-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDVA.h
76 lines (66 loc) · 1.34 KB
/
DVA.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
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
#ifndef _DVA_H
/* Possible DVA Roles:
* '1' TX
* '2' RX */
#define TX_ROLE '1'
#define RX_ROLE '2'
#define ARRAY_MAX_LEN 50
//PKT valid types
#define BLE_CHMODE 1
#define BLE_UPDATELOCATION 2
#define RF_SEND_LOCATION 3
//Buttons ids, used to read data
#define CH_MODE_BUTTON 0
#define NEXT_VICTIM_BUTTON 1
#define RESCUED_VICTIM_BUTTON 2
//Packet structure definition
typedef struct dva_pkts {
int type;
boolean initialized;
String data;
int len;
} Dva_pkt;
//DVA structure definition
typedef struct DVAs {
boolean initialized;
String id;
long lastUpdated;
float latitude;
float longitude;
} Dva;
//RF constants
#ifndef _TX_RX_CONST
#define LED_PIN 13
#define TX_PIN 12
#define RX_PIN 11
#define TX_EN_PIN 3
#define _TX_RX_CONST
#define DVA_ID "000001"
#endif
//PKT management constants
#define PKT_END '#'
#define PREAMBLE "DvA"
#define PKT_MAX_PRESITION 8
#define PKT_TYPE_POS 9
#define PKT_ID_START_POS 3
#define PKT_ID_END_POS 8
#define PKT_CHMODE_LEN 11
#define PKT_GEO_LEN 26
#define PKT_LATITUDE_START_POS 10
#define PKT_LATITUDE_END_POS 17
#define PKT_LONGITUDE_START_POS 18
#define PKT_LONGITUDE_END_POS 25
//Course constants
#ifndef _COURSE_CONST
#define NORTH 0
#define NORTHEAST 1
#define EAST 2
#define SOUTHEAST 3
#define SOUTH 4
#define SOUTHWEST 5
#define WEST 6
#define NORTHWEST 7
#define _COURSE_CONST
#endif
#define _DVA_H
#endif