From: Sandipan Patra Date: Wed, 17 Feb 2016 12:54:49 +0000 (+0530) Subject: [ENROLLEE] SoftAp host based on build command X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8b7cd98a384ef1268bfed9948c355c1d762016e5;p=contrib%2Fiotivity.git [ENROLLEE] SoftAp host based on build command Change-Id: Id3386264522b3015075c3333e14b38b1af9b3180 Signed-off-by: Sandipan Patra Reviewed-on: https://gerrit.iotivity.org/gerrit/5025 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- diff --git a/service/easy-setup/SConscript b/service/easy-setup/SConscript index 5142702..84574e0 100755 --- a/service/easy-setup/SConscript +++ b/service/easy-setup/SConscript @@ -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 : diff --git a/service/easy-setup/enrollee/SConscript b/service/easy-setup/enrollee/SConscript index 60f9d39..db7a566 100644 --- a/service/easy-setup/enrollee/SConscript +++ b/service/easy-setup/enrollee/SConscript @@ -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 ###################################################################### diff --git a/service/easy-setup/enrollee/src/onboarding.cpp b/service/easy-setup/enrollee/src/onboarding.cpp index 3ea3120..c9ea323 100644 --- a/service/easy-setup/enrollee/src/onboarding.cpp +++ b/service/easy-setup/enrollee/src/onboarding.cpp @@ -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); diff --git a/service/easy-setup/enrollee/src/softap.cpp b/service/easy-setup/enrollee/src/softap.cpp index 2f428d1..8784350 100644 --- a/service/easy-setup/enrollee/src/softap.cpp +++ b/service/easy-setup/enrollee/src/softap.cpp @@ -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 } /** diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript index f1f4be8..7082662 100644 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript @@ -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' } diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt b/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt index 9375048..357b824 100644 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt @@ -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 :