123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- #ifndef ES_SLOT_H__
- #define ES_SLOT_H__
- #include <stdint.h>
- #include "es_app_config.h"
- #include "nrf_ble_escs.h"
- typedef struct
- {
- union
- {
- es_uid_frame_t uid;
- es_url_frame_t url;
- es_tlm_frame_t tlm;
- es_eid_frame_t eid;
- es_etlm_frame_t etlm;
- } frame;
- es_frame_type_t type;
- uint8_t length;
- }es_adv_frame_t;
- typedef struct
- {
- uint8_t slot_no;
- nrf_ble_escs_radio_tx_pwr_t radio_tx_pwr;
- nrf_ble_escs_eid_id_key_t encrypted_eid_id_key;
- es_adv_frame_t adv_frame;
- bool adv_custom_tx_power;
- nrf_ble_escs_radio_tx_pwr_t custom_tx_power;
- bool configured;
- uint8_t k_scaler;
- uint32_t seconds;
- uint8_t ik[ESCS_AES_KEY_SIZE];
- } es_slot_t;
- typedef struct
- {
- es_slot_t slots[APP_MAX_ADV_SLOTS];
- uint8_t num_configured_slots;
- uint8_t num_configured_eid_slots;
- uint8_t slots_configured[APP_MAX_ADV_SLOTS];
- uint8_t eid_slots_configured[APP_MAX_EID_SLOTS];
- uint8_t tlm_slot;
- bool tlm_configured;
- uint8_t scaler_k;
- uint8_t enc_key[ESCS_AES_KEY_SIZE];
- } es_slot_reg_t;
- void es_slots_init(const es_slot_t * p_default_slot);
- void es_slot_adv_interval_set(uint8_t slot_no,
- nrf_ble_escs_adv_interval_t * p_adv_interval,
- bool global);
- void es_slot_radio_tx_pwr_set(uint8_t slot_no, nrf_ble_escs_radio_tx_pwr_t radio_tx_pwr);
- void es_slot_on_write(uint8_t slot_no, uint8_t length, uint8_t const * p_frame_data);
- ret_code_t es_slot_write_to_flash(uint8_t slot_no);
- void es_slot_encrypted_eid_id_key_set(uint8_t slot_no, nrf_ble_escs_eid_id_key_t * p_eid_id_key);
- void es_slot_eid_ready(uint8_t slot_no);
- void es_slot_tlm_update(void);
- void es_slot_etlm_update(uint8_t eid_slot_no);
- const es_slot_reg_t * es_slot_get_registry(void);
- void es_slot_set_adv_custom_tx_power(uint8_t slot_no, nrf_ble_escs_adv_tx_pwr_t tx_pwr);
- #endif
|