From a35769d5d3cca13d79fe15ce2bff73af72a9a3b2 Mon Sep 17 00:00:00 2001 From: Sungho Park Date: Mon, 30 Apr 2012 18:06:07 +0900 Subject: [PATCH] upload tizen1.0 source Change-Id: Ic6c668fe18d1393cc54c7673b9770f15d27b12be --- org.tizen.device/META-INF/MANIFEST.MF | 5 +- .../org/tizen/device/battery/page/BatteryPage.java | 44 +++- .../org/tizen/device/earjack/page/EarjackPage.java | 17 +- .../src/org/tizen/device/rssi/page/RssiPage.java | 34 +++- .../src/org/tizen/device/usb/page/UsbPage.java | 52 +++-- org.tizen.eventinjector.feature/feature.xml | 4 +- org.tizen.injector/META-INF/MANIFEST.MF | 4 +- .../org/tizen/injector/socket/TelephonySocket.java | 125 ++++++++---- .../src/org/tizen/injector/view/InjectorView.java | 59 ++++-- org.tizen.location.core/META-INF/MANIFEST.MF | 4 +- .../location/core/injector/LocationInjector.java | 23 ++- org.tizen.location.log/META-INF/MANIFEST.MF | 8 +- .../src/org/tizen/location/log/page/LogFile.java | 30 ++- org.tizen.location.manual/META-INF/MANIFEST.MF | 4 +- .../org/tizen/location/manual/page/Coordinate.java | 31 ++- org.tizen.location.map/META-INF/MANIFEST.MF | 4 +- .../src/org/tizen/location/map/page/MapImage.java | 60 +++++- org.tizen.nfc/META-INF/MANIFEST.MF | 9 +- org.tizen.nfc/src/org/tizen/nfc/Nfc.java | 22 +- .../src/org/tizen/nfc/page/NDEFRecord.java | 26 +++ .../src/org/tizen/nfc/page/NfcCommand.java | 26 +++ .../src/org/tizen/nfc/page/NfcDialog.java | 26 +++ .../src/org/tizen/nfc/page/NfcMimeType.java | 26 +++ org.tizen.nfc/src/org/tizen/nfc/page/NfcPage.java | 56 +++--- .../src/org/tizen/nfc/page/NfcStringResource.java | 38 +++- .../META-INF/MANIFEST.MF | 2 +- .../sensor/accelerometer/page/Accelerometer.java | 223 +++++++++++++++++---- .../sensor/accelerometer/page/MobilePanel.java | 132 ++++++++---- .../src/org/tizen/sensor/magnetic/Magnetic.java | 11 + org.tizen.sensor.light/META-INF/MANIFEST.MF | 7 +- .../src/org/tizen/sensor/light/page/LightPage.java | 8 +- org.tizen.sensor.motion/META-INF/MANIFEST.MF | 2 +- org.tizen.sensor.proximity/META-INF/MANIFEST.MF | 2 +- .../tizen/sensor/proximity/page/ProximityPage.java | 36 +++- package/pkginfo.manifest | 8 +- 35 files changed, 884 insertions(+), 284 deletions(-) diff --git a/org.tizen.device/META-INF/MANIFEST.MF b/org.tizen.device/META-INF/MANIFEST.MF index 6480f6d..98c04be 100644 --- a/org.tizen.device/META-INF/MANIFEST.MF +++ b/org.tizen.device/META-INF/MANIFEST.MF @@ -3,12 +3,13 @@ Bundle-ManifestVersion: 2 Bundle-Name: Tizen Event Injector Device Bundle-SymbolicName: org.tizen.device;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: Tizen +Bundle-Vendor: Samsung Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Require-Bundle: org.tizen.injector, org.eclipse.swt;bundle-version="3.6.2", org.tizen.common, org.tizen.common.connection, - org.eclipse.core.runtime;bundle-version="3.7.0" + org.eclipse.core.runtime;bundle-version="3.7.0", + org.eclipse.core.commands;bundle-version="3.6.0" Import-Package: org.tizen.sdblib, org.eclipse.ui.plugin diff --git a/org.tizen.device/src/org/tizen/device/battery/page/BatteryPage.java b/org.tizen.device/src/org/tizen/device/battery/page/BatteryPage.java index e4ac294..85147eb 100644 --- a/org.tizen.device/src/org/tizen/device/battery/page/BatteryPage.java +++ b/org.tizen.device/src/org/tizen/device/battery/page/BatteryPage.java @@ -27,9 +27,11 @@ package org.tizen.device.battery.page; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; +//import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; @@ -39,8 +41,10 @@ import org.eclipse.swt.widgets.Text; import org.tizen.injector.protocol.sensor.TestSensorMessage; import org.tizen.injector.provider.AbstractInjectorItem; import org.tizen.injector.provider.AbstractInjectorPage; +import org.tizen.injector.view.InjectorView; import org.tizen.common.connection.ConnectionPlugin; import org.tizen.common.connection.ConnectionPlugin.ISelectionListener; +import org.tizen.common.util.DialogUtil; import org.tizen.sdblib.FileListingService.FileEntry; import org.tizen.sdblib.IDevice; @@ -62,7 +66,7 @@ public class BatteryPage extends AbstractInjectorPage implements ISelectionListe @Override protected void createContents() { currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); - ConnectionPlugin.getDefault().addSelectionListener(this); + InjectorView.getDefault().addSelectionListener(this); sensorOn = 0; Composite mainComposite = formUtil.createComposite(parent, 3); @@ -76,6 +80,7 @@ public class BatteryPage extends AbstractInjectorPage implements ISelectionListe gd.widthHint = 24; sliderText.setLayoutData(gd); sendData = slider.getSelection(); + /* slider.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { @@ -88,7 +93,23 @@ public class BatteryPage extends AbstractInjectorPage implements ISelectionListe sendMessage(sendData, sensorOn); } }); - + */ + slider.addMouseListener(new MouseListener() { + @Override + public void mouseDoubleClick(MouseEvent e) { + } + @Override + public void mouseDown(MouseEvent e) { + } + @Override + public void mouseUp(MouseEvent e) { + sendData = slider.getSelection(); + slider.setSelection(sendData); + sliderText.setText(Integer.toString(sendData)); + sendMessage(sendData, sensorOn); + } + }); + Composite secondComposite = formUtil.createComposite(parent, 5); formUtil.createLabel(secondComposite, batteryCharger); radioButton = new Button[2]; @@ -105,11 +126,12 @@ public class BatteryPage extends AbstractInjectorPage implements ISelectionListe } } } - + radioButton[0].addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - for( int i = 0 ; i < radioButton.length ; i++ ) { + for( int i = 0 ; i < radioButton.length ; i++ ) + { if(radioButton[i].getSelection()) { if( i == 0 ) { // On sensorOn = 1; @@ -118,9 +140,10 @@ public class BatteryPage extends AbstractInjectorPage implements ISelectionListe sensorOn = 0; } } + } + super.widgetSelected(e); sendMessage(sendData, sensorOn); - } } }); @@ -157,6 +180,13 @@ public class BatteryPage extends AbstractInjectorPage implements ISelectionListe public void connect() { // TODO Auto-generated method stub currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); + + slider.setSelection(100); + sendData = slider.getSelection(); + sliderText.setText(Integer.toString(sendData)); + + radioButton[0].setSelection(false); + radioButton[1].setSelection(true); } // @Override @@ -166,7 +196,7 @@ public class BatteryPage extends AbstractInjectorPage implements ISelectionListe @Override protected void finalize() throws Throwable { - ConnectionPlugin.getDefault().removeSelectionListener(this); + InjectorView.getDefault().removeSelectionListener(this); // TargetConnectionControl.removeTargetConnectionListener(this); super.finalize(); } diff --git a/org.tizen.device/src/org/tizen/device/earjack/page/EarjackPage.java b/org.tizen.device/src/org/tizen/device/earjack/page/EarjackPage.java index 52c0268..8fbf3bb 100644 --- a/org.tizen.device/src/org/tizen/device/earjack/page/EarjackPage.java +++ b/org.tizen.device/src/org/tizen/device/earjack/page/EarjackPage.java @@ -39,6 +39,7 @@ import org.tizen.sdblib.IDevice; import org.tizen.injector.protocol.sensor.TestSensorMessage; import org.tizen.injector.provider.AbstractInjectorItem; import org.tizen.injector.provider.AbstractInjectorPage; +import org.tizen.injector.view.InjectorView; public class EarjackPage extends AbstractInjectorPage implements ISelectionListener { @@ -54,7 +55,7 @@ public class EarjackPage extends AbstractInjectorPage implements ISelectionListe @Override protected void createContents() { - ConnectionPlugin.getDefault().addSelectionListener(this); + InjectorView.getDefault().addSelectionListener(this); currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); Composite mainComposite = formUtil.createComposite(parent, 6); @@ -166,6 +167,10 @@ public class EarjackPage extends AbstractInjectorPage implements ISelectionListe public void connect() { // TODO Auto-generated method stub currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); + + radioButton[0].setSelection(false); + radioButton[1].setSelection(false); + radioButton[2].setSelection(true); } // @Override @@ -175,7 +180,7 @@ public class EarjackPage extends AbstractInjectorPage implements ISelectionListe @Override protected void finalize() throws Throwable { - ConnectionPlugin.getDefault().removeSelectionListener(this); + InjectorView.getDefault().removeSelectionListener(this); // TargetConnectionControl.removeTargetConnectionListener(this); super.finalize(); } @@ -190,13 +195,15 @@ public class EarjackPage extends AbstractInjectorPage implements ISelectionListe else if (!selectedEntry.getFileListingService().getDevice().isEmulator()) return; - if(currentDevice == null && selectedEntry.getName() != null) + if(currentDevice == null && selectedEntry.getName() != null) { connect(); - else if(currentDevice == null && selectedEntry.getName() == null) + } else if(currentDevice == null && selectedEntry.getName() == null) { return; - else if (currentDevice.getSerialNumber() != selectedEntry.getName()) { + } else if (currentDevice.getSerialNumber() != selectedEntry.getName()) { disconnect(); connect(); + } else if (currentDevice.getSerialNumber() == selectedEntry.getName()) { + return; } sendMessage(earjack_status); } diff --git a/org.tizen.device/src/org/tizen/device/rssi/page/RssiPage.java b/org.tizen.device/src/org/tizen/device/rssi/page/RssiPage.java index 884f486..74c548a 100644 --- a/org.tizen.device/src/org/tizen/device/rssi/page/RssiPage.java +++ b/org.tizen.device/src/org/tizen/device/rssi/page/RssiPage.java @@ -27,8 +27,10 @@ package org.tizen.device.rssi.page; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.MouseEvent; +//import org.eclipse.swt.events.SelectionEvent; +//import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Slider; @@ -41,6 +43,7 @@ import org.tizen.sdblib.IDevice; import org.tizen.injector.protocol.sensor.TestSensorMessage; import org.tizen.injector.provider.AbstractInjectorItem; import org.tizen.injector.provider.AbstractInjectorPage; +import org.tizen.injector.view.InjectorView; public class RssiPage extends AbstractInjectorPage implements ISelectionListener { private Text sliderText; @@ -56,13 +59,13 @@ public class RssiPage extends AbstractInjectorPage implements ISelectionListener @Override protected void createContents() { - ConnectionPlugin.getDefault().addSelectionListener(this); + InjectorView.getDefault().addSelectionListener(this); currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); Composite mainComposite = formUtil.createComposite(parent, 3); formUtil.createLabel(mainComposite, rssiLevel); slider = formUtil.createSlider(mainComposite, SWT.HORIZONTAL); - slider.setValues(6, 0, 7, 1, 1, 1); + slider.setValues(5, 0, 6, 1, 1, 1); slider.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); sliderText = formUtil.createText(mainComposite, Integer.toString(slider.getSelection())); sliderText.setEditable(false); @@ -70,6 +73,7 @@ public class RssiPage extends AbstractInjectorPage implements ISelectionListener gd.widthHint = 10; sliderText.setLayoutData(gd); sendData = slider.getSelection(); + /* slider.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { @@ -82,6 +86,22 @@ public class RssiPage extends AbstractInjectorPage implements ISelectionListener sendLevelMessage(sendData); } }); + */ + slider.addMouseListener(new MouseListener() { + @Override + public void mouseDoubleClick(MouseEvent e) { + } + @Override + public void mouseDown(MouseEvent e) { + } + @Override + public void mouseUp(MouseEvent e) { + sendData = slider.getSelection(); + slider.setSelection(sendData); + sliderText.setText(Integer.toString(sendData)); + sendLevelMessage(sendData); + } + }); boolean connected = checkDeviceConnectedAlready(); if (connected == true) { @@ -116,6 +136,10 @@ public class RssiPage extends AbstractInjectorPage implements ISelectionListener public void connect() { // TODO Auto-generated method stub currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); + + slider.setSelection(5); + sendData = slider.getSelection(); + sliderText.setText(Integer.toString(sendData)); } // @Override @@ -125,7 +149,7 @@ public class RssiPage extends AbstractInjectorPage implements ISelectionListener @Override protected void finalize() throws Throwable { - ConnectionPlugin.getDefault().removeSelectionListener(this); + InjectorView.getDefault().removeSelectionListener(this); // TargetConnectionControl.removeTargetConnectionListener(this); super.finalize(); } diff --git a/org.tizen.device/src/org/tizen/device/usb/page/UsbPage.java b/org.tizen.device/src/org/tizen/device/usb/page/UsbPage.java index 2869dc7..107b7a5 100644 --- a/org.tizen.device/src/org/tizen/device/usb/page/UsbPage.java +++ b/org.tizen.device/src/org/tizen/device/usb/page/UsbPage.java @@ -40,6 +40,7 @@ import org.tizen.sdblib.IDevice; import org.tizen.injector.protocol.sensor.TestSensorMessage; import org.tizen.injector.provider.AbstractInjectorItem; import org.tizen.injector.provider.AbstractInjectorPage; +import org.tizen.injector.view.InjectorView; public class UsbPage extends AbstractInjectorPage implements ISelectionListener { @@ -55,15 +56,16 @@ public class UsbPage extends AbstractInjectorPage implements ISelectionListener @Override protected void createContents() { - ConnectionPlugin.getDefault().addSelectionListener(this); + InjectorView.getDefault().addSelectionListener(this); currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); - sensorOn = false; - + Composite mainComposite = formUtil.createComposite(parent, 5); radioButton = new Button[2]; radioButton[0] = formUtil.createButton(mainComposite, UsbConstants.inject, SWT.RADIO); radioButton[1] = formUtil.createButton(mainComposite, UsbConstants.remove, SWT.RADIO); radioButton[1].setSelection(true); + sensorOn = false; + /* for( int i = 0 ; i < radioButton.length ; i++ ) { if(radioButton[i].getSelection()) { if( i == 0 ) // On @@ -72,30 +74,29 @@ public class UsbPage extends AbstractInjectorPage implements ISelectionListener sensorOn = false; } } - + */ radioButton[0].addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - for( int i = 0 ; i < radioButton.length ; i++ ) { - if(radioButton[i].getSelection()) { - if( i == 0 ) { // On - sensorOn = true; - } - else { // Off - sensorOn = false; - } - } - super.widgetSelected(e); - if( sensorOn ) { // On + // USB Connect + if (radioButton[0].getSelection()) { + sensorOn = true; sendMessage(1); } - else { // Off + } + }); + + radioButton[1].addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // USB Disconnect + if (radioButton[1].getSelection()) { + sensorOn = false; sendMessage(0); } - } } }); - + boolean connected = checkDeviceConnectedAlready(); if (connected == true) { connect(); @@ -130,6 +131,11 @@ public class UsbPage extends AbstractInjectorPage implements ISelectionListener public void connect() { // TODO Auto-generated method stub currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); + + // initialize - USB disconnection + radioButton[0].setSelection(false); + radioButton[1].setSelection(true); + sensorOn = false; } // @Override @@ -139,7 +145,7 @@ public class UsbPage extends AbstractInjectorPage implements ISelectionListener @Override protected void finalize() throws Throwable { - ConnectionPlugin.getDefault().removeSelectionListener(this); + InjectorView.getDefault().removeSelectionListener(this); // TargetConnectionControl.removeTargetConnectionListener(this); super.finalize(); } @@ -154,13 +160,15 @@ public class UsbPage extends AbstractInjectorPage implements ISelectionListener else if (!selectedEntry.getFileListingService().getDevice().isEmulator()) return; - if(currentDevice == null && selectedEntry.getName() != null) + if(currentDevice == null && selectedEntry.getName() != null) { connect(); - else if(currentDevice == null && selectedEntry.getName() == null) + } else if(currentDevice == null && selectedEntry.getName() == null) { return; - else if (currentDevice.getSerialNumber() != selectedEntry.getName()) { + } else if (currentDevice.getSerialNumber() != selectedEntry.getName()) { disconnect(); connect(); + } else if (currentDevice.getSerialNumber() == selectedEntry.getName()) { + return; } if( sensorOn ) // On sendMessage(1); diff --git a/org.tizen.eventinjector.feature/feature.xml b/org.tizen.eventinjector.feature/feature.xml index c375214..a64e410 100644 --- a/org.tizen.eventinjector.feature/feature.xml +++ b/org.tizen.eventinjector.feature/feature.xml @@ -2,8 +2,8 @@ diff --git a/org.tizen.injector/META-INF/MANIFEST.MF b/org.tizen.injector/META-INF/MANIFEST.MF index 1d2a129..538a4e3 100644 --- a/org.tizen.injector/META-INF/MANIFEST.MF +++ b/org.tizen.injector/META-INF/MANIFEST.MF @@ -2,8 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Tizen Event Injector Injector Bundle-SymbolicName: org.tizen.injector;singleton:=true -Bundle-Version: 1.3.20.qualifier -Bundle-Vendor: Tizen +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: Samsung Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.ui.ide, diff --git a/org.tizen.injector/src/org/tizen/injector/socket/TelephonySocket.java b/org.tizen.injector/src/org/tizen/injector/socket/TelephonySocket.java index 08fba2e..a5b48f9 100644 --- a/org.tizen.injector/src/org/tizen/injector/socket/TelephonySocket.java +++ b/org.tizen.injector/src/org/tizen/injector/socket/TelephonySocket.java @@ -112,6 +112,8 @@ public class TelephonySocket { sendInitialize(); isConnected = true; + } catch (SocketException e) { + return; } catch (Exception e) { e.printStackTrace(); throw e; @@ -135,12 +137,16 @@ public class TelephonySocket { if (input != null) input.close(); isConnected = false; + } catch (SocketException e) { + return; } catch (Exception e) { e.printStackTrace(); } finally { if (socket != null) { try { socket.close(); + } catch (SocketException e) { + return; } catch (IOException e) { e.printStackTrace(); } @@ -155,58 +161,81 @@ public class TelephonySocket { } private void sendInitialize() throws IOException { - String str = "telephony\n"; - output.write(str.getBytes(), 0, str.length()); - output.flush(); - - byte[] abuf = { 0x04, 0x00, 0x40, 0x41 }; - output.write(abuf); - output.flush(); - - byte[] bbuf = { 0x16, 0x00, 0x00, 0x00 }; - output.write(bbuf); - output.flush(); - - output.write(str.getBytes(), 0, str.length()); - output.flush(); - - byte[] cbuf = { 0x00, 0x00, 0x40, 0x47 }; - output.write(cbuf); - output.flush(); - - byte[] dbuf = { 0x00, 0x00, 0x40, 0x42 }; - output.write(dbuf); - output.flush(); + try { + String str = "telephony\n"; + output.write(str.getBytes(), 0, str.length()); + output.flush(); + + byte[] abuf = { 0x04, 0x00, 0x40, 0x41 }; + output.write(abuf); + output.flush(); + + byte[] bbuf = { 0x16, 0x00, 0x00, 0x00 }; + output.write(bbuf); + output.flush(); + + output.write(str.getBytes(), 0, str.length()); + output.flush(); + + byte[] cbuf = { 0x00, 0x00, 0x40, 0x47 }; + output.write(cbuf); + output.flush(); + + byte[] dbuf = { 0x00, 0x00, 0x40, 0x42 }; + output.write(dbuf); + output.flush(); + } catch (SocketException e) { + return; + } catch (Exception e) { + e.printStackTrace(); + } } public void sendAskData() throws Exception { if (!isConnected()) connect(); - - String str = "telephony\n"; - output.write(str.getBytes(), 0, str.length()); - output.flush(); - - byte[] buf = { 0x00, 0x00, 0x11, 0x5b }; - output.write(buf); - output.flush(); + try { + String str = "telephony\n"; + output.write(str.getBytes(), 0, str.length()); + output.flush(); + + byte[] buf = { 0x00, 0x00, 0x11, 0x5b }; + output.write(buf); + output.flush(); + } catch (SocketException e) { + disconnect(); + return; + } catch (Exception e) { + e.printStackTrace(); + disconnect(); + throw e; + } } public void sendDispose() throws Exception { if (!isConnected()) return; - String str = "telephony\n"; - output.write(str.getBytes(), 0, str.length()); - output.flush(); - - byte[] abuf = { 0x00, 0x00, 0x10, 0x01 }; - output.write(abuf); - output.flush(); - - byte[] bbuf = { 0x00, 0x00, 0x10, 0x02 }; - output.write(bbuf); - output.flush(); + try{ + String str = "telephony\n"; + output.write(str.getBytes(), 0, str.length()); + output.flush(); + + byte[] abuf = { 0x00, 0x00, 0x10, 0x01 }; + output.write(abuf); + output.flush(); + + byte[] bbuf = { 0x00, 0x00, 0x10, 0x02 }; + output.write(bbuf); + output.flush(); + } catch (SocketException e) { + disconnect(); + return; + } catch (Exception e) { + e.printStackTrace(); + disconnect(); + throw e; + } } public boolean send(AbstractGA sendObj) throws Exception { @@ -231,6 +260,9 @@ public class TelephonySocket { } output.flush(); result = true; + } catch (SocketException e) { + disconnect(); + return false; } catch (Exception e) { e.printStackTrace(); disconnect(); @@ -260,11 +292,13 @@ public class TelephonySocket { byte[] main = sensorMsg.getBytes(); if (main.length > 0) { -// ByteUtil.printHex(main, "send body"); output.write(main, 0, main.length); } output.flush(); result = true; + } catch (SocketException e) { + disconnect(); + return false; } catch (Exception e) { e.printStackTrace(); disconnect(); @@ -289,11 +323,13 @@ public class TelephonySocket { byte[] main = locationMsg.getBytes(); if (main.length > 0) { -// ByteUtil.printHex(main, "send body"); output.write(main, 0, main.length); } output.flush(); result = true; + } catch (SocketException e) { + disconnect(); + return false; } catch (Exception e) { e.printStackTrace(); disconnect(); @@ -328,6 +364,9 @@ public class TelephonySocket { } output.flush(); result = true; + } catch (SocketException e) { + disconnect(); + return false; } catch (Exception e) { e.printStackTrace(); disconnect(); diff --git a/org.tizen.injector/src/org/tizen/injector/view/InjectorView.java b/org.tizen.injector/src/org/tizen/injector/view/InjectorView.java index 5e3dd17..01f2b4a 100644 --- a/org.tizen.injector/src/org/tizen/injector/view/InjectorView.java +++ b/org.tizen.injector/src/org/tizen/injector/view/InjectorView.java @@ -46,19 +46,16 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.part.ViewPart; import org.eclipse.ui.progress.UIJob; - +import org.tizen.common.connection.ConnectionPlugin; +import org.tizen.common.connection.ConnectionPlugin.ISelectionListener; import org.tizen.injector.Injector; import org.tizen.injector.provider.AbstractInjectorItem; -import org.tizen.injector.socket.LocationSocket; -import org.tizen.injector.socket.SensorUDPSocket; import org.tizen.injector.socket.TelephonySocket; import org.tizen.injector.sourceProvider.InjectorStateProvider; import org.tizen.injector.util.FormPageUtil; -import org.tizen.common.connection.ConnectionPlugin; -import org.tizen.common.connection.ConnectionPlugin.ISelectionListener; -import org.tizen.common.util.DialogUtil; import org.tizen.sdblib.FileListingService.FileEntry; import org.tizen.sdblib.IDevice; +import org.tizen.sdblib.Log; public class InjectorView extends ViewPart implements ISelectionListener { @@ -83,8 +80,16 @@ ISelectionListener { private ArrayList formUtilList = new ArrayList(); private ArrayList> compositeArrayList = new ArrayList>(); + private final ArrayList listeners = new ArrayList(); + private static InjectorView view = null; + + public static InjectorView getDefault() { + return view; + } + @Override public void createPartControl(Composite parent) { + view = this; getCategories(); TabFolder tabFolder = createTabFolder(parent); @@ -361,30 +366,52 @@ ISelectionListener { { currentDevice = null; disconnect(); + notifySelectionListeners(selectedEntry); return; - } - else if (!selectedEntry.getFileListingService().getDevice().isEmulator()) + } else if (!selectedEntry.getFileListingService().getDevice().isEmulator()) { return; + } - if(currentDevice == null && selectedEntry.getName() != null) + String selectedName = selectedEntry.getFileListingService().getDevice().getSerialNumber(); + if(currentDevice == null && selectedName/*selectedEntry.getName()*/ != null) { connect(); currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); - return; - } - - if (currentDevice.getSerialNumber() != selectedEntry.getName()) { + } else if (currentDevice.getSerialNumber() != selectedName/*selectedEntry.getName()*/) { disconnect_finished = false; disconnect(); connect(); currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); - return; - } - else if(activated == false) + } else if(activated == false) { connect(); currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); + } else if (currentDevice.getSerialNumber() == selectedName/*selectedEntry.getName()*/) { return; } + + notifySelectionListeners(selectedEntry); + } + + public void addSelectionListener(ISelectionListener listener) { + listeners.add(listener); + } + + public void removeSelectionListener(ISelectionListener listener) { + listeners.remove(listener); + } + + public void notifySelectionListeners(FileEntry file) { + + ISelectionListener[] listenersCopy = listeners.toArray( + new ISelectionListener[listeners.size()]); + + for (ISelectionListener listener : listenersCopy) { + try { + listener.selectionChanged(file); + } catch (Exception e) { + Log.e("ConnectionPlugin", e); + } + } } } diff --git a/org.tizen.location.core/META-INF/MANIFEST.MF b/org.tizen.location.core/META-INF/MANIFEST.MF index 7d977c9..b16bf67 100644 --- a/org.tizen.location.core/META-INF/MANIFEST.MF +++ b/org.tizen.location.core/META-INF/MANIFEST.MF @@ -2,8 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Tizen Event Injector Location Core Bundle-SymbolicName: org.tizen.location.core;singleton:=true -Bundle-Version: 1.3.20.qualifier -Bundle-Vendor: Tizen +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: Samsung Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: org.tizen.location.core.injector, org.tizen.location.core.model, diff --git a/org.tizen.location.core/src/org/tizen/location/core/injector/LocationInjector.java b/org.tizen.location.core/src/org/tizen/location/core/injector/LocationInjector.java index 189b35b..c16f576 100644 --- a/org.tizen.location.core/src/org/tizen/location/core/injector/LocationInjector.java +++ b/org.tizen.location.core/src/org/tizen/location/core/injector/LocationInjector.java @@ -41,6 +41,7 @@ import org.tizen.sdblib.IDevice; import org.tizen.sdblib.SyncService; import org.tizen.sdblib.SyncService.SyncResult; //import org.tizen.location.core.injector.DebugLog; +import org.tizen.injector.view.InjectorView; import org.tizen.location.core.model.GeoLocationVO; import org.tizen.location.core.protocol.GeoLocation; @@ -52,8 +53,11 @@ public class LocationInjector implements ISelectionListener { private final String setLogMode = "vconftool set -t int db/location/replay/ReplayMode 1"; // NMEA MODE(LOG MODE) private final String setManualMode = "vconftool set -t int db/location/replay/ReplayMode 2"; // MANUAL MODE + private boolean isChange = false; + private GeoLocation location = null; + public LocationInjector() { - ConnectionPlugin.getDefault().addSelectionListener(this); + InjectorView.getDefault().addSelectionListener(this); // TargetConnectionControl.addTargetConnectionListener(this); } @@ -121,6 +125,10 @@ public class LocationInjector implements ISelectionListener { } } + public void injectChange(GeoLocation location) { + this.location = location; + this.isChange = true; + } public void inject(GeoLocation location, IProgressMonitor monitor) throws IOException { if (monitor == null) { monitor = new NullProgressMonitor(); @@ -151,6 +159,14 @@ public class LocationInjector implements ISelectionListener { setStopMode(); return; } + + if (isChange) { + if (!injectLocation(this.location.getLatitude(), this.location.getLongitude())) { + monitor.setCanceled(true); + return ; + } + isChange = false; + } } } @@ -198,6 +214,9 @@ public class LocationInjector implements ISelectionListener { this.monitor = monitor; } + public boolean isCanceld() { + return this.monitor.isCanceled(); + } //@Override public void connect() { } @@ -209,7 +228,7 @@ public class LocationInjector implements ISelectionListener { @Override protected void finalize() throws Throwable { - ConnectionPlugin.getDefault().removeSelectionListener(this); + InjectorView.getDefault().removeSelectionListener(this); // TargetConnectionControl.removeTargetConnectionListener(this); super.finalize(); } diff --git a/org.tizen.location.log/META-INF/MANIFEST.MF b/org.tizen.location.log/META-INF/MANIFEST.MF index 956ee4e..23aabdb 100644 --- a/org.tizen.location.log/META-INF/MANIFEST.MF +++ b/org.tizen.location.log/META-INF/MANIFEST.MF @@ -2,13 +2,13 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Tizen Event Injector Location Log Bundle-SymbolicName: org.tizen.location.log;singleton:=true -Bundle-Version: 1.3.20.qualifier -Bundle-Vendor: Tizen +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: Samsung Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.ui.forms;bundle-version="3.3.103", org.tizen.common, - org.tizen.injector;bundle-version="1.3.13", - org.tizen.location.core;bundle-version="1.0.0" + org.tizen.injector, + org.tizen.location.core Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/org.tizen.location.log/src/org/tizen/location/log/page/LogFile.java b/org.tizen.location.log/src/org/tizen/location/log/page/LogFile.java index f5db233..8f52c2d 100644 --- a/org.tizen.location.log/src/org/tizen/location/log/page/LogFile.java +++ b/org.tizen.location.log/src/org/tizen/location/log/page/LogFile.java @@ -65,8 +65,8 @@ public class LogFile extends AbstractInjectorPage { private Button injectButton; private Button cancelButton; - private LocationInjector injector; - + private LocationInjector injector = null; + private Job injectJob = null; public LogFile(AbstractInjectorItem item, String name) { super(item, name); } @@ -117,11 +117,23 @@ public class LogFile extends AbstractInjectorPage { @Override public void widgetSelected(SelectionEvent e) { + if(injector != null) { + injector.setCancel(true); + if (injectJob != null) { + try { + injectJob.join(); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + } + final File file = new File(filenameText.getText()); if (file.exists()) { - Job injectJob = new Job("Inject Job") { - + injectJob = new Job("Inject Job") { + @Override protected IStatus run(IProgressMonitor monitor) { try { @@ -138,6 +150,8 @@ public class LogFile extends AbstractInjectorPage { } } catch (IOException e) { return Status.CANCEL_STATUS; + } finally { + injector = null; } return Status.OK_STATUS; } @@ -171,6 +185,14 @@ public class LogFile extends AbstractInjectorPage { @Override public void widgetSelected(SelectionEvent e) { injector.setCancel(true); + if (injectJob != null) { + try { + injectJob.join(); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } injectButton.setEnabled(true); cancelButton.setEnabled(false); ((Log) getParent()).setSiblingsEnabled(true); diff --git a/org.tizen.location.manual/META-INF/MANIFEST.MF b/org.tizen.location.manual/META-INF/MANIFEST.MF index 39be509..bc1fac1 100644 --- a/org.tizen.location.manual/META-INF/MANIFEST.MF +++ b/org.tizen.location.manual/META-INF/MANIFEST.MF @@ -2,8 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Tizen Event Injector Location Manual Bundle-SymbolicName: org.tizen.location.manual;singleton:=true -Bundle-Version: 1.3.20.qualifier -Bundle-Vendor: Tizen +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: Samsung Require-Bundle: org.eclipse.ui, org.eclipse.ui.forms, org.eclipse.core.runtime, diff --git a/org.tizen.location.manual/src/org/tizen/location/manual/page/Coordinate.java b/org.tizen.location.manual/src/org/tizen/location/manual/page/Coordinate.java index 6576406..0d77261 100644 --- a/org.tizen.location.manual/src/org/tizen/location/manual/page/Coordinate.java +++ b/org.tizen.location.manual/src/org/tizen/location/manual/page/Coordinate.java @@ -67,8 +67,8 @@ public class Coordinate extends AbstractInjectorPage { private Button injectButton; private Button cancelButton; - private LocationInjector injector; - + private LocationInjector injector = null; + private Job injectJob = null; public Coordinate(AbstractInjectorItem item, String name) { super(item, name); } @@ -111,8 +111,15 @@ public class Coordinate extends AbstractInjectorPage { injectButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if(injector != null) - injector.setCancel(true); + if(injector != null && !injector.isCanceld()) { + injectButton.setEnabled(false); + Double latitude = Double.parseDouble(latitudeText.getText().trim()); + Double longitude = Double.parseDouble(longitudeText.getText().trim()); + final GeoLocation location = new GeoLocation(latitude, longitude); + injector.injectChange(location); + return; + } + Double latitude = Double.parseDouble(latitudeText.getText().trim()); Double longitude = Double.parseDouble(longitudeText.getText().trim()); final GeoLocation location = new GeoLocation(latitude, longitude); @@ -125,7 +132,7 @@ public class Coordinate extends AbstractInjectorPage { // NMEASentences.add(new NMEA0183_GPRMC(Double.parseDouble(latitudeText.getText().trim()), Double.parseDouble(longitudeText.getText().trim()))); // NMEASentences.add(new NMEA0183_GPGSA()); - Job injectJob = new Job("Inject Job") { + injectJob = new Job("Inject Job") { @Override protected IStatus run(IProgressMonitor monitor) { @@ -138,6 +145,8 @@ public class Coordinate extends AbstractInjectorPage { } } catch (IOException e) { return Status.CANCEL_STATUS; + } finally { + injector = null; } return Status.OK_STATUS; } @@ -164,6 +173,14 @@ public class Coordinate extends AbstractInjectorPage { @Override public void widgetSelected(SelectionEvent e) { injector.setCancel(true); + if (injectJob != null) { + try { + injectJob.join(); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } injectButton.setEnabled(validateValues()); cancelButton.setEnabled(false); ((Manual) getParent()).setSiblingsEnabled(true); @@ -184,7 +201,7 @@ public class Coordinate extends AbstractInjectorPage { value = Double.parseDouble(latitudeText.getText()); - if (value >= 90 || value <= -90) { + if (value > 90 || value < -90) { return false; } @@ -194,7 +211,7 @@ public class Coordinate extends AbstractInjectorPage { value = Double.parseDouble(longitudeText.getText()); - if (value >= 180 || value <= -180) { + if (value > 180 || value < -180) { return false; } diff --git a/org.tizen.location.map/META-INF/MANIFEST.MF b/org.tizen.location.map/META-INF/MANIFEST.MF index fcdb10a..5b16c6b 100644 --- a/org.tizen.location.map/META-INF/MANIFEST.MF +++ b/org.tizen.location.map/META-INF/MANIFEST.MF @@ -2,8 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Tizen Event Injector Location Map Bundle-SymbolicName: org.tizen.location.map;singleton:=true -Bundle-Version: 1.3.20.qualifier -Bundle-Vendor: Tizen +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: Samsung Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.core.net;bundle-version="1.2.1", diff --git a/org.tizen.location.map/src/org/tizen/location/map/page/MapImage.java b/org.tizen.location.map/src/org/tizen/location/map/page/MapImage.java index fa9328b..b97829c 100644 --- a/org.tizen.location.map/src/org/tizen/location/map/page/MapImage.java +++ b/org.tizen.location.map/src/org/tizen/location/map/page/MapImage.java @@ -27,7 +27,9 @@ package org.tizen.location.map.page; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.net.UnknownHostException; @@ -85,8 +87,8 @@ public class MapImage extends AbstractInjectorPage { private Button resetButton; private Button cancelButton; - private LocationInjector injector; - + private LocationInjector injector = null; + private Job injectJob = null; public MapImage(AbstractInjectorItem item, String name, DefaultTableModel model) { super(item, name); @@ -115,24 +117,56 @@ public class MapImage extends AbstractInjectorPage { URL url = new URL("http://www.google.com"); //open a connection to that source - HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection(); - + HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection(); //trying to retrieve data from the source. If there //is no connection, this line will fail - Object objData = urlConnect.getContent(); + urlConnect.connect(); + boolean isLoading = false; + if (urlConnect.getResponseCode() != -1) { + // parsing title + BufferedReader in = new BufferedReader (new InputStreamReader(urlConnect.getInputStream())); + String line; + String pre = ""; + String tail = ""; + + boolean isNextLine = false; + while((line = in.readLine()) != null) { + if (line.contains(pre) || isNextLine) { + if (line.contains("google")) { + isLoading = true; + } + if (!isLoading && !line.contains(tail)) { + isNextLine = true; + continue; + } + break; + } + } + in.close(); + } + + if (!isLoading) { + this.googleMapScript = "



" + + "
Failed to load the map.
Please check the network status!
"; + return; + } urlConnect.disconnect(); } catch (UnknownHostException e) { // TODO Auto-generated catch block - e.printStackTrace(); + //e.printStackTrace(); this.googleMapScript = "



Can't connect to network.
"; return; } catch (IOException e) { // TODO Auto-generated catch block - //e.printStackTrace(); + //e.printStackTrace(); + this.googleMapScript = "



" + + "
Failed to load the map.
" + e.getMessage() + + "
"; + return; } } - + this.googleMapScript = "" //$NON-NLS-1$ + "" //$NON-NLS-1$ + "" //$NON-NLS-1$ @@ -309,7 +343,7 @@ public class MapImage extends AbstractInjectorPage { // NMEASentences.add(new NMEA0183_GPGSA()); // } - Job injectJob = new Job("Inject Job") { + injectJob = new Job("Inject Job") { @Override protected IStatus run(IProgressMonitor monitor) { @@ -378,6 +412,14 @@ public class MapImage extends AbstractInjectorPage { @Override public void widgetSelected(SelectionEvent e) { injector.setCancel(true); + if (injectJob != null) { + try { + injectJob.join(); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } injectButton.setEnabled(true); browser.setEnabled(true); resetButton.setEnabled(true); diff --git a/org.tizen.nfc/META-INF/MANIFEST.MF b/org.tizen.nfc/META-INF/MANIFEST.MF index 1a440bc..08695a4 100644 --- a/org.tizen.nfc/META-INF/MANIFEST.MF +++ b/org.tizen.nfc/META-INF/MANIFEST.MF @@ -3,12 +3,13 @@ Bundle-ManifestVersion: 2 Bundle-Name: Tizen Event Injector Nfc Bundle-SymbolicName: org.tizen.nfc;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: Tizen +Bundle-Vendor: Samsung Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Require-Bundle: org.tizen.injector, org.eclipse.swt;bundle-version="3.6.2", - org.tizen.common;bundle-version="1.3.20", - org.tizen.common.connection;bundle-version="1.0.0", - org.eclipse.core.runtime;bundle-version="3.7.0" + org.tizen.common, + org.tizen.common.connection, + org.eclipse.core.runtime;bundle-version="3.7.0", + org.eclipse.core.commands;bundle-version="3.6.0" Import-Package: org.tizen.sdblib, org.eclipse.ui.plugin diff --git a/org.tizen.nfc/src/org/tizen/nfc/Nfc.java b/org.tizen.nfc/src/org/tizen/nfc/Nfc.java index 64b7975..003014c 100644 --- a/org.tizen.nfc/src/org/tizen/nfc/Nfc.java +++ b/org.tizen.nfc/src/org/tizen/nfc/Nfc.java @@ -3,19 +3,25 @@ * * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * - * Contact: - * Sungmin Ha - * DongKyun Yun + * Contact: * Jihye kim + * Sungmin Ha + * Yeongkyoon Lee + * + * 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 * - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * 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. * * Contributors: * - S-Core Co., Ltd - * */ package org.tizen.nfc; diff --git a/org.tizen.nfc/src/org/tizen/nfc/page/NDEFRecord.java b/org.tizen.nfc/src/org/tizen/nfc/page/NDEFRecord.java index 29ee521..85dc27a 100644 --- a/org.tizen.nfc/src/org/tizen/nfc/page/NDEFRecord.java +++ b/org.tizen.nfc/src/org/tizen/nfc/page/NDEFRecord.java @@ -1,3 +1,29 @@ +/* + * org.tizen.nfc.tag.page + * + * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jihye kim + * Sungmin Ha + * Yeongkyoon Lee + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + */ + package org.tizen.nfc.page; public class NDEFRecord diff --git a/org.tizen.nfc/src/org/tizen/nfc/page/NfcCommand.java b/org.tizen.nfc/src/org/tizen/nfc/page/NfcCommand.java index 56226a3..8d6e81b 100644 --- a/org.tizen.nfc/src/org/tizen/nfc/page/NfcCommand.java +++ b/org.tizen.nfc/src/org/tizen/nfc/page/NfcCommand.java @@ -1,3 +1,29 @@ +/* + * org.tizen.nfc.tag.page + * + * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jihye kim + * Sungmin Ha + * Yeongkyoon Lee + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + */ + package org.tizen.nfc.page; public class NfcCommand diff --git a/org.tizen.nfc/src/org/tizen/nfc/page/NfcDialog.java b/org.tizen.nfc/src/org/tizen/nfc/page/NfcDialog.java index 5bfc9e8..4a7178c 100644 --- a/org.tizen.nfc/src/org/tizen/nfc/page/NfcDialog.java +++ b/org.tizen.nfc/src/org/tizen/nfc/page/NfcDialog.java @@ -1,3 +1,29 @@ +/* + * org.tizen.nfc.tag.page + * + * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jihye kim + * Sungmin Ha + * Yeongkyoon Lee + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + */ + package org.tizen.nfc.page; import org.eclipse.swt.SWT; diff --git a/org.tizen.nfc/src/org/tizen/nfc/page/NfcMimeType.java b/org.tizen.nfc/src/org/tizen/nfc/page/NfcMimeType.java index 06f8ce4..e762eea 100644 --- a/org.tizen.nfc/src/org/tizen/nfc/page/NfcMimeType.java +++ b/org.tizen.nfc/src/org/tizen/nfc/page/NfcMimeType.java @@ -1,3 +1,29 @@ +/* + * org.tizen.nfc.tag.page + * + * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jihye kim + * Sungmin Ha + * Yeongkyoon Lee + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + */ + package org.tizen.nfc.page; import java.util.ArrayList; diff --git a/org.tizen.nfc/src/org/tizen/nfc/page/NfcPage.java b/org.tizen.nfc/src/org/tizen/nfc/page/NfcPage.java index 4598a65..12992a0 100644 --- a/org.tizen.nfc/src/org/tizen/nfc/page/NfcPage.java +++ b/org.tizen.nfc/src/org/tizen/nfc/page/NfcPage.java @@ -1,21 +1,27 @@ /* * org.tizen.nfc.tag.page - * + * * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * Jihye kim * Sungmin Ha - * DongKyun Yun + * Yeongkyoon Lee + * + * 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. * - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * * Contributors: * - S-Core Co., Ltd - * */ package org.tizen.nfc.page; @@ -35,13 +41,13 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; - -import org.tizen.injector.provider.AbstractInjectorItem; -import org.tizen.injector.provider.AbstractInjectorPage; import org.tizen.common.connection.ConnectionPlugin; import org.tizen.common.connection.ConnectionPlugin.ISelectionListener; import org.tizen.common.connection.ui.TizenRemoteFileDialog; import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult; +import org.tizen.injector.provider.AbstractInjectorItem; +import org.tizen.injector.provider.AbstractInjectorPage; +import org.tizen.injector.view.InjectorView; import org.tizen.sdblib.FileListingService.FileEntry; import org.tizen.sdblib.IDevice; import org.tizen.sdblib.MultiLineReceiver; @@ -99,8 +105,8 @@ public class NfcPage extends AbstractInjectorPage implements ISelectionListener @Override protected void createContents() { + InjectorView.getDefault().addSelectionListener(this); currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); - ConnectionPlugin.getDefault().addSelectionListener(this); shell = parent.getShell(); @@ -189,7 +195,7 @@ public class NfcPage extends AbstractInjectorPage implements ISelectionListener private void Selected(SelectionEvent e) { int i = cmbRecordFormat.getSelectionIndex(); if (i != -1) { - checkRecordFormat(i); + checkRecordFormat(i + 1); txtRecordTypeName.setText(""); cmbRecordTypeName.select(0); txtRecordID.setText(""); @@ -359,7 +365,7 @@ public class NfcPage extends AbstractInjectorPage implements ISelectionListener if (i != -1) { NDEFRecord record = RecordList.get(i); checkRecordFormat(record.getFormat()); - cmbRecordFormat.select(record.getFormat()); + cmbRecordFormat.select(record.getFormat() - 1); if (record.getFormat() == 1) { if (record.getTypeName().compareTo("U") == 0) @@ -433,7 +439,7 @@ public class NfcPage extends AbstractInjectorPage implements ISelectionListener { cmbRecordFormat.setEnabled(true); - checkRecordFormat(cmbRecordFormat.getSelectionIndex()); + checkRecordFormat(cmbRecordFormat.getSelectionIndex() + 1); txtRecordTypeName.setText(""); cmbRecordTypeName.select(0); txtRecordID.setText(""); @@ -479,7 +485,7 @@ public class NfcPage extends AbstractInjectorPage implements ISelectionListener { cmbRecordFormat.setEnabled(true); - checkRecordFormat(cmbRecordFormat.getSelectionIndex()); + checkRecordFormat(cmbRecordFormat.getSelectionIndex() + 1); txtRecordTypeName.setText(""); cmbRecordTypeName.select(0); txtRecordID.setText(""); @@ -544,10 +550,10 @@ public class NfcPage extends AbstractInjectorPage implements ISelectionListener break; case 2: // NDEF_TNF_MIME_MEDIA cmbRecordTypeName.setEnabled(false); - txtRecordTypeName.setEnabled(true); + txtRecordTypeName.setEnabled(false); txtRecordTypeName.setEditable(false); txtRecordID.setEnabled(true); - txtRecordPayload.setEnabled(true); + txtRecordPayload.setEnabled(false); txtRecordPayload.setEditable(false); butSelectMediaFile.setEnabled(true); break; @@ -655,9 +661,9 @@ public class NfcPage extends AbstractInjectorPage implements ISelectionListener private void setRecordValue(NDEFRecord record) { - record.setFormat(cmbRecordFormat.getSelectionIndex()); + record.setFormat(cmbRecordFormat.getSelectionIndex() + 1); - if (cmbRecordFormat.getSelectionIndex() == 1) { + if ((cmbRecordFormat.getSelectionIndex() + 1) == 1) { record.setTypeName(TypeNameList[cmbRecordTypeName.getSelectionIndex()]); } else { if (txtRecordTypeName.getText().isEmpty() == true) @@ -761,7 +767,7 @@ public class NfcPage extends AbstractInjectorPage implements ISelectionListener return; } if (checkFileSize(MediaFilePath) == false) { - NfcDialog.openErrorDialog(shell, "Size of selected file is too big. Available file size is under of 10.\n"); + NfcDialog.openErrorDialog(shell, "Size of selected file is too big. Available file size is under of 10KB.\n"); return; } txtRecordTypeName.setEnabled(true); @@ -927,7 +933,7 @@ public class NfcPage extends AbstractInjectorPage implements ISelectionListener @Override protected void finalize() throws Throwable { - ConnectionPlugin.getDefault().removeSelectionListener(this); + InjectorView.getDefault().removeSelectionListener(this); // TargetConnectionControl.removeTargetConnectionListener(this); super.finalize(); } @@ -942,11 +948,11 @@ public class NfcPage extends AbstractInjectorPage implements ISelectionListener .isEmulator()) return; - if (currentDevice == null && selectedEntry.getName() != null) + if(currentDevice == null && selectedEntry.getName() != null) { connect(); - else if (currentDevice == null && selectedEntry.getName() == null) + } else if(currentDevice == null && selectedEntry.getName() == null) { return; - else if (currentDevice.getSerialNumber() != selectedEntry.getName()) { + } else if (currentDevice.getSerialNumber() != selectedEntry.getName()) { disconnect(); connect(); } diff --git a/org.tizen.nfc/src/org/tizen/nfc/page/NfcStringResource.java b/org.tizen.nfc/src/org/tizen/nfc/page/NfcStringResource.java index c3cc808..2c93807 100644 --- a/org.tizen.nfc/src/org/tizen/nfc/page/NfcStringResource.java +++ b/org.tizen.nfc/src/org/tizen/nfc/page/NfcStringResource.java @@ -1,3 +1,29 @@ +/* + * org.tizen.nfc.tag.page + * + * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jihye kim + * Sungmin Ha + * Yeongkyoon Lee + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + */ + package org.tizen.nfc.page; import java.util.ArrayList; @@ -56,12 +82,12 @@ class RecordFormat extends NfcStringResource private RecordFormat() { - add(0, "NDEF_TNF_EMPTY"); - add(1, "NDEF_TNF_WELL_KNOWN"); - add(2, "NDEF_TNF_MIME_MEDIA"); - add(3, "NDEF_TNF_ABSOLUTE_URI"); - add(4, "NDEF_TNF_EXTERNAL"); - add(5, "NDEF_TNF_UNKNOWN"); + //add(0, "NDEF_TNF_EMPTY"); + add(0, "NDEF_TNF_WELL_KNOWN"); + add(1, "NDEF_TNF_MIME_MEDIA"); + add(2, "NDEF_TNF_ABSOLUTE_URI"); + add(3, "NDEF_TNF_EXTERNAL"); + //add(5, "NDEF_TNF_UNKNOWN"); } } diff --git a/org.tizen.sensor.accelerometer/META-INF/MANIFEST.MF b/org.tizen.sensor.accelerometer/META-INF/MANIFEST.MF index 9a4ba5f..bdf9d3e 100644 --- a/org.tizen.sensor.accelerometer/META-INF/MANIFEST.MF +++ b/org.tizen.sensor.accelerometer/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Tizen Event Injector Sensor Accelerometer Bundle-SymbolicName: org.tizen.sensor.accelerometer;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: Tizen +Bundle-Vendor: Samsung Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Require-Bundle: org.eclipse.ui;bundle-version="3.5.2", org.tizen.injector, diff --git a/org.tizen.sensor.accelerometer/src/org/tizen/sensor/accelerometer/page/Accelerometer.java b/org.tizen.sensor.accelerometer/src/org/tizen/sensor/accelerometer/page/Accelerometer.java index 1913722..a247c1e 100644 --- a/org.tizen.sensor.accelerometer/src/org/tizen/sensor/accelerometer/page/Accelerometer.java +++ b/org.tizen.sensor.accelerometer/src/org/tizen/sensor/accelerometer/page/Accelerometer.java @@ -44,6 +44,7 @@ import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; @@ -68,9 +69,12 @@ public class Accelerometer extends AbstractInjectorPage { Button checkboxGyro; Button checkboxGeoMagnetic; Button checkboxOrientation; + Button button01, button02, button03; private Text dataText; Timer dataOutputTimer; + int button_click_yaw = 180, button_click_pitch = 90, button_click_roll = 180; + double north; double east; double vertical; @@ -84,6 +88,7 @@ public class Accelerometer extends AbstractInjectorPage { static String accelerometerData; static String magneticData; + static String orientationData; static String gyroData; static boolean orientation_active = true; @@ -104,7 +109,7 @@ public class Accelerometer extends AbstractInjectorPage { @Override protected void createContents() { - init(); + //init(); Composite mainComposite = formUtil.createComposite(parent, 2); // Create Mobile Composite to draw virtual mobile phone Composite mobileComposite = formUtil.createComposite(mainComposite); @@ -128,7 +133,7 @@ public class Accelerometer extends AbstractInjectorPage { // Create composite containing moving type selection radio buttons Composite radioComposite = formUtil.createComposite(mobileComposite, 3); - Button button01 = formUtil.createButton(radioComposite, "Yaw/Pitch", SWT.RADIO); + button01 = formUtil.createButton(radioComposite, "Yaw/Pitch", SWT.RADIO); button01.setSelection(true); mode = Mode.YAW_PITCH; button01.addSelectionListener(new SelectionAdapter() { @@ -138,7 +143,7 @@ public class Accelerometer extends AbstractInjectorPage { super.widgetSelected(e); } }); - Button button02 = formUtil.createButton(radioComposite, "Roll/Pitch", SWT.RADIO); + button02 = formUtil.createButton(radioComposite, "Roll/Pitch", SWT.RADIO); button02.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -146,7 +151,7 @@ public class Accelerometer extends AbstractInjectorPage { super.widgetSelected(e); } }); - Button button03 = formUtil.createButton(radioComposite, "Move", SWT.RADIO); + button03 = formUtil.createButton(radioComposite, "Move", SWT.RADIO); button03.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -176,46 +181,114 @@ public class Accelerometer extends AbstractInjectorPage { DecimalFormat mf = new DecimalFormat("#0.00"); Magnetic magnetic = Magnetic.getInstance(); - if(changed_accel == true){ - if(checkboxAccelerometer.isDisposed()) - dataOutputTimer.stop(); - else if( checkboxAccelerometer.getSelection()){ - accelerometerData = "accelerometer : " + mf.format(panel.read_accelx) + ", "+ mf.format(panel.read_accely) + - ", "+ mf.format(panel.read_accelz); + if(checkboxAccelerometer.isDisposed()) + { + dataOutputTimer.stop(); + accelerometerData = "accelerometer : Disable"; + orientationData = "orientation : Disable"; + } + else + { + if(changed_accel == true){ + if( checkboxAccelerometer.getSelection()){ + accelerometerData = "accelerometer : " + mf.format(panel.read_accelx) + ", "+ mf.format(panel.read_accely) + + ", "+ mf.format(panel.read_accelz); + } + else { + accelerometerData = "accelerometer : Disable"; + orientationData = "orientation : Disable"; + } + changed_accel = false; } - else { + else if(!checkboxAccelerometer.getSelection()) + { accelerometerData = "accelerometer : Disable"; + orientationData = "orientation : Disable"; + } + else + { + accelerometerData = "accelerometer : " + mf.format(panel.read_accelx) + ", "+ mf.format(panel.read_accely) + + ", "+ mf.format(panel.read_accelz); } - changed_accel = false; } - if(changed_geo == true){ - if(checkboxGeoMagnetic.isDisposed()) - dataOutputTimer.stop(); - else if( checkboxGeoMagnetic.getSelection()) { - magneticData = "magnetic filed : " + mf.format(magnetic.getReadCompassX()) + - ", " + mf.format(magnetic.getReadCompassY()) + ", " + mf.format(magnetic.getReadCompassZ()) + "\n" + "orientation : " + mf.format(magnetic.getAzimuth()) + - ", " + mf.format(magnetic.getPitch()) + ", " + mf.format(magnetic.getRoll()); + + if(checkboxGeoMagnetic.isDisposed()) + { + dataOutputTimer.stop(); + magneticData = "magnetic filed : Disable"; + orientationData = "orientation : Disable"; + } + else + { + if(changed_geo == true){ + if( checkboxGeoMagnetic.getSelection()) { + magneticData = "magnetic filed : " + mf.format(magnetic.getReadCompassX()) + + ", " + mf.format(magnetic.getReadCompassY()) + ", " + mf.format(magnetic.getReadCompassZ()); + + if( checkboxOrientation.getSelection() ) { + orientationData = "orientation : " + mf.format(magnetic.getAzimuth()) + + ", " + mf.format(magnetic.getPitch()) + ", " + mf.format(magnetic.getRoll()); + } + else + orientationData = "orientation : Disable"; + } + else { + magneticData = "magnetic filed : Disable"; + orientationData = "orientation : Disable"; + } + changed_geo = false; + } + else if(!checkboxGeoMagnetic.getSelection()) + { + magneticData = "magnetic filed : Disable"; + orientationData = "orientation : Disable"; } - else { - magneticData = "magnetic : Disable"; + else + { + magneticData = "magnetic filed : " + mf.format(magnetic.getReadCompassX()) + + ", " + mf.format(magnetic.getReadCompassY()) + ", " + mf.format(magnetic.getReadCompassZ()); + + if( checkboxOrientation.getSelection() ) { + orientationData = "orientation : " + mf.format(magnetic.getAzimuth()) + + ", " + mf.format(magnetic.getPitch()) + ", " + mf.format(magnetic.getRoll()); + } + else + orientationData = "orientation : Disable"; } - changed_geo = false; } - if(changed_gyro == true){ - if(checkboxGyro.isDisposed()) - dataOutputTimer.stop(); - else if( checkboxGyro.getSelection()) { - gyroData = "gyroscope : " + mf.format(panel.gyroPitch) + ", " + mf.format(panel.gyroRoll) + ", " + mf.format(panel.gyroYaw); + + if(checkboxGyro.isDisposed()) + { + dataOutputTimer.stop(); + gyroData = "gyroscope : Disable"; + } + else + { + if(changed_gyro == true){ + + + if( checkboxGyro.getSelection()) { + gyroData = "gyroscope : " + mf.format(panel.gyroPitch) + ", " + mf.format(panel.gyroRoll) + ", " + mf.format(panel.gyroYaw); + } + else { + gyroData = "gyroscope : Disable"; + } + changed_gyro = false; } - else { + else if(!checkboxGyro.getSelection()) + { gyroData = "gyroscope : Disable"; } - changed_gyro = false; + else + { + gyroData = "gyroscope : " + mf.format(panel.gyroPitch) + ", " + mf.format(panel.gyroRoll) + ", " + mf.format(panel.gyroYaw); + } } + if(dataText.isDisposed()) dataOutputTimer.stop(); else - dataText.setText(accelerometerData + "\n" + magneticData + "\n" + gyroData); + dataText.setText(accelerometerData + "\n" + magneticData + "\n" +orientationData + "\n" + gyroData); } }); } @@ -229,12 +302,12 @@ public class Accelerometer extends AbstractInjectorPage { pitchSlider = formUtil.createSlider(sliderComposite); setDefaultSlider(pitchSlider); pitchValue = (int) panel.pitchDegree; - pitchSlider.setSelection((int) panel.pitchDegree + 180); + pitchSlider.setSelection((int) panel.pitchDegree + button_click_pitch); pitchSlider.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // TODO : Fix here - pitchValue = pitchSlider.getSelection() - 180; + pitchValue = pitchSlider.getSelection() - button_click_pitch; panel.pitchDegree = pitchValue; panel.repaint(); @@ -253,12 +326,12 @@ public class Accelerometer extends AbstractInjectorPage { rollSlider = formUtil.createSlider(sliderComposite); setDefaultSlider(rollSlider); rollValue = (int) panel.rollDegree; - rollSlider.setSelection((int) panel.rollDegree + 180); + rollSlider.setSelection((int) panel.rollDegree + button_click_roll); rollSlider.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // TODO : Fix here - rollValue = rollSlider.getSelection() - 180; + rollValue = rollSlider.getSelection() - button_click_roll; panel.rollDegree = rollValue; panel.repaint(); @@ -277,12 +350,12 @@ public class Accelerometer extends AbstractInjectorPage { yawSlider = formUtil.createSlider(sliderComposite); setDefaultSlider(yawSlider); yawValue = (int) panel.yawDegree; - yawSlider.setSelection((int) panel.yawDegree + 180); + yawSlider.setSelection((int) panel.yawDegree + button_click_yaw); yawSlider.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // TODO : Fix here - yawValue = yawSlider.getSelection() - 180; + yawValue = yawSlider.getSelection() - button_click_yaw; panel.yawDegree = yawValue; panel.repaint(); sendMessage(panel.read_accelx, panel.read_accely, panel.read_accelz); @@ -380,11 +453,32 @@ public class Accelerometer extends AbstractInjectorPage { // TODO Auto-generated method stub } + + public void initValues() { + panel.rollDegree = 0; + panel.pitchDegree = 0; + panel.yawDegree = 0; + + panel.setOldGyroRollDegree(0); + panel.setOldGyroPitchDegree(0); + panel.setOldGyroYawDegree(0); + + yawValue = 0; + pitchValue = 0; + rollValue = 0; + } + private void createRotationButton( Composite rotationComposite){ - Button rotation0 = formUtil.createButton(rotationComposite, "Portrait", SWT.PUSH); - Button rotation90 = formUtil.createButton(rotationComposite, "Landscape", SWT.PUSH); - Button rotation180 = formUtil.createButton(rotationComposite, "Reverse Portrait", SWT.PUSH); - Button rotation270 = formUtil.createButton(rotationComposite, "Reverse Landscape", SWT.PUSH); + Composite buttonComposite = formUtil.createComposite(rotationComposite); + buttonComposite.setLayout(new GridLayout(4, true)); + Button rotation0 = formUtil.createButton(buttonComposite, "Portrait", SWT.PUSH); + rotation0.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + Button rotation90 = formUtil.createButton(buttonComposite, "Landscape", SWT.PUSH); + rotation90.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + Button rotation180 = formUtil.createButton(buttonComposite, "Reverse Portrait", SWT.PUSH); + rotation180.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + Button rotation270 = formUtil.createButton(buttonComposite, "Reverse Landscape", SWT.PUSH); + rotation270.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); rotation0.addSelectionListener(new SelectionListener(){ @Override public void widgetDefaultSelected(SelectionEvent e) { @@ -394,6 +488,11 @@ public class Accelerometer extends AbstractInjectorPage { @Override public void widgetSelected(SelectionEvent e) { button_click = true; + + pitchSlider.setSelection(90); + yawSlider.setSelection(180); + rollSlider.setSelection(180); + double axisX[] = {1,0,0}; double axisY[] = {0,0,1}; double axisZ[] = {0,-1,0}; @@ -401,6 +500,12 @@ public class Accelerometer extends AbstractInjectorPage { panel.setGyroAxisY(axisY); panel.setGyroAxisZ(axisZ); panel.repaint(); + + button_click_pitch = 90; + button_click_yaw = 180; + button_click_roll = 180; + + initValues(); } }); rotation90.addSelectionListener(new SelectionListener(){ @@ -410,6 +515,11 @@ public class Accelerometer extends AbstractInjectorPage { @Override public void widgetSelected(SelectionEvent e) { button_click = true; + + pitchSlider.setSelection(90); + yawSlider.setSelection(270); + rollSlider.setSelection(180); + double axisX[] = {0,0,1}; double axisY[] = {-1,0,0}; double axisZ[] = {0,-1,0}; @@ -417,6 +527,12 @@ public class Accelerometer extends AbstractInjectorPage { panel.setGyroAxisY(axisY); panel.setGyroAxisZ(axisZ); panel.repaint(); + + button_click_pitch = 90; + button_click_yaw = 270; + button_click_roll = 180; + + initValues(); } }); rotation180.addSelectionListener(new SelectionListener(){ @@ -428,6 +544,11 @@ public class Accelerometer extends AbstractInjectorPage { @Override public void widgetSelected(SelectionEvent e) { button_click = true; + + pitchSlider.setSelection(90); + yawSlider.setSelection(360); + rollSlider.setSelection(180); + double axisX[] = {-1,0,0}; double axisY[] = {0,0,-1}; double axisZ[] = {0,-1,0}; @@ -435,6 +556,12 @@ public class Accelerometer extends AbstractInjectorPage { panel.setGyroAxisY(axisY); panel.setGyroAxisZ(axisZ); panel.repaint(); + + button_click_pitch = 90; + button_click_yaw = 360; + button_click_roll = 180; + + initValues(); } }); rotation270.addSelectionListener(new SelectionListener(){ @@ -446,6 +573,10 @@ public class Accelerometer extends AbstractInjectorPage { @Override public void widgetSelected(SelectionEvent e) { button_click = true; + pitchSlider.setSelection(90); + yawSlider.setSelection(90); + rollSlider.setSelection(180); + double axisX[] = {0,0,-1}; double axisY[] = {1,0,0}; double axisZ[] = {0,-1,0}; @@ -453,6 +584,12 @@ public class Accelerometer extends AbstractInjectorPage { panel.setGyroAxisY(axisY); panel.setGyroAxisZ(axisZ); panel.repaint(); + + button_click_pitch = 90; + button_click_yaw = 90; + button_click_roll = 180; + + initValues(); } }); } @@ -540,7 +677,7 @@ public class Accelerometer extends AbstractInjectorPage { @Override public void run() { - yawSlider.setSelection(yawValue + 180); + yawSlider.setSelection(yawValue + button_click_yaw); } }); } @@ -566,7 +703,7 @@ public class Accelerometer extends AbstractInjectorPage { @Override public void run() { - pitchSlider.setSelection(pitchValue + 180); + pitchSlider.setSelection(pitchValue + button_click_pitch); } }); } @@ -592,7 +729,7 @@ public class Accelerometer extends AbstractInjectorPage { @Override public void run() { - rollSlider.setSelection(rollValue + 180); + rollSlider.setSelection(rollValue + button_click_roll); } }); } diff --git a/org.tizen.sensor.accelerometer/src/org/tizen/sensor/accelerometer/page/MobilePanel.java b/org.tizen.sensor.accelerometer/src/org/tizen/sensor/accelerometer/page/MobilePanel.java index 6c40abc..601585d 100644 --- a/org.tizen.sensor.accelerometer/src/org/tizen/sensor/accelerometer/page/MobilePanel.java +++ b/org.tizen.sensor.accelerometer/src/org/tizen/sensor/accelerometer/page/MobilePanel.java @@ -37,6 +37,7 @@ import javax.swing.Timer; import org.tizen.common.connection.ConnectionPlugin; import org.tizen.common.connection.ConnectionPlugin.ISelectionListener; +import org.tizen.injector.view.InjectorView; import org.tizen.sdblib.FileListingService.FileEntry; import org.tizen.sdblib.IDevice; import org.tizen.sensor.accelerometer.page.Accelerometer.Mode; @@ -287,8 +288,73 @@ public class MobilePanel extends JPanel implements ISelectionListener { private Timer orientationTimer; private boolean connected = false; + public void init_values() { + mPage.pitchSlider.setSelection(90); + mPage.yawSlider.setSelection(180); + mPage.rollSlider.setSelection(180); + + double axisX[] = {1,0,0}; + double axisY[] = {0,0,1}; + double axisZ[] = {0,-1,0}; + mPage.panel.setGyroAxisX(axisX); + mPage.panel.setGyroAxisY(axisY); + mPage.panel.setGyroAxisZ(axisZ); + mPage.panel.repaint(); + + mPage.button_click_pitch = 90; + mPage.button_click_yaw = 180; + mPage.button_click_roll = 180; + + mPage.panel.rollDegree = 0; + mPage.panel.pitchDegree = 0; + mPage.panel.yawDegree = 0; + + mPage.panel.old_gyro_rollDegree = 0; + mPage.panel.old_gyro_pitchDegree = 0; + mPage.panel.old_gyro_yawDegree = 0; + + mPage.yawValue = 0; + mPage.pitchValue = 0; + mPage.rollValue = 0; + + mPage.button01.setSelection(true); + mPage.button02.setSelection(false); + mPage.button03.setSelection(false); + mPage.mode = Mode.YAW_PITCH; + + mPage.checkboxAccelerometer.setSelection(true); + mPage.panel.accelerometerTimer(mPage.checkboxAccelerometer.getSelection()); + + mPage.checkboxGeoMagnetic.setSelection(true); + mPage.panel.geomagneticTimer(mPage.checkboxGeoMagnetic.getSelection()); + + mPage.checkboxGyro.setSelection(true); + mPage.panel.gyroTimer(mPage.checkboxGyro.getSelection()); + + mPage.checkboxOrientation.setSelection(true); + mPage.panel.orientationTimer(mPage.checkboxOrientation.getSelection()); + mPage.orientation_active = true; + + Magnetic magnetic = Magnetic.getInstance(); + magnetic.setAzimuth(0); + magnetic.setPitch(-90); + magnetic.setRoll(0); + + // reset average + partial_accelx = 0; + partial_accely = 0; + partial_accelz = 0; + partial_accel_n = 0; + + // reset average + partial_yaw = 0; + partial_pitch = 0; + partial_roll = 0; + partial_orientation_n = 0; + } + public MobilePanel(Accelerometer page) { - ConnectionPlugin.getDefault().addSelectionListener(this); + InjectorView.getDefault().addSelectionListener(this); currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); // TargetConnectionControl.addTargetConnectionListener(this); @@ -345,8 +411,6 @@ public class MobilePanel extends JPanel implements ISelectionListener { } }); - - addMouseMotionListener(new MouseMotionListener() { public void mouseDragged(MouseEvent e) { if (mPage.getMode() == Mode.YAW_PITCH) { @@ -538,7 +602,6 @@ private void updateSensorGyro(){ vec.reverserollpitchyaw(); // TODO: Add check condition to figure out selected sensors -// if (mSensorSimulator.mEnabledAccelerometer.isSelected()) { accelx = vec.x; accely = vec.y; accelz = vec.z; @@ -555,39 +618,12 @@ private void updateSensorGyro(){ if (accelz > limit) accelz = limit; if (accelz < -limit) accelz = -limit; } -// } else { -// accelx = 0; -// accely = 0; -// accelz = 0; -// } - - // Orientation is currently not affected: -// if (mSensorSimulator.mEnabledOrientation.isSelected()) { - //yaw = Math.toRadians(yawDegree); - //pitch = Math.toRadians(pitchDegree); - //roll = Math.toRadians(rollDegree); - // Since OpenGL uses degree as input, - // and it seems also more user-friendly, - // let us stick to degree. - // (it seems, professional sensors also use - // degree output.) + yaw = yawDegree; pitch = pitchDegree; roll = rollDegree; -// } else { -// yaw = 0; -// pitch = 0; -// roll = 0; -// } - - // TODO: Add check condition for showing acceleration bar -// if (mSensorSimulator.mShowAcceleration.isSelected()) { - // We only have to repaint if we show the acceleration, - // otherwise the phone does not change as long as there is - // no user interaction. - repaint(); -// }; + repaint(); } /** @@ -698,7 +734,6 @@ private void updateSensorGyro(){ if (read_roll >= 180) { read_roll -= 360; } - } } @@ -769,15 +804,13 @@ private void updateSensorGyro(){ Vector v1 = new Vector(phone[i]); Vector v2 = new Vector(phone[i+1]); -// v1.rollpitchyaw(rollDegree, pitchDegree, yawDegree); -// v2.rollpitchyaw(rollDegree, pitchDegree, yawDegree); if( i == 0 ) { v1.setAxisX(gyro_axisX); v1.setAxisY(gyro_axisY); v1.setAxisZ(gyro_axisZ); v1.rollpitchyaw(draw_roll, draw_pitch, draw_yaw); } - //v2.rollpitchyaw(draw_roll, draw_pitch, draw_yaw); + v1.setPosition(); v2.setPosition(); @@ -802,15 +835,12 @@ private void updateSensorGyro(){ centery - (v2.z + movez) * centerz / (centerz - v2.y))); } -// if (mSensorSimulator.mShowAcceleration.isSelected()) { - // Now we also draw the acceleration: + + // Now we also draw the acceleration: g2.setColor(Color.GREEN); Vector v1 = new Vector(0,0,0); Vector v2 = new Vector(accelx, accely, accelz); v2.scale(20 * ginverse); - //Vector v2 = new Vector(1, 0, 0); -// v1.rollpitchyaw(rollDegree, pitchDegree, yawDegree); -// v2.rollpitchyaw(rollDegree, pitchDegree, yawDegree); v1.setPosition(); v2.setPosition(); g2.draw(new Line2D.Double( @@ -823,7 +853,7 @@ private void updateSensorGyro(){ @Override protected void finalize() throws Throwable { - ConnectionPlugin.getDefault().removeSelectionListener(this); + InjectorView.getDefault().removeSelectionListener(this); // TargetConnectionControl.removeTargetConnectionListener(this); super.finalize(); } @@ -877,6 +907,19 @@ private void updateSensorGyro(){ public void setGyroAxisZ(double[] axis) { gyro_axisZ = axis.clone(); } + + public void setOldGyroRollDegree(double dgree) { + old_gyro_rollDegree = dgree; + } + + public void setOldGyroPitchDegree(double dgree) { + old_gyro_pitchDegree = dgree; + } + + public void setOldGyroYawDegree(double dgree) { + old_gyro_yawDegree = dgree; + } + // @Override public void connect() { connected = true; @@ -888,7 +931,8 @@ private void updateSensorGyro(){ mPage.dataOutputTimer.start(); } currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); - } + init_values(); +} // @Override public void disconnect() { diff --git a/org.tizen.sensor.accelerometer/src/org/tizen/sensor/magnetic/Magnetic.java b/org.tizen.sensor.accelerometer/src/org/tizen/sensor/magnetic/Magnetic.java index b0a30c9..8deb825 100644 --- a/org.tizen.sensor.accelerometer/src/org/tizen/sensor/magnetic/Magnetic.java +++ b/org.tizen.sensor.accelerometer/src/org/tizen/sensor/magnetic/Magnetic.java @@ -158,6 +158,17 @@ public class Magnetic { public int getRoll(){ return roll; } + + public void setAzimuth(int value){ + azimuth = value; + } + public void setPitch(int value){ + pitch = value; + } + public void setRoll(int value){ + roll = value; + } + public void updateSensorReadoutValues() { long currentTime = System.currentTimeMillis(); if (average_compass) { diff --git a/org.tizen.sensor.light/META-INF/MANIFEST.MF b/org.tizen.sensor.light/META-INF/MANIFEST.MF index 3dd22cb..adf6082 100644 --- a/org.tizen.sensor.light/META-INF/MANIFEST.MF +++ b/org.tizen.sensor.light/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Tizen Event Injector Sensor Light Bundle-SymbolicName: org.tizen.sensor.light;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: Tizen +Bundle-Vendor: Samsung Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: org.eclipse.swt.widgets, @@ -11,6 +11,7 @@ Import-Package: org.tizen.common.connection, org.tizen.common.util, org.tizen.sdblib -Require-Bundle: org.tizen.injector;bundle-version="1.3.20", +Require-Bundle: org.tizen.injector, org.eclipse.swt;bundle-version="3.5.2", - org.eclipse.core.runtime;bundle-version="3.7.0" + org.eclipse.core.runtime;bundle-version="3.7.0", + org.eclipse.core.commands;bundle-version="3.6.0" diff --git a/org.tizen.sensor.light/src/org/tizen/sensor/light/page/LightPage.java b/org.tizen.sensor.light/src/org/tizen/sensor/light/page/LightPage.java index f4a4b7b..9c1ff1d 100644 --- a/org.tizen.sensor.light/src/org/tizen/sensor/light/page/LightPage.java +++ b/org.tizen.sensor.light/src/org/tizen/sensor/light/page/LightPage.java @@ -48,6 +48,7 @@ import org.tizen.sdblib.IDevice; import org.tizen.injector.protocol.sensor.TestSensorMessage; import org.tizen.injector.provider.AbstractInjectorItem; import org.tizen.injector.provider.AbstractInjectorPage; +import org.tizen.injector.view.InjectorView; public class LightPage extends AbstractInjectorPage implements ISelectionListener { private Text sliderText; @@ -71,7 +72,7 @@ public class LightPage extends AbstractInjectorPage implements ISelectionListene @Override protected void createContents() { - ConnectionPlugin.getDefault().addSelectionListener(this); + InjectorView.getDefault().addSelectionListener(this); currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); // Composite mainComposite = formUtil.createComposite(parent, 3); @@ -119,6 +120,9 @@ public class LightPage extends AbstractInjectorPage implements ISelectionListene } luxData = Integer.parseInt(number); sendMessage(2, luxData); + + levelData = (luxData / 6554) % 10 + 1; + sendMessage(1, levelData); } }); @@ -165,7 +169,7 @@ public class LightPage extends AbstractInjectorPage implements ISelectionListene @Override protected void finalize() throws Throwable { - ConnectionPlugin.getDefault().removeSelectionListener(this); + InjectorView.getDefault().removeSelectionListener(this); // TargetConnectionControl.removeTargetConnectionListener(this); super.finalize(); } diff --git a/org.tizen.sensor.motion/META-INF/MANIFEST.MF b/org.tizen.sensor.motion/META-INF/MANIFEST.MF index a914a1a..3213e9c 100644 --- a/org.tizen.sensor.motion/META-INF/MANIFEST.MF +++ b/org.tizen.sensor.motion/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Tizen Event Injector Sensor Motion Bundle-SymbolicName: org.tizen.sensor.motion;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: Tizen +Bundle-Vendor: Samsung Require-Bundle: org.eclipse.core.runtime, org.eclipse.swt, org.tizen.injector diff --git a/org.tizen.sensor.proximity/META-INF/MANIFEST.MF b/org.tizen.sensor.proximity/META-INF/MANIFEST.MF index cd4b5d0..68bd13e 100644 --- a/org.tizen.sensor.proximity/META-INF/MANIFEST.MF +++ b/org.tizen.sensor.proximity/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Tizen Event Injector Sensor Proximity Bundle-SymbolicName: org.tizen.sensor.proximity;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: Tizen +Bundle-Vendor: Samsung Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Require-Bundle: org.tizen.injector, org.eclipse.swt, diff --git a/org.tizen.sensor.proximity/src/org/tizen/sensor/proximity/page/ProximityPage.java b/org.tizen.sensor.proximity/src/org/tizen/sensor/proximity/page/ProximityPage.java index bf9912e..a158de1 100644 --- a/org.tizen.sensor.proximity/src/org/tizen/sensor/proximity/page/ProximityPage.java +++ b/org.tizen.sensor.proximity/src/org/tizen/sensor/proximity/page/ProximityPage.java @@ -27,8 +27,10 @@ package org.tizen.sensor.proximity.page; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.MouseEvent; +//import org.eclipse.swt.events.SelectionEvent; +//import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; @@ -43,6 +45,7 @@ import org.tizen.sdblib.IDevice; import org.tizen.injector.protocol.sensor.TestSensorMessage; import org.tizen.injector.provider.AbstractInjectorItem; import org.tizen.injector.provider.AbstractInjectorPage; +import org.tizen.injector.view.InjectorView; public class ProximityPage extends AbstractInjectorPage implements ISelectionListener { private Text sliderText; @@ -59,13 +62,13 @@ public class ProximityPage extends AbstractInjectorPage implements ISelectionLis @Override protected void createContents() { - ConnectionPlugin.getDefault().addSelectionListener(this); + InjectorView.getDefault().addSelectionListener(this); currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); Composite mainComposite = formUtil.createComposite(parent, 3); formUtil.createLabel(mainComposite, proxiDistance); slider = formUtil.createSlider(mainComposite, SWT.HORIZONTAL); - slider.setValues(0, 0, 9, 1, 1, 1); + slider.setValues(8, 0, 9, 1, 1, 1); slider.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); sliderText = formUtil.createText(mainComposite, Integer.toString(slider.getSelection())); sliderText.setEditable(false); @@ -73,7 +76,7 @@ public class ProximityPage extends AbstractInjectorPage implements ISelectionLis gd.widthHint = 20; sliderText.setLayoutData(gd); sendData = slider.getSelection(); - + /* slider.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { @@ -86,6 +89,23 @@ public class ProximityPage extends AbstractInjectorPage implements ISelectionLis sendMessage(sendData); } }); + */ + + slider.addMouseListener(new MouseListener() { + @Override + public void mouseDoubleClick(MouseEvent e) { + } + @Override + public void mouseDown(MouseEvent e) { + } + @Override + public void mouseUp(MouseEvent e) { + sendData = slider.getSelection(); + slider.setSelection(sendData); + sliderText.setText(Integer.toString(sendData)); + sendMessage(sendData); + } + }); boolean connected = checkDeviceConnectedAlready(); if (connected == true) { @@ -121,6 +141,10 @@ public class ProximityPage extends AbstractInjectorPage implements ISelectionLis public void connect() { // TODO Auto-generated method stub currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); + + slider.setSelection(8); + sendData = slider.getSelection(); + sliderText.setText(Integer.toString(sendData)); } // @Override @@ -130,7 +154,7 @@ public class ProximityPage extends AbstractInjectorPage implements ISelectionLis @Override protected void finalize() throws Throwable { - ConnectionPlugin.getDefault().removeSelectionListener(this); + InjectorView.getDefault().removeSelectionListener(this); super.finalize(); } diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index 6ea821b..4841744 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,19 +1,19 @@ Package:eventinjector-eplugin -Version:0.2.6 +Version:0.2.19 OS:linux Build-host-os:linux Maintainer:yeongkyoon Lee , sungmin Ha Description:EventInjector for emulator Build-dependency:indigo-pde[linux], common-eplugin[linux] -Install-dependency:base-ide-product[linux] +Install-dependency:common-eplugin[linux], base-ide-product[linux] Source:eventinjector-eplugin Package:eventinjector-eplugin -Version:0.2.6 +Version:0.2.19 OS:windows Build-host-os:linux Maintainer:yeongkyoon Lee , sungmin Ha Description:EventInjector for emulator Build-dependency:indigo-winpde[windows], common-eplugin[linux] -Install-dependency:base-ide-product[windows] +Install-dependency:common-eplugin[windows], base-ide-product[windows] Source:eventinjector-eplugin -- 2.7.4