1023 if (bytes_received!=11 ||
fData[0]!=10 || err)
1025 if (err==ba::error::eof)
1026 Warn(
"Connection closed by remote host (cosy).");
1030 if (err && err!=ba::error::eof &&
1031 err!=ba::error::basic_errors::not_connected &&
1032 err!=ba::error::basic_errors::operation_aborted)
1035 str <<
"Reading from " <<
URL() <<
": " << err.message() <<
" (" << err <<
")";
1038 PostClose(err!=ba::error::basic_errors::operation_aborted);
1044 const uint16_t desc =
fData[1]<<8 |
fData[2];
1045 const uint16_t cobid = desc>>5;
1049 const uint16_t fcode = cobid >> 7;
1050 const uint8_t
node = cobid & 0x1f;
1055 Out() <<
"Received nodeguard" << endl;
1061 const uint8_t cmd = data[0];
1062 const uint16_t idx = data[1] | (data[2]<<8);
1063 const uint8_t subidx = data[3];
1064 const uint32_t dat = data[4] | (data[5]<<8) | (data[6]<<16) | (data[7]<<24);
1066 const auto it = find(
fTimeouts.begin(),
fTimeouts.end(), SDO(node, cmd, idx, subidx));
1076 str <<
"Unexpected SDO (";
1077 str << uint32_t(node) <<
": ";
1078 str << ((cmd&0xf)==
kTxSdo?
"RX ":
"TX ");
1079 str << idx <<
"/" << uint32_t(subidx) <<
")";
1091 HandleSdo(node, idx, subidx, dat&0xffff, now);
1095 HandleSdo(node, idx, subidx, dat&0xff, now);
1109 out <<
"Invalid SDO command code " << hex << cmd <<
" received.";
1133 out <<
"Invalid function code " << hex << fcode <<
" received.";
void PostClose(bool restart=true)
Adds some functionality to boost::posix_time::ptime for our needs.
void HandlePdo1(const uint8_t &node, const uint8_t *data, const Time &tv)
std::list< Timeout_t > fTimeouts
void HandleSdo(const uint8_t &node, const uint16_t &idx, const uint8_t &subidx, const uint32_t &val, const Time &tv)
void HandleSdoOk(const uint8_t &node, const uint16_t &idx, const uint8_t &subidx, const Time &)
int Error(const std::string &str)
int Warn(const std::string &str)
void HandlePdo3(const uint8_t &node, const uint8_t *data, const Time &tv)
void HandleSdoError(const uint8_t &node, const uint16_t &idx, const uint8_t &subidx, const Time &)
void HandlePdo2(const uint8_t &node, const uint8_t *data, const Time &)