62 #include "ble_srv_common.h" 63 #include "app_util_platform.h" 67 #define BLE_UUID_TCS_SERVICE 0x0100 68 #define BLE_TCS_MAX_DATA_LEN (BLE_GATT_ATT_MTU_DEFAULT - 3) 70 #define BLE_TCS_DEVICE_NAME_LEN_MAX 10 71 #define BLE_TCS_BEACON_LEN_MAX 17 72 #define BLE_TCS_BEACON_LEN_MIN 3 73 #define BLE_TCS_CLOUD_LEN_MAX 250 74 #define BLE_TCS_CLOUD_LEN_MIN 0 75 #define BLE_TCS_NFC_LEN_MAX 247 82 #define PACKED(TYPE) TYPE __attribute__ ((packed)) 85 typedef PACKED(
struct 87 uint8_t name[BLE_TCS_DEVICE_NAME_LEN_MAX+1];
89 }) ble_tcs_dev_name_t;
91 typedef PACKED(
struct 95 }) ble_tcs_adv_params_t;
97 #define TCS_ADV_PARAMS_INTERVAL_MIN 32UL 98 #define TCS_ADV_PARAMS_INTERVAL_MAX 8000UL 99 #define TCS_ADV_PARAMS_TIMEOUT_MIN 0UL 100 #define TCS_ADV_PARAMS_TIMEOUT_MAX 180UL 102 typedef uint16_t ble_tcs_appear_t;
104 typedef PACKED(
struct 106 uint16_t min_conn_int;
107 uint16_t max_conn_int;
108 uint16_t slave_latency;
109 uint16_t sup_timeout;
110 }) ble_tcs_conn_params_t;
112 typedef PACKED(
struct 114 uint8_t data[BLE_TCS_BEACON_LEN_MAX];
116 }) ble_tcs_eddystone_url_t;
118 typedef PACKED(
struct 120 uint8_t token[BLE_TCS_CLOUD_LEN_MAX];
122 }) ble_tcs_cloud_token_t;
124 typedef PACKED(
struct 129 }) ble_tcs_fw_version_t;
131 typedef PACKED(
struct 137 typedef PACKED(
struct 139 uint8_t data[BLE_TCS_NFC_LEN_MAX];
143 #define TCS_MTU_REQ_EXCHANGE 0x01 144 #define TCS_MTU_REQ_MIN 0UL 145 #define TCS_MTU_REQ_MAX 1UL 146 #define TCS_MTU_SIZE_MIN 23UL 147 #define TCS_MTU_SIZE_MAX 276UL 151 ble_tcs_dev_name_t dev_name;
152 ble_tcs_adv_params_t adv_params;
153 ble_tcs_conn_params_t conn_params;
154 ble_tcs_eddystone_url_t eddystone_url;
155 ble_tcs_cloud_token_t cloud_token;
156 ble_tcs_fw_version_t fw_version;
163 BLE_TCS_EVT_DEV_NAME,
164 BLE_TCS_EVT_ADV_PARAM,
165 BLE_TCS_EVT_CONN_PARAM,
167 BLE_TCS_EVT_CLOUD_TOKEN,
177 ble_tcs_evt_type_t evt_type,
188 ble_tcs_params_t * p_init_vals;
203 ble_gatts_char_handles_t beacon_handles;
204 ble_gatts_char_handles_t cloud_handles;
205 ble_gatts_char_handles_t fwv_handles;
206 ble_gatts_char_handles_t mtu_handles;
207 ble_gatts_char_handles_t nfc_handles;
258 #endif // BLE_TCS_H__ ble_gatts_char_handles_t dev_name_handles
Definition: ble_tcs.h:200
uint32_t ble_tcs_mtu_set(ble_tcs_t *p_tcs, ble_tcs_mtu_t *p_data)
Function for setting the MTU char data.
ble_tcs_evt_handler_t evt_handler
Definition: ble_tcs.h:189
uint16_t service_handle
Definition: ble_tcs.h:199
uint32_t ble_tcs_init(ble_tcs_t *p_tcs, const ble_tcs_init_t *p_tcs_init)
Function for initializing the Thingy Configuration Service.
ble_gatts_char_handles_t conn_param_handles
Definition: ble_tcs.h:202
uint32_t ble_tcs_nfc_set(ble_tcs_t *p_tcs, ble_tcs_nfc_t *p_data)
Function for setting the NFC char data.
void(* ble_tcs_evt_handler_t)(ble_tcs_t *p_tcs, ble_tcs_evt_type_t evt_type, uint8_t *p_data, uint16_t length)
Thingy Configuration Service event handler type.
Definition: ble_tcs.h:176
uint16_t conn_handle
Definition: ble_tcs.h:208
uint8_t uuid_type
Definition: ble_tcs.h:198
ble_tcs_evt_handler_t evt_handler
Definition: ble_tcs.h:209
Thingy Configuration Service initialization structure.
Definition: ble_tcs.h:186
void ble_tcs_on_ble_evt(ble_tcs_t *p_tcs, ble_evt_t *p_ble_evt)
Function for handling the Thingy Configuration Service's BLE events.
ble_gatts_char_handles_t adv_param_handles
Definition: ble_tcs.h:201
Thingy Configuration Service structure.
Definition: ble_tcs.h:196