From: sungmin82.ha Date: Wed, 3 Aug 2011 09:14:30 +0000 (+0900) Subject: [Title]status panel enable bug fix X-Git-Tag: 2.2.1_release^2~172^2~41^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12881243e3fdd3e5fa8d19559c1f6c73eeabecb8;p=sdk%2Femulator%2Feventinjector-eplugin.git [Title]status panel enable bug fix [Type]bug fix [Module]event injector [Priority]minor [CQ#] [Redmine#] [Problem]after emulator boot, when start event injector, status panel disabled [Cause]panel doesn't know connection info [Solution]check connection from panel [TestCase]local build test --- diff --git a/com.samsung.linuxplatform.sensor.accelerometer/src/com/samsung/linuxplatform/sensor/accelerometer/page/Accelerometer.java b/com.samsung.linuxplatform.sensor.accelerometer/src/com/samsung/linuxplatform/sensor/accelerometer/page/Accelerometer.java index 912b789..b4b7df9 100644 --- a/com.samsung.linuxplatform.sensor.accelerometer/src/com/samsung/linuxplatform/sensor/accelerometer/page/Accelerometer.java +++ b/com.samsung.linuxplatform.sensor.accelerometer/src/com/samsung/linuxplatform/sensor/accelerometer/page/Accelerometer.java @@ -51,7 +51,13 @@ public class Accelerometer extends AbstractInjectorPage { double north; double east; double vertical; - + + static double tmp_accel_x = 0.1, tmp_accel_y = 0.1, tmp_accel_z = 0.1; + static double tmp_gyro_x = 0.1, tmp_gyro_y = 0.1, tmp_gyro_z = 0.1; + static double tmp_geo_x = 0.1, tmp_geo_y = 0.1, tmp_geo_z = 0.1, tmp_geo_a = 0.1, tmp_geo_b = 0.1, tmp_geo_c = 0.1, tmp_geo_d = 0.1; + + static boolean button_click = false; + public Accelerometer(AbstractInjectorItem item, String name) { super(item, name); north = 22874.1; @@ -277,6 +283,7 @@ public class Accelerometer extends AbstractInjectorPage { super.widgetSelected(e); } }); + panel.ConnectionChanged(); } @Override @@ -297,6 +304,7 @@ public class Accelerometer extends AbstractInjectorPage { } @Override public void widgetSelected(SelectionEvent e) { + button_click = true; double axisX[] = {1,0,0}; double axisY[] = {0,0,1}; double axisZ[] = {0,-1,0}; @@ -312,6 +320,7 @@ public class Accelerometer extends AbstractInjectorPage { } @Override public void widgetSelected(SelectionEvent e) { + button_click = true; double axisX[] = {0,0,1}; double axisY[] = {-1,0,0}; double axisZ[] = {0,-1,0}; @@ -329,6 +338,7 @@ public class Accelerometer extends AbstractInjectorPage { } @Override public void widgetSelected(SelectionEvent e) { + button_click = true; double axisX[] = {-1,0,0}; double axisY[] = {0,0,-1}; double axisZ[] = {0,-1,0}; @@ -346,6 +356,7 @@ public class Accelerometer extends AbstractInjectorPage { } @Override public void widgetSelected(SelectionEvent e) { + button_click = true; double axisX[] = {0,0,-1}; double axisY[] = {1,0,0}; double axisZ[] = {0,-1,0}; @@ -508,23 +519,66 @@ public class Accelerometer extends AbstractInjectorPage { } } public void sendMessage(String sensorNumber, double x, double y, double z) { - TestSensorMessage msg = new TestSensorMessage(x, y, z); - - try { - sensorSocket.send(sensorNumber + msg.getMessage()); - } catch (Exception e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); + if(sensorNumber == "1\n") // accel + { + if(button_click == true || tmp_accel_x != x || tmp_accel_y != y || tmp_accel_z != z) + { + TestSensorMessage msg = new TestSensorMessage(x, y, z); + + try { + sensorSocket.send(sensorNumber + msg.getMessage()); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + tmp_accel_x = x; + tmp_accel_y = y; + tmp_accel_z = z; + button_click = false; + } + } + else if(sensorNumber == "4\n") // gyro + { + if(tmp_gyro_x != x || tmp_gyro_y != y || tmp_gyro_z != z) + { + TestSensorMessage msg = new TestSensorMessage(x, y, z); + + try { + sensorSocket.send(sensorNumber + msg.getMessage()); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + tmp_gyro_x = x; + tmp_gyro_y = y; + tmp_gyro_z = z; + } } } public void sendMessage(String sensorNumber, double x, double y, double z, double a, double b, double c, double d) { - TestSensorMessage msg = new TestSensorMessage(x, y, z, a, b, c, d); - - try { - sensorSocket.send(sensorNumber + msg.getMessage()); - } catch (Exception e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); + if(sensorNumber == "5\n") + { + if(tmp_geo_x != x || tmp_geo_y != y || tmp_geo_z != z || tmp_geo_a != a || tmp_geo_b != b || tmp_geo_c != c || tmp_geo_d != d) + { + TestSensorMessage msg = new TestSensorMessage(x, y, z, a, b, c, d); + + try { + sensorSocket.send(sensorNumber + msg.getMessage()); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + tmp_geo_x = x; // azimuth + tmp_geo_y = y; + tmp_geo_z = z; + tmp_geo_a = a; // accuracy + tmp_geo_b = b; // tesla x + tmp_geo_c = c; // tesla y + tmp_geo_d = d; // tesla z + } } }