[ENROLLEE] SoftAp host based on build command
authorSandipan Patra <sandipan.p@samsung.com>
Wed, 17 Feb 2016 12:54:49 +0000 (18:24 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Thu, 18 Feb 2016 02:21:09 +0000 (02:21 +0000)
Change-Id: Id3386264522b3015075c3333e14b38b1af9b3180
Signed-off-by: Sandipan Patra <sandipan.p@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/5025
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/easy-setup/SConscript
service/easy-setup/enrollee/SConscript
service/easy-setup/enrollee/src/onboarding.cpp
service/easy-setup/enrollee/src/softap.cpp
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt

index 5142702..84574e0 100755 (executable)
@@ -44,7 +44,7 @@ if ('mediator' in es_role) :
 
 if ('enrollee' in es_role) :
        print "Building Easysetup enrollee SDK"
-       
+
        if es_target in ['linux', 'arduino', 'tizen']:
                SConscript('enrollee/SConscript')
        else :
index 60f9d39..db7a566 100644 (file)
@@ -40,6 +40,9 @@ if 'IP' in enrollee_env.get('TARGET_TRANSPORT'):
        print "Enrollees are implemented for IP transport only"
        enrollee_env.AppendUnique(CPPDEFINES = ['ESWIFI'])
 
+if enrollee_env.get('ES_SOFTAP_MODE') == 'ENROLLEE_SOFTAP':
+       enrollee_env.AppendUnique(CPPDEFINES = ['ENROLLEE_SOFTAP'])
+
 ######################################################################
 # Build flags
 ######################################################################
index 3ea3120..c9ea323 100644 (file)
@@ -22,7 +22,7 @@
  * @file
  *
  * This file has methods for on-boarding the Enrollee device.
- * This will contain template methods that will have core business logic & negotiation algorithm 
+ * This will contain template methods that will have core business logic & negotiation algorithm
  * on various on-boarding methods.
  */
 
@@ -66,14 +66,12 @@ bool ESOnboard(const char * ssid, const char* passwd, NetworkEventCallback cb)
 
     if (ESSoftapOnboarding())
     {
-#ifndef ARDUINO //SoftAp at Arduino is not supported
         if (ESSoftapAtEnrollee())
         {
             OC_LOG(DEBUG, ES_ENROLLEE_TAG, "Create softap at enrollee");
             ESCreateSoftap(ssid, passwd, cb);
         }
         else
-#endif
         {
             OC_LOG(DEBUG, ES_ENROLLEE_TAG, "Connecting to SoftAp");
             ConnectToWiFiNetwork(ssid, passwd, cb);
index 2f428d1..8784350 100644 (file)
@@ -23,13 +23,20 @@ void ESCreateSoftapCallback(int result, const char *ip, const char* mac_addr,
 NetworkEventCallback gCallback;
 
 /**
- * It will return Device which is creating Soft AP ;  Devices are identified by their role.
+ * It will return Device which is creating Soft AP.
  * i.e.Enrollee or Mediator.
+ * This decesion is based on, what is the value set for ES_SOFTAP_MODE in build command as well as 
+ * in iotivity.spec file.
  */
 DeviceRole ESSoftapHost()
 {
-    // TODO: To implement
+#ifdef ENROLLEE_SOFTAP
+    //SoftAp at enrollee
     return ENROLLEE;
+#else
+    //SoftAp at mediator
+    return MEDIATOR;
+#endif
 }
 
 /**
index f1f4be8..7082662 100644 (file)
@@ -28,11 +28,11 @@ os_arch_map = {
 es_role_map = {
                'enrollee', 'mediator'
                }
-               
+
 es_target_enrollee_map = {
                'arduino', 'tizen', 'linux'
                }
-               
+
 es_softap_mode_map = {
                'ENROLLEE_SOFTAP', 'MEDIATOR_SOFTAP'
                }
index 9375048..357b824 100644 (file)
@@ -30,7 +30,7 @@ Build Procedure
                attribute               value
                es_target_enrollee      tizen
                es_role                 enrollee
-               softap_mode             ENROLLEE_SOFTAP 
+               softap_mode             ENROLLEE_SOFTAP
 
 3) Go to "iotivity/" folder.
 4) Execute following command(s) to start build based on transport selection required :