What do you think about something like:
if(pport->Read((char*)&resp, 1, CM11A_READ_TIMEOUT) == 0) {
LoggerWrapper::GetInstance()->Write(LV_STATUS, "No response from CM11A device.");
return -1;
} else {
LoggerWrapper::GetInstance()->Write(LV_STATUS, "Got response: %x from CM11A.", resp);
if(resp == CM11A_CLOCK_REQ) {
LoggerWrapper::GetInstance()->Write(LV_STATUS, "CM11A requested clock SET UP", resp);
SendClock(pport);
return -1;
} else if(resp == CM11A_INTERFACE_CQ) {
//Do a log entry here maybe? Not really needed, but maybe a message like "Data ready to be received, we will deal with it after sending..."
return -1; //it will try again...
} else {
if(resp != chksum) {
LoggerWrapper::GetInstance()->Write(LV_CRITICAL, "Bad checksum received (send:%x, recieved:%x).", chksum, resp);
return -1;
}
}
}
?
Once this is ironed out (shouldn't be long now) I'm going to dust off my CM15A (USB version) and see what we need to do to get it to work, and to get it to plug and play!