restore RemoveCallback3 as RemoveCallbackUsr to get (un)interest working again
This commit is contained in:
18
motor.c
18
motor.c
@ -1215,6 +1215,20 @@ static int EndScriptCallback(int iEvent, void *pEvent, void *pUser)
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/*
|
||||
* Context test function for callback removal
|
||||
*/
|
||||
int CheckMotiMatch(const void* context, const void* pUserData)
|
||||
{
|
||||
pMotInfo pMoti = (pMotInfo) pUserData;
|
||||
SConnection *pCon = (SConnection*) context;
|
||||
if (VerifyConnection(pCon) && VerifyConnection(pMoti->pCon)) {
|
||||
if (pMoti->pCon->ident == pCon->ident)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
The wrapper function for a motor. Commands currently supported are:
|
||||
|
||||
@ -1306,14 +1320,14 @@ int MotorAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
pMoti->lastValue = fValue;
|
||||
|
||||
RemoveCallbackCon(self->pCall, pCon);
|
||||
RemoveCallbackUsr(self->pCall, InterestCallback, CheckMotiMatch, pCon); /* only this one */
|
||||
lID = RegisterCallback(self->pCall, MOTDRIVE, InterestCallback,
|
||||
pMoti, KillInfo);
|
||||
DeleteTokenList(pList);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else if (strcmp(pCurrent->text, "uninterest") == 0) {
|
||||
RemoveCallbackCon(self->pCall, pCon);
|
||||
RemoveCallbackUsr(self->pCall, InterestCallback, CheckMotiMatch, pCon); /* only this one */
|
||||
SCSendOK(pCon);
|
||||
DeleteTokenList(pList);
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user