You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/10/28 22:43:18 UTC

[4/5] incubator-mynewt-core git commit: oic; start oic task if one of the transports initializes ok.

oic; start oic task if one of the transports initializes ok.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/262f8b2d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/262f8b2d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/262f8b2d

Branch: refs/heads/develop
Commit: 262f8b2dee9f275f5b2da4a082a34c69d89038b5
Parents: a7400e7
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Oct 28 15:40:12 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Oct 28 15:41:31 2016 -0700

----------------------------------------------------------------------
 net/oic/src/port/mynewt/adaptor.c | 52 ++++++++++++++++------------------
 1 file changed, 24 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/262f8b2d/net/oic/src/port/mynewt/adaptor.c
----------------------------------------------------------------------
diff --git a/net/oic/src/port/mynewt/adaptor.c b/net/oic/src/port/mynewt/adaptor.c
index b61ba02..e4b1cd6 100644
--- a/net/oic/src/port/mynewt/adaptor.c
+++ b/net/oic/src/port/mynewt/adaptor.c
@@ -61,28 +61,27 @@ struct os_task oc_task;
 os_stack_t *oc_stack;
 
 void
-oc_send_buffer(oc_message_t *message) {
-
-    switch (message->endpoint.flags)
-    {
+oc_send_buffer(oc_message_t *message)
+{
+    switch (message->endpoint.flags) {
 #if (MYNEWT_VAL(OC_TRANSPORT_IP) == 1)
-        case IP:
-            oc_send_buffer_ip(message);
-            break;
+    case IP:
+        oc_send_buffer_ip(message);
+        break;
 #endif
 #if (MYNEWT_VAL(OC_TRANSPORT_GATT) == 1)
-        case GATT:
-            oc_send_buffer_gatt(message);
-            break;
+    case GATT:
+        oc_send_buffer_gatt(message);
+        break;
 #endif
 #if (MYNEWT_VAL(OC_TRANSPORT_SERIAL) == 1)
-        case SERIAL:
-            oc_send_buffer_serial(message);
-            break;
+    case SERIAL:
+        oc_send_buffer_serial(message);
+        break;
 #endif
-        default:
-            ERROR("Unknown transport option %u\n", message->endpoint.flags);
-            oc_message_unref(message);
+    default:
+        ERROR("Unknown transport option %u\n", message->endpoint.flags);
+        oc_message_unref(message);
     }
 }
 
@@ -153,7 +152,8 @@ oc_task_handler(void *arg)
 }
 
 static int
-oc_init_task(void) {
+oc_init_task(void)
+{
     int rc;
 
     os_eventq_init(&oc_event_q);
@@ -193,25 +193,21 @@ oc_connectivity_shutdown(void)
 int
 oc_connectivity_init(void)
 {
-    int rc;
+    int rc = -1;
 
 #if (MYNEWT_VAL(OC_TRANSPORT_IP) == 1)
-    rc = oc_connectivity_init_ip();
-    if (rc != 0) {
-        goto oc_connectivity_init_err;
+    if (oc_connectivity_init_ip() == 0) {
+        rc = 0;
     }
 #endif
 #if (MYNEWT_VAL(OC_TRANSPORT_SERIAL) == 1)
-
-    rc = oc_connectivity_init_serial();
-    if (rc != 0) {
-        goto oc_connectivity_init_err;
+    if (oc_connectivity_init_serial() == 0) {
+        rc = 0;
     }
 #endif
 #if (MYNEWT_VAL(OC_TRANSPORT_GATT) == 1)
-    rc = oc_connectivity_init_gatt();
-    if (rc != 0) {
-        goto oc_connectivity_init_err;
+    if (oc_connectivity_init_gatt() == 0) {
+        rc = 0;
     }
 #endif
     rc = oc_init_task();