committing to 2.1.0
authorchpeckha
Mon, 06 Apr 2009 15:12:13 -0500
changeset 59 c892c53c664e
parent 44 e4eb00aa1a3f
child 60 9d2210c8eed2
committing to 2.1.0
connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestOSTTRKNoFormat.java
connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestOSTVersionRequest.java
connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestOstTRK.java
connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestPlatSim.java
connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestPlatSimTRK.java
connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestServerStartStop.java
connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestVirtualSerial.java
--- a/connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestOSTTRKNoFormat.java	Mon Apr 06 09:17:53 2009 -0500
+++ b/connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestOSTTRKNoFormat.java	Mon Apr 06 15:12:13 2009 -0500
@@ -38,13 +38,17 @@
  */
 public class TestOSTTRKNoFormat extends TestCase {
 
+	private boolean startServer = true; // use false when doing Junit plugin test - use true when doing non-plugin junit test
+
 	public void testOstTRK() {
 		// for non-plugin junit test
 		TCAPIConnection api2 = new TCAPIConnection();
-		api2.nativeStartServer();
+		if (startServer) {
+			api2.nativeStartServer();
+		}
 
 		// connection
-		ITCVirtualSerialConnection conn = (ITCVirtualSerialConnection)TCFClassFactory.createITCVirtualSerialConnection("COM19");
+		ITCVirtualSerialConnection conn = (ITCVirtualSerialConnection)TCFClassFactory.createITCVirtualSerialConnection("COM27");
 		// set OST decoding for this connection
 		conn.setDecodeFormat("ost");
 		
@@ -188,7 +192,9 @@
 			}
 		}
 		// for non-plugin junit test
-		api2.nativeStopServer();
+		if (startServer) {
+			api2.nativeStopServer();
+		}
 	}
 
 }
--- a/connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestOSTVersionRequest.java	Mon Apr 06 09:17:53 2009 -0500
+++ b/connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestOSTVersionRequest.java	Mon Apr 06 15:12:13 2009 -0500
@@ -21,7 +21,6 @@
 import org.eclipse.core.runtime.IStatus;
 
 import com.nokia.tcf.api.ITCAPIConnection;
-import com.nokia.tcf.api.ITCConnection;
 import com.nokia.tcf.api.ITCMessage;
 import com.nokia.tcf.api.ITCMessageIds;
 import com.nokia.tcf.api.ITCMessageInputStream;
@@ -37,13 +36,17 @@
  */
 public class TestOSTVersionRequest extends TestCase {
 
+	private boolean startServer = true; // use false when doing Junit plugin test - use true when doing non-plugin junit test
+
 	public void testOSTVersionRequest() {
 		// for non-plugin junit test
 		TCAPIConnection api2 = new TCAPIConnection();
-		api2.nativeStartServer();
+		if (startServer) {
+			api2.nativeStartServer();
+		}
 
 		// connection
-		ITCVirtualSerialConnection conn = (ITCVirtualSerialConnection)TCFClassFactory.createITCVirtualSerialConnection("COM25");
+		ITCVirtualSerialConnection conn = (ITCVirtualSerialConnection)TCFClassFactory.createITCVirtualSerialConnection("COM27");
 		// set OST decoding for this connection
 		conn.setDecodeFormat("ost");
 		
@@ -135,6 +138,8 @@
 			}
 		}
 		// for non-plugin junit test
-		api2.nativeStopServer();
+		if (startServer) {
+			api2.nativeStopServer();
+		}
 	}
 }
--- a/connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestOstTRK.java	Mon Apr 06 09:17:53 2009 -0500
+++ b/connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestOstTRK.java	Mon Apr 06 15:12:13 2009 -0500
@@ -31,13 +31,17 @@
  */
 public class TestOstTRK extends TestCase {
 
+	private boolean startServer = true; // use false when doing Junit plugin test - use true when doing non-plugin junit test
+	
 	public void testOstTRK() {
 		// for non-plugin junit test
 		TCAPIConnection api2 = new TCAPIConnection();
-		api2.nativeStartServer();
+		if (startServer) {
+			api2.nativeStartServer();
+		}
 
 		// connection
-		ITCVirtualSerialConnection conn = (ITCVirtualSerialConnection)TCFClassFactory.createITCVirtualSerialConnection("COM25");
+		ITCVirtualSerialConnection conn = (ITCVirtualSerialConnection)TCFClassFactory.createITCVirtualSerialConnection("COM27");
 		// set OST decoding for this connection
 		conn.setDecodeFormat("ost");
 		
@@ -180,8 +184,10 @@
 				api.disconnect();
 			}
 		}
-		// for non-plugin junit test
-		api2.nativeStopServer();
+		if (startServer) {
+			// for non-plugin junit test
+			api2.nativeStopServer();
+		}
 		
 	}
 }
--- a/connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestPlatSim.java	Mon Apr 06 09:17:53 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-package com.nokia.tcf.test;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.eclipse.core.runtime.IStatus;
-
-import com.nokia.tcf.api.ITCAPIConnection;
-import com.nokia.tcf.api.ITCMessage;
-import com.nokia.tcf.api.ITCMessageIds;
-import com.nokia.tcf.api.ITCMessageInputStream;
-import com.nokia.tcf.api.ITCMessageOptions;
-import com.nokia.tcf.api.ITCRealTCPConnection;
-import com.nokia.tcf.api.TCFClassFactory;
-import com.nokia.tcf.impl.TCAPIConnection;
-
-import junit.framework.TestCase;
-
-/**
- *
- */
-public class TestPlatSim extends TestCase {
-
-	public void testPlatSim() {
-		// connection
-		ITCRealTCPConnection conn = (ITCRealTCPConnection)TCFClassFactory.createITCRealTCPConnection("127.0.0.1", "7654");
-		// set platsim decoding for this connection
-		conn.setDecodeFormat("platsim");
-		
-		// message options
-		ITCMessageOptions options = TCFClassFactory.createITCMessageOptions();
-		// Ask TCF to encode the protocol (we will send raw messages)
-		options.setMessageEncodeFormat(ITCMessageOptions.ENCODE_FORMAT);
-		// ask TCF to delete the protocol on incoming messages
-		options.setUnWrapFormat(ITCMessageOptions.UNWRAP_DELETE_HEADERS);
-		options.setInputStreamSize(64);
-		
-		// Message ID to capture is 0x32 (TraceCore configure response)
-		ITCMessageIds ids = TCFClassFactory.createITCMessageIds();
-		ids.addMessageId((byte)0x32); // Tracecore response
-
-		// TraceCore configure message
-		// RAW message
-		byte[] tcConfigMsg = {0x1, 0x1, 0x0, 0x0};
-		// convert to ITCMessage
-		ITCMessage tcTCFConfigMsg = TCFClassFactory.createITCMessage(tcConfigMsg);
-		// Use the TraceCore configure message req ID (0x31)
-		tcTCFConfigMsg.setUseMyMessageId(true, (byte)0x31);
-
-		// uncomment this to do a non-plugin Junit
-		TCAPIConnection api2 = new TCAPIConnection();
-		api2.nativeStartServer();
-
-		int iconnect = 0;
-		for (iconnect=0; iconnect < 1; iconnect++) {
-			// connect
-			ITCAPIConnection api = TCFClassFactory.createITCAPIConnection();
-			IStatus connStatus = api.connect(conn, options, ids);
-			System.out.printf("iconnect=%d connStatus=%d\n", iconnect, connStatus.getCode());
-			
-			// get stream reference
-			ITCMessageInputStream stream = null;
-			if (connStatus.isOK()) {
-				stream = api.getInputStream();
-				System.out.printf("stream=%s\n", stream.toString());
-			}
-			
-			// send trk ping
-			if (connStatus.isOK()) {
-				IStatus sendStatus = api.sendMessage(tcTCFConfigMsg);
-				if (sendStatus.isOK()) {
-					// wait for response
-					int numberMessages = 0;
-					int numberPeeks = 0;
-					int numberSleeps = 0;
-					for (int i = 0; i < 100; i ++) {
-						try {
-							if (stream != null)
-								numberMessages = stream.peekMessages();
-							numberPeeks++;
-							if (numberMessages < 1) {
-								try {
-									Thread.sleep(100);
-									numberSleeps++;
-								} catch (InterruptedException e) {
-									e.printStackTrace();
-								}
-							}
-						} catch (IOException e) {
-							e.printStackTrace();
-						}
-						if (numberMessages >= 1) {
-							break;
-						}
-					}
-					System.out.printf("NumberMessages = %d numberPeeks = %d numberSleeps = %d\n", numberMessages, numberPeeks, numberSleeps);
-					if (numberMessages > 0) {
-						try {
-							
-//							ITCMessage[] message = stream.readMessages(1);
-//							byte[] b = stream.readBytes(1);
-							ByteBuffer barray = java.nio.ByteBuffer.wrap(stream.readBytes(1));
-//							byte[] b = message[0].getMessage();
-							System.out.printf("msg: length=%d\n", barray.limit());
-							byte[] b = barray.array();
-							for (int i = 0; i < b.length; i++) {
-								System.out.printf("%x ", b[i]);
-							}
-							System.out.printf("\n");
-							numberMessages = stream.peekMessages();
-						} catch (IOException e) {
-							e.printStackTrace();
-						}
-					}
-				}
-				if (connStatus.isOK()) {
-					api.disconnect();
-				}
-				try {
-					Thread.sleep(1000);
-				} catch (InterruptedException e) {
-					e.printStackTrace();
-				}
-			}
-		}
-		// uncomment this when using a non-plugin junit test
-		api2.nativeStopServer();
-	}
-}
--- a/connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestPlatSimTRK.java	Mon Apr 06 09:17:53 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-package com.nokia.tcf.test;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.eclipse.core.runtime.IStatus;
-
-import com.nokia.tcf.api.ITCMessage;
-import com.nokia.tcf.api.ITCMessageIds;
-import com.nokia.tcf.api.ITCMessageInputStream;
-import com.nokia.tcf.api.ITCMessageOptions;
-import com.nokia.tcf.api.ITCRealTCPConnection;
-import com.nokia.tcf.api.ITCAPIConnection;
-import com.nokia.tcf.api.TCFClassFactory;
-import com.nokia.tcf.impl.TCAPIConnection;
-
-import junit.framework.TestCase;
-
-/**
- *
- */
-public class TestPlatSimTRK extends TestCase {
-
-	public void testPlatSimTRK() {
-		// connection
-		// PlatSim 
-		ITCRealTCPConnection conn = (ITCRealTCPConnection)TCFClassFactory.createITCRealTCPConnection("127.0.0.1", "7654");
-		conn.setDecodeFormat("platsim");
-
-		// message options
-		ITCMessageOptions options = TCFClassFactory.createITCMessageOptions();
-		// Ask TCF to encode the protocol (we will send raw TRK messages)
-		options.setMessageEncodeFormat(ITCMessageOptions.ENCODE_FORMAT);
-		// ask TCF to delete the protocol on incoming messages
-		options.setUnWrapFormat(ITCMessageOptions.UNWRAP_DELETE_HEADERS);
-//		options.setInputStreamOverflowOption(ITCMessageOptions.INPUTSTREAM_OVERFLOW_NONE);
-		options.setInputStreamSize(64);
-		
-		// message Ids to capture (we must capture TRK response messages = id=0x45)
-		ITCMessageIds ids = TCFClassFactory.createITCMessageIds();
-		// The PN msg ID for TRK responses is 0x45 per DSS
-		ids.addMessageId((byte)0x45); // TRK response
-
-		// TRK ping message
-		// RAW message
-		byte[] trkping = {0x7e, 0, 0, (byte)0xff, 0x7e};
-		// convert to ITCMessage
-		ITCMessage tcMsgPing = TCFClassFactory.createITCMessage(trkping);
-		// Ask TCF to use the PN msg ID for TRK requests (0x44) per DSS
-		tcMsgPing.setUseMyMessageId(true, (byte)0x44);
-		
-		// TRK version message
-		// RAW message
-		byte[] trkversion = {0x7e, 0x08, 0x01, (byte)0xf6, 0x7e};
-		// convert to ITCMessage
-		ITCMessage tcMsgVersion = TCFClassFactory.createITCMessage(trkversion);
-		// Ask TCF to use the PN msg ID for TRK requests (0x44) per DSS
-		tcMsgVersion.setUseMyMessageId(true, (byte)0x44);
-
-		// uncomment this to do a non-plugin Junit
-		TCAPIConnection api2 = new TCAPIConnection();
-		api2.nativeStartServer();
-
-		int iconnect = 0;
-		for (iconnect=0; iconnect < 1; iconnect++) {
-			// connect
-			ITCAPIConnection api = TCFClassFactory.createITCAPIConnection();
-			IStatus connStatus = api.connect(conn, options, ids);
-			System.out.printf("iconnect=%d connStatus=%d\n", iconnect, connStatus.getCode());
-			
-			// get stream reference
-			ITCMessageInputStream stream = null;
-			if (connStatus.isOK()) {
-				stream = api.getInputStream();
-				System.out.printf("stream=%s\n", stream.toString());
-			}
-			
-			// send trk ping
-			if (connStatus.isOK()) {
-				IStatus sendStatus = api.sendMessage(tcMsgPing);
-				if (sendStatus.isOK()) {
-					// wait for response
-					int numberMessages = 0;
-					int numberPeeks = 0;
-					int numberSleeps = 0;
-					for (int i = 0; i < 200; i ++) {
-						try {
-							if (stream != null)
-								numberMessages = stream.peekMessages();
-							numberPeeks++;
-							if (numberMessages < 1) {
-								try {
-									Thread.sleep(100);
-									numberSleeps++;
-								} catch (InterruptedException e) {
-									e.printStackTrace();
-								}
-							}
-						} catch (IOException e) {
-							e.printStackTrace();
-						}
-						if (numberMessages >= 1) {
-							break;
-						}
-					}
-					System.out.printf("NumberMessages = %d numberPeeks = %d numberSleeps = %d\n", numberMessages, numberPeeks, numberSleeps);
-					if (numberMessages > 0) {
-						try {
-							
-//							ITCMessage[] message = stream.readMessages(1);
-//							byte[] b = stream.readBytes(1);
-							ByteBuffer barray = java.nio.ByteBuffer.wrap(stream.readBytes(1));
-//							byte[] b = message[0].getMessage();
-							System.out.printf("msg: length=%d\n", barray.limit());
-							byte[] b = barray.array();
-							for (int i = 0; i < b.length; i++) {
-								System.out.printf("%x ", b[i]);
-							}
-							System.out.printf("\n");
-							numberMessages = stream.peekMessages();
-						} catch (IOException e) {
-							e.printStackTrace();
-						}
-					}
-				}
-			}
-			// send trk version
-			if (connStatus.isOK()) {
-				IStatus sendStatus = api.sendMessage(tcMsgVersion); 
-				if (sendStatus.isOK()) {
-					// wait for response
-					int numberMessages = 0;
-					int numberPeeks = 0;
-					int numberSleeps = 0;
-					for (int i = 0; i < 200; i ++) {
-						try {
-							if (stream != null)
-								numberMessages = stream.peekMessages();
-							numberPeeks++;
-							if (numberMessages < 1) {
-								try {
-									Thread.sleep(100);
-									numberSleeps++;
-								} catch (InterruptedException e) {
-									e.printStackTrace();
-								}
-							}
-						} catch (IOException e) {
-							e.printStackTrace();
-						}
-						if (numberMessages == 1) {
-							break;
-						}
-					}
-					System.out.printf("NumberMessages = %d numberPeeks = %d numberSleeps = %d\n", numberMessages, numberPeeks, numberSleeps);
-					if (numberMessages > 0) {
-						try {
-							
-							ITCMessage message = stream.readMessage();
-							byte[] b = message.getMessage();
-							System.out.printf("msg: length=%d\n", b.length);
-							for (int i = 0; i < b.length; i++) {
-								System.out.printf("%x ", b[i]);
-							}
-							System.out.printf("\n");
-							numberMessages = stream.peekMessages();
-						} catch (IOException e) {
-							e.printStackTrace();
-						}
-					}
-				}
-			}
-			
-			if (connStatus.isOK()) {
-				api.disconnect();
-			}
-			try {
-				Thread.sleep(1000);
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-			}
-		}
-		// uncomment this when using a non-plugin junit test
-		api2.nativeStopServer();
-		
-	}
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestServerStartStop.java	Mon Apr 06 15:12:13 2009 -0500
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+package com.nokia.tcf.test;
+
+import com.nokia.tcf.impl.TCAPIConnection;
+
+import junit.framework.TestCase;
+
+public class TestServerStartStop extends TestCase {
+
+	public void testServerStartStop() {
+		// for non-plugin junit test
+		TCAPIConnection api2 = new TCAPIConnection();
+		api2.nativeStartServer();
+		
+		// for non-plugin junit test
+		api2.nativeStopServer();
+	}
+}
--- a/connectivity/com.nokia.tcf.test/src/com/nokia/tcf/test/TestVirtualSerial.java	Mon Apr 06 09:17:53 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-package com.nokia.tcf.test;
-
-import java.io.IOException;
-
-import org.eclipse.core.runtime.IStatus;
-
-import com.nokia.tcf.api.ITCAPIConnection;
-import com.nokia.tcf.api.ITCMessage;
-import com.nokia.tcf.api.ITCMessageIds;
-import com.nokia.tcf.api.ITCMessageInputStream;
-import com.nokia.tcf.api.ITCMessageOptions;
-import com.nokia.tcf.api.ITCVirtualSerialConnection;
-import com.nokia.tcf.api.ITCConnection;
-import com.nokia.tcf.api.TCFClassFactory;
-import junit.framework.TestCase;
-
-/**
- * 1 client 1 connection RAW TRK (non-TraceCore TRK) over USB
- */
-public class TestVirtualSerial extends TestCase {
-
-	public void testVirtualSerial() {
-//		TCFClassFactory factory = new TCFClassFactory();
-		
-		// connection
-		ITCVirtualSerialConnection conn = (ITCVirtualSerialConnection)TCFClassFactory.createITCVirtualSerialConnection("COM13");
-		conn.setRetryInterval(5);
-		conn.setRetryTimeout(60);
-		String desc = conn.getConnectionDescription();
-		System.out.println(desc);
-		assertTrue("description != null", desc != null);
-		
-		// messageIds
-		ITCMessageIds messageIds = TCFClassFactory.createITCMessageIds();
-		messageIds.addMessageId((byte)0x7E);
-		
-		// messageOptions - all default
-		ITCMessageOptions messageOptions = TCFClassFactory.createITCMessageOptions();
-		conn.setDecodeFormat("rawtrk");
-		messageOptions.setMessageEncodeFormat(ITCMessageOptions.ENCODE_NO_FORMAT);
-		ITCAPIConnection api = TCFClassFactory.createITCAPIConnection();
-		IStatus connStatus = api.connect(conn, messageOptions, messageIds);
-		assertTrue("connect is not ok", connStatus.isOK());
-
-		// message
-		int[] trkpingi = {0x7e, 00, 00, 0xff, 0x7e};
-		byte[] trkping = new byte[5];
-		for (int i = 0; i < 5; i++) trkping[i] = (byte)(trkpingi[i] & 0xff);
-		ITCMessage tcMsgPing = TCFClassFactory.createITCMessage(trkping);
-		System.out.println("ping message:");
-		for (int i = 0; i < tcMsgPing.size(); i++) {
-			System.out.printf(" %x", tcMsgPing.getMessage()[i]);			
-		}
-		System.out.printf("\n");
-		tcMsgPing.setUseMyMessageId(false, (byte)0);
-		
-		int[] trkversioni = {0x7e, 0x08, 0x01, 0xf6, 0x7e};
-		byte[] trkversion = new byte[5];
-		for (int i = 0; i < 5; i++) trkversion[i] = (byte)(trkversioni[i] & 0xff);
-		ITCMessage tcMsgVersion = TCFClassFactory.createITCMessage(trkversion);
-		System.out.println("version message:");
-		for (int i = 0; i < tcMsgVersion.size(); i++) {
-			System.out.printf(" %x", tcMsgVersion.getMessage()[i]);			
-		}
-		System.out.printf("\n");
-		tcMsgVersion.setUseMyMessageId(false, (byte)0);
-	
-		
-		IStatus sendStatus = null;
-
-		if (connStatus.isOK()) {
-			sendStatus = api.sendMessage(tcMsgPing);
-			sendStatus = api.sendMessage(tcMsgVersion);
-		}
-
-		ITCMessageInputStream stream = api.getInputStream();
-		ITCMessage msg = null;
-		int numberMessages = 0;
-		try {
-			numberMessages = stream.peekMessages();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-		System.out.printf("numberMessages = %d\n", numberMessages);
-		if (numberMessages > 0) {
-			try {
-				msg = stream.readMessage();
-				System.out.printf("messageSize = %d\n", msg.size());
-				if (msg.size() > 0) {
-					for (int i = 0; i < msg.size(); i++) {
-						System.out.printf(" %x", msg.getMessage()[i]);
-					}
-					System.out.printf("\n");
-				}
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-
-		// shutdown BT on phone then execute this
-		if (connStatus.isOK()) {
-			sendStatus = api.sendMessage(tcMsgPing);
-			sendStatus = api.sendMessage(tcMsgVersion);
-		}
-		
-		numberMessages = 0;
-		try {
-			numberMessages = stream.peekMessages();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-		System.out.printf("numberMessages = %d\n", numberMessages);
-		if (numberMessages > 0) {
-			try {
-				msg = stream.readMessage();
-				System.out.printf("messageSize = %d\n", msg.size());
-				if (msg.size() > 0) {
-					for (int i = 0; i < msg.size(); i++) {
-						System.out.printf(" %x", msg.getMessage()[i]);
-					}
-					System.out.printf("\n");
-				}
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-		if (connStatus.isOK()) {
-			api.disconnect();
-		}
-		
-	}
-}