17 #ifndef SCIP2_RESPONSE_TIME_SYNC_H 18 #define SCIP2_RESPONSE_TIME_SYNC_H 20 #include <boost/asio.hpp> 44 using Callback = boost::function<void(
45 const boost::posix_time::ptime&,
56 return std::string(
"TM");
59 const boost::posix_time::ptime& time_read,
60 const std::string& echo_back,
61 const std::string& status,
68 cb_(time_read, echo_back, status, timestamp);
71 if (echo_back[2] ==
'1')
74 if (!std::getline(stream, stamp))
79 const uint8_t checksum = stamp.back();
88 auto it = dec.
begin();
90 if ((dec.getChecksum() & 0x3F) + 0x30 != checksum)
97 cb_(time_read, echo_back, status, timestamp);
107 #endif // SCIP2_RESPONSE_TIME_SYNC_H
void registerCallback(Callback cb)
void operator()(const boost::posix_time::ptime &time_read, const std::string &echo_back, const std::string &status, std::istream &stream)
std::string getCommandCode() const
boost::function< void(const boost::posix_time::ptime &, const std::string &, const std::string &, const Timestamp &)> Callback