Microchip® Advanced Software Framework

pxp_reporter.h File Reference

Proximity Reporter Profile declarations.

Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.

#include "ble_manager.h"

Macros

#define ADV_DATA_LEN   (18)
 ADV_DATA_LEN. More...
 
#define ADV_TYPE_LEN   (0x1)
 ADV_TYPE_LEN. More...
 
#define APP_PXP_ADV_TIMEOUT   (655)
 APP_PXP_ADV_TIMEOUT Advertising time-out between 0x0001 and 0x028F in seconds, 0x0000 disables time-out. More...
 
#define APP_PXP_FAST_ADV   (1600)
 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   (0x3)
 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   (0x3)
 LL_ADV_DATA_UUID_TYPE the total sizeof LL service uuid. More...
 
#define PATHLOSS
 
#define PATHLOSS_VALUE   1
 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   (0x9)
 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   (0x3)
 TXP_ADV_DATA_UUID_TYPE the total sizeof TXP service uuid. More...
 

Typedefs

typedef void(* reporter_callback_t )(uint8_t)
 
typedef void(* reporter_state_callback_t )(bool)
 

Functions

void pxp_reporter_adv (void)
 sets the advertisement data and starts advertisement More...
 
at_ble_status_t pxp_reporter_char_changed_handler (void *params)
 character changed handler More...
 
at_ble_status_t pxp_reporter_connected_state_handler (void *params)
 connection state handler More...
 
at_ble_status_t pxp_reporter_disconnect_event_handler (void *params)
 disconnection event 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_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...
 
void register_state_handler (reporter_state_callback_t state_fn)
 function which register the application state call back handler More...
 

#define ADV_DATA_LEN   (18)

ADV_DATA_LEN.

#define ADV_TYPE_LEN   (0x1)

ADV_TYPE_LEN.

#define APP_PXP_ADV_TIMEOUT   (655)

APP_PXP_ADV_TIMEOUT Advertising time-out between 0x0001 and 0x028F in seconds, 0x0000 disables time-out.

Referenced by pxp_reporter_adv(), and pxp_reporter_disconnect_event_handler().

#define APP_PXP_FAST_ADV   (1600)

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

Referenced by pxp_reporter_adv(), and pxp_reporter_disconnect_event_handler().

#define IAL_ADV_DATA_UUID_LEN   (2)

IAL_ADV_DATA_UUID_LEN the size of IAL service uuid.

#define IAL_ADV_DATA_UUID_TYPE   (0x3)

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   (0x3)

LL_ADV_DATA_UUID_TYPE the total sizeof LL service uuid.

#define PATHLOSS
#define PATHLOSS_VALUE   1

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   (0x9)

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   (0x3)

TXP_ADV_DATA_UUID_TYPE the total sizeof TXP service uuid.

typedef void(* reporter_callback_t)(uint8_t)
typedef void(* reporter_state_callback_t)(bool)

void pxp_reporter_adv ( void  )

sets the advertisement data and starts advertisement

Parameters
[in]void
Precondition
Must be called after ref pxp_service_init
Returns
void

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)

character changed handler

Parameters
[in]at_ble_characteristic_changed_twhich includes handle,new value
Precondition
Must be called when character change event occurred
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 ( void *  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 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)

disconnection event handler

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

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

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

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_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 main().

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 main().

void register_state_handler ( reporter_state_callback_t  state_fn)

function which register the application state call back handler

Parameters
[in]callback function of the application for connection state

References connected_cb.

Referenced by main().