Android OnBoarding code modifications to handle multiple transports
authorMadan Lanka <lanka.madan@samsung.com>
Tue, 14 Jul 2015 10:27:37 +0000 (06:27 -0400)
committerUze Choi <uzchoi@samsung.com>
Wed, 15 Jul 2015 03:31:02 +0000 (03:31 +0000)
1) Used factory pattern to support Enrollee Device on different transports
2) Defined new classes to handle provisioing information of different transports
3) Modified OnBoarding logic to handle onBoarding of Enrollee Devices and provisioning steps in a generic way

Change-Id: I958ee0d44415eecde44de98e977795819d8e55d7
Signed-off-by: Madan Lanka <lanka.madan@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1645
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
30 files changed:
service/easy-setup/readme.txt
service/easy-setup/sampleapp/android/EasySetup/app/app.iml
service/easy-setup/sampleapp/android/EasySetup/app/src/main/AndroidManifest.xml
service/easy-setup/sampleapp/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/MainActivity.java
service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/layout/capture.xml [deleted file]
service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/layout/decoder.xml [deleted file]
service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/layout/encoder.xml [deleted file]
service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/values/colors.xml [deleted file]
service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/values/ids.xml [deleted file]
service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/values/strings.xml
service/easy-setup/sampleapp/android/EasySetup/easySetupCore-debug/easySetupCore-debug.iml
service/easy-setup/sampleapp/android/EasySetup/iotivity-armeabi-base-debug/iotivity-armeabi-base-debug.iml
service/easy-setup/sdk/mediator/android/EasySetupCore/build.gradle
service/easy-setup/sdk/mediator/android/EasySetupCore/easySetupCore.iml
service/easy-setup/sdk/mediator/android/EasySetupCore/settings.gradle [new file with mode: 0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupCallbackHandler.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupManager.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeOnBoardingInfo.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/IOnBoardingStatus.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardEnrollee.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ProvisionEnrollee.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiSoftAPManager.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/EnrolleeDevice.java [new file with mode: 0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/EnrolleeDeviceFactory.java [new file with mode: 0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/OnBoardingConfig.java [new file with mode: 0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/ProvisioningInfo.java [new file with mode: 0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/IPEnrolleeDevice.java [moved from service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeInfo.java with 71% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/IPProvisioningInfo.java [new file with mode: 0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/WiFiSoftAPManager.java [new file with mode: 0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/WiFiSoftAPOnBoardingConfig.java [new file with mode: 0644]

index 61202ef..6affd2e 100644 (file)
@@ -1,15 +1,15 @@
 
 Steps to build and deploy Easysetup Mediator in Android platform
 
-1) Compilation
+1) Compilation using Scons
        0) Prerequisite exports for Android
                export ANDROID_HOME=<ANDROID_HOME>
                export ANDROID_NDK=<ANDROID_NDK>
        a) In the IoTivity root source folder execute
                 scons TARGET_OS=android TARGET_ARCH=armeabi TARGET_TRANSPORT=IP RELEASE=0
        
-       b) Step (a) will generate cross compiled base libraries and places them in the folder
-               /out/android/armeabi/debug
+       b) If the project is setup correctly, you should see a BUILD SUCCESSFUL message on the terminal
+               You should see the .aar files generated inside of '<iotivity>/android/android_api/base/build/outputs/aar' directory. The .aar files contain jni directory and also a .jar file
                
        c) Now navigate to the Easysetup NDK folder 
                <iotivity-root>/service/easy-setup/sdk/android
@@ -19,28 +19,41 @@ Steps to build and deploy Easysetup Mediator in Android platform
                 
        e) Step (d) will generate cross compiled Easysetup JNI .so files in the following folder
                
-               
-               
-2) Execution
+2) Compilation using Android Studio
        
        0) Prerequisite for running the Android application
-               Install Android SDK and ADK in eclipse using the Android SDK manager
+               Install Android Studio and use the Android SDK manager to update the Android API to 21
        
-       a) Import following projects to the Eclipse using the "Import->Android->Existing Android Code Into Workspace"
+       a) Import following projects to the Studio using the "File->New->Import Project"
                - service\easy-setup\sdk\android\EasySetupCore
                - service\easy-setup\sampleapp\android\EasySetup
-                
-       b) Drag and drop the following .so files in to the EasySetup->libs->armeabi folder
-               - libca-interface.so
-               - libconnectivity_abstraction.so
-               - libeasysetup-jni.so [Easy Setup file]
-               - libESSDK.so [Easy Setup file]
-               - libgnustl_shared.so
-               - liboc_logger.so
-               - liboc.so
-               - libocstack-jni.so
-               - liboctbstack.so
-       c) Run "Easy Setup" as an Android application
+       
+       b) EasySetupCore is dependent on the .aar files generated in 1.b 
+               1) To add an .aar file to the 'EasySetupCore' project,
+                       a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
+                       b.Select the .aar file(iotivity-armeabi-base-*.aar) from the location in steps 1.b
+                       c.Right click on EasySetup->Open Module Settings
+                       d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
+                       
+       c)      Build EasySetupCore project using "Android Studio->Build->Make Module "easySetupCore"
+               If the project is setup correctly, you should see a BUILD SUCCESSFUL in the Android Studio Gradle Build terminal
+                       You should see the .aar file generated inside of 
+                       'iotivity\service\easy-setup\sdk\mediator\android\easySetupCore\build\outputs\aar'
+       
+       d) EasySetup application is also dependent on the .so files generated in 1.d step
+               1) Drag and drop the following .so files in to the EasySetup\app\src\main\jniLibs\armeabi folder
+                       - libeasysetup-jni.so [Easy Setup file]
+                       
+       e) EasySetup is also dependent on the .aar files generated in 1.b and 2.c steps
+               1) To add an .aar file to the 'EasySetup' project,
+                       a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
+                       b.Select the .aar file from the location in steps 1.b and 2.b above
+                       c.Right click on EasySetup->Open Module Settings
+                       d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
+                       e.The .aar files (easySetupCore-*.aar & iotivity-armeabi-base-*.aar) selected in step 2.c.1.b above should be present. Select it.
+       
+                       
+       e) Run "Easy Setup" as an Android application
        
 Folder structure
 iotivity/
index e08d4b5..b14367f 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EasySetupGradle" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
+<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EasySetup" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
   <component name="FacetManager">
     <facet type="android-gradle" name="Android-Gradle">
       <configuration>
@@ -69,8 +69,8 @@
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/EasySetupGradle/easySetupCore-debug/unspecified/jars" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/EasySetupGradle/iotivity-armeabi-base-debug/unspecified/jars" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/EasySetup/easySetupCore-debug/unspecified/jars" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/EasySetup/iotivity-armeabi-base-debug/unspecified/jars" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
index e65794b..d3e74dd 100644 (file)
                                <data android:mimeType="text/plain"/>
                        </intent-filter>
         </activity>
-        
-         <activity android:name="com.jwetherell.quick_response_code.CaptureActivity"
-            android:label="@string/capture_name"
-            android:icon="@drawable/icon"
-            android:screenOrientation="landscape"
-            android:clearTaskOnLaunch="true"
-            android:stateNotNeeded="true"
-            android:configChanges="orientation|keyboardHidden"
-            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-            android:windowSoftInputMode="stateAlwaysHidden">
-        </activity>
-
-        <activity android:name="com.jwetherell.quick_response_code.DecoderActivity"
-            android:label="@string/decoder_name"
-            android:icon="@drawable/icon"
-            android:screenOrientation="landscape"
-            android:clearTaskOnLaunch="true"
-            android:stateNotNeeded="true"
-            android:configChanges="orientation|keyboardHidden"
-            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-            android:windowSoftInputMode="stateAlwaysHidden">
-        </activity>
-
-        <activity android:name="com.jwetherell.quick_response_code.EncoderActivity"
-            android:label="@string/encoder_name"
-            android:icon="@drawable/icon"
-            android:screenOrientation="landscape"
-            android:clearTaskOnLaunch="true"
-            android:stateNotNeeded="true"
-            android:configChanges="orientation|keyboardHidden"
-            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-            android:windowSoftInputMode="stateAlwaysHidden">
-        </activity>
-
     </application>
 
 </manifest>
index 5d87d6a..3b785e5 100644 (file)
@@ -27,11 +27,15 @@ import org.iotivity.base.OcPlatform;
 import org.iotivity.base.PlatformConfig;\r
 import org.iotivity.base.QualityOfService;\r
 import org.iotivity.base.ServiceType;\r
-import org.iotivity.service.easysetup.mediator.EnrolleeInfo;\r
+import org.iotivity.service.easysetup.mediator.common.EnrolleeDevice;\r
 import org.iotivity.service.easysetup.mediator.IOnBoardingStatus;\r
 import org.iotivity.service.easysetup.mediator.IProvisioningListener;\r
 import org.iotivity.service.easysetup.mediator.OnBoardEnrollee;\r
 import org.iotivity.service.easysetup.mediator.ProvisionEnrollee;\r
+import org.iotivity.base.OcConnectivityType;\r
+import org.iotivity.service.easysetup.mediator.ip.IPEnrolleeDevice;\r
+import org.iotivity.service.easysetup.mediator.ip.IPProvisioningInfo;\r
+import org.iotivity.service.easysetup.mediator.ip.WiFiSoftAPOnBoardingConfig;\r
 \r
 import android.app.Activity;\r
 import android.content.Intent;\r
@@ -58,7 +62,7 @@ public class MainActivity extends Activity implements IProvisioningListener,
     static int        easySetupCount        = 0;\r
     static final int  REQUEST_IMAGE_CAPTURE = 1;\r
     ImageView         imageView;\r
-    EnrolleeInfo      connectedDevice;\r
+    EnrolleeDevice    connectedDevice;\r
 \r
     OnBoardEnrollee   onBoardingHandlerInstance;\r
     ProvisionEnrollee provisionEnrolleInstance;\r
@@ -71,7 +75,7 @@ public class MainActivity extends Activity implements IProvisioningListener,
         textView1 = (TextView) findViewById(R.id.textView1);\r
 \r
         // OnBoarding Process\r
-        onBoardingHandlerInstance = new OnBoardEnrollee(this);\r
+        onBoardingHandlerInstance = new OnBoardEnrollee(this, OcConnectivityType.IPV4);\r
         onBoardingHandlerInstance.registerOnBoardingStatusHandler(this);\r
 \r
         // Get intent, action and MIME type\r
@@ -79,14 +83,6 @@ public class MainActivity extends Activity implements IProvisioningListener,
         String action = intent.getAction();\r
         String type = intent.getType();\r
 \r
-        if (Intent.ACTION_SEND.equals(action) && type != null) {\r
-            if ("text/plain".equals(type)) {\r
-                handleSendText(intent); // Handle text being sent\r
-            }\r
-        } else {\r
-            // Handle other intents, such as being started from the home screen\r
-        }\r
-\r
         addListenerForStartAP();\r
         addListenerForStopAP();\r
         addListenerOnProvisioning();\r
@@ -96,7 +92,7 @@ public class MainActivity extends Activity implements IProvisioningListener,
         myTimer2.schedule(new TimerTask() {\r
             @Override\r
             public void run() {\r
-                onBoardingHandlerInstance.startDeviceScan();\r
+                onBoardingHandlerInstance.startDeviceScan(300);\r
             }\r
 \r
         }, 0, 2000);\r
@@ -106,7 +102,7 @@ public class MainActivity extends Activity implements IProvisioningListener,
         super.onDestroy();\r
         if(provisionEnrolleInstance != null)\r
         {\r
-            provisionEnrolleInstance.stopEnrolleeProvisioning(0);\r
+            provisionEnrolleInstance.stopEnrolleeProvisioning(OcConnectivityType.IPV4);\r
         }\r
         onBoardingHandlerInstance.disableWiFiAP();\r
         finish();\r
@@ -133,16 +129,17 @@ public class MainActivity extends Activity implements IProvisioningListener,
                 public void run() {\r
                     // TODO Auto-generated method stub\r
                     Toast toast = null;\r
+                    IPEnrolleeDevice ipEnrolleeDevice = (IPEnrolleeDevice)connectedDevice;\r
                     if (statuscode == 0) {\r
                         toast = Toast.makeText(getApplicationContext(),\r
-                                connectedDevice.getIpAddr()\r
+                                ipEnrolleeDevice.getIpAddr()\r
                                         + " - is Provisioned",\r
                                 Toast.LENGTH_LONG);\r
                         Log.i("EasyConnect", "Provisioned statuscode-"\r
                                 + statuscode);\r
                     } else {\r
                         toast = Toast.makeText(getApplicationContext(),\r
-                                connectedDevice.getIpAddr()\r
+                                ipEnrolleeDevice.getIpAddr()\r
                                         + " - is NOT Provisioned",\r
                                 Toast.LENGTH_LONG);\r
                         Log.i("EasyConnect", "Not Provisioned statuscode-"\r
@@ -157,45 +154,9 @@ public class MainActivity extends Activity implements IProvisioningListener,
         }\r
     }\r
 \r
-    void handleSendText(Intent intent) {\r
-        String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);\r
-        if (sharedText != null) {\r
-            // Update UI to reflect text being shared\r
-            WifiConfiguration netConfig = new WifiConfiguration();\r
-            netConfig.SSID = "EasyConnect";\r
-            netConfig.allowedAuthAlgorithms\r
-                    .set(WifiConfiguration.AuthAlgorithm.OPEN);\r
-            // netConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN);\r
-            // netConfig.allowedProtocols.set(WifiConfiguration.Protocol.WPA);\r
-            netConfig.allowedKeyManagement\r
-                    .set(WifiConfiguration.KeyMgmt.WPA_PSK);\r
-            netConfig.preSharedKey = "EasyConnect";\r
-            // netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);\r
-            // netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);\r
-            // netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);\r
-            // netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);\r
-            onBoardingHandlerInstance.enableWiFiAP(netConfig, true);\r
-\r
-            Toast.makeText(getApplicationContext(),\r
-                    "QR Code Captured. Starting Wi-Fi Access Point!",\r
-                    Toast.LENGTH_LONG).show();\r
-\r
-            myTimer = new Timer();\r
-            myTimer.schedule(new TimerTask() {\r
-                @Override\r
-                public void run() {\r
-                    scan();\r
-                    scanCount++;\r
-                    Log.i("EasyConnect", "Scan Count -" + scanCount);\r
-                }\r
-\r
-            }, 0, 5000);\r
-        }\r
-    }\r
-\r
     private void scan() {\r
         onBoardingHandlerInstance.registerOnBoardingStatusHandler(this);\r
-        onBoardingHandlerInstance.startDeviceScan();\r
+        onBoardingHandlerInstance.startDeviceScan(300);\r
     }\r
 \r
     public void addListenerForStartAP() {\r
@@ -204,20 +165,19 @@ public class MainActivity extends Activity implements IProvisioningListener,
         button.setOnClickListener(new OnClickListener() {\r
             @Override\r
             public void onClick(View arg0) {\r
+                WiFiSoftAPOnBoardingConfig transportConfig = new WiFiSoftAPOnBoardingConfig();\r
+\r
                 WifiConfiguration netConfig = new WifiConfiguration();\r
                 netConfig.SSID = "EasySetup123";\r
                 netConfig.allowedAuthAlgorithms\r
                         .set(WifiConfiguration.AuthAlgorithm.OPEN);\r
-                // netConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN);\r
-                // netConfig.allowedProtocols.set(WifiConfiguration.Protocol.WPA);\r
                 netConfig.allowedKeyManagement\r
                         .set(WifiConfiguration.KeyMgmt.WPA_PSK);\r
                 netConfig.preSharedKey = "EasySetup123";\r
-                // netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);\r
-                // netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);\r
-                // netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);\r
-                // netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);\r
-                onBoardingHandlerInstance.enableWiFiAP(netConfig, true);\r
+\r
+                transportConfig.setConnectivityType(OcConnectivityType.IPV4);\r
+                transportConfig.setNetConfig(netConfig);\r
+                onBoardingHandlerInstance.enableNetwork(transportConfig, true);\r
             }\r
         });\r
     }\r
@@ -239,13 +199,20 @@ public class MainActivity extends Activity implements IProvisioningListener,
         button.setOnClickListener(new OnClickListener() {\r
             @Override\r
             public void onClick(View arg0) {\r
+                IPEnrolleeDevice ipEnrolleeDevice = (IPEnrolleeDevice)connectedDevice;\r
+                IPProvisioningInfo ipProvisioningInfo = new IPProvisioningInfo();\r
+\r
+                ipProvisioningInfo.setConnectivityType(OcConnectivityType.IPV4);\r
+                ipProvisioningInfo.setIpAddress(ipEnrolleeDevice.getIpAddr());\r
+                ipProvisioningInfo.setNetSSID("EasySetup123");\r
+                ipProvisioningInfo.setNetPWD("EasySetup123");\r
+\r
                 provisionEnrolleInstance.provisionEnrollee(\r
-                        connectedDevice.getIpAddr(), "EasySetup123",\r
-                        "EasySetup123", 0);\r
+                        ipProvisioningInfo, OcConnectivityType.IPV4);\r
                 easySetupCount++;\r
                 Log.i("EasyConnect", "easy Setup Count-" + easySetupCount);\r
                 Log.i("EasyConnect",\r
-                        "IP Address-" + connectedDevice.getIpAddr());\r
+                        "IP Address-" + ipProvisioningInfo.getIpAddress());\r
             }\r
         });\r
 \r
@@ -277,58 +244,59 @@ public class MainActivity extends Activity implements IProvisioningListener,
     }\r
 \r
     @Override\r
-    public void deviceOnBoardingStatus(EnrolleeInfo enrolleStatus) {\r
+    public void deviceOnBoardingStatus(EnrolleeDevice enrolleeDevice) {\r
         // TODO Auto-generated method stub\r
         // TODO Auto-generated method stub\r
-        if (enrolleStatus != null && enrolleStatus.getIpAddr() != null) {\r
-            String finalResult = "Easy Connect : ";\r
+        if(enrolleeDevice.getConnectivityType() == OcConnectivityType.IPV4) {\r
+            IPEnrolleeDevice ipEnrolleeDevice = (IPEnrolleeDevice)enrolleeDevice;\r
+            if (ipEnrolleeDevice.getIpAddr() != null) {\r
+                String finalResult = "Easy Connect : ";\r
+                if (ipEnrolleeDevice.isReachable()) {\r
+                    finalResult = "Device OnBoarded" + "["\r
+                            + ipEnrolleeDevice.getIpAddr() + "]";\r
+\r
+                    /*\r
+                     * easySetupInstance.StartEasySetup(enrolleStatus.getIpAddr()) ;\r
+                     * easySetupCount++; Log.i("EasyConnect",\r
+                     * "easy Setup Count-"+easySetupCount); Log.i("EasyConnect",\r
+                     * "IP Address-"+enrolleStatus.getIpAddr());\r
+                     */\r
+                    connectedDevice = ipEnrolleeDevice;\r
+\r
+                    // Only after onboarding is successful, provisioning is performed\r
+                    provisionEnrolleInstance = new ProvisionEnrollee(this);\r
+                    provisionEnrolleInstance.registerProvisioningHandler(this);\r
+\r
+                } else {\r
+                    finalResult = "Device Removed" + "["\r
+                            + ipEnrolleeDevice.getIpAddr() + "]";\r
+                }\r
 \r
-            if (enrolleStatus.isReachable()) {\r
-                finalResult = "Device OnBoarded" + "["\r
-                        + enrolleStatus.getIpAddr() + "]";\r
+                textView1.setText("");\r
+                textView1.append("Clients: \n");\r
+                textView1.append("####################\n");\r
+                textView1.append("IP Address   : " + ipEnrolleeDevice.getIpAddr()\r
+                        + "\n");\r
+                textView1.append("HW Address   : " + ipEnrolleeDevice.getHWAddr()\r
+                        + "\n");\r
+                textView1.append("Is OnBoarded : " + ipEnrolleeDevice.isReachable()\r
+                        + "\n");\r
+\r
+                Toast.makeText(getApplicationContext(), finalResult,\r
+                        Toast.LENGTH_LONG).show();\r
 \r
                 /*\r
-                 * easySetupInstance.StartEasySetup(enrolleStatus.getIpAddr()) ;\r
+                 * myTimer2 = new Timer(); myTimer2.schedule(new TimerTask() {\r
+                 *\r
+                 * @Override public void run() {\r
+                 * easySetupInstance.StartEasySetup(enrolleStatus.getIpAddr());\r
                  * easySetupCount++; Log.i("EasyConnect",\r
                  * "easy Setup Count-"+easySetupCount); Log.i("EasyConnect",\r
-                 * "IP Address-"+enrolleStatus.getIpAddr());\r
+                 * "IP Address-"+enrolleStatus.getIpAddr()); }\r
+                 *\r
+                 * }, 0, 10000);\r
                  */\r
-                connectedDevice = enrolleStatus;\r
-\r
-                // Only after onboarding is successful, provisioning is performed\r
-                provisionEnrolleInstance = new ProvisionEnrollee(this);\r
-                provisionEnrolleInstance.registerProvisioningHandler(this);\r
-\r
-            } else {\r
-                finalResult = "Device Removed" + "["\r
-                        + enrolleStatus.getIpAddr() + "]";\r
             }\r
-\r
-            textView1.setText("");\r
-            textView1.append("Clients: \n");\r
-            textView1.append("####################\n");\r
-            textView1.append("IP Address       : " + enrolleStatus.getIpAddr()\r
-                    + "\n");\r
-            textView1.append("Device           : " + enrolleStatus.getDevice() + "\n");\r
-            textView1.append("HW Address       : " + enrolleStatus.getHWAddr()\r
-                    + "\n");\r
-            textView1.append("Is OnBoarded     : " + enrolleStatus.isReachable()\r
-                    + "\n");\r
-\r
-            Toast.makeText(getApplicationContext(), finalResult,\r
-                    Toast.LENGTH_LONG).show();\r
-\r
-            /*\r
-             * myTimer2 = new Timer(); myTimer2.schedule(new TimerTask() {\r
-             *\r
-             * @Override public void run() {\r
-             * easySetupInstance.StartEasySetup(enrolleStatus.getIpAddr());\r
-             * easySetupCount++; Log.i("EasyConnect",\r
-             * "easy Setup Count-"+easySetupCount); Log.i("EasyConnect",\r
-             * "IP Address-"+enrolleStatus.getIpAddr()); }\r
-             *\r
-             * }, 0, 10000);\r
-             */\r
         }\r
     }\r
 \r
diff --git a/service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/layout/capture.xml b/service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/layout/capture.xml
deleted file mode 100644 (file)
index e348ab0..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2008 ZXing authors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-             android:layout_width="fill_parent"
-             android:layout_height="fill_parent">
-
-  <SurfaceView android:id="@+id/preview_view"
-               android:layout_width="fill_parent"
-               android:layout_height="fill_parent">
-  </SurfaceView>
-
-  <com.jwetherell.quick_response_code.ViewfinderView
-      android:id="@+id/viewfinder_view"
-      android:layout_width="fill_parent"
-      android:layout_height="fill_parent"
-      android:background="@color/transparent">
-  </com.jwetherell.quick_response_code.ViewfinderView>
-
-  <LinearLayout android:id="@+id/result_view"
-                android:orientation="horizontal"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent"
-                android:background="@color/result_view"
-                android:gravity="center"
-                android:padding="4dip">
-        <Button
-        android:id="@+id/cancelButton"
-        android:layout_width="50dip"
-        android:layout_height="50dip"
-        android:layout_alignParentTop="true"
-        android:layout_margin="10dp"
-        android:layout_marginTop="28dp"
-        android:elegantTextHeight="true"
-        android:background="@drawable/cancel"
-        android:textSize="18sp" />
-        
-    <LinearLayout
-      android:orientation="vertical"
-      android:layout_width="wrap_content"
-      android:layout_height="fill_parent"
-      android:gravity="right|center_vertical">
-
-      <ImageView android:id="@+id/barcode_image_view"
-                 android:layout_width="160dip"
-                 android:layout_height="wrap_content"
-                 android:maxWidth="160dip"
-                 android:maxHeight="160dip"
-                 android:layout_marginBottom="4dip"
-                 android:adjustViewBounds="true"
-                 android:scaleType="centerInside"
-                 android:contentDescription="@string/barcode_image">
-      </ImageView>
-
-      <LinearLayout
-        android:orientation="horizontal"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content">
-        <TextView android:id="@+id/format_text_view_label"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:text="@string/msg_default_format"
-                  android:textColor="@color/result_minor_text"
-                  android:textStyle="bold"
-                  android:textSize="14sp"
-                  android:paddingRight="4dip">
-        </TextView>
-        <TextView android:id="@+id/format_text_view"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:textColor="@color/result_minor_text"
-                  android:textSize="14sp">
-        </TextView>
-      </LinearLayout>
-
-      <LinearLayout
-        android:orientation="horizontal"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content">
-        <TextView android:id="@+id/type_text_view_label"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:text="@string/msg_default_type"
-                  android:textColor="@color/result_minor_text"
-                  android:textStyle="bold"
-                  android:textSize="14sp"
-                  android:paddingRight="4dip">
-        </TextView>
-        <TextView android:id="@+id/type_text_view"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:textColor="@color/result_minor_text"
-                  android:textSize="14sp">
-        </TextView>
-      </LinearLayout>
-       
-      <LinearLayout
-        android:orientation="horizontal"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content">
-        <TextView android:id="@+id/time_text_view_label"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:text="@string/msg_default_time"
-                  android:textColor="@color/result_minor_text"
-                  android:textStyle="bold"
-                  android:textSize="14sp"
-                  android:paddingRight="4dip">
-        </TextView>
-        <TextView android:id="@+id/time_text_view"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:textColor="@color/result_minor_text"
-                  android:textSize="14sp">
-        </TextView>
-      </LinearLayout>
-        
-      <LinearLayout
-        android:orientation="horizontal"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content">
-        <TextView android:id="@+id/meta_text_view_label"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:text="@string/msg_default_meta"
-                  android:textColor="@color/result_minor_text"
-                  android:textStyle="bold"
-                  android:textSize="14sp"
-                  android:paddingRight="4dip">
-        </TextView>
-        <TextView android:id="@+id/meta_text_view"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:textColor="@color/result_minor_text"
-                  android:textSize="14sp">
-        </TextView>
-      </LinearLayout>
-    
-    </LinearLayout>
-
-    <ScrollView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content">
-      <LinearLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:orientation="vertical">
-        <TextView android:id="@+id/contents_text_view"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:textColor="@color/result_text"
-                  android:textColorLink="@color/result_text"
-                  android:textSize="22sp"
-                  android:paddingLeft="12dip">
-        </TextView>
-      </LinearLayout>
-    </ScrollView>
-
-  </LinearLayout>
-
-  <TextView android:id="@+id/status_view"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="bottom|center_horizontal"
-            android:background="@color/transparent"
-            android:text="@string/msg_default_status"
-            android:textColor="@color/status_text"
-            android:textSize="14sp">
-  </TextView>
-
-</FrameLayout>
\ No newline at end of file
diff --git a/service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/layout/decoder.xml b/service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/layout/decoder.xml
deleted file mode 100644 (file)
index 2471abb..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2008 ZXing authors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-             android:layout_width="fill_parent"
-             android:layout_height="fill_parent">
-
-  <SurfaceView android:id="@+id/preview_view"
-               android:layout_width="fill_parent"
-               android:layout_height="fill_parent">
-  </SurfaceView>
-
-  <com.jwetherell.quick_response_code.ViewfinderView
-      android:id="@+id/viewfinder_view"
-      android:layout_width="fill_parent"
-      android:layout_height="fill_parent"
-      android:background="@color/transparent">
-  </com.jwetherell.quick_response_code.ViewfinderView>
-
-  <TextView android:id="@+id/status_view"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="bottom|center_horizontal"
-            android:background="@color/transparent"
-            android:text="@string/msg_default_status"
-            android:textColor="@color/status_text"
-            android:textSize="14sp"/>
-
-</FrameLayout>
diff --git a/service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/layout/encoder.xml b/service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/layout/encoder.xml
deleted file mode 100644 (file)
index 586fb1e..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2008 ZXing authors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/encode_view"
-              android:layout_width="fill_parent"
-              android:layout_height="fill_parent"
-              android:fillViewport="true"
-              android:background="@color/encode_view"
-              android:orientation="vertical"
-              android:gravity="center">
-
-  <ImageView android:id="@+id/image_view"
-             android:layout_width="fill_parent"
-             android:layout_height="wrap_content"
-             android:layout_gravity="center_horizontal"
-             android:scaleType="center"
-             android:contentDescription="@string/barcode_image"/>
-
-  <ScrollView android:layout_width="fill_parent"
-              android:layout_height="wrap_content"
-              android:layout_gravity="center_horizontal"
-              android:gravity="center">
-
-    <TextView android:id="@+id/contents_text_view"
-              android:layout_width="fill_parent"
-              android:layout_height="wrap_content"
-              android:layout_gravity="center_horizontal"
-              android:gravity="center"
-              android:textColor="@color/contents_text"
-              android:textSize="18sp"
-              android:paddingBottom="8dip"
-              android:paddingLeft="8dip"
-              android:paddingRight="8dip"/>
-
-  </ScrollView>
-
-</LinearLayout>
diff --git a/service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/values/colors.xml b/service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/values/colors.xml
deleted file mode 100644 (file)
index 4643dce..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2008 ZXing authors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<resources>  
-  <color name="transparent">#00000000</color>
-  
-  <color name="contents_text">#ff000000</color>
-  
-  <color name="encode_view">#ffffffff</color>
-
-  <color name="possible_result_points">#c07FFF00</color>
-  
-  <color name="result_image_border">#ff526F35</color>
-  <color name="result_minor_text">#ffc0c0c0</color>
-  <color name="result_points">#c07FFF00</color>
-  <color name="result_text">#ffffffff</color>
-  <color name="result_view">#b0000000</color>
-
-  <color name="status_view">#50000000</color>
-  <color name="status_text">#ffffffff</color>
-
-  <color name="viewfinder_frame">#ff526F35</color>
-  <color name="viewfinder_laser">#ff7FFF00</color>
-  <color name="viewfinder_mask">#607CFC00</color>
-</resources>
diff --git a/service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/values/ids.xml b/service/easy-setup/sampleapp/android/EasySetup/app/src/main/res/values/ids.xml
deleted file mode 100644 (file)
index 45b2fe1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2008 ZXing authors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<resources>
-  <!-- Messages IDs -->
-  <item type="id" name="auto_focus"/>
-  <item type="id" name="decode"/>
-  <item type="id" name="decode_failed"/>
-  <item type="id" name="decode_succeeded"/>
-  <item type="id" name="quit"/>
-  <item type="id" name="restart_preview"/>
-  <item type="id" name="return_scan_result"/>
-</resources>
index 6a9aa12..94af49e 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-
     <string name="app_name">Easy Setup</string>
     <string name="action_settings">Settings</string>
     <string name="textview2">Device Information</string>
@@ -9,43 +8,5 @@
        <string name="start_easy_setup">Start Easy Setup</string> 
        <string name="start_soft_ap">Start Wi-Fi Soft AP</string>
        <string name="stop_soft_ap">Stop Soft AP</string>  
-    <string name="provision_device">Provision Connected Device</string>    
-    
-       <string name="capture_name">QR Code Capture</string>
-       <string name="encoder_name">QR Code Encoder</string>
-       <string name="decoder_name">QR Code Decoder</string>
-       
-       <string name="contents_contact">Contact info</string>
-       <string name="contents_email">Email address</string>
-       <string name="contents_location">Geographic coordinates</string>
-       <string name="contents_phone">Phone number</string>
-       <string name="contents_sms">SMS address</string>
-       <string name="contents_text">Plain text</string>
-       
-       <string name="msg_default_contents">Contents</string>
-       <string name="msg_default_format">Format</string>
-       <string name="msg_default_meta">Metadata</string>
-       <string name="msg_default_mms_subject">Hi</string>
-       <string name="msg_default_status">Place a QR code inside the viewfinder rectangle to scan it.</string>
-       <string name="msg_default_time">Time</string>
-       <string name="msg_default_type">Type</string>
-       
-       <string name="result_address_book">Found contact info</string>
-       <string name="result_calendar">Found calendar event</string>
-       <string name="result_email_address">Found email address</string>
-       <string name="result_geo">Found geographic coordinates</string>
-       <string name="result_isbn">Found book</string>
-       <string name="result_product">Found product</string>
-       <string name="result_sms">Found SMS address</string>
-       <string name="result_tel">Found phone number</string>
-       <string name="result_text">Found plain text</string>
-       <string name="result_uri">Found URL</string>
-       <string name="result_wifi">Found WLAN Configuration</string>
-       
-       <string name="wifi_changing_network">Changing Network</string>
-       <string name="wifi_ssid_label">Network Name</string>
-       <string name="wifi_type_label">Type</string>
-       
-       <string name="barcode_image">Barcode Image</string>
-
+    <string name="provision_device">Provision Connected Device</string>
 </resources>
index 639192d..995ecfb 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.id=":easySetupCore-debug" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EasySetupGradle" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
+<module external.linked.project.id=":easySetupCore-debug" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EasySetup" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
   <component name="FacetManager">
     <facet type="android-gradle" name="Android-Gradle">
       <configuration>
index 905c956..8f28f8f 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.id=":iotivity-armeabi-base-debug" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EasySetupGradle" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
+<module external.linked.project.id=":iotivity-armeabi-base-debug" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EasySetup" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
   <component name="FacetManager">
     <facet type="android-gradle" name="Android-Gradle">
       <configuration>
index 9e550de..c1f2134 100644 (file)
@@ -30,7 +30,11 @@ android {
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'\r
         }\r
     }\r
+    sourceSets {\r
+        main { java.srcDirs = ['src/main/java', 'src/main/java/common', 'src/main/java/interface'] }\r
+    }\r
 }\r
 \r
 dependencies {\r
+    compile project(':iotivity-armeabi-base-debug')\r
 }
\ No newline at end of file
index 14046e3..d3af2de 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.id="easySetupCore" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
+<module external.linked.project.id="EasySetupCore" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
   <component name="FacetManager">
     <facet type="android-gradle" name="Android-Gradle">
       <configuration>
@@ -19,7 +19,6 @@
         <option name="ALLOW_USER_CONFIGURATION" value="false" />
         <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
         <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
-        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
         <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
         <option name="LIBRARY_PROJECT" value="true" />
       </configuration>
@@ -54,6 +53,8 @@
       <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java/common" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java/interface" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
@@ -70,6 +71,7 @@
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/EasySetupCore/iotivity-armeabi-base-debug/unspecified/jars" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
@@ -87,5 +89,7 @@
     </content>
     <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="iotivity-armeabi-base-debug" exported="" />
+    <orderEntry type="library" exported="" name="iotivity-armeabi-base-debug-unspecified" level="project" />
   </component>
 </module>
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/settings.gradle b/service/easy-setup/sdk/mediator/android/EasySetupCore/settings.gradle
new file mode 100644 (file)
index 0000000..3f6e49d
--- /dev/null
@@ -0,0 +1 @@
+include ':iotivity-armeabi-base-debug'
\ No newline at end of file
index 5c59c97..2137f60 100644 (file)
@@ -22,7 +22,7 @@ package org.iotivity.service.easysetup.mediator;
 import android.util.Log;\r
 \r
 public class EasySetupCallbackHandler {\r
-    private static final String             TAG = "EasySetupCallbackHandler";\r
+    private static final String             TAG = "ESCallbackHandler";\r
     ProvisionEnrollee                       provisioningListener;\r
 \r
     private static EasySetupCallbackHandler easySetupCallbackHandlerObj;\r
@@ -36,9 +36,7 @@ public class EasySetupCallbackHandler {
 \r
     public void ProvisioningStatusCallBack(int statuscode) {\r
         // TODO Auto-generated method stub\r
-        Log.d(TAG,\r
-                "onFinishProvisioning() inside Android Java application. statuscode - "\r
-                        + statuscode);\r
+        Log.d(TAG, "onFinishProvisioning(). statuscode - " + statuscode);\r
         if (this.provisioningListener != null) {\r
             this.provisioningListener.ProvisioningStatusCallBack(statuscode);\r
         } else {\r
index 0319f79..b65f785 100644 (file)
@@ -21,34 +21,15 @@ package org.iotivity.service.easysetup.mediator;
 \r
 import android.content.Context;\r
 \r
-//import org.iotivity.ca.CaInterface;\r
-\r
 public class EasySetupManager {\r
     private native void InitEasySetup();\r
-\r
     private native void TerminateEasySetup();\r
-\r
-    // TODO : "OcConnectivityType connectivityType" has to be passed as the\r
-    // second parameter for PerformEasySetup\r
-    // instead of integer\r
     private native void ProvisionEnrollee(String ipAddress, String netSSID,\r
             String netPWD, int connectivityType);\r
-\r
     private native void StopEnrolleeProvisioning(int connectivityType);\r
-\r
-    public static native void initialize(Context context);\r
-\r
     private static EasySetupManager easySetupManagerInterfaceObj = null;\r
     private Context                 appContext                   = null;\r
 \r
-    static {\r
-        // Load Easy Setup JNI interface\r
-        System.loadLibrary("gnustl_shared");\r
-        System.loadLibrary("octbstack");\r
-        System.loadLibrary("connectivity_abstraction");\r
-        System.loadLibrary("easysetup-jni");\r
-    }\r
-\r
     private EasySetupManager() {\r
 \r
     }\r
@@ -66,12 +47,7 @@ public class EasySetupManager {
         return easySetupManagerInterfaceObj;\r
     }\r
 \r
-    public void setApplicationContext(Context context) {\r
-        appContext = context;\r
-    }\r
-\r
     public void initEasySetup() {\r
-        // CaInterface.initialize(appContext);\r
         InitEasySetup();\r
     }\r
 \r
@@ -79,7 +55,7 @@ public class EasySetupManager {
         TerminateEasySetup();\r
     }\r
 \r
-    public void provisionEnrollee(String ipAddress, String netSSID,\r
+    public void provisionIPEnrollee(String ipAddress, String netSSID,\r
             String netPWD, int connectivityType) {\r
 \r
         ProvisionEnrollee(ipAddress, netSSID, netPWD, connectivityType);\r
index 161b7fb..fa7e8b4 100644 (file)
  ******************************************************************/
 package org.iotivity.service.easysetup.mediator;
 
+import org.iotivity.service.easysetup.mediator.common.EnrolleeDevice;
+
 public class EnrolleeOnBoardingInfo {
 
-    private String  IpAddr;
-    private String  HWAddr;
-    private String  Device;
+    private EnrolleeDevice enrolleeDevice;
     private boolean isReachable;
     private boolean isAdditionNotified;
     private boolean isRemovalNotified;
 
-    public EnrolleeOnBoardingInfo(String ipAddr, String hWAddr, String device,
+    public EnrolleeOnBoardingInfo(EnrolleeDevice enrolleeDevice,
             boolean isReachable, boolean isRemovalNotified,
             boolean isAdditionNotified) {
-        this.IpAddr = ipAddr;
-        this.HWAddr = hWAddr;
-        this.Device = device;
+        this.enrolleeDevice = enrolleeDevice;
         this.isReachable = isReachable;
         this.isRemovalNotified = isRemovalNotified;
         this.isAdditionNotified = isAdditionNotified;
     }
 
-    public String getIpAddr() {
-        return IpAddr;
-    }
-
-    public void setIpAddr(String ipAddr) {
-        IpAddr = ipAddr;
-    }
-
-    public String getHWAddr() {
-        return HWAddr;
-    }
-
-    public void setHWAddr(String hWAddr) {
-        HWAddr = hWAddr;
-    }
-
-    public String getDevice() {
-        return Device;
+    public void setEnrolleeDevice(EnrolleeDevice enrolleeDevice) {
+        this.enrolleeDevice = enrolleeDevice;
     }
 
-    public void setDevice(String device) {
-        Device = device;
+    public EnrolleeDevice getEnrolleeDevice() {
+        return this.enrolleeDevice;
     }
 
     public boolean isReachable() {
index fff0634..a7bc24d 100644 (file)
@@ -19,9 +19,7 @@
  ******************************************************************/
 package org.iotivity.service.easysetup.mediator;
 
-import java.util.ArrayList;
-
-import org.iotivity.service.easysetup.mediator.EnrolleeInfo;
+import org.iotivity.service.easysetup.mediator.common.EnrolleeDevice;
 
 public interface IOnBoardingStatus {
 
@@ -29,10 +27,10 @@ public interface IOnBoardingStatus {
      * Interface called when the scan method finishes. Network operations should
      * not execute on UI thread
      * 
-     * @param ArrayList
-     *            of {@link EnrolleeInfo}
+     * @param enrolleeDevice
+     *            of {@link EnrolleeDevice}
      */
 
-    public void deviceOnBoardingStatus(EnrolleeInfo clients);
+    public void deviceOnBoardingStatus(EnrolleeDevice enrolleeDevice);
 
 }
index 2f07442..87f8a8f 100644 (file)
 package org.iotivity.service.easysetup.mediator;\r
 \r
 import android.content.Context;\r
-import android.net.wifi.WifiConfiguration;\r
-import android.widget.Toast;\r
+\r
+import org.iotivity.base.OcConnectivityType;\r
+import org.iotivity.service.easysetup.mediator.common.OnBoardingConfig;\r
+import org.iotivity.service.easysetup.mediator.ip.WiFiSoftAPManager;\r
+import org.iotivity.service.easysetup.mediator.ip.WiFiSoftAPOnBoardingConfig;\r
 \r
 public class OnBoardEnrollee {\r
     WiFiSoftAPManager wifiSoftAPManager;\r
     IOnBoardingStatus deviceScanListener;\r
+    OcConnectivityType selectedConnectivityType;\r
 \r
     /**\r
-     * Constructor for OnBoardEnrollee. Constructs a new OnBoardEnrollee.\r
+     * Constructor for OnBoardEnrollee.\r
      */\r
-    public OnBoardEnrollee(Context context) {\r
-        wifiSoftAPManager = new WiFiSoftAPManager(context);\r
+    public OnBoardEnrollee(Context context, OcConnectivityType connectivityType) {\r
+        if(connectivityType == OcConnectivityType.IPV4) {\r
+            wifiSoftAPManager = new WiFiSoftAPManager(context);\r
+        }\r
+        this.selectedConnectivityType = connectivityType;\r
     }\r
 \r
     public void registerOnBoardingStatusHandler(\r
@@ -39,15 +46,23 @@ public class OnBoardEnrollee {
         this.deviceScanListener = deviceScanListener;\r
     }\r
 \r
-    public void startDeviceScan() {\r
-        wifiSoftAPManager.getClientList(false, this.deviceScanListener);\r
+    public void startDeviceScan(final int reachableTimeout) {\r
+        if(selectedConnectivityType == OcConnectivityType.IPV4) {\r
+            wifiSoftAPManager.getClientList(this.deviceScanListener, reachableTimeout);\r
+        }\r
     }\r
 \r
-    public void enableWiFiAP(WifiConfiguration netConfig, boolean enabled) {\r
-        wifiSoftAPManager.setWifiApEnabled(netConfig, true);\r
+    public void enableNetwork(OnBoardingConfig transportConfig, boolean enabled) {\r
+        if(selectedConnectivityType == OcConnectivityType.IPV4) {\r
+            wifiSoftAPManager.setWifiApEnabled(\r
+                    ((WiFiSoftAPOnBoardingConfig)transportConfig).getNetConfig(),\r
+                    true);\r
+        }\r
     }\r
 \r
     public void disableWiFiAP() {\r
-        wifiSoftAPManager.setWifiApEnabled(null, false);\r
+        if(selectedConnectivityType == OcConnectivityType.IPV4) {\r
+            wifiSoftAPManager.setWifiApEnabled(null, false);\r
+        }\r
     }\r
 }\r
index a315aa2..91c8d20 100644 (file)
@@ -3,19 +3,27 @@ package org.iotivity.service.easysetup.mediator;
 import android.content.Context;\r
 import android.util.Log;\r
 \r
+import org.iotivity.base.OcConnectivityType;\r
+import org.iotivity.service.easysetup.mediator.common.ProvisioningInfo;\r
+import org.iotivity.service.easysetup.mediator.ip.IPProvisioningInfo;\r
+\r
 public class ProvisionEnrollee {\r
     private static final String   TAG                            = "ProvisionEnrollee";\r
-    private Context               appContext                     = null;\r
     private EasySetupManager      easySetupManagerNativeInstance = null;\r
     private IProvisioningListener provisioningListener;\r
 \r
+    static {\r
+        // Load Easy Setup JNI interface\r
+        System.loadLibrary("gnustl_shared");\r
+        System.loadLibrary("octbstack");\r
+        System.loadLibrary("connectivity_abstraction");\r
+        System.loadLibrary("easysetup-jni");\r
+    }\r
     /**\r
      * Constructor for ProvisionEnrollee. Constructs a new ProvisionEnrollee.\r
      */\r
     public ProvisionEnrollee(Context context) {\r
-        appContext = context;\r
         easySetupManagerNativeInstance = EasySetupManager.getInstance();\r
-        easySetupManagerNativeInstance.initEasySetup();\r
     }\r
     \r
     @Override\r
@@ -24,15 +32,22 @@ public class ProvisionEnrollee {
         easySetupManagerNativeInstance.terminateEasySetup();\r
     }\r
 \r
-    public void provisionEnrollee(String ipAddress, String netSSID,\r
-            String netPWD, int connectivityType) {\r
-        easySetupManagerNativeInstance.provisionEnrollee(ipAddress, netSSID,\r
-                netPWD, connectivityType);\r
+    public void provisionEnrollee(ProvisioningInfo provisioningInfo,\r
+                                  OcConnectivityType connectivityType) {\r
+        if(connectivityType == OcConnectivityType.IPV4)\r
+        {\r
+            easySetupManagerNativeInstance.initEasySetup();\r
+            easySetupManagerNativeInstance.provisionIPEnrollee(\r
+                    ((IPProvisioningInfo)provisioningInfo).getIpAddress(),\r
+                    ((IPProvisioningInfo)provisioningInfo).getNetSSID(),\r
+                    ((IPProvisioningInfo)provisioningInfo).getNetPWD(),\r
+                    OcConnectivityType.IPV4.getValue());\r
+        }\r
     }\r
 \r
-    public void stopEnrolleeProvisioning(int connectivityType) {\r
+    public void stopEnrolleeProvisioning(OcConnectivityType connectivityType) {\r
         easySetupManagerNativeInstance\r
-                .stopEnrolleeProvisioning(connectivityType);\r
+                .stopEnrolleeProvisioning(OcConnectivityType.IPV4.getValue());\r
     }\r
 \r
     public void ProvisioningStatusCallBack(int statuscode) {\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiSoftAPManager.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiSoftAPManager.java
deleted file mode 100644 (file)
index 0c51b22..0000000
+++ /dev/null
@@ -1,342 +0,0 @@
-/******************************************************************
- *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
-package org.iotivity.service.easysetup.mediator;
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.util.ArrayList;
-
-import android.content.Context;
-import android.net.wifi.WifiConfiguration;
-import android.net.wifi.WifiManager;
-import android.os.Handler;
-import android.util.Log;
-
-public class WiFiSoftAPManager {
-    private final WifiManager                mWifiManager;
-    private Context                          context;
-    static ArrayList<EnrolleeOnBoardingInfo> appNotification = new ArrayList<EnrolleeOnBoardingInfo>();
-    IOnBoardingStatus                        finishListener  = null;
-
-    public enum WIFI_AP_STATE {
-        WIFI_AP_STATE_DISABLING, WIFI_AP_STATE_DISABLED, WIFI_AP_STATE_ENABLING, WIFI_AP_STATE_ENABLED, WIFI_AP_STATE_FAILED
-    }
-
-    public WiFiSoftAPManager(Context context) {
-        this.context = context;
-        mWifiManager = (WifiManager) this.context
-                .getSystemService(Context.WIFI_SERVICE);
-    }
-
-    /**
-     * Start AccessPoint mode with the specified configuration. If the radio is
-     * already running in AP mode, update the new configuration Note that
-     * starting in access point mode disables station mode operation
-     *
-     * @param wifiConfig
-     *            SSID, security and channel details as part of
-     *            WifiConfiguration
-     * @return {@code true} if the operation succeeds, {@code false} otherwise
-     */
-    public boolean setWifiApEnabled(WifiConfiguration wifiConfig,
-            boolean enabled) {
-        try {
-            if (enabled) { // disable WiFi in any case
-                mWifiManager.setWifiEnabled(false);
-            }
-
-            Method method = mWifiManager.getClass().getMethod(
-                    "setWifiApEnabled", WifiConfiguration.class, boolean.class);
-            return (Boolean) method.invoke(mWifiManager, wifiConfig, enabled);
-        } catch (Exception e) {
-            Log.e(this.getClass().toString(), "", e);
-            return false;
-        }
-    }
-
-    /**
-     * Gets the Wi-Fi enabled state.
-     *
-     * @return {@link WIFI_AP_STATE}
-     * @see #isWifiApEnabled()
-     */
-    public WIFI_AP_STATE getWifiApState() {
-        try {
-            Method method = mWifiManager.getClass().getMethod("getWifiApState");
-
-            int tmp = ((Integer) method.invoke(mWifiManager));
-
-            // Fix for Android 4
-            if (tmp >= 10) {
-                tmp = tmp - 10;
-            }
-
-            return WIFI_AP_STATE.class.getEnumConstants()[tmp];
-        } catch (Exception e) {
-            Log.e(this.getClass().toString(), "", e);
-            return WIFI_AP_STATE.WIFI_AP_STATE_FAILED;
-        }
-    }
-
-    /**
-     * Return whether Wi-Fi AP is enabled or disabled.
-     *
-     * @return {@code true} if Wi-Fi AP is enabled
-     * @see #getWifiApState()
-     *
-     * @hide Dont open yet
-     */
-    public boolean isWifiApEnabled() {
-        return getWifiApState() == WIFI_AP_STATE.WIFI_AP_STATE_ENABLED;
-    }
-
-    /**
-     * Gets the Wi-Fi AP Configuration.
-     *
-     * @return AP details in {@link WifiConfiguration}
-     */
-    public WifiConfiguration getWifiApConfiguration() {
-        try {
-            Method method = mWifiManager.getClass().getMethod(
-                    "getWifiApConfiguration");
-            return (WifiConfiguration) method.invoke(mWifiManager);
-        } catch (Exception e) {
-            Log.e(this.getClass().toString(), "", e);
-            return null;
-        }
-    }
-
-    /**
-     * Sets the Wi-Fi AP Configuration.
-     *
-     * @return {@code true} if the operation succeeded, {@code false} otherwise
-     */
-    public boolean setWifiApConfiguration(WifiConfiguration wifiConfig) {
-        try {
-            Method method = mWifiManager.getClass().getMethod(
-                    "setWifiApConfiguration", WifiConfiguration.class);
-            return (Boolean) method.invoke(mWifiManager, wifiConfig);
-        } catch (Exception e) {
-            Log.e(this.getClass().toString(), "", e);
-            return false;
-        }
-    }
-
-    /**
-     * Gets a list of the clients connected to the Hotspot, reachable timeout is
-     * 300
-     *
-     * @param onlyReachables
-     *            {@code false} if the list should contain unreachable (probably
-     *            disconnected) clients, {@code true} otherwise
-     * @param finishListener
-     *            , Interface called when the scan method finishes
-     */
-    public void getClientList(boolean onlyReachables,
-            IOnBoardingStatus finishListener) {
-        this.finishListener = finishListener;
-        getClientList(onlyReachables, 300);
-    }
-
-    /**
-     * Gets a list of the clients connected to the Hotspot
-     *
-     * @param onlyReachables
-     *            {@code false} if the list should contain unreachable (probably
-     *            disconnected) clients, {@code true} otherwise
-     * @param reachableTimeout
-     *            Reachable Timeout in miliseconds
-     * @param finishListener
-     *            , Interface called when the scan method finishes
-     */
-    public void getClientList(final boolean onlyReachables,
-            final int reachableTimeout) {
-
-        Runnable runnable = new Runnable() {
-            public void run() {
-
-                BufferedReader br = null;
-                final EnrolleeInfo result = new EnrolleeInfo();
-
-                try {
-                    br = new BufferedReader(new FileReader("/proc/net/arp"));
-                    String line;
-                    while ((line = br.readLine()) != null) {
-                        boolean deviceAddedToList = false;
-
-                        String[] splitted = line.split(" +");
-
-                        if ((splitted != null) && (splitted.length >= 4)) {
-                            // Basic sanity check
-                            String mac = splitted[3];
-
-                            if (mac.matches("..:..:..:..:..:..")) {
-                                boolean isReachable = InetAddress.getByName(
-                                        splitted[0]).isReachable(
-                                        reachableTimeout);
-
-                                // String execStatement =
-                                // "ping -c 1 "+splitted[0];
-                                //
-                                // Process p1 =
-                                // java.lang.Runtime.getRuntime().exec(execStatement);
-                                //
-                                // int returnVal = p1.waitFor();
-                                // boolean isReachable = (returnVal==0);
-
-                                Log.i("exec statement", splitted[0]);
-                                Log.i("Return Value", " " + isReachable);
-
-                                if (appNotification.size() > 0) {
-                                    for (EnrolleeOnBoardingInfo ipDeviceOnBoardingNotification : appNotification) {
-                                        boolean macAddressComparison = ipDeviceOnBoardingNotification
-                                                .getHWAddr().equalsIgnoreCase(
-                                                        mac) ? true : false;
-
-                                        if (macAddressComparison) {
-                                            deviceAddedToList = true;
-
-                                            if (ipDeviceOnBoardingNotification
-                                                    .isAdditionNotified()
-                                                    && isReachable) {
-                                                continue;
-                                            } else if (ipDeviceOnBoardingNotification
-                                                    .isRemovalNotified()
-                                                    && !isReachable) {
-                                                continue;
-                                            } else {
-                                                result.setIpAddr(splitted[0]);
-                                                result.setHWAddr(splitted[3]);
-                                                result.setDevice(splitted[5]);
-                                                result.setReachable(isReachable);
-
-                                                appNotification
-                                                        .remove(ipDeviceOnBoardingNotification);
-                                                if (isReachable) {
-                                                    appNotification
-                                                            .add(new EnrolleeOnBoardingInfo(
-                                                                    splitted[0],
-                                                                    splitted[3],
-                                                                    splitted[5],
-                                                                    isReachable,
-                                                                    false, true));
-                                                } else {
-                                                    appNotification
-                                                            .add(new EnrolleeOnBoardingInfo(
-                                                                    splitted[0],
-                                                                    splitted[3],
-                                                                    splitted[5],
-                                                                    isReachable,
-                                                                    true, false));
-                                                }
-
-                                                NotifyApplication(result);
-                                            }
-                                        }
-                                    }
-                                    if (!deviceAddedToList) {
-                                        if (isReachable) {
-                                            appNotification
-                                                    .add(new EnrolleeOnBoardingInfo(
-                                                            splitted[0],
-                                                            splitted[3],
-                                                            splitted[5],
-                                                            isReachable, false,
-                                                            true));
-                                        } else {
-                                            appNotification
-                                                    .add(new EnrolleeOnBoardingInfo(
-                                                            splitted[0],
-                                                            splitted[3],
-                                                            splitted[5],
-                                                            isReachable, true,
-                                                            false));
-                                        }
-
-                                        result.setIpAddr(splitted[0]);
-                                        result.setHWAddr(splitted[3]);
-                                        result.setDevice(splitted[5]);
-                                        result.setReachable(isReachable);
-
-                                        NotifyApplication(result);
-
-                                        break;
-                                    }
-                                } else {
-                                    if (isReachable) {
-                                        appNotification
-                                                .add(new EnrolleeOnBoardingInfo(
-                                                        splitted[0],
-                                                        splitted[3],
-                                                        splitted[5],
-                                                        isReachable, false,
-                                                        true));
-                                    } else {
-                                        appNotification
-                                                .add(new EnrolleeOnBoardingInfo(
-                                                        splitted[0],
-                                                        splitted[3],
-                                                        splitted[5],
-                                                        isReachable, true,
-                                                        false));
-                                    }
-
-                                    result.setIpAddr(splitted[0]);
-                                    result.setHWAddr(splitted[3]);
-                                    result.setDevice(splitted[5]);
-                                    result.setReachable(isReachable);
-
-                                    NotifyApplication(result);
-                                    break;
-                                }
-                            }
-                        }
-                    }
-                } catch (Exception e) {
-                    Log.e(this.getClass().toString(), e.toString());
-                } finally {
-                    try {
-                        br.close();
-                    } catch (IOException e) {
-                        Log.e(this.getClass().toString(), e.getMessage());
-                    }
-                }
-            }
-        };
-
-        Thread mythread = new Thread(runnable);
-        mythread.start();
-    }
-
-    void NotifyApplication(final EnrolleeInfo result) {
-        // Get a handler that can be used to post to the main thread
-        Handler mainHandler = new Handler(context.getMainLooper());
-        Runnable myRunnable = new Runnable() {
-            @Override
-            public void run() {
-                finishListener.deviceOnBoardingStatus(result);
-            }
-        };
-        mainHandler.post(myRunnable);
-    }
-}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/EnrolleeDevice.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/EnrolleeDevice.java
new file mode 100644 (file)
index 0000000..d76c37f
--- /dev/null
@@ -0,0 +1,48 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+package org.iotivity.service.easysetup.mediator.common;
+
+import org.iotivity.base.OcConnectivityType;
+
+/*
+* EnrolleeDevice is a super class for handling Enrollees on different transports.
+* All the transport specific Enrollee Devices inherit from this base class and provide the
+* transport specific implementation in the transport specific subclasses.
+*/
+public class EnrolleeDevice {
+    private OcConnectivityType connectivityType;
+    private boolean isReachable;
+
+    public boolean isReachable() {
+        return isReachable;
+    }
+
+    public void setReachable(boolean isReachable) {
+        this.isReachable = isReachable;
+    }
+
+    public OcConnectivityType getConnectivityType() {
+        return connectivityType;
+    }
+
+    public void setConnectivityType(OcConnectivityType connectivityType) {
+        this.connectivityType = connectivityType;
+    }
+}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/EnrolleeDeviceFactory.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/EnrolleeDeviceFactory.java
new file mode 100644 (file)
index 0000000..3a4333f
--- /dev/null
@@ -0,0 +1,42 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+package org.iotivity.service.easysetup.mediator.common;
+
+import org.iotivity.base.OcConnectivityType;
+import org.iotivity.service.easysetup.mediator.ip.IPEnrolleeDevice;
+
+/*
+* EnrolleeDeviceFactory is a factory class which instantiates a respective transport specific
+* EnrolleeDevice class.
+* This class will be used during the OnBoarding Phase to create a transport specific Enrollee Device
+* after the device is OnBoarded successfully
+* The transport specific instantiation of Enrollee Device will be used in all subsequent operations
+* after OnBoarding
+*/
+public class EnrolleeDeviceFactory {
+    public static EnrolleeDevice getDevice(OcConnectivityType connectivityType)
+    {
+        if(connectivityType == OcConnectivityType.IPV4)
+        {
+            return new IPEnrolleeDevice();
+        }
+        return null;
+    }
+}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/OnBoardingConfig.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/OnBoardingConfig.java
new file mode 100644 (file)
index 0000000..7e65c42
--- /dev/null
@@ -0,0 +1,43 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+package org.iotivity.service.easysetup.mediator.common;
+
+import org.iotivity.base.OcConnectivityType;
+
+/*
+* OnBoardingConfig is a super class for handling different types of transport configurations.
+* OnBoardingConfig will be used during the OnBoarding phase to provide the transport details for
+* OnBoarding Enrollees
+* Transport specific subclasses will be inheriting from OnBoardingConfig to represent transport
+* specific implementations of OnBoardingConfig.
+* The base class provides the connecitivity type information which is needed for dynamic casting of
+* subclasses at runtime.
+*/
+public class OnBoardingConfig {
+    private OcConnectivityType connectivityType;
+
+    public OcConnectivityType getConnectivityType() {
+        return connectivityType;
+    }
+
+    public void setConnectivityType(OcConnectivityType connectivityType) {
+        this.connectivityType = connectivityType;
+    }
+}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/ProvisioningInfo.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/common/ProvisioningInfo.java
new file mode 100644 (file)
index 0000000..b22d47f
--- /dev/null
@@ -0,0 +1,42 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+package org.iotivity.service.easysetup.mediator.common;
+
+import org.iotivity.base.OcConnectivityType;
+
+/*
+* ProvisioningInfo is a super class for handling different types of transport provisioning
+* informations.
+* Different Connectivities have different types of provisioning information. This base class holds
+* the common information that is related to all the subclasses.
+* Transport specific provisioning information will be available with the subclasses of
+* ProvisioningInfo
+*/
+public class ProvisioningInfo {
+    private OcConnectivityType connectivityType;
+
+    public OcConnectivityType getConnectivityType() {
+        return connectivityType;
+    }
+
+    public void setConnectivityType(OcConnectivityType connectivityType) {
+        this.connectivityType = connectivityType;
+    }
+}
  *
  ******************************************************************/
 
-package org.iotivity.service.easysetup.mediator;
+package org.iotivity.service.easysetup.mediator.ip;
 
-public class EnrolleeInfo {
+import org.iotivity.service.easysetup.mediator.common.EnrolleeDevice;
 
+/*
+* IPEnrolleeDevice is a subclass of EnrolleeDevice for creating EnrolleeDevice for WiFi transport.
+*/
+public class IPEnrolleeDevice extends EnrolleeDevice {
     private String  IpAddr;
     private String  HWAddr;
-    private String  Device;
-    private boolean isReachable;
 
     public String getIpAddr() {
         return IpAddr;
@@ -42,21 +44,4 @@ public class EnrolleeInfo {
     public void setHWAddr(String hWAddr) {
         HWAddr = hWAddr;
     }
-
-    public String getDevice() {
-        return Device;
-    }
-
-    public void setDevice(String device) {
-        Device = device;
-    }
-
-    public boolean isReachable() {
-        return isReachable;
-    }
-
-    public void setReachable(boolean isReachable) {
-        this.isReachable = isReachable;
-    }
-
 }
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/IPProvisioningInfo.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/IPProvisioningInfo.java
new file mode 100644 (file)
index 0000000..140c179
--- /dev/null
@@ -0,0 +1,55 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+package org.iotivity.service.easysetup.mediator.ip;
+
+import org.iotivity.service.easysetup.mediator.common.ProvisioningInfo;
+
+/*
+* IPProvisioningInfo is a sub class for handling IP transport provisioning information.
+*/
+public class IPProvisioningInfo extends ProvisioningInfo {
+    private String ipAddress;
+    private String netSSID;
+    private String netPWD;
+
+    public String getIpAddress() {
+        return ipAddress;
+    }
+
+    public void setIpAddress(String ipAddress) {
+        this.ipAddress = ipAddress;
+    }
+
+    public String getNetSSID() {
+        return netSSID;
+    }
+
+    public void setNetSSID(String netSSID) {
+        this.netSSID = netSSID;
+    }
+
+    public String getNetPWD() {
+        return netPWD;
+    }
+
+    public void setNetPWD(String netPWD) {
+        this.netPWD = netPWD;
+    }
+}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/WiFiSoftAPManager.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/WiFiSoftAPManager.java
new file mode 100644 (file)
index 0000000..e7e20dd
--- /dev/null
@@ -0,0 +1,348 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+package org.iotivity.service.easysetup.mediator.ip;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.util.ArrayList;
+
+import android.content.Context;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiManager;
+import android.os.Handler;
+import android.util.Log;
+
+import org.iotivity.base.OcConnectivityType;
+import org.iotivity.service.easysetup.mediator.common.EnrolleeDeviceFactory;
+import org.iotivity.service.easysetup.mediator.EnrolleeOnBoardingInfo;
+import org.iotivity.service.easysetup.mediator.IOnBoardingStatus;
+
+/**
+ * WiFiSoftAPManager provides wrapper methods for accessing Android Soft Access Point functionality.
+ * This is a convenient class, providing Android "WiFiManager" kind of equivalent class for Soft AP.
+ * <p>
+ * Note: Android doesn't provide public APIs for Soft Access Point feature access.
+ * This class provides only reference implementation to use the Soft AP and it uses Java reflection
+ * for access Soft Access point features.
+ * </p>
+ */
+public class WiFiSoftAPManager {
+    private final WifiManager                mWifiManager;
+    private Context                          context;
+    static ArrayList<EnrolleeOnBoardingInfo> appNotification =
+                                                    new ArrayList<EnrolleeOnBoardingInfo>();
+    IOnBoardingStatus finishListener  = null;
+
+    public enum WIFI_AP_STATE {
+        WIFI_AP_STATE_DISABLING,
+        WIFI_AP_STATE_DISABLED,
+        WIFI_AP_STATE_ENABLING,
+        WIFI_AP_STATE_ENABLED,
+        WIFI_AP_STATE_FAILED
+    }
+
+    public WiFiSoftAPManager(Context context) {
+        this.context = context;
+        mWifiManager = (WifiManager) this.context
+                .getSystemService(Context.WIFI_SERVICE);
+    }
+
+    /*
+    * Utility API to check the validity of the MAC Address read from the ARP cache
+    */
+    private boolean CheckIfValidMacAddress(String macAddr)
+    {
+        if(macAddr.matches("..:..:..:..:..:.."))
+        {
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
+
+    /*
+    * The API is used for checking the device entry in the list maintained for the device
+    * notifications.
+    * If device entry is not found in the list, app is notified.
+    * If the device entry is found in the device, as application is already notified it will
+    * continue
+    */
+    private synchronized boolean CheckForDeviceEntryAndNotify(String ipAddr,
+                                                 String macAddr, boolean isReachable)
+    {
+        final IPEnrolleeDevice result = new IPEnrolleeDevice();
+        boolean deviceAddedToList = false;
+
+        result.setConnectivityType(OcConnectivityType.IPV4);
+
+        if (appNotification.size() > 0) {
+            for (EnrolleeOnBoardingInfo ipDeviceOnBoardingNotification : appNotification) {
+                IPEnrolleeDevice ipEnrolleeDevice = (IPEnrolleeDevice)ipDeviceOnBoardingNotification
+                        .getEnrolleeDevice();
+                boolean macAddressComparison = ipEnrolleeDevice.getHWAddr().equalsIgnoreCase(
+                                macAddr) ? true : false;
+
+                if (macAddressComparison) {
+                    deviceAddedToList = true;
+
+                    if (ipDeviceOnBoardingNotification
+                            .isAdditionNotified()
+                            && isReachable) {
+                        continue;
+                    } else if (ipDeviceOnBoardingNotification
+                            .isRemovalNotified()
+                            && !isReachable) {
+                        continue;
+                    } else {
+                        result.setIpAddr(ipAddr);
+                        result.setHWAddr(macAddr);
+                        result.setReachable(isReachable);
+
+                        appNotification
+                                .remove(ipDeviceOnBoardingNotification);
+                        if (isReachable) {
+                            appNotification
+                                    .add(new EnrolleeOnBoardingInfo(ipEnrolleeDevice, isReachable,
+                                            false, true));
+                        } else {
+                            appNotification
+                                    .add(new EnrolleeOnBoardingInfo(ipEnrolleeDevice, isReachable,
+                                            true, false));
+                        }
+
+                        NotifyApplication(result);
+                        return true;
+                    }
+                }
+            }
+            if (!deviceAddedToList) {
+                IPEnrolleeDevice ipEnrolleeDevice = (IPEnrolleeDevice) EnrolleeDeviceFactory.getDevice(
+                        OcConnectivityType.IPV4);
+                ipEnrolleeDevice.setIpAddr(ipAddr);
+                ipEnrolleeDevice.setHWAddr(macAddr);
+                if (isReachable) {
+                    appNotification
+                            .add(new EnrolleeOnBoardingInfo(ipEnrolleeDevice, isReachable, false,
+                                    true));
+                } else {
+                    appNotification
+                            .add(new EnrolleeOnBoardingInfo(ipEnrolleeDevice, isReachable, true,
+                                    false));
+                }
+
+                result.setIpAddr(ipAddr);
+                result.setHWAddr(macAddr);
+                result.setReachable(isReachable);
+
+                NotifyApplication(result);
+                return true;
+            }
+        } else {
+            IPEnrolleeDevice ipEnrolleeDevice = (IPEnrolleeDevice)EnrolleeDeviceFactory.getDevice(
+                    OcConnectivityType.IPV4);
+            ipEnrolleeDevice.setIpAddr(ipAddr);
+            ipEnrolleeDevice.setHWAddr(macAddr);
+            if (isReachable) {
+                appNotification
+                        .add(new EnrolleeOnBoardingInfo(ipEnrolleeDevice, isReachable, false,
+                                true));
+            } else {
+                appNotification
+                        .add(new EnrolleeOnBoardingInfo(ipEnrolleeDevice, isReachable, true,
+                                false));
+            }
+
+            result.setIpAddr(ipAddr);
+            result.setHWAddr(macAddr);
+            result.setReachable(isReachable);
+
+            NotifyApplication(result);
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Start WiFi Soft AccessPoint mode with the specified configuration.
+     * If the Soft AP is already running, this API call will update the new configuration.
+     * <p>
+     * Note: Starting Wi-Fi Soft Access Point will disable the Wi-Fi normal operation.
+     * </p>
+     *
+     * @param wifiConfig
+     *            SSID, security and channel details as part of WifiConfiguration
+     * @return {@code true} if the operation succeeds, {@code false} otherwise
+     */
+    public boolean setWifiApEnabled(WifiConfiguration wifiConfig,
+            boolean enabled) {
+        try {
+            // Stopping Wi-Fi mode
+            if (enabled) {
+                mWifiManager.setWifiEnabled(false);
+            }
+
+            Method method = mWifiManager.getClass().getMethod(
+                    "setWifiApEnabled", WifiConfiguration.class, boolean.class);
+            return (Boolean) method.invoke(mWifiManager, wifiConfig, enabled);
+        } catch (Exception e) {
+            Log.e(this.getClass().toString(), "", e);
+            return false;
+        }
+    }
+
+    /**
+     * Fetch the current state of the Wi-Fi Soft AP
+     *
+     * @return {@link WIFI_AP_STATE}
+     */
+    public WIFI_AP_STATE getWifiApState() {
+        try {
+            Method method = mWifiManager.getClass().getMethod("getWifiApState");
+
+            int currentWiFiState = ((Integer) method.invoke(mWifiManager));
+
+            return WIFI_AP_STATE.class.getEnumConstants()[currentWiFiState];
+        } catch (Exception e) {
+            Log.e(this.getClass().toString(), "", e);
+            return WIFI_AP_STATE.WIFI_AP_STATE_FAILED;
+        }
+    }
+
+    /**
+     * Fetch the current Wi-Fi AP Configuration.
+     *
+     * @return AP details in {@link WifiConfiguration}
+     */
+    public WifiConfiguration getWifiApConfiguration() {
+        try {
+            Method method = mWifiManager.getClass().getMethod(
+                    "getWifiApConfiguration");
+            return (WifiConfiguration) method.invoke(mWifiManager);
+        } catch (Exception e) {
+            Log.e(this.getClass().toString(), "", e);
+            return null;
+        }
+    }
+
+    /**
+     * Set/Update the Wi-Fi AP Configuration.
+     *
+     * @return {@code true} if the operation succeeds, {@code false} otherwise
+     */
+    public boolean setWifiApConfiguration(WifiConfiguration wifiConfig) {
+        try {
+            Method method = mWifiManager.getClass().getMethod(
+                    "setWifiApConfiguration", WifiConfiguration.class);
+            return (Boolean) method.invoke(mWifiManager, wifiConfig);
+        } catch (Exception e) {
+            Log.e(this.getClass().toString(), "", e);
+            return false;
+        }
+    }
+
+    /**
+     * Gets a list of the Soft AP clients connected to the Wi-Fi Soft Access point
+     *
+     * @param finishListener
+     *            Interface called when the scan method finishes
+     * @param reachableTimeout
+     *            Reachable Timeout in miliseconds
+     */
+    public void getClientList(IOnBoardingStatus finishListener, final int reachableTimeout) {
+        this.finishListener = finishListener;
+        Runnable runnable = new Runnable() {
+            public void run() {
+
+                BufferedReader bufferedReader = null;
+
+                try {
+                    // Note : This is a reference implementation for getting the list of Enrollee's
+                    // connected to the Soft AP.
+                    // There is no Android API for getting list of connected devices to the Soft AP.
+                    // The connected device information is fetched from Arp cache for Soft AP and
+                    // it is maintained in the file "/proc/net/arp"
+                    bufferedReader = new BufferedReader(new FileReader("/proc/net/arp"));
+                    String line;
+                    while ((line = bufferedReader.readLine()) != null) {
+                        //ARP entries are splitted using Regex for getting the IP and MAC Address
+                        // info
+                        String[] arpEntry = line.split(" +");
+
+                        if ((arpEntry != null) && (arpEntry.length >= 4)) {
+                            String ipAddr = arpEntry[0];
+                            String macAddr = arpEntry[3];
+
+
+                            // Checking if the string is matching MAC Address is matching the
+                            // standard MAC address format.
+                            // If the entry is not matching with MAC address format,
+                            // it will continue
+                            if (CheckIfValidMacAddress(macAddr)) {
+                                boolean isReachable = InetAddress.getByName(
+                                        ipAddr).isReachable(
+                                        reachableTimeout);
+
+                                Log.i("exec statement", ipAddr);
+                                Log.i("Return Value", " " + isReachable);
+
+                                // Checking if the app notification entries are available in the
+                                // list for the current device
+                                // API returns true is there is a notification to the application.
+                                // API returns false if there is no entry or if device is
+                                // already notified
+                                if(CheckForDeviceEntryAndNotify(ipAddr, macAddr, isReachable))
+                                {
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                } catch (Exception e) {
+                    Log.e(this.getClass().toString(), e.toString());
+                } finally {
+                    try {
+                        bufferedReader.close();
+                    } catch (IOException e) {
+                        Log.e(this.getClass().toString(), e.getMessage());
+                    }
+                }
+            }
+        };
+
+        Thread mythread = new Thread(runnable);
+        mythread.start();
+    }
+
+    void NotifyApplication(final IPEnrolleeDevice result) {
+        // Get a handler that can be used to post to the main thread
+        Handler mainHandler = new Handler(context.getMainLooper());
+        Runnable myRunnable = new Runnable() {
+            @Override
+            public void run() {
+                finishListener.deviceOnBoardingStatus(result);
+            }
+        };
+        mainHandler.post(myRunnable);
+    }
+}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/WiFiSoftAPOnBoardingConfig.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/WiFiSoftAPOnBoardingConfig.java
new file mode 100644 (file)
index 0000000..bae89a0
--- /dev/null
@@ -0,0 +1,42 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+package org.iotivity.service.easysetup.mediator.ip;
+
+import android.net.wifi.WifiConfiguration;
+import org.iotivity.service.easysetup.mediator.common.OnBoardingConfig;
+
+/*
+* WiFiSoftAPOnBoardingConfig is a sub class for handling WiFi SoftAP transport configurations.
+* WiFiSoftAPOnBoardingConfig will be used during the OnBoarding phase to provide the
+* WiFi Soft AP transport details for OnBoarding Enrollee's
+* The base class OnBoardingConfig provides the connecitivity type information which is needed
+* for dynamic casting of subclasses at runtime.
+*/
+public class WiFiSoftAPOnBoardingConfig extends OnBoardingConfig {
+    private WifiConfiguration netConfig;
+
+    public WifiConfiguration getNetConfig() {
+        return netConfig;
+    }
+
+    public void setNetConfig(WifiConfiguration netConfig) {
+        this.netConfig = netConfig;
+    }
+}