C Messaging API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E70344-26
iotcs_device.h File Reference

Methods for device client. More...

#include <inttypes.h>
#include "iotcs.h"

Go to the source code of this file.

Defines

#define IOTCS_METADATA_DEVICE_CLASS   "deviceClass"
 The deviceClass metadata attribute key.
#define IOTCS_METADATA_MANUFACTURER   "manufacturer"
 The manufacturer metadata attribute key.
#define IOTCS_METADATA_MODEL_NUMBER   "modelNumber"
 The modelNumber metadata attribute key.
#define IOTCS_METADATA_PROTOCOL   "protocol"
 The protocol metadata attribute key.
#define IOTCS_METADATA_PROTOCOL_DEVICE_CLASS   "protocolDeviceClass"
 The protocolDeviceClass metadata attribute key.
#define IOTCS_METADATA_PROTOCOL_DEVICE_ID   "protocolDeviceId"
 The protocolDeviceId metadata attribute key.
#define IOTCS_METADATA_SERIAL_NUMBER   "serialNumber"
 The serialNumber metadata attribute key.

Functions

iotcs_result iotcs_init (const char *path, const char *password)
 IoT DC library initialization.
void iotcs_finalize (void)
 IoT DC library finalization.
const char * iotcs_get_endpoint_id (void)
 Get endpoint Id.
iotcs_result iotcs_activate (const char *device_models[])
 Activate the device.
int iotcs_is_activated (void)
 Returns whether the device is activated.
iotcs_result iotcs_register_device (iotcs_bool restricted, const char *hardware_id, const iotcs_key_value metadata[], const char *device_models[], char *endpoint_id)
 Register an indirectly-connected device with the cloud service.

Detailed Description

Methods for device client.


Function Documentation

iotcs_result iotcs_activate ( const char *  device_models[])

Activate the device.

Parameters:
device_modelsarray of device model URN strings. Last element must have NULL value.
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif device_models is NULL.
IOTCS_RESULT_OKif succeeds or device has already been activated.
IOTCS_RESULT_CANNOT_AUTHORIZEif there are problems with authorization.
IOTCS_RESULT_FAILotherwise.
void iotcs_finalize ( void  )

IoT DC library finalization.

IoT DC library finalization. Releases previously allocated temporary resources.

const char* iotcs_get_endpoint_id ( void  )

Get endpoint Id.

Returns:
null terminated string with endpoint id
iotcs_result iotcs_init ( const char *  path,
const char *  password 
)

IoT DC library initialization.

IoT DC library initialization. Initiates all subsystems. This function must be called before any iotcs_* calls (except iotcs_log_* methods).

Parameters:
patha path to trusted assets store.
passworda password for trusted assets store.
Return values:
IOTCS_RESULT_OKif succeeds.
IOTCS_RESULT_FAILotherwise.
int iotcs_is_activated ( void  )

Returns whether the device is activated.

Returns:
non-zero value is device is activated or zero otherwise
iotcs_result iotcs_register_device ( iotcs_bool  restricted,
const char *  hardware_id,
const iotcs_key_value  metadata[],
const char *  device_models[],
char *  endpoint_id 
)

Register an indirectly-connected device with the cloud service.

Register an indirectly-connected device with the cloud service and specifiy whether the gateway device is required to have the appropriate credentials for activating the indirectly-connected device.

Parameters:
restrictedindicate whether or not credentials are required for activating the indirectly connected device
hardware_idan identifier unique within the Cloud Service instance
metadatakeys and values for device metadata. Last element must have NULL 'key'.
device_modelsarray with pointers to zero or more device models that are implemented by the directly connected device. Last element must have NULL value.
endpoint_idbuffer for returning endpoint id string
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif hardware_id or metadata or device_models are NULL.
IOTCS_RESULT_CANNOT_AUTHORIZEif there are problems with authorization.
IOTCS_RESULT_OKif succeeds.
IOTCS_RESULT_FAILotherwise.