Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sol-lwm2m-client.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #pragma once
19 
20 #include "sol-lwm2m.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
46 struct sol_lwm2m_client;
48 
63 };
64 
82 typedef struct sol_lwm2m_object {
83 #ifndef SOL_NO_API_VERSION
84 #define SOL_LWM2M_OBJECT_API_VERSION (1)
85 
86  uint16_t api_version;
87 #endif
88 
90  uint16_t id;
91 
92  /* @brief The number of resources that the object has */
93  uint16_t resources_count;
94 
106  int (*create)(void *user_data, struct sol_lwm2m_client *client,
107  uint16_t instance_id, void **instance_data, struct sol_lwm2m_payload payload);
129  int (*read)(void *instance_data, void *user_data,
130  struct sol_lwm2m_client *client, uint16_t instance_id,
131  uint16_t res_id, struct sol_lwm2m_resource *res);
150  int (*write_resource)(void *instance_data, void *user_data,
151  struct sol_lwm2m_client *client, uint16_t instance_id, uint16_t res_id,
152  const struct sol_lwm2m_resource *res);
173  int (*write_tlv)(void *instance_data, void *user_data,
174  struct sol_lwm2m_client *client, uint16_t instance_id,
175  struct sol_vector *tlvs);
196  int (*execute)(void *instance_data, void *user_data,
197  struct sol_lwm2m_client *client, uint16_t instance_id,
198  uint16_t res_id, const struct sol_str_slice args);
199 
209  int (*del)(void *instance_data, void *user_data,
210  struct sol_lwm2m_client *client, uint16_t instance_id);
212 
231 struct sol_lwm2m_client *sol_lwm2m_client_new(const char *name,
232  const char *path, const char *sms, const struct sol_lwm2m_object **objects,
233  const void *data);
234 
244 void sol_lwm2m_client_del(struct sol_lwm2m_client *client);
245 
255  const struct sol_lwm2m_object *obj, const void *data);
256 
269 int sol_lwm2m_client_start(struct sol_lwm2m_client *client);
270 
285 int sol_lwm2m_client_stop(struct sol_lwm2m_client *client);
286 
297 
311 int sol_lwm2m_client_notify(struct sol_lwm2m_client *client, const char **paths);
312 
327  void (*sol_lwm2m_client_bootstrap_event_cb)(void *data,
328  struct sol_lwm2m_client *client,
329  enum sol_lwm2m_bootstrap_event event),
330  const void *data);
331 
342  void (*sol_lwm2m_client_bootstrap_event_cb)(void *data,
343  struct sol_lwm2m_client *client,
344  enum sol_lwm2m_bootstrap_event event),
345  const void *data);
346 
350 #ifdef __cplusplus
351 }
352 #endif
int sol_lwm2m_client_del_bootstrap_finish_monitor(struct sol_lwm2m_client *client, void(*sol_lwm2m_client_bootstrap_event_cb)(void *data, struct sol_lwm2m_client *client, enum sol_lwm2m_bootstrap_event event), const void *data)
Removes a bootstrap monitor from the client.
int(* execute)(void *instance_data, void *user_data, struct sol_lwm2m_client *client, uint16_t instance_id, uint16_t res_id, const struct sol_str_slice args)
Executes a resource.
Definition: sol-lwm2m-client.h:196
Indicates that an error occurred during the bootstrap process.
Definition: sol-lwm2m-client.h:62
uint16_t id
The object id.
Definition: sol-lwm2m-client.h:90
A LWM2M object implementation.
Definition: sol-lwm2m-client.h:82
int(* del)(void *instance_data, void *user_data, struct sol_lwm2m_client *client, uint16_t instance_id)
Deletes an object instance.
Definition: sol-lwm2m-client.h:209
int sol_lwm2m_client_stop(struct sol_lwm2m_client *client)
Stops the LWM2M client.
int sol_lwm2m_client_send_update(struct sol_lwm2m_client *client)
Sends an update message to the LWM2M servers.
Routines that handle the LWM2M protocol.
String slice type.
Definition: sol-str-slice.h:84
int sol_lwm2m_client_start(struct sol_lwm2m_client *client)
Starts the LWM2M client.
struct sol_lwm2m_client * sol_lwm2m_client_new(const char *name, const char *path, const char *sms, const struct sol_lwm2m_object **objects, const void *data)
Creates a new LWM2M client.
uint16_t api_version
API version.
Definition: sol-lwm2m-client.h:86
uint16_t resources_count
Definition: sol-lwm2m-client.h:93
A payload received from the network used to create a LWM2M object instance.
Definition: sol-lwm2m.h:495
int(* read)(void *instance_data, void *user_data, struct sol_lwm2m_client *client, uint16_t instance_id, uint16_t res_id, struct sol_lwm2m_resource *res)
Reads a resource.
Definition: sol-lwm2m-client.h:129
int(* create)(void *user_data, struct sol_lwm2m_client *client, uint16_t instance_id, void **instance_data, struct sol_lwm2m_payload payload)
Creates a new object instance.
Definition: sol-lwm2m-client.h:106
struct sol_lwm2m_object sol_lwm2m_object
A LWM2M object implementation.
Indicates that a server finished bootstrapping the client.
Definition: sol-lwm2m-client.h:58
int sol_lwm2m_client_add_bootstrap_finish_monitor(struct sol_lwm2m_client *client, void(*sol_lwm2m_client_bootstrap_event_cb)(void *data, struct sol_lwm2m_client *client, enum sol_lwm2m_bootstrap_event event), const void *data)
Adds a bootstrap monitor to the client.
struct sol_lwm2m_client sol_lwm2m_client
A handle to a LWM2M client.
Definition: sol-lwm2m-client.h:47
sol_lwm2m_bootstrap_event
Enum that express the bootstrapping lifecycle.
Definition: sol-lwm2m-client.h:54
int(* write_resource)(void *instance_data, void *user_data, struct sol_lwm2m_client *client, uint16_t instance_id, uint16_t res_id, const struct sol_lwm2m_resource *res)
Writes a resource.
Definition: sol-lwm2m-client.h:150
Soletta vector is an array that grows dynamically.
Definition: sol-vector.h:58
int sol_lwm2m_client_add_object_instance(struct sol_lwm2m_client *client, const struct sol_lwm2m_object *obj, const void *data)
Creates an object instance.
void sol_lwm2m_client_del(struct sol_lwm2m_client *client)
Deletes a LWM2M client.
union sol_lwm2m_payload::sol_lwm2m_payload_data payload
The payload data.
int sol_lwm2m_client_notify(struct sol_lwm2m_client *client, const char **paths)
Notifies all the observing LWM2M servers that a resource has changed.
int(* write_tlv)(void *instance_data, void *user_data, struct sol_lwm2m_client *client, uint16_t instance_id, struct sol_vector *tlvs)
Writes a resource(s).
Definition: sol-lwm2m-client.h:173
Struct that represents a LWM2M resource.
Definition: sol-lwm2m.h:355