Proximity Reporter Profile.
Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include <string.h>
#include "at_ble_api.h"
#include "ble_manager.h"
#include "pxp_reporter.h"
#include "immediate_alert.h"
#include "link_loss.h"
#include "tx_power.h"
#include "ble_utils.h"
Functions | |
at_ble_status_t | pxp_disconnect_event_handler (at_ble_disconnected_t *disconnect) |
reporter disconnected state handler function called after More... | |
void | pxp_reporter_adv (void) |
reporter advertisement initialization and adv start More... | |
at_ble_status_t | pxp_reporter_char_changed_handler (at_ble_characteristic_changed_t *char_handle) |
Characteristic change handler function More... | |
at_ble_status_t | pxp_reporter_connected_state_handler (at_ble_connected_t *conn_params) |
reporter connected state handler function called after More... | |
void | pxp_reporter_init (void *param) |
reporter Initialization which initializes service,defines and start adv More... | |
at_ble_status_t | pxp_service_define (void) |
of profile services to the attribute data base based on pathloss More... | |
void | pxp_service_init (void) |
Initializations of profile services based on pathloss option. More... | |
void | register_conn_update_handler (reporter_callback_t conn_update_fn) |
function which register notification callback on BLE connection update More... | |
void | register_linkloss_handler (reporter_callback_t linkloss_fn) |
registering the linkloss handler of the application More... | |
void | register_pathloss_handler (reporter_callback_t pathloss_fn) |
registering the path loss handler of the application More... | |
Variables | |
reporter_callback_t | conn_update_cb |
gatt_service_handler_t | ias_handle |
reporter_callback_t | linkloss_cb |
uint8_t | linkloss_current_alert_level |
Alert value used for Linkloss service. More... | |
gatt_service_handler_t | lls_handle |
uint8_t | pathloss_alert_value = INVALID_IAS_PARAM |
Alert value used for immediate alert service helps in pathloss. More... | |
reporter_callback_t | pathloss_cb |
Callback handlers for linkloss and pathloss. More... | |
uint8_t | scan_rsp_data [SCAN_RESP_LEN] = {0x09, 0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8} |
led_state the state of the led More... | |
gatt_service_handler_t | txps_handle |
at_ble_status_t pxp_disconnect_event_handler | ( | at_ble_disconnected_t * | disconnect | ) |
reporter disconnected state handler function called after
disconnection event handler
References APP_PXP_ADV_TIMEOUT, APP_PXP_FAST_ADV, AT_BLE_ADV_FP_ANY, AT_BLE_ADV_GEN_DISCOVERABLE, at_ble_adv_start(), AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_GAP_PERIPHERAL_SLV, at_ble_set_dev_config(), AT_BLE_SUCCESS, DBG_LOG, linkloss_cb, linkloss_current_alert_level, and NULL.
void pxp_reporter_adv | ( | void | ) |
reporter advertisement initialization and adv start
sets the advertisement data and starts advertisement
References ADV_TYPE_LEN, APP_PXP_ADV_TIMEOUT, APP_PXP_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_GAP_PERIPHERAL_SLV, at_ble_set_dev_config(), AT_BLE_SUCCESS, DBG_LOG, IAL_ADV_DATA_UUID_LEN, IMMEDIATE_ALERT_SERVICE_UUID, LINK_LOSS_SERVICE_UUID, LL_ADV_DATA_UUID_LEN, LL_ADV_DATA_UUID_TYPE, NULL, PXP_ADV_DATA_NAME_DATA, PXP_ADV_DATA_NAME_LEN, PXP_ADV_DATA_NAME_TYPE, SCAN_RESP_LEN, TX_POWER_SERVICE_UUID, and TXP_ADV_DATA_UUID_LEN.
Referenced by pxp_reporter_init().
at_ble_status_t pxp_reporter_char_changed_handler | ( | at_ble_characteristic_changed_t * | char_handle | ) |
Characteristic change handler function
character changed handler
References AT_BLE_SUCCESS, ias_set_alert_value(), INVALID_IAS_PARAM, INVALID_LLS_PARAM, linkloss_current_alert_level, lls_set_alert_value(), pathloss_alert_value, and pathloss_cb.
at_ble_status_t pxp_reporter_connected_state_handler | ( | at_ble_connected_t * | conn_params | ) |
reporter connected state handler function called after
connection state handler
References at_ble_characteristic_value_get(), AT_BLE_SUCCESS, at_ble_characteristic_t::char_val_handle, at_ble_connected_t::conn_status, conn_update_cb, DBG_LOG, linkloss_current_alert_level, pathloss_alert_value, gatt_service_handler::serv_chars, and status.
void pxp_reporter_init | ( | void * | param | ) |
reporter Initialization which initializes service,defines and start adv
Initialize the profile, includes all initializations and start up routines of the profiles.
References pxp_reporter_adv(), pxp_service_define(), and pxp_service_init().
at_ble_status_t pxp_service_define | ( | void | ) |
of profile services to the attribute data base based on pathloss
profile services definition to the attribute data base
References AT_BLE_SUCCESS, DBG_LOG, ias_primary_service_define(), lls_primary_service_define(), and txps_primary_service_define().
Referenced by pxp_reporter_init().
void pxp_service_init | ( | void | ) |
Initializations of profile services based on pathloss option.
Initialize the services of the profile.
Initializing the mandatory linkloss service of proximity reporter
Initializing the optional services for pathloss feature of proximity reporter
References init_immediate_alert_service(), init_linkloss_service(), and init_tx_power_service().
Referenced by pxp_reporter_init().
void register_conn_update_handler | ( | reporter_callback_t | conn_update_fn | ) |
function which register notification callback on BLE connection update
[in] | call | back function of the application for connection_update. |
References conn_update_cb.
Referenced by ble_pxp_profile_init().
void register_linkloss_handler | ( | reporter_callback_t | linkloss_fn | ) |
registering the linkloss handler of the application
function which register the application alerting function for linkloss to the profile
References linkloss_cb.
Referenced by ble_pxp_profile_init().
void register_pathloss_handler | ( | reporter_callback_t | pathloss_fn | ) |
registering the path loss handler of the application
function which register the application alerting function for pathloss to the profile
References pathloss_cb.
Referenced by ble_pxp_profile_init().
reporter_callback_t conn_update_cb |
Referenced by pxp_reporter_connected_state_handler(), and register_conn_update_handler().
gatt_service_handler_t ias_handle |
reporter_callback_t linkloss_cb |
Referenced by pxp_disconnect_event_handler(), and register_linkloss_handler().
uint8_t linkloss_current_alert_level |
Alert value used for Linkloss service.
Referenced by pxp_disconnect_event_handler(), pxp_reporter_char_changed_handler(), and pxp_reporter_connected_state_handler().
gatt_service_handler_t lls_handle |
uint8_t pathloss_alert_value = INVALID_IAS_PARAM |
Alert value used for immediate alert service helps in pathloss.
Referenced by pxp_reporter_char_changed_handler(), and pxp_reporter_connected_state_handler().
reporter_callback_t pathloss_cb |
Callback handlers for linkloss and pathloss.
Referenced by pxp_reporter_char_changed_handler(), and register_pathloss_handler().
uint8_t scan_rsp_data[SCAN_RESP_LEN] = {0x09, 0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8} |
led_state the state of the led
Scan response data
gatt_service_handler_t txps_handle |