Microchip® Advanced Software Framework

pxp_monitor_app.c File Reference

Proximity Monitor Profile Application.

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

#include <asf.h>
#include "platform.h"
#include "console_serial.h"
#include "pxp_monitor_app.h"
#include "immediate_alert.h"
#include "tx_power.h"
#include "link_loss.h"
#include "pxp_reporter.h"

Macros

#define APP_BUTTON_EVENT_ID   (2)
 
#define APP_INVALID_EVENT_ID   (0)
 
#define APP_TIMER_EVENT_ID   (1)
 

Functions

void button_cb (void)
 
int main (void)
 
static void pxp_app_init (void)
 Proximity Application initialization start the device scanning process. More...
 
static void pxp_monitor_app_button_event (void)
 
static at_ble_status_t pxp_monitor_app_custom_event (void *param)
 
static void pxp_monitor_app_timer_event (void)
 
static void rssi_update (at_ble_handle_t conn_handle)
 Check for Link Loss and Path Loss alert check for Low Alert value if crossed write Low Alert value to Immediate Alert Service. More...
 
static void timer_callback_handler (void)
 

Variables

pxp_current_alert_t alert_level = PXP_NO_ALERT
 
user_custom_event_t app_custom_event [2]
 
volatile bool app_init_done = false
 
volatile bool app_timer_done = false
 
ble_connected_dev_info_t ble_dev_info [BLE_MAX_DEVICE_CONNECTION]
 Initialize the service with its included service, characteristics, and descriptors. More...
 
volatile bool button_pressed = false
 Determine if button is pressed. More...
 
gatt_ias_char_handler_t ias_handle
 
gatt_lls_char_handler_t lls_handle
 
at_ble_addr_t peer_addr = {AT_BLE_ADDRESS_PUBLIC, {0x03, 0x18, 0xf0, 0x05, 0xf0, 0xf8}}
 
uint8_t pxp_connect_request_flag
 
static const ble_custom_event_cb_t pxp_monitor_custom_event_cb
 
int8_t rssi_power = 0
 
gatt_txps_char_handler_t txps_handle
 

#define APP_BUTTON_EVENT_ID   (2)
#define APP_INVALID_EVENT_ID   (0)
#define APP_TIMER_EVENT_ID   (1)

void button_cb ( void  )
static void pxp_app_init ( void  )
static

Proximity Application initialization start the device scanning process.

References AT_BLE_FAILURE, AT_BLE_INVALID_PARAM, DBG_LOG, and gap_dev_scan().

Referenced by main().

static void rssi_update ( at_ble_handle_t  conn_handle)
static

Check for Link Loss and Path Loss alert check for Low Alert value if crossed write Low Alert value to Immediate Alert Service.

High Alert value if crossed write High Alert value to IAS service

Parameters
[in]conn_handleConnection handle of a connected device

References alert_level, app_timer_done, at_ble_rx_power_get(), AT_BLE_SUCCESS, gatt_ias_char_handler::char_handle, DBG_LOG, DBG_LOG_CONT, ias_alert_level_write(), IAS_HIGH_ALERT, IAS_MID_ALERT, IAS_NO_ALERT, PXP_HIGH_ALERT, PXP_HIGH_ALERT_RANGE, PXP_LOW_ALERT_RANGE, PXP_MID_ALERT, PXP_NO_ALERT, and rssi_power.

Referenced by pxp_monitor_app_timer_event().

static void timer_callback_handler ( void  )
static

Referenced by rssi_update().

user_custom_event_t app_custom_event[2]
Initial value:
= {
{
.bptr = NULL,
},
{
.bptr = NULL
}
}
#define APP_BUTTON_EVENT_ID
Definition: pxp_monitor_app.c:199
#define APP_TIMER_EVENT_ID
Definition: pxp_monitor_app.c:198
#define NULL
Definition: nm_bsp.h:64
volatile bool app_init_done = false
volatile bool app_timer_done = false

Initialize the service with its included service, characteristics, and descriptors.

Parameters
[in]scan_paramgatt service information
Returns
none
at_ble_addr_t peer_addr = {AT_BLE_ADDRESS_PUBLIC, {0x03, 0x18, 0xf0, 0x05, 0xf0, 0xf8}}

Referenced by app_connected_cb().

const ble_custom_event_cb_t pxp_monitor_custom_event_cb
static
Initial value:
= {
}
static at_ble_status_t pxp_monitor_app_custom_event(void *param)
Definition: pxp_monitor_app.c:453
int8_t rssi_power = 0