LORAWAN Certification Application.
Copyright (c) 2019-2020 Microchip Technology Inc. and its subsidiaries.
#include "asf.h"
#include "lorawan.h"
#include "system_task_manager.h"
#include "enddevice_cert.h"
#include "enddevice_cpc.h"
#include "conf_certification.h"
#include "sio2host.h"
#include "sw_timer.h"
#include "pds_interface.h"
Macros | |
#define | MAX_NA_CHANNELS 72 |
#define | MAX_SUBBAND_CHANNELS 8 |
Functions | |
void | cert_app_init (void) |
Initialization the Demo application. More... | |
void | cert_app_timer_callback (uint8_t param) |
static void | cert_appdata_callback (void *appHandle, appCbParams_t *appdata) |
Callback function for the ending of Bidirectional communication of Application data. More... | |
static void | cert_enable_channels (void) |
static void | cert_enter_test_mode (void) |
static void | cert_handle_cert_rx_data (uint8_t *data, uint8_t dataLen) |
static void | cert_joindata_callback (StackRetStatus_t status) |
static bool | cert_select_band (void) |
StackRetStatus_t | cert_set_join_parameters (ActivationType_t activation_type) |
static StackRetStatus_t | cert_set_mac_parameters (void) |
static void | print_array (uint8_t *array, uint8_t length) |
static void | print_stack_status (StackRetStatus_t status) |
Variables | |
uint8_t | appKey [16] = CERT_APPLICATION_KEY |
static uint8_t | appsKey [16] = CERT_APPLICATION_SESSION_KEY |
static const char * | bandStrings [] |
static uint8_t | bandTable [] |
bool | bTxCnf = false |
uint32_t | certAppTimeout = CERT_APP_TIMEOUT |
uint8_t | certAppTimerId |
bool | clear_linkcheck = false |
bool | cnfTxInProgress = false |
IsmBand_t | current_band |
static uint32_t | devAddr = CERT_DEVICE_ADDRESS |
uint8_t | devEui [8] = CERT_DEVICE_EUI |
uint16_t | downlinkCtr = 0 |
uint8_t | joinEui [8] = CERT_APPLICATION_EUI |
LorawanSendReq_t | lorawanSendReq |
static uint8_t | nwksKey [16] = CERT_NETWORK_SESSION_KEY |
bool | pktRxd = false |
uint8_t | sendData [100] |
uint16_t | sendDataLen |
uint8_t | sendFport = CERT_APP_FPORT |
const char * | status_message [] |
uint8_t | testMode = OFF |
uint8_t | tx_cw_timer |
TransmissionType_t | txType = CERT_APP_TRANSMISSION_TYPE |
uint8_t | uplinkTestNoResp = 0 |
#define MAX_NA_CHANNELS 72 |
Referenced by cert_enable_channels().
#define MAX_SUBBAND_CHANNELS 8 |
Referenced by cert_enable_channels().
void cert_app_init | ( | void | ) |
Initialization the Demo application.
Function to Initialize the Demo application.
References CERT_APP_ACTIVATION_TYPE, cert_appdata_callback(), cert_joindata_callback(), cert_select_band(), cert_set_join_parameters(), cert_set_mac_parameters(), certAppTimerId, LORAWAN_ABP, LORAWAN_Init(), LORAWAN_Join(), LORAWAN_OTAA, LORAWAN_SUCCESS, PDS_RestoreAll(), print_stack_status(), SwTimerCreate(), and tx_cw_timer.
Referenced by runCertApp().
void cert_app_timer_callback | ( | uint8_t | param | ) |
References bTxCnf, _LorawanSendReq::buffer, _LorawanSendReq::bufferLength, CERT_APP_FPORT, cert_app_timer_callback(), certAppTimeout, certAppTimerId, clear_linkcheck, cnfTxInProgress, _LorawanSendReq::confirmed, CURRENT_DATARATE, LINK_CHECK_PERIOD, LORAWAN_GetAttr(), LORAWAN_Send(), LORAWAN_SetAttr(), LORAWAN_SUCCESS, MS_TO_US, NULL, pktRxd, _LorawanSendReq::port, print_array(), print_stack_status(), sendData, sendDataLen, sendFport, SW_TIMEOUT_RELATIVE, SwTimerStart(), and UPLINK_COUNTER.
Referenced by cert_app_timer_callback(), cert_joindata_callback(), and enddevice_cpc_execute_command().
|
static |
Callback function for the ending of Bidirectional communication of Application data.
References cert_handle_cert_rx_data(), cnfTxInProgress, DOWNLINK_COUNTER, downlinkCtr, _appCbParams::evt, i, LAST_CH_ID, LORAWAN_EVT_RX_DATA_AVAILABLE, LORAWAN_EVT_TRANSACTION_COMPLETE, LORAWAN_GetAttr(), LORAWAN_SUCCESS, NULL, _appCbParams::param, pktRxd, print_stack_status(), _appCbParams::rxData, sendData, sendDataLen, TEST_PORT_NB, _appCbParams::transCmpl, UPLINK_COUNTER, and uplinkTestNoResp.
Referenced by cert_app_init().
|
static |
References CH_PARAM_STATUS, _ChannelParameters::channelAttr, _ChannelParameters::channelId, LORAWAN_SetAttr(), MAX_NA_CHANNELS, MAX_SUBBAND_CHANNELS, _ChannelAttr::status, and SUBBAND.
Referenced by cert_select_band().
|
static |
References downlinkCtr, ON, sendData, sendDataLen, testMode, and uplinkTestNoResp.
Referenced by cert_handle_cert_rx_data().
|
static |
References ACTIVATE_MODE, bTxCnf, cert_enter_test_mode(), certAppTimerId, CNF_MODE, CRYPTO_MODE, DEACTIVATE_MODE, downlinkCtr, enddevice_cpc_execute_command(), enddevice_cpc_is_payload_valid(), i, LORAWAN_Join(), LORAWAN_OTAA, LORAWAN_SUCCESS, OFF, OTAA_TRIGGER_MODE, print_stack_status(), sendData, sendDataLen, SwTimerStop(), testMode, UNCNF_MODE, and uplinkTestNoResp.
Referenced by cert_appdata_callback().
|
static |
References cert_app_timer_callback(), certAppTimeout, certAppTimerId, DEV_ADDR, LORAWAN_GetAttr(), LORAWAN_Join(), LORAWAN_OTAA, LORAWAN_SUCCESS, MS_TO_US, NULL, print_stack_status(), SW_TIMEOUT_RELATIVE, and SwTimerStart().
Referenced by cert_app_init().
|
static |
References bandStrings, bandTable, cert_enable_channels(), current_band, i, ISM_AU915, ISM_NA915, LORAWAN_Reset(), and sio2host_getchar().
Referenced by cert_app_init().
StackRetStatus_t cert_set_join_parameters | ( | ActivationType_t | activation_type | ) |
References ACTIVATION_BY_PERSONALIZATION, APP_KEY, appKey, APPS_KEY, appsKey, bandTable, CRYPTODEVICE_ENABLED, current_band, CURRENT_DATARATE, DEV_ADDR, DEV_EUI, devAddr, devEui, DR0, DR2, ISM_JPN923, ISM_THAI923, JOIN_EUI, joinEui, LORAWAN_SetAttr(), LORAWAN_SUCCESS, NWKS_KEY, nwksKey, and print_array().
Referenced by cert_app_init().
|
static |
References ADR, LORAWAN_SetAttr(), LORAWAN_SUCCESS, TEST_MODE_ENABLE, and true.
Referenced by cert_app_init().
|
static |
|
static |
uint8_t appKey[16] = CERT_APPLICATION_KEY |
Referenced by cert_set_join_parameters(), and enddevice_cpc_fresh_join().
|
static |
Referenced by cert_set_join_parameters().
|
static |
Referenced by cert_select_band().
|
static |
Referenced by cert_app_timer_callback(), cert_handle_cert_rx_data(), and enddevice_cpc_execute_command().
uint32_t certAppTimeout = CERT_APP_TIMEOUT |
Referenced by cert_app_timer_callback(), cert_joindata_callback(), and enddevice_cpc_execute_command().
uint8_t certAppTimerId |
Referenced by cert_app_timer_callback().
Referenced by cert_app_timer_callback(), and cert_appdata_callback().
IsmBand_t current_band |
Referenced by cert_select_band(), cert_set_join_parameters(), and enddevice_cpc_fresh_join().
|
static |
Referenced by cert_set_join_parameters().
uint8_t devEui[8] = CERT_DEVICE_EUI |
Referenced by cert_set_join_parameters(), and enddevice_cpc_fresh_join().
uint16_t downlinkCtr = 0 |
uint8_t joinEui[8] = CERT_APPLICATION_EUI |
Referenced by cert_set_join_parameters(), and enddevice_cpc_fresh_join().
LorawanSendReq_t lorawanSendReq |
|
static |
Referenced by cert_set_join_parameters().
Referenced by cert_app_timer_callback(), and cert_appdata_callback().
void sendData |
uint16_t sendDataLen |
uint8_t sendFport = CERT_APP_FPORT |
Referenced by cert_app_timer_callback(), and enddevice_cpc_execute_command().
const char* status_message[] |
uint8_t testMode = OFF |
Referenced by cert_enter_test_mode(), and cert_handle_cert_rx_data().
uint8_t tx_cw_timer |
Referenced by cert_app_init(), and enddevice_cpc_execute_command().
uint8_t uplinkTestNoResp = 0 |
Referenced by cert_appdata_callback(), cert_enter_test_mode(), and cert_handle_cert_rx_data().