/**@brief 128-bit service UUID for the Apple Notification Center Service. */
ble_uuid128_t const ble_hrs_base_uuid128 =
{
{
// 7905F431-B5CE-4E99-A40F-4B1E122D00D0
0xd0, 0x00, 0x2d, 0x12, 0x1e, 0x4b, 0x0f, 0xa4,
0x99, 0x4e, 0xce, 0xb5, 0x31, 0xf4, 0x05, 0x79
}
};
uint32_t ble_hrs_init(ble_hrs_t * p_hrs, const ble_hrs_init_t * p_hrs_init)
{
uint32_t err_code;
ble_uuid_t ble_uuid;
ble_add_char_params_t add_char_params;
uint8_t encoded_initial_hrm[MAX_HRM_LEN];
uint8_t my_saved_uuid_type;
// Initialize service structure
p_hrs->evt_handler = p_hrs_init->evt_handler;
p_hrs->is_sensor_contact_supported = p_hrs_init->is_sensor_contact_supported;
p_hrs->conn_handle = BLE_CONN_HANDLE_INVALID;
p_hrs->is_sensor_contact_detected = false;
p_hrs->rr_interval_count = 0;
p_hrs->max_hrm_len = MAX_HRM_LEN;
// Add a custom base UUID.sd_ble_uuid_vs_add
err_code = sd_ble_uuid_vs_add(&ble_hrs_base_uuid128, &my_saved_uuid_type);
if (err_code != NRF_SUCCESS)
{
// return err_code;
}
ble_uuid.type = my_saved_uuid_type;
ble_uuid.uuid = BLE_UUID_HEART_RATE_SERVICE;
// Add service
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
&ble_uuid,
&p_hrs->service_handle);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
}