@Override
public void selectionChanged(FileEntry selectedEntry) {
- if( selectedEntry == null)
- {
+ if (selectedEntry == null) {
disconnect();
- return;
- }
- else if (!selectedEntry.getFileListingService().getDevice().isEmulator())
- return;
-
- if(currentDevice == null && selectedEntry.getName() != null)
- connect();
- else if(currentDevice == null && selectedEntry.getName() == null)
- return;
- else if (currentDevice.getSerialNumber() != selectedEntry.getName()) {
- disconnect();
- connect();
+ } else {
+ String selectedName = selectedEntry.getFileListingService().getDevice().getSerialNumber();
+ if (currentDevice == null) {
+ if (selectedName != null) {
+ connect();
+ }
+ } else {
+ if (currentDevice.getSerialNumber() != selectedName) {
+ disconnect();
+ connect();
+ }
+ }
}
sendMessage(sendData, sensorOn);
}
@Override
public void selectionChanged(FileEntry selectedEntry) {
- if( selectedEntry == null)
- {
- disconnect();
- return;
- }
- else if (!selectedEntry.getFileListingService().getDevice().isEmulator())
- return;
-
- if(currentDevice == null && selectedEntry.getName() != null) {
- connect();
- } else if(currentDevice == null && selectedEntry.getName() == null) {
- return;
- } else if (currentDevice.getSerialNumber() != selectedEntry.getName()) {
+ if (selectedEntry == null) {
disconnect();
- connect();
- } else if (currentDevice.getSerialNumber() == selectedEntry.getName()) {
- return;
+ } else {
+ String selectedName = selectedEntry.getFileListingService().getDevice().getSerialNumber();
+ if (currentDevice == null) {
+ if (selectedName != null) {
+ connect();
+ }
+ } else {
+ if (currentDevice.getSerialNumber() != selectedName) {
+ disconnect();
+ connect();
+ }
+ }
}
sendMessage(earjack_status);
}
@Override
public void selectionChanged(FileEntry selectedEntry) {
- if( selectedEntry == null)
- {
+ if (selectedEntry == null) {
disconnect();
- return;
- }
- else if (!selectedEntry.getFileListingService().getDevice().isEmulator())
- return;
-
- if(currentDevice == null && selectedEntry.getName() != null)
- connect();
- else if(currentDevice == null && selectedEntry.getName() == null)
- return;
- else if (currentDevice.getSerialNumber() != selectedEntry.getName()) {
- disconnect();
- connect();
+ } else {
+ String selectedName = selectedEntry.getFileListingService().getDevice().getSerialNumber();
+ if (currentDevice == null) {
+ if (selectedName != null) {
+ connect();
+ }
+ } else {
+ if (currentDevice.getSerialNumber() != selectedName) {
+ disconnect();
+ connect();
+ }
+ }
}
sendLevelMessage(sendData);
}
@Override
public void selectionChanged(FileEntry selectedEntry) {
- if( selectedEntry == null)
- {
+ if (selectedEntry == null) {
disconnect();
- return;
- }
- else if (!selectedEntry.getFileListingService().getDevice().isEmulator())
- return;
-
- if(currentDevice == null && selectedEntry.getName() != null) {
- connect();
- } else if(currentDevice == null && selectedEntry.getName() == null) {
- return;
- } else if (currentDevice.getSerialNumber() != selectedEntry.getName()) {
- disconnect();
- connect();
- } else if (currentDevice.getSerialNumber() == selectedEntry.getName()) {
- return;
+ } else {
+ String selectedName = selectedEntry.getFileListingService().getDevice().getSerialNumber();
+ if (currentDevice == null) {
+ if (selectedName != null) {
+ connect();
+ }
+ } else {
+ if (currentDevice.getSerialNumber() != selectedName) {
+ disconnect();
+ connect();
+ }
+ }
}
if( sensorOn ) // On
sendMessage(1);
private Receiver receiverThread;
public boolean callWaiting = false;
private IDevice currentDevice = null;
+
+ // Event ID
+ private static int lengthOfID = 10;
+ private static byte[] TELEPHONY = new byte[lengthOfID];
+ private static byte[] SENSOR = new byte[lengthOfID];
+ private static byte[] LOCATION = new byte[lengthOfID];
+ private static byte[] NFC = new byte[lengthOfID];
+ private TelephonySocket () {
+ int i = 0;
+ for (byte b : new String("telephony\n").getBytes()) {
+ TELEPHONY[i++] = b;
+ }
+
+ i = 0;
+ for (byte b : new String("sensor\n").getBytes()) {
+ SENSOR[i++] = b;
+ }
+
+ i = 0;
+ for (byte b : new String("location\n").getBytes()) {
+ LOCATION[i++] = b;
+ }
+
+ i = 0;
+ for (byte b : new String("nfc\n").getBytes()) {
+ NFC[i++] = b;
+ }
+ }
+
public void addInjectorReceiver(ArrayList<AbstractInjectorReceiver> list) {
if (list == null)
return;
private void sendInitialize() throws IOException {
try {
- String str = "telephony\n";
- output.write(str.getBytes(), 0, str.length());
+ output.write(TELEPHONY, 0, lengthOfID);
output.flush();
byte[] abuf = { 0x04, 0x00, 0x40, 0x41 };
byte[] bbuf = { 0x16, 0x00, 0x00, 0x00 };
output.write(bbuf);
output.flush();
-
- output.write(str.getBytes(), 0, str.length());
+
+ output.write(TELEPHONY, 0, lengthOfID);
output.flush();
byte[] cbuf = { 0x00, 0x00, 0x40, 0x47 };
if (!isConnected())
connect();
try {
- String str = "telephony\n";
- output.write(str.getBytes(), 0, str.length());
+ output.write(TELEPHONY, 0, lengthOfID);
output.flush();
byte[] buf = { 0x00, 0x00, 0x11, 0x5b };
return;
try{
- String str = "telephony\n";
- output.write(str.getBytes(), 0, str.length());
+ output.write(TELEPHONY, 0, lengthOfID);
output.flush();
byte[] abuf = { 0x00, 0x00, 0x10, 0x01 };
boolean result = false;
try {
- String str = "telephony\n";
- output.write(str.getBytes(), 0, str.length());
+ output.write(TELEPHONY, 0, lengthOfID);
output.flush();
byte[] starter = sendObj.makeStarterPacket();
boolean result = false;
try {
- String str = "sensor\n\n\n\n";
if(output != null)
output.flush();
else
return false;
-
- output.write(str.getBytes(), 0, str.length());
+
+ output.write(SENSOR, 0, lengthOfID);
output.flush();
byte[] next_packet_length = { (byte)sensorMsg.getBytes().length, 0x00, 0x00, 0x00 };
boolean result = false;
try {
- String str = "location\n\n";
- output.write(str.getBytes(), 0, str.length());
+ output.write(LOCATION, 0, lengthOfID);
output.flush();
byte[] next_packet_length = { (byte)locationMsg.getBytes().length, 0x00, 0x00, 0x00 };
boolean result = false;
try {
- String str = "nfc\n\n\n\n\n\n\n";
- output.write(str.getBytes(), 0, str.length());
+ output.write(NFC, 0, lengthOfID);
output.flush();
- /*
- String msgLen = Integer.toString(nfcMsg.getBytes().length);
- while(msgLen.length() < 5)
- {
- msgLen = msgLen + "\n";
- }
- output.write(msgLen.getBytes(), 0 , msgLen.length());
- output.flush();
- */
byte[] next_packet_length = ByteUtil.int2byte(nfcMsg.getBytes().length);
output.write(next_packet_length);
output.flush();
byte[] main = nfcMsg.getBytes();
if (main.length > 0)
{
-// ByteUtil.printHex(main, "send body");
output.write(main, 0, main.length);
}
output.flush();
\r
public final static String VIEW_ID = "org.tizen.injector.view.InjectorView";\r
\r
+ /*\r
private String errorMessage = Messages.InjectorView_6\r
+ System.getProperty("line.separator") //$NON-NLS-1$\r
+ Messages.InjectorView_8;\r
+ */\r
\r
private ArrayList<String> categoryList = new ArrayList<String>();\r
private ArrayList<FormPageUtil> formUtilList = new ArrayList<FormPageUtil>();\r
if (desposing != true) {\r
job.schedule();\r
}\r
- */\r
+*/\r
}\r
\r
public ArrayList<String> getCategoryList() {\r
} else if (!selectedEntry.getFileListingService().getDevice().isEmulator()) {\r
return;\r
}\r
- \r
+\r
String selectedName = selectedEntry.getFileListingService().getDevice().getSerialNumber();\r
- if(currentDevice == null && selectedName/*selectedEntry.getName()*/ != null)\r
- {\r
- connect();\r
- currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();\r
- } else if (currentDevice.getSerialNumber() != selectedName/*selectedEntry.getName()*/) {\r
- disconnect_finished = false;\r
- disconnect();\r
- connect();\r
- currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();\r
- } else if(activated == false)\r
+ if(currentDevice == null)\r
{\r
- connect();\r
- currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();\r
- } else if (currentDevice.getSerialNumber() == selectedName/*selectedEntry.getName()*/) {\r
- return;\r
+ if (selectedName/*selectedEntry.getName()*/ != null) {\r
+ connect();\r
+ currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();\r
+ }\r
+ } else {\r
+ if (currentDevice.getSerialNumber() != selectedName/*selectedEntry.getName()*/) {\r
+ disconnect_finished = false;\r
+ disconnect();\r
+ connect();\r
+ currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();\r
+ } else {\r
+ if(activated == false) {\r
+ connect();\r
+ currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();\r
+ } else {\r
+ return;\r
+ }\r
+ }\r
}\r
\r
notifySelectionListeners(selectedEntry);\r
{
if (selectedEntry == null) {
disconnect();
- return;
- } else if (!selectedEntry.getFileListingService().getDevice().isEmulator()) {
- return;
- }
-
- String selectedName = selectedEntry.getFileListingService().getDevice().getSerialNumber();
- if (currentDevice == null) {
- if (selectedName != null) {
- connect();
- }
} else {
- if (currentDevice.getSerialNumber() != selectedName) {
- disconnect();
- connect();
+ String selectedName = selectedEntry.getFileListingService().getDevice().getSerialNumber();
+ if (currentDevice == null) {
+ if (selectedName != null) {
+ connect();
+ }
+ } else {
+ if (currentDevice.getSerialNumber() != selectedName) {
+ disconnect();
+ connect();
+ }
}
}
}
@Override
public void selectionChanged(FileEntry selectedEntry) {
- if( selectedEntry == null)
- {
+ if (selectedEntry == null) {
disconnect();
- return;
- }
- else if (!selectedEntry.getFileListingService().getDevice().isEmulator())
- return;
-
- if(currentDevice == null && selectedEntry.getName() != null)
- connect();
- else if(currentDevice == null && selectedEntry.getName() == null)
- return;
- else if (currentDevice.getSerialNumber() != selectedEntry.getName()) {
- disconnect();
- connect();
+ } else {
+ String selectedName = selectedEntry.getFileListingService().getDevice().getSerialNumber();
+ if (currentDevice == null) {
+ if (selectedName != null) {
+ connect();
+ }
+ } else {
+ if (currentDevice.getSerialNumber() != selectedName) {
+ disconnect();
+ connect();
+ }
+ }
}
}
}
@Override
public void selectionChanged(FileEntry selectedEntry) {
- if( selectedEntry == null)
- {
+ if (selectedEntry == null) {
disconnect();
- return;
- }
- else if (!selectedEntry.getFileListingService().getDevice().isEmulator())
- return;
-
- if(currentDevice == null && selectedEntry.getName() != null)
- connect();
- else if(currentDevice == null && selectedEntry.getName() == null)
- return;
- else if (currentDevice.getSerialNumber() != selectedEntry.getName()) {
- disconnect();
- connect();
+ } else {
+ String selectedName = selectedEntry.getFileListingService().getDevice().getSerialNumber();
+ if (currentDevice == null) {
+ if (selectedName != null) {
+ connect();
+ }
+ } else {
+ if (currentDevice.getSerialNumber() != selectedName) {
+ disconnect();
+ connect();
+ }
+ }
}
sendMessage(1, levelData);
sendMessage(2, luxData);
@Override
public void selectionChanged(FileEntry selectedEntry) {
- if( selectedEntry == null)
- {
+ if (selectedEntry == null) {
disconnect();
- return;
- }
- else if (!selectedEntry.getFileListingService().getDevice().isEmulator())
- return;
-
- if(currentDevice == null && selectedEntry.getName() != null)
- connect();
- else if(currentDevice == null && selectedEntry.getName() == null)
- return;
- else if (currentDevice.getSerialNumber() != selectedEntry.getName()) {
- disconnect();
- connect();
+ } else {
+ String selectedName = selectedEntry.getFileListingService().getDevice().getSerialNumber();
+ if (currentDevice == null) {
+ if (selectedName != null) {
+ connect();
+ }
+ } else {
+ if (currentDevice.getSerialNumber() != selectedName) {
+ disconnect();
+ connect();
+ }
+ }
}
sendMessage(sendData);
}