Commit 4c39cef3 authored by Pierre NARVOR's avatar Pierre NARVOR
Browse files

[driver] Fixed STATUS_BITS_E composition and added some print functions

parent 99361f9a
......@@ -672,6 +672,49 @@ inline std::ostream& operator<<(std::ostream& os, narval::seatrac::CID_E cid)
return os;
}
inline std::ostream& operator<<(std::ostream& os, narval::seatrac::CST_E& statusCode)
{
using namespace narval::seatrac;
switch(statusCode) {
case CST_OK: os << "CST_OK"; break;
case CST_FAIL: os << "CST_FAIL"; break;
case CST_EEPROM_ERROR: os << "CST_EEPROM_ERROR"; break;
case CST_CMD_PARAM_MISSING: os << "CST_CMD_PARAM_MISSING"; break;
case CST_CMD_PARAM_INVALID: os << "CST_CMD_PARAM_INVALID"; break;
case CST_PROG_FLASH_ERROR: os << "CST_PROG_FLASH_ERROR"; break;
case CST_PROG_FIRMWARE_ERROR: os << "CST_PROG_FIRMWARE_ERROR"; break;
case CST_PROG_SECTION_ERROR: os << "CST_PROG_SECTION_ERROR"; break;
case CST_PROG_LENGTH_ERROR: os << "CST_PROG_LENGTH_ERROR"; break;
case CST_PROG_DATA_ERROR: os << "CST_PROG_DATA_ERROR"; break;
case CST_PROG_CHECKSUM_ERROR: os << "CST_PROG_CHECKSUM_ERROR"; break;
case CST_XCVR_BUSY: os << "CST_XCVR_BUSY"; break;
case CST_XCVR_ID_REJECTED: os << "CST_XCVR_ID_REJECTED"; break;
case CST_XCVR_CSUM_ERROR: os << "CST_XCVR_CSUM_ERROR"; break;
case CST_XCVR_LENGTH_ERROR: os << "CST_XCVR_LENGTH_ERROR"; break;
case CST_XCVR_RESP_TIMEOUT: os << "CST_XCVR_RESP_TIMEOUT"; break;
case CST_XCVR_RESP_ERROR: os << "CST_XCVR_RESP_ERROR"; break;
case CST_XCVR_RESP_WRONG: os << "CST_XCVR_RESP_WRONG"; break;
case CST_XCVR_PLOAD_ERROR: os << "CST_XCVR_PLOAD_ERROR"; break;
case CST_XCVR_STATE_STOPPED: os << "CST_XCVR_STATE_STOPPED"; break;
case CST_XCVR_STATE_IDLE: os << "CST_XCVR_STATE_IDLE"; break;
case CST_XCVR_STATE_TX: os << "CST_XCVR_STATE_TX"; break;
case CST_XCVR_STATE_REQ: os << "CST_XCVR_STATE_REQ"; break;
case CST_XCVR_STATE_RX: os << "CST_XCVR_STATE_RX"; break;
case CST_XCVR_STATE_RESP: os << "CST_XCVR_STATE_RESP"; break;
case CST_DEX_SOCKET_ERROR: os << "CST_DEX_SOCKET_ERROR"; break;
case CST_DEX_RX_SYNC: os << "CST_DEX_RX_SYNC"; break;
case CST_DEX_RX_DATA: os << "CST_DEX_RX_DATA"; break;
case CST_DEX_RX_SEQ_ERROR: os << "CST_DEX_RX_SEQ_ERROR"; break;
case CST_DEX_RX_MSG_ERROR: os << "CST_DEX_RX_MSG_ERROR"; break;
case CST_DEX_REQ_ERROR: os << "CST_DEX_REQ_ERROR"; break;
case CST_DEX_RESP_TMO_ERROR: os << "CST_DEX_RESP_TMO_ERROR"; break;
case CST_DEX_RESP_MSG_ERROR: os << "CST_DEX_RESP_MSG_ERROR"; break;
case CST_DEX_RESP_REMOTE_ERROR: os << "CST_DEX_RESP_REMOTE_ERROR"; break;
default: os << "Unknown status code"; break;
}
return os;
}
inline std::ostream& operator<<(std::ostream& os, narval::seatrac::STATUS_BITS_E flags)
{
using namespace narval::seatrac;
......@@ -684,6 +727,13 @@ inline std::ostream& operator<<(std::ostream& os, narval::seatrac::STATUS_BITS_E
return os;
}
inline narval::seatrac::STATUS_BITS_E operator|(narval::seatrac::STATUS_BITS_E lhs,
narval::seatrac::STATUS_BITS_E rhs)
{
return static_cast<narval::seatrac::STATUS_BITS_E>(
static_cast<uint8_t>(lhs) | static_cast<uint8_t>(rhs));
}
inline std::ostream& operator<<(std::ostream& os, narval::seatrac::STATUSMODE_E mode)
{
using namespace narval::seatrac;
......
Markdown is supported
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