Proximity Reporter Profile.
Copyright (c) 2017-2018 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 | |
void | pxp_reporter_adv (void) |
reporter advertisement initialization and adv start More... | |
at_ble_status_t | pxp_reporter_char_changed_handler (void *params) |
Characteristic change handler function More... | |
at_ble_status_t | pxp_reporter_connected_state_handler (void *params) |
reporter connected state handler More... | |
at_ble_status_t | pxp_reporter_disconnect_event_handler (void *params) |
reporter disconnected state handler 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_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... | |
void | register_state_handler (reporter_state_callback_t state_fn) |
function which register the application state call back handler More... | |
Variables | |
reporter_state_callback_t | connected_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... | |
static const ble_gap_event_cb_t | pxp_gap_handle |
static const ble_gatt_server_event_cb_t | pxp_gatt_server_handle |
uint8_t | scan_rsp_data [SCAN_RESP_LEN] = {0x09, 0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8} |
Scan response data. More... | |
gatt_service_handler_t | txps_handle |
void pxp_reporter_adv | ( | void | ) |
reporter advertisement initialization and adv start
sets the advertisement data and starts advertisement
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_SUCCESS, ble_advertisement_data_set(), DBG_LOG, and NULL.
Referenced by pxp_reporter_init().
at_ble_status_t pxp_reporter_char_changed_handler | ( | void * | params | ) |
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 | ( | void * | params | ) |
reporter connected state handler
connection state handler
References ALL_UNUSED, at_ble_characteristic_value_get(), AT_BLE_SUCCESS, connected_cb, DBG_LOG, linkloss_current_alert_level, and pathloss_alert_value.
at_ble_status_t pxp_reporter_disconnect_event_handler | ( | void * | params | ) |
reporter disconnected state handler
disconnection event handler
References ALL_UNUSED, 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_SUCCESS, DBG_LOG, linkloss_cb, linkloss_current_alert_level, and NULL.
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 ALL_UNUSED, BLE_GAP_EVENT_TYPE, BLE_GATT_SERVER_EVENT_TYPE, ble_mgr_events_callback_handler(), pxp_reporter_adv(), pxp_service_define(), pxp_service_init(), and REGISTER_CALL_BACK.
Referenced by main().
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, DBG_LOG_DEV, 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_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 main().
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 main().
void register_state_handler | ( | reporter_state_callback_t | state_fn | ) |
function which register the application state call back handler
[in] | call | back function of the application for connection state |
References connected_cb.
Referenced by main().
reporter_state_callback_t connected_cb |
gatt_service_handler_t ias_handle |
reporter_callback_t linkloss_cb |
Referenced by pxp_reporter_disconnect_event_handler(), and register_linkloss_handler().
uint8_t linkloss_current_alert_level |
Alert value used for Linkloss service.
Referenced by pxp_reporter_char_changed_handler(), pxp_reporter_connected_state_handler(), and pxp_reporter_disconnect_event_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().
|
static |
|
static |
uint8_t scan_rsp_data[SCAN_RESP_LEN] = {0x09, 0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8} |
Scan response data.
gatt_service_handler_t txps_handle |