-
Notifications
You must be signed in to change notification settings - Fork 0
/
eth_api.h
50 lines (38 loc) · 831 Bytes
/
eth_api.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <unistd.h>
#include <stdarg.h>
#include "xmessage.h"
enum MsgTypes {
mgFrontObstacle = xqm::message_count,
mgRearObstacle
};
#pragma pack(1)
struct MsgHeader {
};
struct MFrontObstacle {
static const MsgTypes type = mgFrontObstacle;
float distance;
};
#pragma pack()
/**
* @brief
*
* @param msg
* @param type
* @return char* a pointer to the message body
*/
//char* makeMsgHeader(char* msg, MsgTypes type);
/**
* @brief
*
* @param msg
* @param type
* @return char*
*/
//char* makeTail(char* msg, MsgTypes type);
int sendMsg(const unsigned char* data, unsigned char type, unsigned short int size);
template<class T> int sendMsg(const T* info/*, unsigned int timestamp*/) {
int ret;
ret = sendMsg((unsigned char*)(info), T::type, sizeof(T)/*, timestamp*/);
return ret;
}