Microchip® Advanced Software Framework

pxp_reporter.h File Reference

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.

Referenced by pxp_disconnect_event_handler(), and pxp_reporter_adv().

#define APP_PXP_FAST_ADV   (100)

APP_PXP_FAST_ADV between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s).

Referenced by pxp_disconnect_event_handler(), and pxp_reporter_adv().

#define IAL_ADV_DATA_UUID_LEN   (2)

IAL_ADV_DATA_UUID_LEN the size of IAL service uuid.

Referenced by pxp_reporter_adv().

#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.

Referenced by pxp_reporter_adv().

#define LL_ADV_DATA_UUID_TYPE   (0x03)

LL_ADV_DATA_UUID_TYPE the total sizeof LL service uuid.

Referenced by pxp_reporter_adv().

#define PATHLOSS

PATHLOSS which defines if the user wants pathloss functionality.

#define PXP_ADV_DATA_NAME_DATA   ("ATMEL-PXP")

Referenced by pxp_reporter_adv().

#define PXP_ADV_DATA_NAME_LEN   (9)

PXP_ADV_DATA_NAME_LEN the length of the device name.

Referenced by pxp_reporter_adv().

#define PXP_ADV_DATA_NAME_TYPE   (0x09)

PXP_ADV_DATA_NAME_TYPE the gap ad data type.

Referenced by pxp_reporter_adv().

#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.

Referenced by pxp_reporter_adv().

#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

Parameters
[in]at_ble_disconnected_twhich includes the connection parameters like handle,reason for disconnection
Precondition
Must be called when the device is disconnected
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

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.

at_ble_status_t pxp_reporter_char_changed_handler ( at_ble_characteristic_changed_t char_handle)

character changed handler

Parameters
[in]at_ble_characteristic_changed_twhich includes handle,new value
Precondition
Must be called when character change event occurs
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

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

Parameters
[in]at_ble_connected_twhich includes the connection parameters like handle
Precondition
Must be called when the device is connected
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

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)

Initialize the profile, includes all initializations and start up routines of the profiles.

Parameters
[in]void
Precondition
Must be called after ble_init
Returns
void

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  )

profile services definition to the attribute data base

Parameters
[in]void
Precondition
Must be called after ref pxp_service_init
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

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  )

Initialize the services of the profile.

Parameters
[in]void
Precondition
Must be called before pxp_service_define
Returns
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

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

Parameters
[in]callback 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

Parameters
[in]callback 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().

void register_pathloss_handler ( reporter_callback_t  pathloss_fn)

function which register the application alerting function for pathloss to the profile

Parameters
[in]callback 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().