Microchip® Advanced Software Framework

thirdparty/wireless/ble_sdk/ble_services/heart_rate/heart_rate.c File Reference

Heart Rate Service.

Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.

#include "ble_manager.h"
#include "heart_rate.h"

Functions

void hr_init_service (hr_gatt_service_handler_t *heart_rate_serv)
 Heart Rate service and characteristic initialization(Called only once by user). More...
 
at_ble_status_t hr_primary_service_define (hr_gatt_service_handler_t *hr_primary_service)
 Register a dis service instance inside stack. More...
 
uint8_t hr_write_value_handler (hr_gatt_service_handler_t *hr_primary_service, at_ble_characteristic_changed_t *params)
 handler for characteristic write called by profile More...
 

Variables

uint8_t body_sensor_location_value = CHEST
 initial body sensor location value More...
 
uint8_t hr_control_point_value = 0
 initial heart rate control point value More...
 
uint16_t hr_measurement_value = 0
 initial heart rate measurement value More...
 

void hr_init_service ( hr_gatt_service_handler_t heart_rate_serv)

Heart Rate service and characteristic initialization(Called only once by user).

Parameters
[in]Heartrate service instance
Returns
none

References AT_BLE_ATTR_NO_PERMISSIONS, AT_BLE_ATTR_READABLE_NO_AUTHN_NO_AUTHR, AT_BLE_ATTR_READABLE_REQ_AUTHN_NO_AUTHR, AT_BLE_ATTR_WRITABLE_NO_AUTHN_NO_AUTHR, AT_BLE_ATTR_WRITABLE_REQ_AUTHN_NO_AUTHR, AT_BLE_ATTR_WRITABLE_REQ_AUTHN_REQ_AUTHR, AT_BLE_CHAR_NOTIFY, AT_BLE_CHAR_READ, AT_BLE_CHAR_WRITE, AT_BLE_UUID_16, BODY_SENSOR_LOCATION_CHAR_UUID, body_sensor_location_value, at_ble_characteristic_t::char_val_handle, at_ble_characteristic_t::client_config_handle, at_ble_characteristic_t::client_config_permissions, HEART_RATE_CONTROL_POINT_CHAR_UUID, HEART_RATE_MEASUREMENT_CHAR_UUID, HEART_RATE_SERVICE_UUID, hr_control_point_value, hr_measurement_value, HR_MM_EX_SIZE, HR_MM_FLAGS_SIZE, HR_MM_RR_SIZE, HR_MM_VAL_SIZE, at_ble_characteristic_t::init_value, NULL, at_ble_characteristic_t::presentation_format, at_ble_characteristic_t::properties, hr_gatt_service_handler::serv_chars, hr_gatt_service_handler::serv_handle, hr_gatt_service_handler::serv_uuid, at_ble_characteristic_t::server_config_handle, at_ble_characteristic_t::server_config_permissions, at_ble_uuid_t::type, at_ble_characteristic_t::user_desc, at_ble_characteristic_t::user_desc_handle, at_ble_characteristic_t::user_desc_len, at_ble_characteristic_t::user_desc_max_len, at_ble_characteristic_t::user_desc_permissions, at_ble_uuid_t::uuid, at_ble_characteristic_t::uuid, at_ble_characteristic_t::value_init_len, at_ble_characteristic_t::value_max_len, and at_ble_characteristic_t::value_permissions.

Referenced by hr_sensor_service_init().

at_ble_status_t hr_primary_service_define ( hr_gatt_service_handler_t hr_primary_service)

Register a dis service instance inside stack.

Parameters
[in]dis_primary_servicedis service instance
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

References at_ble_primary_service_define(), HR_TOTAL_CHARATERISTIC_NUM, NULL, hr_gatt_service_handler::serv_chars, hr_gatt_service_handler::serv_handle, and hr_gatt_service_handler::serv_uuid.

Referenced by hr_sensor_service_define().

uint8_t hr_write_value_handler ( hr_gatt_service_handler_t hr_primary_service,
at_ble_characteristic_changed_t params 
)

handler for characteristic write called by profile

Parameters
[in]hr_gatt_service_handler_tservcie handler
Returns
number representing the changed characteristic

References at_ble_characteristic_changed_t::char_handle, at_ble_characteristic_changed_t::char_new_value, at_ble_characteristic_t::char_val_handle, at_ble_characteristic_t::client_config_handle, HR_CONTROL_POINT_RESET, HR_NOTIFICATION_DISABLE, HR_NOTIFICATION_ENABLE, and hr_gatt_service_handler::serv_chars.

Referenced by hr_sensor_char_changed_handler().

uint8_t body_sensor_location_value = CHEST

initial body sensor location value

uint8_t hr_control_point_value = 0

initial heart rate control point value

uint16_t hr_measurement_value = 0

initial heart rate measurement value