- 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

@ -96,6 +96,10 @@
self = (pCounter)pData;
assert(self);
if(!GetCountLock(self->pCountInt, pCon)){
return 0;
}
/* try at least three times to do it */
for(i = 0; i < 3; i++)
{
@ -118,12 +122,14 @@
{
SCWrite(pCon,"ERROR: Cannot fix counter problem, aborting",eError);
SCSetInterrupt(pCon,eAbortBatch);
ReleaseCountLock(self->pCountInt);
return HWFault;
}
}
}
SCWrite(pCon,"ERROR: Cannot fix counter problem, aborting",eError);
SCSetInterrupt(pCon,eAbortBatch);
ReleaseCountLock(self->pCountInt);
return HWFault;
}
/*-----------------------------------------------------------------------*/
@ -235,6 +241,7 @@
SCWrite(pCon,"ERROR: Cannot fix counter problem, aborting",eError);
SCSetInterrupt(pCon,eAbortBatch);
InvokeCallBack(self->pCall,COUNTEND,NULL);
ReleaseCountLock(self->pCountInt);
return eCt;
}
else
@ -267,6 +274,7 @@
if(eCt == HWIdle)
{
InvokeCallBack(self->pCall,COUNTEND,NULL);
ReleaseCountLock(self->pCountInt);
}
return eCt;
}
@ -462,7 +470,7 @@
if(!iRet)
{
SetStatus(eOld);
SCWrite(pCon,"Counting aborted",eStatus);
SCWrite(pCon,"Counting aborted",eError);
return 0;
}
@ -476,16 +484,16 @@
iRet = Wait4Success(GetExecutor());
if(iRet == DEVINT)
{
SCWrite(pCon,"Counting aborted due to Interrupt",eStatus);
SCWrite(pCon,"Counting aborted due to Interrupt",eError);
}
else if(iRet == DEVERROR)
{
SCWrite(pCon,"Counting finished with Problems",eStatus);
SCWrite(pCon,"Counting finished with Problems",eError);
iRet = 1;
}
else
{
SCWrite(pCon,"Counting finished",eStatus);
SCWrite(pCon,"Counting finished",eValue);
iRet = 1;
}
SetStatus(eOld);
@ -715,15 +723,18 @@
return 1;
}
/*-----------------------------------------------------------------------*/
static int CounterInterest(int iEvent, void *pEvent, void *pUser,
commandContext cc)
static int CounterInterest(int iEvent, void *pEvent, void *pUser)
{
SConnection *pCon = NULL;
pMonEvent pMon = NULL;
char pBueffel[512];
int rights;
if(iEvent != MONITOR)
if(pCon == NULL || !SCisConnected(pCon)){
return -1;
}
if(iEvent != MONITOR || pCon == NULL)
{
return 0;
}
@ -737,10 +748,8 @@
/**
* prevent this to be written to log files
*/
rights = SCGetRights(pCon);
SCSetRights(pCon,usSpy);
SCWriteInContext(pCon,pBueffel,eWarning,cc);
SCSetRights(pCon,rights);
SCWrite(pCon,pBueffel,eWarning);
return 1;
}
/*-----------------------------------------------------------------------*/
@ -817,6 +826,10 @@
return 1;
break;
case 2: /* Set Preset */
if(isRunning(self->pCountInt)){
SCWrite(pCon,"ERROR: cannot change preset while counting", eError);
return 0;
}
if(isAuthorised(pCon,usUser))
{
iRet2 = SetCounterPreset(self,PaRes.Arg[0].fVal);
@ -844,6 +857,10 @@
return 1;
break;
case 4: /* Set Mode */
if(isRunning(self->pCountInt)){
SCWrite(pCon,"ERROR: cannot change mode while counting", eError);
return 0;
}
if(isAuthorised(pCon,usUser))
{
if(strcmp(PaRes.Arg[0].text,"timer") == 0)
@ -905,13 +922,13 @@
SCWrite(pCon,pBueffel,eValue);
return 1;
case 9: /* interest */
lID = RegisterCallback(self->pCall, SCGetContext(pCon), MONITOR, CounterInterest,
pCon, NULL);
SCRegister(pCon,pSics, self->pCall,lID);
lID = RegisterCallback(self->pCall, MONITOR, CounterInterest,
SCCopyConnection(pCon),
SCDeleteConnection);
SCSendOK(pCon);
return 1;
case 10: /* uninterest */
RemoveCallback2(self->pCall,pCon);
RemoveCallbackCon(self->pCall,pCon);
SCSendOK(pCon);
return 1;
case 11: /* status */
@ -1008,6 +1025,10 @@
/* mode */
if(PaRes.Arg[0].iVal) /* set case */
{
if(isRunning(self->pCountInt)){
SCWrite(pCon,"ERROR: cannot change mode while counting",eError);
return 0;
}
if(isAuthorised(pCon,usUser))
{
if(strcmp(PaRes.Arg[0].text,"timer") == 0)
@ -1053,6 +1074,10 @@
case 18: /* preset */
if(PaRes.Arg[0].iVal) /* set case */
{
if(isRunning(self->pCountInt)){
SCWrite(pCon,"ERROR: cannot set preset while counting", eError);
return 0;
}
if(isAuthorised(pCon,usUser))
{
iRet2 = SetCounterPreset(self,PaRes.Arg[0].fVal);
@ -1095,6 +1120,10 @@
}
break;
case 20: /* setpar*/
if(isRunning(self->pCountInt)){
SCWrite(pCon,"ERROR: cannot change parameters while counting", eError);
return 0;
}
if(!SCMatchRights(pCon,usMugger))
{
return 0;