17 #ifndef VISIONTRANSFER_DATACHANNEL_IMU_BNO080_H
18 #define VISIONTRANSFER_DATACHANNEL_IMU_BNO080_H
20 #include <visiontransfer/internal/datachannelservicebase.h>
21 #include <visiontransfer/internal/sensorringbuffer.h>
26 namespace visiontransfer {
33 class DataChannelIMUBNO080Commands {
47 class DataChannelIMUBNO080Util {
48 static DataChannelIMUBNO080Commands::Command getCommand(
unsigned char* data,
int datalen) {
49 if (datalen < 2)
throw std::runtime_error(
"Buffer too small");
50 return (DataChannelIMUBNO080Commands::Command) ntohs(*((uint16_t*) data));
52 static int packResetMessage(
unsigned char* data,
int datalen) {
53 if (datalen < 2)
throw std::runtime_error(
"Buffer too small");
54 *((uint16_t*)data) = htons(DataChannelIMUBNO080Commands::BNOReset);
67 static constexpr
int RINGBUFFER_SIZE = 2048;
78 DataChannel::Type getChannelType()
const override {
return DataChannel::Types::BNO080; }
79 int handleSensorInputRecord(
unsigned char* data,
int datalen, uint64_t baseTime);
80 void handleChunk(
unsigned char* data,
int datalen);
84 int stopService()
override {
return 1; }
Encapsulate a 4D (quaternion) sensor report, containing X, Y, Z, W, as well as timestamp and status f...
int startService() override
startService() implementations can start devices, launch an IO-blocked worker thread etc.
Base class all data channel services derive from (once on the server side, once on the API side)
Encapsulate a 3D sensor report, containing X, Y, Z, as well as timestamp and status fields.
bool initialize() override
When initialize() implementations return false, the service will be deactivated.
Encapsulate a scalar sensor measurement, containing the value, as well as timestamp and status fields...
int handleMessage(DataChannelMessage &message, sockaddr_in *sender) override
Channel-dependent message handlers in respective channel implementations.
Encapsulated receiver with ring buffers for IMU / environment sensor data.