Heart Rate Sensor Profile declarations.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | ACTIVITY_BRISK_WALKING (2) |
#define | ACTIVITY_FAST_RUNNING (4) |
#define | ACTIVITY_NORMAL (0) |
Activities of user. More... | |
#define | ACTIVITY_RUNNING (3) |
#define | ACTIVITY_WALKING (1) |
#define | ADV_DATA_LEN (18) |
ADV_DATA_LEN. More... | |
#define | ADV_TYPE_LEN (0x01) |
ADV_TYPE_LEN. More... | |
#define | APP_HRS_ADV_TIMEOUT (1000) |
APP_HRS_ADV_TIMEOUT Advertising time-out between 0x0001 and 0x3FFF in seconds, 0x0000 disables time-out. More... | |
#define | APP_HRS_FAST_ADV (100) |
#define | DEFAULT_ACTIVITY (0xFF) |
#define | END_OF_LAST_ACTIVITY (200) |
#define | ENERGY_EXP_BRISK_WALKING (20) |
#define | ENERGY_EXP_FAST_RUNNING (60) |
#define | ENERGY_EXP_NORMAL (3) |
energy expended for various activities More... | |
#define | ENERGY_EXP_RUNNING (40) |
#define | ENERGY_EXP_WALKING (10) |
#define | ENERGY_EXPENDED_FIELD_PRESENT (0x1 << 3) |
ENERGY_EXPENDED_FIELD_PRESENT represents energy expended inclusion. More... | |
#define | ENERGY_RESET (0) |
#define | HEART_RATE_INCREMENT_VALUE (1) |
Heart rate increment value. More... | |
#define | HEART_RATE_MAX_BRISK_WALK (110) |
#define | HEART_RATE_MAX_FAST_RUNNING (151) |
#define | HEART_RATE_MAX_NORM (70) |
#define | HEART_RATE_MAX_RUNNING (130) |
#define | HEART_RATE_MAX_WALKING (90) |
#define | HEART_RATE_MIN_BRISK_WALK (91) |
#define | HEART_RATE_MIN_FAST_RUNNING (130) |
#define | HEART_RATE_MIN_NORM (50) |
Heart Rate maximum and minimum values for various activities. More... | |
#define | HEART_RATE_MIN_RUNNING (111) |
#define | HEART_RATE_MIN_WALKING (71) |
#define | HR_CHAR_VALUE_LEN (10) |
The maximum length of the hr measurement characteristic data. More... | |
#define | HR_VALUE_FORMAT_UINT16 (0x1 << 0) |
HR_VALUE_FORMAT_UINT16 the bit to represent hr value sent is 16 bit. More... | |
#define | HRS_ADV_DATA_NAME_DATA ("ATMEL-HRT") |
#define | HRS_ADV_DATA_NAME_LEN (9) |
HRS_ADV_DATA_NAME_LEN the length of the device name. More... | |
#define | HRS_ADV_DATA_NAME_TYPE (0x09) |
HRS_ADV_DATA_NAME_TYPE the gap ad data type. More... | |
#define | HRS_ADV_DATA_UUID_LEN (2) |
HRS_ADV_DATA_UUID_LEN the size of HRS service uuid. More... | |
#define | HRS_ADV_DATA_UUID_TYPE (0x03) |
HRS_ADV_DATA_UUID_TYPE the total sizeof HRS service uuid. More... | |
#define | NOTIFICATION_INTERVAL (1000) |
Notification interval to determine the frequency of notifications. More... | |
#define | RR_INTERVAL_VALUE_PRESENT (0x1 << 4) |
RR_INTERVAL_VALUE_PRESENT represents the rr value inclusion. More... | |
#define | RR_VALUE_MAX (1000) |
RR interval maximum and minimum values for simulation of rr values. More... | |
#define | RR_VALUE_MIN (100) |
#define | SCAN_RESP_LEN (10) |
scan_resp_len is the length of the scan response data More... | |
#define | SENSOR_CONTACT_FTR_NOT_SPRTD_CONTACT_DTD (0x3 << 1) |
SENSOR_CONTACT_FTR_NOT_SPRTD_NOT_CONTACT to represent the sensor contact info. More... | |
#define | SENSOR_CONTACT_FTR_NOT_SPRTD_NOT_CONTACT (0x1 << 2) |
SENSOR_CONTACT_FTR_NOT_SPRTD_NOT_CONTACT to represent the sensor contact info. More... | |
#define | START_OF_FIRST_ACTIVITY (0) |
time limit of last activity More... | |
Functions | |
void | ble_heart_rate_handle_disconnect_event (at_ble_handle_t conn_handle) |
void | ble_heart_rate_handle_paired_event (at_ble_handle_t conn_handle) |
void | ble_heart_rate_profile_init (void) |
hr_sensor_init initializes and defines the services of the hr profile More... | |
at_ble_status_t | ble_heart_rate_start_advertise (void) |
void | heart_rate_send_notification (uint8_t *char_data, uint8_t length) |
Variables | |
uint8_t | activity |
uint16_t | energy_expended_val |
uint8_t | energy_inclusion |
uint16_t | energy_incrementor |
uint16_t | heart_rate_value |
uint8_t | hr_max_value |
uint8_t | hr_min_value |
uint8_t | inc_changer |
uint8_t | notification_flag |
uint8_t | prev_activity |
uint8_t | second_counter |
uint8_t | time_operator |
bool volatile | timer_cb_done |
#define ACTIVITY_BRISK_WALKING (2) |
Referenced by ble_heart_rate_process(), and ble_heart_rate_value_init().
#define ACTIVITY_FAST_RUNNING (4) |
Referenced by ble_heart_rate_process(), and ble_heart_rate_value_init().
#define ACTIVITY_NORMAL (0) |
Activities of user.
Referenced by ble_heart_rate_handle_disconnect_event(), ble_heart_rate_process(), and ble_heart_rate_value_init().
#define ACTIVITY_RUNNING (3) |
Referenced by ble_heart_rate_process(), and ble_heart_rate_value_init().
#define ACTIVITY_WALKING (1) |
Referenced by ble_heart_rate_process(), and ble_heart_rate_value_init().
#define ADV_DATA_LEN (18) |
ADV_DATA_LEN.
#define ADV_TYPE_LEN (0x01) |
ADV_TYPE_LEN.
Referenced by ble_heart_rate_start_advertise(), csc_prf_dev_adv(), and pxp_reporter_adv().
#define APP_HRS_ADV_TIMEOUT (1000) |
APP_HRS_ADV_TIMEOUT Advertising time-out between 0x0001 and 0x3FFF in seconds, 0x0000 disables time-out.
Referenced by ble_heart_rate_start_advertise().
#define APP_HRS_FAST_ADV (100) |
Referenced by ble_heart_rate_start_advertise().
#define DEFAULT_ACTIVITY (0xFF) |
Referenced by ble_heart_rate_handle_disconnect_event().
#define END_OF_LAST_ACTIVITY (200) |
Referenced by ble_heart_rate_handle_timer_event().
#define ENERGY_EXP_BRISK_WALKING (20) |
Referenced by ble_heart_rate_value_init().
#define ENERGY_EXP_FAST_RUNNING (60) |
Referenced by ble_heart_rate_value_init().
#define ENERGY_EXP_NORMAL (3) |
energy expended for various activities
Referenced by ble_heart_rate_handle_disconnect_event(), and ble_heart_rate_value_init().
#define ENERGY_EXP_RUNNING (40) |
Referenced by ble_heart_rate_value_init().
#define ENERGY_EXP_WALKING (10) |
Referenced by ble_heart_rate_value_init().
#define ENERGY_EXPENDED_FIELD_PRESENT (0x1 << 3) |
ENERGY_EXPENDED_FIELD_PRESENT represents energy expended inclusion.
Referenced by ble_heart_rate_process().
#define ENERGY_RESET (0) |
Referenced by ble_heart_rate_process().
#define HEART_RATE_INCREMENT_VALUE (1) |
Heart rate increment value.
Referenced by ble_heart_rate_process().
#define HEART_RATE_MAX_BRISK_WALK (110) |
Referenced by ble_heart_rate_value_init().
#define HEART_RATE_MAX_FAST_RUNNING (151) |
Referenced by ble_heart_rate_value_init().
#define HEART_RATE_MAX_NORM (70) |
Referenced by ble_heart_rate_value_init().
#define HEART_RATE_MAX_RUNNING (130) |
Referenced by ble_heart_rate_value_init().
#define HEART_RATE_MAX_WALKING (90) |
Referenced by ble_heart_rate_value_init().
#define HEART_RATE_MIN_BRISK_WALK (91) |
Referenced by ble_heart_rate_value_init().
#define HEART_RATE_MIN_FAST_RUNNING (130) |
Referenced by ble_heart_rate_value_init().
#define HEART_RATE_MIN_NORM (50) |
Heart Rate maximum and minimum values for various activities.
Referenced by ble_heart_rate_value_init().
#define HEART_RATE_MIN_RUNNING (111) |
Referenced by ble_heart_rate_value_init().
#define HEART_RATE_MIN_WALKING (71) |
Referenced by ble_heart_rate_value_init().
#define HR_CHAR_VALUE_LEN (10) |
The maximum length of the hr measurement characteristic data.
Referenced by ble_heart_rate_process().
#define HR_VALUE_FORMAT_UINT16 (0x1 << 0) |
HR_VALUE_FORMAT_UINT16 the bit to represent hr value sent is 16 bit.
#define HRS_ADV_DATA_NAME_DATA ("ATMEL-HRT") |
Referenced by ble_heart_rate_start_advertise().
#define HRS_ADV_DATA_NAME_LEN (9) |
HRS_ADV_DATA_NAME_LEN the length of the device name.
Referenced by ble_heart_rate_start_advertise().
#define HRS_ADV_DATA_NAME_TYPE (0x09) |
HRS_ADV_DATA_NAME_TYPE the gap ad data type.
Referenced by ble_heart_rate_start_advertise().
#define HRS_ADV_DATA_UUID_LEN (2) |
HRS_ADV_DATA_UUID_LEN the size of HRS service uuid.
Referenced by ble_heart_rate_start_advertise().
#define HRS_ADV_DATA_UUID_TYPE (0x03) |
HRS_ADV_DATA_UUID_TYPE the total sizeof HRS service uuid.
Referenced by ble_heart_rate_start_advertise().
#define NOTIFICATION_INTERVAL (1000) |
Notification interval to determine the frequency of notifications.
Referenced by ble_heart_rate_handle_paired_event().
#define RR_INTERVAL_VALUE_PRESENT (0x1 << 4) |
RR_INTERVAL_VALUE_PRESENT represents the rr value inclusion.
Referenced by ble_heart_rate_process().
#define RR_VALUE_MAX (1000) |
RR interval maximum and minimum values for simulation of rr values.
Referenced by ble_heart_rate_process().
#define RR_VALUE_MIN (100) |
Referenced by ble_heart_rate_process().
#define SCAN_RESP_LEN (10) |
scan_resp_len is the length of the scan response data
Referenced by ble_heart_rate_start_advertise(), csc_prf_dev_adv(), and pxp_reporter_adv().
#define SENSOR_CONTACT_FTR_NOT_SPRTD_CONTACT_DTD (0x3 << 1) |
SENSOR_CONTACT_FTR_NOT_SPRTD_NOT_CONTACT to represent the sensor contact info.
#define SENSOR_CONTACT_FTR_NOT_SPRTD_NOT_CONTACT (0x1 << 2) |
SENSOR_CONTACT_FTR_NOT_SPRTD_NOT_CONTACT to represent the sensor contact info.
#define START_OF_FIRST_ACTIVITY (0) |
time limit of last activity
Referenced by ble_heart_rate_handle_timer_event().
void ble_heart_rate_handle_disconnect_event | ( | at_ble_handle_t | conn_handle | ) |
void ble_heart_rate_handle_paired_event | ( | at_ble_handle_t | conn_handle | ) |
References ble_heart_rate_handle_timer_event(), nm_bsp_start_timer(), nm_bsp_stop_timer(), NOTIFICATION_INTERVAL, and timer_cb_done.
Referenced by ble_heart_rate_profile_init().
void ble_heart_rate_profile_init | ( | void | ) |
hr_sensor_init initializes and defines the services of the hr profile
References ble_heart_rate_handle_disconnect_event(), ble_heart_rate_handle_paired_event(), ble_heart_rate_start_advertise(), DBG_LOG, heart_rate_init_service(), heart_rate_primary_service_define(), register_ble_disconnected_event_cb(), and register_ble_paired_event_cb().
Referenced by ble_heart_rate_init().
at_ble_status_t ble_heart_rate_start_advertise | ( | void | ) |
References ADV_TYPE_LEN, APP_HRS_ADV_TIMEOUT, APP_HRS_FAST_ADV, at_ble_adv_data_set(), AT_BLE_ADV_FP_ANY, AT_BLE_ADV_GEN_DISCOVERABLE, at_ble_adv_start(), AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_FAILURE, AT_BLE_GAP_PERIPHERAL_SLV, at_ble_set_dev_config(), AT_BLE_SUCCESS, DBG_LOG, HEART_RATE_SERVICE_UUID, HRS_ADV_DATA_NAME_DATA, HRS_ADV_DATA_NAME_LEN, HRS_ADV_DATA_NAME_TYPE, HRS_ADV_DATA_UUID_LEN, HRS_ADV_DATA_UUID_TYPE, NULL, SCAN_RESP_DATA, and SCAN_RESP_LEN.
Referenced by ble_heart_rate_handle_disconnect_event(), and ble_heart_rate_profile_init().
void heart_rate_send_notification | ( | uint8_t * | char_data, |
uint8_t | length | ||
) |
References heart_rate_update_char_value().
Referenced by ble_heart_rate_process().
uint8_t activity |
activity which will determine the
Referenced by ble_heart_rate_handle_disconnect_event(), ble_heart_rate_process(), and ble_heart_rate_value_init().
uint16_t energy_expended_val |
to count the energy expended
Referenced by ble_heart_rate_handle_disconnect_event(), and ble_heart_rate_process().
uint8_t energy_inclusion |
To check for including the energy in hr measurement
Referenced by ble_heart_rate_handle_disconnect_event(), and ble_heart_rate_process().
uint16_t energy_incrementor |
energy incrementor for various heart rate values
Referenced by ble_heart_rate_process(), and ble_heart_rate_value_init().
uint16_t heart_rate_value |
to count the heart rate value
Referenced by ble_heart_rate_process(), and ble_heart_rate_value_init().
uint8_t hr_max_value |
the maximum heart rate value
Referenced by ble_heart_rate_value_init().
uint8_t hr_min_value |
the minimum heart rate value
Referenced by ble_heart_rate_value_init().
uint8_t inc_changer |
increment operator to change heart rate
Referenced by ble_heart_rate_process(), and ble_heart_rate_value_init().
uint8_t notification_flag |
flag to show notification
Referenced by ble_heart_rate_handle_timer_event().
uint8_t prev_activity |
previous activity
Referenced by ble_heart_rate_handle_disconnect_event(), and ble_heart_rate_value_init().
uint8_t second_counter |
second_counter to count the time
Referenced by ble_heart_rate_handle_disconnect_event(), ble_heart_rate_handle_timer_event(), ble_heart_rate_process(), and ble_heart_rate_value_init().
uint8_t time_operator |
operator to change the seconds
Referenced by ble_heart_rate_handle_timer_event().
bool volatile timer_cb_done |