Commit 478d11b9 authored by Pierre NARVOR's avatar Pierre NARVOR
Browse files

[commands] Added SysReboot (not working, seatrac spec not up to date

parent 66659a7e
......@@ -30,6 +30,18 @@ inline messages::SysInfo sys_info(SeatracDriver& seatrac, int64_t timeout=1000)
return response;
}
inline messages::SysReboot sys_reboot(SeatracDriver& seatrac, int64_t timeout=1000)
{
messages::SysReboot response;
messages::SysReboot::Request request;
if(!seatrac.send_request(sizeof(request), (const uint8_t*)&request, &response, timeout)) {
throw TimeoutReached();
}
return response;
}
}; //namespace command
}; //namespace seatrac
}; //namespace narval
......
......@@ -4,6 +4,7 @@
#include <seatrac_driver/messages/MessageBase.h>
#include <seatrac_driver/messages/SysAlive.h>
#include <seatrac_driver/messages/SysInfo.h>
#include <seatrac_driver/messages/SysReboot.h>
#include <seatrac_driver/messages/Status.h>
......
#ifndef _DEF_SEATRAC_DRIVER_MESSAGES_SYSREBOOT_H_
#define _DEF_SEATRAC_DRIVER_MESSAGES_SYSREBOOT_H_
#include <seatrac_driver/SeatracTypes.h>
#include <seatrac_driver/messages/MessageBase.h>
namespace narval { namespace seatrac { namespace messages {
struct SysReboot : public Message<SysReboot>
{
static const CID_E Identifier = CID_SYS_REBOOT;
struct Request : public Message<Request> {
static const CID_E Identifier = CID_SYS_REBOOT;
const uint16_t check;
Request() : check(0x6A95) {}
};
using Message<SysReboot>::operator=;
CST_E status;
}__attribute__((packed));
}; //namespace messages
}; //namespace seatrac
}; //namespace narval
inline std::ostream& operator<<(std::ostream& os,
const narval::seatrac::messages::SysReboot& msg)
{
static const char* prefix = "\n- ";
os << "SysReboot :"
<< prefix << "cmdId : " << (uint32_t)msg.cmdId
<< prefix << "status : " << (uint32_t)msg.status;
return os;
}
#endif //_DEF_SEATRAC_DRIVER_MESSAGES_SYSREBOOT_H_
......@@ -24,6 +24,11 @@ int main()
seatrac.enable_io_dump();
service.start();
cout << "Type Enter for reboot" << endl;
getchar();
cout << command::sys_reboot(seatrac) << endl;
for(int i = 0; i < 1000; i++) {
//for(int i = 0; i < 10; i++) {
......
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