2020-02-03 09:13:19 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-03-18 19:15:51 -07:00
|
|
|
// low level types
|
2020-02-03 09:13:19 -08:00
|
|
|
|
2020-04-17 09:48:54 -07:00
|
|
|
#include "MemoryPool.h"
|
|
|
|
|
#include "mesh.pb.h"
|
2020-02-03 09:13:19 -08:00
|
|
|
#include <Arduino.h>
|
|
|
|
|
|
|
|
|
|
typedef uint8_t NodeNum;
|
2020-04-17 11:52:20 -07:00
|
|
|
typedef uint8_t PacketId; // A packet sequence number
|
2020-02-03 09:13:19 -08:00
|
|
|
|
2020-06-03 13:46:31 -07:00
|
|
|
#define NODENUM_BROADCAST (sizeof(NodeNum) == 4 ? UINT32_MAX : UINT8_MAX)
|
2020-02-03 09:13:19 -08:00
|
|
|
#define ERRNO_OK 0
|
2020-04-23 12:47:41 -07:00
|
|
|
#define ERRNO_NO_INTERFACES 33
|
2020-02-03 09:13:19 -08:00
|
|
|
#define ERRNO_UNKNOWN 32 // pick something that doesn't conflict with RH_ROUTER_ERROR_UNABLE_TO_DELIVER
|
|
|
|
|
|
2020-05-18 17:35:23 -07:00
|
|
|
/**
|
|
|
|
|
* the max number of hops a message can pass through, used as the default max for hop_limit in MeshPacket.
|
|
|
|
|
*
|
|
|
|
|
* We reserve 3 bits in the header so this could be up to 7, but given the high range of lora and typical usecases, keeping
|
|
|
|
|
* maxhops to 3 should be fine for a while. This also serves to prevent routing/flooding attempts to be attempted for
|
|
|
|
|
* too long.
|
|
|
|
|
**/
|
2020-05-18 17:57:58 -07:00
|
|
|
#define HOP_MAX 7
|
|
|
|
|
|
|
|
|
|
/// We normally just use max 3 hops for sending reliable messages
|
|
|
|
|
#define HOP_RELIABLE 3
|
2020-05-18 17:35:23 -07:00
|
|
|
|
2020-04-17 09:48:54 -07:00
|
|
|
typedef int ErrorCode;
|
|
|
|
|
|
|
|
|
|
/// Alloc and free packets to our global, ISR safe pool
|
|
|
|
|
extern MemoryPool<MeshPacket> packetPool;
|