[ARDUINO][BLE] Enable Arduino BLE support in RI sample
authorAbhishek Sharma <ce.abhishek@samsung.com>
Mon, 12 Oct 2015 10:55:15 +0000 (16:25 +0530)
committerJon A. Cruz <jonc@osg.samsung.com>
Sat, 21 Nov 2015 09:29:21 +0000 (09:29 +0000)
Change-Id: Ie326dca25edbfea638e5fea718ad0802224e4c39
Signed-off-by: Abhishek Sharma <ce.abhishek@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3807
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
arduino.scons
resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript
resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/ocserver.cpp

index ae3b53f..4329775 100644 (file)
@@ -35,6 +35,7 @@ Help(vars.GenerateHelpText(env))
 env.ImportLib('SPI')
 if 'ETH' in env.get('SHIELD'):
        env.ImportLib('Ethernet')
+       env.AppendUnique(CPPDEFINES = ['ARDUINOETH'])
 if 'WIFI' in env.get('SHIELD'):
        env.ImportLib('WiFi')
        env.AppendUnique(CPPDEFINES = ['ARDUINOWIFI'])
index 5b551bb..829ce52 100644 (file)
@@ -21,9 +21,6 @@
 Import('env')
 
 transport = env.get('TARGET_TRANSPORT')
-if 'BLE' in transport:
-        # Only supported for ethernet and WiFi.
-        Return()
 
 arduino_simplecs_env = env.Clone()
 ######################################################################
index 22aab31..9c9885c 100644 (file)
@@ -31,7 +31,7 @@
 #include <SPI.h>
 #include <WiFi.h>
 #include <WiFiUdp.h>
-#else
+#elif defined ARDUINOETH
 // Arduino Ethernet Shield
 #include <EthernetServer.h>
 #include <Ethernet.h>
@@ -107,7 +107,7 @@ int ConnectToNetwork()
     OC_LOG_V(INFO, TAG, "IP Address:  %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
     return 0;
 }
-#else
+#elif defined ARDUINOETH
 // Arduino Ethernet Shield
 int ConnectToNetwork()
 {
@@ -249,11 +249,13 @@ void setup()
     OC_LOG(DEBUG, TAG, ("OCServer is starting..."));
 
     // Connect to Ethernet or WiFi network
+#if defined(ARDUINOWIFI) || defined(ARDUINOETH)
     if (ConnectToNetwork() != 0)
     {
         OC_LOG(ERROR, TAG, ("Unable to connect to network"));
         return;
     }
+#endif
 
     // Initialize the OC Stack in Server mode
     if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)