forked from Betschi/FANET_V2019_02_07
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fanet_struct.c
212 lines (190 loc) · 4.18 KB
/
fanet_struct.c
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
typedef bool boolean;
typedef unsigned char byte;
#ifndef __typedef_RADIODATA
# define __typedef_RADIODATA
typedef struct {
int8_t rssi;
int8_t prssi;
float psnr;
char coding_rate[5];
byte crc_err;
int16_t rx_headers;
int16_t rx_packets;
int16_t tx_packets;
int16_t tx_time;
int32_t freq_err;
uint32_t timestamp;
}sRadioData;
#endif
#ifndef __typedef_NAME
# define __typedef_NAME
typedef struct {
char name[255];
byte n_length;
}sName;
#endif
#ifndef __typedef_FANETMAC
# define __typedef_FANETMAC
typedef struct {
boolean e_header;
boolean forward;
byte type;
byte s_manufactur_id;
uint16_t s_unique_id;
byte ack;
boolean cast;
boolean signature_bit;
byte d_manufactur_id;
uint16_t d_unique_id;
uint32_t signature;
byte valid_bit;
}sFanetMAC;
#endif
#ifndef __typedef_RAW_MESSAGE
# define __typedef_RAW_MESSAGE
typedef struct {
char message[255];
byte m_length;
byte m_pointer;
}sRawMessage;
#endif
#ifndef __typedef_ACK
# define __typedef_ACK
typedef struct {
uint32_t message_id;
uint32_t time;
char subheader;
byte s_address_manufactur_id;
uint16_t s_address_unique_id;
byte d_address_manufactur_id;
uint16_t d_address_unique_id;
char ack_req;
char ack_status;
byte send_events;
}sACK;
#endif
#ifndef __typedef_TRACKING
# define __typedef_TRACKING
typedef struct {
byte s_address_manufactur_id;
uint16_t s_address_unique_id;
float latitude;
float longitude;
boolean tracking;
byte aircraft_type;
char aircraft_type_char[16];
uint16_t altitude;
float speed;
float climb;
float heading;
boolean turn_rate_on;
float turn_rate;
float distance;
}sTRACKING;
#endif
#ifndef __typedef_MESSAGE
# define __typedef_MESSAGE
typedef struct {
uint32_t message_id;
uint32_t time;
char subheader;
byte s_address_manufactur_id;
uint16_t s_address_unique_id;
byte d_address_manufactur_id;
uint16_t d_address_unique_id;
char ack_req;
char ack_status;
byte send_events;
char message_type;
char message[255];
byte m_length;
byte m_pointer;
}sMessage;
#endif
#ifndef __typedef_WEATHER
# define __typedef_WEATHER
typedef struct {
char id_station[32];
char name[64];
char short_name[32];
uint32_t time;
boolean gateway;
boolean temp;
boolean wind;
boolean humid;
boolean barom;
boolean e_header;
byte extended_header;
float latitude;
float longitude;
int16_t altitude;
float temperature;
float wind_heading;
float wind_speed;
float wind_gusts;
float humidity;
float barometric;
}sWeather;
#endif
#ifndef __typedef_SYSTEM
# define __typedef_SYSTEM
typedef struct {
long timestamp_1min;
long timestamp_15min;
float rssi_avg_1min;
float rssi_avg_15min;
int rssi_max_1min;
int rssi_max_15min;
int16_t rx_headers_1min;
int16_t rx_headers_15min;
int16_t rx_packets_1min;
int16_t rx_packets_15min;
int16_t tx_packets_1min;
int16_t tx_packets_15min;
int16_t tx_time_1min;
int32_t tx_time_15min;
}sSystem;
#endif
#ifndef __typedef_ROUTING
# define __typedef_ROUTING
typedef struct {
byte address_manufactur_id;
uint16_t address_unique_id;
byte subnet_manufactur_id;
uint16_t subnet_unique_id;
byte next_hop_manufactur_id;
uint16_t next_hop_unique_id;
int metrik;
long last_seen;
float snr;
}sRouting;
#endif
#ifndef __typedef_ONLINE
# define __typedef_ONLINE
typedef struct {
long timestamp;
byte address_manufactur_id[255];
uint16_t address_unique_id[255];
int online;
}sOnline;
#endif
/*
#ifndef __typedef_RX_RADIO_MESSAGES
# define __typedef_RX_RADIO_MESSAGES
typedef struct {
char rx_radio_messages[255];
byte rx_radio_length;
}sRxRadioMessages;
#endif
#ifndef __typedef_TX_RADIO_MESSAGES
# define __typedef_TX_RADIO_MESSAGES
typedef struct {
char tx_radio_messages[255];
byte tx_radio_length;
}sTxRadioMessages;
#endif
*/