functions for the communication between SOLID slow control modules and Cprograms
Diff: sscm_comm.cpp
- Revision:
- 9:4bfcfa029dff
- Parent:
- 7:6d3c421026df
- Child:
- 10:0675c2e3d330
--- a/sscm_comm.cpp Tue Oct 07 13:20:15 2014 +0000 +++ b/sscm_comm.cpp Tue Oct 14 17:06:23 2014 +0000 @@ -5,10 +5,19 @@ #include <stlib.h> // for the strtol #endif + +/***** + * version history + * v3.31 first version history entry + * v3.32 changed the return values for decode and range checking +*******/ + #include "sscm_comm.h" -#define SSCM_COMM_LIB_SRC_VERSION "3.31" + + +#define SSCM_COMM_LIB_SRC_VERSION "3.32" using namespace sscm_comm; @@ -47,8 +56,12 @@ else rv=0; } } } } }} } } - int crr=check_ranges( sc); if ( crr < 0 ) rv=crr ; -for( int i=0;i<27;i++) input[i]=0; + if ( rv ==0) { + int crr=check_ranges( sc); + if ( crr < 0 ) rv=crr ; + } + // clean input string + for( int i=0;i<27;i++) input[i]=0; return rv; } @@ -57,12 +70,12 @@ int rv =1; // no check done // devnr check - if ( sc->con <1 || sc->con >2 ){ rv= -43; goto RVOUT;} + if ( sc->con <1 || sc->con >2 ){ rv= -0x10; goto RVOUT;} switch ( sc->dev) { - case ADC : if(sc->devnr < 1 || sc->devnr > 2 ){ rv=-23; break; } + case ADC : if(sc->devnr < 1 || sc->devnr > 2 ){ rv=-0x11; break; } break; - case TEMP : if( sc->ch <1 || sc->ch >2) {rv =-22 ;break;} + case TEMP : if( sc->ch <1 || sc->ch >2) {rv =-0x12 ;break;} break; default : rv=1; }