TI-OpenThread  1.08.05.18
Macros | Functions | Variables
LP_CC2652RSIP/thread/shade/shade.c File Reference
#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"
+ Include dependency graph for LP_CC2652RSIP/thread/shade/shade.c:

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]
 

Macro Definition Documentation

§ ATTR_READ

#define ATTR_READ   0x01

Referenced by setupCoapServer().

§ ATTR_WRITE

#define ATTR_WRITE   0x02

Referenced by setupCoapServer().

§ ATTR_REPORT

#define ATTR_REPORT   0x04

§ SHADE_PROC_QUEUE_MAX_MSG

#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().

Function Documentation

§ Shade_task()

void* Shade_task ( void *  arg0)

§ coapHandleServer()

static void coapHandleServer ( void *  aContext,
otMessage *  aMessage,
const otMessageInfo *  aMessageInfo 
)
static

Callback function registered with the Coap server. Processes the coap request from the clients.

Parameters
aContextA pointer to the context information.
aMessageA pointer to the message.
aMessageInfoA pointer to the message info.
Returns
None

References attrState, Shade_evtClosed, Shade_evtDrawn, Shade_evtOpen, Shade_postEvt(), SHADE_STATE_CLOSED, SHADE_STATE_DRAWN, and SHADE_STATE_OPEN.

Referenced by setupCoapServer().

§ setupCoapServer()

static otError setupCoapServer ( otInstance *  aInstance,
const attrDesc_t *  attr 
)
static

sets up the application coap server.

Parameters
aInstanceA pointer to the context information.
attrAttribute data
Returns
OT_ERROR_NONE if successful, else error code

References ATTR_READ, ATTR_WRITE, coapHandleServer(), coapResource, OtRtosApi_lock(), and OtRtosApi_unlock().

Referenced by processEvent().

§ processKeyChangeCB()

void processKeyChangeCB ( Button_Handle  _buttonHandle,
Button_EventMask  _buttonEvents 
)

Handles the key press events.

Handles the key pressed events for examples.

Parameters
_buttonHandleidentifies which keys were pressed
_buttonEventsidentifies the event that occurred on the key
Returns
None

References rightButtonHandle, Shade_evtKeyRight, and Shade_postEvt().

§ processOtStackEvents()

static void processOtStackEvents ( uint8_t  event,
void *  aContext 
)
static

Processes the OT stack events.

Parameters
eventevent identifier
aContextcontext pointer for the event
Returns
None

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().

§ processEvent()

static void processEvent ( Shade_evt_t  event)
static

§ otPlatUartReceived()

void otPlatUartReceived ( const uint8_t *  aBuf,
uint16_t  aBufLength 
)

Documented in openthread/platform/uart.h.

§ otPlatUartSendDone()

void otPlatUartSendDone ( void  )

Documented in openthread/platform/uart.h.

§ Shade_postEvt()

void Shade_postEvt ( Shade_evt_t  event)

§ Shade_taskCreate()

void Shade_taskCreate ( void  )

Variable Documentation

§ Shade_procQueueName

const char Shade_procQueueName[] = "sh_process"

Referenced by Shade_task().

§ Shade_procQueueDesc

mqd_t Shade_procQueueDesc
static

Referenced by Shade_postEvt(), and Shade_task().

§ stack

Referenced by Shade_taskCreate().

§ coapResource

otCoapResource coapResource
static

Referenced by setupCoapServer().

§ attrState

uint8_t attrState[15] = SHADE_STATE_OPEN
static

§ coapAttr

const attrDesc_t coapAttr
Initial value:
= {
}
#define ATTR_WRITE
Definition: LP_CC2652RSIP/thread/shade/shade.c:108
static uint8_t attrState[15]
Definition: LP_CC2652RSIP/thread/shade/shade.c:153
#define SHADE_STATE_URI
Definition: CC1352P_2_LAUNCHXL/thread/shade/shade.h:61
#define ATTR_READ
Definition: LP_CC2652RSIP/thread/shade/shade.c:106

Referenced by processEvent().

§ rightButtonHandle

Button_Handle rightButtonHandle
static

Referenced by processKeyChangeCB(), and Shade_task().

§ serverSetup

bool serverSetup
static

Referenced by processEvent().

§ statusBuf

char statusBuf[MAX_STATUS_LINE_VALUE_LEN]
static

Referenced by processEvent(), and Shade_task().

© Copyright 1995-2021, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale