WSNDemo command handler implementation.
Copyright (c) 2018 - 2022 Microchip Technology Inc. and its subsidiaries.
#include <stdlib.h>
#include <string.h>
#include "asf.h"
#include "config.h"
#include "miwi_api.h"
#include "sysTimer.h"
#include "commands.h"
#include "wsndemo.h"
Data Structures | |
struct | AppCmdHeader_t |
struct | AppCmdIdentify_t |
struct | AppCmdUartHeader_t |
struct | AppCmdUartIdentify_t |
Macros | |
#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) |
static void | appCmdBuffer (uint16_t addr, uint8_t *data, uint8_t size) |
static void | appCmdDataConf (uint8_t msgConfHandle, miwi_status_t status, uint8_t *msgPointer) |
void | appCmdDataInd (RECEIVED_MESH_MESSAGE *ind) |
static void | appCmdDataRequest (uint16_t addr, uint8_t size, uint8_t *payload) |
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 | |
SYS_Timer_t | appCmdIdentifyDurationTimer |
SYS_Timer_t | appCmdIdentifyPeriodTimer |
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 |
uint8_t | wsnmsghandle |
#define APP_CMD_INVALID_ADDR 0xffff |
#define APP_CMD_PENDING_TABLE_SIZE 5 |
#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 appCmdIdentifyDurationTimerHandler(), appCmdIdentifyPeriodTimerHandler(), SYS_Timer_t::handler, SYS_Timer_t::mode, SYS_TIMER_INTERVAL_MODE, and SYS_TIMER_PERIODIC_MODE.
Referenced by appInit().
|
static |
References appCmdDataRequest(), and appCmdHandle().
Referenced by appCmdUartProcess().
|
static |
Referenced by appCmdDataRequest().
void appCmdDataInd | ( | RECEIVED_MESH_MESSAGE * | ind | ) |
References appCmdHandle(), RECEIVED_MESH_MESSAGE::payload, and RECEIVED_MESH_MESSAGE::payloadSize.
Referenced by appDataInd().
|
static |
References appCmdDataConf(), MiApp_SendData(), SHORT_ADDR_LEN, and wsnmsghandle.
Referenced by appCmdBuffer().
|
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, AppCmdIdentify_t::period, SYS_TIMER_INTERVAL_MODE, SYS_TIMER_PERIODIC_MODE, SYS_TimerStart(), and SYS_TimerStop().
Referenced by appCmdBuffer(), and appCmdDataInd().
|
static |
References appCmdIdentifyPeriodTimer, 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().
SYS_Timer_t appCmdIdentifyDurationTimer |
Referenced by APP_TaskHandler(), and appCmdHandle().
SYS_Timer_t appCmdIdentifyPeriodTimer |
Referenced by APP_TaskHandler(), appCmdHandle(), and appCmdIdentifyDurationTimerHandler().
|
static |
Referenced by APP_CommandsByteReceived().
|
static |
Referenced by APP_CommandsByteReceived().
|
static |
Referenced by APP_CommandsByteReceived().
|
static |
Referenced by APP_CommandsByteReceived().
uint8_t wsnmsghandle |
Referenced by appCmdDataRequest(), and appSendData().