lwm2m_client.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef LWM2M_CLIENT_H
21 #define LWM2M_CLIENT_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <ctype.h>
28 #include <errno.h>
29 #include <signal.h>
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include <sys/types.h>
34 #include <unistd.h>
35 #include <sys/time.h>
36 
37 #include "periph/pm.h"
38 #include "net/sock/udp.h"
39 
40 #include "lwm2m_client_config.h"
41 #include "liblwm2m.h"
42 
46 typedef struct lwm2m_client_connection {
49  time_t last_send;
51 
55 typedef struct {
59  lwm2m_context_t *lwm2m_ctx;
60  lwm2m_object_t *obj_security;
63 
67 #define LWM2M_CLIENT_RCV_BUFFER_SIZE (200)
68 
73 #define LWM2M_CLIENT_REBOOT_TIME (5)
74 
81 #define LWM2M_CLIENT_MIN_REFRESH_TIME (1)
82 
92 lwm2m_context_t *lwm2m_client_run(lwm2m_client_data_t *client_data,
93  lwm2m_object_t *obj_list[],
94  uint16_t obj_numof);
95 
104 void lwm2m_client_init(lwm2m_client_data_t *client_data);
105 
113 static inline lwm2m_context_t *lwm2m_client_get_ctx(
114  lwm2m_client_data_t *client_data)
115 {
116  return client_data->lwm2m_ctx;
117 }
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* LWM2M_CLIENT_H */
124 
kernel_pid_t
int16_t kernel_pid_t
Unique process identifier.
Definition: sched.h:125
lwm2m_client_run
lwm2m_context_t * lwm2m_client_run(lwm2m_client_data_t *client_data, lwm2m_object_t *obj_list[], uint16_t obj_numof)
Starts a LwM2M client.
lwm2m_client_get_ctx
static lwm2m_context_t * lwm2m_client_get_ctx(lwm2m_client_data_t *client_data)
Returns the LwM2M context of a LwM2M client.
Definition: lwm2m_client.h:113
udp.h
UDP sock definitions.
lwm2m_client_config.h
LwM2M client configurations.
lwm2m_client_connection
Connection to server descriptor.
Definition: lwm2m_client.h:46
lwm2m_client_init
void lwm2m_client_init(lwm2m_client_data_t *client_data)
Initializes a LwM2M client.
lwm2m_client_data_t::conn_list
lwm2m_client_connection_t * conn_list
LwM2M connections list.
Definition: lwm2m_client.h:61
lwm2m_client_data_t::local_ep
sock_udp_ep_t local_ep
Local endpoint.
Definition: lwm2m_client.h:58
lwm2m_client_connection_t
struct lwm2m_client_connection lwm2m_client_connection_t
Connection to server descriptor.
lwm2m_client_data_t
LwM2M client descriptor.
Definition: lwm2m_client.h:55
sock_udp
UDP sock type.
Definition: sock_types.h:128
lwm2m_client_data_t::lwm2m_ctx
lwm2m_context_t * lwm2m_ctx
LwM2M context.
Definition: lwm2m_client.h:59
lwm2m_client_data_t::sock
sock_udp_t sock
UDP server sock.
Definition: lwm2m_client.h:57
lwm2m_client_data_t::obj_security
lwm2m_object_t * obj_security
LwM2M security object.
Definition: lwm2m_client.h:60
_sock_tl_ep
Common IP-based transport layer end point.
Definition: sock.h:213
lwm2m_client_connection::remote
sock_udp_ep_t remote
remote endpoint
Definition: lwm2m_client.h:48
pm.h
Power management interface.
lwm2m_client_connection::next
struct lwm2m_client_connection * next
pointer to the next connection
Definition: lwm2m_client.h:47
lwm2m_client_data_t::pid
kernel_pid_t pid
PID of the client thread.
Definition: lwm2m_client.h:56
lwm2m_client_connection::last_send
time_t last_send
last sent packet to the server
Definition: lwm2m_client.h:49
errno.h