mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-21 17:20:01 +00:00
Merge branch 'meshtastic:master' into master
This commit is contained in:
commit
c11247ea69
@ -1 +1 @@
|
|||||||
Subproject commit 5a97acb17543a10e114675a205e3274a83e721af
|
Subproject commit 00332412b238fe559175a6e83fdf8d31fa5e209a
|
@ -324,7 +324,7 @@ extern const pb_msgdesc_t meshtastic_NodeRemoteHardwarePin_msg;
|
|||||||
#define meshtastic_DeviceState_size 17571
|
#define meshtastic_DeviceState_size 17571
|
||||||
#define meshtastic_NodeInfoLite_size 158
|
#define meshtastic_NodeInfoLite_size 158
|
||||||
#define meshtastic_NodeRemoteHardwarePin_size 29
|
#define meshtastic_NodeRemoteHardwarePin_size 29
|
||||||
#define meshtastic_OEMStore_size 3246
|
#define meshtastic_OEMStore_size 3262
|
||||||
#define meshtastic_PositionLite_size 28
|
#define meshtastic_PositionLite_size 28
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -181,7 +181,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define meshtastic_LocalConfig_size 469
|
#define meshtastic_LocalConfig_size 469
|
||||||
#define meshtastic_LocalModuleConfig_size 631
|
#define meshtastic_LocalModuleConfig_size 647
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -6,12 +6,15 @@
|
|||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PB_BIND(meshtastic_ModuleConfig, meshtastic_ModuleConfig, AUTO)
|
PB_BIND(meshtastic_ModuleConfig, meshtastic_ModuleConfig, 2)
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_ModuleConfig_MQTTConfig, meshtastic_ModuleConfig_MQTTConfig, AUTO)
|
PB_BIND(meshtastic_ModuleConfig_MQTTConfig, meshtastic_ModuleConfig_MQTTConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_ModuleConfig_MapReportSettings, meshtastic_ModuleConfig_MapReportSettings, AUTO)
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_ModuleConfig_RemoteHardwareConfig, meshtastic_ModuleConfig_RemoteHardwareConfig, AUTO)
|
PB_BIND(meshtastic_ModuleConfig_RemoteHardwareConfig, meshtastic_ModuleConfig_RemoteHardwareConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,6 +84,14 @@ typedef enum _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar {
|
|||||||
} meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar;
|
} meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar;
|
||||||
|
|
||||||
/* Struct definitions */
|
/* Struct definitions */
|
||||||
|
/* Settings for reporting unencrypted information about our node to a map via MQTT */
|
||||||
|
typedef struct _meshtastic_ModuleConfig_MapReportSettings {
|
||||||
|
/* How often we should report our info to the map (in seconds) */
|
||||||
|
uint32_t publish_interval_secs;
|
||||||
|
/* Bits of precision for the location sent (default of 32 is full precision). */
|
||||||
|
uint32_t position_precision;
|
||||||
|
} meshtastic_ModuleConfig_MapReportSettings;
|
||||||
|
|
||||||
/* MQTT Client Config */
|
/* MQTT Client Config */
|
||||||
typedef struct _meshtastic_ModuleConfig_MQTTConfig {
|
typedef struct _meshtastic_ModuleConfig_MQTTConfig {
|
||||||
/* If a meshtastic node is able to reach the internet it will normally attempt to gateway any channels that are marked as
|
/* If a meshtastic node is able to reach the internet it will normally attempt to gateway any channels that are marked as
|
||||||
@ -114,6 +122,11 @@ typedef struct _meshtastic_ModuleConfig_MQTTConfig {
|
|||||||
char root[16];
|
char root[16];
|
||||||
/* If true, we can use the connected phone / client to proxy messages to MQTT instead of a direct connection */
|
/* If true, we can use the connected phone / client to proxy messages to MQTT instead of a direct connection */
|
||||||
bool proxy_to_client_enabled;
|
bool proxy_to_client_enabled;
|
||||||
|
/* If true, we will periodically report unencrypted information about our node to a map via MQTT */
|
||||||
|
bool map_reporting_enabled;
|
||||||
|
/* Settings for reporting information about our node to a map via MQTT */
|
||||||
|
bool has_map_report_settings;
|
||||||
|
meshtastic_ModuleConfig_MapReportSettings map_report_settings;
|
||||||
} meshtastic_ModuleConfig_MQTTConfig;
|
} meshtastic_ModuleConfig_MQTTConfig;
|
||||||
|
|
||||||
/* NeighborInfoModule Config */
|
/* NeighborInfoModule Config */
|
||||||
@ -427,6 +440,7 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define meshtastic_ModuleConfig_AudioConfig_bitrate_ENUMTYPE meshtastic_ModuleConfig_AudioConfig_Audio_Baud
|
#define meshtastic_ModuleConfig_AudioConfig_bitrate_ENUMTYPE meshtastic_ModuleConfig_AudioConfig_Audio_Baud
|
||||||
|
|
||||||
|
|
||||||
@ -447,7 +461,8 @@ extern "C" {
|
|||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_ModuleConfig_init_default {0, {meshtastic_ModuleConfig_MQTTConfig_init_default}}
|
#define meshtastic_ModuleConfig_init_default {0, {meshtastic_ModuleConfig_MQTTConfig_init_default}}
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0, 0, "", 0}
|
#define meshtastic_ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0, 0, "", 0, 0, false, meshtastic_ModuleConfig_MapReportSettings_init_default}
|
||||||
|
#define meshtastic_ModuleConfig_MapReportSettings_init_default {0, 0}
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_default {0, 0, 0, {meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default}}
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_default {0, 0, 0, {meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default}}
|
||||||
#define meshtastic_ModuleConfig_NeighborInfoConfig_init_default {0, 0}
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_init_default {0, 0}
|
||||||
#define meshtastic_ModuleConfig_DetectionSensorConfig_init_default {0, 0, 0, 0, "", 0, 0, 0}
|
#define meshtastic_ModuleConfig_DetectionSensorConfig_init_default {0, 0, 0, 0, "", 0, 0, 0}
|
||||||
@ -462,7 +477,8 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_AmbientLightingConfig_init_default {0, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_AmbientLightingConfig_init_default {0, 0, 0, 0, 0}
|
||||||
#define meshtastic_RemoteHardwarePin_init_default {0, "", _meshtastic_RemoteHardwarePinType_MIN}
|
#define meshtastic_RemoteHardwarePin_init_default {0, "", _meshtastic_RemoteHardwarePinType_MIN}
|
||||||
#define meshtastic_ModuleConfig_init_zero {0, {meshtastic_ModuleConfig_MQTTConfig_init_zero}}
|
#define meshtastic_ModuleConfig_init_zero {0, {meshtastic_ModuleConfig_MQTTConfig_init_zero}}
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0, 0, "", 0}
|
#define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0, 0, "", 0, 0, false, meshtastic_ModuleConfig_MapReportSettings_init_zero}
|
||||||
|
#define meshtastic_ModuleConfig_MapReportSettings_init_zero {0, 0}
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero {0, 0, 0, {meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero}}
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero {0, 0, 0, {meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero}}
|
||||||
#define meshtastic_ModuleConfig_NeighborInfoConfig_init_zero {0, 0}
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_init_zero {0, 0}
|
||||||
#define meshtastic_ModuleConfig_DetectionSensorConfig_init_zero {0, 0, 0, 0, "", 0, 0, 0}
|
#define meshtastic_ModuleConfig_DetectionSensorConfig_init_zero {0, 0, 0, 0, "", 0, 0, 0}
|
||||||
@ -478,6 +494,8 @@ extern "C" {
|
|||||||
#define meshtastic_RemoteHardwarePin_init_zero {0, "", _meshtastic_RemoteHardwarePinType_MIN}
|
#define meshtastic_RemoteHardwarePin_init_zero {0, "", _meshtastic_RemoteHardwarePinType_MIN}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
|
#define meshtastic_ModuleConfig_MapReportSettings_publish_interval_secs_tag 1
|
||||||
|
#define meshtastic_ModuleConfig_MapReportSettings_position_precision_tag 2
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_enabled_tag 1
|
#define meshtastic_ModuleConfig_MQTTConfig_enabled_tag 1
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_address_tag 2
|
#define meshtastic_ModuleConfig_MQTTConfig_address_tag 2
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_username_tag 3
|
#define meshtastic_ModuleConfig_MQTTConfig_username_tag 3
|
||||||
@ -487,6 +505,8 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_MQTTConfig_tls_enabled_tag 7
|
#define meshtastic_ModuleConfig_MQTTConfig_tls_enabled_tag 7
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_root_tag 8
|
#define meshtastic_ModuleConfig_MQTTConfig_root_tag 8
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_proxy_to_client_enabled_tag 9
|
#define meshtastic_ModuleConfig_MQTTConfig_proxy_to_client_enabled_tag 9
|
||||||
|
#define meshtastic_ModuleConfig_MQTTConfig_map_reporting_enabled_tag 10
|
||||||
|
#define meshtastic_ModuleConfig_MQTTConfig_map_report_settings_tag 11
|
||||||
#define meshtastic_ModuleConfig_NeighborInfoConfig_enabled_tag 1
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_enabled_tag 1
|
||||||
#define meshtastic_ModuleConfig_NeighborInfoConfig_update_interval_tag 2
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_update_interval_tag 2
|
||||||
#define meshtastic_ModuleConfig_DetectionSensorConfig_enabled_tag 1
|
#define meshtastic_ModuleConfig_DetectionSensorConfig_enabled_tag 1
|
||||||
@ -623,9 +643,18 @@ X(a, STATIC, SINGULAR, BOOL, encryption_enabled, 5) \
|
|||||||
X(a, STATIC, SINGULAR, BOOL, json_enabled, 6) \
|
X(a, STATIC, SINGULAR, BOOL, json_enabled, 6) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, tls_enabled, 7) \
|
X(a, STATIC, SINGULAR, BOOL, tls_enabled, 7) \
|
||||||
X(a, STATIC, SINGULAR, STRING, root, 8) \
|
X(a, STATIC, SINGULAR, STRING, root, 8) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, proxy_to_client_enabled, 9)
|
X(a, STATIC, SINGULAR, BOOL, proxy_to_client_enabled, 9) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, map_reporting_enabled, 10) \
|
||||||
|
X(a, STATIC, OPTIONAL, MESSAGE, map_report_settings, 11)
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_CALLBACK NULL
|
#define meshtastic_ModuleConfig_MQTTConfig_CALLBACK NULL
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_DEFAULT NULL
|
#define meshtastic_ModuleConfig_MQTTConfig_DEFAULT NULL
|
||||||
|
#define meshtastic_ModuleConfig_MQTTConfig_map_report_settings_MSGTYPE meshtastic_ModuleConfig_MapReportSettings
|
||||||
|
|
||||||
|
#define meshtastic_ModuleConfig_MapReportSettings_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, publish_interval_secs, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, position_precision, 2)
|
||||||
|
#define meshtastic_ModuleConfig_MapReportSettings_CALLBACK NULL
|
||||||
|
#define meshtastic_ModuleConfig_MapReportSettings_DEFAULT NULL
|
||||||
|
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_FIELDLIST(X, a) \
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||||
@ -764,6 +793,7 @@ X(a, STATIC, SINGULAR, UENUM, type, 3)
|
|||||||
|
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_MQTTConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_MQTTConfig_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_MapReportSettings_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_RemoteHardwareConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_RemoteHardwareConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_NeighborInfoConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_NeighborInfoConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_DetectionSensorConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_DetectionSensorConfig_msg;
|
||||||
@ -781,6 +811,7 @@ extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg;
|
|||||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
#define meshtastic_ModuleConfig_fields &meshtastic_ModuleConfig_msg
|
#define meshtastic_ModuleConfig_fields &meshtastic_ModuleConfig_msg
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_fields &meshtastic_ModuleConfig_MQTTConfig_msg
|
#define meshtastic_ModuleConfig_MQTTConfig_fields &meshtastic_ModuleConfig_MQTTConfig_msg
|
||||||
|
#define meshtastic_ModuleConfig_MapReportSettings_fields &meshtastic_ModuleConfig_MapReportSettings_msg
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_fields &meshtastic_ModuleConfig_RemoteHardwareConfig_msg
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_fields &meshtastic_ModuleConfig_RemoteHardwareConfig_msg
|
||||||
#define meshtastic_ModuleConfig_NeighborInfoConfig_fields &meshtastic_ModuleConfig_NeighborInfoConfig_msg
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_fields &meshtastic_ModuleConfig_NeighborInfoConfig_msg
|
||||||
#define meshtastic_ModuleConfig_DetectionSensorConfig_fields &meshtastic_ModuleConfig_DetectionSensorConfig_msg
|
#define meshtastic_ModuleConfig_DetectionSensorConfig_fields &meshtastic_ModuleConfig_DetectionSensorConfig_msg
|
||||||
@ -801,7 +832,8 @@ extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg;
|
|||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_size 49
|
#define meshtastic_ModuleConfig_CannedMessageConfig_size 49
|
||||||
#define meshtastic_ModuleConfig_DetectionSensorConfig_size 44
|
#define meshtastic_ModuleConfig_DetectionSensorConfig_size 44
|
||||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_size 42
|
#define meshtastic_ModuleConfig_ExternalNotificationConfig_size 42
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_size 222
|
#define meshtastic_ModuleConfig_MQTTConfig_size 238
|
||||||
|
#define meshtastic_ModuleConfig_MapReportSettings_size 12
|
||||||
#define meshtastic_ModuleConfig_NeighborInfoConfig_size 8
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_size 8
|
||||||
#define meshtastic_ModuleConfig_PaxcounterConfig_size 8
|
#define meshtastic_ModuleConfig_PaxcounterConfig_size 8
|
||||||
#define meshtastic_ModuleConfig_RangeTestConfig_size 10
|
#define meshtastic_ModuleConfig_RangeTestConfig_size 10
|
||||||
@ -809,7 +841,7 @@ extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg;
|
|||||||
#define meshtastic_ModuleConfig_SerialConfig_size 28
|
#define meshtastic_ModuleConfig_SerialConfig_size 28
|
||||||
#define meshtastic_ModuleConfig_StoreForwardConfig_size 22
|
#define meshtastic_ModuleConfig_StoreForwardConfig_size 22
|
||||||
#define meshtastic_ModuleConfig_TelemetryConfig_size 36
|
#define meshtastic_ModuleConfig_TelemetryConfig_size 36
|
||||||
#define meshtastic_ModuleConfig_size 225
|
#define meshtastic_ModuleConfig_size 241
|
||||||
#define meshtastic_RemoteHardwarePin_size 21
|
#define meshtastic_RemoteHardwarePin_size 21
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -9,4 +9,7 @@
|
|||||||
PB_BIND(meshtastic_ServiceEnvelope, meshtastic_ServiceEnvelope, AUTO)
|
PB_BIND(meshtastic_ServiceEnvelope, meshtastic_ServiceEnvelope, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_MapReport, meshtastic_MapReport, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#define PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED
|
#define PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "meshtastic/mesh.pb.h"
|
#include "meshtastic/mesh.pb.h"
|
||||||
|
#include "meshtastic/config.pb.h"
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
@ -23,6 +24,38 @@ typedef struct _meshtastic_ServiceEnvelope {
|
|||||||
char *gateway_id;
|
char *gateway_id;
|
||||||
} meshtastic_ServiceEnvelope;
|
} meshtastic_ServiceEnvelope;
|
||||||
|
|
||||||
|
/* Information about a node intended to be reported unencrypted to a map using MQTT. */
|
||||||
|
typedef struct _meshtastic_MapReport {
|
||||||
|
/* A full name for this user, i.e. "Kevin Hester" */
|
||||||
|
char long_name[40];
|
||||||
|
/* A VERY short name, ideally two characters.
|
||||||
|
Suitable for a tiny OLED screen */
|
||||||
|
char short_name[5];
|
||||||
|
/* Role of the node that applies specific settings for a particular use-case */
|
||||||
|
meshtastic_Config_DeviceConfig_Role role;
|
||||||
|
/* Hardware model of the node, i.e. T-Beam, Heltec V3, etc... */
|
||||||
|
meshtastic_HardwareModel hw_model;
|
||||||
|
/* Device firmware version string */
|
||||||
|
char firmware_version[18];
|
||||||
|
/* The region code for the radio (US, CN, EU433, etc...) */
|
||||||
|
meshtastic_Config_LoRaConfig_RegionCode region;
|
||||||
|
/* Modem preset used by the radio (LongFast, MediumSlow, etc...) */
|
||||||
|
meshtastic_Config_LoRaConfig_ModemPreset modem_preset;
|
||||||
|
/* Whether the node has a channel with default PSK and name (LongFast, MediumSlow, etc...)
|
||||||
|
and it uses the default frequency slot given the region and modem preset. */
|
||||||
|
bool has_default_channel;
|
||||||
|
/* Latitude: multiply by 1e-7 to get degrees in floating point */
|
||||||
|
int32_t latitude_i;
|
||||||
|
/* Longitude: multiply by 1e-7 to get degrees in floating point */
|
||||||
|
int32_t longitude_i;
|
||||||
|
/* Altitude in meters above MSL */
|
||||||
|
int32_t altitude;
|
||||||
|
/* Indicates the bits of precision for latitude and longitude set by the sending node */
|
||||||
|
uint32_t position_precision;
|
||||||
|
/* Number of online nodes (heard in the last 2 hours) this node has in its list that were received locally (not via MQTT) */
|
||||||
|
uint16_t num_online_local_nodes;
|
||||||
|
} meshtastic_MapReport;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -30,12 +63,27 @@ extern "C" {
|
|||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_ServiceEnvelope_init_default {NULL, NULL, NULL}
|
#define meshtastic_ServiceEnvelope_init_default {NULL, NULL, NULL}
|
||||||
|
#define meshtastic_MapReport_init_default {"", "", _meshtastic_Config_DeviceConfig_Role_MIN, _meshtastic_HardwareModel_MIN, "", _meshtastic_Config_LoRaConfig_RegionCode_MIN, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_ServiceEnvelope_init_zero {NULL, NULL, NULL}
|
#define meshtastic_ServiceEnvelope_init_zero {NULL, NULL, NULL}
|
||||||
|
#define meshtastic_MapReport_init_zero {"", "", _meshtastic_Config_DeviceConfig_Role_MIN, _meshtastic_HardwareModel_MIN, "", _meshtastic_Config_LoRaConfig_RegionCode_MIN, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, 0, 0}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define meshtastic_ServiceEnvelope_packet_tag 1
|
#define meshtastic_ServiceEnvelope_packet_tag 1
|
||||||
#define meshtastic_ServiceEnvelope_channel_id_tag 2
|
#define meshtastic_ServiceEnvelope_channel_id_tag 2
|
||||||
#define meshtastic_ServiceEnvelope_gateway_id_tag 3
|
#define meshtastic_ServiceEnvelope_gateway_id_tag 3
|
||||||
|
#define meshtastic_MapReport_long_name_tag 1
|
||||||
|
#define meshtastic_MapReport_short_name_tag 2
|
||||||
|
#define meshtastic_MapReport_role_tag 3
|
||||||
|
#define meshtastic_MapReport_hw_model_tag 4
|
||||||
|
#define meshtastic_MapReport_firmware_version_tag 5
|
||||||
|
#define meshtastic_MapReport_region_tag 6
|
||||||
|
#define meshtastic_MapReport_modem_preset_tag 7
|
||||||
|
#define meshtastic_MapReport_has_default_channel_tag 8
|
||||||
|
#define meshtastic_MapReport_latitude_i_tag 9
|
||||||
|
#define meshtastic_MapReport_longitude_i_tag 10
|
||||||
|
#define meshtastic_MapReport_altitude_tag 11
|
||||||
|
#define meshtastic_MapReport_position_precision_tag 12
|
||||||
|
#define meshtastic_MapReport_num_online_local_nodes_tag 13
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define meshtastic_ServiceEnvelope_FIELDLIST(X, a) \
|
#define meshtastic_ServiceEnvelope_FIELDLIST(X, a) \
|
||||||
@ -46,13 +94,33 @@ X(a, POINTER, SINGULAR, STRING, gateway_id, 3)
|
|||||||
#define meshtastic_ServiceEnvelope_DEFAULT NULL
|
#define meshtastic_ServiceEnvelope_DEFAULT NULL
|
||||||
#define meshtastic_ServiceEnvelope_packet_MSGTYPE meshtastic_MeshPacket
|
#define meshtastic_ServiceEnvelope_packet_MSGTYPE meshtastic_MeshPacket
|
||||||
|
|
||||||
|
#define meshtastic_MapReport_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, long_name, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, short_name, 2) \
|
||||||
|
X(a, STATIC, SINGULAR, UENUM, role, 3) \
|
||||||
|
X(a, STATIC, SINGULAR, UENUM, hw_model, 4) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, firmware_version, 5) \
|
||||||
|
X(a, STATIC, SINGULAR, UENUM, region, 6) \
|
||||||
|
X(a, STATIC, SINGULAR, UENUM, modem_preset, 7) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, has_default_channel, 8) \
|
||||||
|
X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 9) \
|
||||||
|
X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 10) \
|
||||||
|
X(a, STATIC, SINGULAR, INT32, altitude, 11) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, position_precision, 12) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, num_online_local_nodes, 13)
|
||||||
|
#define meshtastic_MapReport_CALLBACK NULL
|
||||||
|
#define meshtastic_MapReport_DEFAULT NULL
|
||||||
|
|
||||||
extern const pb_msgdesc_t meshtastic_ServiceEnvelope_msg;
|
extern const pb_msgdesc_t meshtastic_ServiceEnvelope_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_MapReport_msg;
|
||||||
|
|
||||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
#define meshtastic_ServiceEnvelope_fields &meshtastic_ServiceEnvelope_msg
|
#define meshtastic_ServiceEnvelope_fields &meshtastic_ServiceEnvelope_msg
|
||||||
|
#define meshtastic_MapReport_fields &meshtastic_MapReport_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
/* meshtastic_ServiceEnvelope_size depends on runtime parameters */
|
/* meshtastic_ServiceEnvelope_size depends on runtime parameters */
|
||||||
|
#define meshtastic_MapReport_size 108
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -122,6 +122,8 @@ typedef enum _meshtastic_PortNum {
|
|||||||
/* ATAK Plugin
|
/* ATAK Plugin
|
||||||
Portnum for payloads from the official Meshtastic ATAK plugin */
|
Portnum for payloads from the official Meshtastic ATAK plugin */
|
||||||
meshtastic_PortNum_ATAK_PLUGIN = 72,
|
meshtastic_PortNum_ATAK_PLUGIN = 72,
|
||||||
|
/* Provides unencrypted information about a node for consumption by a map via MQTT */
|
||||||
|
meshtastic_PortNum_MAP_REPORT_APP = 73,
|
||||||
/* Private applications should use portnums >= 256.
|
/* Private applications should use portnums >= 256.
|
||||||
To simplify initial development and testing you can use "PRIVATE_APP"
|
To simplify initial development and testing you can use "PRIVATE_APP"
|
||||||
in your code without needing to rebuild protobuf files (via [regen-protos.sh](https://github.com/meshtastic/firmware/blob/master/bin/regen-protos.sh)) */
|
in your code without needing to rebuild protobuf files (via [regen-protos.sh](https://github.com/meshtastic/firmware/blob/master/bin/regen-protos.sh)) */
|
||||||
|
@ -7,9 +7,19 @@
|
|||||||
|
|
||||||
PaxcounterModule *paxcounterModule;
|
PaxcounterModule *paxcounterModule;
|
||||||
|
|
||||||
void NullFunc(){};
|
/**
|
||||||
|
* Callback function for libpax.
|
||||||
// paxcounterModule->sendInfo(NODENUM_BROADCAST);
|
* We only clear our sent flag here, since this function is called from another thread, so we
|
||||||
|
* cannot send to the mesh directly.
|
||||||
|
*/
|
||||||
|
void PaxcounterModule::handlePaxCounterReportRequest()
|
||||||
|
{
|
||||||
|
// The libpax library already updated our data structure, just before invoking this callback.
|
||||||
|
LOG_INFO("PaxcounterModule: libpax reported new data: wifi=%d; ble=%d; uptime=%lu\n",
|
||||||
|
paxcounterModule->count_from_libpax.wifi_count, paxcounterModule->count_from_libpax.ble_count, millis() / 1000);
|
||||||
|
paxcounterModule->reportedDataSent = false;
|
||||||
|
paxcounterModule->setIntervalFromNow(0);
|
||||||
|
}
|
||||||
|
|
||||||
PaxcounterModule::PaxcounterModule()
|
PaxcounterModule::PaxcounterModule()
|
||||||
: concurrency::OSThread("PaxcounterModule"),
|
: concurrency::OSThread("PaxcounterModule"),
|
||||||
@ -17,11 +27,20 @@ PaxcounterModule::PaxcounterModule()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send the Pax information to the mesh if we got new data from libpax.
|
||||||
|
* This is called periodically from our runOnce() method and will actually send the data to the mesh
|
||||||
|
* if libpax updated it since the last transmission through the callback.
|
||||||
|
* @param dest - destination node (usually NODENUM_BROADCAST)
|
||||||
|
* @return false if sending is unnecessary, true if information was sent
|
||||||
|
*/
|
||||||
bool PaxcounterModule::sendInfo(NodeNum dest)
|
bool PaxcounterModule::sendInfo(NodeNum dest)
|
||||||
{
|
{
|
||||||
libpax_counter_count(&count_from_libpax);
|
if (paxcounterModule->reportedDataSent)
|
||||||
LOG_INFO("(Sending): pax: wifi=%d; ble=%d; uptime=%d\n", count_from_libpax.wifi_count, count_from_libpax.ble_count,
|
return false;
|
||||||
millis() / 1000);
|
|
||||||
|
LOG_INFO("PaxcounterModule: sending pax info wifi=%d; ble=%d; uptime=%lu\n", count_from_libpax.wifi_count,
|
||||||
|
count_from_libpax.ble_count, millis() / 1000);
|
||||||
|
|
||||||
meshtastic_Paxcount pl = meshtastic_Paxcount_init_default;
|
meshtastic_Paxcount pl = meshtastic_Paxcount_init_default;
|
||||||
pl.wifi = count_from_libpax.wifi_count;
|
pl.wifi = count_from_libpax.wifi_count;
|
||||||
@ -34,6 +53,9 @@ bool PaxcounterModule::sendInfo(NodeNum dest)
|
|||||||
p->priority = meshtastic_MeshPacket_Priority_MIN;
|
p->priority = meshtastic_MeshPacket_Priority_MIN;
|
||||||
|
|
||||||
service.sendToMesh(p, RX_SRC_LOCAL, true);
|
service.sendToMesh(p, RX_SRC_LOCAL, true);
|
||||||
|
|
||||||
|
paxcounterModule->reportedDataSent = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +89,7 @@ int32_t PaxcounterModule::runOnce()
|
|||||||
libpax_default_config(&configuration);
|
libpax_default_config(&configuration);
|
||||||
|
|
||||||
configuration.blecounter = 1;
|
configuration.blecounter = 1;
|
||||||
configuration.blescantime = 0; // infinit
|
configuration.blescantime = 0; // infinite
|
||||||
configuration.wificounter = 1;
|
configuration.wificounter = 1;
|
||||||
configuration.wifi_channel_map = WIFI_CHANNEL_ALL;
|
configuration.wifi_channel_map = WIFI_CHANNEL_ALL;
|
||||||
configuration.wifi_channel_switch_interval = 50;
|
configuration.wifi_channel_switch_interval = 50;
|
||||||
@ -76,7 +98,8 @@ int32_t PaxcounterModule::runOnce()
|
|||||||
libpax_update_config(&configuration);
|
libpax_update_config(&configuration);
|
||||||
|
|
||||||
// internal processing initialization
|
// internal processing initialization
|
||||||
libpax_counter_init(NullFunc, &count_from_libpax, UINT16_MAX, 1);
|
libpax_counter_init(handlePaxCounterReportRequest, &count_from_libpax,
|
||||||
|
moduleConfig.paxcounter.paxcounter_update_interval, 0);
|
||||||
libpax_counter_start();
|
libpax_counter_start();
|
||||||
} else {
|
} else {
|
||||||
sendInfo(NODENUM_BROADCAST);
|
sendInfo(NODENUM_BROADCAST);
|
||||||
|
@ -8,11 +8,15 @@
|
|||||||
#include <libpax_api.h>
|
#include <libpax_api.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple example module that just replies with "Message received" to any message it receives.
|
* Wrapper module for the estimate passenger (PAX) count library (https://github.com/dbinfrago/libpax) which
|
||||||
|
* implements the core functionality of the ESP32 Paxcounter project (https://github.com/cyberman54/ESP32-Paxcounter)
|
||||||
*/
|
*/
|
||||||
class PaxcounterModule : private concurrency::OSThread, public ProtobufModule<meshtastic_Paxcount>
|
class PaxcounterModule : private concurrency::OSThread, public ProtobufModule<meshtastic_Paxcount>
|
||||||
{
|
{
|
||||||
bool firstTime = true;
|
bool firstTime = true;
|
||||||
|
bool reportedDataSent = true;
|
||||||
|
|
||||||
|
static void handlePaxCounterReportRequest();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PaxcounterModule();
|
PaxcounterModule();
|
||||||
|
Loading…
Reference in New Issue
Block a user