-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrackPacket.hpp
33 lines (26 loc) · 1.12 KB
/
TrackPacket.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef __TRACKPACKET_HPP__
#define __TRACKPACKET_HPP__
#include <cstdint>
#include <array>
#include "settings.hpp"
#include "Position.hpp"
struct TrackPacket {
uint8_t nodeID=0;
uint32_t seqnum=0;
uint32_t timestamp;
Position position;
bool led_status=false;
uint16_t polyid;
std::array<char, TRACKING_GLOBALPOLY_MAXBUF> globalpoly;
TrackPacket(uint8_t nodeID, uint32_t seqnum, uint32_t timestamp, Position pos, bool led_status, uint16_t polyid, std::array<char, TRACKING_GLOBALPOLY_MAXBUF> globalpoly) :
nodeID(nodeID), seqnum(seqnum), timestamp(timestamp), position(pos), led_status(led_status), polyid(polyid), globalpoly(globalpoly) {}
TrackPacket() :
nodeID(0), seqnum(0), timestamp(0), position(0,0), led_status(false), polyid(), globalpoly() {}
std::string repr() const {
const size_t len=256;
char buffer[len];
snprintf(buffer, len, "{nodeID=%d|seqnum=%d|timestamp=%d|Pos=(%f,%f)|led_status=%d|poly=%s", nodeID, seqnum, timestamp, position.longitude, position.latitude, led_status, globalpoly.data());
return buffer;
}
};
#endif