Mistake on this page? Email us
M2MInterface Class Referenceabstract

#include <m2minterface.h>

Public Types

enum  Error {
  ErrorNone = 0, AlreadyExists, BootstrapFailed, InvalidParameters,
  InvalidCertificates, NotRegistered, Timeout, NetworkError,
  ResponseParseFailed, UnknownError, MemoryFail, NotAllowed,
  SecureConnectionFailed, DnsResolvingFailed, UnregistrationFailed, ESTEnrollmentFailed,
  FailedToStoreCredentials, FailedToReadCredentials
}
 An enum defining different kinds of errors that can occur during various client operations.
 
enum  BindingMode {
  NOT_SET = 0, UDP = 0x01, UDP_QUEUE = 0x03, SMS = 0x04,
  SMS_QUEUE = 0x06, UDP_SMS_QUEUE = 0x07, TCP = 0x09, TCP_QUEUE = 0x0b
}
 An enum defining different kinds of binding modes handled for client operations.
 
enum  NetworkStack {
  Uninitialized = 0, LwIP_IPv4, LwIP_IPv6, Reserved,
  Nanostack_IPv6, ATWINC_IPv4, Unknown
}
 An enum defining different kinds of network stacks that can be used by mbed Client.
 

Public Member Functions

virtual void bootstrap (M2MSecurity *security_object)=0
 Initiates bootstrapping of the client with the provided Bootstrap Server information. NOTE: This API is not supported for developers!! More...
 
virtual void cancel_bootstrap ()=0
 Cancels an ongoing bootstrapping operation of the client. If the client has already successfully bootstrapped, this function deletes the existing bootstrap information from the client. NOTE: This API is not supported for developers!!
 
virtual void finish_bootstrap ()=0
 Finishes bootstrap in cases where client will be the one to finish it.
 
virtual void register_object (M2MSecurity *security_object, const M2MBaseList &list, bool full_registration=false)=0
 Initiates the registration of a provided security object to the corresponding LWM2M server. More...
 
virtual void register_object (M2MSecurity *security_object, const M2MObjectList &object_list)=0
 Initiates the registration of a provided security object to the corresponding LWM2M server. More...
 
virtual bool remove_object (M2MBase *base)=0
 Removes an object from M2MInterface. Does not call delete on the object though. More...
 
virtual void update_registration (M2MSecurity *security_object, const uint32_t lifetime=0)=0
 Updates or refreshes the client's registration on the LWM2M server. More...
 
virtual void update_registration (M2MSecurity *security_object, const M2MBaseList &list, const uint32_t lifetime=0)=0
 Updates or refreshes the client's registration on the LWM2M server. Use this function to publish new objects to LWM2M server. More...
 
virtual void update_registration (M2MSecurity *security_object, const M2MObjectList &object_list, const uint32_t lifetime=0)=0
 Updates or refreshes the client's registration on the LWM2M server. Use this function to publish new objects to LWM2M server. More...
 
virtual void unregister_object (M2MSecurity *security_object=NULL)=0
 Unregisters the registered object from the LWM2M server. More...
 
virtual void set_queue_sleep_handler (callback_handler handler)=0
 Sets the function that is called for indicating that the client is going to sleep when the binding mode is selected with queue mode. More...
 
virtual void set_random_number_callback (random_number_cb callback)=0
 Sets the function callback that is called by mbed Client to fetch a random number from an application to ensure strong entropy. More...
 
virtual void set_entropy_callback (entropy_cb callback)=0
 Sets the function callback that is called by mbed Client to provide an entropy source from an application to ensure strong entropy. More...
 
virtual void set_platform_network_handler (void *handler=NULL)=0
 Sets the network interface handler that is used by mbed Client to connect to a network over IP. More...
 
virtual void set_platform_network_handler (void *handler=NULL, bool credentials_available=0)=0
 Sets the network interface handler that is used by client to connect to a network over IP. More...
 
virtual void update_endpoint (const String &name)=0
 Updates the endpoint name. More...
 
virtual void update_domain (const String &domain)=0
 Updates the domain name. More...
 
virtual const String internal_endpoint_name () const =0
 Return internal endpoint name. More...
 
virtual const char * error_description () const =0
 Return error description for the latest error code. More...
 
virtual void get_data_request (DownloadType type, const char *uri, const size_t offset, const bool async, get_data_cb, get_data_error_cb, void *context)=0
 Sends the CoAP GET request to the server. Download type. Uri path to the data. Data offset. In async mode application must call this API again with the updated offset. If set to false then client will automatically download the whole package. Callback which is triggered once there is data available. Callback which is trigged in case of any error.
 
virtual void post_data_request (const char *uri, const bool async, const uint16_t payload_len, uint8_t *payload_ptr, get_data_cb data_cb, get_data_error_cb error_cb, void *context)=0
 Sends the CoAP POST request to the server. Uri path to the data. In async mode application must call this API again with the updated offset. If set to false then client will automatically download the whole package. Length of payload. , Pointer to payload buffer. Callback which is triggered once there is data available. Callback which is trigged in case of any error.
 
virtual bool set_uri_query_parameters (const char *uri_query_params)=0
 Set custom uri query paramaters used in LWM2M registration. Uri query params. Parameters must be in key-value format: "a=100&b=200". Maximum length can be up to 64 bytes. More...
 
virtual void pause ()=0
 Pauses client's timed functionality and closes network connection to the Cloud. After successful call the operation is continued by calling register_object(). More...
 
virtual void alert ()=0
 Sets client into an alert mode. More...
 
virtual nsdl_s * get_nsdl_handle () const =0
 Get ndsl handle. More...
 
virtual M2MServerget_m2mserver () const =0
 Returns M2MServer handle. More...
 
virtual uint16_t stagger_wait_time (bool boostrap) const =0
 
virtual void set_cid_value (const uint8_t *data_ptr, const size_t data_len)=0
 Internal test function. Set CID for current tls session. More...
 

Detailed Description

This class handles LwM2M Client logic related to communicating with all four interfaces defined in LwM2M.

LwM2M defines four interfaces:

  • Bootstrap
  • Client Registration
  • Device management and service enablement
  • Information Reporting

Member Function Documentation

virtual void M2MInterface::alert ( )
pure virtual

Sets client into an alert mode.

Note
In alert mode client halts all data sendings/active operations and waits for priority data to be sent.
virtual void M2MInterface::bootstrap ( M2MSecurity security_object)
pure virtual

Initiates bootstrapping of the client with the provided Bootstrap Server information. NOTE: This API is not supported for developers!!

Parameters
security_objectA security object that contains information required for successful bootstrapping of the client.
virtual const char* M2MInterface::error_description ( ) const
pure virtual

Return error description for the latest error code.

Returns
Error description string
virtual M2MServer* M2MInterface::get_m2mserver ( ) const
pure virtual

Returns M2MServer handle.

Returns
M2MServer handle
virtual nsdl_s* M2MInterface::get_nsdl_handle ( ) const
pure virtual

Get ndsl handle.

Returns
nsdl handle
virtual const String M2MInterface::internal_endpoint_name ( ) const
pure virtual

Return internal endpoint name.

Returns
internal endpoint name
virtual void M2MInterface::pause ( )
pure virtual

Pauses client's timed functionality and closes network connection to the Cloud. After successful call the operation is continued by calling register_object().

Note
This operation does not unregister client from the Cloud. Closes the socket and removes interface from the interface list.
virtual void M2MInterface::register_object ( M2MSecurity security_object,
const M2MBaseList &  list,
bool  full_registration = false 
)
pure virtual

Initiates the registration of a provided security object to the corresponding LWM2M server.

Parameters
security_objectThe security object that contains information required for registering to the LWM2M server. If the client wants to register to multiple LWM2M servers, it must call this function once for each of the LWM2M server objects separately.
object_listObjects that contain information about the client attempting to register to the LWM2M server.
full_registrationIf True client will perform full registration and not just register update.
virtual void M2MInterface::register_object ( M2MSecurity security_object,
const M2MObjectList &  object_list 
)
pure virtual

Initiates the registration of a provided security object to the corresponding LWM2M server.

Parameters
security_objectThe security object that contains information required for registering to the LWM2M server. If the client wants to register to multiple LWM2M servers, it must call this function once for each of the LWM2M server objects separately.
object_listObjects that contain information about the client attempting to register to the LWM2M server.
virtual bool M2MInterface::remove_object ( M2MBase base)
pure virtual

Removes an object from M2MInterface. Does not call delete on the object though.

Returns
true if the object was found and false if the object was not found.
virtual void M2MInterface::set_cid_value ( const uint8_t *  data_ptr,
const size_t  data_len 
)
pure virtual

Internal test function. Set CID for current tls session.

Parameters
data_ptrCID
data_lenlength of the CID
virtual void M2MInterface::set_entropy_callback ( entropy_cb  callback)
pure virtual

Sets the function callback that is called by mbed Client to provide an entropy source from an application to ensure strong entropy.

Parameters
entropy_callbackA function pointer that is called by mbed Client while performing a secure handshake. Function signature, if using mbed-client-mbedtls, should be int (*mbedtls_entropy_f_source_ptr)(void *data, unsigned char *output, size_t len, size_t *olen);
virtual void M2MInterface::set_platform_network_handler ( void *  handler = NULL)
pure virtual

Sets the network interface handler that is used by mbed Client to connect to a network over IP.

Parameters
handlerA network interface handler that is used by mbed Client to connect. This API is optional but it provides a mechanism for different platforms to manage the usage of underlying network interface by the client.
virtual void M2MInterface::set_platform_network_handler ( void *  handler = NULL,
bool  credentials_available = 0 
)
pure virtual

Sets the network interface handler that is used by client to connect to a network over IP.

Parameters
handlerA network interface handler that is used by client to connect. This API is optional but provides a mechanism for different platforms to manage usage of underlying network interface by client.
credentials_availableThis extra parameter allows the client to further optimize its internal connection logic in high latency networks when dynamic handling of network staggering is supported. (Platform-dependent).
virtual void M2MInterface::set_queue_sleep_handler ( callback_handler  handler)
pure virtual

Sets the function that is called for indicating that the client is going to sleep when the binding mode is selected with queue mode.

Parameters
callbackA function pointer that is called when the client goes to sleep.
virtual void M2MInterface::set_random_number_callback ( random_number_cb  callback)
pure virtual

Sets the function callback that is called by mbed Client to fetch a random number from an application to ensure strong entropy.

Parameters
random_callbackA function pointer that is called by mbed Client while performing a secure handshake. The function signature should be uint32_t (*random_number_callback)(void);
virtual bool M2MInterface::set_uri_query_parameters ( const char *  uri_query_params)
pure virtual

Set custom uri query paramaters used in LWM2M registration. Uri query params. Parameters must be in key-value format: "a=100&b=200". Maximum length can be up to 64 bytes.

Returns
False if maximum length exceeded otherwise True.
virtual void M2MInterface::unregister_object ( M2MSecurity security_object = NULL)
pure virtual

Unregisters the registered object from the LWM2M server.

Parameters
security_objectThe security object from which the device object needs to be unregistered. If there is only one LWM2M server registered, this parameter can be NULL.
virtual void M2MInterface::update_domain ( const String &  domain)
pure virtual

Updates the domain name.

Parameters
domainNew domain name
virtual void M2MInterface::update_endpoint ( const String &  name)
pure virtual

Updates the endpoint name.

Parameters
nameNew endpoint name
virtual void M2MInterface::update_registration ( M2MSecurity security_object,
const uint32_t  lifetime = 0 
)
pure virtual

Updates or refreshes the client's registration on the LWM2M server.

Parameters
security_objectA security object from which the device object needs to update the registration. If there is only one LWM2M server registered, this parameter can be NULL.
lifetimeThe lifetime of the endpoint client in seconds. If the same value has to be passed, set the default value to 0.
virtual void M2MInterface::update_registration ( M2MSecurity security_object,
const M2MBaseList &  list,
const uint32_t  lifetime = 0 
)
pure virtual

Updates or refreshes the client's registration on the LWM2M server. Use this function to publish new objects to LWM2M server.

Parameters
security_objectThe security object from which the device object needs to update the registration. If there is only one LWM2M server registered, this parameter can be NULL.
object_listObjects that contain information about the client attempting to register to the LWM2M server.
lifetimeThe lifetime of the endpoint client in seconds. If the same value has to be passed, set the default value to 0.
virtual void M2MInterface::update_registration ( M2MSecurity security_object,
const M2MObjectList &  object_list,
const uint32_t  lifetime = 0 
)
pure virtual

Updates or refreshes the client's registration on the LWM2M server. Use this function to publish new objects to LWM2M server.

Parameters
security_objectThe security object from which the device object needs to update the registration. If there is only one LWM2M server registered, this parameter can be NULL.
object_listObjects that contain information about the client attempting to register to the LWM2M server.
lifetimeThe lifetime of the endpoint client in seconds. If the same value has to be passed, set the default value to 0.

The documentation for this class was generated from the following file: