Proximity Reporter Profile Application Implementations.
Copyright (c) 2020-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 "console.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 | led_clear (void) |
static void | led_flash (uint32_t interval_ms) |
static void | led_init (void) |
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 |
Referenced by app_ble_wifi_provisioning(), and app_button_press_callback().
#define APP_BTN_EVENT_BTN1_SHORT_PRESS 1 |
Referenced by app_ble_wifi_provisioning(), and app_button_press_callback().
#define APP_BTN_EVENT_BTN2_LONG_PRESS 8 |
Referenced by app_button_press_callback().
#define APP_BTN_EVENT_BTN2_SHORT_PRESS 4 |
Referenced by app_button_press_callback().
#define APP_STATE_COMPLETE 6 |
Referenced by app_ble_wifi_provisioning().
#define APP_STATE_IDLE 0 |
Referenced by app_ble_wifi_provisioning().
#define APP_STATE_PROVISIONING 2 |
Referenced by app_ble_wifi_provisioning().
#define APP_STATE_WAITING_FOR_BUTTON_PRESS 3 |
Referenced by app_ble_wifi_provisioning().
#define APP_STATE_WAITING_FOR_PROFILE_SWITCH 5 |
Referenced by app_ble_wifi_provisioning().
#define APP_STATE_WAITING_FOR_WIFI_CONNECTION 4 |
Referenced by app_ble_wifi_provisioning().
#define APP_STATE_WAITING_FOR_WIFI_DISCONNECTION 1 |
Referenced by app_ble_wifi_provisioning().
#define APP_WIFI_PROV_DISPLAY_NAME ("3400 DEMO") |
Referenced by app_ble_wifi_provisioning().
#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 |
Referenced by main().
|
static |
|
static |
References AT_BLE_SUCCESS, ble_pxp_init(), ble_pxp_process_event(), m2m_ble_event_get(), and m2m_ble_init().
Referenced by app_main().
|
static |
References APP_BTN_EVENT_BTN1_LONG_PRESS, APP_BTN_EVENT_BTN1_SHORT_PRESS, APP_STATE_COMPLETE, APP_STATE_IDLE, APP_STATE_PROVISIONING, APP_STATE_WAITING_FOR_BUTTON_PRESS, APP_STATE_WAITING_FOR_PROFILE_SWITCH, APP_STATE_WAITING_FOR_WIFI_CONNECTION, APP_STATE_WAITING_FOR_WIFI_DISCONNECTION, APP_WIFI_PROV_DISPLAY_NAME, AT_BLE_AUTH_NO_MITM_NO_BOND, AT_BLE_SUCCESS, ble_prov_get_credentials(), ble_prov_get_provision_state(), ble_prov_init(), ble_prov_process_event(), ble_prov_start(), BLE_PROV_STATE_FAILED, BLE_PROV_STATE_SUCCESS, ble_prov_stop(), ble_prov_wifi_con_update, CREDENTIALS_VALID, DEFAULT_AUTH, DEFAULT_KEY, DEFAULT_SSID, gu8BtnEvent, gu8WiFiConnectionState, m2m_ble_event_get(), m2m_ble_init(), M2M_INFO, M2M_WIFI_CH_ALL, m2m_wifi_connect(), M2M_WIFI_CONNECTED, m2m_wifi_disconnect(), M2M_WIFI_DISCONNECTED, M2M_WIFI_UNDEF, credentials::passphrase, credentials::sec_type, credentials::ssid, credentials::ssid_length, WIFIPROV_CON_STATE_CONNECTED, WIFIPROV_CON_STATE_CONNECTING, and WIFIPROV_CON_STATE_DISCONNECTED.
Referenced by app_main().
References APP_BTN_EVENT_BTN1_LONG_PRESS, APP_BTN_EVENT_BTN1_SHORT_PRESS, APP_BTN_EVENT_BTN2_LONG_PRESS, APP_BTN_EVENT_BTN2_SHORT_PRESS, gu8BtnEvent, SW1, and SW2.
Referenced by app_main().
|
static |
References app_ble_proximity(), app_ble_wifi_provisioning(), app_button_press_callback(), app_wifi_handle_event(), app_wifi_init(), and nm_bsp_btn_init().
Referenced by main().
|
static |
References ble_prov_scan_result(), gu8ScanIndex, gu8WiFiConnectionState, M2M_ERR, M2M_INFO, M2M_WIFI_CONNECTED, M2M_WIFI_DISCONNECTED, m2m_wifi_get_num_ap_found(), M2M_WIFI_REQ_DHCP_CONF, m2m_wifi_req_scan_result(), M2M_WIFI_RESP_CON_STATE_CHANGED, M2M_WIFI_RESP_CURRENT_RSSI, M2M_WIFI_RESP_SCAN_DONE, M2M_WIFI_RESP_SCAN_RESULT, M2M_WIFI_RESP_SET_GAIN_TABLE, NM_BSP_TIME_MSEC, tstrM2MGainTableRsp::s8ErrorCode, tstrM2MIPConfig::u32StaticIP, tstrM2mWifiStateChanged::u8CurrState, and tstrM2mScanDone::u8NumofCh.
Referenced by app_main().
|
static |
References tstrEthInitParam::au8ethRcvBuf, HEX2ASCII, m2m_ble_wifi_init(), M2M_DEVICE_NAME, M2M_ERR, M2M_INFO, M2M_LISTEN_INTERVAL, m2m_memset(), M2M_NO_PS, m2m_periph_pullup_ctrl(), M2M_PERIPH_PULLUP_DIS_HOST_WAKEUP, M2M_PERIPH_PULLUP_DIS_SD_CMD_SPI_SCK, M2M_PERIPH_PULLUP_DIS_SD_DAT0_SPI_TXD, M2M_PS_DEEP_AUTOMATIC, M2M_PS_MANUAL, m2m_strlen(), M2M_SUCCESS, m2m_wifi_get_mac_address(), m2m_wifi_get_otp_mac_address(), m2m_wifi_set_device_name(), m2m_wifi_set_lsn_int(), m2m_wifi_set_mac_address(), m2m_wifi_set_sleep_mode(), MAC_ADDRESS, tstrEthInitParam::pfAppEthCb, tstrWifiInitParam::pfAppWifiCb, tstrWifiInitParam::strEthInitParam, system_reset(), tstrEthInitParam::u16ethRcvBufSize, and tstrM2mLsnInt::u16LsnInt.
Referenced by app_main().
|
static |
References led_clear().
Referenced by ble_pxp_profile_init().
|
static |
References led_clear(), led_flash(), LLS_HIGH_ALERT, LLS_MILD_ALERT, LLS_NO_ALERT, M2M_INFO, PXP_REPORTER_LL_INTERVAL_FAST, and PXP_REPORTER_LL_INTERVAL_MEDIUM.
Referenced by ble_pxp_profile_init().
|
static |
References IAS_HIGH_ALERT, IAS_MID_ALERT, IAS_NO_ALERT, led_clear(), led_flash(), M2M_INFO, PXP_REPORTER_PL_INTERVAL_FAST, and PXP_REPORTER_PL_INTERVAL_MEDIUM.
Referenced by ble_pxp_profile_init().
void ble_pxp_init | ( | void | ) |
References ble_device_init(), ble_pxp_profile_init(), and NULL.
Referenced by app_ble_proximity().
void ble_pxp_process_event | ( | at_ble_events_t | event, |
void * | params | ||
) |
References AT_BLE_UNDEFINED_EVENT, and ble_event_manager().
Referenced by app_ble_proximity().
|
static |
|
static |
References LED0_PIN, nm_bsp_stop_timer(), and port_pin_set_output_level().
Referenced by ble_pxp_handle_conn_update(), ble_pxp_handle_linkloss(), and ble_pxp_handle_pathloss().
|
static |
References led_toggle(), nm_bsp_start_timer(), and nm_bsp_stop_timer().
Referenced by ble_pxp_handle_linkloss(), and ble_pxp_handle_pathloss().
|
static |
References port_config::direction, LED0_PIN, port_get_config_defaults(), PORT_PIN_DIR_OUTPUT, port_pin_set_config(), and port_pin_set_output_level().
Referenced by main().
|
static |
References LED0_PIN, and port_pin_toggle_output_level().
Referenced by led_flash().
int main | ( | void | ) |
References app_main(), configure_console(), led_init(), nm_bsp_app_init(), nm_bsp_init(), STRING_HEADER, and system_init().
|
static |
Referenced by app_ble_wifi_provisioning(), and app_button_press_callback().
|
static |
Referenced by app_wifi_handle_event().
|
static |
Referenced by app_ble_wifi_provisioning(), and app_wifi_handle_event().