From abafa6a2e6f8a226fce884e656215b5297f46b62 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 16 May 2014 11:18:20 +1000 Subject: [PATCH] Change obsoleted eStatus logging to eLog or eValue --- site_ansto/fsm.c | 12 +-- site_ansto/ls340.c | 28 +++--- site_ansto/lssmonitor.c | 24 ++--- site_ansto/motor_asim.c | 12 +-- site_ansto/motor_dmc2280.c | 182 ++++++++++++++++++------------------- site_ansto/orhvps.c | 6 +- site_ansto/site_ansto.c | 24 ++--- 7 files changed, 144 insertions(+), 144 deletions(-) diff --git a/site_ansto/fsm.c b/site_ansto/fsm.c index 869e8396..da80f229 100644 --- a/site_ansto/fsm.c +++ b/site_ansto/fsm.c @@ -31,7 +31,7 @@ static void report_event(pStateMachine self, pEvtEvent event) { self->state_name ? self->state_name(self->myState) : "", self->mySubState, self->event_name ? self->event_name(event, text, sizeof(text)) : ""); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } static void handle_event(pStateMachine self, pEvtEvent event) { @@ -50,8 +50,8 @@ int fsm_msg_callback(pAsyncTxn pCmd) if (self->debug) { char line[1024]; fsm_textify(pCmd->out_buf, pCmd->out_len, line, sizeof(line)); - SICSLogWrite(line, eStatus); - SICSLogWrite("", eStatus); + SICSLogWrite(line, eLog); + SICSLogWrite("", eLog); } event.event_type = eTimeoutEvent; event.event.msg.cmd = pCmd; @@ -60,9 +60,9 @@ int fsm_msg_callback(pAsyncTxn pCmd) if (self->debug) { char line[1024]; fsm_textify(pCmd->out_buf, pCmd->out_len, line, sizeof(line)); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); fsm_textify(pCmd->inp_buf, pCmd->inp_idx, line, sizeof(line)); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } event.event_type = eMessageEvent; event.event.msg.cmd = pCmd; @@ -99,7 +99,7 @@ void fsm_change_state(pStateMachine self, StateFunc func) { self->state_name ? self->state_name(self->myState) : "", self->mySubState, self->state_name ? self->state_name(func) : ""); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } self->myPrevState = self->myState; self->myState = func; diff --git a/site_ansto/ls340.c b/site_ansto/ls340.c index b44bccaf..ebd993c5 100644 --- a/site_ansto/ls340.c +++ b/site_ansto/ls340.c @@ -256,7 +256,7 @@ static void LS340State_Unknown(pStateMachine sm, pEvtEvent event) { char line[132]; *p = '\0'; sprintf(line, "IDN: %s", pCmd->inp_buf); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } #if 0 sprintf(cmd, "RANGE 0"); /* ensure heater is off */ @@ -281,7 +281,7 @@ static void LS340State_Unknown(pStateMachine sm, pEvtEvent event) { *p = '\0'; sprintf(line, "CLIMIT (Unknown): %s", pCmd->inp_buf); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); sscanf(pCmd->inp_buf, "%f,%f,%f,%d,%d", &priv->fSetPointLimit, &priv->fPosSlope, &priv->fNegSlope, &priv->iMaxCurrent, &priv->iMaxRange); } @@ -302,7 +302,7 @@ static void LS340State_Unknown(pStateMachine sm, pEvtEvent event) { *p = '\0'; sprintf(line, "SETP: %s", pCmd->inp_buf); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); sscanf(pCmd->inp_buf, "%f", &priv->fSetPoint); priv->fTarget = priv->fSetPoint; /* Set target and setpoints to current values from controller */ } @@ -326,7 +326,7 @@ static void LS340State_Unknown(pStateMachine sm, pEvtEvent event) { priv->fValue = priv->fSensorValues[sm->mySubState-4]; } sprintf(line, "KRDG? (Unknown) sensor %s = %8.2f", priv->cValidSensors[sm->mySubState-4], priv->fSensorValues[sm->mySubState-4]); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } if (sm->mySubState >= priv->iNumSensors+3) { @@ -385,7 +385,7 @@ static void LS340State_Idle(pStateMachine sm, pEvtEvent event){ *p = '\0'; sprintf(line, "CLIMIT (Idle): %s", pCmd->inp_buf); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); sscanf(pCmd->inp_buf, "%f,%f,%f,%d,%d", &priv->fSetPointLimit, &priv->fPosSlope, &priv->fNegSlope, &priv->iMaxCurrent, &priv->iMaxRange); } @@ -401,7 +401,7 @@ static void LS340State_Idle(pStateMachine sm, pEvtEvent event){ priv->fSensorValues[sm->mySubState-2] = atof(pCmd->inp_buf); if (sm->mySubState-2 == priv->iCtrlSens) priv->fValue = priv->fSensorValues[sm->mySubState-2]; sprintf(line, "KRDG? (Idle) sensor %s = %8.2f", priv->cValidSensors[sm->mySubState-2], priv->fSensorValues[sm->mySubState-2]); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } if (sm->mySubState >= priv->iNumSensors+1) { @@ -421,7 +421,7 @@ static void LS340State_Idle(pStateMachine sm, pEvtEvent event){ if (priv->controller) { char line[132]; sprintf(line, "LS340 eMode: = %d", priv->controller->eMode); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } @@ -449,7 +449,7 @@ static void LS340State_Idle(pStateMachine sm, pEvtEvent event){ sprintf(cmd, "KRDG? %s", priv->cValidSensors[sm->mySubState-2]); LS340_SendCmd(priv, cmd, strlen(cmd), fsm_msg_callback); sprintf(line, "eTimerEvent (Idle): Sent: %s", cmd); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } /* restart timer */ @@ -502,7 +502,7 @@ static void LS340State_Raising(pStateMachine sm, pEvtEvent event){ *p = '\0'; sprintf(line, "CLIMIT (Raising): %s", pCmd->inp_buf); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); sscanf(pCmd->inp_buf, "%f,%f,%f,%d,%d", &priv->fSetPointLimit, &priv->fPosSlope, &priv->fNegSlope, &priv->iMaxCurrent, &priv->iMaxRange); } @@ -519,7 +519,7 @@ static void LS340State_Raising(pStateMachine sm, pEvtEvent event){ priv->fSensorValues[sm->mySubState-2] = atof(pCmd->inp_buf); if (sm->mySubState-2 == priv->iCtrlSens) priv->fValue = priv->fSensorValues[sm->mySubState-2]; sprintf(line, "KRDG? (Raising) sensor %s = %8.2f", priv->cValidSensors[sm->mySubState-2], priv->fSensorValues[sm->mySubState-2]); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } @@ -600,7 +600,7 @@ static void LS340State_Lowering(pStateMachine sm, pEvtEvent event){ *p = '\0'; sprintf(line, "CLIMIT (lowering): %s", pCmd->inp_buf); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); sscanf(pCmd->inp_buf, "%f,%f,%f,%d,%d", &priv->fSetPointLimit, &priv->fPosSlope, &priv->fNegSlope, &priv->iMaxCurrent, &priv->iMaxRange); } @@ -618,7 +618,7 @@ static void LS340State_Lowering(pStateMachine sm, pEvtEvent event){ priv->fSensorValues[sm->mySubState-2] = atof(pCmd->inp_buf); if (sm->mySubState-2 == priv->iCtrlSens) priv->fValue = priv->fSensorValues[sm->mySubState-2]; sprintf(line, "KRDG? (Lowering) sensor %s = %8.2f", priv->cValidSensors[sm->mySubState-2], priv->fSensorValues[sm->mySubState-2]); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } @@ -760,12 +760,12 @@ static void LS340Notify(void* context, int event) switch (event) { case AQU_DISCONNECT: snprintf(line, 132, "Disconnect on Device '%s'", self->name); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); /* TODO: disconnect */ break; case AQU_RECONNECT: snprintf(line, 132, "Reconnect on Device '%s'", self->name); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); /* TODO: reconnect */ if (self->has_fsm) { /* Reset the state machine */ diff --git a/site_ansto/lssmonitor.c b/site_ansto/lssmonitor.c index af2f092d..68e998f2 100644 --- a/site_ansto/lssmonitor.c +++ b/site_ansto/lssmonitor.c @@ -167,7 +167,7 @@ static void LSS_Notify(void* context, int event) char line[132]; sprintf(line, "LSS_Notify: (AQU_RECONNECT)%d [%d]", AQU_RECONNECT, event); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); pLSSController self = (pLSSController) context; @@ -233,7 +233,7 @@ static mxml_type_t xmlLoadStringCallback(mxml_node_t *node) { } */ sprintf(line, "xmlLoadStringCallback: [%s] [%s] [%s] [%s] [%s] [%s]", node->value.element.name, type, mxmlElementGetAttr(node, "description"), mxmlElementGetAttr(node, "time"), mxmlElementGetAttr(node, "tag"), value); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); return myType; } @@ -257,12 +257,12 @@ static int GetCallback(pAsyncTxn txn) pLSSController self = (pLSSController) txn->cntx; if (resp_len <= 0) { snprintf(line, 132, "lss1 = NO INPUT!!"); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); return 1; } else { snprintf(line, 132, "lss1 = [%d] [%s]", strlen(resp), resp); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); /* free memory from previous tree */ @@ -300,7 +300,7 @@ static int MyOneShotCallback(void* context, int mode) self->oneshot = 0; AsyncUnitSendTxn(self->unit, "WRITE 0", 7, NULL, NULL, 132); sprintf(line, "lssmonitor.c: MyOneShotCallback() -> AsyncUnitSendTxn( WRITE ) "); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); return 0; } @@ -320,7 +320,7 @@ static int MyTimerCallback(void* context, int mode) AsyncUnitSendTxn(self->unit, "READ", 4, GetCallback, self, 1024*1024); sprintf(line, "lssmonitor.c: MyTimerCallback() -> AsyncUnitSendTxn(READ 1MB)"); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); return 1; } @@ -339,7 +339,7 @@ static int PutCallback(pAsyncTxn txn) sprintf(line, "lssmonitor.c: PutCallback() -> RegisterTimer "); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); return 0; } @@ -375,7 +375,7 @@ static int LSS_Print(SConnection *pCon, SicsInterp *pSics, return 0; } else { snprintf(line, 132, "%s.%s = %s", name, param, lss_states[state]); - SCWrite(pCon, line, eStatus); + SCWrite(pCon, line, eLog); return OKOK; } } @@ -392,13 +392,13 @@ static int findElement(SConnection *pCon, const char *string) { if (mxmlElementGetAttr(n, "version") == NULL) { if (strcasestr(mxmlElementGetAttr(n, "description"), string) != NULL) { snprintf(line, 132, "%s.%s %s = %s (%s)", string, mxmlElementGetAttr(n, "description"), mxmlElementGetAttr(n, "tag"), n->child->value.text.string, mxmlElementGetAttr(n, "time")); - SCWrite(pCon, line, eStatus); + SCWrite(pCon, line, eLog); found = 1; } if (strcasestr(mxmlElementGetAttr(n, "tag"), string) != NULL) { snprintf(line, 132, "%s.%s %s = %s (%s)", string, mxmlElementGetAttr(n, "description"), mxmlElementGetAttr(n, "tag"), n->child->value.text.string, mxmlElementGetAttr(n, "time")); - SCWrite(pCon, line, eStatus); + SCWrite(pCon, line, eLog); found = 1; } } else { @@ -421,7 +421,7 @@ static int LSS_Action(SConnection *pCon, SicsInterp *pSics, pLSSController self = (pLSSController) pData; if (argc == 1) { snprintf(line, 132, "%s.iValue = %06X", argv[0], self->iValue & 0xffffff); - SCWrite(pCon, line, eStatus); + SCWrite(pCon, line, eLog); return OKOK; } else if (argc == 2) { @@ -434,7 +434,7 @@ static int LSS_Action(SConnection *pCon, SicsInterp *pSics, if (mxmlElementGetAttr(node, "version") == NULL) { snprintf(line, 132, "%s.%s %s = %s (%s)", argv[0], mxmlElementGetAttr(node, "description"), mxmlElementGetAttr(node, "tag"), node->child->value.text.string, mxmlElementGetAttr(node, "time")); - SCWrite(pCon, line, eStatus); + SCWrite(pCon, line, eLog); } } } diff --git a/site_ansto/motor_asim.c b/site_ansto/motor_asim.c index 4fc3194c..e27620c0 100644 --- a/site_ansto/motor_asim.c +++ b/site_ansto/motor_asim.c @@ -569,11 +569,11 @@ static void SimStrList(pASIMDriv self, char *name, SConnection *pCon){ char buffer[BUFFLEN]; snprintf(buffer, BUFFLEN, "%s.part = %s\n", name, self->part); - SCWrite(pCon, buffer, eStatus); + SCWrite(pCon, buffer, eValue); snprintf(buffer, BUFFLEN, "%s.long_name = %s\n", name, self->long_name); - SCWrite(pCon, buffer, eStatus); + SCWrite(pCon, buffer, eValue); snprintf(buffer, BUFFLEN, "%s.units = %s\n", name, self->units); - SCWrite(pCon, buffer, eStatus); + SCWrite(pCon, buffer, eValue); return; } @@ -646,7 +646,7 @@ int SimAction(SConnection *pCon, SicsInterp *pSics, void *pData, else { char buffer[BUFFLEN]; snprintf(buffer, BUFFLEN, "%s.setPos = %f\n", argv[0], oldZero); - SCWrite(pCon, buffer, eStatus); + SCWrite(pCon, buffer, eValue); return 1; } newZero = (currPos - newValue); @@ -667,12 +667,12 @@ int SimAction(SConnection *pCon, SicsInterp *pSics, void *pData, else if(strcasecmp("thread0", argv[1]) == 0) { char line[132]; snprintf(line, 132, "%s.thread0 = %d", argv[0], 1); - SCWrite(pCon, line, eStatus); + SCWrite(pCon, line, eValue); return 1; } else if(strcasecmp("posit", argv[1]) == 0) { char line[132]; snprintf(line, 132, "%s.posit = %f", argv[0], 1.0); - SCWrite(pCon, line, eStatus); + SCWrite(pCon, line, eValue); return 1; } } diff --git a/site_ansto/motor_dmc2280.c b/site_ansto/motor_dmc2280.c index 2b34af15..1210fd2a 100644 --- a/site_ansto/motor_dmc2280.c +++ b/site_ansto/motor_dmc2280.c @@ -541,7 +541,7 @@ static long long unit2count(pDMC2280Driv self, double target) { char line[CMDLEN]; snprintf(line, CMDLEN, "unit2count motor %s has no absolute encoder", self->name); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); return -1; } /* distance of target from home in units */ @@ -559,7 +559,7 @@ static long long unit2count(pDMC2280Driv self, double target) { if (self->debug) { char line[CMDLEN]; snprintf(line, CMDLEN, "unit2count Rounding %f to %lld", absolute, result); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } return result; } @@ -570,7 +570,7 @@ static double count2unit(pDMC2280Driv self, long long counts) { char line[CMDLEN]; snprintf(line, CMDLEN, "unit2count motor %s has no absolute encoder", self->name); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); return -1; } fPos = (counts - self->absEncHome) / self->cntsPerX + self->fHome; @@ -720,7 +720,7 @@ static int motAbsol(pDMC2280Driv self, double target) { if (self->debug) { char line[CMDLEN]; snprintf(line, CMDLEN, "motAbsol Rounding %f to %d", absolute, result); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } return result; } @@ -781,7 +781,7 @@ static int motCreep(pDMC2280Driv self, double target) { char line[CMDLEN]; snprintf(line, CMDLEN, "Motor=%s creep stopped, stepcount = %d", self->name, self->stepCount); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } iRet = 1; } @@ -800,7 +800,7 @@ static int motCreep(pDMC2280Driv self, double target) { char line[CMDLEN]; snprintf(line, CMDLEN, "CREEP: cur=%d, target=%d, offset=%d, new=%d", self->currSteps, target_steps, offset, self->currSteps + offset); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } /* * We don't want to handle each case separately, so fold negative into positive case @@ -845,13 +845,13 @@ static int motCreep(pDMC2280Driv self, double target) { char line[CMDLEN]; snprintf(line, CMDLEN, "CREEP: Motor=%s, preseek=%d, creep_val=%d, cur_steps=%d", self->name, self->preseek, self->creep_val, self->currSteps); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); snprintf(line, CMDLEN, "CREEP: Motor=%s, fPreseek=%f, fTarget=%f, target=%f, tgt_steps=%d", self->name, self->fPreseek, self->fTarget, target, target_steps); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); snprintf(line, CMDLEN, "CREEP: cur=%d, target=%d, offset=%d, new=%d", self->currSteps, target_steps, offset, self->currSteps + offset); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } /* * The new absolute step target is the current step position plus @@ -927,7 +927,7 @@ static int DMC_Rx(pAsyncProtocol p, pAsyncTxn ctx, int rxchar) { myCmd->inp_buf[myCmd->inp_idx] = '\0'; if (strncmp(myCmd->inp_buf, myCmd->out_buf, myCmd->out_len) == 0) { int i; - SICSLogWrite("Line echo detected", eStatus); + SICSLogWrite("Line echo detected", eLog); for (i = myCmd->out_len; i <= myCmd->inp_idx; ++i) { myCmd->inp_buf[i - myCmd->out_len] = myCmd->inp_buf[i]; } @@ -966,8 +966,8 @@ static int SendCallback(pAsyncTxn pCmd) { if (pCmd->txn_status == ATX_TIMEOUT) { if (self->debug) { - SICSLogWrite(pCmd->out_buf, eStatus); - SICSLogWrite("", eStatus); + SICSLogWrite(pCmd->out_buf, eLog); + SICSLogWrite("", eLog); } strncpy(self->lastCmd, pCmd->out_buf, CMDLEN); self->errorCode = MOTCMDTMO; @@ -978,8 +978,8 @@ static int SendCallback(pAsyncTxn pCmd) { case ' ': /* leading blank */ case '-': /* leading minus sign */ if (self->debug) { - SICSLogWrite(cmnd, eStatus); - SICSLogWrite(resp, eStatus); + SICSLogWrite(cmnd, eLog); + SICSLogWrite(resp, eLog); } break; case '?': @@ -994,8 +994,8 @@ static int SendCallback(pAsyncTxn pCmd) { if ((cmnd[0] == 'M' && cmnd[1] == 'G') || (cmnd[0] == 'L' && cmnd[1] == 'V')) { /* MG and LV commands can produce this result */ if (self->debug) { - SICSLogWrite(cmnd, eStatus); - SICSLogWrite(resp, eStatus); + SICSLogWrite(cmnd, eLog); + SICSLogWrite(resp, eLog); } break; } @@ -1051,7 +1051,7 @@ static int DMC_SendReceive(pDMC2280Driv self, char *cmd, char* reply) { if (status != 1) { if (self->debug) - SICSLogWrite(cmd, eStatus); + SICSLogWrite(cmd, eLog); if (status == -1) self->errorCode = MOTCMDTMO; else @@ -1062,15 +1062,15 @@ static int DMC_SendReceive(pDMC2280Driv self, char *cmd, char* reply) { switch (reply[0]) { case ':': /* prompt */ if (self->debug) { - SICSLogWrite(cmd, eStatus); - SICSLogWrite(reply, eStatus); + SICSLogWrite(cmd, eLog); + SICSLogWrite(reply, eLog); } return SUCCESS; case ' ': /* leading blank */ case '-': /* leading minus sign */ if (self->debug) { - SICSLogWrite(cmd, eStatus); - SICSLogWrite(reply, eStatus); + SICSLogWrite(cmd, eLog); + SICSLogWrite(reply, eLog); } return SUCCESS; case '?': @@ -1085,8 +1085,8 @@ static int DMC_SendReceive(pDMC2280Driv self, char *cmd, char* reply) { if ((cmd[0] == 'M' && cmd[1] == 'G') || (cmd[0] == 'L' && cmd[1] == 'V')) { /* MG and LV commands can produce this result */ if (self->debug) { - SICSLogWrite(cmd, eStatus); - SICSLogWrite(reply, eStatus); + SICSLogWrite(cmd, eLog); + SICSLogWrite(reply, eLog); } return SUCCESS; } @@ -1692,9 +1692,9 @@ static int rspStatus(pDMC2280Driv self, const char* text) { } snprintf(line, CMDLEN, "Motor %s limits: %s", self->name, sw); if (trace_switches) - ServerWriteGlobal(line, eStatus); + ServerWriteGlobal(line, eLog); else - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } if ((self->currFlags & (32)) != (iFlags & (32))) { if (iFlags & (32)) { @@ -1706,9 +1706,9 @@ static int rspStatus(pDMC2280Driv self, const char* text) { } snprintf(line, CMDLEN, "Motor %s motor: %s", self->name, sw); if (trace_switches) - ServerWriteGlobal(line, eStatus); + ServerWriteGlobal(line, eLog); else - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } if ((self->currFlags & (128)) != (iFlags & (128))) { if (iFlags & (128)) { @@ -1720,9 +1720,9 @@ static int rspStatus(pDMC2280Driv self, const char* text) { } snprintf(line, CMDLEN, "Motor %s motor: %s", self->name, sw); if (trace_switches) - ServerWriteGlobal(line, eStatus); + ServerWriteGlobal(line, eLog); else - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } } self->currFlags = iFlags; @@ -1831,8 +1831,8 @@ static void state_trace_prn(pDMC2280Driv self) { if (line && *line) { if (lines_printed == 0) /* print the opening message only if there are lines to print */ - SICSLogTimePrintf(eStatus, &tv, "Motor: %s, state_trace_prn trace history listing start", self->name); - SICSLogWriteTime(line, eStatus, tp); + SICSLogTimePrintf(eLog, &tv, "Motor: %s, state_trace_prn trace history listing start", self->name); + SICSLogWriteTime(line, eLog, tp); lines_printed++; } self->state_trace_done[idx] = 1; @@ -1840,9 +1840,9 @@ static void state_trace_prn(pDMC2280Driv self) { idx = 0; } while (idx != self->state_trace_idx); /* print a close message, even if there are zero lines */ - SICSLogTimePrintf(eStatus, &tv, "Motor: %s, state_trace_prn trace history listing end (%d entries)", self->name, lines_printed); + SICSLogTimePrintf(eLog, &tv, "Motor: %s, state_trace_prn trace history listing end (%d entries)", self->name, lines_printed); #else - SICSLogPrintf(eStatus, "Motor: %s, state_trace_prn not implemented", self->name); + SICSLogPrintf(eLog, "Motor: %s, state_trace_prn not implemented", self->name); #endif } @@ -1993,9 +1993,9 @@ static void state_trace_ins(pDMC2280Driv self, const char *fmt, ...) { vsnprintf(lp, CMDLEN, format, ap); va_end(ap); if (self->debug) - SICSLogWrite(lp, eStatus); + SICSLogWrite(lp, eLog); if (self->trace) - SCWrite(self->trace, lp, eStatus); + SCWrite(self->trace, lp, eLog); } #if defined(STATE_TRACE) && (STATE_TRACE > 0) if (++self->state_trace_idx >= STATE_TRACE) @@ -2689,7 +2689,7 @@ static void DMCState_MotorOn(pDMC2280Driv self, pEvtEvent event) { self->currPosition, self->fPreseek, self->fTarget); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } self->creep_val = 0; absolute = motCreep(self, target); @@ -2954,7 +2954,7 @@ static void DMCState_BacklashCont(pDMC2280Driv self, pEvtEvent event) { char line[CMDLEN]; snprintf(line, CMDLEN, "Motor=%s preseek stopped, stepcount = %d", self->name, self->stepCount); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } self->preseek = 0; } @@ -3387,7 +3387,7 @@ static void DMCState_StepMove(pDMC2280Driv self, pEvtEvent event) { self->minRatio, self->maxRatio, time); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } if (self->abs_encoder && true /*self->doStats*/) { if (labs(steps) > fabs(self->stepsPerX) && labs(counts) > fabs(self->cntsPerX)) { @@ -3412,7 +3412,7 @@ static void DMCState_StepMove(pDMC2280Driv self, pEvtEvent event) { self->S_xx, self->S_yy, self->S_xy); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); snprintf(line, CMDLEN, "Motor=%s stats: n=%.0f, m=%f, b=%f, r=%f, stepsPerX=%f", self->name, self->S_n, @@ -3420,7 +3420,7 @@ static void DMCState_StepMove(pDMC2280Driv self, pEvtEvent event) { self->S_b, self->S_r, self->cntsPerX * self->S_m); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } } } @@ -3569,7 +3569,7 @@ static void DMCState_Moving(pDMC2280Driv self, pEvtEvent event) { char line[CMDLEN]; snprintf(line, CMDLEN, "Motor=%s preseek stopped, stepcount = %d", self->name, self->stepCount); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } self->preseek = 0; absolute = motCreep(self, target); @@ -3585,7 +3585,7 @@ static void DMCState_Moving(pDMC2280Driv self, pEvtEvent event) { self->fPreseek, absolute - self->currSteps, self->creep_val); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } } else { @@ -3601,7 +3601,7 @@ static void DMCState_Moving(pDMC2280Driv self, pEvtEvent event) { self->fPreseek, absolute - self->currSteps, self->creep_val); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } } } @@ -3615,7 +3615,7 @@ static void DMCState_Moving(pDMC2280Driv self, pEvtEvent event) { self->currPosition, self->fPreseek, self->fTarget); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } /* * If we are still iterating, continue @@ -3626,7 +3626,7 @@ static void DMCState_Moving(pDMC2280Driv self, pEvtEvent event) { char line[CMDLEN]; snprintf(line, CMDLEN, "Motor=%s motion stopped, absolute = %d", self->name, absolute); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } self->preseek = 0; } @@ -3674,7 +3674,7 @@ static void DMCState_Moving(pDMC2280Driv self, pEvtEvent event) { self->minRatio, self->maxRatio, time); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } change_state(self, DMCState_OffTimer); return; @@ -4821,14 +4821,14 @@ static int DMC2280SetPar(void *pData, SConnection *pCon, */ static void DMC2280StrList(pDMC2280Driv self, char *name, SConnection *pCon){ - SCPrintf(pCon, eStatus, "%s.part = %s\n", name, self->part); - SCPrintf(pCon, eStatus, "%s.long_name = %s\n", name, self->long_name); - SCPrintf(pCon, eStatus, "%s.axis = %c\n", name, self->axisLabel); - SCPrintf(pCon, eStatus, "%s.legacy_fsm = %s\n", name, self->legacy_fsm ? "ON" : "OFF"); + SCPrintf(pCon, eValue, "%s.part = %s\n", name, self->part); + SCPrintf(pCon, eValue, "%s.long_name = %s\n", name, self->long_name); + SCPrintf(pCon, eValue, "%s.axis = %c\n", name, self->axisLabel); + SCPrintf(pCon, eValue, "%s.legacy_fsm = %s\n", name, self->legacy_fsm ? "ON" : "OFF"); if (self->encoderAxis) { - SCPrintf(pCon, eStatus, "%s.encoderAxis = %c\n", name, self->encoderAxis); + SCPrintf(pCon, eValue, "%s.encoderAxis = %c\n", name, self->encoderAxis); } - SCPrintf(pCon, eStatus, "%s.units = %s\n", name, self->units); + SCPrintf(pCon, eValue, "%s.units = %s\n", name, self->units); if (self->asyncUnit) { mkChannel* sock = AsyncUnitGetSocket(self->asyncUnit); if (sock) { @@ -4836,14 +4836,14 @@ static void DMC2280StrList(pDMC2280Driv self, char *name, SConnection *pCon){ int port = ntohs(sock->adresse.sin_port); strncpy(addr, inet_ntoa(sock->adresse.sin_addr), 80); addr[79] = '\0'; - SCPrintf(pCon, eStatus, "%s.address = %s:%d\n", self->name, addr, port); + SCPrintf(pCon, eValue, "%s.address = %s:%d\n", self->name, addr, port); } } if (self->errorCode) { int iCode; char error[CMDLEN]; DMC2280Error(self, &iCode, error, CMDLEN); - SCPrintf(pCon, eStatus, "%s.error = %d:%s", self->name, iCode, error); + SCPrintf(pCon, eValue, "%s.error = %d:%s", self->name, iCode, error); } return; } @@ -4855,45 +4855,45 @@ static void DMC2280StrList(pDMC2280Driv self, char *name, SConnection *pCon){ static void DMC2280List(void *pData, char *name, SConnection *pCon){ pDMC2280Driv self = (pDMC2280Driv) pData; - SCPrintf(pCon, eStatus, "%s.home = %f\n", name, self->fHome); - SCPrintf(pCon, eStatus, "%s.speed = %f\n", name, self->speed); - SCPrintf(pCon, eStatus, "%s.maxSpeed = %f\n", name, self->maxSpeed); - SCPrintf(pCon, eStatus, "%s.accel = %f\n", name, self->accel); - SCPrintf(pCon, eStatus, "%s.maxAccel = %f\n", name, self->maxAccel); - SCPrintf(pCon, eStatus, "%s.decel = %f\n", name, self->decel); - SCPrintf(pCon, eStatus, "%s.maxDecel = %f\n", name, self->maxDecel); - SCPrintf(pCon, eStatus, "%s.motOnDelay = %d\n", name, self->motOnDelay); - SCPrintf(pCon, eStatus, "%s.motOffDelay = %d\n", name, self->motOffDelay); - SCPrintf(pCon, eStatus, "%s.motorPollFast = %d\n", name, self->motorPollFast); - SCPrintf(pCon, eStatus, "%s.motorPollSlow = %d\n", name, self->motorPollSlow); - SCPrintf(pCon, eStatus, "%s.airPollTimer = %d\n", name, self->airPollTimer); - SCPrintf(pCon, eStatus, "%s.Debug = %d\n", name, self->debug); - SCPrintf(pCon, eStatus, "%s.Settle = %d\n", name, self->settle); - SCPrintf(pCon, eStatus, "%s.Blockage_Check_Interval = %f\n", name, self->blockage_ckInterval); - SCPrintf(pCon, eStatus, "%s.Blockage_Thresh = %f\n", name, self->blockage_thresh); - SCPrintf(pCon, eStatus, "%s.Blockage_Ratio = %f\n", name, self->blockage_ratio); - SCPrintf(pCon, eStatus, "%s.Blockage_Fail = %d\n", name, self->blockage_fail); - SCPrintf(pCon, eStatus, "%s.Backlash_offset = %f\n", name, self->backlash_offset); - SCPrintf(pCon, eStatus, "%s.Protocol = %d\n", name, self->protocol); - SCPrintf(pCon, eStatus, "%s.absEncoder = %d\n", name, self->abs_encoder); + SCPrintf(pCon, eValue, "%s.home = %f\n", name, self->fHome); + SCPrintf(pCon, eValue, "%s.speed = %f\n", name, self->speed); + SCPrintf(pCon, eValue, "%s.maxSpeed = %f\n", name, self->maxSpeed); + SCPrintf(pCon, eValue, "%s.accel = %f\n", name, self->accel); + SCPrintf(pCon, eValue, "%s.maxAccel = %f\n", name, self->maxAccel); + SCPrintf(pCon, eValue, "%s.decel = %f\n", name, self->decel); + SCPrintf(pCon, eValue, "%s.maxDecel = %f\n", name, self->maxDecel); + SCPrintf(pCon, eValue, "%s.motOnDelay = %d\n", name, self->motOnDelay); + SCPrintf(pCon, eValue, "%s.motOffDelay = %d\n", name, self->motOffDelay); + SCPrintf(pCon, eValue, "%s.motorPollFast = %d\n", name, self->motorPollFast); + SCPrintf(pCon, eValue, "%s.motorPollSlow = %d\n", name, self->motorPollSlow); + SCPrintf(pCon, eValue, "%s.airPollTimer = %d\n", name, self->airPollTimer); + SCPrintf(pCon, eValue, "%s.Debug = %d\n", name, self->debug); + SCPrintf(pCon, eValue, "%s.Settle = %d\n", name, self->settle); + SCPrintf(pCon, eValue, "%s.Blockage_Check_Interval = %f\n", name, self->blockage_ckInterval); + SCPrintf(pCon, eValue, "%s.Blockage_Thresh = %f\n", name, self->blockage_thresh); + SCPrintf(pCon, eValue, "%s.Blockage_Ratio = %f\n", name, self->blockage_ratio); + SCPrintf(pCon, eValue, "%s.Blockage_Fail = %d\n", name, self->blockage_fail); + SCPrintf(pCon, eValue, "%s.Backlash_offset = %f\n", name, self->backlash_offset); + SCPrintf(pCon, eValue, "%s.Protocol = %d\n", name, self->protocol); + SCPrintf(pCon, eValue, "%s.absEncoder = %d\n", name, self->abs_encoder); if (self->abs_encoder) { - SCPrintf(pCon, eStatus, "%s.absEncHome = %d\n", name, self->absEncHome); - SCPrintf(pCon, eStatus, "%s.cntsPerX = %f\n", name, self->cntsPerX); - SCPrintf(pCon, eStatus, "%s.Creep_Offset = %f\n", name, self->creep_offset); - SCPrintf(pCon, eStatus, "%s.Creep_Precision = %f\n", name, self->creep_precision); - SCPrintf(pCon, eStatus, "%s.Creep_Factor = %f\n", name, self->creep_factor); - SCPrintf(pCon, eStatus, "%s.Creep_Substep = %f\n", name, self->creep_substep); + SCPrintf(pCon, eValue, "%s.absEncHome = %d\n", name, self->absEncHome); + SCPrintf(pCon, eValue, "%s.cntsPerX = %f\n", name, self->cntsPerX); + SCPrintf(pCon, eValue, "%s.Creep_Offset = %f\n", name, self->creep_offset); + SCPrintf(pCon, eValue, "%s.Creep_Precision = %f\n", name, self->creep_precision); + SCPrintf(pCon, eValue, "%s.Creep_Factor = %f\n", name, self->creep_factor); + SCPrintf(pCon, eValue, "%s.Creep_Substep = %f\n", name, self->creep_substep); } if (self->posit_count > 0) { int i; - SCPrintf(pCon, eStatus, "%s.posit_count = %d\n", name, + SCPrintf(pCon, eValue, "%s.posit_count = %d\n", name, self->posit_count); for (i = 0; i < self->posit_count; ++i) { - SCPrintf(pCon, eStatus, "%s.posit_%d = %lld\n", name, i + 1, + SCPrintf(pCon, eValue, "%s.posit_%d = %lld\n", name, i + 1, posit2count(self, i + 1)); } } - SCPrintf(pCon, eStatus, "%s.stepsPerX = %f\n", name, self->stepsPerX); + SCPrintf(pCon, eValue, "%s.stepsPerX = %f\n", name, self->stepsPerX); return; } @@ -4904,13 +4904,13 @@ static void DMC_Notify(void* context, int event) { switch (event) { case AQU_DISCONNECT: snprintf(line, 132, "Disconnect on Motor '%s'", self->name); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); /* TODO: disconnect */ change_state(self, DMCState_Disconnected); break; case AQU_RECONNECT: snprintf(line, 132, "Reconnect on Motor '%s'", self->name); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); /* TODO: reconnect */ /* Reset the state machine */ DMC_ClearTimer(self); @@ -5376,7 +5376,7 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData, strncpy(addr, inet_ntoa(sock->adresse.sin_addr), 80); addr[79] = '\0'; snprintf(line, 132, "%s.address = %s:%d\n", self->name, addr, port); - SCWrite(pCon, line, eStatus); + SCWrite(pCon, line, eValue); } } return 1; @@ -5493,9 +5493,9 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData, int iCode; char error[CMDLEN]; DMC2280Error(self, &iCode, error, CMDLEN); - SCPrintf(pCon, eStatus, "%s.error = %d:%s", self->name, iCode, error); + SCPrintf(pCon, eValue, "%s.error = %d:%s", self->name, iCode, error); } else { - SCPrintf(pCon, eStatus, "%s.error = %d:%s", self->name, 0, "No error"); + SCPrintf(pCon, eValue, "%s.error = %d:%s", self->name, 0, "No error"); } return 1; } @@ -5580,7 +5580,7 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData, return 1; } } else { - SCPrintf(pCon, eStatus, "%s.oscillation = %s", self->name, self->doOscillate ? "on" : "off"); + SCPrintf(pCon, eValue, "%s.oscillation = %s", self->name, self->doOscillate ? "on" : "off"); return 1; } } @@ -5778,7 +5778,7 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData, } } fclose(fp); - SCPrintf(pCon, eStatus, "Motor %s, tracking data saved to %s", + SCPrintf(pCon, eLog, "Motor %s, tracking data saved to %s", argv[0], rp ? rp : argv[3]); if (rp) free(rp); diff --git a/site_ansto/orhvps.c b/site_ansto/orhvps.c index 5721faef..1880e699 100644 --- a/site_ansto/orhvps.c +++ b/site_ansto/orhvps.c @@ -302,7 +302,7 @@ static void ORHVState_Unknown(pStateMachine sm, pEvtEvent event) { char line[132]; *p = '\0'; sprintf(line, "Version: %s", pCmd->inp_buf); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); } ORHV_SendCmd(priv, "Hz", 2, fsm_msg_callback); sm->mySubState = 2; @@ -852,12 +852,12 @@ static void ORHVPSNotify(void* context, int event) switch (event) { case AQU_DISCONNECT: snprintf(line, 132, "Disconnect on Device '%s'", self->name); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); /* TODO: disconnect */ break; case AQU_RECONNECT: snprintf(line, 132, "Reconnect on Device '%s'", self->name); - SICSLogWrite(line, eStatus); + SICSLogWrite(line, eLog); /* TODO: reconnect */ if (self->has_fsm) { /* Reset the state machine */ diff --git a/site_ansto/site_ansto.c b/site_ansto/site_ansto.c index 1f77076d..75fedc60 100644 --- a/site_ansto/site_ansto.c +++ b/site_ansto/site_ansto.c @@ -180,10 +180,10 @@ static int Ansto_Valgrind(SConnection *pCon, SicsInterp *pSics, void *pData, int long int suppressed = 0; VALGRIND_COUNT_LEAKS(leaked, dubious, reachable, suppressed); if (argc > 2 && strcasecmp(argv[2], "delta") == 0) { - SCPrintf(pCon, eStatus, "Valgrind delta bytes: leaked=%ld, dubious=%ld, reachable=%ld, suppressed=%ld", + SCPrintf(pCon, eLog, "Valgrind delta bytes: leaked=%ld, dubious=%ld, reachable=%ld, suppressed=%ld", leaked - leaked_bytes, dubious - dubious_bytes, reachable - reachable_bytes, suppressed - suppressed_bytes); } else { - SCPrintf(pCon, eStatus, "Valgrind bytes: leaked=%ld, dubious=%ld, reachable=%ld, suppressed=%ld", + SCPrintf(pCon, eLog, "Valgrind bytes: leaked=%ld, dubious=%ld, reachable=%ld, suppressed=%ld", leaked, dubious, reachable, suppressed); } leaked_bytes = leaked; @@ -208,10 +208,10 @@ static int Ansto_Valgrind(SConnection *pCon, SicsInterp *pSics, void *pData, int long int suppressed = 0; VALGRIND_COUNT_LEAK_BLOCKS(leaked, dubious, reachable, suppressed); if (argc > 2 && strcasecmp(argv[2], "delta") == 0) { - SCPrintf(pCon, eStatus, "Valgrind delta blocks: leaked=%ld, dubious=%ld, reachable=%ld, suppressed=%ld", + SCPrintf(pCon, eLog, "Valgrind delta blocks: leaked=%ld, dubious=%ld, reachable=%ld, suppressed=%ld", leaked - leaked_blocks, dubious - dubious_blocks, reachable - reachable_blocks, suppressed - suppressed_blocks); } else { - SCPrintf(pCon, eStatus, "Valgrind blocks: leaked=%ld, dubious=%ld, reachable=%ld, suppressed=%ld", + SCPrintf(pCon, eLog, "Valgrind blocks: leaked=%ld, dubious=%ld, reachable=%ld, suppressed=%ld", leaked, dubious, reachable, suppressed); } leaked_blocks = leaked; @@ -280,7 +280,7 @@ static int MacroFileEvalGlob(SConnection * pCon, SicsInterp * pInter, void *pDat rv = 1; for (i = 0; i < (int) globbuf.gl_pathc; ++i) { args[1] = globbuf.gl_pathv[i]; - SCPrintf(pCon, eStatus, "fileeval %s", args[1]); + SCPrintf(pCon, eLog, "fileeval %s", args[1]); if (0 == MacroFileEval(pCon, pInter, pData, 2, args)) rv = 0; } @@ -301,21 +301,21 @@ int testLogCmd(SConnection *pCon, SicsInterp *pInter, void *pData, char lbuf[2048]; char sbuf[1000]; int i; - SICSLogWrite("Multiline:\nLine 1\r\nLine 2\r\nLine 3\r\n", eStatus); + SICSLogWrite("Multiline:\nLine 1\r\nLine 2\r\nLine 3\r\n", eLog); memset(lbuf, 0, sizeof(lbuf)); memset(sbuf, ' ', sizeof(sbuf)); - SICSLogPrintf(eStatus, "Hexlog %d all zero bytes", sizeof(lbuf)); - SICSLogWriteHex(lbuf, sizeof(lbuf), eStatus); + SICSLogPrintf(eLog, "Hexlog %d all zero bytes", sizeof(lbuf)); + SICSLogWriteHex(lbuf, sizeof(lbuf), eLog); for (i = 0; i <= 128; ++i) sbuf[i] = sbuf[sizeof(sbuf) - 1 - i] = i; sbuf[sizeof(sbuf) / 2] = '!'; - SICSLogPrintf(eStatus, "Hexlog %d mid space bytes", sizeof(sbuf)); - SICSLogWriteHex(sbuf, sizeof(sbuf), eStatus); + SICSLogPrintf(eLog, "Hexlog %d mid space bytes", sizeof(sbuf)); + SICSLogWriteHex(sbuf, sizeof(sbuf), eLog); for (i = 0; i < 1000; ++i) sbuf[i] = ' ' + (i % 96); sbuf[sizeof(sbuf) - 1] = '\0'; - SICSLogWrite("Very long line 1000 bytes", eStatus); - SICSLogWrite(sbuf, eStatus); + SICSLogWrite("Very long line 1000 bytes", eLog); + SICSLogWrite(sbuf, eLog); SCSendOK(pCon); return OKOK; }