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:613
@ KV_KEY_REBOOTS
Number of times device has rebooted.
Definition kv_types.h:422
@ TDF_GYR_2000DPS
Gyroscope +-2000 DPS.
Definition definitions.h:731
@ TDF_REBOOT_INFO
Information pertaining to the previous reboot.
Definition definitions.h:713
@ TDF_GYR_250DPS
Gyroscope +-250 DPS.
Definition definitions.h:725
@ TDF_EXCEPTION_STACK_FRAME
Generic exception stack frame.
Definition definitions.h:799
@ TDF_GYR_1000DPS
Gyroscope +-1000 DPS.
Definition definitions.h:729
@ TDF_ACC_4G
Accelerometer +-4G.
Definition definitions.h:717
@ TDF_GYR_125DPS
Gyroscope +-125 DPS.
Definition definitions.h:723
@ TDF_ACC_8G
Accelerometer +-8G.
Definition definitions.h:719
@ TDF_ACC_2G
Accelerometer +-2G.
Definition definitions.h:715
@ TDF_GYR_500DPS
Gyroscope +-500 DPS.
Definition definitions.h:727
@ TDF_ACC_16G
Accelerometer +-16G.
Definition definitions.h:721
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:68
#define KV_STORE_READ(key, data)
Read a key from the KV store.
Definition kv_store.h:186
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 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
static void tdf_lte_conn_status_from_monitor(struct nrf_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:140
Typed key-value store for Infuse-IoT.
Autogenerated KV definitions.
Reboot handling for Infuse-IoT applications.
Reboot state information.
Definition reboot.h:105
uint32_t hardware_reason
Hardware reboot reason flags.
Definition reboot.h:119
union infuse_reboot_info info
Reboot information.
Definition reboot.h:127
char thread_name[8]
Thread executing at reboot time.
Definition reboot.h:121
enum infuse_reboot_info_type info_type
Type of the information in info.
Definition reboot.h:123
enum infuse_reboot_reason reason
Reason for the reboot.
Definition reboot.h:117
uint32_t uptime
The device uptime at the reboot.
Definition reboot.h:115
Definition nrf_modem_monitor.h:29
struct lte_lc_cell cell
Definition nrf_modem_monitor.h:35
enum lte_lc_lte_mode lte_mode
Definition nrf_modem_monitor.h:31
enum lte_lc_nw_reg_status nw_reg_status
Definition nrf_modem_monitor.h:30
Information on service cell and registration status.
Definition definitions.h:340
struct tdf_struct_lte_cell_id_global cell
Global LTE cell identifier.
Definition definitions.h:342
uint8_t rsrp
Reference signal received power (255 = Unknown)
Definition definitions.h:350
uint8_t status
Registration status (See AT+CEREG)
Definition definitions.h:346
uint8_t tech
Access Technology (7 = LTE-M, 9 = NB-IoT)
Definition definitions.h:348
int8_t rsrq
Reference signal received quality (-128 = Unknown)
Definition definitions.h:352
uint32_t earfcn
Evolved Absolute Radio Frequency Channel (E-ARFCN)
Definition definitions.h:344
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:94
uint32_t info1
Info 1.
Definition reboot.h:82
uint32_t info2
Info 2.
Definition reboot.h:84
struct infuse_reboot_info::@31 generic