![]() |
![]() |
TI-OpenThread
1.08.05.18
|
#include <openthread/config.h>
#include <openthread-core-config.h>
#include <assert.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <openthread/coap.h>
#include <openthread/link.h>
#include <openthread/platform/uart.h>
#include <openthread/thread.h>
#include <sched.h>
#include <pthread.h>
#include <mqueue.h>
#include <ti/drivers/GPIO.h>
#include "otsupport/otrtosapi.h"
#include "otsupport/otinstance.h"
#include "ti_drivers_config.h"
#include "images.h"
#include "shade.h"
#include "utils/code_utils.h"
#include "tiop_ui.h"
#include "disp_utils.h"
#include "otstack.h"
#include "task_config.h"
#include "tiop_config.h"
Macros | |
#define | ATTR_READ 0x01 |
#define | ATTR_REPORT 0x04 |
#define | ATTR_WRITE 0x02 |
#define | SHADE_PROC_QUEUE_MAX_MSG (10) |
Size of the message queue for Shade_procQueue More... | |
Functions | |
static void | coapHandleServer (void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo) |
Callback function registered with the Coap server. Processes the coap request from the clients. More... | |
void | otPlatUartReceived (const uint8_t *aBuf, uint16_t aBufLength) |
void | otPlatUartSendDone (void) |
static void | processEvent (Shade_evt_t event) |
Processes the events. More... | |
void | processKeyChangeCB (Button_Handle _buttonHandle, Button_EventMask _buttonEvents) |
Handles the key press events. More... | |
static void | processOtStackEvents (uint8_t event, void *aContext) |
Processes the OT stack events. More... | |
static otError | setupCoapServer (otInstance *aInstance, const attrDesc_t *attr) |
sets up the application coap server. More... | |
void | Shade_postEvt (Shade_evt_t event) |
Posts an event to the Shade task. More... | |
void * | Shade_task (void *arg0) |
void | Shade_taskCreate (void) |
Variables | |
static uint8_t | attrState [15] = SHADE_STATE_OPEN |
const attrDesc_t | coapAttr |
static otCoapResource | coapResource |
static Button_Handle | rightButtonHandle |
static bool | serverSetup |
static mqd_t | Shade_procQueueDesc |
const char | Shade_procQueueName [] = "sh_process" |
static char | stack [TASK_CONFIG_SHADE_TASK_STACK_SIZE] |
static char | statusBuf [MAX_STATUS_LINE_VALUE_LEN] |
#define ATTR_READ 0x01 |
Referenced by setupCoapServer().
#define ATTR_WRITE 0x02 |
Referenced by setupCoapServer().
#define ATTR_REPORT 0x04 |
#define SHADE_PROC_QUEUE_MAX_MSG (10) |
Size of the message queue for Shade_procQueue
There are 9/12 events that can be raised, it is unlikely that they will all be raised at the same time. Add one buffer queue element.
Referenced by Shade_task().
void* Shade_task | ( | void * | arg0 | ) |
Shade processing thread.
References attrState, CUI_COLOR_CYAN, CUI_COLOR_RESET, CUI_COLOR_WHITE, DISPUTILS_LCDPRINTF, DispUtils_open(), DISPUTILS_SERIALPRINTF, extAddress, OtInstance_get(), OtRtosApi_lock(), OtRtosApi_unlock(), OtStack_registerCallback(), OtStack_setupInterfaceAndNetwork(), OtStack_taskCreate(), processEvent(), processOtStackEvents(), rightButtonHandle, SHADE_PROC_QUEUE_MAX_MSG, Shade_procQueueDesc, Shade_procQueueName, statusBuf, and tiopCUIInit().
Referenced by Shade_taskCreate().
|
static |
Callback function registered with the Coap server. Processes the coap request from the clients.
aContext | A pointer to the context information. |
aMessage | A pointer to the message. |
aMessageInfo | A pointer to the message info. |
References attrState, Shade_evtClosed, Shade_evtDrawn, Shade_evtOpen, Shade_postEvt(), SHADE_STATE_CLOSED, SHADE_STATE_DRAWN, and SHADE_STATE_OPEN.
Referenced by setupCoapServer().
|
static |
sets up the application coap server.
aInstance | A pointer to the context information. |
attr | Attribute data |
References ATTR_READ, ATTR_WRITE, coapHandleServer(), coapResource, OtRtosApi_lock(), and OtRtosApi_unlock().
Referenced by processEvent().
void processKeyChangeCB | ( | Button_Handle | _buttonHandle, |
Button_EventMask | _buttonEvents | ||
) |
Handles the key press events.
Handles the key pressed events for examples.
_buttonHandle | identifies which keys were pressed |
_buttonEvents | identifies the event that occurred on the key |
References rightButtonHandle, Shade_evtKeyRight, and Shade_postEvt().
|
static |
Processes the OT stack events.
event | event identifier |
aContext | context pointer for the event |
References OT_STACK_EVENT_DEV_ROLE_CHANGED, OT_STACK_EVENT_NWK_DATA_CHANGED, OT_STACK_EVENT_NWK_JOINED, OT_STACK_EVENT_NWK_JOINED_FAILURE, Shade_evtDevRoleChanged, Shade_evtNwkJoined, Shade_evtNwkJoinFailure, Shade_evtNwkSetup, and Shade_postEvt().
Referenced by Shade_task().
|
static |
Processes the events.
event | event to process in the switch |
References attrState, coapAttr, CUI_COLOR_CYAN, CUI_COLOR_RESET, CUI_COLOR_WHITE, CUI_conn_join_fail, CUI_conn_joined, CUI_conn_joining, CUI_processMenuUpdate(), DispUtils_lcdDraw(), DISPUTILS_LCDPRINTF, DISPUTILS_SERIALPRINTF, Images_shadeClosed, Images_shadeDrawn, Images_shadeOpen, OT_STACK_EVENT_NWK_JOIN_IN_PROGRESS, OtInstance_get(), OtRtosApi_lock(), OtRtosApi_unlock(), OtStack_joinConfiguredNetwork(), OtStack_joinState(), OtStack_setupInterfaceAndNetwork(), OtStack_setupNetwork(), serverSetup, setupCoapServer(), Shade_evtClosed, Shade_evtDevRoleChanged, Shade_evtDrawn, Shade_evtKeyLeft, Shade_evtKeyRight, Shade_evtNwkJoined, Shade_evtNwkJoinFailure, Shade_evtNwkSetup, Shade_evtOpen, statusBuf, tiopCUIUpdateApp(), tiopCUIUpdateChannel(), tiopCUIUpdateConnStatus(), tiopCUIUpdateExtPANID(), tiopCUIUpdateMasterkey(), tiopCUIUpdateNwkName(), tiopCUIUpdatePANID(), tiopCUIUpdateRole(), and tiopCUIUpdateShortAddr().
Referenced by Shade_task().
void otPlatUartReceived | ( | const uint8_t * | aBuf, |
uint16_t | aBufLength | ||
) |
Documented in openthread/platform/uart.h.
void otPlatUartSendDone | ( | void | ) |
Documented in openthread/platform/uart.h.
void Shade_postEvt | ( | Shade_evt_t | event | ) |
Posts an event to the Shade task.
event | event to post. |
References attrState, CUI_ITEM_INTERCEPT_START, MAX_MENU_LINE_LEN, OtInstance_get(), OtRtosApi_lock(), OtRtosApi_unlock(), processMenuUpdateFn(), Shade_evtClosed, Shade_evtDrawn, Shade_evtOpen, Shade_procQueueDesc, SHADE_STATE_CLOSED, SHADE_STATE_DRAWN, SHADE_STATE_OPEN, shade_toggleClose(), shade_toggleDraw(), shade_toggleOpen(), tiopCUINwkReset(), tiopCUIReset(), uiActionAttach(), and uiActionJoin().
Referenced by coapHandleServer(), processKeyChangeCB(), and processOtStackEvents().
void Shade_taskCreate | ( | void | ) |
Documented in task_config.h.
References Shade_task(), stack, TASK_CONFIG_SHADE_TASK_PRIORITY, and TASK_CONFIG_SHADE_TASK_STACK_SIZE.
const char Shade_procQueueName[] = "sh_process" |
Referenced by Shade_task().
|
static |
Referenced by Shade_postEvt(), and Shade_task().
|
static |
Referenced by Shade_taskCreate().
|
static |
Referenced by setupCoapServer().
|
static |
Referenced by coapHandleServer(), processEvent(), Shade_postEvt(), and Shade_task().
const attrDesc_t coapAttr |
Referenced by processEvent().
|
static |
Referenced by processKeyChangeCB(), and Shade_task().
|
static |
Referenced by processEvent().
|
static |
Referenced by processEvent(), and Shade_task().