IoTivity-Lite
|
Optional group of functions OCF server support. More...
Typedefs | |
typedef void(* | oc_con_write_cb_t) (size_t device_index, const oc_rep_t *rep) |
Callback for change notifications from the oic.wk.con resource. More... | |
typedef void(* | oc_send_response_cb_t) (oc_request_t *request, oc_status_t response_code) |
Callback function is triggered by oc_send_response before the response is set. More... | |
Functions | |
bool | oc_add_resource (oc_resource_t *resource) |
Add a resource to the IoTivity stack. More... | |
void | oc_delayed_delete_resource (oc_resource_t *resource) |
Schedule a callback to remove a resource. More... | |
bool | oc_delete_resource (oc_resource_t *resource) |
Remove a resource from the IoTivity stack and delete the resource. More... | |
void | oc_device_bind_resource_type (size_t device, const char *type) |
Add a Resource Type "rt" property to the an /oic/d resource. More... | |
bool | oc_get_diagnostic_message (const oc_client_response_t *response, const char **msg, size_t *size) |
retrieve the diagnostic payload from a response More... | |
int | oc_get_query_value (const oc_request_t *request, const char *key, const char **value) |
Get a pointer to the start of the value in a URL query parameter key=value pair. More... | |
int | oc_get_query_value_v1 (const oc_request_t *request, const char *key, size_t key_len, const char **value) |
Get a pointer to the start of the value in a URL query parameter key=value pair. More... | |
bool | oc_get_request_payload_raw (const oc_request_t *request, const uint8_t **payload, size_t *size, oc_content_format_t *content_format) |
retrieve the payload from the request, no processing More... | |
bool | oc_get_response_payload_raw (const oc_client_response_t *response, const uint8_t **payload, size_t *size, oc_content_format_t *content_format) |
retrieve the response payload, without processing More... | |
void | oc_ignore_request (oc_request_t *request) |
Ignore the request. More... | |
void | oc_indicate_separate_response (oc_request_t *request, oc_separate_response_t *response) |
Respond to an incoming request asynchronously. More... | |
void | oc_init_query_iterator (void) |
This resets the query iterator to the start of the URI query parameter. More... | |
int | oc_iterate_query (const oc_request_t *request, const char **key, size_t *key_len, const char **value, size_t *value_len) |
Iterate through the URI query parameters and get each key=value pair. More... | |
bool | oc_iterate_query_get_values (const oc_request_t *request, const char *key, const char **value, int *value_len) |
Iterate though the URI query parameters for a specific key. More... | |
bool | oc_iterate_query_get_values_v1 (const oc_request_t *request, const char *key, size_t key_len, const char **value, int *value_len) |
Iterate though the URI query parameters for a specific key. More... | |
oc_resource_t * | oc_new_resource (const char *name, const char *uri, uint8_t num_resource_types, size_t device) |
Allocate and populate a new oc_resource_t. More... | |
int | oc_notify_observers (oc_resource_t *resource) |
Notify all observers of a change to a given resource's property. More... | |
void | oc_notify_observers_delayed (oc_resource_t *resource, uint16_t seconds) |
Schedule notify all observers to invoke after a set number of seconds. More... | |
void | oc_notify_observers_delayed_ms (oc_resource_t *resource, uint16_t milliseconds) |
Schedule notify all observers to invoke after a set number of milliseconds. More... | |
void | oc_notify_resource_changed (oc_resource_t *resource) |
Notify all relevant mechanisms of a change to a given resource. More... | |
void | oc_process_baseline_interface (const oc_resource_t *resource) |
Helper function used when responding to a GET request to add Common Properties to a GET response. More... | |
int | oc_query_value_exists (const oc_request_t *request, const char *key) |
Checks if a query parameter 'key' exist in the URL query parameter. More... | |
bool | oc_query_value_exists_v1 (const oc_request_t *request, const char *key, size_t key_len) |
Checks if a query parameter 'key' exist in the URL query parameter. More... | |
void | oc_resource_bind_resource_interface (oc_resource_t *resource, oc_interface_mask_t iface_mask) |
Add the supported interface(s) to the resource. More... | |
void | oc_resource_bind_resource_type (oc_resource_t *resource, const char *type) |
Add a Resource Type "rt" property to the resource. More... | |
void | oc_resource_make_public (oc_resource_t *resource) |
Expose unsecured coap:// endpoints (in addition to secured coaps:// endpoints) for this resource in /oic/res. More... | |
void | oc_resource_set_default_interface (oc_resource_t *resource, oc_interface_mask_t iface_mask) |
Select the default interface. More... | |
void | oc_resource_set_discoverable (oc_resource_t *resource, bool state) |
Specify if a resource can be found using OCF discover mechanisms. More... | |
void | oc_resource_set_observable (oc_resource_t *resource, bool state) |
Specify that a resource should notify clients when a property has been modified. More... | |
void | oc_resource_set_periodic_observable (oc_resource_t *resource, uint16_t seconds) |
The resource will periodically notify observing clients of is property values. More... | |
void | oc_resource_set_pushable (oc_resource_t *resource, bool state) |
Specify if a resource can be pushable. More... | |
void | oc_resource_set_request_handler (oc_resource_t *resource, oc_method_t method, oc_request_callback_t callback, void *user_data) |
Specify a request_callback for GET, PUT, POST, and DELETE methods. More... | |
void | oc_resource_tag_func_desc (oc_resource_t *resource, oc_enum_t func) |
Sets the tag value for the relatvie position "tag_func_rel" tag. More... | |
void | oc_resource_tag_locn (oc_resource_t *resource, oc_locn_t locn) |
sets the value of the "tag_locn" tag More... | |
void | oc_resource_tag_pos_desc (oc_resource_t *resource, oc_pos_description_t pos) |
Sets the tag value for tag "tag-pos-desc" on the resource. More... | |
void | oc_resource_tag_pos_rel (oc_resource_t *resource, double x, double y, double z) |
Sets the value for the relative position "tag-pos-rel" tag. More... | |
void | oc_send_diagnostic_message (oc_request_t *request, const char *msg, size_t msg_len, oc_status_t response_code) |
send a diagnostic payload More... | |
void | oc_send_response (oc_request_t *request, oc_status_t response_code) |
Called after the response to a GET, PUT, POST or DELETE call has been prepared completed. More... | |
void | oc_send_response_raw (oc_request_t *request, const uint8_t *payload, size_t size, oc_content_format_t content_format, oc_status_t response_code) |
send the request, no processing More... | |
void | oc_send_response_with_callback (oc_request_t *request, oc_status_t response_code, bool trigger_cb) |
Called after the response to a GET, PUT, POST or DELETE call has been prepared completed. More... | |
void | oc_send_separate_response (oc_separate_response_t *handle, oc_status_t response_code) |
Called to send the deferred response to a GET, PUT, POST or DELETE request. More... | |
void | oc_set_con_write_cb (oc_con_write_cb_t callback) |
Sets the callback to receive change notifications for the oic.wk.con resource. More... | |
void | oc_set_send_response_callback (oc_send_response_cb_t cb) |
Set the send response callback function. More... | |
int | oc_set_send_response_etag (oc_request_t *request, const uint8_t *etag, uint8_t etag_len) |
Set the ETag for the response to a OC_GET request. More... | |
void | oc_set_separate_response_buffer (oc_separate_response_t *handle) |
Set a response buffer for holding the response payload. More... | |
Optional group of functions OCF server support.
typedef void(* oc_con_write_cb_t) (size_t device_index, const oc_rep_t *rep) |
Callback for change notifications from the oic.wk.con resource.
This callback is invoked to notify a change of one or more properties on the oic.wk.con resource. The rep
parameter contains all properties, the function is not invoked for each property.
When the function is invoked, all properties handled by the stack are already updated. The callee can use the invocation to optionally store the new values persistently.
Once the callback returns, the response will be sent to the client and observers will be notified.
device_index | index of the device to which the change was applied, 0 is the first device |
rep | list of properties and their new values |
typedef void(* oc_send_response_cb_t) (oc_request_t *request, oc_status_t response_code) |
Callback function is triggered by oc_send_response before the response is set.
In this callback, the application can set/override the response payload.
request | the request being responded to |
response_code | the status of the response |
bool oc_add_resource | ( | oc_resource_t * | resource | ) |
Add a resource to the IoTivity stack.
The resource will be validated then added to the stack.
resource | the resource to add to the stack |
void oc_delayed_delete_resource | ( | oc_resource_t * | resource | ) |
Schedule a callback to remove a resource.
resource | the resource to delete |
bool oc_delete_resource | ( | oc_resource_t * | resource | ) |
Remove a resource from the IoTivity stack and delete the resource.
Any resource observers will automatically be removed.
This will free the memory associated with the resource.
resource | the resource to delete |
void oc_device_bind_resource_type | ( | size_t | device, |
const char * | type | ||
) |
Add a Resource Type "rt" property to the an /oic/d
resource.
This function can be used to bind a new Resource Type to a logical device's /oic/d
resource.
device | index of a logical device |
type | the Resource type to add to the Resource Type "rt" property (cannot be NULL) |
bool oc_get_diagnostic_message | ( | const oc_client_response_t * | response, |
const char ** | msg, | ||
size_t * | size | ||
) |
retrieve the diagnostic payload from a response
response | the response to get the diagnostic payload from |
msg | the diagnotic payload |
size | the size of the diagnostic payload |
int oc_get_query_value | ( | const oc_request_t * | request, |
const char * | key, | ||
const char ** | value | ||
) |
Get a pointer to the start of the value in a URL query parameter key=value pair.
int oc_get_query_value_v1 | ( | const oc_request_t * | request, |
const char * | key, | ||
size_t | key_len, | ||
const char ** | value | ||
) |
Get a pointer to the start of the value in a URL query parameter key=value pair.
[in] | request | the oc_request_t that contains the query parameters |
[in] | key | the key being searched for (cannot be NULL) |
[in] | key_len | the length of the key |
[out] | value | pointer to the value string assigned to the key |
-1
if there are no additional query parameters bool oc_get_request_payload_raw | ( | const oc_request_t * | request, |
const uint8_t ** | payload, | ||
size_t * | size, | ||
oc_content_format_t * | content_format | ||
) |
retrieve the payload from the request, no processing
request | the request |
payload | the payload of the request |
size | the size in bytes of the payload |
content_format | the content format of the payload |
bool oc_get_response_payload_raw | ( | const oc_client_response_t * | response, |
const uint8_t ** | payload, | ||
size_t * | size, | ||
oc_content_format_t * | content_format | ||
) |
retrieve the response payload, without processing
response | the response |
payload | the payload of the response |
size | the size of the payload |
content_format | the content format of the payload |
void oc_ignore_request | ( | oc_request_t * | request | ) |
Ignore the request.
The GET, PUT, POST or DELETE requests can be ignored. For example a oc_request_callback_t may only want to respond to multicast requests. Thus any request that is not over multicast endpoint could be ignored.
Using oc_ignore(request)
is preferred over oc_send_response(request, OC_IGNORE)
since it does not attempt to fill the response buffer before sending the response.
[in] | request | the request being responded to (cannot be NULL) |
void oc_indicate_separate_response | ( | oc_request_t * | request, |
oc_separate_response_t * | response | ||
) |
Respond to an incoming request asynchronously.
If for some reason the response to a request would take a long time or is not immediately available, then this function may be used defer responding to the request.
Example:
[in] | request | the request that will be responded to as a separate response (cannot be NULL) |
[in] | response | instance of an internal struct that is used to track the state of the separate response. (cannot be NULL) |
void oc_init_query_iterator | ( | void | ) |
This resets the query iterator to the start of the URI query parameter.
This is used together with oc_iterate_query_get_values() or oc_iterate_query() to iterate through query parameter of a URI that are part of an oc_request_t
int oc_iterate_query | ( | const oc_request_t * | request, |
const char ** | key, | ||
size_t * | key_len, | ||
const char ** | value, | ||
size_t * | value_len | ||
) |
Iterate through the URI query parameters and get each key=value pair.
Before calling oc_iterate_query() the first time oc_init_query_iterator() must be called to reset the query iterator to the first query parameter.
Example:
[in] | request | the oc_request_t that contains the query parameters (cannot be NULL) |
[out] | key | pointer to the location of the the key of the key=value pair (cannot be NULL) |
[out] | key_len | the length of the key string (cannot be NULL) |
[out] | value | pointer the location of the value string assigned to the key=value pair |
[out] | value_len | the length of the value string |
-1
if there are no additional query parameters bool oc_iterate_query_get_values | ( | const oc_request_t * | request, |
const char * | key, | ||
const char ** | value, | ||
int * | value_len | ||
) |
Iterate though the URI query parameters for a specific key.
bool oc_iterate_query_get_values_v1 | ( | const oc_request_t * | request, |
const char * | key, | ||
size_t | key_len, | ||
const char ** | value, | ||
int * | value_len | ||
) |
Iterate though the URI query parameters for a specific key.
Before calling oc_iterate_query_get_values_v1() the first time oc_init_query_iterator() must be called to reset the query iterator to the first query parameter.
Example:
[in] | request | the oc_request_t that contains the query parameters (cannot be NULL) |
[in] | key | the key being searched for (cannot be NULL) |
[in] | key_len | the length of the key |
[out] | value | pointer to the value string for to the key=value pair (cannot be NULL) |
[out] | value_len | the length of the value string (cannot be NULL) |
oc_resource_t* oc_new_resource | ( | const char * | name, |
const char * | uri, | ||
uint8_t | num_resource_types, | ||
size_t | device | ||
) |
Allocate and populate a new oc_resource_t.
Resources are the primary interface between code and real world devices.
Each resource has a Uniform Resource Identifier (URI) that identifies it. All resources must specify one or more Resource Types to be considered a valid resource. The number of Resource Types is specified by the num_resource_types
the actual Resource Types are added later using the oc_resource_bind_resource_type() function.
The resource is populated with a default interface OC_IF_BASELINE.
Many properties associated with a resource are set or modified after the new resource has been created.
The resource is not added to the device till oc_add_resource() is called.
Example:
[in] | name | the name of the new resource this will set the property n |
[in] | uri | the Uniform Resource Identifier for the resource (cannot be NULL) |
[in] | num_resource_types | the number of Resource Types that will be added/bound to the resource |
[in] | device | index of the logical device the resource will be added to |
int oc_notify_observers | ( | oc_resource_t * | resource | ) |
Notify all observers of a change to a given resource's property.
[in] | resource | the oc_resource_t that has a modified property (cannot be NULL) |
0
on failure could also mean no registered observers void oc_notify_observers_delayed | ( | oc_resource_t * | resource, |
uint16_t | seconds | ||
) |
Schedule notify all observers to invoke after a set number of seconds.
[in] | resource | the oc_resource_t that has a modified property (cannot be NULL) |
[in] | seconds | the number of seconds to wait till the callback is invoked |
void oc_notify_observers_delayed_ms | ( | oc_resource_t * | resource, |
uint16_t | milliseconds | ||
) |
Schedule notify all observers to invoke after a set number of milliseconds.
[in] | resource | the oc_resource_t that has a modified property (cannot be NULL) |
[in] | milliseconds | the number of milliseconds to wait till the callback is invoked |
void oc_notify_resource_changed | ( | oc_resource_t * | resource | ) |
Notify all relevant mechanisms of a change to a given resource.
resource | resource that has a modified property (cannot be NULL) |
void oc_process_baseline_interface | ( | const oc_resource_t * | resource | ) |
Helper function used when responding to a GET request to add Common Properties to a GET response.
This add Common Properties name ("n"), Interface ("if"), and Resource Type ("rt") to a GET response.
Example:
resource | the resource the baseline Common Properties will be read from to respond to the GET request (cannot be NULL) |
int oc_query_value_exists | ( | const oc_request_t * | request, |
const char * | key | ||
) |
Checks if a query parameter 'key' exist in the URL query parameter.
bool oc_query_value_exists_v1 | ( | const oc_request_t * | request, |
const char * | key, | ||
size_t | key_len | ||
) |
Checks if a query parameter 'key' exist in the URL query parameter.
request | the oc_request_t that contains the query parameters |
key | the key being searched for (cannot be NULL) |
key_len | the length of the key |
void oc_resource_bind_resource_interface | ( | oc_resource_t * | resource, |
oc_interface_mask_t | iface_mask | ||
) |
Add the supported interface(s) to the resource.
Resource interfaces specify how the code is able to interact with the resource
The iface_mask
is bitwise OR of the following interfaces:
OC_IF_BASELINE
("oic.if.baseline") baseline interface allow GET, PUT/POST, and notify/observe operations.OC_IF_LL
("oic.if.ll") The links list interface is a specifically designed to provide a list of links pointing to other resources. Links list interfaces allow GET, and notify/observe operations.OC_IF_B
("oic.if.b") batch interface. The batch interface is used to interact with a collection of resources at the same time.OC_IF_R
("oic.if.r") a read-only interface. A read-only interface allows GET, and notify/observe operations.OC_IF_RW
("oir.if.rw") a read-write interface. A read-write interface allows GET, PUT/POST, and notify/observe operations.OC_IF_A
("oic.if.a") an actuator interface. An actuator interface allows GET, PUT/POST, and notify/observe operations.OC_IF_S
("oic.if.s") a sensor interface. A sensor interface allows GET, and notify/observe operations.OC_IC_CREATE
("oic.if.create") used to create new resources in a collection.The read-write and actuator interfaces are very similar and sometimes hard to differentiate when one should be used over another. In general an actuator interface is used when it modifies the real world value. e.g. turn on light, increase temperature, open vent.
The read-only and sensor are also very similar in general a sensor value is read directly or indirectly from a real world sensor.
resource | the resource that the interface(s) will be added to (cannot be NULL) |
iface_mask | a bitwise ORed list of all interfaces supported by the resource. |
void oc_resource_bind_resource_type | ( | oc_resource_t * | resource, |
const char * | type | ||
) |
Add a Resource Type "rt" property to the resource.
All resources require at least one Resource Type. The number of Resource Types the resource contains is declared when the resource it created using oc_new_resource() function.
Resource Types use a dot "." naming scheme e.g. oic.r.switch.binary
. Resource Types starting with oic
are reserved for a OCF defined Resource Types. Developers are strongly encouraged to try and use an OCF defined Resource Type vs. creating their own. A repository of OCF defined resources can be found on https://github.com/openconnectivityfoundation/IoTDataModels.
Multi-value "rt" Resource means a resource with multiple Resource Types. i.e. oc_resource_bind_resource_type() is called multiple times for a single resource. When using a Mulit-value Resource the different resources properties must not conflict.
resource | the resource that the Resource Type will be set on (cannot be NULL) |
type | the Resource Type to add to the Resource Type "rt" property (cannot be NULL) |
void oc_resource_make_public | ( | oc_resource_t * | resource | ) |
Expose unsecured coap:// endpoints (in addition to secured coaps:// endpoints) for this resource in /oic/res.
resource | the resource to make public (cannot be NULL) |
void oc_resource_set_default_interface | ( | oc_resource_t * | resource, |
oc_interface_mask_t | iface_mask | ||
) |
Select the default interface.
The default interface must be one of the resources specified in the oc_resource_bind_resource_interface() function.
If a request to the resource comes in and the interface is not specified then the default interface will be used to service the request.
If the default interface is not set then the OC_IF_BASELINE will be used by the stack.
resource | the resource that the default interface will be set on (cannot be NULL) |
iface_mask | a single interface that will will be used as the default interface |
void oc_resource_set_discoverable | ( | oc_resource_t * | resource, |
bool | state | ||
) |
Specify if a resource can be found using OCF discover mechanisms.
resource | to specify as discoverable or non-discoverable (cannot be NULL) |
state | if true the resource will be discoverable if false the resource will be non-discoverable |
void oc_resource_set_observable | ( | oc_resource_t * | resource, |
bool | state | ||
) |
Specify that a resource should notify clients when a property has been modified.
resource | the resource to specify the observability (cannot be NULL) |
state | true to make resource observable, false to make resource unobservable |
void oc_resource_set_periodic_observable | ( | oc_resource_t * | resource, |
uint16_t | seconds | ||
) |
The resource will periodically notify observing clients of is property values.
The oc_resource_set_observable() function can be used to turn off a periodic observable resource.
Setting a seconds
frequency of zero 0
is invalid and will result in an invalid resource.
resource | the resource to specify the periodic observability (cannot be NULL) |
seconds | the frequency in seconds that the resource will send out an notification of is property values. |
void oc_resource_set_pushable | ( | oc_resource_t * | resource, |
bool | state | ||
) |
Specify if a resource can be pushable.
resource | to specify as pushable or non-pushable (cannot be NULL) |
state | if true the resource will be pushable if false the resource will be non-pushable |
void oc_resource_set_request_handler | ( | oc_resource_t * | resource, |
oc_method_t | method, | ||
oc_request_callback_t | callback, | ||
void * | user_data | ||
) |
Specify a request_callback for GET, PUT, POST, and DELETE methods.
All resources must provide at least one request handler to be a valid resource.
method types:
OC_GET
the oc_request_callback_t
is responsible for returning the current value of all of the resource properties.OC_PUT
the oc_request_callback_t
is responsible for updating one or more of the resource properties.OC_POST
the oc_request_callback_t
is responsible for updating one or more of the resource properties. The callback may also be responsible for creating new resources.OC_DELETE
the oc_request_callback_t
is responsible for deleting a resourceresource | the resource the callback handler will be registered to (cannot be NULL) |
method | specify if type method the callback is responsible for handling |
callback | the callback handler that will be invoked when a the method is called on the resource. |
user_data | context pointer that is passed to the oc_request_callback_t. The pointer must remain valid as long as the resource exists. |
void oc_resource_tag_func_desc | ( | oc_resource_t * | resource, |
oc_enum_t | func | ||
) |
Sets the tag value for the relatvie position "tag_func_rel" tag.
resource | the resource to apply the tag too (cannot be NULL). |
func | the function description |
void oc_resource_tag_locn | ( | oc_resource_t * | resource, |
oc_locn_t | locn | ||
) |
sets the value of the "tag_locn" tag
resource | the resource to apply the tag too (cannot be NULL). |
locn | the location |
void oc_resource_tag_pos_desc | ( | oc_resource_t * | resource, |
oc_pos_description_t | pos | ||
) |
Sets the tag value for tag "tag-pos-desc" on the resource.
resource | the resource (cannot be NULL) |
pos | the descriptive text for the tag |
void oc_resource_tag_pos_rel | ( | oc_resource_t * | resource, |
double | x, | ||
double | y, | ||
double | z | ||
) |
Sets the value for the relative position "tag-pos-rel" tag.
resource | the resource to apply the tag too (cannot be NULL). |
x | the x value in 3D space |
y | the y value in 3D space |
z | the z value in 3D space |
void oc_send_diagnostic_message | ( | oc_request_t * | request, |
const char * | msg, | ||
size_t | msg_len, | ||
oc_status_t | response_code | ||
) |
send a diagnostic payload
request | the request |
msg | the message in ascii |
msg_len | the length of the message |
response_code | the coap response code |
void oc_send_response | ( | oc_request_t * | request, |
oc_status_t | response_code | ||
) |
Called after the response to a GET, PUT, POST or DELETE call has been prepared completed.
The function oc_send_response is called at the end of a oc_request_callback_t to inform the caller about the status of the requested action.
[in] | request | the request being responded to |
[in] | response_code | the status of the response |
void oc_send_response_raw | ( | oc_request_t * | request, |
const uint8_t * | payload, | ||
size_t | size, | ||
oc_content_format_t | content_format, | ||
oc_status_t | response_code | ||
) |
send the request, no processing
request | the request to send |
payload | the payload for the request |
size | the payload size |
content_format | the content format |
response_code | the response code to send |
void oc_send_response_with_callback | ( | oc_request_t * | request, |
oc_status_t | response_code, | ||
bool | trigger_cb | ||
) |
Called after the response to a GET, PUT, POST or DELETE call has been prepared completed.
The function oc_send_response is called at the end of a oc_request_callback_t to inform the caller about the status of the requested action.
[in] | request | the request being responded to |
[in] | response_code | the status of the response |
[in] | trigger_cb | if true, the send response callback will be triggered |
void oc_send_separate_response | ( | oc_separate_response_t * | handle, |
oc_status_t | response_code | ||
) |
Called to send the deferred response to a GET, PUT, POST or DELETE request.
The function oc_send_separate_response is called to initiate transfer of the response.
[in] | handle | instance of the internal struct that was passed to oc_indicate_separate_response() |
[in] | response_code | the status of the response |
void oc_set_con_write_cb | ( | oc_con_write_cb_t | callback | ) |
Sets the callback to receive change notifications for the oic.wk.con
resource.
The function can be used to set or unset the callback. Whenever an attribute of the oic.wk.con
resource is changed, the callback will be invoked.
callback | The callback to register or NULL to unset it. If the function is invoked a second time, then the previously set callback is simply replaced. |
void oc_set_send_response_callback | ( | oc_send_response_cb_t | cb | ) |
Set the send response callback function.
cb | that will be triggered by oc_send_response_with_callback when the trigger_cb is true. |
int oc_set_send_response_etag | ( | oc_request_t * | request, |
const uint8_t * | etag, | ||
uint8_t | etag_len | ||
) |
Set the ETag for the response to a OC_GET request.
request | the request being responded to (cannot be NULL) |
etag | ETag value (cannot be NULL) |
etag_len | length of the ETag value |
void oc_set_separate_response_buffer | ( | oc_separate_response_t * | handle | ) |
Set a response buffer for holding the response payload.
When a deferred response is ready, pass in the same oc_separate_response_t
that was handed to oc_indicate_separate_response() for delaying the initial response.
[in] | handle | instance of the oc_separate_response_t that was passed to the oc_indicate_separate_response() function (cannot be NULL) |