functions for the communication between SOLID slow control modules and Cprograms
Diff: sscm_comm.cpp
- Revision:
- 4:66d1a4200f67
- Parent:
- 3:e9053e5e7175
- Child:
- 5:357fa8928d63
diff -r e9053e5e7175 -r 66d1a4200f67 sscm_comm.cpp --- a/sscm_comm.cpp Wed Sep 24 10:29:42 2014 +0000 +++ b/sscm_comm.cpp Tue Sep 30 13:19:31 2014 +0000 @@ -8,7 +8,7 @@ #include "sscm_comm.h" -#define SSCM_LIB_SRC_VERSION "1.31" +#define SSCM_LIB_SRC_VERSION "1.40" using namespace sscm_comm; @@ -41,9 +41,12 @@ else { part[0]=input[ic++];part[1]=input[ic++];part[2]=input[ic++];part[3]=input[ic++];part[4]=0;sc->dataout = (u32)strtol(part, NULL, 16); if( input[ic++] != SEP ) rv= -7; + else { + part[0]=input[ic++];part[1]=input[ic++];part[4]=0;sc->status = (u8)strtol(part, NULL, 16); + if( input[ic++] != SEP ) rv= -8; else rv=0; - } } } } }} } + } } } } }} } } int crr=check_ranges( sc); if ( crr < 0 ) rv=crr ; for( int i=0;i<27;i++) input[i]=0; @@ -66,9 +69,9 @@ } void sscm_comm::encode_cmd ( char *output , ssc_cmd *sc) { - sprintf(output,"%c%02X%c%02X%c%02X%c%02X%c%c%c%c%c%c%02X%c%04X%c%04X%c%c\0", + sprintf(output,"%c%02X%c%02X%c%02X%c%02X%c%c%c%c%c%c%02X%c%04X%c%04X%c%02X%c%c\0", CMDSTART,sc->module,SEP,sc->con,SEP,sc->dev,SEP,sc->devnr,SEP,sc->cmd[0],sc->cmd[1],sc->cmd[2],sc->cmd[3], - SEP,sc->ch,SEP,sc->datain,SEP,sc->dataout,SEP,CMDSTOP); + SEP,sc->ch,SEP,sc->datain,SEP,sc->dataout,SEP,sc->status,SEP,CMDSTOP); }