2022-02-27 04:52:22 +00:00
|
|
|
/* Automatically generated nanopb header */
|
2022-06-17 13:37:52 +00:00
|
|
|
/* Generated by nanopb-0.4.6 */
|
2022-02-27 04:52:22 +00:00
|
|
|
|
|
|
|
#ifndef PB_TELEMETRY_PB_H_INCLUDED
|
|
|
|
#define PB_TELEMETRY_PB_H_INCLUDED
|
|
|
|
#include <pb.h>
|
|
|
|
|
|
|
|
#if PB_PROTO_HEADER_VERSION != 40
|
|
|
|
#error Regenerate this file with the current version of nanopb generator.
|
|
|
|
#endif
|
|
|
|
|
2022-05-01 19:26:05 +00:00
|
|
|
/* Enum definitions */
|
|
|
|
/* TODO: REPLACE */
|
|
|
|
typedef enum _TelemetrySensorType {
|
2022-06-11 21:44:56 +00:00
|
|
|
/* No external telemetry sensor explicitly set */
|
2022-05-01 19:26:05 +00:00
|
|
|
TelemetrySensorType_NotSet = 0,
|
2022-06-11 21:44:56 +00:00
|
|
|
/* Moderate accuracy temperature */
|
2022-05-01 19:26:05 +00:00
|
|
|
TelemetrySensorType_DHT11 = 1,
|
2022-06-11 21:44:56 +00:00
|
|
|
/* High accuracy temperature */
|
2022-05-01 19:26:05 +00:00
|
|
|
TelemetrySensorType_DS18B20 = 2,
|
2022-06-11 21:44:56 +00:00
|
|
|
/* Moderate accuracy temperature and humidity */
|
2022-05-01 19:26:05 +00:00
|
|
|
TelemetrySensorType_DHT12 = 3,
|
2022-06-11 21:44:56 +00:00
|
|
|
/* Moderate accuracy temperature and humidity */
|
2022-05-01 19:26:05 +00:00
|
|
|
TelemetrySensorType_DHT21 = 4,
|
2022-06-11 21:44:56 +00:00
|
|
|
/* Moderate accuracy temperature and humidity */
|
2022-05-01 19:26:05 +00:00
|
|
|
TelemetrySensorType_DHT22 = 5,
|
2022-06-11 21:44:56 +00:00
|
|
|
/* High accuracy temperature, pressure, humidity */
|
2022-05-01 19:26:05 +00:00
|
|
|
TelemetrySensorType_BME280 = 6,
|
2022-06-11 21:44:56 +00:00
|
|
|
/* High accuracy temperature, pressure, humidity, and air resistance */
|
2022-05-01 19:26:05 +00:00
|
|
|
TelemetrySensorType_BME680 = 7,
|
2022-06-11 21:44:56 +00:00
|
|
|
/* Very high accuracy temperature */
|
2022-05-01 19:26:05 +00:00
|
|
|
TelemetrySensorType_MCP9808 = 8,
|
2022-06-11 21:44:56 +00:00
|
|
|
/* Moderate accuracy temperature and humidity */
|
|
|
|
TelemetrySensorType_SHTC3 = 9,
|
|
|
|
/* Moderate accuracy current and voltage */
|
|
|
|
TelemetrySensorType_INA260 = 10,
|
|
|
|
/* Moderate accuracy current and voltage */
|
|
|
|
TelemetrySensorType_INA219 = 11
|
2022-05-01 19:26:05 +00:00
|
|
|
} TelemetrySensorType;
|
|
|
|
|
2022-02-27 04:52:22 +00:00
|
|
|
/* Struct definitions */
|
2022-03-27 14:55:35 +00:00
|
|
|
/* Key native device metrics such as battery level */
|
|
|
|
typedef struct _DeviceMetrics {
|
2022-03-26 14:48:35 +00:00
|
|
|
/* 1-100 (0 means powered) */
|
2022-06-17 13:37:52 +00:00
|
|
|
uint32_t battery_level;
|
2022-03-27 14:55:35 +00:00
|
|
|
/* Voltage measured */
|
2022-06-17 13:37:52 +00:00
|
|
|
float voltage;
|
2022-03-26 14:48:35 +00:00
|
|
|
/* Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). */
|
2022-06-17 13:37:52 +00:00
|
|
|
float channel_utilization;
|
2022-03-26 14:48:35 +00:00
|
|
|
/* Percent of airtime for transmission used within the last hour. */
|
2022-06-17 13:37:52 +00:00
|
|
|
float air_util_tx;
|
2022-03-27 14:55:35 +00:00
|
|
|
} DeviceMetrics;
|
|
|
|
|
|
|
|
/* Weather station or other environmental metrics */
|
|
|
|
typedef struct _EnvironmentMetrics {
|
2022-03-26 14:48:35 +00:00
|
|
|
/* Temperature measured */
|
2022-06-17 13:37:52 +00:00
|
|
|
float temperature;
|
2022-03-26 14:48:35 +00:00
|
|
|
/* Relative humidity percent measured */
|
2022-06-17 13:37:52 +00:00
|
|
|
float relative_humidity;
|
2022-03-26 14:48:35 +00:00
|
|
|
/* Barometric pressure in hPA measured */
|
2022-06-17 13:37:52 +00:00
|
|
|
float barometric_pressure;
|
2022-03-26 14:48:35 +00:00
|
|
|
/* Gas resistance in mOhm measured */
|
2022-06-17 13:37:52 +00:00
|
|
|
float gas_resistance;
|
2022-03-26 14:48:35 +00:00
|
|
|
/* Voltage measured */
|
2022-06-17 13:37:52 +00:00
|
|
|
float voltage;
|
2022-03-26 14:48:35 +00:00
|
|
|
/* Current measured */
|
2022-06-17 13:37:52 +00:00
|
|
|
float current;
|
2022-03-27 14:55:35 +00:00
|
|
|
} EnvironmentMetrics;
|
|
|
|
|
|
|
|
/* Types of Measurements the telemetry module is equipped to handle */
|
|
|
|
typedef struct _Telemetry {
|
2022-06-12 14:44:23 +00:00
|
|
|
/* This is usually not sent over the mesh (to save space), but it is sent
|
|
|
|
from the phone so that the local device can set its RTC If it is sent over
|
|
|
|
the mesh (because there are devices on the mesh without GPS), it will only
|
|
|
|
be sent by devices which has a hardware GPS clock (IE Mobile Phone).
|
2022-03-27 14:55:35 +00:00
|
|
|
seconds since 1970 */
|
2022-06-17 13:37:52 +00:00
|
|
|
uint32_t time;
|
2022-03-27 14:55:35 +00:00
|
|
|
pb_size_t which_variant;
|
|
|
|
union {
|
2022-06-17 13:37:52 +00:00
|
|
|
/* Key native device metrics such as battery level */
|
2022-03-27 14:55:35 +00:00
|
|
|
DeviceMetrics device_metrics;
|
2022-06-17 13:37:52 +00:00
|
|
|
/* Weather station or other environmental metrics */
|
2022-03-27 14:55:35 +00:00
|
|
|
EnvironmentMetrics environment_metrics;
|
2022-06-17 13:37:52 +00:00
|
|
|
} variant;
|
2022-02-27 04:52:22 +00:00
|
|
|
} Telemetry;
|
|
|
|
|
|
|
|
|
2022-05-01 19:26:05 +00:00
|
|
|
/* Helper constants for enums */
|
|
|
|
#define _TelemetrySensorType_MIN TelemetrySensorType_NotSet
|
2022-06-11 21:44:56 +00:00
|
|
|
#define _TelemetrySensorType_MAX TelemetrySensorType_INA219
|
|
|
|
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_INA219+1))
|
2022-05-01 19:26:05 +00:00
|
|
|
|
|
|
|
|
2022-02-27 04:52:22 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Initializer values for message structs */
|
2022-03-27 14:55:35 +00:00
|
|
|
#define DeviceMetrics_init_default {0, 0, 0, 0}
|
|
|
|
#define EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0}
|
|
|
|
#define Telemetry_init_default {0, 0, {DeviceMetrics_init_default}}
|
|
|
|
#define DeviceMetrics_init_zero {0, 0, 0, 0}
|
|
|
|
#define EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0}
|
|
|
|
#define Telemetry_init_zero {0, 0, {DeviceMetrics_init_zero}}
|
2022-02-27 04:52:22 +00:00
|
|
|
|
|
|
|
/* Field tags (for use in manual encoding/decoding) */
|
2022-03-27 14:55:35 +00:00
|
|
|
#define DeviceMetrics_battery_level_tag 1
|
|
|
|
#define DeviceMetrics_voltage_tag 2
|
|
|
|
#define DeviceMetrics_channel_utilization_tag 3
|
|
|
|
#define DeviceMetrics_air_util_tx_tag 4
|
|
|
|
#define EnvironmentMetrics_temperature_tag 1
|
|
|
|
#define EnvironmentMetrics_relative_humidity_tag 2
|
|
|
|
#define EnvironmentMetrics_barometric_pressure_tag 3
|
|
|
|
#define EnvironmentMetrics_gas_resistance_tag 4
|
|
|
|
#define EnvironmentMetrics_voltage_tag 5
|
|
|
|
#define EnvironmentMetrics_current_tag 6
|
2022-03-20 14:55:38 +00:00
|
|
|
#define Telemetry_time_tag 1
|
2022-03-27 14:55:35 +00:00
|
|
|
#define Telemetry_device_metrics_tag 2
|
|
|
|
#define Telemetry_environment_metrics_tag 3
|
2022-02-27 04:52:22 +00:00
|
|
|
|
|
|
|
/* Struct field encoding specification for nanopb */
|
2022-03-27 14:55:35 +00:00
|
|
|
#define DeviceMetrics_FIELDLIST(X, a) \
|
|
|
|
X(a, STATIC, SINGULAR, UINT32, battery_level, 1) \
|
|
|
|
X(a, STATIC, SINGULAR, FLOAT, voltage, 2) \
|
|
|
|
X(a, STATIC, SINGULAR, FLOAT, channel_utilization, 3) \
|
|
|
|
X(a, STATIC, SINGULAR, FLOAT, air_util_tx, 4)
|
|
|
|
#define DeviceMetrics_CALLBACK NULL
|
|
|
|
#define DeviceMetrics_DEFAULT NULL
|
|
|
|
|
|
|
|
#define EnvironmentMetrics_FIELDLIST(X, a) \
|
|
|
|
X(a, STATIC, SINGULAR, FLOAT, temperature, 1) \
|
|
|
|
X(a, STATIC, SINGULAR, FLOAT, relative_humidity, 2) \
|
|
|
|
X(a, STATIC, SINGULAR, FLOAT, barometric_pressure, 3) \
|
|
|
|
X(a, STATIC, SINGULAR, FLOAT, gas_resistance, 4) \
|
|
|
|
X(a, STATIC, SINGULAR, FLOAT, voltage, 5) \
|
|
|
|
X(a, STATIC, SINGULAR, FLOAT, current, 6)
|
|
|
|
#define EnvironmentMetrics_CALLBACK NULL
|
|
|
|
#define EnvironmentMetrics_DEFAULT NULL
|
|
|
|
|
2022-02-27 04:52:22 +00:00
|
|
|
#define Telemetry_FIELDLIST(X, a) \
|
2022-03-20 14:55:38 +00:00
|
|
|
X(a, STATIC, SINGULAR, FIXED32, time, 1) \
|
2022-03-27 14:55:35 +00:00
|
|
|
X(a, STATIC, ONEOF, MESSAGE, (variant,device_metrics,variant.device_metrics), 2) \
|
|
|
|
X(a, STATIC, ONEOF, MESSAGE, (variant,environment_metrics,variant.environment_metrics), 3)
|
2022-02-27 04:52:22 +00:00
|
|
|
#define Telemetry_CALLBACK NULL
|
|
|
|
#define Telemetry_DEFAULT NULL
|
2022-03-27 14:55:35 +00:00
|
|
|
#define Telemetry_variant_device_metrics_MSGTYPE DeviceMetrics
|
|
|
|
#define Telemetry_variant_environment_metrics_MSGTYPE EnvironmentMetrics
|
2022-02-27 04:52:22 +00:00
|
|
|
|
2022-03-27 14:55:35 +00:00
|
|
|
extern const pb_msgdesc_t DeviceMetrics_msg;
|
|
|
|
extern const pb_msgdesc_t EnvironmentMetrics_msg;
|
2022-02-27 04:52:22 +00:00
|
|
|
extern const pb_msgdesc_t Telemetry_msg;
|
|
|
|
|
|
|
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
2022-03-27 14:55:35 +00:00
|
|
|
#define DeviceMetrics_fields &DeviceMetrics_msg
|
|
|
|
#define EnvironmentMetrics_fields &EnvironmentMetrics_msg
|
2022-02-27 04:52:22 +00:00
|
|
|
#define Telemetry_fields &Telemetry_msg
|
|
|
|
|
|
|
|
/* Maximum encoded size of messages (where known) */
|
2022-03-27 14:55:35 +00:00
|
|
|
#define DeviceMetrics_size 21
|
|
|
|
#define EnvironmentMetrics_size 30
|
|
|
|
#define Telemetry_size 37
|
2022-02-27 04:52:22 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|