This library allows an IoT client to interact with resources stored on a oneM2M Infrastructure Node (IN) or Mobile Node (MN) via the oneM2M protocol. For general information about OS-IoT refer to http://os-iot.org/. For a practical introduction to oneM2M concepts and procedures see the oneM2M Developers Guide http://onem2m.org/application-developer-guide/welcome.

Guide to the API Specification

This detailed API specification should be read in conjunction with the OS-IoT Manual which is available from the OS-IoT web site.

The public interface to the library is contained in the namespace onem2m.

Functions to support oneM2M network operations are documented in the onem2m functions.

The oneM2M resource object library is documented in the onem2m classes. Note in paricular the special handling for optional and sequence elements. For the semantics and structure of oneM2M resource objects refer to the oneM2M specifications. For information about the supported resource fields refer to the OS-IoT Manual.

Library Usage

To use the library, the application should follow the following steps:

  1. Initialize the library with onem2m::initialize()
  2. Update any values for pre-set parameters (e.g. the 'from' parameter) to those needed for the application using functions like onem2m::setHostName(), onem2m::setFrom() or onem2m::setProtocol().
  3. For CREATE and UPDATE operations create a oneM2M resource object of the appropriate type and populate with the data to be included in the resource. Example classes that represent oneM2M resource objects are onem2m::AE, onem2m::container, onem2m::contentInstance, onem2m::subscription and onem2m::accessControlPolicy.
  4. Call a high level function such as retrieveResource(), deleteResource(), createResource(), updateResource() to perform the desired operation on resources at the IN. These functions will generate signalling to the IN and return the result to the calling application. In this version of the library these are synchronous (blocking) functions.
  5. Repeat steps 2 and/or 3 and/or 4 as needed.
  6. Terminate the library with onem2m::terminate()

Refer to the file osiotcmd.cxx for an example command-line application that demonstrates this use of the API and also how to interact with oneM2M resource objects. A further example application and a guide to how to build your own applications are available on the OS-IoT web site.

Note that the function onem2m::send() is a low level routine and should only be used by advanced applications that need to interact with the oneM2M signalling at a finer level of granularity than is possible with the high level routines.