WSNDemo command handler implementation.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "nwk.h"
#include "sysTimer.h"
#include "commands.h"
#include "wsndemo.h"
#include "asf.h"
Data Structures | |
struct | AppCmdHeader_t |
struct | AppCmdIdentify_t |
struct | AppCmdPendingTableEntry_t |
struct | AppCmdUartHeader_t |
struct | AppCmdUartIdentify_t |
Macros | |
#define | APP_CMD_ENDPOINT 2 |
#define | APP_CMD_INVALID_ADDR 0xffff |
#define | APP_CMD_PENDING_TABLE_SIZE 5 |
#define | APP_CMD_UART_BUFFER_SIZE 16 |
Enumerations | |
enum | AppCmdUartState_t { APP_CMD_UART_STATE_IDLE, APP_CMD_UART_STATE_SYNC, APP_CMD_UART_STATE_DATA, APP_CMD_UART_STATE_MARK, APP_CMD_UART_STATE_CSUM } |
Functions | |
void | APP_CommandsByteReceived (uint8_t byte) |
void | APP_CommandsInit (void) |
bool | APP_CommandsPending (uint16_t addr) |
static void | appCmdBuffer (uint16_t addr, uint8_t *data, uint8_t size) |
static void | appCmdCheckPendingTable (void) |
static void | appCmdDataConf (NWK_DataReq_t *req) |
static bool | appCmdDataInd (NWK_DataInd_t *ind) |
static void | appCmdDataRequest (AppCmdPendingTableEntry_t *entry) |
static bool | appCmdHandle (uint8_t *data, uint8_t size) |
static void | appCmdIdentifyDurationTimerHandler (SYS_Timer_t *timer) |
static void | appCmdIdentifyPeriodTimerHandler (SYS_Timer_t *timer) |
static void | appCmdUartProcess (uint8_t *data, uint8_t size) |
Variables | |
static NWK_DataReq_t | appCmdDataReq |
static SYS_Timer_t | appCmdIdentifyDurationTimer |
static SYS_Timer_t | appCmdIdentifyPeriodTimer |
static AppCmdPendingTableEntry_t * | appCmdInProgress |
static AppCmdPendingTableEntry_t | appCmdPendingTable [APP_CMD_PENDING_TABLE_SIZE] |
static uint8_t | appCmdUartBuf [APP_CMD_UART_BUFFER_SIZE] |
static uint8_t | appCmdUartCsum |
static uint8_t | appCmdUartPtr |
static AppCmdUartState_t | appCmdUartState = APP_CMD_UART_STATE_IDLE |
#define APP_CMD_ENDPOINT 2 |
Referenced by APP_CommandsInit().
#define APP_CMD_INVALID_ADDR 0xffff |
Referenced by APP_CommandsInit(), appCmdBuffer(), and appCmdDataConf().
#define APP_CMD_PENDING_TABLE_SIZE 5 |
Referenced by APP_CommandsInit(), APP_CommandsPending(), appCmdBuffer(), and appCmdCheckPendingTable().
#define APP_CMD_UART_BUFFER_SIZE 16 |
Referenced by APP_CommandsByteReceived().
enum AppCmdUartState_t |
void APP_CommandsByteReceived | ( | uint8_t | byte | ) |
void APP_CommandsInit | ( | void | ) |
References AppCmdPendingTableEntry_t::addr, APP_CMD_ENDPOINT, APP_CMD_INVALID_ADDR, APP_CMD_PENDING_TABLE_SIZE, appCmdDataConf(), appCmdDataInd(), appCmdIdentifyDurationTimerHandler(), appCmdIdentifyPeriodTimerHandler(), appCmdPendingTable, i, NULL, NWK_OpenEndpoint(), NWK_OPT_ENABLE_SECURITY, AppCmdPendingTableEntry_t::ready, SYS_TIMER_INTERVAL_MODE, and SYS_TIMER_PERIODIC_MODE.
Referenced by appInit().
bool APP_CommandsPending | ( | uint16_t | addr | ) |
References APP_CMD_PENDING_TABLE_SIZE, appCmdCheckPendingTable(), appCmdPendingTable, i, and AppCmdPendingTableEntry_t::ready.
Referenced by appDataInd().
|
static |
References AppCmdPendingTableEntry_t::addr, addr, APP_ADDR, APP_CMD_INVALID_ADDR, APP_CMD_PENDING_TABLE_SIZE, appCmdCheckPendingTable(), appCmdHandle(), appCmdPendingTable, i, NWK_ROUTE_NON_ROUTING, AppCmdPendingTableEntry_t::ready, and AppCmdPendingTableEntry_t::size.
Referenced by appCmdUartProcess().
|
static |
References APP_CMD_PENDING_TABLE_SIZE, appCmdDataRequest(), appCmdInProgress, appCmdPendingTable, and i.
Referenced by APP_CommandsPending(), appCmdBuffer(), and appCmdDataConf().
|
static |
References AppCmdPendingTableEntry_t::addr, APP_CMD_INVALID_ADDR, appCmdCheckPendingTable(), appCmdInProgress, NULL, and AppCmdPendingTableEntry_t::ready.
Referenced by APP_CommandsInit().
|
static |
References appCmdHandle(), NWK_DataInd_t::data, and NWK_DataInd_t::size.
Referenced by APP_CommandsInit().
|
static |
|
static |
References APP_COMMAND_ID_IDENTIFY, appCmdIdentifyDurationTimer, appCmdIdentifyDurationTimerHandler(), appCmdIdentifyPeriodTimer, appCmdIdentifyPeriodTimerHandler(), AppCmdIdentify_t::duration, SYS_Timer_t::handler, header, AppCmdHeader_t::id, SYS_Timer_t::interval, SYS_Timer_t::mode, NWK_Lock(), AppCmdIdentify_t::period, SYS_TIMER_INTERVAL_MODE, SYS_TIMER_PERIODIC_MODE, SYS_TimerStart(), and SYS_TimerStop().
Referenced by appCmdBuffer(), and appCmdDataInd().
|
static |
References appCmdIdentifyPeriodTimer, NWK_Unlock(), and SYS_TimerStop().
Referenced by APP_CommandsInit(), and appCmdHandle().
|
static |
Referenced by APP_CommandsInit(), and appCmdHandle().
|
static |
References APP_COMMAND_ID_IDENTIFY, appCmdBuffer(), AppCmdUartHeader_t::commandId, AppCmdUartHeader_t::dstAddr, AppCmdUartIdentify_t::duration, AppCmdIdentify_t::duration, header, AppCmdIdentify_t::id, AppCmdUartIdentify_t::period, and AppCmdIdentify_t::period.
Referenced by APP_CommandsByteReceived().
|
static |
Referenced by appCmdDataRequest().
|
static |
Referenced by appCmdHandle().
|
static |
Referenced by appCmdHandle(), and appCmdIdentifyDurationTimerHandler().
|
static |
Referenced by appCmdCheckPendingTable(), appCmdDataConf(), and appCmdDataRequest().
|
static |
Referenced by APP_CommandsInit(), APP_CommandsPending(), appCmdBuffer(), and appCmdCheckPendingTable().
|
static |
Referenced by APP_CommandsByteReceived().
|
static |
Referenced by APP_CommandsByteReceived().
|
static |
Referenced by APP_CommandsByteReceived().
|
static |
Referenced by APP_CommandsByteReceived().