Blood Pressure Sensor Profile.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include <string.h>
#include "timer_hw.h"
#include "at_ble_api.h"
#include "ble_manager.h"
#include "device_info.h"
#include "blood_pressure.h"
#include "blp_sensor.h"
#include "ble_utils.h"
Functions | |
void | blp_disconnection (void) |
blp_disconnection called by the application to disconnect More... | |
at_ble_status_t | blp_indication_confirmation_handler (void *params) |
blp_indication_confirmation_handler called by ble manager to give the status of notification sent More... | |
at_ble_status_t | blp_notification_confirmation_handler (void *params) |
blp_notification_confirmation_handler called by ble manager to give the status of notification sent More... | |
void | blp_sensor_adv (void) |
blp_sensor_adv starts advertisement More... | |
at_ble_status_t | blp_sensor_char_changed_handler (void *char_handle) |
blp_sensor_char_changed_handler called by the ble manager after a change in the characteristic More... | |
at_ble_status_t | blp_sensor_connected_state_handler (void *conn_params) |
blp_sensor_connected_state_handler called by ble manager after a change in characteristic More... | |
at_ble_status_t | blp_sensor_disconnect_event_handler (void *disconnect) |
blp_sensor_disconnect_event_handler called by ble manager after disconnection event received More... | |
void | blp_sensor_init (void *param) |
blp_sensor_init initializes and defines the services of the hr profile More... | |
void | blp_sensor_send_indication (uint8_t *blp_data, uint8_t length) |
blp_sensor_send_indication adds the new characteristic value and sends the indication More... | |
void | blp_sensor_send_notification (uint8_t *blp_data, uint8_t length) |
blp_sensor_send_notification adds the new characteristic value and sends the notification More... | |
void | blp_sensor_service_define (void) |
blp_sensor_service_define defines the services of the profile More... | |
void | blp_sensor_service_init (void) |
Initialization of profile services. More... | |
void | register_blp_indication_handler (blp_indication_callback_t blp_indication_handler) |
register_blp_indication_handler registers the indication handler passed by the application More... | |
void | register_blp_notification_handler (blp_notification_callback_t blp_notificaton_handler) |
register_blp_notification_handler registers the notification handler passed by the application More... | |
Variables | |
static const ble_gap_event_cb_t | blp_sensor_gap_handle |
static const ble_gatt_server_event_cb_t | blp_sensor_gatt_server_handle |
blp_gatt_service_handler_t | blp_service_handler |
blood pressure measurement service handler More... | |
at_ble_handle_t | connection_handle |
contains the connection handle functions More... | |
dis_gatt_service_handler_t | dis_service_handler |
device information service handler More... | |
blp_indication_callback_t | indication_cb |
blp_notification_callback_t | notification_cb |
callback functions pointers contains the address of application functions More... | |
uint8_t | scan_rsp_data [SCAN_RESP_LEN] = {0x09, 0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8} |
Scan response data. More... | |
void blp_disconnection | ( | void | ) |
blp_disconnection called by the application to disconnect
References at_ble_disconnect(), AT_BLE_SUCCESS, AT_BLE_TERMINATED_BY_USER, connection_handle, DBG_LOG, and status.
Referenced by update_blp_sensor_value().
at_ble_status_t blp_indication_confirmation_handler | ( | void * | params | ) |
blp_indication_confirmation_handler called by ble manager to give the status of notification sent
[in] | at_ble_cmd_complete_event_t | address of the cmd completion |
References AT_BLE_SUCCESS, DBG_LOG_DEV, and at_ble_cmd_complete_event_t::status.
at_ble_status_t blp_notification_confirmation_handler | ( | void * | params | ) |
blp_notification_confirmation_handler called by ble manager to give the status of notification sent
[in] | at_ble_cmd_complete_event_t | address of the cmd completion |
References AT_BLE_SUCCESS, DBG_LOG_DEV, and at_ble_cmd_complete_event_t::status.
void blp_sensor_adv | ( | void | ) |
blp_sensor_adv starts advertisement
blp_sensor_adv adds the advertisement data of the profile and starts advertisement
References AT_BLE_ADV_FP_ANY, AT_BLE_ADV_GEN_DISCOVERABLE, at_ble_adv_start(), AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_SUCCESS, BLP_SENSOR_ADV_TIMEOUT, BLP_SENSOR_FAST_ADV, DBG_LOG, NULL, and status.
Referenced by app_disconnected_state_handler(), and main().
at_ble_status_t blp_sensor_char_changed_handler | ( | void * | char_handle | ) |
blp_sensor_char_changed_handler called by the ble manager after a change in the characteristic
[in] | at_ble_characteristic_changed_t | which contains handle of characteristic and new value |
References AT_BLE_SUCCESS, blp_char_change_handler(), BLP_INDICATION_DISABLE, BLP_INDICATION_ENABLE, BLP_NOTIFICATION_DISABLE, BLP_NOTIFICATION_ENABLE, indication_cb, and notification_cb.
at_ble_status_t blp_sensor_connected_state_handler | ( | void * | conn_params | ) |
blp_sensor_connected_state_handler called by ble manager after a change in characteristic
[in] | at_ble_connected_t | which has connection handle and the peer device address |
References AT_BLE_SUCCESS, and connection_handle.
at_ble_status_t blp_sensor_disconnect_event_handler | ( | void * | disconnect | ) |
blp_sensor_disconnect_event_handler called by ble manager after disconnection event received
@param[in] at_ble_disconnected_t which has connection handle and
reason for disconnection
References ALL_UNUSED, and AT_BLE_SUCCESS.
void blp_sensor_init | ( | void * | param | ) |
blp_sensor_init initializes and defines the services of the hr profile
blp_sensor_init initializes and defines the services of the blp profile
[in] | params | are unused. |
References ALL_UNUSED, AT_BLE_SUCCESS, ble_advertisement_data_set(), BLE_GAP_EVENT_TYPE, BLE_GATT_SERVER_EVENT_TYPE, ble_mgr_events_callback_handler(), blp_sensor_service_define(), blp_sensor_service_init(), at_ble_characteristic_t::char_val_handle, at_ble_characteristic_t::client_config_handle, DBG_LOG, DBG_LOG_PTS, at_ble_characteristic_t::init_value, REGISTER_CALL_BACK, hr_gatt_service_handler::serv_chars, dis_gatt_service_handler::serv_chars, hr_gatt_service_handler::serv_handle, dis_gatt_service_handler::serv_handle, and status.
Referenced by main().
void blp_sensor_send_indication | ( | uint8_t * | blp_data, |
uint8_t | length | ||
) |
blp_sensor_send_indication adds the new characteristic value and sends the indication
[in] | blp | the new blp characteristic value needs to be updated |
[in] | length | length of new characteristic value |
Updating the new characteristic value
Sending the indication for the updated characteristic
References at_ble_characteristic_value_set(), at_ble_indication_send(), AT_BLE_SUCCESS, at_ble_characteristic_t::char_val_handle, connection_handle, DBG_LOG, hr_gatt_service_handler::serv_chars, and status.
Referenced by app_indication_handler(), and blp_char_indication().
void blp_sensor_send_notification | ( | uint8_t * | blp_data, |
uint8_t | length | ||
) |
blp_sensor_send_notification adds the new characteristic value and sends the notification
blp_sensor_send_notification disconnects with the peer device called by the application
[in] | blp_data | the new hr characteristic value needs to be updated |
[in] | length | length of new characteristic value |
Updating the new characteristic value
Sending the notification for the updated characteristic
References at_ble_characteristic_value_set(), at_ble_notification_send(), AT_BLE_SUCCESS, at_ble_characteristic_t::char_val_handle, connection_handle, DBG_LOG, hr_gatt_service_handler::serv_chars, and status.
Referenced by blp_char_notification().
void blp_sensor_service_define | ( | void | ) |
blp_sensor_service_define defines the services of the profile
References AT_BLE_SUCCESS, blp_primary_service_define(), DBG_LOG, dis_primary_service_define(), and status.
Referenced by blp_sensor_init().
void blp_sensor_service_init | ( | void | ) |
Initialization of profile services.
blp_sensor_service_init initializes the services of the profile
References blp_init_service(), and dis_init_service().
Referenced by blp_sensor_init().
void register_blp_indication_handler | ( | blp_indication_callback_t | blp_indication_handler | ) |
register_blp_indication_handler registers the indication handler passed by the application
[in] | blp_indication_callback_t | address of the indication handler function to be called |
References indication_cb.
Referenced by main().
void register_blp_notification_handler | ( | blp_notification_callback_t | blp_notificaton_handler | ) |
register_blp_notification_handler registers the notification handler passed by the application
[in] | blp_notification_callback_t | address of the notification handler function to be called |
References notification_cb.
Referenced by main().
|
static |
|
static |
blp_gatt_service_handler_t blp_service_handler |
blood pressure measurement service handler
at_ble_handle_t connection_handle |
contains the connection handle functions
Referenced by blp_disconnection(), blp_sensor_connected_state_handler(), blp_sensor_send_indication(), blp_sensor_send_notification(), hr_sensor_connected_state_handler(), hr_sensor_disconnect(), and hr_sensor_send_notification().
dis_gatt_service_handler_t dis_service_handler |
device information service handler
blp_indication_callback_t indication_cb |
Referenced by blp_sensor_char_changed_handler(), and register_blp_indication_handler().
blp_notification_callback_t notification_cb |
callback functions pointers contains the address of application functions
Referenced by blp_sensor_char_changed_handler(), hr_sensor_char_changed_handler(), register_blp_notification_handler(), and register_hr_notification_handler().
uint8_t scan_rsp_data[SCAN_RESP_LEN] = {0x09, 0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8} |
Scan response data.