-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNode.h
69 lines (54 loc) · 1.11 KB
/
Node.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
#pragma once
#include "Logging.h"
#include "Definitions.h"
#include "Utilities.h"
#include "Payload.h"
#include "Data.h"
#ifndef ARDUINO
#include <wiringPi.h>
#include <cstdio>
#include <string.h>
#include <stdint.h>
#include <chrono>
#include <time.h>
#include "sql.h"
#include "FileRW.h"
#else
#include "EEPROM.h"
#include "Arduino.h"
//#define printf Definitions::prf
#endif
class Node
{
private:
Logger _logger;
public:
Node();
Node(Logger* logger);
#ifndef ARDUINO
SqlClass sql;
FileRW f;
#endif
time_t lastSensorUpdateTime; //time last update occured
time_t lastDownlinkUpdateTime;
Data data;
Payload p;
//both platforms but different
bool GetIds();
bool SetNodeId();
//Gateway only
bool DetermineNewNodeId(int arr[]);
void CheckSqlData();
void Request(char cmd);
void ConcatDownlinkMessage();
bool GetDownlinkMessage();
void DisableNode(); //turn an active slave off
void SendPing();
//Arduino only
void CheckIds(uint8_t &project_id, uint8_t &class_id, uint16_t &node_id);
void prf(char* fmt, ...); //printf
//both but same
void CheckNewMsgs();
void SetLed();
bool ProcessCmd();
};