Proximity Reporter Profile declarations.
Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.
#include "ble_manager.h"
Macros | |
#define | ADV_DATA_LEN (18) |
ADV_DATA_LEN. More... | |
#define | ADV_TYPE_LEN (0x01) |
ADV_TYPE_LEN. More... | |
#define | APP_PXP_ADV_TIMEOUT (1000) |
APP_PXP_ADV_TIMEOUT Advertising time-out between 0x0001 and 0x3FFF in seconds, 0x0000 disables time-out. More... | |
#define | APP_PXP_FAST_ADV (100) |
APP_PXP_FAST_ADV between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s). More... | |
#define | IAL_ADV_DATA_UUID_LEN (2) |
IAL_ADV_DATA_UUID_LEN the size of IAL service uuid. More... | |
#define | IAL_ADV_DATA_UUID_TYPE (0x03) |
IAL_ADV_DATA_UUID_TYPE the total sizeof IAL service uuid. More... | |
#define | LL_ADV_DATA_UUID_LEN (2) |
LL_ADV_DATA_UUID_LEN the size of LL service uuid. More... | |
#define | LL_ADV_DATA_UUID_TYPE (0x03) |
LL_ADV_DATA_UUID_TYPE the total sizeof LL service uuid. More... | |
#define | PATHLOSS |
PATHLOSS which defines if the user wants pathloss functionality. More... | |
#define | PXP_ADV_DATA_NAME_DATA ("ATMEL-PXP") |
#define | PXP_ADV_DATA_NAME_LEN (9) |
PXP_ADV_DATA_NAME_LEN the length of the device name. More... | |
#define | PXP_ADV_DATA_NAME_TYPE (0x09) |
PXP_ADV_DATA_NAME_TYPE the gap ad data type. More... | |
#define | SCAN_RESP_LEN (10) |
scan_resp_len is the length of the scan response data More... | |
#define | TXP_ADV_DATA_UUID_LEN (2) |
TXP_ADV_DATA_UUID_LEN the size of TXP service uuid. More... | |
#define | TXP_ADV_DATA_UUID_TYPE (0x03) |
TXP_ADV_DATA_UUID_TYPE the total sizeof TXP service uuid. More... | |
Typedefs | |
typedef void(* | reporter_callback_t )(uint8_t) |
Functions | |
at_ble_status_t | pxp_disconnect_event_handler (at_ble_disconnected_t *disconnect) |
disconnection event handler More... | |
void | pxp_reporter_adv (void) |
sets the advertisement data and starts advertisement More... | |
at_ble_status_t | pxp_reporter_char_changed_handler (at_ble_characteristic_changed_t *char_handle) |
character changed handler More... | |
at_ble_status_t | pxp_reporter_connected_state_handler (at_ble_connected_t *conn_params) |
connection state handler More... | |
void | pxp_reporter_init (void *param) |
Initialize the profile, includes all initializations and start up routines of the profiles. More... | |
at_ble_status_t | pxp_service_define (void) |
profile services definition to the attribute data base More... | |
void | pxp_service_init (void) |
Initialize the services of the profile. 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) |
function which register the application alerting function for linkloss to the profile More... | |
void | register_pathloss_handler (reporter_callback_t pathloss_fn) |
function which register the application alerting function for pathloss to the profile More... | |
#define ADV_DATA_LEN (18) |
ADV_DATA_LEN.
#define ADV_TYPE_LEN (0x01) |
ADV_TYPE_LEN.
#define APP_PXP_ADV_TIMEOUT (1000) |
APP_PXP_ADV_TIMEOUT Advertising time-out between 0x0001 and 0x3FFF in seconds, 0x0000 disables time-out.
#define APP_PXP_FAST_ADV (100) |
APP_PXP_FAST_ADV between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s).
#define IAL_ADV_DATA_UUID_LEN (2) |
IAL_ADV_DATA_UUID_LEN the size of IAL service uuid.
#define IAL_ADV_DATA_UUID_TYPE (0x03) |
IAL_ADV_DATA_UUID_TYPE the total sizeof IAL service uuid.
#define LL_ADV_DATA_UUID_LEN (2) |
LL_ADV_DATA_UUID_LEN the size of LL service uuid.
#define LL_ADV_DATA_UUID_TYPE (0x03) |
LL_ADV_DATA_UUID_TYPE the total sizeof LL service uuid.
#define PATHLOSS |
PATHLOSS which defines if the user wants pathloss functionality.
#define PXP_ADV_DATA_NAME_DATA ("ATMEL-PXP") |
#define PXP_ADV_DATA_NAME_LEN (9) |
PXP_ADV_DATA_NAME_LEN the length of the device name.
#define PXP_ADV_DATA_NAME_TYPE (0x09) |
PXP_ADV_DATA_NAME_TYPE the gap ad data type.
#define SCAN_RESP_LEN (10) |
scan_resp_len is the length of the scan response data
#define TXP_ADV_DATA_UUID_LEN (2) |
TXP_ADV_DATA_UUID_LEN the size of TXP service uuid.
#define TXP_ADV_DATA_UUID_TYPE (0x03) |
TXP_ADV_DATA_UUID_TYPE the total sizeof TXP service uuid.
typedef void(* reporter_callback_t)(uint8_t) |
at_ble_status_t pxp_disconnect_event_handler | ( | at_ble_disconnected_t * | disconnect | ) |
disconnection event handler
[in] | at_ble_disconnected_t | which includes the connection parameters like handle,reason for disconnection |
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 | ) |
sets the advertisement data and starts advertisement
[in] | void |
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, ble_advertisement_data_set(), 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 | ) |
character changed handler
[in] | at_ble_characteristic_changed_t | which includes handle,new value |
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 | ) |
connection state handler
[in] | at_ble_connected_t | which includes the connection parameters like handle |
connection state handler
References at_ble_characteristic_value_get(), AT_BLE_SUCCESS, at_ble_connected_t::conn_status, conn_update_cb, DBG_LOG, len, linkloss_current_alert_level, pathloss_alert_value, and status.
void pxp_reporter_init | ( | void * | param | ) |
Initialize the profile, includes all initializations and start up routines of the profiles.
[in] | void |
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 | ) |
profile services definition to the attribute data base
[in] | void |
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 | ) |
Initialize the services of the profile.
[in] | void |
Initialize the services of the profile.
Initializing the mandatory linkloss service of proximity reporter
Initializing the optional services for pathloss feature of proximity reporter
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 | ) |
function which register the application alerting function for linkloss to the profile
[in] | call | back function of the application for linkloss |
function which register the application alerting function for linkloss to the profile
References linkloss_cb.
Referenced by ble_pxp_profile_init(), and main().
void register_pathloss_handler | ( | reporter_callback_t | pathloss_fn | ) |
function which register the application alerting function for pathloss to the profile
[in] | call | back function of the application for pathloss |
function which register the application alerting function for pathloss to the profile
References pathloss_cb.
Referenced by ble_pxp_profile_init(), and main().