| 
    IoTivity-Lite
    
   | 
 
Optional group of functions to support OCF compliant collections. More...
Typedefs | |
| typedef void(* | oc_resource_free_instance_t) (oc_resource_t *) | 
| Callback invoked to delete an resource.  More... | |
| typedef oc_resource_t *(* | oc_resource_get_instance_t) (const char *, const oc_string_array_t *, oc_resource_properties_t, oc_interface_mask_t, size_t) | 
| Callback invoked to retrieve an resource.  More... | |
Functions | |
| void | oc_add_collection (oc_resource_t *collection) | 
| bool | oc_add_collection_v1 (oc_resource_t *collection) | 
| Adds a collection to the list of collections.  More... | |
| bool | oc_check_if_collection (const oc_resource_t *resource) | 
| Check if resource is a global collection.  More... | |
| void | oc_collection_add_link (oc_resource_t *collection, oc_link_t *link) | 
| Adds the link to the collection.  More... | |
| bool | oc_collection_add_mandatory_rt (oc_resource_t *collection, const char *rt) | 
| Add a mandatory Resource Type to a collection.  More... | |
| bool | oc_collection_add_supported_rt (oc_resource_t *collection, const char *rt) | 
| Add a supported Resource Type to a collection.  More... | |
| oc_resource_t * | oc_collection_get_collections (void) | 
| Gets all known collections.  More... | |
| oc_link_t * | oc_collection_get_links (oc_resource_t *collection) | 
| Returns the list of links belonging to this collection.  More... | |
| void | oc_collection_remove_link (oc_resource_t *collection, const oc_link_t *link) | 
| Removes a link from the collection.  More... | |
| bool | oc_collections_add_rt_factory (const char *rt, oc_resource_get_instance_t get_instance, oc_resource_free_instance_t free_instance) | 
| adds the resource type factory  More... | |
| void | oc_delete_collection (oc_resource_t *collection) | 
| Deletes the specified collection.  More... | |
| oc_collection_t * | oc_get_collection_by_uri (const char *uri_path, size_t uri_path_len, size_t device) | 
| Find a collection in the global collection by its URI.  More... | |
| oc_link_t * | oc_get_link_by_uri (oc_collection_t *collection, const char *uri_path, size_t uri_path_len) | 
| Get a link from a collection by its URI.  More... | |
| oc_resource_t * | oc_new_collection (const char *name, const char *uri, uint8_t num_resource_types, size_t device) | 
| Creates a new empty collection.  More... | |
| void | oc_resource_set_properties_cbs (oc_resource_t *resource, oc_get_properties_cb_t get_properties, void *get_props_user_data, oc_set_properties_cb_t set_properties, void *set_props_user_data) | 
| sets the callback properties for set properties and get properties  More... | |
Optional group of functions to support OCF compliant collections.
| typedef void(* oc_resource_free_instance_t) (oc_resource_t *) | 
Callback invoked to delete an resource.
| typedef oc_resource_t*(* oc_resource_get_instance_t) (const char *, const oc_string_array_t *, oc_resource_properties_t, oc_interface_mask_t, size_t) | 
Callback invoked to retrieve an resource.
| void oc_add_collection | ( | oc_resource_t * | collection | ) | 
| bool oc_add_collection_v1 | ( | oc_resource_t * | collection | ) | 
Adds a collection to the list of collections.
If the caller makes the collection discoverable, then it will be included in the collection discovery once it has been added with this function.
| [in] | collection | Collection to add to the list of collections. Must not be NULL. Must not be added twice or a list corruption will occur. The collection is not copied. | 
| bool oc_check_if_collection | ( | const oc_resource_t * | resource | ) | 
Check if resource is a global collection.
| void oc_collection_add_link | ( | oc_resource_t * | collection, | 
| oc_link_t * | link | ||
| ) | 
Adds the link to the collection.
| [in,out] | collection | Collection to add the link to. Must not be NULL | 
| [in] | link | Link to add to the collection. The link is not copied. Must not be NULL. Must not be added again to this or a different collection or a list corruption will occur. To re-add it, remove the link first. | 
| bool oc_collection_add_mandatory_rt | ( | oc_resource_t * | collection, | 
| const char * | rt | ||
| ) | 
Add a mandatory Resource Type to a collection.
This will be come the "rts-m" property of the collection. The "rts-m" property is an array of Resource Types that are mandatory to be exposed with in an array of Links exposed by the collection.
| [in] | collection | the collection the the Resource Type will be added to (cannot be NULL) | 
| [in] | rt | the mandatory Resource Type being added to the collection (cannot be NULL) | 
| bool oc_collection_add_supported_rt | ( | oc_resource_t * | collection, | 
| const char * | rt | ||
| ) | 
Add a supported Resource Type to a collection.
This will become the "rts" property of the collection. The "rts" property is an array of Resource Types that are supported within an array of Links exposed by the collection.
| [in] | collection | the collection the the Resource Type will be added to (cannot be NULL) | 
| [in] | rt | the supported Resource Type being added to the collection (cannot be NULL) | 
| oc_resource_t* oc_collection_get_collections | ( | void | ) | 
Gets all known collections.
| oc_link_t* oc_collection_get_links | ( | oc_resource_t * | collection | ) | 
Returns the list of links belonging to this collection.
| [in] | collection | Collection to get the links from. | 
| void oc_collection_remove_link | ( | oc_resource_t * | collection, | 
| const oc_link_t * | link | ||
| ) | 
Removes a link from the collection.
| [in,out] | collection | Collection to remove the link from. Does nothing if this is NULL | 
| [in] | link | The link to remove. Does nothing if this is NULL or not part of the collection. The link and its resource are not freed. | 
| bool oc_collections_add_rt_factory | ( | const char * | rt, | 
| oc_resource_get_instance_t | get_instance, | ||
| oc_resource_free_instance_t | free_instance | ||
| ) | 
adds the resource type factory
| rt | the resource type | 
| get_instance | creates the instance of the resource type | 
| free_instance | sets callback to free the created instance of the resource tupe | 
| void oc_delete_collection | ( | oc_resource_t * | collection | ) | 
Deletes the specified collection.
The function removes the collection from the internal list of collections and releases all direct resources and links associated with this collection.
| [in,out] | collection | The pointer to the collection to delete. If this is NULL, the function does nothing | 
| oc_collection_t* oc_get_collection_by_uri | ( | const char * | uri_path, | 
| size_t | uri_path_len, | ||
| size_t | device | ||
| ) | 
Find a collection in the global collection by its URI.
| uri_path | the URI path of the collection (with or without the leading slash) | 
| uri_path_len | the length of the URI path | 
| device | device index | 
| oc_link_t* oc_get_link_by_uri | ( | oc_collection_t * | collection, | 
| const char * | uri_path, | ||
| size_t | uri_path_len | ||
| ) | 
Get a link from a collection by its URI.
| collection | collection to search | 
| uri_path | the URI path of the link (with or without the leading slash) | 
| uri_path_len | the length of the URI path | 
| oc_resource_t* oc_new_collection | ( | const char * | name, | 
| const char * | uri, | ||
| uint8_t | num_resource_types, | ||
| size_t | device | ||
| ) | 
Creates a new empty collection.
The collection is created with interfaces OC_IF_BASELINE, OC_IF_LL (also default) and OC_IF_B. Initially it is neither discoverable nor observable.
The function only allocates the collection. Use oc_add_collection() after the setup of the collection is complete.
| [in] | name | name of the collection | 
| [in] | uri | Unique URI of this collection. Must not be NULL. | 
| [in] | num_resource_types | Number of resources the caller will bind with this resource (e.g. by invoking oc_resource_bind_resource_type(col, OIC_WK_COLLECTION)). Must be 1 or higher.  | 
| [in] | device | The internal device that should carry this collection. This is typically 0. | 
oc_collection_t *) or NULL if out of memory.| void oc_resource_set_properties_cbs | ( | oc_resource_t * | resource, | 
| oc_get_properties_cb_t | get_properties, | ||
| void * | get_props_user_data, | ||
| oc_set_properties_cb_t | set_properties, | ||
| void * | set_props_user_data | ||
| ) | 
sets the callback properties for set properties and get properties
| resource | the resource for the callback data | 
| get_properties | callback function for retrieving the properties | 
| get_props_user_data | the user data for the get_properties callback function | 
| set_properties | callback function for setting the properties | 
| set_props_user_data | the user data for the set_properties callback function |