JavaDoc comments and code formatting
authorHemant Mahsky <h.mahsky@samsung.com>
Tue, 8 Sep 2015 18:36:50 +0000 (00:06 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Wed, 9 Sep 2015 02:52:53 +0000 (02:52 +0000)
- Updated Java doc comments for EasySetup SDK APIs
- Performed code formatting using Android style

Signed-off-by: Hemant Mahsky <h.mahsky@samsung.com>
Change-Id: Ibdce574d460110de2e965817163561375a0669e9
Reviewed-on: https://gerrit.iotivity.org/gerrit/2410
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
25 files changed:
service/easy-setup/sampleapp/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/MainActivity.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/ConnectionInterface.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EasySetupService.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EasySetupStatus.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeDevice.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeSetupError.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeState.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/IpConnection.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/OnBoardingCallback.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/OnBoardingConfig.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/ProvisioningCallback.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/ProvisioningConfig.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/EnrolleeDeviceFactory.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/EnrolleeDeviceWiFiOnboarding.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/WiFiOnBoardingConfig.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/WiFiProvConfig.java [changed mode: 0755->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/EnrolleeInfo.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 [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/IProvisioningListener.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 [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/WiFiSoftAPManager.java [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 75c67c5..69b81e0
@@ -27,77 +27,21 @@ import android.widget.TextView;
 import android.widget.Toast;\r
 \r
 public class MainActivity extends Activity {\r
-    TextView          textView1;\r
+    TextView textView1;\r
 \r
-    static final int  REQUEST_IMAGE_CAPTURE = 1;\r
-    ImageView         imageView;\r
+    static final int REQUEST_IMAGE_CAPTURE = 1;\r
+    ImageView imageView;\r
     ProvisionEnrollee provisionEnrolleInstance;\r
 \r
-    /****Start new API implementation */\r
+    /**\r
+     * Objects to be instantiated by the programmer\r
+     */\r
     WiFiProvConfig mWiFiProvConfig;\r
     WiFiOnBoardingConfig mWiFiOnBoardingConfig;\r
-    EasySetupService mEasySetupService ;\r
+    EasySetupService mEasySetupService;\r
     EnrolleeDeviceFactory mDeviceFactory;\r
     EnrolleeDevice mDevice;\r
 \r
- /*   IOnBoardingStatus deviceScanListener = new IOnBoardingStatus() {\r
-\r
-           @Override\r
-            public void deviceOnBoardingStatus(EnrolleeInfo enrolleStatus) {\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
-\r
-                    if (enrolleStatus.isReachable()) {\r
-                        finalResult = "Device OnBoarded" + "["\r
-                                + enrolleStatus.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 = enrolleStatus;\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
-    */\r
-\r
-\r
-    /* End new API implementation*/\r
-\r
     @Override\r
     protected void onCreate(Bundle savedInstanceState) {\r
         super.onCreate(savedInstanceState);\r
@@ -105,50 +49,17 @@ public class MainActivity extends Activity {
 \r
         textView1 = (TextView) findViewById(R.id.textView1);\r
 \r
-        // OnBoarding Process\r
-        // onBoardingHandlerInstance = new OnBoardEnrollee(this);\r
-\r
-        //onBoardingHandlerInstance.registerOnBoardingStatusHandler(this);\r
-\r
         // Provisioning Process\r
         provisionEnrolleInstance = new ProvisionEnrollee(this);\r
-        // provisionEnrolleInstance.registerProvisioningHandler(this);\r
-\r
-  /*      // Get intent, action and MIME type\r
-        Intent intent = getIntent();\r
-        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
-\r
-        myTimer2 = new Timer();\r
-        myTimer2.schedule(new TimerTask() {\r
-            @Override\r
-            public void run() {\r
-                //onBoardingHandlerInstance.startDeviceScan();\r
-                mWifiSoftAPManager.getClientList(false, deviceScanListener);\r
-            }\r
-\r
-        }, 0, 2000);*/\r
-\r
-\r
-        /* Start new API implementation */\r
+        /* Invocation of APIs using the Easy Setup SDK APIs */\r
 \r
+        /* Create Easy Setup Service instance*/\r
         mEasySetupService = EasySetupService.getInstance(getApplicationContext(), new EasySetupStatus() {\r
 \r
             @Override\r
             public void onFinished(EnrolleeDevice enrolledevice) {\r
-                final String msg = enrolledevice.isSetupSuccessful()? "Device configured successfully" : "Device configuration failed" ;\r
+                final String msg = enrolledevice.isSetupSuccessful() ? "Device configured successfully" : "Device configuration failed";\r
                 runOnUiThread(new Runnable() {\r
                     @Override\r
                     public void run() {\r
@@ -169,25 +80,26 @@ public class MainActivity extends Activity {
 \r
         });\r
 \r
+        /* Create EnrolleeDevice Factory instance*/\r
         mDeviceFactory = EnrolleeDeviceFactory.newInstance(getApplicationContext());\r
 \r
+        /* Create a device using Factory instance*/\r
         mDevice = mDeviceFactory.newEnrolleeDevice(getOnBoardingWifiConfig(), getEnrollerWifiConfig());\r
 \r
         addListenerForStartAP();\r
         addListenerForStopAP();\r
-\r
-        /* End new API implementation */\r
-\r
     }\r
 \r
     public WiFiProvConfig getEnrollerWifiConfig() {\r
+        /* Provide the credentials for the Mediator Soft AP to be connected by Enrollee*/\r
         mWiFiProvConfig = new WiFiProvConfig("EasySetup123", "EasySetup123");\r
         return mWiFiProvConfig;\r
     }\r
 \r
     public WiFiOnBoardingConfig getOnBoardingWifiConfig() {\r
-        //TODO : Check proper configuration\r
         mWiFiOnBoardingConfig = new WiFiOnBoardingConfig();\r
+\r
+        /* Provide the target credentials to be provisioned to the Enrollee by Mediator*/\r
         mWiFiOnBoardingConfig.setSSId("EasySetup123");\r
         mWiFiOnBoardingConfig.setSharedKey("EasySetup123");\r
         mWiFiOnBoardingConfig.setAuthAlgo(WifiConfiguration.AuthAlgorithm.OPEN);\r
@@ -199,94 +111,8 @@ public class MainActivity extends Activity {
     public void onDestroy() {\r
         super.onDestroy();\r
         provisionEnrolleInstance.stopEnrolleeProvisioning(0);\r
-        //onBoardingHandlerInstance.disableWiFiAP();\r
-        //  mWifiSoftAPManager.setWifiApEnabled(null, false);\r
-\r
-        //finish();\r
-    }\r
-\r
-    @Override\r
-    public boolean onCreateOptionsMenu(Menu menu) {\r
-        menu.add(0, 0, 0, "Get Clients");\r
-        menu.add(0, 1, 0, "Start AP");\r
-        menu.add(0, 2, 0, "Stop AP");\r
-        menu.add(0, 3, 0, "Provision");\r
-        // Inflate the menu; this adds items to the action bar if it is present.\r
-        getMenuInflater().inflate(R.menu.main, menu);\r
-        return true;\r
     }\r
 \r
-/*    @Override\r
-    public void onFinishProvisioning(final int statuscode) {\r
-        // TODO Auto-generated method stub\r
-        try {\r
-            // code runs in a thread\r
-            runOnUiThread(new Runnable() {\r
-                @Override\r
-                public void run() {\r
-                    // TODO Auto-generated method stub\r
-                    Toast toast = null;\r
-                    if (statuscode == 0) {\r
-                        toast = Toast.makeText(getApplicationContext(),\r
-                                connectedDevice.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
-                                        + " - is NOT Provisioned",\r
-                                Toast.LENGTH_LONG);\r
-                        Log.i("EasyConnect", "Not Provisioned statuscode-"\r
-                                + statuscode);\r
-                    }\r
-\r
-                    toast.show();\r
-                }\r
-            });\r
-        } catch (final Exception ex) {\r
-            Log.i("---", "Exception in thread");\r
-        }\r
-    }*/\r
-\r
-/*    void handleSendText(Intent intent) {\r
-        String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);\r
-        if (sharedText != null) {\r
-\r
-          WifiConfiguration netConfig = new WifiConfiguration();\r
-            netConfig.SSID = "DLNA_LISMORE1";\r
-            netConfig.allowedAuthAlgorithms\r
-                    .set(WifiConfiguration.AuthAlgorithm.OPEN);\r
-            netConfig.allowedKeyManagement\r
-                    .set(WifiConfiguration.KeyMgmt.WPA_PSK);\r
-            netConfig.preSharedKey = "dlna@010203";\r
-\r
-            mWifiSoftAPManager.setWifiApEnabled((WifiConfiguration)getOnBoardingWifiConfig().getConfig(), 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
-        mWifiSoftAPManager.getClientList(false, deviceScanListener);\r
-        //onBoardingHandlerInstance.startDeviceScan();\r
-    }*/\r
-\r
     public void addListenerForStartAP() {\r
         Button button = (Button) findViewById(R.id.button1);\r
 \r
@@ -314,24 +140,6 @@ public class MainActivity extends Activity {
         });\r
     }\r
 \r
-/*    public void addListenerOnProvisioning() {\r
-        Button button = (Button) findViewById(R.id.button2);\r
-\r
-        button.setOnClickListener(new OnClickListener() {\r
-            @Override\r
-            public void onClick(View arg0) {\r
-                provisionEnrolleInstance.provisionEnrollee(\r
-                        connectedDevice.getIpAddr(), "NewAccessPoint",\r
-                        "NewAccessPoint", 0);\r
-                easySetupCount++;\r
-                Log.i("EasyConnect", "easy Setup Count-" + easySetupCount);\r
-                Log.i("EasyConnect",\r
-                        "IP Address-" + connectedDevice.getIpAddr());\r
-            }\r
-        });\r
-\r
-    }*/\r
-\r
     @Override\r
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {\r
         if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {\r
@@ -340,6 +148,4 @@ public class MainActivity extends Activity {
             imageView.setImageBitmap(imageBitmap);\r
         }\r
     }\r
-\r
-\r
 }\r
index a07b54f..837b784 100644 (file)
@@ -8,13 +8,19 @@ import org.iotivity.service.easysetup.impl.EnrolleeDeviceFactory;
 import java.io.IOException;
 import java.util.ArrayList;
 
+/**
+ * This is facade class, a single point of contact for Application.
+ * It contains set of APIs to do easy setup of the enrolling device.
+ * ON-BOARDING - This is a step to establish connectivity between the device & Mediator device.
+ * PROVISION   - This is a step where the netowork's detail & credentials are given to the enrolling device.
+ */
 public class EasySetupService {
 
-    private static EasySetupService sInstance ;
+    private static EasySetupService sInstance;
 
     private final EasySetupStatus mCallback;
 
-    private ArrayList<EnrolleeDevice>mEnrolleeDeviceList;
+    private ArrayList<EnrolleeDevice> mEnrolleeDeviceList;
 
     private final ProvisioningCallback mProvisioningCallback;
 
@@ -26,26 +32,38 @@ public class EasySetupService {
     private EasySetupService(EasySetupStatus callback) {
         mCallback = callback;
         mProvisioningCallback = new ProvisioningCallbackImpl(mCallback);
-        mEnrolleeDeviceList = new ArrayList<EnrolleeDevice> ();
+        mEnrolleeDeviceList = new ArrayList<EnrolleeDevice>();
         mContext = null;
         mDeviceFactory = null;
     }
 
-    // TODO : Implement singleton method
+    /**
+     * Gives a singleton instance of Easy setup service.
+     *
+     * @param callback Application needs to provide this callback to receive the status of of easy setup process.
+     */
+
     public synchronized static EasySetupService getInstance(Context context, EasySetupStatus callback) {
-        if(sInstance == null) {
+        if (sInstance == null) {
             sInstance = new EasySetupService(callback);
             mContext = context;
         }
-        return sInstance ;
+        return sInstance;
     }
 
-    public synchronized void startSetup (final EnrolleeDevice enrolledevice) throws IOException{
+    /**
+     * Starts Easy setup process for the enrolling device.
+     *
+     * @param enrolledevice Device to be enrolled in network
+     * @throws IOException Throws exception in case of any connection error.
+     */
+
+    public synchronized void startSetup(final EnrolleeDevice enrolledevice) throws IOException {
 
         mEnrolleeDeviceList.add(enrolledevice);
 
         // Starts the provisioning directly if the device is already on boarded on the network.
-        if(enrolledevice.onBoarded()) {
+        if (enrolledevice.onBoarded()) {
             enrolledevice.startProvisioning(mProvisioningCallback);
             return;
         }
@@ -54,7 +72,7 @@ public class EasySetupService {
 
             @Override
             public void onFinished(ConnectionInterface connection) {
-                if(connection.isConnected()) {
+                if (connection.isConnected()) {
                     try {
                         Thread.sleep(15000);//Sleep for allowing thin device to start the services
                     } catch (InterruptedException e) {
@@ -64,7 +82,7 @@ public class EasySetupService {
                     // Start provisioning here
                     enrolledevice.setConnection(connection);
                     enrolledevice.startProvisioning(mProvisioningCallback);
-                }else{
+                } else {
                     enrolledevice.mState = EnrolleeState.DEVICE_PROVISIONING_FAILED_STATE;
                     mProvisioningCallback.onFinished(enrolledevice);
                 }
@@ -75,27 +93,32 @@ public class EasySetupService {
 
     }
 
-    public synchronized void stopSetup (EnrolleeDevice enrolledevice) {
+    /**
+     * Stops on-going Easy setup process for enrolling device.
+     *
+     * @param enrolledevice Device to be enrolled in network
+     */
+    public synchronized void stopSetup(EnrolleeDevice enrolledevice) {
         enrolledevice.stopOnBoardingProcess();
         mEnrolleeDeviceList.remove(enrolledevice);
     }
 
-    public synchronized void getEnrolleeDevice (OnBoardingConfig connType) {
+    public synchronized void getEnrolleeDevice(OnBoardingConfig connType) {
         mDeviceFactory = EnrolleeDeviceFactory.newInstance(mContext);
     }
 
     class ProvisioningCallbackImpl extends ProvisioningCallback {
 
-        private final EasySetupStatus mCallback ;
+        private final EasySetupStatus mCallback;
 
-        ProvisioningCallbackImpl (EasySetupStatus callback) {
-            mCallback  = callback;
+        ProvisioningCallbackImpl(EasySetupStatus callback) {
+            mCallback = callback;
         }
 
         @Override
         public void onFinished(EnrolleeDevice enrolledevice) {
             //if(mEnrolleeDeviceList.contains(enrolledevice)) {
-                mCallback.onFinished(enrolledevice);
+            mCallback.onFinished(enrolledevice);
             //}
         }
 
old mode 100755 (executable)
new mode 100644 (file)
index f77db29..4ec7712
@@ -1,8 +1,28 @@
 package org.iotivity.service.easysetup.core;
 
+/**
+ * This interface facilitates Application to get progress & result of Easy setup
+ * process Easy setup process.
+ */
 public interface EasySetupStatus {
 
-        public void onFinished(EnrolleeDevice enrolledevice);
-        public void onProgress(EnrolleeState state);
+    /**
+     * This method is called back when easy setup process is finished. Easy
+     * setup process status can read from the APIs given in Enrollee class.This
+     * method is called on worker thread, UI operations to be executed on main /
+     * Ui Thread.
+     *
+     * @param enrolledevice Device to be enrolled in network through Easy setup process
+     */
+    public void onFinished(EnrolleeDevice enrolledevice);
+
+    /**
+     * This method is called back to give intermediate progress on the easy
+     * setup process This method is called on worker thread, UI operations to be
+     * executed on main / Ui Thread.
+     *
+     * @param state Gives state of the device changed during easy setup process
+     */
+    public void onProgress(EnrolleeState state);
 
 }
old mode 100755 (executable)
new mode 100644 (file)
index 9962b59..e7577d1
 package org.iotivity.service.easysetup.core;
 
+/**
+ * This is an abstract class represents the device being provisioned into the network. The device being enrolled or provisioned into the network is called Enrollee.
+ * Application has to extend this class and provide implementation of abstract methods according to the ON-BOARDING & PROVISION connectivity i.e. WiFi, BLE, BT etc. the device is having.
+ */
+
 public abstract class EnrolleeDevice {
 
     protected EnrolleeState mState;
     private EnrolleeSetupError mError;
 
-    protected  ConnectionInterface mConnection;
+    protected ConnectionInterface mConnection;
     protected final ProvisioningConfig mProvConfig;
     protected final OnBoardingConfig mOnBoardingConfig;
 
     protected OnBoardingCallback mOnBoardingCallback;
     protected ProvisioningCallback mProvisioningCallback;
 
+    /**
+     * @param onBoardingConfig Contains details about the connectivity to be established between the Enrollee device & Mediator device in order to perform on-boarding
+     * @param provConfig       Contains details about the network to which Enrollee device is going to connect.
+     */
     protected EnrolleeDevice(OnBoardingConfig onBoardingConfig, ProvisioningConfig provConfig) {
         mProvConfig = provConfig;
         mOnBoardingConfig = onBoardingConfig;
     }
 
-
-    // Application can override this API to provide their own implementation for on boarding.
+    /**
+     * Application has to implement it according to the on boarding connectivity the device is having.
+     * This method will be called back during the easy setup process.
+     */
     protected abstract void startOnBoardingProcess();
+
+    /**
+     * This method is called back during the easy setup process if Application cancels the setup.
+     * Easy setup service checks the state of device and calls this function accordingly.
+     * Application has to provide implementation for this method to cancel the on boarding step.
+     */
     protected abstract void stopOnBoardingProcess();
 
+    /**
+     * Application has to implement it according to the type of the network device is going to connect or provisioned.
+     * This method will be called back once on-boarding of the device is successful.
+     *
+     * @param conn Contains detail about the network established between the Enrollee device & Mediator device. Its implementation vary according to the connectivity type.
+     */
     protected abstract void startProvisioningProcess(ConnectionInterface conn);
 
+    /**
+     * Once on boarding is successful concrete Enrollee class would call this method and set the Connection.
+     *
+     * @param conn Connectivity between Enrollee device & Mediator device.
+     */
     public void setConnection(ConnectionInterface conn) {
         mConnection = conn;
     }
 
-    // Not accessible by the Application
-    void startOnBoarding(OnBoardingCallback onBoardingCallback){
+
+    /**
+     * This method is called back by Easy setup service if on boarding needs to be done.
+     *
+     * @param onBoardingCallback This is called back once the on boarding is completed.
+     */
+    void startOnBoarding(OnBoardingCallback onBoardingCallback) {
         mOnBoardingCallback = onBoardingCallback;
         startOnBoardingProcess();
     }
 
-    // Not accessible by the Application
-    void startProvisioning(ProvisioningCallback provisioningCallback){
+    /**
+     * This method is called back by Easy setup service once on boarding is successful
+     *
+     * @param provisioningCallback This is called back once the provisioning process is completed
+     */
+    void startProvisioning(ProvisioningCallback provisioningCallback) {
         mProvisioningCallback = provisioningCallback;
         startProvisioningProcess(mConnection);
     }
 
+    /**
+     * This method is used to check easy setup status
+     *
+     * @return true if successful or false
+     */
 
-    public boolean isSetupSuccessful(){
+    public boolean isSetupSuccessful() {
         return (mState == EnrolleeState.DEVICE_PROVISIONING_SUCCESS_STATE) ? true : false;
     }
 
+    /**
+     * Returns error occured during easy setup process
+     *
+     * @return True EnrolleeSetupError object
+     */
     public EnrolleeSetupError getError() {
         return mError;
     }
 
+    /**
+     * Gives the state of the device being enrolled during the easy setup process.
+     *
+     * @return Returns EnrolleeState object
+     */
     public EnrolleeState getState() {
         return mState;
     }
 
-    public boolean onBoarded(){
-        return ( mState == EnrolleeState.DEVICE_PROVISIONING_STATE ) ? true : false;
+    /**
+     * This method is used to know if the device is on boarded or not
+     *
+     * @return True if on-boarded successfully or False
+     */
+
+    public boolean onBoarded() {
+        return (mState == EnrolleeState.DEVICE_PROVISIONING_STATE) ? true : false;
     }
 
 }
old mode 100755 (executable)
new mode 100644 (file)
index 93b4b08..3a2ef4b
@@ -1,6 +1,15 @@
 package org.iotivity.service.easysetup.core;
 
+/**
+ * This class defines constants for Errors comes during Easy setup process
+ */
 public enum EnrolleeSetupError {
+    /**
+     * Device setup successful
+     */
     DEVICE_SETUP_SUCCESSFUL,
+    /**
+     * Device setup failed
+     */
     DEVICE_SETUP_FAILED,
 }
old mode 100755 (executable)
new mode 100644 (file)
index b20f5f2..cb74de6
@@ -2,33 +2,47 @@ package org.iotivity.service.easysetup.core;
 
 
 /**
- *
- * The device being enrolled into the network will fall into any of the below mentioned states
- *
+ * It defines various states of the Enrollee device during easy setup process
  */
 
 public enum EnrolleeState {
 
-    // Device will be there in this state by default
+    /**
+     * Default state of the device
+     */
+    DEVICE_INIT_STATE,
+
+    /**
+     * Device will move to this state after successful on-boarding of the device
+     */
     DEVICE_ON_BOARDING_STATE,
 
-    // Device will move to this state once the on boarding is done
+    /**
+     * Device will move to this state once the on boarding is done
+     */
     DEVICE_PROVISIONING_STATE,
 
-    // Device will move to this state after successful provisioning into the network
+    /**
+     * Easy setup process is successful.
+     */
     DEVICE_PROVISIONING_SUCCESS_STATE,
 
-    // Device is not able to provisioned
+    /**
+     * Device is not able to provisioned.
+     * Easy setup process failed to enrolled the device in the network
+     */
     DEVICE_PROVISIONING_FAILED_STATE,
 
-    // The below state is arbitrary one, any time device can come into this state
-    //Device will move to this state if the ownership transfer initiated  by the Application
+    /**
+     * This state is arbitrary one, any time device can come into this state
+     * Device will move to this state if the ownership transfer initiated  by the Application
+     */
     DEVICE_OWNERSHIP_TRANSFER_STATE,
 
-    // The below state is arbitrary one, any time device can come into this state
-    // Device will move to this state once the Application factory reset the device
+    /**
+     * This state is arbitrary one, any time device can come into this state
+     * Device will move to this state once the Application factory reset the device
+     */
     DEVICE_FACTORY_RESET_STATE,
 
-
-
 }
old mode 100755 (executable)
new mode 100644 (file)
index 480bbac..6140ca9
@@ -1,11 +1,11 @@
 package org.iotivity.service.easysetup.core;
 
-public class IpConnection implements ConnectionInterface{
+public class IpConnection implements ConnectionInterface {
 
     private boolean mIsConnected;
     private String mIp;
 
-    public void setConnectivity(boolean connected){
+    public void setConnectivity(boolean connected) {
         mIsConnected = connected;
     }
 
old mode 100755 (executable)
new mode 100644 (file)
index cf9fc76..f7314de
@@ -1,5 +1,5 @@
 package org.iotivity.service.easysetup.core;
 
 public abstract class OnBoardingCallback {
-    public abstract void onFinished(ConnectionInterface connection) ;
+    public abstract void onFinished(ConnectionInterface connection);
 }
old mode 100755 (executable)
new mode 100644 (file)
index e6279ee..b8f96ba
@@ -1,16 +1,32 @@
 package org.iotivity.service.easysetup.core;
 
+/**
+ * It contains configuration details about the connectivity type between the Enrollee device & Mediator device in order to perform on-boarding.
+ */
 
 public interface OnBoardingConfig {
 
+    /**
+     * It provides constants for connectivity types used for on-boarding Enrollee device
+     */
     public static enum ConnType {
         WiFi,
         BLE,
     }
 
+    /**
+     * Gives configuration object specific to the on-boarding connectivity of the enrolling device.
+     *
+     * @return instance object of configuration according to connectivity type
+     */
     public Object getConfig();
+
+    /**
+     * Gives connectivity type of on-boarding device
+     *
+     * @return on-boarding connectivity type
+     */
     public ConnType getConnType();
-    public ConnectionInterface getConnection();
-    public void setConnection(ConnectionInterface conn);
+
 
 }
old mode 100755 (executable)
new mode 100644 (file)
index 8cb52d1..6792cc6
@@ -1,14 +1,31 @@
 package org.iotivity.service.easysetup.core;
 
-
+/**
+ * It contains configuration details about the the target network where Enrollee device is going to be enrolled.
+ */
 public interface ProvisioningConfig {
 
+    /**
+     * It provides constants for connectivity types of target network
+     */
     public static enum ConnType {
         WiFi,
         BT
     }
 
+    /**
+     * Gives the instance of the configuration object created according to the connectivity type of target network.
+     *
+     * @return instance object of configuration according to connectivity type of target network
+     */
     Object getConfig();
+
+
+    /**
+     * Gives connectivity type of target network
+     *
+     * @return Connectivity type of target network
+     */
     ConnType getConnType();
 
 }
old mode 100755 (executable)
new mode 100644 (file)
index 8f6b78e..145e2ea
@@ -6,25 +6,42 @@ import org.iotivity.service.easysetup.core.ProvisioningConfig;
 
 import android.content.Context;
 
+/**
+ * This a factory class provides the native implementation of the various Enrollee devices.
+ * Application can make use of Enrollee factory if it does not want to create its own Enrollee devices.
+ */
 public class EnrolleeDeviceFactory {
 
     Context mContext;
 
+    /**
+     * This method create & returns instance of EnrolleeDeviceFactory
+     *
+     * @param context This is Android Application context
+     */
     public static EnrolleeDeviceFactory newInstance(Context context) {
         return new EnrolleeDeviceFactory(context);
     }
 
-    private EnrolleeDeviceFactory (Context context) {
+    private EnrolleeDeviceFactory(Context context) {
         mContext = context;
     }
 
-    public EnrolleeDevice newEnrolleeDevice(OnBoardingConfig onboardingConfig, ProvisioningConfig provConfig){
+    /**
+     * This method create & returns instance of Enrollee device of supported configuration
+     *
+     * @param onboardingConfig Contains details about the connectivity to be established between the Enrollee device & Mediator device in order to perform on-boarding
+     * @param provConfig       Contains details about the network to which Enrollee device is going to connect.
+     * @return Instance of the Enrollee device created natively.
+     */
+
+    public EnrolleeDevice newEnrolleeDevice(OnBoardingConfig onboardingConfig, ProvisioningConfig provConfig) {
 
         EnrolleeDevice enrolleeDevice;
 
-        if (onboardingConfig.getConnType()== OnBoardingConfig.ConnType.WiFi) {
-            enrolleeDevice =  new EnrolleeDeviceWiFiOnboarding(mContext, onboardingConfig, provConfig);
-        }else {
+        if (onboardingConfig.getConnType() == OnBoardingConfig.ConnType.WiFi) {
+            enrolleeDevice = new EnrolleeDeviceWiFiOnboarding(mContext, onboardingConfig, provConfig);
+        } else {
             throw new IllegalArgumentException("OnBoarding configuration is not supported");
         }
 
old mode 100755 (executable)
new mode 100644 (file)
index cf22da2..db57a77
@@ -22,27 +22,30 @@ import android.net.wifi.WifiConfiguration;
 import android.util.Log;
 import android.widget.Toast;
 
-public class EnrolleeDeviceWiFiOnboarding extends EnrolleeDevice  {
+/**
+ * This is a ready to use class for Enrollee device having Soft AP as on-boarding connectivity.
+ */
+public class EnrolleeDeviceWiFiOnboarding extends EnrolleeDevice {
 
     public static final String TAG = EnrolleeDeviceWiFiOnboarding.class.getName();
 
-    final Context  mContext;
+    final Context mContext;
     final WiFiSoftAPManager mWifiSoftAPManager;
-    EnrolleeInfo      connectedDevice;
-    private EasySetupManager  easySetupManagerNativeInstance ;
+    EnrolleeInfo connectedDevice;
+    private EasySetupManager easySetupManagerNativeInstance;
     ProvisionEnrollee provisionEnrolleInstance;
 
     IOnBoardingStatus deviceScanListener = new IOnBoardingStatus() {
 
-           @Override
-            public void deviceOnBoardingStatus(EnrolleeInfo enrolleStatus) {
-                Log.d("ESSoftAPOnBoarding", "Entered");
-                if (enrolleStatus != null && enrolleStatus.getIpAddr() != null) {
-                    String finalResult = "Easy Connect : ";
+        @Override
+        public void deviceOnBoardingStatus(EnrolleeInfo enrolleStatus) {
+            Log.d("ESSoftAPOnBoarding", "Entered");
+            if (enrolleStatus != null && enrolleStatus.getIpAddr() != null) {
+                String finalResult = "Easy Connect : ";
 
-                    if (enrolleStatus.isReachable()) {
-                        finalResult = "Device OnBoarded" + "["
-                                + enrolleStatus.getIpAddr() + "]";
+                if (enrolleStatus.isReachable()) {
+                    finalResult = "Device OnBoarded" + "["
+                            + enrolleStatus.getIpAddr() + "]";
 
                         /*
                          * easySetupInstance.StartEasySetup(enrolleStatus.getIpAddr()) ;
@@ -50,15 +53,15 @@ public class EnrolleeDeviceWiFiOnboarding extends EnrolleeDevice  {
                          * "easy Setup Count-"+easySetupCount); Log.i("EasyConnect",
                          * "IP Address-"+enrolleStatus.getIpAddr());
                          */
-                           connectedDevice = enrolleStatus;
-                           IpConnection conn = new IpConnection();
-                           conn.setConnectivity(true);
-                           conn.setIp(connectedDevice.getIpAddr());
-                           Log.d("ESSoftAPOnBoarding", "Entered");
-                           mOnBoardingCallback.onFinished(conn);
-                           return;
+                    connectedDevice = enrolleStatus;
+                    IpConnection conn = new IpConnection();
+                    conn.setConnectivity(true);
+                    conn.setIp(connectedDevice.getIpAddr());
+                    Log.d("ESSoftAPOnBoarding", "Entered");
+                    mOnBoardingCallback.onFinished(conn);
+                    return;
 
-                    }
+                }
 
 /*                    textView1.setText("");
                     textView1.append("Clients: \n");
@@ -75,12 +78,12 @@ public class EnrolleeDeviceWiFiOnboarding extends EnrolleeDevice  {
                             Toast.LENGTH_LONG).show();*/
 
 
-                }
-
-                   IpConnection conn = new IpConnection();
-                   conn.setConnectivity(false);
-                   mOnBoardingCallback.onFinished(conn);
             }
+
+            IpConnection conn = new IpConnection();
+            conn.setConnectivity(false);
+            mOnBoardingCallback.onFinished(conn);
+        }
     };
 
 
@@ -101,12 +104,12 @@ public class EnrolleeDeviceWiFiOnboarding extends EnrolleeDevice  {
         Log.i(TAG, "Starging on boarding process");
 
         //1. Create Soft AP
-        boolean status = mWifiSoftAPManager.setWifiApEnabled((WifiConfiguration)mOnBoardingConfig.getConfig(), true);
+        boolean status = mWifiSoftAPManager.setWifiApEnabled((WifiConfiguration) mOnBoardingConfig.getConfig(), true);
 
         Log.i(TAG, "Soft AP is created with status " + status);
 
 
-        Timer  myTimer;
+        Timer myTimer;
         myTimer = new Timer();
         myTimer.schedule(new TimerTask() {
             @Override
@@ -118,7 +121,6 @@ public class EnrolleeDeviceWiFiOnboarding extends EnrolleeDevice  {
         }, 0, 5000);
 
 
-
     }
 
     protected void stopOnBoardingProcess() {
@@ -130,27 +132,26 @@ public class EnrolleeDeviceWiFiOnboarding extends EnrolleeDevice  {
     @Override
     protected void startProvisioningProcess(ConnectionInterface conn) {
 
-        if(mProvConfig.getConnType() == ProvisioningConfig.ConnType.WiFi) {
+        if (mProvConfig.getConnType() == ProvisioningConfig.ConnType.WiFi) {
 
             provisionEnrolleInstance = new ProvisionEnrollee(mContext);
             provisionEnrolleInstance.registerProvisioningHandler(new IProvisioningListener() {
                 @Override
                 public void onFinishProvisioning(int statuscode) {
-                    mState = ( statuscode == 0) ? EnrolleeState.DEVICE_PROVISIONING_SUCCESS_STATE : EnrolleeState.DEVICE_PROVISIONING_FAILED_STATE;
+                    mState = (statuscode == 0) ? EnrolleeState.DEVICE_PROVISIONING_SUCCESS_STATE : EnrolleeState.DEVICE_PROVISIONING_FAILED_STATE;
                     mProvisioningCallback.onFinished(EnrolleeDeviceWiFiOnboarding.this);
                 }
             });
 
-            IpConnection connection = (IpConnection)conn;
-            WiFiProvConfig wifiProvConfig = (WiFiProvConfig)mProvConfig;
+            IpConnection connection = (IpConnection) conn;
+            WiFiProvConfig wifiProvConfig = (WiFiProvConfig) mProvConfig;
             easySetupManagerNativeInstance = EasySetupManager.getInstance();
             easySetupManagerNativeInstance.initEasySetup();
-            easySetupManagerNativeInstance.provisionEnrollee(connection .getIp(), wifiProvConfig.getSsId(), wifiProvConfig.getPassword(), 0 /*In base code '0' is hard coded*/);
+            easySetupManagerNativeInstance.provisionEnrollee(connection.getIp(), wifiProvConfig.getSsId(), wifiProvConfig.getPassword(), 0 /*In base code '0' is hard coded*/);
 
         }
 
     }
 
 
-
 }
old mode 100755 (executable)
new mode 100644 (file)
index ed450b6..1bf863d
@@ -6,7 +6,12 @@ import org.iotivity.service.easysetup.core.OnBoardingConfig;
 
 import android.net.wifi.WifiConfiguration;
 
-public class WiFiOnBoardingConfig implements OnBoardingConfig{
+/**
+ * This class contains on boarding configuration information for Soft AP on boarding connectivity.
+ * It implements OnBoardingConfig interface & provide implementation for WiFi Soft AP connectivity.
+ */
+
+public class WiFiOnBoardingConfig implements OnBoardingConfig {
 
     private final WifiConfiguration config = new WifiConfiguration();
     private final ConnType mConnType = OnBoardingConfig.ConnType.WiFi;
@@ -40,16 +45,16 @@ public class WiFiOnBoardingConfig implements OnBoardingConfig{
         return mConnType;
     }
 
-    @Override
-    public ConnectionInterface getConnection() {
-        // TODO Auto-generated method stub
-        return mConnection;
-    }
+/*     @Override
+    public OnBoardingConnection getConnection() {
+               // TODO Auto-generated method stub
+               return mConnection;
+       }
 
-    @Override
-    public void setConnection(ConnectionInterface conn) {
-        mConnection = (IpConnection)conn;
-    }
+       @Override
+       public void setConnection(OnBoardingConnection conn) {
+               mConnection = (IpConnection)conn;
+       }*/
 
 
 }
old mode 100755 (executable)
new mode 100644 (file)
index 723dcbc..f2c8ab0
@@ -5,7 +5,11 @@ import org.iotivity.service.easysetup.mediator.EnrolleeInfo;
 
 import android.net.wifi.WifiConfiguration;
 
-public class WiFiProvConfig implements ProvisioningConfig{
+/**
+ * This class contains on provisioning configuration information for for target network.
+ * It implements ProvisioningConfig interface and provide configuration object specific to WiFi target network
+ */
+public class WiFiProvConfig implements ProvisioningConfig {
 
     private final ConnType mConnType = ProvisioningConfig.ConnType.WiFi;
 
index 1b61069..3c93be1 100644 (file)
@@ -1,29 +1,31 @@
-/******************************************************************\r
- *\r
+/**\r
+ * ***************************************************************\r
+ * <p/>\r
  * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- *\r
- *\r
- *\r
+ * <p/>\r
+ * <p/>\r
+ * <p/>\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
+ * <p/>\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * <p/>\r
  * Unless required by applicable law or agreed to in writing, software\r
  * distributed under the License is distributed on an "AS IS" BASIS,\r
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
- *\r
- ******************************************************************/\r
+ * <p/>\r
+ * ****************************************************************\r
+ */\r
 package org.iotivity.service.easysetup.mediator;\r
 \r
 import android.util.Log;\r
 \r
 public class EasySetupCallbackHandler {\r
-    private static final String             TAG = "ESCallbackHandler";\r
-    ProvisionEnrollee                       provisioningListener;\r
+    private static final String TAG = "ESCallbackHandler";\r
+    ProvisionEnrollee provisioningListener;\r
 \r
     private static EasySetupCallbackHandler easySetupCallbackHandlerObj;\r
 \r
index 0319f79..dcb99e4 100644 (file)
@@ -1,22 +1,24 @@
-/******************************************************************\r
- *\r
+/**\r
+ * ***************************************************************\r
+ * <p/>\r
  * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- *\r
- *\r
- *\r
+ * <p/>\r
+ * <p/>\r
+ * <p/>\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
+ * <p/>\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * <p/>\r
  * Unless required by applicable law or agreed to in writing, software\r
  * distributed under the License is distributed on an "AS IS" BASIS,\r
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
- *\r
- ******************************************************************/\r
+ * <p/>\r
+ * ****************************************************************\r
+ */\r
 package org.iotivity.service.easysetup.mediator;\r
 \r
 import android.content.Context;\r
@@ -32,14 +34,14 @@ public class EasySetupManager {
     // second parameter for PerformEasySetup\r
     // instead of integer\r
     private native void ProvisionEnrollee(String ipAddress, String netSSID,\r
-            String netPWD, int connectivityType);\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
+    private Context appContext = null;\r
 \r
     static {\r
         // Load Easy Setup JNI interface\r
@@ -80,7 +82,7 @@ public class EasySetupManager {
     }\r
 \r
     public void provisionEnrollee(String ipAddress, String netSSID,\r
-            String netPWD, int connectivityType) {\r
+                                  String netPWD, int connectivityType) {\r
 \r
         ProvisionEnrollee(ipAddress, netSSID, netPWD, connectivityType);\r
     }\r
index a00758e..db3b737 100644 (file)
@@ -1,30 +1,32 @@
-/******************************************************************
- *
+/**
+ * ***************************************************************
+ * <p/>
  * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
+ * <p/>
+ * <p/>
+ * <p/>
  * 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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.
- *
- ******************************************************************/
+ * <p/>
+ * ****************************************************************
+ */
 
 package org.iotivity.service.easysetup.mediator;
 
 public class EnrolleeInfo {
 
-    private String  IpAddr;
-    private String  HWAddr;
-    private String  Device;
+    private String IpAddr;
+    private String HWAddr;
+    private String Device;
     private boolean isReachable;
 
     public String getIpAddr() {
index 161b7fb..1abf5f4 100644 (file)
@@ -1,36 +1,38 @@
-/******************************************************************
- *
+/**
+ * ***************************************************************
+ * <p/>
  * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
+ * <p/>
+ * <p/>
+ * <p/>
  * 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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.
- *
- ******************************************************************/
+ * <p/>
+ * ****************************************************************
+ */
 package org.iotivity.service.easysetup.mediator;
 
 public class EnrolleeOnBoardingInfo {
 
-    private String  IpAddr;
-    private String  HWAddr;
-    private String  Device;
+    private String IpAddr;
+    private String HWAddr;
+    private String Device;
     private boolean isReachable;
     private boolean isAdditionNotified;
     private boolean isRemovalNotified;
 
     public EnrolleeOnBoardingInfo(String ipAddr, String hWAddr, String device,
-            boolean isReachable, boolean isRemovalNotified,
-            boolean isAdditionNotified) {
+                                  boolean isReachable, boolean isRemovalNotified,
+                                  boolean isAdditionNotified) {
         this.IpAddr = ipAddr;
         this.HWAddr = hWAddr;
         this.Device = device;
old mode 100755 (executable)
new mode 100644 (file)
index 403721d..23cec64
@@ -1,22 +1,24 @@
-/******************************************************************
- *
+/**
+ * ***************************************************************
+ * <p/>
  * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
+ * <p/>
+ * <p/>
+ * <p/>
  * 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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.
- *
- ******************************************************************/
+ * <p/>
+ * ****************************************************************
+ */
 package org.iotivity.service.easysetup.mediator;
 
 import java.util.ArrayList;
index a178401..8106382 100644 (file)
@@ -1,22 +1,24 @@
-/******************************************************************\r
- *\r
+/**\r
+ * ***************************************************************\r
+ * <p/>\r
  * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- *\r
- *\r
- *\r
+ * <p/>\r
+ * <p/>\r
+ * <p/>\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
+ * <p/>\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * <p/>\r
  * Unless required by applicable law or agreed to in writing, software\r
  * distributed under the License is distributed on an "AS IS" BASIS,\r
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
- *\r
- ******************************************************************/\r
+ * <p/>\r
+ * ****************************************************************\r
+ */\r
 package org.iotivity.service.easysetup.mediator;\r
 \r
 public interface IProvisioningListener {\r
index 0add977..3bffc96 100644 (file)
@@ -1,26 +1,29 @@
-/******************************************************************\r
- *\r
+/**\r
+ * ***************************************************************\r
+ * <p/>\r
  * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- *\r
- *\r
- *\r
+ * <p/>\r
+ * <p/>\r
+ * <p/>\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
+ * <p/>\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * <p/>\r
  * Unless required by applicable law or agreed to in writing, software\r
  * distributed under the License is distributed on an "AS IS" BASIS,\r
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
- *\r
- ******************************************************************/\r
+ * <p/>\r
+ * ****************************************************************\r
+ */\r
 package org.iotivity.service.easysetup.mediator;\r
 \r
 import android.content.Context;\r
 import android.net.wifi.WifiConfiguration;\r
+\r
 import org.iotivity.service.easysetup.mediator.ip.WiFiSoftAPManager;\r
 \r
 import android.widget.Toast;\r
old mode 100755 (executable)
new mode 100644 (file)
index ce68f53..79dd916
@@ -4,9 +4,9 @@ import android.content.Context;
 import android.util.Log;\r
 \r
 public class ProvisionEnrollee {\r
-    private static final String   TAG                            = "ProvisionEnrollee";\r
-    private Context               appContext                     = null;\r
-    private EasySetupManager      easySetupManagerNativeInstance = null;\r
+    private static final String TAG = "ProvisionEnrollee";\r
+    private Context appContext = null;\r
+    private EasySetupManager easySetupManagerNativeInstance = null;\r
     private IProvisioningListener provisioningListener;\r
 \r
     /**\r
@@ -25,7 +25,7 @@ public class ProvisionEnrollee {
     }\r
 \r
     public void provisionEnrollee(String ipAddress, String netSSID,\r
-            String netPWD, int connectivityType) {\r
+                                  String netPWD, int connectivityType) {\r
         easySetupManagerNativeInstance.provisionEnrollee(ipAddress, netSSID,\r
                 netPWD, connectivityType);\r
     }\r
old mode 100755 (executable)
new mode 100644 (file)
index beeb705..3aef566
@@ -1,22 +1,24 @@
-/******************************************************************
- *
+/**
+ * ***************************************************************
+ * <p/>
  * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
+ * <p/>
+ * <p/>
+ * <p/>
  * 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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.
- *
- ******************************************************************/
+ * <p/>
+ * ****************************************************************
+ */
 package org.iotivity.service.easysetup.mediator.ip;
 
 import java.io.BufferedReader;
@@ -46,11 +48,11 @@ import org.iotivity.service.easysetup.mediator.IOnBoardingStatus;
  * </p>
  */
 public class WiFiSoftAPManager {
-    private final WifiManager                mWifiManager;
-    private Context                          context;
+    private final WifiManager mWifiManager;
+    private Context context;
     static ArrayList<EnrolleeOnBoardingInfo> appNotification =
-                                                    new ArrayList<EnrolleeOnBoardingInfo>();
-    IOnBoardingStatus finishListener  = null;
+            new ArrayList<EnrolleeOnBoardingInfo>();
+    IOnBoardingStatus finishListener = null;
 
     public enum WIFI_AP_STATE {
         WIFI_AP_STATE_DISABLING,
@@ -69,13 +71,10 @@ public class WiFiSoftAPManager {
     /*
     * Utility API to check the validity of the MAC Address read from the ARP cache
     */
-    private boolean CheckIfValidMacAddress(String macAddr)
-    {
-        if(macAddr.matches("..:..:..:..:..:.."))
-        {
+    private boolean CheckIfValidMacAddress(String macAddr) {
+        if (macAddr.matches("..:..:..:..:..:..")) {
             return true;
-        }
-        else {
+        } else {
             return false;
         }
     }
@@ -88,16 +87,15 @@ public class WiFiSoftAPManager {
     * continue
     */
     private synchronized boolean CheckForDeviceEntryAndNotify(String ipAddr,
-                                                 String macAddr, boolean isReachable)
-    {
+                                                              String macAddr, boolean isReachable) {
         final EnrolleeInfo result = new EnrolleeInfo();
         boolean deviceAddedToList = false;
 
         if (appNotification.size() > 0) {
             for (EnrolleeOnBoardingInfo ipDeviceOnBoardingNotification : appNotification) {
-                EnrolleeOnBoardingInfo ipEnrolleeDevice = (EnrolleeOnBoardingInfo)ipDeviceOnBoardingNotification;
+                EnrolleeOnBoardingInfo ipEnrolleeDevice = (EnrolleeOnBoardingInfo) ipDeviceOnBoardingNotification;
                 boolean macAddressComparison = ipEnrolleeDevice.getHWAddr().equalsIgnoreCase(
-                                macAddr) ? true : false;
+                        macAddr) ? true : false;
 
                 if (macAddressComparison) {
                     deviceAddedToList = true;
@@ -183,7 +181,7 @@ public class WiFiSoftAPManager {
      * @return {@code true} if the operation succeeds, {@code false} otherwise
      */
     public boolean setWifiApEnabled(WifiConfiguration wifiConfig,
-            boolean enabled) {
+                                    boolean enabled) {
         try {
             // Stopping Wi-Fi mode
             if (enabled) {
@@ -300,8 +298,7 @@ public class WiFiSoftAPManager {
                                 // 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))
-                                {
+                                if (CheckForDeviceEntryAndNotify(ipAddr, macAddr, isReachable)) {
                                     break;
                                 }
                             }