mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 10:42:49 +00:00
begin cleaning up mesh library layer so that it could be split someday
This commit is contained in:
27
src/mesh/mesh-pb-constants.h
Normal file
27
src/mesh/mesh-pb-constants.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "mesh.pb.h"
|
||||
|
||||
// this file defines constants which come from mesh.options
|
||||
|
||||
// Tricky macro to let you find the sizeof a type member
|
||||
#define member_size(type, member) sizeof(((type *)0)->member)
|
||||
|
||||
/// max number of packets which can be waiting for delivery to android - note, this value comes from mesh.options protobuf
|
||||
#define MAX_RX_TOPHONE (member_size(DeviceState, receive_queue) / member_size(DeviceState, receive_queue[0]))
|
||||
|
||||
/// max number of nodes allowed in the mesh
|
||||
#define MAX_NUM_NODES (member_size(DeviceState, node_db) / member_size(DeviceState, node_db[0]))
|
||||
|
||||
/// helper function for encoding a record as a protobuf, any failures to encode are fatal and we will panic
|
||||
/// returns the encoded packet size
|
||||
size_t pb_encode_to_bytes(uint8_t *destbuf, size_t destbufsize, const pb_msgdesc_t *fields, const void *src_struct);
|
||||
|
||||
/// helper function for decoding a record as a protobuf, we will return false if the decoding failed
|
||||
bool pb_decode_from_bytes(const uint8_t *srcbuf, size_t srcbufsize, const pb_msgdesc_t *fields, void *dest_struct);
|
||||
|
||||
/// Read from an Arduino File
|
||||
bool readcb(pb_istream_t *stream, uint8_t *buf, size_t count);
|
||||
|
||||
/// Write to an arduino file
|
||||
bool writecb(pb_ostream_t *stream, const uint8_t *buf, size_t count);
|
||||
Reference in New Issue
Block a user