- Added Sycamore protocol and command context to SICS

- Added sinfo to SICS
- Added driver for TCP/IP Astrium velocity selector
- Added driver for TCP/IP Astrium chopper controller
This commit is contained in:
koennecke
2005-12-22 22:16:13 +00:00
parent 6b224a4520
commit a5f315b56a
22 changed files with 2225 additions and 90 deletions

View File

@ -50,7 +50,8 @@
static int iTOF = 0;
static pHistMem pHMHM = NULL;
/*-------------------------------------------------------------------------*/
static int HMCountStartCallback(int iEvent, void *pEvent, void *pUser)
static int HMCountStartCallback(int iEvent, void *pEvent, void *pUser,
commandContext cc)
{
SConnection *pCon = (SConnection *)pUser;
const float *fTime = NULL;
@ -75,15 +76,18 @@
iTime[i+1] = htonl((int)((fTime[i]/10.)*65536.));
}
/* send new time binning to all clients */
SCPushContext2(pCon,cc);
SCWrite(pCon,"TOFClear",eError);
SCWriteUUencoded(pCon,"arrowaxis_time",iTime,
(iLength+1)*sizeof(int));
SCPopContext(pCon);
free(iTime);
}
return 1;
}
/*-------------------------------------------------------------------------*/
static int ScanStartCallback(int iEvent, void *pEvent, void *pUser)
static int ScanStartCallback(int iEvent, void *pEvent, void *pUser,
commandContext cc)
{
float *fAxis = NULL;
int *iAxis = NULL;
@ -116,16 +120,19 @@
iAxis[i+1] = htonl((int)(fAxis[i]*65536.));
}
/* send new axis to client */
SCPushContext2(pCon,cc);
SCWrite(pCon,"SCANClear",eError);
SCWriteUUencoded(pCon,pBueffel,iAxis,
(iLength+1)*sizeof(int));
SCPopContext(pCon);
free(iAxis);
free(fAxis);
}
return 1;
}
/*------------------------------------------------------------------------*/
static int ScanPointCallback(int iEvent, void *pEvent, void *pUser)
static int ScanPointCallback(int iEvent, void *pEvent, void *pUser,
commandContext cc)
{
long *lData = NULL;
int *iData = NULL;
@ -155,6 +162,7 @@
iData[i+1] = htonl((int)(lData[i]));
}
/* send counts to client */
SCPushContext2(pCon,cc);
SCWriteUUencoded(pCon,"arrow_spinupup",iData,
(iLength+1)*sizeof(int));
/* send counts for other detector */
@ -166,6 +174,7 @@
SCWriteUUencoded(pCon,"arrow_spinuplo",iData,
(iLength+1)*sizeof(int));
/* to do: check for polarization and send spinlo */
SCPopContext(pCon);
free(iData);
free(lData);
}
@ -201,7 +210,8 @@
return 0;
}
/*------------------------------------------------------------------------*/
static int LoadCallback(int iEvent, void *pEvent, void *pUser)
static int LoadCallback(int iEvent, void *pEvent, void *pUser,
commandContext cc)
{
pAmorStat pAS = NULL;
SConnection *pCon = NULL;
@ -212,7 +222,9 @@
pCon = (SConnection *)pUser;
assert(pAS);
assert(pCon);
SendLoadedData(pAS,pCon);
SCPushContext2(pCon,cc);
SendLoadedData(pAS,pCon);
SCPopContext(pCon);
}
return 1;
}
@ -378,6 +390,7 @@
long lID;
pDummy pDum = NULL;
pICallBack pCall = NULL;
commandContext comCon;
assert(self);
assert(pCon);
@ -386,8 +399,9 @@
iTOF invoke the apropriate callbacks in order to force
an initial update.
*/
comCon = SCGetContext(pCon);
/* file load callback */
lID = RegisterCallback(self->pCall, FILELOADED, LoadCallback,
lID = RegisterCallback(self->pCall, comCon,FILELOADED, LoadCallback,
pCon, NULL);
SCRegister(pCon,pServ->pSics, self->pCall,lID);
SendLoadedData(self,pCon);
@ -397,31 +411,31 @@
pCall = pDum->pDescriptor->GetInterface(pDum,CALLBACKINTERFACE);
if(pCall)
{
lID = RegisterCallback(pCall,SCANSTART,ScanStartCallback,
lID = RegisterCallback(pCall,comCon,SCANSTART,ScanStartCallback,
pCon, NULL);
SCRegister(pCon,pServ->pSics,pCall,lID);
lID = RegisterCallback(pCall,SCANPOINT,ScanPointCallback,
lID = RegisterCallback(pCall,comCon,SCANPOINT,ScanPointCallback,
pCon, NULL);
SCRegister(pCon,pServ->pSics,pCall,lID);
lID = RegisterCallback(pCall,SCANEND,ScanPointCallback,
lID = RegisterCallback(pCall,comCon,SCANEND,ScanPointCallback,
pCon, NULL);
SCRegister(pCon,pServ->pSics,pCall,lID);
if(iTOF == 0)
{
ScanStartCallback(SCANSTART,pDum,pCon);
ScanPointCallback(SCANPOINT,pDum,pCon);
ScanStartCallback(SCANSTART,pDum,pCon,SCGetContext(pCon));
ScanPointCallback(SCANPOINT,pDum,pCon,SCGetContext(pCon));
}
}
pDum = (pDummy)self->pHM;
pCall = pDum->pDescriptor->GetInterface(pDum,CALLBACKINTERFACE);
if(pCall)
{
lID = RegisterCallback(pCall,COUNTSTART,HMCountStartCallback,
lID = RegisterCallback(pCall,comCon,COUNTSTART,HMCountStartCallback,
pCon, NULL);
SCRegister(pCon,pServ->pSics,pCall,lID);
if(iTOF == 1)
{
HMCountStartCallback(COUNTSTART,pDum,pCon);
HMCountStartCallback(COUNTSTART,pDum,pCon,SCGetContext(pCon));
}
}
return 1;
@ -1001,7 +1015,7 @@
}
else if(strcmp(argv[1],"tofmode") == 0)
{
HMCountStartCallback(COUNTSTART,NULL,pCon);
HMCountStartCallback(COUNTSTART,NULL,pCon,SCGetContext(pCon));
return 1;
}
else