12#ifndef INFUSE_SDK_INCLUDE_INFUSE_TDF_UTIL_H_
13#define INFUSE_SDK_INCLUDE_INFUSE_TDF_UTIL_H_
18#include <zephyr/bluetooth/addr.h>
96 info->
count = reboot.count;
102 info->
count = reboot.count;
129 tdf->
type = addr->type;
130 memcpy(tdf->
val, addr->a.val, 6);
153 tdf->
rsrp = UINT8_MAX;
154 if (rsrp != INT16_MIN) {
155 tdf->
rsrp = 0 - rsrp;
168#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:938
@ KV_KEY_REBOOTS
Number of times device has rebooted.
Definition kv_types.h:646
@ TDF_GYR_2000DPS
Gyroscope +-2000 DPS.
Definition definitions.h:867
@ TDF_REBOOT_INFO
Information pertaining to the previous reboot.
Definition definitions.h:845
@ TDF_GYR_250DPS
Gyroscope +-250 DPS.
Definition definitions.h:861
@ TDF_EXCEPTION_STACK_FRAME
Generic exception stack frame.
Definition definitions.h:935
@ TDF_GYR_1000DPS
Gyroscope +-1000 DPS.
Definition definitions.h:865
@ TDF_ACC_4G
Accelerometer +-4G.
Definition definitions.h:853
@ TDF_GYR_125DPS
Gyroscope +-125 DPS.
Definition definitions.h:859
@ TDF_ACC_8G
Accelerometer +-8G.
Definition definitions.h:855
@ TDF_ACC_2G
Accelerometer +-2G.
Definition definitions.h:851
@ TDF_GYR_500DPS
Gyroscope +-500 DPS.
Definition definitions.h:863
@ TDF_ACC_16G
Accelerometer +-16G.
Definition definitions.h:857
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:74
#define KV_STORE_READ(key, data)
Read a key from the KV store.
Definition kv_store.h:209
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:174
#define TDF_DATA_LOGGER_LOG(logger_mask, tdf_id, tdf_time, data)
Type safe wrapper around tdf_data_logger_log.
Definition tdf.h:194
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:126
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:89
static void tdf_reboot_info_log(uint8_t logger_mask)
Log REBOOT_INFO TDF to specified TDF data loggers.
Definition util.h:166
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:142
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:46
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:67
Typed key-value store for Infuse-IoT.
Autogenerated KV definitions.
Reboot handling for Infuse-IoT applications.
Reboot state information.
Definition reboot.h:108
uint32_t hardware_reason
Hardware reboot reason flags.
Definition reboot.h:122
union infuse_reboot_info info
Reboot information.
Definition reboot.h:130
char thread_name[8]
Thread executing at reboot time.
Definition reboot.h:124
enum infuse_reboot_info_type info_type
Type of the information in info.
Definition reboot.h:126
enum infuse_reboot_reason reason
Reason for the reboot.
Definition reboot.h:120
uint32_t uptime
The device uptime at the reboot.
Definition reboot.h:118
int mnc
Mobile Network Code.
Definition lte_modem_monitor.h:46
uint32_t tac
Tracking area code.
Definition lte_modem_monitor.h:50
int mcc
Mobile Country Code.
Definition lte_modem_monitor.h:44
uint32_t earfcn
EARFCN per 3GPP TS 36.101.
Definition lte_modem_monitor.h:52
uint32_t id
E-UTRAN cell ID, range 0 - LTE_LC_CELL_EUTRAN_ID_MAX.
Definition lte_modem_monitor.h:48
Current LTE network state.
Definition lte_modem_monitor.h:104
enum cellular_registration_status nw_reg_status
Network registration status.
Definition lte_modem_monitor.h:106
struct lte_cell cell
Serving cell information.
Definition lte_modem_monitor.h:116
enum cellular_access_technology lte_mode
Current LTE access technology.
Definition lte_modem_monitor.h:108
Information on service cell and registration status.
Definition definitions.h:376
struct tdf_struct_lte_cell_id_global cell
Global LTE cell identifier.
Definition definitions.h:378
uint8_t rsrp
Reference signal received power (255 = Unknown)
Definition definitions.h:386
uint8_t status
Registration status (See AT+CEREG)
Definition definitions.h:382
uint8_t tech
Access Technology (7 = LTE-M, 9 = NB-IoT)
Definition definitions.h:384
int8_t rsrq
Reference signal received quality (-128 = Unknown)
Definition definitions.h:388
uint32_t earfcn
Evolved Absolute Radio Frequency Channel (E-ARFCN)
Definition definitions.h:380
Information pertaining to the previous reboot.
Definition definitions.h:198
uint32_t param_1
Program counter/Watchdog Info/Other.
Definition definitions.h:208
uint32_t param_2
Link Register/Watchdog Info/Other.
Definition definitions.h:210
uint32_t hardware_flags
Hardware flags (hwinfo_get_reset_cause)
Definition definitions.h:202
uint32_t uptime
Uptime before reboot (seconds)
Definition definitions.h:206
char thread[8]
Running thread at reboot.
Definition definitions.h:212
uint32_t count
Reboot counter.
Definition definitions.h:204
uint8_t reason
Reboot reason (enum infuse_reboot_reason)
Definition definitions.h:200
Bluetooth address type (bt_addr_le_t)
Definition definitions.h:97
uint8_t type
Address type (0 = Public, 1 = Random)
Definition definitions.h:99
uint8_t val[6]
Address bytes.
Definition definitions.h:101
uint16_t tac
Tracking Area Code.
Definition definitions.h:79
uint32_t eci
E-UTRAN Cell ID.
Definition definitions.h:77
uint16_t mnc
Mobile Network Code.
Definition definitions.h:75
uint16_t mcc
Mobile Country Code.
Definition definitions.h:73
struct arch_esf exception_full
Exception stack frame.
Definition reboot.h:98
uint32_t info1
Info 1.
Definition reboot.h:87
uint32_t info2
Info 2.
Definition reboot.h:89
struct infuse_reboot_info::@163117250354136147143043021172122106010321121301 generic
Generic reboot information.