OS-IoT C API
ATIS OS-IoT BG96

Introduction

This library allows a lightweight IoT client on the Quectel BG96 cellular module 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 library supports JSON encoded oneM2M resources transported over HTTP(S). The library contains a communications interface (onem2m_http.h) and a set of functions for manipulating oneM2M resource models (onem2m_resource.h and onem2m_resource_models.h). The library is built using the QAPI HTTP API and generally follows the structure of that API. A slightly modified version of the Parson library (https://github.com/kgabis/parson) is used for support of JSON. Some datatypes from the QAPI and Parson are exposed to library users.

The following resource types are currently supported: CSE-Base, AE, Container and ContentInstance.

The library is developed for the BG96 running ThreadX version 3 RTOS to run locally on the module using the QAPI. It may be built using the CLANG/LLVM SDK. The SDK may be obtained from Quectel.

Library Usage

Incorporate the following .c and .h files in your application source: onem2m_http, onem2m_resource, onem2m_resource_models, parson

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

  1. Use onem2m_set_allocation_functions() to set the dynamic memory allocation functions used by the library. On the BG96 these should normally use a ThreadX BytePool resource.
  2. Start HTTP using onem2m_http_start()
  3. Start an HTTP session using onem2m_http_sess_start()
  4. Configure the from value using onem2m_set_from()
  5. Start an HTTP connection using onem2m_http_connect()
  6. For CREATE and UPDATE operations create a oneM2M resource object of the appropriate type and populate with the data
  7. Perform oneM2M operations using onem2m_http_retrieve(), onem2m_http_create(), and onem2m_http_update()
  8. Use the callback function provided to process the results of the operation
  9. Once the callback has been processed release the HTTP connection
  10. HTTP sessions can be kept open for reuse or closed

Limitations:

  1. Only one oneM2M operation may be in process at a time. Similarly, only one HTTP session and HTTP connection is supported.
  2. Due to limitations on the QAPI the DELETE operation is not supported.
  3. Due to limitations on the QAPI a RETRIEVE operation cannot be performed in a session after a CREATE or UPDATE operation. The old session and connection must be cleared if you wish to do a RETRIEVE after an CREATE or UPDATE.