From 3615c8d60bb399d2e7d9c0799bc456cf23f1c92c Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Tue, 8 Aug 2006 13:25:35 +1000 Subject: [PATCH] Return status so SICs doesn't segfault. r1047 | ffr | 2006-08-08 13:25:35 +1000 (Tue, 08 Aug 2006) | 2 lines --- site_ansto/counterdriv.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/site_ansto/counterdriv.c b/site_ansto/counterdriv.c index 57880bc0..eedfed9c 100644 --- a/site_ansto/counterdriv.c +++ b/site_ansto/counterdriv.c @@ -82,6 +82,7 @@ static int MonGetStatus(CounterDriver *cntrData, float *fControl) { BeamMon *self = NULL; self = (BeamMon *) cntrData->pData; + return HWIdle; } /** \brief Starts counting in the current mode and with the current preset @@ -92,6 +93,7 @@ static int MonStart(CounterDriver *cntrData) { BeamMon *self = NULL; self = (BeamMon *) cntrData->pData; + return SUCCESS; } /** \brief Pauses a counting operation @@ -102,6 +104,7 @@ static int MonPause(CounterDriver *cntrData) { BeamMon *self = NULL; self = (BeamMon *) cntrData->pData; + return SUCCESS; } /* \brief Continues a paused counting operation. @@ -112,6 +115,7 @@ static int MonContinue(CounterDriver *cntrData) { BeamMon *self = NULL; self = (BeamMon *) cntrData->pData; + return SUCCESS; } /** \brief Cancels a counting operation. This is an emergency stop used when interrupting an operation. @@ -121,6 +125,7 @@ static int MonHalt(CounterDriver *cntrData) { BeamMon *self = NULL; self = (BeamMon *) cntrData->pData; + return SUCCESS; } /** \brief Reads the counter and the monitors in the lCounts array. @@ -131,6 +136,7 @@ static int MonReadValues(CounterDriver *cntrData) { BeamMon *self = NULL; self = (BeamMon *) cntrData->pData; + return SUCCESS; } /* \brief Called when an error condition is reported by a counter operation. @@ -144,6 +150,7 @@ static int MonGetError(CounterDriver *cntrData, int *iCode, char *error, int iEr BeamMon *self = NULL; self = (BeamMon *) cntrData->pData; + return SUCCESS; } /* \brief Tries to fix problem associated with iCode error reported by MonGetError. @@ -182,6 +189,7 @@ static int MonSet(CounterDriver *cntrData, char *name, int iCter, float FVal) { //TODO set threshold self->dummy_threshold = FVal; } + return SUCCESS; } static int MonGet(CounterDriver *cntrData, char *name, int iCter, float *fVal) { @@ -193,13 +201,14 @@ static int MonGet(CounterDriver *cntrData, char *name, int iCter, float *fVal) { *fVal = self->dummy_threshold; } - *fVal = 123456789.0; + return SUCCESS; } static int MonSend(CounterDriver *cntrData, char *pText, char *pReply, int iReplyLen) { BeamMon *self = NULL; self = (BeamMon *) cntrData->pData; + return SUCCESS; } static void KillMon(pCounterDriver self) { @@ -221,7 +230,7 @@ static void KillMon(pCounterDriver self) { if (controller==NULL) { snprintf(pError, ERRLEN, "ERROR: failed to create controller for %s at port %d", - controller->pHost, controller->iPort); + host, port); SCWrite(pCon,pError,eError); return NULL; } @@ -255,6 +264,10 @@ static void KillMon(pCounterDriver self) { eError); return NULL; } + newCtr->controller = NULL; + newCtr->host = NULL; + newCtr->iPort = 0; + newCtr->dummy_threshold = 0; pCntDriv = CreateCounterDriver(name, "anstomonitor"); if(!pCntDriv) { free(newCtr);