Clean up some SonarQube warnings (trailing whitespace, etc).
[platform/upstream/iotivity.git] / android / examples / simpleserver / src / main / java / org / iotivity / base / examples / simpleserver / LightRepThread.java
index 0993995..f27b23b 100644 (file)
@@ -1,86 +1,86 @@
-/*\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
-/*\r
- * // Starts a new thread for OBSERVE. It increments the value of mPower by 10 every 3 seconds\r
- */\r
-package org.iotivity.base.examples.simpleserver;\r
-\r
-import android.util.Log;\r
-\r
-import org.iotivity.base.EntityHandlerResult;\r
-import org.iotivity.base.OcException;\r
-import org.iotivity.base.OcPlatform;\r
-import org.iotivity.base.OcRepresentation;\r
-import org.iotivity.base.OcResourceResponse;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * LightRepThread\r
- *\r
- * Spawn a thread for OBSERVE. This increments the resource's power value by 10 every 3 seconds.\r
- * If there is an observationList, call notifyListOfObservers(). Otherwise, call notifyAllObservers()\r
- */\r
-public class LightRepThread extends Thread {\r
-    private static String TAG = "LightRepThread: ";\r
-\r
-    private LightResource mLightResource;\r
-    private List<Byte> mObservationList;\r
-    private static int count = 0;\r
-\r
-    LightRepThread(Object lr, List<Byte> observationList) {\r
-        mLightResource = (LightResource)lr;\r
-        mObservationList = observationList;\r
-    }\r
-\r
-    public void run() {\r
-        while(count < 20) {\r
-            try {\r
-                sleep(3000);\r
-            } catch (InterruptedException e) {\r
-                Log.e(TAG, e.getMessage());\r
-            }\r
-\r
-            // increment current power value by 10 every 3 seconds\r
-            mLightResource.setPower(mLightResource.getPower() + 10);\r
-            try {\r
-                // if observationList is not empty, call notifyListOfObservers\r
-                if (mObservationList.size() > 0) {\r
-                    OcResourceResponse ocResourceResponse = new OcResourceResponse();\r
-                    ocResourceResponse.setErrorCode(StringConstants.ERROR_CODE);\r
-                    ocResourceResponse.setResponseResult(EntityHandlerResult.OK);\r
-                    OcRepresentation r = mLightResource.get();\r
-                    ocResourceResponse.setResourceRepresentation\r
-                            (mLightResource.get(), OcPlatform.DEFAULT_INTERFACE);\r
-                    OcPlatform.notifyListOfObservers(mLightResource.getHandle(), mObservationList, ocResourceResponse);\r
-                } else {\r
-                    // notify all observers if mObservationList is empty\r
-                    OcPlatform.notifyAllObservers(mLightResource.getHandle());\r
-                }\r
-            } catch (OcException e) {\r
-                Log.e(TAG, e.getMessage());\r
-            }\r
-            ++count;\r
-        }\r
-    }\r
-}\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.
+ * //
+ * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ */
+
+/*
+ * // Starts a new thread for OBSERVE. It increments the value of mPower by 10 every 3 seconds
+ */
+package org.iotivity.base.examples.simpleserver;
+
+import android.util.Log;
+
+import org.iotivity.base.EntityHandlerResult;
+import org.iotivity.base.OcException;
+import org.iotivity.base.OcPlatform;
+import org.iotivity.base.OcRepresentation;
+import org.iotivity.base.OcResourceResponse;
+
+import java.util.List;
+
+/**
+ * LightRepThread
+ *
+ * Spawn a thread for OBSERVE. This increments the resource's power value by 10 every 3 seconds.
+ * If there is an observationList, call notifyListOfObservers(). Otherwise, call notifyAllObservers()
+ */
+public class LightRepThread extends Thread {
+    private static String TAG = "LightRepThread: ";
+
+    private LightResource mLightResource;
+    private List<Byte> mObservationList;
+    private static int count = 0;
+
+    LightRepThread(Object lr, List<Byte> observationList) {
+        mLightResource = (LightResource)lr;
+        mObservationList = observationList;
+    }
+
+    public void run() {
+        while(count < 20) {
+            try {
+                sleep(3000);
+            } catch (InterruptedException e) {
+                Log.e(TAG, e.getMessage());
+            }
+
+            // increment current power value by 10 every 3 seconds
+            mLightResource.setPower(mLightResource.getPower() + 10);
+            try {
+                // if observationList is not empty, call notifyListOfObservers
+                if (mObservationList.size() > 0) {
+                    OcResourceResponse ocResourceResponse = new OcResourceResponse();
+                    ocResourceResponse.setErrorCode(StringConstants.ERROR_CODE);
+                    ocResourceResponse.setResponseResult(EntityHandlerResult.OK);
+                    OcRepresentation r = mLightResource.get();
+                    ocResourceResponse.setResourceRepresentation
+                            (mLightResource.get(), OcPlatform.DEFAULT_INTERFACE);
+                    OcPlatform.notifyListOfObservers(mLightResource.getHandle(), mObservationList, ocResourceResponse);
+                } else {
+                    // notify all observers if mObservationList is empty
+                    OcPlatform.notifyAllObservers(mLightResource.getHandle());
+                }
+            } catch (OcException e) {
+                Log.e(TAG, e.getMessage());
+            }
+            ++count;
+        }
+    }
+}