A “Hello World” Application Using OS-IoT

The follow C++ code uses the OS-IoT API to get a CSE-Base resource from a CSE. This is about the simplest possible use of OS-IoT. You can link this program to the OS-IoT library following the build instructions.

// test.cxx

#include <iostream>
#include "onem2m.hxx"

int main (int argc, char* argv[]) {


// For Eclipse OM2M - modify for your CSE
 ::std::string cse_root_addr = "/in-cse/in-name"; // SP-Relative address

long result;
 ::xml_schema::integer respObjType;
 std::unique_ptr< ::xml_schema::type > respObj;

// *** Retrieve a resource ***
 respObj = ::onem2m::retrieveResource(cse_root_addr, "1234", result, respObjType);
 std::cout << "Retrieve result:" << result << "\n";
 std::cout << "Obj Type#:" << respObjType << "\n";



For more information on the API see the documentation page.