- Many fixes to the new scriptcontext to make it work
This commit is contained in:
@ -78,6 +78,10 @@ static int SCTDRIVCheckLimits(void *data, float val,
|
||||
if(GetHdbProperty(self->node,"checklimits",script,1024)){
|
||||
status = SctCallInContext(pServ->dummyCon, script,
|
||||
self->node, self->c, &result);
|
||||
if(SctVerbose(self->c)){
|
||||
SCPrintf(pServ->dummyCon, eWarning, "script %s called with result %s\n ",
|
||||
script, result);
|
||||
}
|
||||
if(status == 0){
|
||||
strncpy(error,result,errlen);
|
||||
return 0;
|
||||
@ -102,6 +106,7 @@ static long SCTDRIVSetValue(void *data, SConnection *pCon, float val){
|
||||
self = (pSctDrive)data;
|
||||
v.dataType = HIPFLOAT;
|
||||
v.v.doubleValue = (double)val;
|
||||
SetHdbProperty(self->node,"writestatus", "start");
|
||||
status = SetHipadabaPar(self->node, v, pCon);
|
||||
if(status == 1){
|
||||
return OKOK;
|
||||
@ -125,9 +130,22 @@ static int SCTDRIVCheckStatus(void *data, SConnection *pCon){
|
||||
int status;
|
||||
Tcl_Interp *pTcl = NULL;
|
||||
char *result;
|
||||
SConnection *con;
|
||||
|
||||
self = (pSctDrive)data;
|
||||
|
||||
/*
|
||||
* check if the write command has gone through
|
||||
*/
|
||||
if(GetHdbProperty(self->node,"writestatus", script,1024)){
|
||||
if(strcmp(script,"start") == 0){
|
||||
return HWBusy;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* run the checkstatus script
|
||||
*/
|
||||
if(!GetHdbProperty(self->node,"checkstatus",script,1024)){
|
||||
if (!GetHdbProperty(self->node,"status",script,1024)){
|
||||
SCWrite(pCon,
|
||||
@ -139,11 +157,16 @@ static int SCTDRIVCheckStatus(void *data, SConnection *pCon){
|
||||
status = SctCallInContext(pCon,script, self->node,
|
||||
self->c, &result);
|
||||
if (status == 0) {
|
||||
SCWrite(pCon,result, eError);
|
||||
SCPrintf(pCon,eError," script %s returned %s",
|
||||
script, result);
|
||||
return HWFault;
|
||||
}
|
||||
if(SctVerbose(self->c)){
|
||||
SCPrintf(pCon,eError," script %s returned %s",
|
||||
script, result);
|
||||
}
|
||||
}
|
||||
if(strstr(result,"busy") != NULL){
|
||||
if(strstr(result,"busy") != NULL){
|
||||
return HWBusy;
|
||||
} else if(strstr(result,"posfault") != NULL){
|
||||
return HWPosFault;
|
||||
|
Reference in New Issue
Block a user