mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-02 16:10:43 +00:00
Add QueueStatus sending to the firmware (#1820)
* Yank mqtt service envelope queue * trybuildfix mqtt system * removed too much * no excessive heap debugging on release builds * send QueueStatus messages The QueueStatus message is sent as a response to the attempt to queue an outgoing MeshPacket and contains statuses of the last queue attempt, TX Queue space and capacity and MeshPacket.id that was queued. When TX Queue changes status from completely full to at least a single slot free a QueueStatus message is also sent to notify that user can queue more messages. Signed-off-by: Pavel Boldin <pavel.b@techspark.engineering> * WIP: update protobufs Signed-off-by: Pavel Boldin <pavel.b@techspark.engineering> * update protobufs * regen protos Signed-off-by: Pavel Boldin <pavel.b@techspark.engineering> Co-authored-by: Ben Meadors <benmmeadors@gmail.com> Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com> Co-authored-by: Sacha Weatherstone <sachaw100@hotmail.com>
This commit is contained in:
@@ -36,6 +36,9 @@ PB_BIND(MyNodeInfo, MyNodeInfo, AUTO)
|
||||
PB_BIND(LogRecord, LogRecord, AUTO)
|
||||
|
||||
|
||||
PB_BIND(QueueStatus, QueueStatus, AUTO)
|
||||
|
||||
|
||||
PB_BIND(FromRadio, FromRadio, 2)
|
||||
|
||||
|
||||
|
||||
@@ -621,6 +621,17 @@ typedef struct _LogRecord {
|
||||
LogRecord_Level level;
|
||||
} LogRecord;
|
||||
|
||||
typedef struct _QueueStatus {
|
||||
/* Last attempt to queue status, ErrorCode */
|
||||
int8_t res;
|
||||
/* Free entries in the outgoing queue */
|
||||
uint8_t free;
|
||||
/* Maximum entries in the outgoing queue */
|
||||
uint8_t maxlen;
|
||||
/* What was mesh packet id that generated this response? */
|
||||
uint32_t mesh_packet_id;
|
||||
} QueueStatus;
|
||||
|
||||
/* Packets from the radio to the phone will appear on the fromRadio characteristic.
|
||||
It will support READ and NOTIFY. When a new packet arrives the device will BLE notify?
|
||||
It will sit in that descriptor until consumed by the phone,
|
||||
@@ -657,6 +668,8 @@ typedef struct _FromRadio {
|
||||
ModuleConfig moduleConfig;
|
||||
/* One packet is sent for each channel */
|
||||
Channel channel;
|
||||
/* Queue status info */
|
||||
QueueStatus queueStatus;
|
||||
};
|
||||
} FromRadio;
|
||||
|
||||
@@ -755,6 +768,7 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
|
||||
#define Compressed_portnum_ENUMTYPE PortNum
|
||||
|
||||
|
||||
@@ -769,6 +783,7 @@ extern "C" {
|
||||
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0, false, DeviceMetrics_init_default}
|
||||
#define MyNodeInfo_init_default {0, 0, 0, "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
|
||||
#define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN}
|
||||
#define QueueStatus_init_default {0, 0, 0, 0}
|
||||
#define FromRadio_init_default {0, 0, {MeshPacket_init_default}}
|
||||
#define ToRadio_init_default {0, {MeshPacket_init_default}}
|
||||
#define Compressed_init_default {_PortNum_MIN, {0, {0}}}
|
||||
@@ -782,6 +797,7 @@ extern "C" {
|
||||
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0, false, DeviceMetrics_init_zero}
|
||||
#define MyNodeInfo_init_zero {0, 0, 0, "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
|
||||
#define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN}
|
||||
#define QueueStatus_init_zero {0, 0, 0, 0}
|
||||
#define FromRadio_init_zero {0, 0, {MeshPacket_init_zero}}
|
||||
#define ToRadio_init_zero {0, {MeshPacket_init_zero}}
|
||||
#define Compressed_init_zero {_PortNum_MIN, {0, {0}}}
|
||||
@@ -873,6 +889,10 @@ extern "C" {
|
||||
#define LogRecord_time_tag 2
|
||||
#define LogRecord_source_tag 3
|
||||
#define LogRecord_level_tag 4
|
||||
#define QueueStatus_res_tag 1
|
||||
#define QueueStatus_free_tag 2
|
||||
#define QueueStatus_maxlen_tag 3
|
||||
#define QueueStatus_mesh_packet_id_tag 4
|
||||
#define FromRadio_id_tag 1
|
||||
#define FromRadio_packet_tag 2
|
||||
#define FromRadio_my_info_tag 3
|
||||
@@ -883,6 +903,7 @@ extern "C" {
|
||||
#define FromRadio_rebooted_tag 8
|
||||
#define FromRadio_moduleConfig_tag 9
|
||||
#define FromRadio_channel_tag 10
|
||||
#define FromRadio_queueStatus_tag 11
|
||||
#define ToRadio_packet_tag 1
|
||||
#define ToRadio_want_config_id_tag 3
|
||||
#define ToRadio_disconnect_tag 4
|
||||
@@ -1022,6 +1043,14 @@ X(a, STATIC, SINGULAR, UENUM, level, 4)
|
||||
#define LogRecord_CALLBACK NULL
|
||||
#define LogRecord_DEFAULT NULL
|
||||
|
||||
#define QueueStatus_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, INT32, res, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, free, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, maxlen, 3) \
|
||||
X(a, STATIC, SINGULAR, UINT32, mesh_packet_id, 4)
|
||||
#define QueueStatus_CALLBACK NULL
|
||||
#define QueueStatus_DEFAULT NULL
|
||||
|
||||
#define FromRadio_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, id, 1) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,packet,packet), 2) \
|
||||
@@ -1032,7 +1061,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,log_record,log_record), 6)
|
||||
X(a, STATIC, ONEOF, UINT32, (payload_variant,config_complete_id,config_complete_id), 7) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,rebooted,rebooted), 8) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,moduleConfig,moduleConfig), 9) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,channel,channel), 10)
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,channel,channel), 10) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,queueStatus,queueStatus), 11)
|
||||
#define FromRadio_CALLBACK NULL
|
||||
#define FromRadio_DEFAULT NULL
|
||||
#define FromRadio_payload_variant_packet_MSGTYPE MeshPacket
|
||||
@@ -1042,6 +1072,7 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,channel,channel), 10)
|
||||
#define FromRadio_payload_variant_log_record_MSGTYPE LogRecord
|
||||
#define FromRadio_payload_variant_moduleConfig_MSGTYPE ModuleConfig
|
||||
#define FromRadio_payload_variant_channel_MSGTYPE Channel
|
||||
#define FromRadio_payload_variant_queueStatus_MSGTYPE QueueStatus
|
||||
|
||||
#define ToRadio_FIELDLIST(X, a) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,packet,packet), 1) \
|
||||
@@ -1067,6 +1098,7 @@ extern const pb_msgdesc_t MeshPacket_msg;
|
||||
extern const pb_msgdesc_t NodeInfo_msg;
|
||||
extern const pb_msgdesc_t MyNodeInfo_msg;
|
||||
extern const pb_msgdesc_t LogRecord_msg;
|
||||
extern const pb_msgdesc_t QueueStatus_msg;
|
||||
extern const pb_msgdesc_t FromRadio_msg;
|
||||
extern const pb_msgdesc_t ToRadio_msg;
|
||||
extern const pb_msgdesc_t Compressed_msg;
|
||||
@@ -1082,6 +1114,7 @@ extern const pb_msgdesc_t Compressed_msg;
|
||||
#define NodeInfo_fields &NodeInfo_msg
|
||||
#define MyNodeInfo_fields &MyNodeInfo_msg
|
||||
#define LogRecord_fields &LogRecord_msg
|
||||
#define QueueStatus_fields &QueueStatus_msg
|
||||
#define FromRadio_fields &FromRadio_msg
|
||||
#define ToRadio_fields &ToRadio_msg
|
||||
#define Compressed_fields &Compressed_msg
|
||||
@@ -1095,6 +1128,7 @@ extern const pb_msgdesc_t Compressed_msg;
|
||||
#define MyNodeInfo_size 179
|
||||
#define NodeInfo_size 258
|
||||
#define Position_size 137
|
||||
#define QueueStatus_size 23
|
||||
#define RouteDiscovery_size 40
|
||||
#define Routing_size 42
|
||||
#define ToRadio_size 324
|
||||
|
||||
@@ -301,6 +301,7 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
|
||||
#define ModuleConfig_AudioConfig_bitrate_ENUMTYPE ModuleConfig_AudioConfig_Audio_Baud
|
||||
|
||||
#define ModuleConfig_SerialConfig_baud_ENUMTYPE ModuleConfig_SerialConfig_Serial_Baud
|
||||
|
||||
Reference in New Issue
Block a user