Commit b90eb757 authored by Pierre NARVOR's avatar Pierre NARVOR
Browse files

[messages] Added PingError message

parent e0420bc0
......@@ -629,6 +629,16 @@ inline std::ostream& operator<<(std::ostream& os, narval::seatrac::BAUDRATE_E ra
return os;
}
inline std::ostream& operator<<(std::ostream& os, const narval::seatrac::BID_E& beaconId)
{
if(beaconId == narval::seatrac::BEACON_ALL)
os << "BEACON_ALL";
else if(beaconId <= 15)
os << "BEACON_" << (int)beaconId;
else
os << "BEACON_UNKNOWN";
return os;
}
inline std::ostream& operator<<(std::ostream& os, narval::seatrac::ENV_FLAGS_E flags)
{
......
......@@ -19,6 +19,7 @@
#include <seatrac_driver/messages/PingSend.h>
#include <seatrac_driver/messages/PingReq.h>
#include <seatrac_driver/messages/PingResp.h>
#include <seatrac_driver/messages/PingError.h>
#include <seatrac_driver/messages/XcvrAnalyse.h>
#include <seatrac_driver/messages/XcvrStatus.h>
......
#ifndef _DEF_SEATRAC_DRIVER_MESSAGES_PING_ERROR_H_
#define _DEF_SEATRAC_DRIVER_MESSAGES_PING_ERROR_H_
#include <seatrac_driver/SeatracTypes.h>
#include <seatrac_driver/messages/MessageBase.h>
namespace narval { namespace seatrac { namespace messages {
struct PingError : public Message<PingError>
{
using Message<PingError>::operator=;
static const CID_E Identifier = CID_PING_ERROR;
CST_E statusCode;
BID_E beaconId;
}__attribute__((packed));
}; //namespace messages
}; //namespace seatrac
}; //namespace narval
inline std::ostream& operator<<(std::ostream& os,
const narval::seatrac::messages::PingError& msg)
{
os << "PingError (" << msg.beaconId << ") : " << msg.statusCode;
return os;
}
#endif //_DEF_SEATRAC_DRIVER_MESSAGES_PING_ERROR_H_
......@@ -35,6 +35,13 @@ void SeatracDriver::on_receive(const std::vector<uint8_t>& data)
default:
std::cout << "Got message : " << msgId << std::endl << std::flush;
break;
case CID_PING_ERROR:
{
messages::PingError response;
response = data;
std::cout << response << std::endl;
}
break;
case CID_PING_RESP:
// std::cout << "Got a Ping Response" << std::endl << std::flush;
{
......
......@@ -75,10 +75,10 @@ int main(int argc, char** argv)
//cout << command::sys_info(seatrac) << endl;
//cout << command::status_config_get(seatrac) << endl;
//cout << command::settings_get(seatrac) << endl;
//cout << command::ping_send(seatrac, BEACON_ID_15) << endl;
cout << command::ping_send(seatrac, BEACON_ID_14) << endl;
//cout << command::ping_send(seatrac, BEACON_ID_15, MSG_REQU) << endl;
//cout << command::background_noise(seatrac) << endl;
cout << command::xcvr_status(seatrac) << endl;
//cout << command::xcvr_status(seatrac) << endl;
}
catch(const TimeoutReached& e) {
cout << "Timeout reached" << endl;
......
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