328 ofstream fout(
"received.txt", ios::app);
329 fout <<
Time() <<
": ";
330 for (
unsigned int i=0;
i<bytes_received;
i++)
331 fout << hex << setfill(
'0') << setw(2) << (uint16_t)buf[
i];
338 Out() << endl <<
kBold << dec <<
"Data received (size=" << bytes_received <<
"):" << endl;
340 Out() << hex << setfill(
'0');
342 for (
size_t i=0;
i<bytes_received/3;
i++)
345 Out() <<
'\n' << setw(2) << bytes_received/24 <<
"| ";
347 Out() << setw(2) << uint16_t(buf[
i*3+2]);
348 Out() << setw(2) << uint16_t(buf[
i*3+1]);
349 Out() << setw(2) << uint16_t(buf[
i*3+0]) <<
" ";
354 const int cmd = command&0xf;
368 for (
size_t i=0;
i<bytes_received/3;
i++)
379 Message(
"Stream successfully synchronized.");
394 msg <<
"Corrupted answer: received wrap counter " <<
fWrapCounter <<
" is not send counter " << send_counter <<
"%8.";
409 Message(
"Reset command successfully answered...");
423 Message(
"...restarting automatic readout.");
452 Warn(
"OverCurrent detected - emergency ramp down initiated.");
vector< uint64_t > fCounter
vector< int16_t > fCurrent
void CloseImp(int64_t delay=0)
Adds some functionality to boost::posix_time::ptime for our needs.
bool RampAllDacs(uint16_t dac)
int Error(const std::string &str)
void SendCommandNB(const std::string &command)
int Warn(const std::string &str)
void ScheduleUpdate(int millisec)
boost::asio::deadline_timer fUpdateTimer
int Message(const std::string &str)
void ExpertReset(bool expert_mode=true)
bool CheckMessageLength(int received, int expected, const string &msg)
bool EvalAnswer(const uint8_t *answer, uint16_t id, int command)
void ReadAllChannels(bool special=false)
boost::asio::deadline_timer fSyncTimer