mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
minor refactor
This commit is contained in:
parent
4704ea8dae
commit
1d4ae9f3c4
3 changed files with 23 additions and 23 deletions
16
src/Packet.h
16
src/Packet.h
|
|
@ -11,10 +11,10 @@ namespace mesh {
|
|||
#define PH_VER_SHIFT 6
|
||||
#define PH_VER_MASK 0x03 // 2-bits
|
||||
|
||||
#define ROUTE_TYPE_TRANS_FLOOD 0x00 // flood mode + transport codes
|
||||
#define ROUTE_TYPE_FLOOD 0x01 // flood mode, needs 'path' to be built up (max 64 bytes)
|
||||
#define ROUTE_TYPE_DIRECT 0x02 // direct route, 'path' is supplied
|
||||
#define ROUTE_TYPE_TRANS_DIRECT 0x03 // direct route + transport codes
|
||||
#define ROUTE_TYPE_TRANSPORT_FLOOD 0x00 // flood mode + transport codes
|
||||
#define ROUTE_TYPE_FLOOD 0x01 // flood mode, needs 'path' to be built up (max 64 bytes)
|
||||
#define ROUTE_TYPE_DIRECT 0x02 // direct route, 'path' is supplied
|
||||
#define ROUTE_TYPE_TRANSPORT_DIRECT 0x03 // direct route + transport codes
|
||||
|
||||
#define PAYLOAD_TYPE_REQ 0x00 // request (prefixed with dest/src hashes, MAC) (enc data: timestamp, blob)
|
||||
#define PAYLOAD_TYPE_RESPONSE 0x01 // response to REQ or ANON_REQ (prefixed with dest/src hashes, MAC) (enc data: timestamp, blob)
|
||||
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
uint8_t header;
|
||||
uint16_t payload_len, path_len;
|
||||
uint16_t trans_codes[2];
|
||||
uint16_t transport_codes[2];
|
||||
uint8_t path[MAX_PATH_SIZE];
|
||||
uint8_t payload[MAX_PACKET_PAYLOAD];
|
||||
int8_t _snr;
|
||||
|
|
@ -59,10 +59,10 @@ public:
|
|||
*/
|
||||
uint8_t getRouteType() const { return header & PH_ROUTE_MASK; }
|
||||
|
||||
bool isRouteFlood() const { return getRouteType() == ROUTE_TYPE_FLOOD || getRouteType() == ROUTE_TYPE_TRANS_FLOOD; }
|
||||
bool isRouteDirect() const { return getRouteType() == ROUTE_TYPE_DIRECT || getRouteType() == ROUTE_TYPE_TRANS_DIRECT; }
|
||||
bool isRouteFlood() const { return getRouteType() == ROUTE_TYPE_FLOOD || getRouteType() == ROUTE_TYPE_TRANSPORT_FLOOD; }
|
||||
bool isRouteDirect() const { return getRouteType() == ROUTE_TYPE_DIRECT || getRouteType() == ROUTE_TYPE_TRANSPORT_DIRECT; }
|
||||
|
||||
bool hasTransCodes() const { return getRouteType() == ROUTE_TYPE_TRANS_FLOOD || getRouteType() == ROUTE_TYPE_TRANS_DIRECT; }
|
||||
bool hasTransportCodes() const { return getRouteType() == ROUTE_TYPE_TRANSPORT_FLOOD || getRouteType() == ROUTE_TYPE_TRANSPORT_DIRECT; }
|
||||
|
||||
/**
|
||||
* \returns one of PAYLOAD_TYPE_ values
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue