- Reworked the connection object and the IO system

- Reworked the support for TRICS
- Added a second generation motor
This commit is contained in:
koennecke
2009-02-03 08:05:39 +00:00
parent f6d595665e
commit 361ee9ebea
119 changed files with 16455 additions and 3674 deletions

View File

@ -241,15 +241,19 @@ static int ConfCheckLimits(void *pData, float fVal, char *error, int errLen){
{
free(self->pName);
}
if(self->pCon)
{
SCDeleteConnection(self->pCon);
}
free(self);
}
/*------------------- The CallBack function for interest ------------------
* iEvent: Event ID, see event.h for SICS events
* pEvent: May contain data from event generating object
* pUser: Data available when registering interest, see RegisteredInfo struct
* defined above for available info */
static int InterestCallback(int iEvent, void *pEvent, void *pUser,
commandContext cc)
* defined above for available info
--------------------------------------------------------------------------*/
static int InterestCallback(int iEvent, void *pEvent, void *pUser)
{
pRegisteredInfo pInfo = NULL;
char pBueffel[80];
@ -257,7 +261,11 @@ static int ConfCheckLimits(void *pData, float fVal, char *error, int errLen){
assert(pEvent);
assert(pUser);
if(!SCisConnected(pInfo->pCon)){
return -1;
}
pEventData = (EventInfo *)pEvent;
pInfo = (RegisteredInfo *)pUser;
@ -265,7 +273,7 @@ static int ConfCheckLimits(void *pData, float fVal, char *error, int errLen){
pInfo->lastValue = pEventData->fVal;
(pInfo->pCon)->conEventType=POSITION;
sprintf(pBueffel,"%s.position = %f ", pInfo->pName, pInfo->lastValue);
SCWriteInContext(pInfo->pCon,pBueffel,eEvent,cc);
SCWrite(pInfo->pCon,pBueffel,eEvent);
}
return 1;
}
@ -552,7 +560,7 @@ int ConfigurableVirtualMotorAction(SConnection *pCon, SicsInterp *pSics,
return 0;
}
pRegInfo->pName = strdup(argv[0]);
pRegInfo->pCon = pCon;
pRegInfo->pCon = SCCopyConnection(pCon);
value = ConfGetValue(self,pCon);
if(!iRet)
{
@ -562,8 +570,8 @@ int ConfigurableVirtualMotorAction(SConnection *pCon, SicsInterp *pSics,
}
pRegInfo->lastValue = value;
lID = RegisterCallback(self->pCall, SCGetContext(pCon),MOTDRIVE, InterestCallback, pRegInfo, KillInfo);
SCRegister(pCon,pSics, self->pCall,lID);
lID = RegisterCallback(self->pCall, MOTDRIVE,
InterestCallback, pRegInfo, KillInfo);
SCSendOK(pCon);
return 1;
} else {