Heart Rate Sensor Profile.
Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.
#include "ble_manager.h"
#include "heart_rate.h"
#include "common/include/nm_common.h"
#include <asf.h>
#include "at_ble_api.h"
#include "hr_sensor.h"
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) |
static void | ble_heart_rate_handle_timer_event (void) |
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) |
static void | ble_heart_rate_value_init (void) |
void | heart_rate_send_notification (uint8_t *char_data, uint8_t length) |
Variables | |
uint8_t | activity = 0 |
uint16_t | energy_expended_val = ENERGY_EXP_NORMAL |
uint8_t | energy_inclusion = 0 |
uint16_t | energy_incrementor |
static gatt_service_handler_t | heart_rate_serv_handler |
uint16_t | heart_rate_value = HEART_RATE_MIN_NORM |
uint8_t | hr_max_value |
uint8_t | hr_min_value |
uint8_t | inc_changer = HEART_RATE_INCREMENT_VALUE |
uint8_t | notification_flag = 0 |
uint8_t | prev_activity = DEFAULT_ACTIVITY |
static const uint8_t | SCAN_RESP_DATA [SCAN_RESP_LEN] = {0x09,0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8} |
Scan response data. More... | |
uint8_t | second_counter = 0 |
uint8_t | time_operator |
bool volatile | timer_cb_done = false |
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().
|
static |
References ble_heart_rate_value_init(), END_OF_LAST_ACTIVITY, led_toggle, notification_flag, second_counter, START_OF_FIRST_ACTIVITY, time_operator, and timer_cb_done.
Referenced by ble_heart_rate_handle_paired_event().
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().
|
static |
References activity, ACTIVITY_BRISK_WALKING, ACTIVITY_FAST_RUNNING, ACTIVITY_NORMAL, ACTIVITY_RUNNING, ACTIVITY_WALKING, ENERGY_EXP_BRISK_WALKING, ENERGY_EXP_FAST_RUNNING, ENERGY_EXP_NORMAL, ENERGY_EXP_RUNNING, ENERGY_EXP_WALKING, energy_incrementor, HEART_RATE_MAX_BRISK_WALK, HEART_RATE_MAX_FAST_RUNNING, HEART_RATE_MAX_NORM, HEART_RATE_MAX_RUNNING, HEART_RATE_MAX_WALKING, HEART_RATE_MIN_BRISK_WALK, HEART_RATE_MIN_FAST_RUNNING, HEART_RATE_MIN_NORM, HEART_RATE_MIN_RUNNING, HEART_RATE_MIN_WALKING, heart_rate_value, hr_max_value, hr_min_value, inc_changer, led_toggle, prev_activity, and second_counter.
Referenced by ble_heart_rate_handle_disconnect_event(), and ble_heart_rate_handle_timer_event().
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 = 0 |
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 = ENERGY_EXP_NORMAL |
to count the energy expended
Referenced by ble_heart_rate_handle_disconnect_event(), and ble_heart_rate_process().
uint8_t energy_inclusion = 0 |
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().
|
static |
uint16_t heart_rate_value = HEART_RATE_MIN_NORM |
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 = HEART_RATE_INCREMENT_VALUE |
increment operator to change heart rate
Referenced by ble_heart_rate_process(), and ble_heart_rate_value_init().
uint8_t notification_flag = 0 |
flag to show notification
Referenced by ble_heart_rate_handle_timer_event().
uint8_t prev_activity = DEFAULT_ACTIVITY |
previous activity
Referenced by ble_heart_rate_handle_disconnect_event(), and ble_heart_rate_value_init().
|
static |
Scan response data.
Referenced by ble_heart_rate_start_advertise().
uint8_t second_counter = 0 |
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().