diff --git a/site_ansto/counterdriv.c b/site_ansto/counterdriv.c index 105042de..73af2d41 100644 --- a/site_ansto/counterdriv.c +++ b/site_ansto/counterdriv.c @@ -63,9 +63,7 @@ typedef struct { prs232 controller; char *host; int iPort; - int iChannel; - void *pData; - int finishCount; + float dummy_threshold; } BeamMon; /** \brief Returns the counter status, @@ -171,13 +169,22 @@ static int MonTryAndFixIt(CounterDriver *cntrData, int iCode) { static int MonSet(CounterDriver *cntrData, char *name, int iCter, float FVal) { BeamMon *self = NULL; - self = (BeamMon *) cntrData; + self = cntrData->pData; + if(strcmp(name,"threshold") == 0){ + //TODO set threshold + self->dummy_threshold = FVal; + } } static int MonGet(CounterDriver *cntrData, char *name, int iCter, float *fVal) { BeamMon *self = NULL; - self = (BeamMon *) cntrData; + self = cntrData->pData; + if(strcmp(name,"threshold") == 0){ + //TODO get threshold + *fVal = self->dummy_threshold; + } + *fVal = 123456789.0; } @@ -240,7 +247,7 @@ static void KillMon(pCounterDriver self) { eError); return NULL; } - pCntDriv = CreateCounterDriver(name, "MONITOR"); + pCntDriv = CreateCounterDriver(name, "anstomonitor"); if(!pCntDriv) { free(newCtr); return NULL; @@ -271,6 +278,7 @@ static void KillMon(pCounterDriver self) { strncpy(buffer,pPtr, 131); newCtr->controller = MonConnect(pCon, buffer, port); + newCtr->dummy_threshold = 1.7e6; return pCntDriv; } diff --git a/site_ansto/site_ansto.c b/site_ansto/site_ansto.c index a4eb58ae..088e17eb 100644 --- a/site_ansto/site_ansto.c +++ b/site_ansto/site_ansto.c @@ -24,6 +24,9 @@ /* Added code for new LH45 and Lakeshore 340 drivers */ #include "lh45.h" #include "lakeshore340.h" + +/*@observer@*//*@null@*/ pCounterDriver CreateMonCounter(/*@observer@*/SConnection *pCon, /*@observer@*/char *name, char *params); + /* from tcpdornier.c */ @@ -104,17 +107,15 @@ static void RemoveCommands(SicsInterp *pSics){ static pCounterDriver CreateCounterDriverAnsto(SConnection *pCon, int argc, char *argv[]){ - pCounterDriver pNew = NULL; - if(strcmp(argv[2],"nitio10") == 0){ - if(argc < 4){ - SCWrite(pCon, - "ERROR:SITE: Insufficient arguments for NITIO10 counter", - eError); - return NULL; - } -/* pNew = CreateCtrNitio10(pCon,argv[1],argc-3,&argv[3]);*/ + pCounterDriver pDriver = NULL; + strtolower(argv[2]); + if(strcmp(argv[2],"anstomonitor") == 0) { + pDriver = CreateMonCounter(pCon, argv[1], argv[3]); } - return pNew; + if(!pDriver){ + return NULL; + } + return pDriver; } /*-------------------------------------------------------------------*/ static HistDriver *CreateHistMem(char *name, pStringDict pOptions){