IoTivity-Lite
Common operations

Macros

#define oc_activate_interrupt_handler(name)   (oc_process_start(&(name##_interrupt_x), 0))
 activate the interrupt handler More...
 
#define oc_define_interrupt_handler(name)
 define the interrupt handler More...
 
#define oc_signal_interrupt_handler(name)
 API for setting handlers for interrupts. More...
 

Functions

bool oc_has_delayed_callback (void *cb_data, oc_trigger_t callback, bool ignore_cb_data)
 Check if given delayed callback has already been scheduled. More...
 
void oc_remove_delayed_callback (void *cb_data, oc_trigger_t callback)
 Cancel a scheduled delayed callback. More...
 
void oc_set_delayed_callback (void *cb_data, oc_trigger_t callback, uint16_t seconds)
 Schedule a callback to be invoked after a set number of seconds. More...
 
void oc_set_delayed_callback_ms (void *cb_data, oc_trigger_t callback, uint16_t miliseconds)
 Schedule a callback to be invoked after a set number of miliseconds. More...
 
void oc_set_immutable_device_identifier (size_t device, oc_uuid_t *piid)
 Set the immutable device identifier. More...
 

Detailed Description

Macro Definition Documentation

◆ oc_activate_interrupt_handler

#define oc_activate_interrupt_handler (   name)    (oc_process_start(&(name##_interrupt_x), 0))

activate the interrupt handler

◆ oc_define_interrupt_handler

#define oc_define_interrupt_handler (   name)
Value:
void name##_interrupt_x_handler(void); \
OC_PROCESS(name##_interrupt_x, ""); \
OC_PROCESS_THREAD(name##_interrupt_x, ev, data) \
{ \
(void)data; \
OC_PROCESS_POLLHANDLER(name##_interrupt_x_handler()); \
OC_PROCESS_BEGIN(); \
while (oc_process_is_running(&(name##_interrupt_x))) { \
OC_PROCESS_YIELD(); \
} \
OC_PROCESS_END(); \
} \
void name##_interrupt_x_handler(void)

define the interrupt handler

◆ oc_signal_interrupt_handler

#define oc_signal_interrupt_handler (   name)
Value:
do { \
oc_process_poll(&(name##_interrupt_x)); \
_oc_signal_event_loop(); \
} while (0)

API for setting handlers for interrupts.

Function Documentation

◆ oc_has_delayed_callback()

bool oc_has_delayed_callback ( void *  cb_data,
oc_trigger_t  callback,
bool  ignore_cb_data 
)

Check if given delayed callback has already been scheduled.

To match a delayed callback: 1) function pointers must be equal 2) the user defined context pointers must be equal or ignore_cb_data must be true

Parameters
cb_datathe user defined context pointer
callbackthe delayed callback to look for
ignore_cb_datadon't compare the user defined context pointers
Returns
true matching delayed callback was found
false otherwise

◆ oc_remove_delayed_callback()

void oc_remove_delayed_callback ( void *  cb_data,
oc_trigger_t  callback 
)

Cancel a scheduled delayed callback.

Parameters
[in]cb_datathe user defined context pointer that was passed to the oc_sed_delayed_callback() function
[in]callbackthe delayed callback that is being removed

◆ oc_set_delayed_callback()

void oc_set_delayed_callback ( void *  cb_data,
oc_trigger_t  callback,
uint16_t  seconds 
)

Schedule a callback to be invoked after a set number of seconds.

Parameters
[in]cb_datauser defined context pointer that is passed to the oc_trigger_t callback
[in]callbackthe callback invoked after the set number of seconds
[in]secondsthe number of seconds to wait till the callback is invoked

◆ oc_set_delayed_callback_ms()

void oc_set_delayed_callback_ms ( void *  cb_data,
oc_trigger_t  callback,
uint16_t  miliseconds 
)

Schedule a callback to be invoked after a set number of miliseconds.

Parameters
[in]cb_datauser defined context pointer that is passed to the oc_trigger_t callback
[in]callbackthe callback invoked after the set number of miliseconds
[in]milisecondsthe number of miliseconds to wait till the callback is invoked

◆ oc_set_immutable_device_identifier()

void oc_set_immutable_device_identifier ( size_t  device,
oc_uuid_t *  piid 
)

Set the immutable device identifier.

This will set the piid device property (a.k.a Protocol Independent ID)

Unlike device id di device property the piid will remain the same even after device resets.

Parameters
[in]devicethe logical device index
[in]piidthe UUID for the immutable device identifier