Commit 86c6a4b9 authored by Kishen Maloor's avatar Kishen Maloor

Make the maintenance resource optional

Change-Id: Ib4703c5e117a1f8fde1156bd8f92295506d110e2
Signed-off-by: Kishen Maloor's avatarKishen Maloor <kishen.maloor@intel.com>
parent 5c72091d
......@@ -16,9 +16,11 @@
#include "oc_core_res.h"
#include "api/cloud/oc_cloud_internal.h"
#include "oc_api.h"
#ifdef OC_MNT
#include "api/oc_mnt.h"
#endif /* OC_MNT */
#include "messaging/coap/oc_coap.h"
#include "oc_api.h"
#include "oc_discovery.h"
#include "oc_introspection_internal.h"
#include "oc_rep.h"
......@@ -359,8 +361,9 @@ oc_core_add_new_device(const char *uri, const char *rt, const char *name,
oc_create_introspection_resource(device_count);
#ifdef OC_MNT
oc_create_maintenance_resource(device_count);
#endif /* OC_MNT */
#if defined(OC_CLIENT) && defined(OC_SERVER) && defined(OC_CLOUD)
oc_create_cloudconf_resource(device_count);
#endif /* OC_CLIENT && OC_SERVER && OC_CLOUD */
......@@ -556,10 +559,12 @@ oc_core_get_resource_by_uri(const char *uri, size_t device)
} else if ((strlen(uri) - skip) == 16 &&
memcmp(uri + skip, "oc/introspection", 16) == 0) {
type = OCF_INTROSPECTION_DATA;
} else if ((strlen(uri) - skip) == 7 &&
memcmp(uri + skip, "oic/mnt", 7) == 0) {
}
#ifdef OC_MNT
else if ((strlen(uri) - skip) == 7 && memcmp(uri + skip, "oic/mnt", 7) == 0) {
type = OCF_MNT;
}
#endif /* OC_MNT */
#ifdef OC_CLOUD
else if ((strlen(uri) - skip) == 19 &&
memcmp(uri + skip, "CoapCloudConfResURI", 19) == 0) {
......
......@@ -135,10 +135,11 @@ process_device_resources(CborEncoder *links, oc_request_t *request,
filter_resource(oc_core_get_resource_by_index(OCF_CON, device_index),
request, oc_string(anchor), links))
matches++;
#ifdef OC_MNT
if (filter_resource(oc_core_get_resource_by_index(OCF_MNT, device_index),
request, oc_string(anchor), links))
matches++;
#endif /* OC_MNT */
#ifdef OC_SOFTWARE_UPDATE
if (filter_resource(
oc_core_get_resource_by_index(OCF_SW_UPDATE, device_index), request,
......
......@@ -14,10 +14,11 @@
// limitations under the License.
*/
#include <stdio.h>
#include "api/oc_mnt.h"
#include "oc_api.h"
#ifdef OC_MNT
#include "api/oc_mnt.h"
#include "oc_core_res.h"
#include <stdio.h>
#ifdef OC_SECURITY
#include "security/oc_pstat.h"
#endif /* OC_SECURITY */
......@@ -81,3 +82,4 @@ oc_create_maintenance_resource(size_t device)
OCF_MNT, device, "oic/mnt", OC_IF_RW | OC_IF_BASELINE, OC_IF_RW,
OC_SECURE | OC_DISCOVERABLE, get_mnt, 0, post_mnt, 0, 1, "oic.wk.mnt");
}
#endif /* OC_MNT */
......@@ -94,7 +94,9 @@ typedef enum {
OCF_INTROSPECTION_WK,
OCF_INTROSPECTION_DATA,
OCF_RES,
#ifdef OC_MNT
OCF_MNT,
#endif /* OC_MNT */
#ifdef OC_CLOUD
OCF_COAPCLOUDCONF,
#endif /* OC_CLOUD */
......
......@@ -33,6 +33,8 @@ typedef uint64_t oc_clock_time_t;
#define OC_DNS_LOOKUP_IPV6
/* Add support for the oic.if.create interface in Collections */
#define OC_COLLECTIONS_IF_CREATE
/* Add support for the maintenance resource */
#define OC_MNT
/* If we selected support for dynamic memory allocation */
#ifdef OC_DYNAMIC_ALLOCATION
#define OC_COLLECTIONS
......
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