12#ifndef INFUSE_SDK_INCLUDE_INFUSE_TDF_UTIL_H_
13#define INFUSE_SDK_INCLUDE_INFUSE_TDF_UTIL_H_
18#include <zephyr/bluetooth/addr.h>
95 info->
count = reboot.count;
101 info->
count = reboot.count;
128 tdf->
type = addr->type;
129 memcpy(tdf->
val, addr->a.val, 6);
152 tdf->
rsrp = UINT8_MAX;
153 if (rsrp != INT16_MIN) {
154 tdf->
rsrp = 0 - rsrp;
167#ifdef CONFIG_TDF_UTIL_REBOOT_INFO_LOG
Interactions with the common boot logic.
Autogenerated TDF definitions.
Infuse-IoT time based on the GPS epoch.
#define KV_KEY_TYPE(key)
Convert key ID to key type.
Definition kv_types.h:820
@ KV_KEY_REBOOTS
Number of times device has rebooted.
Definition kv_types.h:566
@ TDF_GYR_2000DPS
Gyroscope +-2000 DPS.
Definition definitions.h:816
@ TDF_REBOOT_INFO
Information pertaining to the previous reboot.
Definition definitions.h:794
@ TDF_GYR_250DPS
Gyroscope +-250 DPS.
Definition definitions.h:810
@ TDF_EXCEPTION_STACK_FRAME
Generic exception stack frame.
Definition definitions.h:884
@ TDF_GYR_1000DPS
Gyroscope +-1000 DPS.
Definition definitions.h:814
@ TDF_ACC_4G
Accelerometer +-4G.
Definition definitions.h:802
@ TDF_GYR_125DPS
Gyroscope +-125 DPS.
Definition definitions.h:808
@ TDF_ACC_8G
Accelerometer +-8G.
Definition definitions.h:804
@ TDF_ACC_2G
Accelerometer +-2G.
Definition definitions.h:800
@ TDF_GYR_500DPS
Gyroscope +-500 DPS.
Definition definitions.h:812
@ TDF_ACC_16G
Accelerometer +-16G.
Definition definitions.h:806
uint64_t epoch_time_from_ticks(uint64_t ticks)
Get the epoch time associated with a local uptime.
int infuse_common_boot_last_reboot(struct infuse_reboot_state *state)
Query the reason for the latest reboot.
@ INFUSE_REBOOT_INFO_EXCEPTION_ESF
Exception with full stack frame.
Definition reboot.h:70
#define KV_STORE_READ(key, data)
Read a key from the KV store.
Definition kv_store.h:196
static void tdf_data_logger_log(uint8_t logger_mask, uint16_t tdf_id, uint8_t tdf_len, uint64_t time, const void *data)
Add a single TDF to multiple data loggers.
Definition tdf.h:173
#define TDF_DATA_LOGGER_LOG(logger_mask, tdf_id, tdf_time, data)
Type safe wrapper around tdf_data_logger_log.
Definition tdf.h:193
static void tdf_bt_addr_le_from_stack(const bt_addr_le_t *addr, struct tdf_struct_bt_addr_le *tdf)
Populate the TDF Bluetooth address from a Bluetooth stack structure.
Definition util.h:125
static void tdf_reboot_info_from_state(struct infuse_reboot_state *state, struct tdf_reboot_info *info)
Populate a REBOOT_INFO TDF from Infuse-IoT reboot state.
Definition util.h:88
static void tdf_reboot_info_log(uint8_t logger_mask)
Log REBOOT_INFO TDF to specified TDF data loggers.
Definition util.h:165
static void tdf_lte_conn_status_from_monitor(const struct lte_modem_network_state *network_state, struct tdf_lte_conn_status *tdf, int16_t rsrp, int8_t rsrq)
Populate the LTE connection status TDF from modem monitor information.
Definition util.h:141
static uint16_t tdf_id_from_accelerometer_range(uint8_t range)
Get TDF ID to use for given accelerometer full scale range.
Definition util.h:45
static uint16_t tdf_id_from_gyroscope_range(uint16_t range)
Get TDF ID to use for given gyroscope full scale range.
Definition util.h:66
Typed key-value store for Infuse-IoT.
Autogenerated KV definitions.
Reboot handling for Infuse-IoT applications.
Reboot state information.
Definition reboot.h:107
uint32_t hardware_reason
Hardware reboot reason flags.
Definition reboot.h:121
union infuse_reboot_info info
Reboot information.
Definition reboot.h:129
char thread_name[8]
Thread executing at reboot time.
Definition reboot.h:123
enum infuse_reboot_info_type info_type
Type of the information in info.
Definition reboot.h:125
enum infuse_reboot_reason reason
Reason for the reboot.
Definition reboot.h:119
uint32_t uptime
The device uptime at the reboot.
Definition reboot.h:117
int mnc
Mobile Network Code.
Definition lte_modem_monitor.h:44
uint32_t tac
Tracking area code.
Definition lte_modem_monitor.h:48
int mcc
Mobile Country Code.
Definition lte_modem_monitor.h:42
uint32_t earfcn
EARFCN per 3GPP TS 36.101.
Definition lte_modem_monitor.h:50
uint32_t id
E-UTRAN cell ID, range 0 - LTE_LC_CELL_EUTRAN_ID_MAX.
Definition lte_modem_monitor.h:46
Definition lte_modem_monitor.h:101
enum cellular_registration_status nw_reg_status
Definition lte_modem_monitor.h:102
struct lte_cell cell
Definition lte_modem_monitor.h:107
enum cellular_access_technology lte_mode
Definition lte_modem_monitor.h:103
Information on service cell and registration status.
Definition definitions.h:366
struct tdf_struct_lte_cell_id_global cell
Global LTE cell identifier.
Definition definitions.h:368
uint8_t rsrp
Reference signal received power (255 = Unknown)
Definition definitions.h:376
uint8_t status
Registration status (See AT+CEREG)
Definition definitions.h:372
uint8_t tech
Access Technology (7 = LTE-M, 9 = NB-IoT)
Definition definitions.h:374
int8_t rsrq
Reference signal received quality (-128 = Unknown)
Definition definitions.h:378
uint32_t earfcn
Evolved Absolute Radio Frequency Channel (E-ARFCN)
Definition definitions.h:370
Information pertaining to the previous reboot.
Definition definitions.h:188
uint32_t param_1
Program counter/Watchdog Info/Other.
Definition definitions.h:198
uint32_t param_2
Link Register/Watchdog Info/Other.
Definition definitions.h:200
uint32_t hardware_flags
Hardware flags (hwinfo_get_reset_cause)
Definition definitions.h:192
uint32_t uptime
Uptime before reboot (seconds)
Definition definitions.h:196
char thread[8]
Running thread at reboot.
Definition definitions.h:202
uint32_t count
Reboot counter.
Definition definitions.h:194
uint8_t reason
Reboot reason (enum infuse_reboot_reason)
Definition definitions.h:190
Bluetooth address type (bt_addr_le_t)
Definition definitions.h:89
uint8_t type
Address type (0 = Public, 1 = Random)
Definition definitions.h:91
uint8_t val[6]
Address bytes.
Definition definitions.h:93
uint16_t tac
Tracking Area Code.
Definition definitions.h:71
uint32_t eci
E-UTRAN Cell ID.
Definition definitions.h:69
uint16_t mnc
Mobile Network Code.
Definition definitions.h:67
uint16_t mcc
Mobile Country Code.
Definition definitions.h:65
struct arch_esf exception_full
Definition reboot.h:96
uint32_t info1
Info 1.
Definition reboot.h:84
uint32_t info2
Info 2.
Definition reboot.h:86
struct infuse_reboot_info::@163117250354136147143043021172122106010321121301 generic