From dd1dba8298e06539742829b7de55c7ed666496f1 Mon Sep 17 00:00:00 2001 From: zolliker Date: Tue, 19 Jun 2012 06:55:40 +0000 Subject: [PATCH] - do not check running state for changing evvontroller parameters --- evcontroller.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/evcontroller.c b/evcontroller.c index 85ca22b4..33fb9abc 100644 --- a/evcontroller.c +++ b/evcontroller.c @@ -920,19 +920,32 @@ int EVCGetPar(pEVControl self, char *name, float *fVal) int EVCSetPar(pEVControl self, char *name, float fVal, SConnection * pCon) { ObPar *pPar = NULL; - char pBueffel[512]; int iRet, savedStatus; assert(self); assert(pCon); - savedStatus = GetStatus(); /* fool status check in ObParSet (avoid "Cannot change parameter while running" message */ - SetStatus(eBatch); - iRet = ObParSet(self->pParam, self->pName, name, fVal, pCon); - SetStatus(savedStatus); - if (!iRet) { - return iRet; + /* find the parameter */ + pPar = ObParFind(self->pParam, name); + if (pPar == NULL) { + SCPrintf(pCon, eError, "ERROR: %s.%s parameter not found", + self->pName, name); + return 0; } + + /* DO NOT CHECK RUNNING STATE, this is not needed */ + + /* check permission */ + if (!SCMatchRights(pCon, pPar->iCode)) { + SCPrintf(pCon, eError, "ERROR: Insufficient privilege to change %s.%s", + self->pName, name); + return 0; + } + + /* passed all tests: do It! */ + pPar->fVal = fVal; + + iRet = 1; if (self->iTcl) { iRet = UpdateTclVariable(self->pDriv, name, fVal); }