escs.h
Go to the documentation of this file.
1 
47 #ifndef _ESCS_H_
48 #define _ESCS_H_
49 #include "es_app_config.h"
50 #include "es.h"
51 #include "ble_prf_types.h"
52 #include "ble_sdk_error.h"
53 #include "es_utility.h"
54 #include "es_nvds.h"
55 #include "es_gatts_read_write.h"
56 #include <stdbool.h>
57 #include <stdint.h>
58 
65 {
66  ESEC_IDX_SVC,
67  ESCS_BROADCAST_CAP_RD_CHAR,
68  ESCS_BROADCAST_CAP_RD_VALUE,
69  ESCS_ACTIVE_SLOT_RW_CHAR,
70  ESCS_ACTIVE_SLOT_RW_VALUE,
71  ESCS_ADV_INTERVAL_RW_CHAR,
72  ESCS_ADV_INTERVAL_RW_VALUE,
73  ESCS_RADIO_TX_PWR_RW_CHAR,
74  ESCS_RADIO_TX_PWR_RW_VALUE,
75  ESCS_ADV_TX_PWR_RW_CHAR,
76  ESCS_ADV_TX_PWR_RW_VALUE,
77  ESCS_LOCK_STATE_RW_CHAR,
78  ESCS_LOCK_STATE_RW_VALUE,
79  ESCS_UNLOCK_RW_CHAR,
80  ESCS_UNLOCK_RW_VALUE,
81  ESCS_PUBLIC_ECDH_KEY_RD_CHAR,
82  ESCS_PUBLIC_ECDH_KEY_RD_VALUE,
83  ESCS_EID_ID_KEY_RD_CHAR,
84  ESCS_EID_ID_KEY_RD_VALUE,
85  ESCS_RW_ADV_SLOT_RW_CHAR,
86  ESCS_RW_ADV_SLOT_RW_VALUE,
87  ESCS_FACTORY_RESET_SET_CHAR,
88  ESCS_FACTORY_RESET_SET_VALUE,
89  ESCS_REMAIN_CONNECTABLE_RW_CHAR,
90  ESCS_REMAIN_CONNECTABLE_RW_VALUE,
91  ESCSS_IDX_NB,
92 };
101 typedef struct
102 {
103  uint8_t security_key[ESCS_LOCK_CODE_WRITE_LENGTH];
104  uint8_t k_scaler;
106 
108 typedef struct
109 {
110  uint8_t pub_ecdh_key[ESCS_ECDH_KEY_SIZE];
111  uint8_t k_scaler;
112 } escs_eid_t;
113 
115 typedef struct
116 {
117  uint8_t active_slot_no;
118  uint8_t lock_state;
119  uint16_t adv_interval;
120  int8_t slot_tx_power[APP_MAX_ADV_SLOTS];
121  int8_t adv_tx_power;
124 #if(APP_IS_EID_SUPPORTED)
125  escs_eid_t eid_slot_data[APP_MAX_ADV_SLOTS];
126 #endif //APP_IS_EID_SUPPORTED
128 
143 
152 void es_adv_remain_connectable_set(bool remain_connectable);
153 
162 void es_public_ecdh_key_get (uint8_t* p_ecdh_key_buf);
163 
172 void es_public_ecdh_key_set (uint8_t* p_ecdh_key_buf);
173 
183 void es_security_key_set(uint8_t* p_security_key,bool is_eid_write);
184 
194 
203 void es_active_slot_number_set (uint8_t slot_no);
204 
214 
222 
229 void set_beacon_locked(void);
230 
238 
247 int8_t es_adv_tx_power_get(void);
248 
257 void es_adv_tx_power_set(int8_t adv_tx_power);
258 
267 int8_t es_slot_tx_power_get(void);
268 
277 void es_slot_tx_power_set(int8_t tx_power);
278 
287 uint16_t es_adv_interval_get(void);
288 
297 void es_adv_interval_set (uint16_t adv_interval);
298 
310 #endif
311 
es_beacon_has_eid_adv
bool es_beacon_has_eid_adv(void)
to konw if a beacon has EID slot
ble_escs_init_params_t::beacon_lock_code
slot_lock_code_t beacon_lock_code
Definition: escs.h:123
ble_escs_init_params_t::remain_connectable
bool remain_connectable
Definition: escs.h:122
es_slot_tx_power_get
int8_t es_slot_tx_power_get(void)
get advertised tx power of a slot
ble_escs_init_params_t::active_slot_no
uint8_t active_slot_no
Definition: escs.h:117
es_adv_interval_get
uint16_t es_adv_interval_get(void)
get advertising interval for slot
escs_eid_t
Structure for storing EID slot key.
Definition: escs.h:109
es_active_slot_number_set
void es_active_slot_number_set(uint8_t slot_no)
set number of the actived slot
slot_lock_code_t::k_scaler
uint8_t k_scaler
Definition: escs.h:104
es_public_ecdh_key_get
void es_public_ecdh_key_get(uint8_t *p_ecdh_key_buf)
get public ecdh key
ble_escs_init_params_t::adv_interval
uint16_t adv_interval
Definition: escs.h:119
es_adv_tx_power_get
int8_t es_adv_tx_power_get(void)
get the radio tx power
esec_service_init
sdk_err_t esec_service_init(ble_escs_init_params_t *p_escs_init)
Initialize Eddystone Configuration Service,and data for the service.
es_adv_remain_connectable_set
void es_adv_remain_connectable_set(bool remain_connectable)
set eddystone remain connectable state
ble_prf_types.h
Profile/Service Common Types.
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
escs_attr_idx_t
escs_attr_idx_t
ESCS Service Attributes Indexes.
Definition: escs.h:65
es_slot_tx_power_set
void es_slot_tx_power_set(int8_t tx_power)
set advertised tx power of a slot
ble_escs_init_params_t::lock_state
uint8_t lock_state
Definition: escs.h:118
set_beacon_unlocked
void set_beacon_unlocked(void)
unlock a beacon
es_public_ecdh_key_set
void es_public_ecdh_key_set(uint8_t *p_ecdh_key_buf)
set public ecdh key
escs_eid_t::k_scaler
uint8_t k_scaler
Definition: escs.h:111
es_security_key_set
void es_security_key_set(uint8_t *p_security_key, bool is_eid_write)
set security key for slot
es_active_slot_number_get
uint8_t es_active_slot_number_get(void)
get number of the actived slot
ble_escs_init_params_t::adv_tx_power
int8_t adv_tx_power
Definition: escs.h:121
es_adv_remain_connectable_get
bool es_adv_remain_connectable_get(void)
get eddystone remain connectable state
set_beacon_locked
void set_beacon_locked(void)
lock a beacon
slot_lock_code_t
Structure for storing a slot key.
Definition: escs.h:102
es_adv_interval_set
void es_adv_interval_set(uint16_t adv_interval)
set advertising interval for slot
ble_escs_init_params_t
EddyStone Configuration Service environment variable.
Definition: escs.h:116
is_active_slot_eid
bool is_active_slot_eid(void)
to know if the actived slot is a n EID slot
es_adv_tx_power_set
void es_adv_tx_power_set(int8_t adv_tx_power)
set the radio tx power