Microchip® Advanced Software Framework

heart_rate.h File Reference

Heart Rate Service declarations.

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

Data Structures

struct  hr_gatt_service_handler
 hr_gatt_service_handler is the service handler function More...
 

Macros

#define BODY_SENSOR_LOCATION_CHAR_UUID   (0x2A38)
 Body Sensor location characteristic UUID. More...
 
#define HEART_RATE_CONTROL_POINT_CHAR_UUID   (0x2A39)
 Heart Rate Control Point characteristic UUID. More...
 
#define HEART_RATE_MEASUREMENT_CHAR_UUID   (0x2A37)
 Heart rate measurement characteristic UUID. More...
 
#define HEART_RATE_SERVICE_UUID   (0x180D)
 Heart rate service UUID. More...
 
#define HR_CONTROL_POINT_RESET   (2)
 number for resetting energy expended More...
 
#define HR_MM_EX_SIZE   (2)
 maximum size of heart rate field of hr mm characteristic in bytes More...
 
#define HR_MM_FLAGS_SIZE   (1)
 maximum size of flags field of hr mm characteristic in bytes More...
 
#define HR_MM_RR_SIZE   (2 * 2)
 maximum size of rr value field of hr mm characteristic in bytes More...
 
#define HR_MM_VAL_SIZE   (2)
 maximum size of heart rate field of hr mm characteristic in bytes More...
 
#define HR_NOTIFICATION_DISABLE   (0)
 number for Enabling the notification More...
 
#define HR_NOTIFICATION_ENABLE   (1)
 number for disabling the notification More...
 
#define HR_TOTAL_CHARATERISTIC_NUM   (3)
 Total no of characteristic in heart rate service. More...
 

Typedefs

typedef struct
hr_gatt_service_handler 
hr_gatt_service_handler_t
 hr_gatt_service_handler is the service handler function More...
 

Enumerations

enum  body_sensor_location_val {
  OTHERS = 0,
  CHEST,
  WRIST,
  FINGER,
  HAND,
  EAR_LOBE,
  FOOT
}
 

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 *dis_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...
 

#define BODY_SENSOR_LOCATION_CHAR_UUID   (0x2A38)

Body Sensor location characteristic UUID.

Referenced by hr_init_service().

#define HEART_RATE_CONTROL_POINT_CHAR_UUID   (0x2A39)

Heart Rate Control Point characteristic UUID.

Referenced by hr_init_service().

#define HEART_RATE_MEASUREMENT_CHAR_UUID   (0x2A37)

Heart rate measurement characteristic UUID.

Referenced by hr_init_service().

#define HEART_RATE_SERVICE_UUID   (0x180D)

Heart rate service UUID.

Referenced by hr_init_service().

#define HR_CONTROL_POINT_RESET   (2)

number for resetting energy expended

Referenced by hr_sensor_char_changed_handler(), and hr_write_value_handler().

#define HR_MM_EX_SIZE   (2)

maximum size of heart rate field of hr mm characteristic in bytes

Referenced by hr_init_service().

#define HR_MM_FLAGS_SIZE   (1)

maximum size of flags field of hr mm characteristic in bytes

Referenced by hr_init_service().

#define HR_MM_RR_SIZE   (2 * 2)

maximum size of rr value field of hr mm characteristic in bytes

Referenced by hr_init_service().

#define HR_MM_VAL_SIZE   (2)

maximum size of heart rate field of hr mm characteristic in bytes

Referenced by hr_init_service().

#define HR_NOTIFICATION_DISABLE   (0)

number for Enabling the notification

Referenced by hr_sensor_char_changed_handler(), and hr_write_value_handler().

#define HR_NOTIFICATION_ENABLE   (1)

number for disabling the notification

Referenced by hr_sensor_char_changed_handler(), and hr_write_value_handler().

#define HR_TOTAL_CHARATERISTIC_NUM   (3)

Total no of characteristic in heart rate service.

Referenced by hr_primary_service_define().

hr_gatt_service_handler is the service handler function

Enumerator
OTHERS 
CHEST 
WRIST 
FINGER 
HAND 
EAR_LOBE 
FOOT 

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().