Commit af87427c authored by Achim Morschhauser's avatar Achim Morschhauser
Browse files

tests in binary mode updated

parent 8ab2bfc9
......@@ -788,23 +788,27 @@ int driver_obs_obsdaq::parse_data_bin(data_obs_vector* data, char* buf) {
// Check 7th bits
for (int i=0; i<strlen(buf);i++){
if (buf[i]<32 || buf[i]>159){
fprintf(stderr,"Faulty data: 7th bit check failed for %d.",
buf[i]);
if ((unsigned char) buf[i]<32 || (unsigned char) buf[i]>159){
fprintf(stderr,"Faulty data: 7th bit check failed for byte %d: %d.\n",
i,(unsigned char) buf[i]);
//fprintf(stderr,"%d %d %d %d %d %d %d %d\n",buf[i]&1,(buf[i]&2)/2,
// (buf[i]&4)/4,(buf[i]&8)/8,(buf[i]&16)/16,(buf[i]&32)/32,
// (buf[i]&64)/64,(buf[i]&128)/128);
return(-1);
}
}
// Check control bit
// Check checksum byte
tmp_d=0;
// Sum over N-1 data bytes
for (int i=0; i<reclen-1; i++){
tmp_d += buf[i];
}
// Last byte must contain sum of last (N-1) bytes in bits 0-6
if ( (tmp_d&127) != (buf[reclen-1]&127) ){
fprintf(stderr,"Faulty data: Control sum check failed for ");
for (int i=0; i<strlen(buf);i++){
for (int i=0; i<reclen-1;i++){
fprintf(stderr,"%d ",buf[i]);
}
fprintf(stderr,"and values %d %d %d.\n",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment