static int process_device_object(CborEncoder *device, const char *uuid, const char *rt, int rt_len) { int dev, matches = 0; #ifdef OC_SERVER oc_resource_t *resource; #endif oc_rep_start_object(*device, links); oc_rep_set_text_string(links, di, uuid); oc_rep_set_array(links, links); if (filter_resource(oc_core_get_resource_by_index(OCF_P), rt, rt_len, oc_rep_array(links))) matches++; for (dev = 0; dev < oc_core_get_num_devices(); dev++) { if (filter_resource( oc_core_get_resource_by_index(NUM_OC_CORE_RESOURCES - 1 - dev), rt, rt_len, oc_rep_array(links))) matches++; } #ifdef OC_SERVER for (resource = oc_ri_get_app_resources(); resource; resource = SLIST_NEXT(resource, next)) { if (!(resource->properties & OC_DISCOVERABLE)) { continue; } if (filter_resource(resource, rt, rt_len, oc_rep_array(links))) { matches++; } } #endif #ifdef OC_SECURITY if (filter_resource(oc_core_get_resource_by_index(OCF_SEC_DOXM), rt, rt_len, oc_rep_array(links))) matches++; #endif oc_rep_close_array(links, links); oc_rep_end_object(*device, links); return matches; }
struct filter_resource * efrm_filter_resource_from_resource(struct efrm_resource *rs) { return filter_resource(rs); }