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 "led.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, 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, and AppCmdPendingTableEntry_t::ready.
Referenced by appDataInd().
|
static |
|
static |
References APP_CMD_PENDING_TABLE_SIZE, appCmdDataRequest(), appCmdInProgress, and appCmdPendingTable.
Referenced by APP_CommandsPending(), appCmdBuffer(), and appCmdDataConf().
|
static |
References AppCmdPendingTableEntry_t::addr, APP_CMD_INVALID_ADDR, appCmdCheckPendingTable(), appCmdInProgress, 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, AppCmdHeader_t::id, SYS_Timer_t::interval, LED_IDENTIFY, LED_On, 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, LED_IDENTIFY, LED_Off, NWK_Unlock(), and SYS_TimerStop().
Referenced by APP_CommandsInit(), and appCmdHandle().
|
static |
References LED_IDENTIFY, and LED_Toggle.
Referenced by APP_CommandsInit(), and appCmdHandle().
|
static |
|
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().