[Title]modified for performance
authorsungmin82.ha <sungmin82.ha@samsung.com>
Fri, 5 Aug 2011 20:23:25 +0000 (05:23 +0900)
committersungmin82.ha <sungmin82.ha@samsung.com>
Fri, 5 Aug 2011 20:23:25 +0000 (05:23 +0900)
[Type]bug fix
[Module]proxi sensor plugin
[Priority]minor
[CQ#]
[Redmine#]
[Problem]send same data
[Cause]
[Solution]
[TestCase]

com.samsung.linuxplatform.sensor.proximity/src/com/samsung/linuxplatform/sensor/proximity/page/ProximityPage.java

index db67030..a5ca1c3 100644 (file)
@@ -35,6 +35,7 @@ public class ProximityPage extends AbstractInjectorPage implements IDeviceListen
        private final String sensorNumber = "2\n";
        private Timer timer;
        private boolean sensorOn;
+       static int tmp_proxi = -1;
        
        public ProximityPage(AbstractInjectorItem item, String name) {
                super(item, name);
@@ -90,12 +91,16 @@ public class ProximityPage extends AbstractInjectorPage implements IDeviceListen
        }
 
        public void sendMessage(int on) {
-               TestSensorMessage msg = new TestSensorMessage(on);
-               try {
-                       sensorSocket.send(sensorNumber + msg.getMessage());
-               } catch (Exception e1) {
-                       // TODO Auto-generated catch block
-                       e1.printStackTrace();
+               if(tmp_proxi != on)
+               {
+                       TestSensorMessage msg = new TestSensorMessage(on);
+                       try {
+                               sensorSocket.send(sensorNumber + msg.getMessage());
+                       } catch (Exception e1) {
+                               // TODO Auto-generated catch block
+                               e1.printStackTrace();
+                       }
+                       tmp_proxi = on;
                }
        }