Developer World
Spresense SDK Library v3.2.0-ebc0364
lte_lwm2m.h
Go to the documentation of this file.
1/****************************************************************************
2 * apps/include/lte/lte_lwm2m.h
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership. The
7 * ASF licenses this file to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance with the
9 * License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16 * License for the specific language governing permissions and limitations
17 * under the License.
18 *
19 ****************************************************************************/
20
21#ifndef __APPS_INCLUDE_LTE_LTE_LWM2M_H
22#define __APPS_INCLUDE_LTE_LTE_LWM2M_H
23
30/****************************************************************************
31 * Included Files
32 ****************************************************************************/
33
34#include <nuttx/config.h>
35#include <stdint.h>
37
71#define LWM2MSTUB_RESOURCE_HANDLENOCARE (0)
73#define LWM2MSTUB_RESOURCE_HANDLEHOST (1)
75#define LWM2MSTUB_RESOURCE_HANDLEMODEMH (2) /* end of group m2m_handlid */
86#define LWM2MSTUB_MAX_WRITE_SIZE (1500)
88#define LWM2MSTUB_MAX_TOKEN_SIZE (8 * 2 + 1)
90#define LWM2MSTUB_MAX_SERVER_NAME (256)
92#define LWM2MSTUB_MAX_DEVID (256)
94#define LWM2MSTUB_MAX_SEQKEY (256)
106#define LWM2MSTUB_CONDVALID_MINPERIOD (1<<0)
109#define LWM2MSTUB_CONDVALID_MAXPERIOD (1<<1)
112#define LWM2MSTUB_CONDVALID_GRATERTHAN (1<<2)
115#define LWM2MSTUB_CONDVALID_LESSTHAN (1<<3)
118#define LWM2MSTUB_CONDVALID_STEP (1<<4) /* end of group m2m_condvalid */
129#define LWM2MSTUB_FWUP_PEND_DL (0)
131#define LWM2MSTUB_FWUP_PEND_UPD (1)
133#define LWM2MSTUB_FWUP_COMP_DL (2)
135#define LWM2MSTUB_FWUP_FAIL_DL (3)
137#define LWM2MSTUB_FWUP_CANCELED (4) /* end of group m2m_fwupnote */
148#define LWM2MSTUB_CMD_REGISTER (0)
150#define LWM2MSTUB_CMD_DEREGISTER (1)
152#define LWM2MSTUB_CMD_UPDATERESIGER (2) /* end of group m2m_command */
163#define LWM2MSTUB_STATE_NOTREGISTERD (0)
165#define LWM2MSTUB_STATE_REGISTPENDING (1)
167#define LWM2MSTUB_STATE_REGISTERD (2)
169#define LWM2MSTUB_STATE_REGISTERFAILED (3)
171#define LWM2MSTUB_STATE_UPDATEPENDING (4)
173#define LWM2MSTUB_STATE_DEREGISTPENDING (5)
175#define LWM2MSTUB_STATE_BSHOLDOFF (6)
177#define LWM2MSTUB_STATE_BSREQUESTED (7)
179#define LWM2MSTUB_STATE_BSONGOING (8)
181#define LWM2MSTUB_STATE_BSDONE (9)
183#define LWM2MSTUB_STATE_BSFAILED (10) /* end of group m2m_serverstat */
194#define LWM2MSTUB_RESOP_READ (0)
196#define LWM2MSTUB_RESOP_WRITE (1)
198#define LWM2MSTUB_RESOP_RW (2)
200#define LWM2MSTUB_RESOP_EXEC (3) /* end of group m2m_resopmode */
211#define LWM2MSTUB_RESINST_SINGLE (0)
213#define LWM2MSTUB_RESINST_MULTI (1) /* end of group m2m_resinsttype */
224#define LWM2MSTUB_RESDATA_NONE (0)
226#define LWM2MSTUB_RESDATA_STRING (1)
228#define LWM2MSTUB_RESDATA_INT (2)
230#define LWM2MSTUB_RESDATA_UNSIGNED (3)
232#define LWM2MSTUB_RESDATA_FLOAT (4)
234#define LWM2MSTUB_RESDATA_BOOL (5)
236#define LWM2MSTUB_RESDATA_OPAQUE (6)
238#define LWM2MSTUB_RESDATA_TIME (7)
240#define LWM2MSTUB_RESDATA_OBJLINK (8) /* end of group m2m_resdatatype */
251#define LWM2MSTUB_SECUREMODE_PSK (0)
253#define LWM2MSTUB_SECUREMODE_RPK (1)
255#define LWM2MSTUB_SECUREMODE_CERT (2)
257#define LWM2MSTUB_SECUREMODE_NOSEC (3)
259#define LWM2MSTUB_SECUREMODE_CERTEST (4) /* end of group m2m_seqmode */
270#define LWM2MSTUB_CONNECT_REGISTER (0)
272#define LWM2MSTUB_CONNECT_DEREGISTER (1)
274#define LWM2MSTUB_CONNECT_REREGISTER (2)
276#define LWM2MSTUB_CONNECT_BOOTSTRAP (3) /* end of group m2m_regcmd */
287#define LWM2MSTUB_RESP_CHANGED (0)
289#define LWM2MSTUB_RESP_CONTENT (1)
291#define LWM2MSTUB_RESP_BADREQ (2)
293#define LWM2MSTUB_RESP_UNAUTH (3)
295#define LWM2MSTUB_RESP_NOURI (4)
297#define LWM2MSTUB_RESP_NOTALLOW (5)
299#define LWM2MSTUB_RESP_NOTACCEPT (6)
301#define LWM2MSTUB_RESP_UNSUPPORT (7)
303#define LWM2MSTUB_RESP_INTERNALERROR (8) /* end of group m2m_respcode */
314#define LWM2MSTUB_OP_WRITE (0)
316#define LWM2MSTUB_OP_EXEC (1)
318#define LWM2MSTUB_OP_WATTR (4)
320#define LWM2MSTUB_OP_DISCOVER (5)
322#define LWM2MSTUB_OP_READ (6)
324#define LWM2MSTUB_OP_OBSERVE (7)
326#define LWM2MSTUB_OP_CANCELOBS (8)
328#define LWM2MSTUB_OP_OFFLINE (9)
330#define LWM2MSTUB_OP_ONLINE (10)
332#define LWM2MSTUB_OP_SENDNOTICE (11)
334#define LWM2MSTUB_OP_RCVWUP (12)
336#define LWM2MSTUB_OP_RCVOBSACK (13)
340#define LWM2MSTUB_OP_CLIENTON (14)
342#define LWM2MSTUB_OP_CLIENTOFF (15)
344#define LWM2MSTUB_OP_FAILNOTIFY (16)
346#define LWM2MSTUB_OP_BSFINISH (20)
351#define LWM2MSTUB_OP_REGSUCCESS (21)
353#define LWM2MSTUB_OP_REGUPDATED (22)
355#define LWM2MSTUB_OP_DEREGSUCCESS (23)
357#define LWM2MSTUB_OP_NOSENDNOTICE (24) /* end of group m2m_serverop */
366{
367 int res_id;
371 int handl;
372};
373
379{
382 int res_id;
384};
385
391{
392 uint8_t valid_mask;
393 unsigned int min_period;
394 unsigned int max_period;
395 double gt_cond;
396 double lt_cond;
397 double step_val;
398};
399
405{
407 int state;
409 bool nonip;
411 uint32_t lifetime;
415};
416
435typedef void (*lwm2mstub_write_cb_t)(int seq_no, int srv_id,
436 FAR struct lwm2mstub_instance_s *inst, FAR char *value, int len);
437
447typedef void (*lwm2mstub_read_cb_t)(int seq_no, int srv_id,
448 FAR struct lwm2mstub_instance_s *inst);
449
459typedef void (*lwm2mstub_exec_cb_t)(int seq_no, int srv_id,
460 FAR struct lwm2mstub_instance_s *inst);
461
473typedef void (*lwm2mstub_ovstart_cb_t)(int seq_no, int srv_id,
474 FAR struct lwm2mstub_instance_s *inst, FAR char *token,
475 FAR struct lwm2mstub_ovcondition_s *cond);
476
487typedef void (*lwm2mstub_ovstop_cb_t)(int seq_no, int srv_id,
488 FAR struct lwm2mstub_instance_s *inst, FAR char *token);
489
499typedef void (*lwm2mstub_operation_cb_t)(int event, int srv_id,
500 FAR struct lwm2mstub_instance_s *inst);
501
509typedef void (*lwm2mstub_fwupstate_cb_t)(int event);
513#ifdef __cplusplus
514extern "C"
515{
516#endif
517
518/****************************************************************************
519 * Public Function Prototypes
520 ****************************************************************************/
521
522/* On powe on state */
523
541int lte_setm2m_endpointname(FAR char *name);
542
552int lte_getm2m_endpointname(FAR char *name, int len);
553
562
572int lte_setm2m_serverinfo(FAR struct lwm2mstub_serverinfo_s *info, int id);
573
583int lte_getm2m_serverinfo(FAR struct lwm2mstub_serverinfo_s *info, int id);
584
593
603int lte_getm2m_enabled_objects(FAR uint16_t *objids, int objnum);
604
614int lte_enablem2m_objects(FAR uint16_t *objids, int objnum);
615
624int lte_getm2m_objresourcenum(uint16_t objid);
625
636int lte_getm2m_objresourceinfo(uint16_t objids, int res_num,
637 FAR struct lwm2mstub_resource_s *reses);
638
649int lte_setm2m_objectdefinition(uint16_t objids, int res_num,
650 FAR struct lwm2mstub_resource_s *reses);
651
660
669int lte_setm2m_qmode(bool en);
670
682/* After attached */
683
703
713
723
733
743
753
763
773
787int lte_m2m_readresponse(int seq_no,
788 FAR struct lwm2mstub_instance_s *inst,
789 int resp, FAR char *readvalue, int len);
790
803 FAR struct lwm2mstub_instance_s *inst,
804 int resp);
805
817int lte_m2m_executeresp(int seq_no,
818 FAR struct lwm2mstub_instance_s *inst,
819 int resp);
820
831int lte_m2m_observeresp(int seq_no, int resp);
832
833<<<<<<< HEAD
845int lte_m2m_observeupdate(FAR char *token,
846 FAR struct lwm2mstub_instance_s *inst,
847 FAR char *value, int len);
851#ifdef __cplusplus
852}
853#endif
854 /* end of group lte_lwm2m */
856
857#endif /* __APPS_INCLUDE_LTE_LTE_LWM2M_H */
void(* lwm2mstub_read_cb_t)(int seq_no, int srv_id, FAR struct lwm2mstub_instance_s *inst)
Read request call back function type.
Definition: lte_lwm2m.h:447
void(* lwm2mstub_ovstart_cb_t)(int seq_no, int srv_id, FAR struct lwm2mstub_instance_s *inst, FAR char *token, FAR struct lwm2mstub_ovcondition_s *cond)
Observe start request call back function type.
Definition: lte_lwm2m.h:473
void(* lwm2mstub_ovstop_cb_t)(int seq_no, int srv_id, FAR struct lwm2mstub_instance_s *inst, FAR char *token)
Observation stop request call back function type.
Definition: lte_lwm2m.h:487
void(* lwm2mstub_write_cb_t)(int seq_no, int srv_id, FAR struct lwm2mstub_instance_s *inst, FAR char *value, int len)
Write request call back function type.
Definition: lte_lwm2m.h:435
void(* lwm2mstub_fwupstate_cb_t)(int event)
Firmware update call back function type.
Definition: lte_lwm2m.h:509
void(* lwm2mstub_operation_cb_t)(int event, int srv_id, FAR struct lwm2mstub_instance_s *inst)
Server operation call back function type.
Definition: lte_lwm2m.h:499
void(* lwm2mstub_exec_cb_t)(int seq_no, int srv_id, FAR struct lwm2mstub_instance_s *inst)
Execution request call back function type.
Definition: lte_lwm2m.h:459
double lt_cond
Definition: lte_lwm2m.h:396
int lte_set_report_m2moperation(lwm2mstub_operation_cb_t cb)
Register callback function pointer for server operation.
int lte_set_report_m2movstop(lwm2mstub_ovstop_cb_t cb)
Register callback function pointer for observation stop request.
double gt_cond
Definition: lte_lwm2m.h:395
int lte_set_report_m2mwrite(lwm2mstub_write_cb_t cb)
Register callback function pointer for write request.
unsigned int max_period
Definition: lte_lwm2m.h:394
int res_id
Definition: lte_lwm2m.h:367
int lte_set_report_m2mexec(lwm2mstub_exec_cb_t cb)
Register callback function pointer for execute request.
int lte_set_report_m2movstart(lwm2mstub_ovstart_cb_t cb)
Register callback function pointer for observation start request.
int res_inst
Definition: lte_lwm2m.h:383
int operation
Definition: lte_lwm2m.h:368
unsigned int min_period
Definition: lte_lwm2m.h:393
int object_id
Definition: lte_lwm2m.h:380
int data_type
Definition: lte_lwm2m.h:370
uint32_t lifetime
Definition: lte_lwm2m.h:411
int security_mode
Definition: lte_lwm2m.h:410
int lte_m2m_executeresp(int seq_no, FAR struct lwm2mstub_instance_s *inst, int resp)
Response result of execute request to the server.
double step_val
Definition: lte_lwm2m.h:397
bool bootstrap
Definition: lte_lwm2m.h:408
int lte_set_report_m2mread(lwm2mstub_read_cb_t cb)
Register callback function pointer for read request.
int state
Definition: lte_lwm2m.h:407
int lte_m2m_writeresponse(int seq_no, FAR struct lwm2mstub_instance_s *inst, int resp)
Response result of write request to the server.
bool nonip
Definition: lte_lwm2m.h:409
int lte_m2m_readresponse(int seq_no, FAR struct lwm2mstub_instance_s *inst, int resp, FAR char *readvalue, int len)
Response result of read request to the server.
char security_key[LWM2MSTUB_MAX_SEQKEY]
Definition: lte_lwm2m.h:414
int lte_m2m_connection(int cmd)
Control connection to server.
uint8_t valid_mask
Definition: lte_lwm2m.h:392
int inst_type
Definition: lte_lwm2m.h:369
int object_inst
Definition: lte_lwm2m.h:381
char server_uri[LWM2MSTUB_MAX_SERVER_NAME]
Definition: lte_lwm2m.h:412
int lte_set_report_m2mfwupdate(lwm2mstub_fwupstate_cb_t cb)
Register callback function pointer for firmware update status.
int handl
Definition: lte_lwm2m.h:371
char device_id[LWM2MSTUB_MAX_DEVID]
Definition: lte_lwm2m.h:413
int lte_m2m_observeresp(int seq_no, int resp)
Response result of observation start/stop request to the server.
int lte_getm2m_enabled_objectnum(void)
Get enabled objects number.
int lte_setm2m_objectdefinition(uint16_t objids, int res_num, FAR struct lwm2mstub_resource_s *reses)
Configure the resources of the object.
int lte_setm2m_qmode(bool en)
Set Queue mode of LwM2M.
int lte_setm2m_endpointname(FAR char *name)
Set endpoint name.
int lte_getm2m_servernum(void)
Get Server num.
int lte_getm2m_endpointname(FAR char *name, int len)
Get endpoint name.
bool lte_getm2m_qmode(void)
Get current Queue mode of LwM2M.
int lte_apply_m2msetting(void)
Activate all configurations.
int lte_enablem2m_objects(FAR uint16_t *objids, int objnum)
Enable objects.
int lte_getm2m_enabled_objects(FAR uint16_t *objids, int objnum)
Get object IDs of currently active objects.
int lte_getm2m_objresourceinfo(uint16_t objids, int res_num, FAR struct lwm2mstub_resource_s *reses)
Get the information of resources on the object.
int lte_setm2m_serverinfo(FAR struct lwm2mstub_serverinfo_s *info, int id)
Server configuration.
int lte_getm2m_serverinfo(FAR struct lwm2mstub_serverinfo_s *info, int id)
Get server configuration.
int lte_getm2m_objresourcenum(uint16_t objid)
Get resource number on the object.
#define LWM2MSTUB_MAX_DEVID
Max device id length in lwm2mstub_serverinfo_s.
Definition: lte_lwm2m.h:92
#define LWM2MSTUB_MAX_SERVER_NAME
Max server name length in lwm2mstub_serverinfo_s.
Definition: lte_lwm2m.h:90
#define LWM2MSTUB_MAX_SEQKEY
Max security key length in lwm2mstub_serverinfo_s.
Definition: lte_lwm2m.h:94
Definition: lte_lwm2m.h:379
Definition: lte_lwm2m.h:391
Definition: lte_lwm2m.h:366
Definition: lte_lwm2m.h:405