2020-12-28 05:22:10 +00:00
|
|
|
/* Automatically generated nanopb header */
|
2022-06-17 13:37:52 +00:00
|
|
|
/* Generated by nanopb-0.4.6 */
|
2020-12-28 05:22:10 +00:00
|
|
|
|
|
|
|
#ifndef PB_DEVICEONLY_PB_H_INCLUDED
|
|
|
|
#define PB_DEVICEONLY_PB_H_INCLUDED
|
|
|
|
#include <pb.h>
|
2021-02-27 05:17:18 +00:00
|
|
|
#include "channel.pb.h"
|
2021-12-02 16:19:25 +00:00
|
|
|
#include "mesh.pb.h"
|
2020-12-28 05:22:10 +00:00
|
|
|
|
|
|
|
#if PB_PROTO_HEADER_VERSION != 40
|
|
|
|
#error Regenerate this file with the current version of nanopb generator.
|
|
|
|
#endif
|
|
|
|
|
2022-04-18 16:27:17 +00:00
|
|
|
/* Enum definitions */
|
|
|
|
/* TODO: REPLACE */
|
|
|
|
typedef enum _ScreenFonts {
|
|
|
|
/* TODO: REPLACE */
|
|
|
|
ScreenFonts_FONT_SMALL = 0,
|
|
|
|
/* TODO: REPLACE */
|
|
|
|
ScreenFonts_FONT_MEDIUM = 1,
|
|
|
|
/* TODO: REPLACE */
|
|
|
|
ScreenFonts_FONT_LARGE = 2
|
|
|
|
} ScreenFonts;
|
|
|
|
|
2020-12-28 05:22:10 +00:00
|
|
|
/* Struct definitions */
|
2022-03-26 14:48:35 +00:00
|
|
|
/* The on-disk saved channels */
|
|
|
|
typedef struct _ChannelFile {
|
|
|
|
/* The channels our node knows about */
|
2021-03-11 05:02:00 +00:00
|
|
|
pb_size_t channels_count;
|
2022-06-17 13:37:52 +00:00
|
|
|
Channel channels[8];
|
2022-06-15 14:44:33 +00:00
|
|
|
/* A version integer used to invalidate old save files when we make
|
|
|
|
incompatible changes This integer is set at build time and is private to
|
|
|
|
NodeDB.cpp in the device code. */
|
2022-06-17 13:37:52 +00:00
|
|
|
uint32_t version;
|
2021-03-11 05:02:00 +00:00
|
|
|
} ChannelFile;
|
|
|
|
|
2022-03-26 14:48:35 +00:00
|
|
|
/* This message is never sent over the wire, but it is used for serializing DB
|
|
|
|
state to flash in the device code
|
|
|
|
FIXME, since we write this each time we enter deep sleep (and have infinite
|
|
|
|
flash) it would be better to use some sort of append only data structure for
|
|
|
|
the receive queue and use the preferences store for the other stuff */
|
|
|
|
typedef struct _DeviceState {
|
|
|
|
/* Read only settings/info about this node */
|
2020-12-28 05:22:10 +00:00
|
|
|
bool has_my_node;
|
2022-06-17 13:37:52 +00:00
|
|
|
MyNodeInfo my_node;
|
2022-03-26 14:48:35 +00:00
|
|
|
/* My owner info */
|
2020-12-28 05:22:10 +00:00
|
|
|
bool has_owner;
|
2022-06-17 13:37:52 +00:00
|
|
|
User owner;
|
2022-03-26 14:48:35 +00:00
|
|
|
/* TODO: REPLACE */
|
2020-12-28 05:22:10 +00:00
|
|
|
pb_size_t node_db_count;
|
2022-06-17 13:37:52 +00:00
|
|
|
NodeInfo node_db[80];
|
2022-03-26 14:48:35 +00:00
|
|
|
/* Received packets saved for delivery to the phone */
|
2020-12-28 05:22:10 +00:00
|
|
|
pb_size_t receive_queue_count;
|
2022-06-17 13:37:52 +00:00
|
|
|
MeshPacket receive_queue[1];
|
2022-03-26 14:48:35 +00:00
|
|
|
/* We keep the last received text message (only) stored in the device flash,
|
|
|
|
so we can show it on the screen.
|
|
|
|
Might be null */
|
2022-06-17 13:37:52 +00:00
|
|
|
bool has_rx_text_message;
|
|
|
|
MeshPacket rx_text_message;
|
|
|
|
/* A version integer used to invalidate old save files when we make
|
|
|
|
incompatible changes This integer is set at build time and is private to
|
|
|
|
NodeDB.cpp in the device code. */
|
|
|
|
uint32_t version;
|
2022-03-26 14:48:35 +00:00
|
|
|
/* Used only during development.
|
|
|
|
Indicates developer is testing and changes should never be saved to flash. */
|
2022-06-17 13:37:52 +00:00
|
|
|
bool no_save;
|
2022-03-26 14:48:35 +00:00
|
|
|
/* Some GPSes seem to have bogus settings from the factory, so we always do one factory reset. */
|
2022-06-17 13:37:52 +00:00
|
|
|
bool did_gps_reset;
|
2020-12-28 05:22:10 +00:00
|
|
|
} DeviceState;
|
|
|
|
|
2022-04-18 16:27:17 +00:00
|
|
|
typedef PB_BYTES_ARRAY_T(2048) OEMStore_oem_icon_bits_t;
|
2022-10-19 11:44:12 +00:00
|
|
|
typedef PB_BYTES_ARRAY_T(32) OEMStore_oem_aes_key_t;
|
2022-04-18 16:27:17 +00:00
|
|
|
/* This can be used for customizing the firmware distribution. If populated,
|
|
|
|
show a secondary bootup screen with cuatom logo and text for 2.5 seconds. */
|
|
|
|
typedef struct _OEMStore {
|
|
|
|
/* The Logo width in Px */
|
2022-06-17 13:37:52 +00:00
|
|
|
uint32_t oem_icon_width;
|
2022-04-18 16:27:17 +00:00
|
|
|
/* The Logo height in Px */
|
2022-06-17 13:37:52 +00:00
|
|
|
uint32_t oem_icon_height;
|
2022-04-18 16:27:17 +00:00
|
|
|
/* The Logo in xbm bytechar format */
|
2022-06-17 13:37:52 +00:00
|
|
|
OEMStore_oem_icon_bits_t oem_icon_bits;
|
2022-04-18 16:27:17 +00:00
|
|
|
/* Use this font for the OEM text. */
|
2022-06-17 13:37:52 +00:00
|
|
|
ScreenFonts oem_font;
|
2022-04-18 16:27:17 +00:00
|
|
|
/* Use this font for the OEM text. */
|
2022-06-17 13:37:52 +00:00
|
|
|
char oem_text[40];
|
2022-10-19 11:44:12 +00:00
|
|
|
/* The default device encryption key, 16 or 32 byte */
|
|
|
|
OEMStore_oem_aes_key_t oem_aes_key;
|
2022-04-18 16:27:17 +00:00
|
|
|
} OEMStore;
|
|
|
|
|
|
|
|
|
|
|
|
/* Helper constants for enums */
|
|
|
|
#define _ScreenFonts_MIN ScreenFonts_FONT_SMALL
|
|
|
|
#define _ScreenFonts_MAX ScreenFonts_FONT_LARGE
|
|
|
|
#define _ScreenFonts_ARRAYSIZE ((ScreenFonts)(ScreenFonts_FONT_LARGE+1))
|
|
|
|
|
2020-12-28 05:22:10 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Initializer values for message structs */
|
2022-06-03 01:07:08 +00:00
|
|
|
#define DeviceState_init_default {false, MyNodeInfo_init_default, false, User_init_default, 0, {NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default}, 0, {MeshPacket_init_default}, false, MeshPacket_init_default, 0, 0, 0}
|
2022-06-15 14:44:33 +00:00
|
|
|
#define ChannelFile_init_default {0, {Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default}, 0}
|
2022-10-19 11:44:12 +00:00
|
|
|
#define OEMStore_init_default {0, 0, {0, {0}}, _ScreenFonts_MIN, "", {0, {0}}}
|
2022-06-03 01:07:08 +00:00
|
|
|
#define DeviceState_init_zero {false, MyNodeInfo_init_zero, false, User_init_zero, 0, {NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero}, 0, {MeshPacket_init_zero}, false, MeshPacket_init_zero, 0, 0, 0}
|
2022-06-15 14:44:33 +00:00
|
|
|
#define ChannelFile_init_zero {0, {Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero}, 0}
|
2022-10-19 11:44:12 +00:00
|
|
|
#define OEMStore_init_zero {0, 0, {0, {0}}, _ScreenFonts_MIN, "", {0, {0}}}
|
2020-12-28 05:22:10 +00:00
|
|
|
|
|
|
|
/* Field tags (for use in manual encoding/decoding) */
|
2021-03-11 05:02:00 +00:00
|
|
|
#define ChannelFile_channels_tag 1
|
2022-06-15 14:44:33 +00:00
|
|
|
#define ChannelFile_version_tag 2
|
2020-12-28 05:22:10 +00:00
|
|
|
#define DeviceState_my_node_tag 2
|
|
|
|
#define DeviceState_owner_tag 3
|
|
|
|
#define DeviceState_node_db_tag 4
|
|
|
|
#define DeviceState_receive_queue_tag 5
|
|
|
|
#define DeviceState_rx_text_message_tag 7
|
|
|
|
#define DeviceState_version_tag 8
|
|
|
|
#define DeviceState_no_save_tag 9
|
|
|
|
#define DeviceState_did_gps_reset_tag 11
|
2022-04-18 16:27:17 +00:00
|
|
|
#define OEMStore_oem_icon_width_tag 1
|
|
|
|
#define OEMStore_oem_icon_height_tag 2
|
|
|
|
#define OEMStore_oem_icon_bits_tag 3
|
|
|
|
#define OEMStore_oem_font_tag 4
|
|
|
|
#define OEMStore_oem_text_tag 5
|
2022-10-19 11:44:12 +00:00
|
|
|
#define OEMStore_oem_aes_key_tag 6
|
2020-12-28 05:22:10 +00:00
|
|
|
|
|
|
|
/* Struct field encoding specification for nanopb */
|
|
|
|
#define DeviceState_FIELDLIST(X, a) \
|
|
|
|
X(a, STATIC, OPTIONAL, MESSAGE, my_node, 2) \
|
|
|
|
X(a, STATIC, OPTIONAL, MESSAGE, owner, 3) \
|
|
|
|
X(a, STATIC, REPEATED, MESSAGE, node_db, 4) \
|
|
|
|
X(a, STATIC, REPEATED, MESSAGE, receive_queue, 5) \
|
|
|
|
X(a, STATIC, OPTIONAL, MESSAGE, rx_text_message, 7) \
|
|
|
|
X(a, STATIC, SINGULAR, UINT32, version, 8) \
|
|
|
|
X(a, STATIC, SINGULAR, BOOL, no_save, 9) \
|
2022-02-21 05:29:15 +00:00
|
|
|
X(a, STATIC, SINGULAR, BOOL, did_gps_reset, 11)
|
2020-12-28 05:22:10 +00:00
|
|
|
#define DeviceState_CALLBACK NULL
|
|
|
|
#define DeviceState_DEFAULT NULL
|
|
|
|
#define DeviceState_my_node_MSGTYPE MyNodeInfo
|
|
|
|
#define DeviceState_owner_MSGTYPE User
|
|
|
|
#define DeviceState_node_db_MSGTYPE NodeInfo
|
|
|
|
#define DeviceState_receive_queue_MSGTYPE MeshPacket
|
|
|
|
#define DeviceState_rx_text_message_MSGTYPE MeshPacket
|
2021-03-11 05:02:00 +00:00
|
|
|
|
|
|
|
#define ChannelFile_FIELDLIST(X, a) \
|
2022-06-15 14:44:33 +00:00
|
|
|
X(a, STATIC, REPEATED, MESSAGE, channels, 1) \
|
|
|
|
X(a, STATIC, SINGULAR, UINT32, version, 2)
|
2021-03-11 05:02:00 +00:00
|
|
|
#define ChannelFile_CALLBACK NULL
|
|
|
|
#define ChannelFile_DEFAULT NULL
|
|
|
|
#define ChannelFile_channels_MSGTYPE Channel
|
2020-12-28 05:22:10 +00:00
|
|
|
|
2022-04-18 16:27:17 +00:00
|
|
|
#define OEMStore_FIELDLIST(X, a) \
|
|
|
|
X(a, STATIC, SINGULAR, UINT32, oem_icon_width, 1) \
|
|
|
|
X(a, STATIC, SINGULAR, UINT32, oem_icon_height, 2) \
|
|
|
|
X(a, STATIC, SINGULAR, BYTES, oem_icon_bits, 3) \
|
|
|
|
X(a, STATIC, SINGULAR, UENUM, oem_font, 4) \
|
2022-10-19 11:44:12 +00:00
|
|
|
X(a, STATIC, SINGULAR, STRING, oem_text, 5) \
|
|
|
|
X(a, STATIC, SINGULAR, BYTES, oem_aes_key, 6)
|
2022-04-18 16:27:17 +00:00
|
|
|
#define OEMStore_CALLBACK NULL
|
|
|
|
#define OEMStore_DEFAULT NULL
|
|
|
|
|
2020-12-28 05:22:10 +00:00
|
|
|
extern const pb_msgdesc_t DeviceState_msg;
|
2021-03-11 05:02:00 +00:00
|
|
|
extern const pb_msgdesc_t ChannelFile_msg;
|
2022-04-18 16:27:17 +00:00
|
|
|
extern const pb_msgdesc_t OEMStore_msg;
|
2020-12-28 05:22:10 +00:00
|
|
|
|
|
|
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
|
|
|
#define DeviceState_fields &DeviceState_msg
|
2021-03-11 05:02:00 +00:00
|
|
|
#define ChannelFile_fields &ChannelFile_msg
|
2022-04-18 16:27:17 +00:00
|
|
|
#define OEMStore_fields &OEMStore_msg
|
2020-12-28 05:22:10 +00:00
|
|
|
|
|
|
|
/* Maximum encoded size of messages (where known) */
|
2022-10-03 00:45:15 +00:00
|
|
|
#define ChannelFile_size 638
|
2022-09-09 09:19:18 +00:00
|
|
|
#define DeviceState_size 21800
|
2022-10-19 11:44:12 +00:00
|
|
|
#define OEMStore_size 2140
|
2020-12-28 05:22:10 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
2021-02-16 07:41:52 +00:00
|
|
|
#endif
|