-
Notifications
You must be signed in to change notification settings - Fork 8
/
global_defines.h
45 lines (40 loc) · 1.04 KB
/
global_defines.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
/*
* The MIT License (MIT)
*
* Copyright (C) 2018 Gabriel Nikol
*/
#ifndef ARDUINO_MQTTSN_CLIENT_GLOBAL_DEFINES_H
#define ARDUINO_MQTTSN_CLIENT_GLOBAL_DEFINES_H
#include <stdint.h>
struct device_address {
uint8_t bytes[6]; // mac
device_address() {
bytes[0] = 0x0;
bytes[1] = 0x0;
bytes[2] = 0x0;
bytes[3] = 0x0;
bytes[4] = 0x0;
bytes[5] = 0x0;
}
device_address(uint8_t one, uint8_t two,
uint8_t three, uint8_t four,
uint8_t five, uint8_t six) {
bytes[0] = one;
bytes[1] = two;
bytes[2] = three;
bytes[3] = four;
bytes[4] = five;
bytes[5] = six;
}
};
void printDeviceAddress(device_address *address) {
for (uint8_t i = 0; i < sizeof(device_address); i++) {
if (i == sizeof(device_address) - 1) {
Serial.print(address->bytes[i]);
} else {
Serial.print(address->bytes[i]);
Serial.print(", ");
}
}
}
#endif //ARDUINO_MQTTSN_CLIENT_GLOBAL_DEFINES_H