IoTivity-Lite
oc_introspection.h File Reference

functions for introspection More...

#include "oc_export.h"
#include "util/oc_compiler.h"
#include <inttypes.h>
#include <stddef.h>

Functions

void oc_set_introspection_data (size_t device, const uint8_t *IDD, size_t IDD_size)
 Set the IDD by passing in an array containing the data. More...
 
long oc_set_introspection_data_v1 (size_t device, const uint8_t *IDD, size_t IDD_size)
 Set the IDD by passing in an array containing the data. More...
 

Detailed Description

functions for introspection

The IDD information is served up as encoded CBOR content (read as is). If the size of the IDD data is to big for the buffer, then an internal error is returned. Note that some build options can only serve up introspection data for one device and can not be used if multiple devices are implemented.

There are multiple mechanisms for adding introspection data to a server.

Add OC_IDD_API (recommended) to the compilers preprocessor macro defines. Then set the introspection data for each device using oc_set_introspection_data function.

If OC_IDD_API was added to the preprocessor and the server does not call oc_set_introspection_data the server will look for the file IDD_<device_index> in the location specified by oc_storage_config.

The final option is to build without OC_IDD_API compiler preprocessor macro define. This is not recommended but is provided for backwards compatibility. The instrospection data is read from the headerfile server_introspection.dat.h. Introspection data can only be added for a single device.

When using the final option the server_introspeciton.dat.h must contain two items:

  1. A macro introspection_data_size that specifies the size of the introspection data in bytes
  2. An array uint8_t introspection_data[] containing the hex data representing the IDD. The header file must be placed in a folder that gets included in the build.

Function Documentation

◆ oc_set_introspection_data()

void oc_set_introspection_data ( size_t  device,
const uint8_t *  IDD,
size_t  IDD_size 
)

Set the IDD by passing in an array containing the data.

Deprecated:
replaced by oc_set_introspection_data_v1 in v2.2.5.13

◆ oc_set_introspection_data_v1()

long oc_set_introspection_data_v1 ( size_t  device,
const uint8_t *  IDD,
size_t  IDD_size 
)

Set the IDD by passing in an array containing the data.

Parameters
deviceindex of the device to which the IDD describes
IDDan array of CBOR encoded bytes containing the introspection device data (cannot be NULL)
IDD_sizethe size of the IDD array
Returns
-1 on failure
>=0 number of written bytes on success