Soletta™ Framework
|
Routines to create Clients talking the LWM2M protocol. More...
Data Structures | |
struct | sol_lwm2m_object |
A LWM2M object implementation. More... | |
Typedefs | |
typedef struct sol_lwm2m_client | sol_lwm2m_client |
A handle to a LWM2M client. More... | |
typedef struct sol_lwm2m_object | sol_lwm2m_object |
A LWM2M object implementation. More... | |
Enumerations | |
enum | sol_lwm2m_bootstrap_event { SOL_LWM2M_BOOTSTRAP_EVENT_FINISHED, SOL_LWM2M_BOOTSTRAP_EVENT_ERROR } |
Enum that express the bootstrapping lifecycle. More... | |
Functions | |
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. More... | |
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. More... | |
void | sol_lwm2m_client_del (struct sol_lwm2m_client *client) |
Deletes a LWM2M client. More... | |
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. More... | |
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. More... | |
int | sol_lwm2m_client_notify (struct sol_lwm2m_client *client, const char **paths) |
Notifies all the observing LWM2M servers that a resource has changed. More... | |
int | sol_lwm2m_client_send_update (struct sol_lwm2m_client *client) |
Sends an update message to the LWM2M servers. More... | |
int | sol_lwm2m_client_start (struct sol_lwm2m_client *client) |
Starts the LWM2M client. More... | |
int | sol_lwm2m_client_stop (struct sol_lwm2m_client *client) |
Stops the LWM2M client. More... | |
Routines to create Clients talking the LWM2M protocol.
A handle to a LWM2M client.
typedef struct sol_lwm2m_object sol_lwm2m_object |
A LWM2M object implementation.
Every LWM2M client must implement a set of LWM2M objects, This struct is used by the sol-lwm2m to know which objects a LWM2M Client implements.
All the functions in this struct will be called by the sol-lwm2m infra, when the LWM2M server request an operation. For example, when the LWM2M server requests the creation for a LWM2M location object, the create function will be called. When a LWM2M object does not support a certain operation, one must not implement the corresponding method. In order words, if a LWM2M object can't be deleted, the del
handle must be ponting to NULL
int sol_lwm2m_client_add_bootstrap_finish_monitor | ( | struct sol_lwm2m_client * | client, |
void(*)(void *data, struct sol_lwm2m_client *client, enum sol_lwm2m_bootstrap_event event) | sol_lwm2m_client_bootstrap_event_cb, | ||
const void * | data | ||
) |
Adds a bootstrap monitor to the client.
This function register a monitor. This means that every time a LWM2M bootstrap server performs a Bootstrap Finish sol_lwm2m_client_bootstrap_event_cb
will be called.
client | The LWM2M client. |
sol_lwm2m_client_bootstrap_event_cb | A callback that is used to inform a LWM2M bootstrap server event - data User data; client The LWM2M client; event The bootstrap event itself. |
data | The user data to sol_lwm2m_client_bootstrap_event_cb . |
Referenced by main().
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.
client | The client to create the object instance in. |
obj | The object that the instance should be created. |
data | The instance data. |
Referenced by main().
void sol_lwm2m_client_del | ( | struct sol_lwm2m_client * | client | ) |
Deletes a LWM2M client.
This will automatically stop the LWM2M client as well.
client | The client to be deleted. |
Referenced by main().
int sol_lwm2m_client_del_bootstrap_finish_monitor | ( | struct sol_lwm2m_client * | client, |
void(*)(void *data, struct sol_lwm2m_client *client, enum sol_lwm2m_bootstrap_event event) | sol_lwm2m_client_bootstrap_event_cb, | ||
const void * | data | ||
) |
Removes a bootstrap monitor from the client.
client | The LWM2M client. |
sol_lwm2m_client_bootstrap_event_cb | The previous registered callback. - data User data; client The LWM2M client; event The bootstrap event itself. |
data | The user data to sol_lwm2m_client_bootstrap_event_cb . |
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.
This function will create a new LWM2M client with its objects. In order to start the LWM2M client and connect with the LWM2M servers, one must call sol_lwm2m_client_start.
name | The LWM2M client name, must not be NULL . |
path | The Objects path, may be NULL . |
sms | The SMS number, may be NULL . |
objects | The implemented objects, must not be NULL and must be NULL terminated. |
data | The user's data that will be passed to the object callbacks. (create, execute, read, write and del). |
NULL
on error Referenced by main().
int sol_lwm2m_client_notify | ( | struct sol_lwm2m_client * | client, |
const char ** | paths | ||
) |
Notifies all the observing LWM2M servers that a resource has changed.
Use this function to notify the LWM2M servers that an Object instance resource value has changed.
client | The LWM2M client. |
paths | The resource paths that were changed, must be NULL terminated. |
Referenced by change_location().
int sol_lwm2m_client_send_update | ( | struct sol_lwm2m_client * | client | ) |
Sends an update message to the LWM2M servers.
This will trigger the update method of the LWM2M registration interface. The client will send an update to all the registered LWM2M servers.
client | The client to send the update request. |
Referenced by execute_server_obj().
int sol_lwm2m_client_start | ( | struct sol_lwm2m_client * | client | ) |
Starts the LWM2M client.
The LWM2M client will attempt to connect with all the registered LWM2M servers. The LWM2M client will look for the Security and Server LWM2M objects in order to connect with the LWM2M servers.
client | The client to be started. |
Referenced by bootstrap_cb(), and main().
int sol_lwm2m_client_stop | ( | struct sol_lwm2m_client * | client | ) |
Stops the LWM2M client.
This will make the LWM2M client to stop receiving/sending messages from/to the LWM2M servers. It's important to note that the objects and object instances will not be deleted.
In order to be able to respond to commands from a LWM2M server, one must call sol_lwm2m_client_start
client | The client to be stopped. |
Referenced by main().