You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/08/31 09:42:54 UTC
[GitHub] mkiiskila closed pull request #1356: OIC client discovery optional
mkiiskila closed pull request #1356: OIC client discovery optional
URL: https://github.com/apache/mynewt-core/pull/1356
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/net/oic/include/oic/oc_api.h b/net/oic/include/oic/oc_api.h
index f1db54bf65..2fb432a42f 100644
--- a/net/oic/include/oic/oc_api.h
+++ b/net/oic/include/oic/oc_api.h
@@ -122,7 +122,9 @@ int oc_notify_observers(oc_resource_t *resource);
/** Client side */
#include "oc_client_state.h"
+#if MYNEWT_VAL(OC_CLIENT_DISCOVERY_ENABLE)
bool oc_do_ip_discovery(const char *rt, oc_discovery_cb_t handler);
+#endif
bool oc_do_get(const char *uri, oc_server_handle_t *server, const char *query,
oc_response_handler_t handler, oc_qos_t qos);
diff --git a/net/oic/src/api/oc_client_api.c b/net/oic/src/api/oc_client_api.c
index bc6bc2df2c..9b7e393273 100644
--- a/net/oic/src/api/oc_client_api.c
+++ b/net/oic/src/api/oc_client_api.c
@@ -269,6 +269,7 @@ oc_stop_observe(const char *uri, oc_server_handle_t *server)
return status;
}
+#if MYNEWT_VAL(OC_CLIENT_DISCOVERY_ENABLE)
#if MYNEWT_VAL(OC_TRANSPORT_IP)
static bool
oc_send_ip_discovery(oc_server_handle_t *handle, const char *rt,
@@ -342,4 +343,6 @@ oc_do_ip_discovery(const char *rt, oc_discovery_cb_t handler)
}
#endif
+#endif /* OC_CLIENT_DISCOVERY_ENABLE */
+
#endif /* OC_CLIENT */
diff --git a/net/oic/src/api/oc_discovery.c b/net/oic/src/api/oc_discovery.c
index 2bc46a45e2..b00b33c2f5 100644
--- a/net/oic/src/api/oc_discovery.c
+++ b/net/oic/src/api/oc_discovery.c
@@ -179,6 +179,7 @@ oc_create_discovery_resource(void)
}
#ifdef OC_CLIENT
+#if MYNEWT_VAL(OC_CLIENT_DISCOVERY_ENABLE)
oc_discovery_flags_t
oc_ri_process_discovery_payload(struct coap_packet_rx *rsp,
oc_discovery_cb_t *handler,
@@ -316,4 +317,5 @@ oc_ri_process_discovery_payload(struct coap_packet_rx *rsp,
oc_free_rep(rep);
return ret;
}
+#endif /* OC_CLIENT_DISCOVERY_ENABLE */
#endif /* OC_CLIENT */
diff --git a/net/oic/src/api/oc_ri.c b/net/oic/src/api/oc_ri.c
index 8e888a9027..b2564ff399 100644
--- a/net/oic/src/api/oc_ri.c
+++ b/net/oic/src/api/oc_ri.c
@@ -795,11 +795,17 @@ oc_ri_invoke_client_cb(struct coap_packet_rx *rsp, oc_endpoint_t *endpoint)
*/
if (rsp->payload_len) {
if (cb->discovery) {
+#if MYNEWT_VAL(OC_CLIENT_DISCOVERY_ENABLE)
if (oc_ri_process_discovery_payload(rsp, cb->handler,
endpoint) == OC_STOP_DISCOVERY) {
free_client_cb(cb);
return true;
}
+#else
+ /* XXX should never be here */
+ free_client_cb(cb);
+ return true;
+#endif
} else {
client_response.packet = rsp;
client_response.origin = endpoint;
diff --git a/net/oic/src/port/mynewt/ble_adaptor.c b/net/oic/src/port/mynewt/ble_adaptor.c
index d0cef2d177..fe69220d52 100644
--- a/net/oic/src/port/mynewt/ble_adaptor.c
+++ b/net/oic/src/port/mynewt/ble_adaptor.c
@@ -421,10 +421,6 @@ oc_send_buffer_gatt(struct os_mbuf *m)
uint16_t attr_handle;
#endif
-#if (MYNEWT_VAL(OC_CLIENT) == 1)
- OC_LOG(ERROR, "oc_gatt send not supported on client");
-#endif
-
#if (MYNEWT_VAL(OC_SERVER) == 1)
assert(OS_MBUF_USRHDR_LEN(m) >= sizeof(struct oc_endpoint_ble));
diff --git a/net/oic/syscfg.yml b/net/oic/syscfg.yml
index d7d1f2773c..a8b304f62b 100644
--- a/net/oic/syscfg.yml
+++ b/net/oic/syscfg.yml
@@ -52,6 +52,10 @@ syscfg.defs:
description: 'Enables OIC client support'
value: '0'
+ OC_CLIENT_DISCOVERY_ENABLE:
+ description: 'Enables OIC discovery from client side'
+ value: '1'
+
OC_SERVER:
description: 'Enables OIC server support'
value: '0'
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services