- Reworked the connection object and the IO system
- Reworked the support for TRICS - Added a second generation motor
This commit is contained in:
20
danu.c
20
danu.c
@ -95,14 +95,19 @@ static int writeDataNumber(pDataNumber self, int iNum)
|
||||
return 1;
|
||||
}
|
||||
/*------------------- The CallBack function for interest ------------------*/
|
||||
static int InterestCallback(int iEvent, void *pEvent, void *pUser,
|
||||
commandContext cc)
|
||||
static int InterestCallback(int iEvent, void *pEvent, void *pUser)
|
||||
{
|
||||
pDataNumber self = NULL;
|
||||
SConnection *pCon = NULL;
|
||||
char pBueffel[132];
|
||||
int iNum;
|
||||
|
||||
pCon = (SConnection *)pUser;
|
||||
if(pCon == NULL || !SCisConnected(pCon))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(iEvent != VALUECHANGE)
|
||||
{
|
||||
return 1;
|
||||
@ -111,7 +116,6 @@ static int writeDataNumber(pDataNumber self, int iNum)
|
||||
assert(pEvent);
|
||||
assert(pUser);
|
||||
|
||||
pCon = (SConnection *)pUser;
|
||||
self = (pDataNumber)pEvent;
|
||||
|
||||
/*
|
||||
@ -121,7 +125,7 @@ static int writeDataNumber(pDataNumber self, int iNum)
|
||||
if(iNum > 0)
|
||||
{
|
||||
snprintf(pBueffel,131,"sicsdatanumber = %d", iNum);
|
||||
SCWriteInContext(pCon,pBueffel,eValue,cc);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -331,16 +335,16 @@ int NewThousand(pDataNumber self)
|
||||
}
|
||||
if(strcmp(argv[1],"interest") == 0)
|
||||
{
|
||||
lID = RegisterCallback(self->pCall, SCGetContext(pCon),
|
||||
lID = RegisterCallback(self->pCall,
|
||||
VALUECHANGE, InterestCallback,
|
||||
pCon, NULL);
|
||||
SCRegister(pCon,pSics, self->pCall,lID);
|
||||
SCCopyConnection(pCon),
|
||||
SCDeleteConnection);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
if(strcmp(argv[1],"uninterest") == 0)
|
||||
{
|
||||
RemoveCallback2(self->pCall,pCon);
|
||||
RemoveCallbackCon(self->pCall,pCon);
|
||||
SCSendOK(pCon);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user