-/*\r
- * //******************************************************************\r
- * //\r
- * // Copyright 2015 Intel Corporation.\r
- * //\r
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
- * //\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
- * // 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
- */\r
-\r
-package org.iotivity.ca;\r
-\r
-import android.content.BroadcastReceiver;\r
-import android.content.Context;\r
-import android.content.Intent;\r
-import android.content.IntentFilter;\r
-import android.net.ConnectivityManager;\r
-import android.net.NetworkInfo;\r
-import android.net.wifi.WifiManager;\r
-\r
-public class CaWiFiInterface {\r
-\r
- private static Context mContext;\r
-\r
- private CaWiFiInterface(Context context) {\r
- mContext = context;\r
- registerWiFiStateReceiver();\r
- }\r
-\r
- private void registerWiFiStateReceiver() {\r
- IntentFilter intentFilter = new IntentFilter();\r
- intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);\r
- intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);\r
-\r
- mContext.registerReceiver(mReceiver, intentFilter);\r
- }\r
-\r
- private static BroadcastReceiver mReceiver = new BroadcastReceiver() {\r
-\r
- @Override\r
- public void onReceive(Context context, Intent intent) {\r
- if (intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,\r
- WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_DISABLED) {\r
- CAWiFiStateDisabled();\r
- } else if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {\r
- ConnectivityManager manager = (ConnectivityManager)\r
- mContext.getSystemService(Context.CONNECTIVITY_SERVICE);\r
- NetworkInfo nwInfo = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);\r
-\r
- if (nwInfo.isConnected()) {\r
- CAWiFiStateEnabled();\r
- }\r
- }\r
- }\r
- };\r
-\r
- private native static void CAWiFiStateEnabled();\r
-\r
- private native static void CAWiFiStateDisabled();\r
+/*
+ * //******************************************************************
+ * //
+ * // Copyright 2015 Intel Corporation.
+ * //
+ * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ * //
+ * // 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.ca;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.net.wifi.WifiManager;
+
+public class CaWiFiInterface {
+
+ private static Context mContext;
+
+ private CaWiFiInterface(Context context) {
+ mContext = context;
+ registerWiFiStateReceiver();
+ }
+
+ private void registerWiFiStateReceiver() {
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
+ intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
+
+ mContext.registerReceiver(mReceiver, intentFilter);
+ }
+
+ private static BroadcastReceiver mReceiver = new BroadcastReceiver() {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
+ WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_DISABLED) {
+ CAWiFiStateDisabled();
+ } else if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
+ ConnectivityManager manager = (ConnectivityManager)
+ mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo nwInfo = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
+
+ if (nwInfo.isConnected()) {
+ CAWiFiStateEnabled();
+ }
+ }
+ }
+ };
+
+ private native static void CAWiFiStateEnabled();
+
+ private native static void CAWiFiStateDisabled();
}
\ No newline at end of file