restore RemoveCallback3 as RemoveCallbackUsr to get (un)interest working again

This commit is contained in:
Douglas Clowes
2013-05-17 15:23:49 +10:00
parent 041735a969
commit 55d3c34a24
4 changed files with 54 additions and 8 deletions

View File

@ -36,9 +36,10 @@
#include "confvirtmot.i"
#define BAD_VALUE (-9999.99)
extern double DoubleTime(void);
extern char *stptok(char *s, char *t, int len, char *brk);
extern int CheckMotiMatch(const void* context, const void* pUserData);
extern double DoubleTime(void);
/*---------------------------------------------------------------------------
An internal data structure which holds information required to control
@ -299,13 +300,13 @@ static int InterestCallback(int iEvent, void *pEvent, void *pUser)
assert(pEvent);
assert(pUser);
pEventData = (EventInfo *) pEvent;
pInfo = (RegisteredInfo *) pUser;
if (!SCisConnected(pInfo->pCon)) {
return -1;
}
pEventData = (EventInfo *) pEvent;
pInfo = (RegisteredInfo *) pUser;
if (pInfo->lastValue != pEventData->fVal) {
pInfo->lastValue = pEventData->fVal;
(pInfo->pCon)->conEventType = POSITION;
@ -713,13 +714,13 @@ int ConfigurableVirtualMotorAction(SConnection * pCon, SicsInterp * pSics,
}
pRegInfo->lastValue = value;
RemoveCallbackCon(self->pCall, pCon);
RemoveCallbackUsr(self->pCall, InterestCallback, CheckMotiMatch, pCon); /* only this one */
lID = RegisterCallback(self->pCall, MOTDRIVE,
InterestCallback, pRegInfo, KillInfo);
SCSendOK(pCon);
return 1;
} else if(strcmp(argv[1],"uninterest") == 0) {
RemoveCallbackCon(self->pCall, pCon);
RemoveCallbackUsr(self->pCall, InterestCallback, CheckMotiMatch, pCon);
SCSendOK(pCon);
return 1;
} else {