Status
status.h and status.c files define status structs and form in which firmware parameters are stored and periodically sent via LoRa and as BLE advertisement.
Status can consit of several building blocks, defined by FW and tracker type. Each building block is a byte array, where each byte reperesents a values as defined in governing status structre.
Total status cannot exceed 24 - DEVICE_NAME_LEN bytes, as this is the maximum length of BLE advertisment packet. Currently max length is set to 19 bytes.
Main building block is defined by statusData_t struct:
that can be compressed in byte array by
Individual values are defined as:
system_functions_errors - TBD
battery = (battery_mV - 2500)/10
Total length of main status part is 9 bytes.
If #define STATUS_LR is enabled, additional LR chip status block is added.
where:
satellites - nr. of satellites used in last LR fix
Total length of LR buildning block is 2 bytes.
If #define STATUS_UBLOX is enabled, additional UBLOX chip status block is added.
where:
lat - latitude defined as:
lat[0] = (lat+90)*1000 >> 16
lat[1] = (lat+90)*1000 >> 8
Total length of UBLOX status is 8 bytes.
To obtain new status message for either BLE advertisement or LR status send, int get_status_message(uint8_t *message, uint8_t max_len) function updates all values with int update_status_message(bool lr_status, bool ublox_status) function and returns message length.
max_len can be passed as an argument, as maximal length of message depends on the send format. If status message is too long, only max_len message will be returned.