Fix for multicountersec coordination issues implemented

This commit is contained in:
2015-06-26 11:32:05 +02:00
parent 766c8bbb73
commit 7643c51d74
2 changed files with 91 additions and 8 deletions

View File

@ -77,7 +77,7 @@ static int SecStartCount(void *pData, SConnection *pCon)
}
statusNode = GetHipadabaNode(self->pDes->parNode, "status");
UpdateHipadabaPar(statusNode,MakeHdbText("run"), pCon);
UpdateHipadabaPar(statusNode,MakeHdbText("starting"), pCon);
status = SecCtrInvokeFunction(self,pCon, START);
self->haltFixFlag = 0;
if(status == 1){
@ -150,6 +150,8 @@ static int SecCtrCheckStatus(void *pData, SConnection *pCon)
status = HWIdle;
} else if (strstr(v.v.text, "run") != NULL) {
status = HWBusy;
} else if (strstr(v.v.text, "starting") != NULL) {
status = HWBusy;
} else if (strstr(v.v.text, "nobeam") != NULL) {
status = HWNoBeam;
} else if (strstr(v.v.text, "pause") != NULL) {
@ -559,6 +561,28 @@ static int CountStatusCmd(pSICSOBJ ccmd, SConnection * con,
return 1;
}
/*--------------------------------------------------------------------------
Disallows status changes from starting to anything else but run or
error
----------------------------------------------------------------------------*/
static hdbCallbackReturn SecStatusCallback(pHdb node, void *userData,
pHdbMessage message)
{
pHdbDataMessage mm = NULL;
hdbValue v;
mm = GetHdbUpdateMessage(message);
if (mm != NULL) {
if(strcmp(node->value.v.text,"starting") == 0) {
v = *mm->v;
if(strstr(v.v.text,"run") == 0 && strstr(v.v.text,"error") == 0) {
return hdbAbort;
}
}
}
return hdbContinue;
}
/*--------------------------------------------------------------------------*/
pCounter CreateSecCounter(SConnection *pCon, char *type, char *name, int length)
{
@ -644,6 +668,9 @@ pCounter CreateSecCounter(SConnection *pCon, char *type, char *name, int length)
if (child == NULL) {
return NULL;
}
AppendHipadabaCallback(child,
MakeHipadabaCallback(SecStatusCallback, NULL,
NULL));
AddHipadabaChild(node, child, NULL);
child = MakeSICSHdbPar("error", usInternal, MakeHdbText("None"));