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 (const 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 (const void *cb_data, oc_trigger_t callback)
 Cancel a scheduled delayed callback. More...
 
void oc_remove_delayed_callback_by_filter (oc_trigger_t cb, oc_ri_timed_event_filter_t filter, const void *filter_data, bool match_all, oc_ri_timed_event_on_delete_t on_delete)
 Cancel a scheduled delayed callback by matching it by the provided filtering function. 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 milliseconds)
 Schedule a callback to be invoked after a set number of milliseconds. More...
 
void oc_set_delayed_callback_ms_v1 (void *cb_data, oc_trigger_t callback, uint64_t milliseconds)
 Schedule a callback to be invoked after a set number of milliseconds. More...
 
void oc_set_immutable_device_identifier (size_t device, const 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)
int oc_process_is_running(const struct oc_process *p)
Check if a process is running.

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 ( const 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 ( const 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_set_delayed_callback() function
[in]callbackthe delayed callback that is being removed

◆ oc_remove_delayed_callback_by_filter()

void oc_remove_delayed_callback_by_filter ( oc_trigger_t  cb,
oc_ri_timed_event_filter_t  filter,
const void *  filter_data,
bool  match_all,
oc_ri_timed_event_on_delete_t  on_delete 
)

Cancel a scheduled delayed callback by matching it by the provided filtering function.

Parameters
[in]cbthe delayed callback that is being removed
[in]filterfiltering function (cannot be NULL)
[in]filter_datauser data provided to the filtering function
[in]match_alliterate over all delayed callbacks (otherwise the iteration will stop after the first match)
[in]on_deletefunction invoked with the context data of the delayed callback, before the callback is deallocated
Note
if the matched timed event is currently being processed then the on_delete callback will be invoked when the processing is finished. So it might occurr some time after the call to oc_ri_remove_timed_event_callback_by_filter has finished.
See also
oc_ri_timed_event_filter_t
oc_ri_timed_event_on_delete_t

◆ 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  milliseconds 
)

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

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 milliseconds
[in]millisecondsthe number of milliseconds to wait till the callback is invoked
Deprecated:
replaced by oc_set_delayed_callback_ms_v1 in v2.2.5.4

◆ oc_set_delayed_callback_ms_v1()

void oc_set_delayed_callback_ms_v1 ( void *  cb_data,
oc_trigger_t  callback,
uint64_t  milliseconds 
)

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

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 milliseconds
[in]millisecondsthe number of milliseconds to wait till the callback is invoked

◆ oc_set_immutable_device_identifier()

void oc_set_immutable_device_identifier ( size_t  device,
const 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