Add temporary "USB (TCF)" connection type for accessing the target-side Symbian TCF agent.
authorEd Swartz <ed.swartz@nokia.com>
Fri, 28 May 2010 14:29:31 -0500
changeset 1416 809f579bf32c
parent 1415 9cca70448cde
child 1426 6a454f350c2a
child 1442 c5fe7852bd34
Add temporary "USB (TCF)" connection type for accessing the target-side Symbian TCF agent.
debuggercdi/com.nokia.carbide.trk.support/plugin.xml
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/IUSBConnectionType.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnection.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnectionType.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/USBConnectionType.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/messages.properties
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKConnectedService.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingConnectedService.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java
--- a/debuggercdi/com.nokia.carbide.trk.support/plugin.xml	Fri May 28 11:09:31 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/plugin.xml	Fri May 28 14:29:31 2010 -0500
@@ -44,11 +44,18 @@
             class="com.nokia.carbide.trk.support.connection.TCPIPConnectionType">
       </connectionType>
    </extension>
+   
    <extension
          point="com.nokia.carbide.remoteConnections.connectionType">
       <connectionType
             class="com.nokia.carbide.trk.support.connection.TCFConnectionType">
       </connectionType>
    </extension>
+   <extension
+         point="com.nokia.carbide.remoteConnections.connectionType">
+      <connectionType
+            class="com.nokia.carbide.trk.support.connection.TCFUSBConnectionType">
+      </connectionType>
+   </extension>
  	
 </plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/IUSBConnectionType.java	Fri May 28 14:29:31 2010 -0500
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Nokia and others.
+ * All rights reserved. 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:
+ * Nokia - Initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.carbide.trk.support.connection;
+
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
+
+/**
+ * Common interface for implementors of IConnectionType for USB.
+ */
+public interface IUSBConnectionType extends IConnectionType {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnection.java	Fri May 28 14:29:31 2010 -0500
@@ -0,0 +1,31 @@
+/*
+* 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.carbide.trk.support.connection;
+
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
+
+import java.util.Map;
+
+public class TCFUSBConnection extends TCPIPConnection {
+
+	public TCFUSBConnection(IConnectionType connectionType, Map<String, String> settings) {
+		super(connectionType, settings);
+	}
+
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnectionType.java	Fri May 28 14:29:31 2010 -0500
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2010 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.carbide.trk.support.connection;
+
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory;
+import com.nokia.carbide.trk.support.Messages;
+
+/**
+ * Implementation of IConnectionType for USB TCF connections.  This also uses Nokia TCF but 
+ * is given a unique identifier for now so we can debug it differently.
+ */
+public class TCFUSBConnectionType implements IUSBConnectionType {
+
+	public static final String ID = "com.nokia.carbide.connection.TCFUSBConnectionType"; //$NON-NLS-1$
+
+	public IConnectionFactory getConnectionFactory() {
+		return new SerialConnectionFactory(this, true);
+	}
+
+	public String getDescription() {
+		return Messages.getString("TCFUSBConnectionType.Desc"); //$NON-NLS-1$
+	}
+
+	public String getDisplayName() {
+		return Messages.getString("TCFUSBConnectionType.Label"); //$NON-NLS-1$
+	}
+
+	public String getHelpContext() {
+		return null;
+	}
+
+	public String getIdentifier() {
+		return ID;
+	}
+
+}
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/USBConnectionType.java	Fri May 28 11:09:31 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/USBConnectionType.java	Fri May 28 14:29:31 2010 -0500
@@ -19,13 +19,12 @@
 package com.nokia.carbide.trk.support.connection;
 
 import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
 import com.nokia.carbide.trk.support.Messages;
 
 /**
  * Implementation of IConnectionType for USB over TC framework connections
  */
-public class USBConnectionType implements IConnectionType {
+public class USBConnectionType implements IUSBConnectionType {
 
 	public static final String ID = USBConnectionType.class.getName();
 
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/messages.properties	Fri May 28 11:09:31 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/messages.properties	Fri May 28 14:29:31 2010 -0500
@@ -56,10 +56,12 @@
 TracingConnectedService.TCPIPInUseStatus=Address {0}, port {1} is in use
 TracingConnectedService.TimedOutError=Attempt to get response from TraceCore timed out
 TracingConnectedService.UnknownLabel=Unknown
-TracingService.AdditionalInfoString=For USB, ensure Trace Switch Application is running on the device 
+TracingService.AdditionalInfoString=For USB, ensure TraceSwitch is running on the device. 
 TracingService.Label=Tracing
 USBConnectionType.Desc=USB serial port connection settings
 USBConnectionType.Label=USB
 TCFConnectionType.Desc=TCP/IP settings
 TCFConnectionType.Label=TCP/IP
+TCFUSBConnectionType.Desc=USB serial port connection settings\n(This is a temporary variant used to target the TCF debug agent on the device.)
+TCFUSBConnectionType.Label=USB (TCF)
 
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java	Fri May 28 11:09:31 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java	Fri May 28 14:29:31 2010 -0500
@@ -31,6 +31,7 @@
 import com.nokia.carbide.trk.support.connection.SerialConnectionType;
 import com.nokia.carbide.trk.support.connection.TCFConnection;
 import com.nokia.carbide.trk.support.connection.TCFConnectionType;
+import com.nokia.carbide.trk.support.connection.TCFUSBConnectionType;
 import com.nokia.carbide.trk.support.connection.USBConnectionType;
 import com.nokia.cpp.internal.api.utils.core.HostOS;
 
@@ -71,7 +72,8 @@
 
 	private Collection<String> getCompatibleTracingConnectionTypeIds() {
 		return Arrays.asList(new String[] {
-				USBConnectionType.ID
+				USBConnectionType.ID,
+				TCFUSBConnectionType.ID,
 		});
 	}
 	
@@ -80,7 +82,9 @@
 				SerialConnectionType.ID,
 				TCFConnectionType.ID,
 				SerialBTConnectionType.ID,
-				USBConnectionType.ID}); 
+				USBConnectionType.ID,
+				TCFUSBConnectionType.ID,
+				}); 
 	}
 
 	/* (non-Javadoc)
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKConnectedService.java	Fri May 28 11:09:31 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKConnectedService.java	Fri May 28 14:29:31 2010 -0500
@@ -34,10 +34,10 @@
 import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus;
 import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider.IRemoteAgentInstaller;
 import com.nokia.carbide.trk.support.Messages;
+import com.nokia.carbide.trk.support.connection.IUSBConnectionType;
 import com.nokia.carbide.trk.support.connection.SerialConnectionType;
 import com.nokia.carbide.trk.support.connection.TCPIPConnectionFactory;
 import com.nokia.carbide.trk.support.connection.TCPIPConnectionType;
-import com.nokia.carbide.trk.support.connection.USBConnectionType;
 import com.nokia.cpp.internal.api.utils.core.Check;
 import com.nokia.cpp.internal.api.utils.core.Pair;
 import com.nokia.tcf.api.ITCAPIConnection;
@@ -138,7 +138,7 @@
 			}
 			return new Version(versInts[0], versInts[1], versInts[2]);
 		}
-		else if (connection.getConnectionType() instanceof USBConnectionType) {
+		else if (connection.getConnectionType() instanceof IUSBConnectionType) {
 			String portNumStr = connection.getSettings().get(SerialConnectionSettings.PORT);
 			int portNum = Integer.parseInt(portNumStr);
 			return getTRKVersionFromOSTUSB(getSimplePortName(portNum));
@@ -316,7 +316,7 @@
 					estatus = EStatus.IN_USE;
 					IConnectionType connectionType = connection.getConnectionType();
 					if (connectionType instanceof SerialConnectionType ||
-							connectionType instanceof USBConnectionType)
+							connectionType instanceof IUSBConnectionType)
 						message = MessageFormat.format(PORT_IN_USE, 
 								connection.getSettings().get(SerialConnectionSettings.PORT));
 					else if (connectionType instanceof TCPIPConnectionType)
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java	Fri May 28 11:09:31 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java	Fri May 28 14:29:31 2010 -0500
@@ -45,7 +45,9 @@
 				SerialConnectionType.ID, 
 				SerialBTConnectionType.ID,
 				TCPIPConnectionType.ID,
-				USBConnectionType.ID}); 
+				USBConnectionType.ID,
+				TCFUSBConnectionType.ID
+				}); 
 	}
 
 	public String getDisplayName() {
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingConnectedService.java	Fri May 28 11:09:31 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingConnectedService.java	Fri May 28 14:29:31 2010 -0500
@@ -32,9 +32,9 @@
 import com.nokia.carbide.remoteconnections.interfaces.IService;
 import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus;
 import com.nokia.carbide.trk.support.Messages;
+import com.nokia.carbide.trk.support.connection.IUSBConnectionType;
 import com.nokia.carbide.trk.support.connection.TCPIPConnectionFactory;
 import com.nokia.carbide.trk.support.connection.TCPIPConnectionType;
-import com.nokia.carbide.trk.support.connection.USBConnectionType;
 import com.nokia.cpp.internal.api.utils.core.Check;
 import com.nokia.tcf.api.ITCAPIConnection;
 import com.nokia.tcf.api.ITCConnection;
@@ -78,7 +78,7 @@
 	}
 
 	private boolean getTraceCoreResponse() throws ConnectionFailException {
-		if (connection.getConnectionType() instanceof USBConnectionType) {
+		if (connection.getConnectionType() instanceof IUSBConnectionType) {
 			String portNumStr = connection.getSettings().get(SerialConnectionSettings.PORT);
 			int portNum = Integer.parseInt(portNumStr);
 			return getTraceCoreResponseFromOSTUSB(getSimplePortName(portNum));
@@ -212,7 +212,7 @@
 				if (connection.isInUse()) {
 					estatus = EStatus.IN_USE;
 					IConnectionType connectionType = connection.getConnectionType();
-					if (connectionType instanceof USBConnectionType)
+					if (connectionType instanceof IUSBConnectionType)
 						message = MessageFormat.format(PORT_IN_USE, 
 								connection.getSettings().get(SerialConnectionSettings.PORT));
 					else if (connectionType instanceof TCPIPConnectionType)
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java	Fri May 28 11:09:31 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java	Fri May 28 14:29:31 2010 -0500
@@ -20,6 +20,7 @@
 
 import com.nokia.carbide.remoteconnections.interfaces.*;
 import com.nokia.carbide.trk.support.Messages;
+import com.nokia.carbide.trk.support.connection.TCFUSBConnectionType;
 import com.nokia.carbide.trk.support.connection.TCPIPConnectionType;
 import com.nokia.carbide.trk.support.connection.USBConnectionType;
 import com.nokia.cpp.internal.api.utils.core.Check;
@@ -46,7 +47,8 @@
 	public Collection<String> getCompatibleConnectionTypeIds() {
 		return Arrays.asList(new String[] {
 				TCPIPConnectionType.ID,
-				USBConnectionType.ID
+				USBConnectionType.ID,
+				TCFUSBConnectionType.ID,
 		});
 	}
 
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java	Fri May 28 11:09:31 2010 -0500
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java	Fri May 28 14:29:31 2010 -0500
@@ -37,6 +37,7 @@
 import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus;
 import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus.EConnectionStatus;
 import com.nokia.carbide.trk.support.Messages;
+import com.nokia.carbide.trk.support.connection.TCFUSBConnectionType;
 import com.nokia.carbide.trk.support.connection.USBConnectionType;
 import com.nokia.carbide.trk.support.service.TRKConnectedService;
 import com.nokia.carbide.trk.support.service.TracingConnectedService;
@@ -204,7 +205,8 @@
 	
 	private boolean canBeSetToCurrent(IConnection connection) {
 		// USB connections for now
-		return USBConnectionType.ID.equals(connection.getConnectionType().getIdentifier());
+		return USBConnectionType.ID.equals(connection.getConnectionType().getIdentifier())
+		|| TCFUSBConnectionType.ID.equals(connection.getConnectionType().getIdentifier());
 	}
 
 	private void reconcileStatus(IConnection connection) {