Nordic新增服务流程
1、设置服务UUID,以及指向这个ID的句柄
将自定义UUID基数添加到SoftDevice,并且获得一个指向这个uuid的指针
//*p_uuid_type指向这个uuid
uint32_t, sd_ble_uuid_vs_add(ble_uuid128_t const *p_vs_uuid, uint8_t *p_uuid_type));
2、添加服务
sd_ble_gatts_service_add
uint32_t, sd_ble_gatts_service_add(uint8_t type, ble_uuid_t const *p_uuid, uint16_t *p_handle));
type 首要服务还是次要服务 BLE_GATTS_SRVC_TYPE_PRIMARY
p_uuid (ble_uuid_t)包含获得的UUID的句柄,以及其中的000A UUID
p_handle 协议栈提供的服务句柄
3、添加特征
uint32_t characteristic_add(uint16_t service_handle,
ble_add_char_params_t * p_char_props,
ble_gatts_char_handles_t * p_char_handle);
- @param[in] service_handle Handle of the service to which the characteristic is to be added.
- @param[in] p_char_props Information needed to add the characteristic.
- @param[out] p_char_handle Handle of the added characteristic.
ble_add_char_params_t类型