IoTivity-Lite
oc_core_res.h File Reference
#include "oc_ri.h"
#include "util/oc_compiler.h"
#include <stdint.h>

Data Structures

struct  oc_device_info_t
 device information More...
 
struct  oc_platform_info_t
 platform information More...
 

Typedefs

typedef void(* oc_core_add_device_cb_t) (void *data)
 callback for adding a device More...
 
typedef void(* oc_core_init_platform_cb_t) (void *data)
 callback for initializing the platform More...
 
typedef struct oc_device_info_t oc_device_info_t
 device information More...
 
typedef struct oc_platform_info_t oc_platform_info_t
 platform information More...
 

Functions

oc_uuid_t * oc_core_get_device_id (size_t device)
 retrieve the id (uuid) of the device More...
 
bool oc_core_get_device_index (oc_uuid_t di, size_t *device)
 retrieve the index of device with given id More...
 
oc_device_info_toc_core_get_device_info (size_t device)
 retrieve the device info from the device index More...
 
int oc_core_get_latency (void)
 retrieves the latency (lat) property in eps of the oic.wk.res resource. More...
 
size_t oc_core_get_num_devices (void)
 retrieve the amount of devices More...
 
oc_platform_info_toc_core_get_platform_info (void)
 retrieve the platform information More...
 
oc_resource_toc_core_get_resource_by_index (int type, size_t device)
 retrieve the resource by type (e.g. More...
 
oc_resource_toc_core_get_resource_by_uri (const char *uri, size_t device)
 retrieve a core resource by uri More...
 
oc_resource_toc_core_get_resource_by_uri_v1 (const char *uri, size_t uri_len, size_t device)
 retrieve a core resource by uri More...
 
bool oc_core_is_DCR (const oc_resource_t *resource, size_t device)
 determine if a resource is a Device Configuration Resource More...
 
bool oc_core_is_SVR (const oc_resource_t *resource, size_t device)
 determine if a resource is Security Vertical Resource More...
 
bool oc_core_is_vertical_resource (const oc_resource_t *resource, size_t device)
 determine if a resource is a vertical resource More...
 
void oc_core_set_latency (int latency)
 set the latency (lat) property in eps of oic.wk.res resource. More...
 

Typedef Documentation

◆ oc_core_add_device_cb_t

typedef void(* oc_core_add_device_cb_t) (void *data)

callback for adding a device

◆ oc_core_init_platform_cb_t

typedef void(* oc_core_init_platform_cb_t) (void *data)

callback for initializing the platform

◆ oc_device_info_t

device information

◆ oc_platform_info_t

platform information

Function Documentation

◆ oc_core_get_device_id()

oc_uuid_t* oc_core_get_device_id ( size_t  device)

retrieve the id (uuid) of the device

Parameters
devicethe device index
Returns
oc_uuid_t* the device id

◆ oc_core_get_device_index()

bool oc_core_get_device_index ( oc_uuid_t  di,
size_t *  device 
)

retrieve the index of device with given id

Parameters
didevice id to be used for search
[out]devicedevice index of the device with the given id
Returns
true if found

◆ oc_core_get_device_info()

oc_device_info_t* oc_core_get_device_info ( size_t  device)

retrieve the device info from the device index

Parameters
devicethe device index
Returns
oc_device_info_t* the device info

◆ oc_core_get_latency()

int oc_core_get_latency ( void  )

retrieves the latency (lat) property in eps of the oic.wk.res resource.

the lat value is implemented globally for the stack

Returns
  • the latency in seconds

◆ oc_core_get_num_devices()

size_t oc_core_get_num_devices ( void  )

retrieve the amount of devices

Returns
size_t the amount of devices

◆ oc_core_get_platform_info()

oc_platform_info_t* oc_core_get_platform_info ( void  )

retrieve the platform information

Returns
oc_platform_info_t* the platform information

◆ oc_core_get_resource_by_index()

oc_resource_t* oc_core_get_resource_by_index ( int  type,
size_t  device 
)

retrieve the resource by type (e.g.

index) on a specific device

Parameters
typethe index of the resource
devicethe device index
Returns
oc_resource_t* the resource handle
NULL on failure

◆ oc_core_get_resource_by_uri()

oc_resource_t* oc_core_get_resource_by_uri ( const char *  uri,
size_t  device 
)

retrieve a core resource by uri

Deprecated:
replaced by replaced by oc_core_get_resource_by_uri_v1 in v2.2.5.7

◆ oc_core_get_resource_by_uri_v1()

oc_resource_t* oc_core_get_resource_by_uri_v1 ( const char *  uri,
size_t  uri_len,
size_t  device 
)

retrieve a core resource by uri

Parameters
urithe uri (cannot be NULL)
uri_lenthe length of the uri
devicethe device index
Returns
oc_resource_t* the resource handle
NULL on failure

◆ oc_core_is_DCR()

bool oc_core_is_DCR ( const oc_resource_t resource,
size_t  device 
)

determine if a resource is a Device Configuration Resource

Parameters
resourcethe resource
devicethe device index to which the resource belongs too
Returns
true is DCR resource
false is not DCR resource

◆ oc_core_is_SVR()

bool oc_core_is_SVR ( const oc_resource_t resource,
size_t  device 
)

determine if a resource is Security Vertical Resource

Parameters
resourcethe resource
devicethe device index to which the resource belongs too
Returns
true is SRV resource
false is not SVR resource

◆ oc_core_is_vertical_resource()

bool oc_core_is_vertical_resource ( const oc_resource_t resource,
size_t  device 
)

determine if a resource is a vertical resource

Note
vertical resources are mostly custom resources specific to a device
Parameters
resourcethe resource
devicethe device index to which the resource belongs too
Returns
true : is vertical resource
false : is not a vertical resource

◆ oc_core_set_latency()

void oc_core_set_latency ( int  latency)

set the latency (lat) property in eps of oic.wk.res resource.

The latency is implemented globally e.g. for all the resource instances. The default behaviour is that if nothing is set (e.g. value is 0) the lat property will not be framed in the eps property. Setting the value on 0 will cause that the lat property will not be framed in the eps property.

Parameters
[in]latencythe latency in seconds