Microchip® Advanced Software Framework

pxp_reporter_app_s.c File Reference

Proximity Reporter Profile Application Implementations.

Copyright (c) 2021 Microchip Technology Inc. and its subsidiaries.

#include "ble_manager.h"
#include "pxp_reporter.h"
#include "immediate_alert.h"
#include "link_loss.h"
#include "common/include/nm_common.h"
#include "pxp_reporter_app.h"
#include <asf.h>
#include "driver/include/m2m_wifi.h"
#include "driver/include/m2m_periph.h"
#include "m2m_ble.h"
#include "at_ble_api.h"
#include "wifi_prov.h"

Macros

#define APP_BTN_EVENT_BTN1_LONG_PRESS   2
 
#define APP_BTN_EVENT_BTN1_SHORT_PRESS   1
 
#define APP_BTN_EVENT_BTN2_LONG_PRESS   8
 
#define APP_BTN_EVENT_BTN2_SHORT_PRESS   4
 
#define APP_STATE_COMPLETE   6
 
#define APP_STATE_IDLE   0
 
#define APP_STATE_PROVISIONING   2
 
#define APP_STATE_WAITING_FOR_BUTTON_PRESS   3
 
#define APP_STATE_WAITING_FOR_PROFILE_SWITCH   5
 
#define APP_STATE_WAITING_FOR_WIFI_CONNECTION   4
 
#define APP_STATE_WAITING_FOR_WIFI_DISCONNECTION   1
 
#define APP_WIFI_PROV_DISPLAY_NAME   ("3400 DEMO")
 
#define HEX2ASCII(x)   (((x)>=10)? (((x)-10)+'A') : ((x)+'0'))
 
#define PXP_REPORTER_INIT_TIMER_INTERVAL   (60)
 
#define PXP_REPORTER_LL_INTERVAL_FAST   (60)
 
#define PXP_REPORTER_LL_INTERVAL_MEDIUM   (255)
 
#define PXP_REPORTER_PL_INTERVAL_FAST   (60)
 
#define PXP_REPORTER_PL_INTERVAL_MEDIUM   (255)
 
#define STRING_HEADER
 

Functions

static
at_ble_event_parameter_t
gu8BleParam 
__aligned (4)
 
static void app_ble_proximity (void)
 
static void app_ble_wifi_provisioning (void)
 
static void app_button_press_callback (uint8 btn, uint8 press)
 
static void app_main (void)
 
static void app_wifi_handle_event (uint8 u8MsgType, void *pvMsg)
 
static void app_wifi_init (tpfAppWifiCb wifi_cb_func)
 
static void ble_pxp_handle_conn_update (uint8_t conn_state)
 
static void ble_pxp_handle_linkloss (uint8_t alert_val)
 
static void ble_pxp_handle_pathloss (uint8_t alert_val)
 
void ble_pxp_init (void)
 
void ble_pxp_process_event (at_ble_events_t event, void *params)
 
static void ble_pxp_profile_init (void)
 
static void configure_console (void)
 
static void led_clear (void)
 
static void led_flash (uint32_t interval_ms)
 
static void led_toggle (void)
 
int main (void)
 

Variables

static volatile uint8 gu8BtnEvent
 
static uint8 gu8ScanIndex
 
static volatile uint8 gu8WiFiConnectionState = M2M_WIFI_UNDEF
 

#define APP_BTN_EVENT_BTN1_LONG_PRESS   2
#define APP_BTN_EVENT_BTN1_SHORT_PRESS   1
#define APP_BTN_EVENT_BTN2_LONG_PRESS   8
#define APP_BTN_EVENT_BTN2_SHORT_PRESS   4
#define APP_STATE_COMPLETE   6
#define APP_STATE_IDLE   0
#define APP_STATE_PROVISIONING   2
#define APP_STATE_WAITING_FOR_BUTTON_PRESS   3
#define APP_STATE_WAITING_FOR_PROFILE_SWITCH   5
#define APP_STATE_WAITING_FOR_WIFI_CONNECTION   4
#define APP_STATE_WAITING_FOR_WIFI_DISCONNECTION   1
#define APP_WIFI_PROV_DISPLAY_NAME   ("3400 DEMO")
#define HEX2ASCII (   x)    (((x)>=10)? (((x)-10)+'A') : ((x)+'0'))

Referenced by app_wifi_init().

#define PXP_REPORTER_INIT_TIMER_INTERVAL   (60)
#define PXP_REPORTER_LL_INTERVAL_FAST   (60)

Referenced by ble_pxp_handle_linkloss().

#define PXP_REPORTER_LL_INTERVAL_MEDIUM   (255)

Referenced by ble_pxp_handle_linkloss().

#define PXP_REPORTER_PL_INTERVAL_FAST   (60)

Referenced by ble_pxp_handle_pathloss().

#define PXP_REPORTER_PL_INTERVAL_MEDIUM   (255)

Referenced by ble_pxp_handle_pathloss().

#define STRING_HEADER
Value:
"-- Wifi BLE Provisioning demo with Proximity Example--\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --\r\n"
#define BOARD_NAME
Definition: fatfs_access_example.c:112

Referenced by main().

static at_ble_event_parameter_t gu8BleParam __aligned ( )
static
static void app_ble_proximity ( void  )
static
static void app_button_press_callback ( uint8  btn,
uint8  press 
)
static
static void ble_pxp_handle_conn_update ( uint8_t  conn_state)
static

References led_clear().

Referenced by ble_pxp_profile_init().

static void ble_pxp_handle_linkloss ( uint8_t  alert_val)
static
static void ble_pxp_handle_pathloss ( uint8_t  alert_val)
static
void ble_pxp_init ( void  )
void ble_pxp_process_event ( at_ble_events_t  event,
void *  params 
)
static void configure_console ( void  )
static
static void led_clear ( void  )
static
static void led_flash ( uint32_t  interval_ms)
static
static void led_toggle ( void  )
static

Referenced by led_flash().

volatile uint8 gu8BtnEvent
static
uint8 gu8ScanIndex
static

Referenced by app_wifi_handle_event().

volatile uint8 gu8WiFiConnectionState = M2M_WIFI_UNDEF
static