Commit 369141a4 authored by Kishen Maloor's avatar Kishen Maloor

oc_collection:exclude rts/rts-m unless defined

Signed-off-by: Kishen Maloor's avatarKishen Maloor <kishen.maloor@intel.com>
parent bb53715d
Pipeline #1040 passed with stage
in 12 minutes and 9 seconds
...@@ -577,23 +577,27 @@ oc_handle_collection_request(oc_method_t method, oc_request_t *request, ...@@ -577,23 +577,27 @@ oc_handle_collection_request(oc_method_t method, oc_request_t *request,
oc_rep_start_root_object(); oc_rep_start_root_object();
oc_process_baseline_interface(request->resource); oc_process_baseline_interface(request->resource);
/* rts */ /* rts */
oc_rep_open_array(root, rts); if (oc_list_length(collection->supported_rts) > 0) {
oc_rt_t *rtt = (oc_rt_t *)oc_list_head(collection->supported_rts); oc_rep_open_array(root, rts);
while (rtt) { oc_rt_t *rtt = (oc_rt_t *)oc_list_head(collection->supported_rts);
oc_rep_add_text_string(rts, oc_string(rtt->rt)); while (rtt) {
rtt = rtt->next; oc_rep_add_text_string(rts, oc_string(rtt->rt));
rtt = rtt->next;
}
oc_rep_close_array(root, rts);
} }
oc_rep_close_array(root, rts);
/* rts-m */ /* rts-m */
const char *rtsm_key = "rts-m"; if (oc_list_length(collection->mandatory_rts) > 0) {
oc_rep_set_key(oc_rep_object(root), rtsm_key); const char *rtsm_key = "rts-m";
oc_rep_start_array(oc_rep_object(root), rtsm); oc_rep_set_key(oc_rep_object(root), rtsm_key);
oc_rt_t *rtt = (oc_rt_t *)oc_list_head(collection->mandatory_rts); oc_rep_start_array(oc_rep_object(root), rtsm);
while (rtt) { oc_rt_t *rtt = (oc_rt_t *)oc_list_head(collection->mandatory_rts);
oc_rep_add_text_string(rtsm, oc_string(rtt->rt)); while (rtt) {
rtt = rtt->next; oc_rep_add_text_string(rtsm, oc_string(rtt->rt));
rtt = rtt->next;
}
oc_rep_end_array(oc_rep_object(root), rtsm);
} }
oc_rep_end_array(oc_rep_object(root), rtsm);
oc_rep_set_array(root, links); oc_rep_set_array(root, links);
while (link != NULL) { while (link != NULL) {
if (oc_filter_resource_by_rt(link->resource, request)) { if (oc_filter_resource_by_rt(link->resource, request)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment