TizenRT Public API  v2.0 M2
dm_lwm2m.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 
31 #ifndef _DMAPI_H
32 #define _DMAPI_H
33 
34 #include <tinyara/config.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39 
40 #ifdef CONFIG_LWM2M_WAKAAMA
41 #include <protocols/liblwm2m.h>
42 #include "er-coap-13/er-coap-13.h"
43 #else
44 #include <stdbool.h>
45 #endif
46 
47 #define IPADDRLEN_MAX 32
48 #define PORTLEN 6
49 
57 typedef enum {
58  DM_LWM2M_CLIENT_STARTED, DM_LWM2M_CLIENT_STOPPED,
60 
64 struct server_info_s {
65  char ipAddress[IPADDRLEN_MAX];
66  char port[PORTLEN];
67  bool isBootstrap;
68 };
69 
73 struct client_info_s {
74  int lifetime;
75 };
76 
81  struct server_info_s server_info;
82  struct client_info_s client_info;
83 };
84 
95 int dm_lwm2m_start_client(struct dm_lwm2m_context_s *dm_context);
96 
106 int dm_lwm2m_stop_client(void);
107 
117 int dm_lwm2m_get_server_address(char *server_ipAddr);
118 
128 int dm_lwm2m_get_server_port(char *server_port);
129 
139 int dm_lwm2m_get_client_lifetime(int *lifetime);
140 
150 int dm_lwm2m_get_client_state(dm_lwm2m_client_state_e *state);
151 
162 int dm_lwm2m_display_client_resource(char *buffer);
163 
164 #ifdef __cplusplus
165 }
166 #endif /* __cplusplus */
167 
168 #endif
169  // end of LWM2M group
int dm_lwm2m_get_server_port(char *server_port)
Get server port number.
int dm_lwm2m_start_client(struct dm_lwm2m_context_s *dm_context)
Start a DM client.
dm_lwm2m_client_state_e
Enumeration of dm client state.
Definition: dm_lwm2m.h:57
int dm_lwm2m_get_server_address(char *server_ipAddr)
Get server IP address.
Specify DM context structure for a LWM2M session.
Definition: dm_lwm2m.h:80
Specify LWM2M client information such as session lifetime.
Definition: dm_lwm2m.h:73
int dm_lwm2m_get_client_lifetime(int *lifetime)
Get lifetime for a client.
int dm_lwm2m_display_client_resource(char *buffer)
Get client resource value.
Specify LWM2M server information such as ipaddress and port.
Definition: dm_lwm2m.h:64
int dm_lwm2m_stop_client(void)
Close a DM client.
int dm_lwm2m_get_client_state(dm_lwm2m_client_state_e *state)
Get state of client.