monoZ docs
MZ_lwm2m_example1.c File Reference

This is an example of how to use a lwm2m notify in timer based Application thread. More...

#include "MZ_sys_cmsis_os2.h"
#include "MZ_lwm2m_example1.h"
#include "MZ_timer.h"
#include "MZ_print.h"
#include "MZ_error_handler.h"
#include "MZ_Lwm2m_public.h"
#include "MZ_type_converter.h"
#include "MZ_rtc.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define LW_START_AT_INIT   (0)
 Defines the AT Initialization
More...
 
#define LW_START_AT_THREAD   (1)
 Defines the AT thread. More...
 
#define LWM2M_EXAMPLE   LW_START_AT_THREAD
 
#define LWM2M_APP_STACK_SIZE   (128)
 Defines the App stack size. More...
 
#define LWM2M_TX_TIME   (pdMS_TO_TICKS(60000))
 Defines the Timer size in milliseconds. More...
 

Functions

static void lwm2m_timer_cb (TimerHandle_t xTimer)
 timer callback function for lwm2m app More...
 
static void lwm2m_app (void *arg)
 Create recursive timer create the timer and starts when main RTOS scheduler started and it will starts recursively for the defined duration. More...
 
mz_error_t lwm2m_app_init (void)
 Initiate LWM2M App. More...
 
void lwm2m_event_process (void *event)
 LWM2M user defined callback function. More...
 

Variables

static char sensor_data [11] = ""
 
static char sensor_in [5] = "0000"
 
static int copy_flag = 0
 
static mz_thread_t lwm2m_thread_id = NULL
 
static StaticTask_t lwm2m_cb_mem
 
static StackType_t lwm2m_stack [LWM2M_APP_STACK_SIZE]
 

Detailed Description

This is an example of how to use a lwm2m notify in timer based Application thread.

Date
Jun 10, 2021
Author
MZ_click

Definition in file MZ_lwm2m_example1.c.

Macro Definition Documentation

◆ LW_START_AT_INIT

#define LW_START_AT_INIT   (0)

Defines the AT Initialization

Definition at line 41 of file MZ_lwm2m_example1.c.

◆ LW_START_AT_THREAD

#define LW_START_AT_THREAD   (1)

Defines the AT thread.

Definition at line 42 of file MZ_lwm2m_example1.c.

◆ LWM2M_EXAMPLE

#define LWM2M_EXAMPLE   LW_START_AT_THREAD

Definition at line 51 of file MZ_lwm2m_example1.c.

◆ LWM2M_APP_STACK_SIZE

#define LWM2M_APP_STACK_SIZE   (128)

Defines the App stack size.

Definition at line 53 of file MZ_lwm2m_example1.c.

◆ LWM2M_TX_TIME

#define LWM2M_TX_TIME   (pdMS_TO_TICKS(60000))

Defines the Timer size in milliseconds.

Definition at line 54 of file MZ_lwm2m_example1.c.

Function Documentation

◆ lwm2m_timer_cb()

void lwm2m_timer_cb ( TimerHandle_t  xTimer)
static

timer callback function for lwm2m app

Parameters
xTimerTimerHandle_t

Definition at line 71 of file MZ_lwm2m_example1.c.

◆ lwm2m_app()

void lwm2m_app ( void *  arg)
static

Create recursive timer create the timer and starts when main RTOS scheduler started and it will starts recursively for the defined duration.

Parameters
argvoid

Definition at line 150 of file MZ_lwm2m_example1.c.

◆ lwm2m_app_init()

mz_error_t lwm2m_app_init ( void  )

Initiate LWM2M App.

Returns
MZ_OK/MZ_FAIL

Definition at line 192 of file MZ_lwm2m_example1.c.

◆ lwm2m_event_process()

void lwm2m_event_process ( void *  event)

LWM2M user defined callback function.

Process LWM2M Event.

  • START This Function will be called from MZ_callback.c mz_pro_default_callback(). User need to check the events interested based on specific application requirement. If no application requirement exist for specific event, then no action need to be taken by this function
    Note
    MonoZ_Lib will call the mz_pro_default_callback() API after processing all LWM2M server events. So the events received at this API are just to inform user application to perform any post processing tasks. MonoZ_Lib maintain server connection and Obj19 related data. The detailed event list refer MZ_Lwm2m_public.h
    Parameters
    eventvoid

Definition at line 272 of file MZ_lwm2m_example1.c.

Variable Documentation

◆ sensor_data

char sensor_data[11] = ""
static

Buffer to hold sensor data

Definition at line 56 of file MZ_lwm2m_example1.c.

◆ sensor_in

char sensor_in[5] = "0000"
static

Input Buffer for sensor data

Definition at line 57 of file MZ_lwm2m_example1.c.

◆ copy_flag

int copy_flag = 0
static

Definition at line 59 of file MZ_lwm2m_example1.c.

◆ lwm2m_thread_id

mz_thread_t lwm2m_thread_id = NULL
static

Definition at line 139 of file MZ_lwm2m_example1.c.

◆ lwm2m_cb_mem

StaticTask_t lwm2m_cb_mem
static

Definition at line 140 of file MZ_lwm2m_example1.c.

◆ lwm2m_stack

StackType_t lwm2m_stack[LWM2M_APP_STACK_SIZE]
static

Definition at line 141 of file MZ_lwm2m_example1.c.