forked from alex-agency/hydroponics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMeshNet.h
More file actions
64 lines (46 loc) · 1.81 KB
/
MeshNet.h
File metadata and controls
64 lines (46 loc) · 1.81 KB
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
/*
This file is part of the MeshNet Arduino library.
Copyright (C) 2013 Mattia Baldani
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MESHNET_H__
#define __MESHNET_H__
#include "Arduino.h"
#include <stddef.h>
#include <stdint.h>
#include "hmac_sha1.h"
// Enable the debug messages via Serial
#define DEBUG_SERIAL_ENABLE
#ifdef DEBUG_SERIAL_ENABLE
#define DEBUG_PRINT(x) ({Serial.print(x);})
#else
#define DEBUG_PRINT(x)
#endif
#ifdef DEBUG_SERIAL_ENABLE
#define DEBUG_PRINTLN(x) ({Serial.println(x);})
#else
#define DEBUG_PRINTLN(x)
#endif
/** These functions must be implemented by the sketch */
int sendPacket(unsigned char *, uint8_t, uint8_t, uint8_t);
extern const int NUM_INTERFACES;
extern const uint32_t deviceType;
extern uint32_t deviceUniqueId;
void onCommandReceived(uint8_t command, void* data, uint8_t dataLen);
/** This is the function that every layer2 implementations must call to pass a packet to the layer3 */
void processIncomingPacket(unsigned char*, uint8_t, uint8_t, uint8_t);
void sendCommand(uint8_t command, void* data, uint8_t dataLen); // called by the sketch
extern uint16_t networkId;
void printDebugStateInfo();
int printPacket(unsigned char *, uint8_t);
void meshTest();
#endif