# HG changeset patch # User fturovic # Date 1265133406 21600 # Node ID 11480f2167cad618dc1deff03c1a2acd8c08a8f5 # Parent 00c3cae74cd67eaa4968cab84ef2cd39474d48a2# Parent 90ae1a15f8672b2e6072a129f8184e03bc7f6e43 daily merge diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/.classpath --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/.classpath Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,9 @@ + + + + + + + + + diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/.project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/.project Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,34 @@ + + + com.nokia.carbide.remoteConnections.discovery.pccs + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature + + diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/.settings/.api_filters --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/.settings/.api_filters Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/.settings/org.eclipse.jdt.core.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/.settings/org.eclipse.jdt.core.prefs Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,8 @@ +#Thu Dec 17 12:28:16 CST 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/META-INF/MANIFEST.MF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/META-INF/MANIFEST.MF Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: PCCS Discovery Agent +Bundle-SymbolicName: com.nokia.carbide.remoteConnections.discovery.pccs;singleton:=true +Bundle-Version: 1.4.0.qualifier +Bundle-Activator: com.nokia.carbide.remoteconnections.discovery.pccs.Activator +Bundle-Vendor: Nokia +Require-Bundle: org.eclipse.cdt.core, + org.eclipse.core.runtime, + org.eclipse.jface, + org.eclipse.ui, + com.nokia.carbide.remoteConnections +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: ., + lib/jna.jar, + lib/win32-x86.jar, + pccsPlugin.jar +Export-Package: com.nokia.carbide.remoteconnections.discovery.pccs.agent, + com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/build.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/build.properties Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,8 @@ +bin.includes = META-INF/,\ + plugin.xml,\ + os/,\ + lib/,\ + pccsPlugin.jar +jars.compile.order = pccsPlugin.jar +output.pccsPlugin.jar = bin/ +source.pccsPlugin.jar = src/ diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/lib/jna.jar Binary file connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/lib/jna.jar has changed diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/lib/win32-x86.jar Binary file connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/lib/win32-x86.jar has changed diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/os/win32/x86/jnidispatch.dll Binary file connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/os/win32/x86/jnidispatch.dll has changed diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/plugin.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/plugin.xml Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,11 @@ + + + + + + + + + diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/Activator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/Activator.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,88 @@ +/* +* 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.remoteconnections.discovery.pccs; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends Plugin { + + // The plug-in ID + public static final String PLUGIN_ID = "com.nokia.carbide.remoteConnections.discovery.pccs"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + private static final String SYMSEE_LAYOUT_PLUGIN = "com.nokia.carbide.internal.doc.user"; //$NON-NLS-1$ + private static final String AGENT_NAME = Messages.Activator_Agent_Name; + private static final String PCSuiteWikiLocation = Messages.Activator_PCSuite_Location; + private static final String PCCSLocation = Messages.Activator_PCCS_Location; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + public static boolean isSymSEELayout() { + if (Platform.getBundle(SYMSEE_LAYOUT_PLUGIN) != null) + return true; + return false; + + } + public static String getDisplayName() { + return AGENT_NAME; + } + public static String getLoadErrorURL() { + if (isSymSEELayout()) { + return PCCSLocation; + } else { + return PCSuiteWikiLocation; + } + } +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/Messages.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/Messages.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,45 @@ +/* +* 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.remoteconnections.discovery.pccs; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "com.nokia.carbide.remoteconnections.discovery.pccs.messages"; //$NON-NLS-1$ + public static String Activator_Agent_Name; + public static String Activator_PCCS_Location; + public static String Activator_PCSuite_Location; + public static String ConnAPILibrary_PCCS_Not_Found_Error; + public static String ConnAPILibrary_PCSuite_Not_Found_Error; + public static String PCCSConnection_PCCS_CONAOpenDM_Error; + public static String PCCSConnection_PCCS_CONARegisterNotifyCallback_Error; + public static String PCCSConnection_PCCS_CONARegisterNotifyCallback_Pointer_Error; + public static String PCCSConnection_PCCS_Not_Enough_Memory_Error; + public static String PCCSConnection_PCCS_Version_Error; + public static String PCCSConnection_PCSuite_Version_Error; + public static String PCCSDiscoveryAgent_PCCS_Not_Found_Error; + public static String PCCSDiscoveryAgent_PCCS_Version_Error; + public static String PCCSDiscoveryAgent_PCSuite_Not_Found_Error; + public static String PCCSDiscoveryAgent_PCSuite_Version_Error; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/agent/PCCSDiscoveryAgent.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/agent/PCCSDiscoveryAgent.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,300 @@ +/* +* 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.remoteconnections.discovery.pccs.agent; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.CoreException; + +import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; +import com.nokia.carbide.remoteconnections.discovery.pccs.Activator; +import com.nokia.carbide.remoteconnections.discovery.pccs.Messages; +import com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.DeviceConnectionInfo; +import com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.DeviceInfo; +import com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.PCCSConnection; +import com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.PCCSConnection.DeviceEventListener; +import com.nokia.carbide.remoteconnections.interfaces.IConnection; +import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory; +import com.nokia.carbide.remoteconnections.interfaces.IConnectionType; +import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager; +import com.nokia.carbide.remoteconnections.internal.api.IConnection2; +import com.nokia.carbide.remoteconnections.internal.api.IDeviceDiscoveryAgent; + +/** + * Implementation of IDeviceDiscoveryAgent for PCCS USB connection. + */ +public class PCCSDiscoveryAgent implements IDeviceDiscoveryAgent, DeviceEventListener { + + private static final String USB_CONNECTION_TYPE = + "com.nokia.carbide.trk.support.connection.USBConnectionType"; //$NON-NLS-1$ + private static final String PORT_SETTING = "port"; //$NON-NLS-1$ + + public class PCCSPrequisiteStatus implements IPrerequisiteStatus { + private boolean isOK = true; + private String errorText; + private URL errorURL; + + public PCCSPrequisiteStatus() { + isOK = true; + errorText = null; + errorURL = null; + } + + public PCCSPrequisiteStatus(boolean ok, String msg, URL url) { + isOK = ok; + errorText = msg; + errorURL = url; + } + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.internal.api.IDeviceDiscoveryAgent.IPrerequisiteStatus#getErrorText() + */ + public String getErrorText() { + return errorText; + } + + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.internal.api.IDeviceDiscoveryAgent.IPrerequisiteStatus#getURL() + */ + public URL getURL() { + return errorURL; + } + + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.internal.api.IDeviceDiscoveryAgent.IPrerequisiteStatus#isOK() + */ + public boolean isOK() { + return isOK; + } + + } + + protected Map connections; + protected IConnectionsManager manager; + protected PCCSConnection pccsConnection; + private IPrerequisiteStatus loadStatus = new PCCSPrequisiteStatus(); + + /** + * Constructs a PCCSDiscoveryAgent object + */ + public PCCSDiscoveryAgent() { + connections = new HashMap(); + manager = RemoteConnectionsActivator.getConnectionsManager(); + pccsConnection = new PCCSConnection(); + } + + private boolean isSymSEELayout() { + return Activator.isSymSEELayout(); + } + + /* + * (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.internal.IDeviceDiscoveryAgent#getInformation() + */ + public URL getInformation() { + return null; + } + + /* + * (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.PCCSConnection.DeviceEventListener#onDeviceEvent(com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.PCCSConnection.DeviceEventListener.DeviceEvent, java.lang.String) + */ + public void onDeviceEvent(DeviceEvent eventType, String serialNumber) { + try { + switch (eventType) { + case DEVICE_LIST_UPDATED: + case DEVICE_ADDED: + case DEVICE_REMOVED: + case DEVICE_UPDATED_ADDEDCONNECTION: + case DEVICE_UPDATED_REMOVEDCONNECTION: + updateConnections(pccsConnection.getDeviceList()); + break; + case DEVICE_UPDATED_RENAMED: + // TODO what to do when device is renamed? + break; + } + } catch (CoreException e) { + RemoteConnectionsActivator.logError(e); + } + } + + /* + * (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.internal.IDeviceDiscoveryAgent#start() + */ + public void start() throws CoreException { + try { + pccsConnection.open(); + } catch (CoreException ce) { + saveLoadStatus(ce); + throw ce; // rethrow + } + updateConnections(pccsConnection.getDeviceList()); + pccsConnection.addEventListenter(this); + } + + private void saveLoadStatus(CoreException ce) { + String msg = null; + URL location = null; + if (isSymSEELayout()) { + if (ce.getStatus().getCode() == PCCSConnection.PCCS_NOT_FOUND) + msg = Messages.PCCSDiscoveryAgent_PCCS_Not_Found_Error; + else + msg = Messages.PCCSDiscoveryAgent_PCCS_Version_Error; + + try { + location = new URL(Activator.getLoadErrorURL()); + } catch (MalformedURLException e) { + } + } else { + if (ce.getStatus().getCode() == PCCSConnection.PCCS_NOT_FOUND) + msg = Messages.PCCSDiscoveryAgent_PCSuite_Not_Found_Error; + else + msg = Messages.PCCSDiscoveryAgent_PCSuite_Version_Error; + + try { + location = new URL(Activator.getLoadErrorURL()); + } catch (MalformedURLException e) { + } + } + loadStatus = new PCCSPrequisiteStatus(false, msg, location); + } + + /* + * (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.internal.IDeviceDiscoveryAgent#stop() + */ + public void stop() throws CoreException { + pccsConnection.removeEventListener(this); + pccsConnection.close(); + } + + /** + * Creates a new PCCS USB connection + * @param deviceInfo - device information of the PCCS USB connection + */ + protected void createConnection(DeviceInfo deviceInfo, DeviceConnectionInfo connectionInfo) { + if (connections.get(deviceInfo) == null) { + // TODO: currently only handles USB + if (connectionInfo.media.equals("usb")) { //$NON-NLS-1$ + IConnectionType connectionType = + RemoteConnectionsActivator.getConnectionTypeProvider().getConnectionType(USB_CONNECTION_TYPE); + if (connectionType != null) { + IConnectionFactory factory = connectionType.getConnectionFactory(); + Map settings = factory.getSettingsFromUI(); + settings.put(PORT_SETTING, connectionInfo.comPort); + IConnection connection = factory.createConnection(settings); + if (connection instanceof IConnection2) { + IConnection2 connection2 = (IConnection2) connection; + connection2.setIdentifier(createUniqueId(deviceInfo)); + connection2.setDisplayName(deviceInfo.friendlyName); + connection2.setDynamic(true); + String key = getKey(deviceInfo, connectionInfo); + connections.put(key, connection2); + manager.addConnection(connection2); + } + else { + RemoteConnectionsActivator.log("Could not create dynamic serial connection", null); + } + } + else { + RemoteConnectionsActivator.log("USB connection type extension not found", null); + } + } + } + } + + private String createUniqueId(DeviceInfo deviceInfo) { + return getClass().getSimpleName() + ": " + deviceInfo.friendlyName; //$NON-NLS-1$ + } + + /** + * Return a string key based on the device and connection information + * @param deviceInfo - device information + * @param connectionInfo - device connection information + * @return + */ + protected String getKey(DeviceInfo deviceInfo, DeviceConnectionInfo connectionInfo) { + String key = deviceInfo.friendlyName + deviceInfo.serialNumber + connectionInfo.address; + return key; + } + + /** + * Update existing PCCS USB connections + * @param deviceInfoList - list of device information for current PCCS USB connections + */ + protected void updateConnections(DeviceInfo[] deviceInfoList) { + disconnectAll(); + if (deviceInfoList != null) { + if (connections.isEmpty()) { + // no existing connections, so create new ones + for (DeviceInfo deviceInfo : deviceInfoList) { + for (DeviceConnectionInfo connectionInfo : deviceInfo.connections) { + createConnection(deviceInfo, connectionInfo); + } + } + } + else { + for (DeviceInfo deviceInfo : deviceInfoList) { + for (DeviceConnectionInfo connectionInfo : deviceInfo.connections) { + String key = getKey(deviceInfo, connectionInfo); + IConnection2 connection = connections.get(key); + if (connection == null) { + // no existing connection for the device found, must be new connection + createConnection(deviceInfo, connectionInfo); + } + else { + // existing connection for the device found, try to reconnect + if (!manager.reconnect(connection)) { + // reconnect failed, probably because the connection is not in use + // so just create a new one + manager.addConnection(connection); + } + } + } + } + } + } + } + + private void disconnectAll() { + for (IConnection2 connection : connections.values()) { + manager.disconnect(connection); + } + } + + public String getDisplayName() { + return Activator.getDisplayName(); + } + + public IPrerequisiteStatus getPrerequisiteStatus() { + // Manager calls this first so we can check if we can load. + // so let's open the discovery and close it catching any exceptions. + try { + pccsConnection.open(); + // successful load - close it as start() will open again + pccsConnection.close(); + } catch (CoreException ce) { + saveLoadStatus(ce); + } + + return loadStatus; + } + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/messages.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/messages.properties Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,15 @@ +Activator_Agent_Name=PC Suite Device Discovery Agent +Activator_PCCS_Location=http://www2.connecting.nokia.com/nmp/swp/pcsuite.nsf/document/ES336ZAHVY?OpenDocument +Activator_PCSuite_Location=http://s60wiki.nokia.com/S60Wiki/Device_Discovery +ConnAPILibrary_PCCS_Not_Found_Error=Agent could not find a PC Connectivity Solution (PCCS) installation. For more information go to: +ConnAPILibrary_PCSuite_Not_Found_Error=Agent could not find a PC Suite installation. To install PC Suite, go to: +PCCSConnection_PCCS_CONAOpenDM_Error=PCCS CONAOpenDM API returned error on initialization %x +PCCSConnection_PCCS_CONARegisterNotifyCallback_Error=PCCS CONARegisterNotifyCallback API returned error %x +PCCSConnection_PCCS_CONARegisterNotifyCallback_Pointer_Error=PCCS CONARegisterNotifyCallback API contained an invalid function pointer +PCCSConnection_PCCS_Not_Enough_Memory_Error=Not enough memory to open the PCCS Device Management connection +PCCSConnection_PCCS_Version_Error=The requested PC Connectivity Solution DMAPI version (3.4) is not installed on this machine. To install a later version go to: +PCCSConnection_PCSuite_Version_Error=The current PC Suite intallation does not support the required level of API for this agent. To install a later version go to: +PCCSDiscoveryAgent_PCCS_Not_Found_Error=Agent could not find the PC Connectivity Solution (PCCS) installation. +PCCSDiscoveryAgent_PCCS_Version_Error=Agent requires a later version of the PC Connectivity Solution (PCCS) installed. +PCCSDiscoveryAgent_PCSuite_Not_Found_Error=Agent could not find a PC Suite installation. +PCCSDiscoveryAgent_PCSuite_Version_Error=Agent requires a later version of the PC Suite installed. diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/CONAPI_CONNECTION_INFO.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/CONAPI_CONNECTION_INFO.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,59 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Structure; + +public class CONAPI_CONNECTION_INFO extends Structure { + public int dwDeviceID; + /// See definitions for media types in PCCSTypeDefinitions.h + public int dwMedia; + /// C type : WCHAR* + public com.sun.jna.ptr.ShortByReference pstrDeviceName; + /// C type : WCHAR* + public com.sun.jna.ptr.ShortByReference pstrAddress; + /// See definitions for State values + public int dwState; + public CONAPI_CONNECTION_INFO() { + super(); + } + + /** + * @param dwMedia See definitions for media types in PCCSTypeDefinitions.h
+ * @param pstrDeviceName C type : WCHAR*
+ * @param pstrAddress C type : WCHAR*
+ * @param dwState See definitions for State values + */ + public CONAPI_CONNECTION_INFO(int dwDeviceID, int dwMedia, com.sun.jna.ptr.ShortByReference pstrDeviceName, com.sun.jna.ptr.ShortByReference pstrAddress, int dwState) { + super(); + this.dwDeviceID = dwDeviceID; + this.dwMedia = dwMedia; + this.pstrDeviceName = pstrDeviceName; + this.pstrAddress = pstrAddress; + this.dwState = dwState; + } + protected ByReference newByReference() { return new ByReference(); } + protected ByValue newByValue() { return new ByValue(); } + protected CONAPI_CONNECTION_INFO newInstance() { return new CONAPI_CONNECTION_INFO(); } + public static CONAPI_CONNECTION_INFO[] newArray(int arrayLength) { + return null; +// return com.ochafik.lang.jnaerator.runtime.Structure.newArray(CONAPI_CONNECTION_INFO.class, arrayLength); + } + public static class ByReference extends CONAPI_CONNECTION_INFO implements com.sun.jna.Structure.ByReference {} + public static class ByValue extends CONAPI_CONNECTION_INFO implements com.sun.jna.Structure.ByValue {} + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/CONAPI_DEVICE.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/CONAPI_DEVICE.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,63 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Structure; + +public class CONAPI_DEVICE extends Structure { + /// C type : WCHAR* + public com.sun.jna.ptr.ShortByReference pstrSerialNumber; + /// C type : WCHAR* + public com.sun.jna.ptr.ShortByReference pstrFriendlyName; + /// C type : WCHAR* + public com.sun.jna.ptr.ShortByReference pstrModel; + /// C type : WCHAR* + public com.sun.jna.ptr.ShortByReference pstrManufacturer; + public int dwNumberOfItems; + /// C type : CONAPI_CONNECTION_INFO* + public CONAPI_CONNECTION_INFO.ByReference pItems; + public CONAPI_DEVICE() { + super(); + } + /** + * @param pstrSerialNumber C type : WCHAR*
+ * @param pstrFriendlyName C type : WCHAR*
+ * @param pstrModel C type : WCHAR*
+ * @param pstrManufacturer C type : WCHAR*
+ * @param pItems C type : CONAPI_CONNECTION_INFO* + */ + public CONAPI_DEVICE(com.sun.jna.ptr.ShortByReference pstrSerialNumber, com.sun.jna.ptr.ShortByReference pstrFriendlyName, com.sun.jna.ptr.ShortByReference pstrModel, com.sun.jna.ptr.ShortByReference pstrManufacturer, int dwNumberOfItems, CONAPI_CONNECTION_INFO.ByReference pItems) { + super(); + this.pstrSerialNumber = pstrSerialNumber; + this.pstrFriendlyName = pstrFriendlyName; + this.pstrModel = pstrModel; + this.pstrManufacturer = pstrManufacturer; + this.dwNumberOfItems = dwNumberOfItems; + this.pItems = pItems; + } + protected ByReference newByReference() { return new ByReference(); } + protected ByValue newByValue() { return new ByValue(); } + protected CONAPI_DEVICE newInstance() { return new CONAPI_DEVICE(); } + public static CONAPI_DEVICE[] newArray(int arrayLength) { + return null; + +// return com.ochafik.lang.jnaerator.runtime.Structure.newArray(CONAPI_DEVICE.class, arrayLength); + } + public static class ByReference extends CONAPI_DEVICE implements com.sun.jna.Structure.ByReference {} + public static class ByValue extends CONAPI_DEVICE implements com.sun.jna.Structure.ByValue {} + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/CONAPI_MEDIA.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/CONAPI_MEDIA.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,80 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Structure; + +/** + * This file was originally autogenerated by JNAerator,
+ * but then modified for Carbide. + */ +public class CONAPI_MEDIA extends Structure { + /// Must be sizeof(CONAPI_MEDIA) + public int dwSize; + /// Media type + public int dwMedia; + /** + * Media name
+ * C type : WCHAR* + */ + public com.sun.jna.ptr.ShortByReference pstrDescription; + /// Media state. CONAPI_MEDIA_ACTIVE or CONAPI_MEDIA_NOT_ACTIVE + public int dwState; + /// Media options + public int dwOptions; + /// Media specific data + public int dwMediaData; + /** + * Media ID string
+ * C type : WCHAR* + */ + public com.sun.jna.ptr.ShortByReference pstrID; + public CONAPI_MEDIA() { + super(); + } + /** + * @param dwSize Must be sizeof(CONAPI_MEDIA)
+ * @param dwMedia Media type
+ * @param pstrDescription Media name
+ * C type : WCHAR*
+ * @param dwState Media state. CONAPI_MEDIA_ACTIVE or CONAPI_MEDIA_NOT_ACTIVE
+ * @param dwOptions Media options
+ * @param dwMediaData Media specific data
+ * @param pstrID Media ID string
+ * C type : WCHAR* + */ + public CONAPI_MEDIA(int dwSize, int dwMedia, com.sun.jna.ptr.ShortByReference pstrDescription, int dwState, int dwOptions, int dwMediaData, com.sun.jna.ptr.ShortByReference pstrID) { + super(); + this.dwSize = dwSize; + this.dwMedia = dwMedia; + this.pstrDescription = pstrDescription; + this.dwState = dwState; + this.dwOptions = dwOptions; + this.dwMediaData = dwMediaData; + this.pstrID = pstrID; + } + protected ByReference newByReference() { return new ByReference(); } + protected ByValue newByValue() { return new ByValue(); } + protected CONAPI_MEDIA newInstance() { return new CONAPI_MEDIA(); } + public static CONAPI_MEDIA[] newArray(int arrayLength) { + return null; +// return com.ochafik.lang.jnaerator.runtime.Structure.newArray(CONAPI_MEDIA.class, arrayLength); + } + public static class ByReference extends CONAPI_MEDIA implements com.sun.jna.Structure.ByReference {} + public static class ByValue extends CONAPI_MEDIA implements com.sun.jna.Structure.ByValue {} + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/CONAPI_MEDIA_INFO.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/CONAPI_MEDIA_INFO.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,103 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.NativeLong; +import com.sun.jna.Pointer; +import com.sun.jna.Structure; +import com.sun.jna.TypeMapper; +import com.sun.jna.ptr.ShortByReference; + +/** + * This file was originally autogenerated by JNAerator,
+ * but modified to work with Carbide. + */ +public class CONAPI_MEDIA_INFO extends Structure { + /// Must be sizeof(CONAPI_MEDIA_INFO) + public int dwSize; + /** + * Media ID
+ * C type : GUID + */ + public GUID gMediaID; + /// Detailed media type + public int dwMediaType; + /// Media state. Use media state macros to get states! + public int dwMediaState; + /** + * Media name
+ * C type : WCHAR* + */ + public ShortByReference pstrName; + /** + * Version (driver, stack, etc.), can be NULL
+ * C type : WCHAR* + */ + public ShortByReference pstrVersion; + /** + * Local address if supported, can be NULL
+ * C type : WCHAR* + */ + public ShortByReference pstrAddress; + /** + * Local HW name if supported, can be NULL
+ * C type : WCHAR* + */ + public ShortByReference pstrHWName; + /// For future use + public int dwCapabilities; + public CONAPI_MEDIA_INFO() { + super(); + } + /** + * @param dwSize Must be sizeof(CONAPI_MEDIA_INFO)
+ * @param gMediaID Media ID
+ * C type : GUID
+ * @param dwMediaType Detailed media type
+ * @param dwMediaState Media state. Use media state macros to get states!
+ * @param pstrName Media name
+ * C type : WCHAR*
+ * @param pstrVersion Version (driver, stack, etc.), can be NULL
+ * C type : WCHAR*
+ * @param pstrAddress Local address if supported, can be NULL
+ * C type : WCHAR*
+ * @param pstrHWName Local HW name if supported, can be NULL
+ * C type : WCHAR*
+ * @param dwCapabilities For future use + */ + public CONAPI_MEDIA_INFO(int dwSize, GUID gMediaID, int dwMediaType, int dwMediaState, ShortByReference pstrName, ShortByReference pstrVersion, ShortByReference pstrAddress, ShortByReference pstrHWName, int dwCapabilities) { + super(); + this.dwSize = dwSize; + this.gMediaID = gMediaID; + this.dwMediaType = dwMediaType; + this.dwMediaState = dwMediaState; + this.pstrName = pstrName; + this.pstrVersion = pstrVersion; + this.pstrAddress = pstrAddress; + this.pstrHWName = pstrHWName; + this.dwCapabilities = dwCapabilities; + } + protected ByReference newByReference() { return new ByReference(); } + protected ByValue newByValue() { return new ByValue(); } + protected CONAPI_MEDIA_INFO newInstance() { return new CONAPI_MEDIA_INFO(); } + public static CONAPI_MEDIA_INFO[] newArray(int arrayLength) { + return null; +// return com.ochafik.lang.jnaerator.runtime.Structure.newArray(CONAPI_MEDIA_INFO.class, arrayLength); + } + public static class ByReference extends CONAPI_MEDIA_INFO implements com.sun.jna.Structure.ByReference {} + public static class ByValue extends CONAPI_MEDIA_INFO implements com.sun.jna.Structure.ByValue {} +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/ConnAPILibrary.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/ConnAPILibrary.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,274 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import java.nio.IntBuffer; +import java.nio.ShortBuffer; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +import com.nokia.carbide.remoteconnections.discovery.pccs.Activator; +import com.nokia.carbide.remoteconnections.discovery.pccs.Messages; +import com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.CONAPI_MEDIA.ByReference; +import com.sun.jna.Native; +import com.sun.jna.Pointer; +import com.sun.jna.ptr.IntByReference; + +public class ConnAPILibrary implements IConnAPILibrary { + + private static IConnAPILibrary Instance; + + /** + * + */ + public ConnAPILibrary() { + } + + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.ConnAPILibrary#getInstance() + */ + public static IConnAPILibrary getInstance() throws CoreException { + if (Instance == null) + loadConnAPILibrary(); + return Instance; + } + + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.ConnAPILibrary#loadConnAPILibrary() + */ + private static void loadConnAPILibrary() throws CoreException { + try { + Instance = (IConnAPILibrary) Native.loadLibrary("ConnAPI", IConnAPILibrary.class); //$NON-NLS-1$ + } catch (UnsatisfiedLinkError e) { + String msg; + if (Activator.isSymSEELayout()) { + msg = Messages.ConnAPILibrary_PCCS_Not_Found_Error + Activator.getLoadErrorURL(); + } else { + msg = Messages.ConnAPILibrary_PCSuite_Not_Found_Error + Activator.getLoadErrorURL(); + } + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, PCCSConnection.PCCS_NOT_FOUND, msg, e)); + } + } + + public int CFAPI_Initialize(int dwAPIVersion, IntByReference pdwParam) { + // TODO Auto-generated method stub + return 0; + } + + public int CFAPI_Terminate(IntByReference pdwParam) { + // TODO Auto-generated method stub + return 0; + } + + public int CONACloseDM(DMHANDLE mHDMHandle) { + // TODO Auto-generated method stub + return 0; + } + + public int CONAFreeDeviceStructure(int dwCount, CONAPI_DEVICE[] pDevices) { + // TODO Auto-generated method stub + return 0; + } + + public int CONAGetDeviceCount(DMHANDLE hDMHandle, IntByReference pdwCount) { + // TODO Auto-generated method stub + return 0; + } + + public int CONAGetDevices(DMHANDLE hDMHandle, IntByReference pdwCount, + CONAPI_DEVICE[] pDevices) { + // TODO Auto-generated method stub + return 0; + } + + public int CONAOpenDM(LPDMHANDLE mHDMHandle) { + // TODO Auto-generated method stub + return 0; + } + + public int CONARegisterNotifyCallback(DMHANDLE hDMHandle, int dwState, + IConnAPIDeviceCallback pfnNotify) { + // TODO Auto-generated method stub + return 0; + } + + public int DMAPI_GetAPIVersion() { + // TODO Auto-generated method stub + return 0; + } + + public int DMAPI_Initialize(int dwAPIVersion, IntByReference pdwParam) { + // TODO Auto-generated method stub + return 0; + } + + public int DMAPI_Terminate(IntByReference pdwParam) { + // TODO Auto-generated method stub + return 0; + } + + public int CONACloseMM(MCHANDLE hMCHandle) { + // TODO Auto-generated method stub + return 0; + } + + public int CONAMMFreeMediaStructures(int dwCountOfMedia, + CONAPI_MEDIA[] pMedia) { + // TODO Auto-generated method stub + return 0; + } + + public int CONAMMGetMedia(MCHANDLE hMCHandle, IntBuffer pdwCountOfMedia, + ByReference[] ppMedia) { + // TODO Auto-generated method stub + return 0; + } + + public int CONAMMSetMedia(MCHANDLE hMCHandle, CONAPI_MEDIA[] pMedia) { + // TODO Auto-generated method stub + return 0; + } + + public int CONAOpenMM(LPMCHANDLE phMCHandle, int dwValue) { + // TODO Auto-generated method stub + return 0; + } + + public int CONARegisterMMNotifyCallback(MCHANDLE hMCHandle, int dwState, + IConnAPIMediaCallback pfnNotify) { + // TODO Auto-generated method stub + return 0; + } + + public int MCAPI_FreeMediaInfo(CONAPI_MEDIA_INFO[] pMediaInfo) { + // TODO Auto-generated method stub + return 0; + } + + public int MCAPI_GetAPIVersion() { + // TODO Auto-generated method stub + return 0; + } + + public int MCAPI_GetMediaInfo(MCHANDLE hMCHandle, ShortBuffer pstrMediaID, + CONAPI_MEDIA_INFO[] pMediaInfo) { + // TODO Auto-generated method stub + return 0; + } + + public int MCAPI_Initialize(int dwAPIVersion, IntBuffer pdwParam) { + // TODO Auto-generated method stub + return 0; + } + + public int MCAPI_Terminate(IntBuffer pdwParam) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_CloseUSBPersonality(UPHANDLE hUPHandle) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_FreeDeviceDescriptor(int dwDeviceCount, + UP_DEVICE_DESCRIPTOR[] pDeviceDescriptor) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_FreePersonalityDescriptors( + UP_PERSONALITY_DESCRIPTORS[] pPersonalityDescriptors) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_FreeStringDescriptor( + UP_STRING_DESCRIPTOR[] pStringDescriptor) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_GetAPIVersion() { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_GetConfigurationDescriptor(UPHANDLE hUPHandle, + ShortBuffer pstrDeviceId, + UP_CONFIGURATION_DESCRIPTOR[] pConfigurationDescriptor) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_GetPersonalityDescriptors(UPHANDLE hUPHandle, + ShortBuffer pstrDeviceId, + UP_PERSONALITY_DESCRIPTORS[] pPersonalityDescriptors) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_GetStringDescriptor(UPHANDLE hUPHandle, + ShortBuffer pstrDeviceId, int dwDescriptorIndex, int dwLanguageID, + UP_STRING_DESCRIPTOR[] pStringDescriptor) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_Initialize(int dwAPIVersion, IntBuffer pdwParam) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_OpenUSBPersonality(int dwVendorId, LPUPHANDLE phUPHandle) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_QueryDeviceCount(UPHANDLE hUPHandle, + IntBuffer pdwDeviceCount) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_QueryDevices(Pointer hUPHandle, IntBuffer pdwDeviceCount, + UP_DEVICE_DESCRIPTOR[] pDeviceDescriptor) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_SendCommandToDevice(UPHANDLE hUPHandle, + ShortBuffer pstrDeviceId, int dwDataDirection, + UP_DATA_BUFFER[] pDataBuffer) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_SetPersonality(UPHANDLE hUPHandle, + ShortBuffer pstrDeviceId, int dwPersonalityCode) { + // TODO Auto-generated method stub + return 0; + } + + public int UPAPI_Terminate(IntBuffer pdwParam) { + // TODO Auto-generated method stub + return 0; + } + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/DMAPIDefinitions.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/DMAPIDefinitions.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,176 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +public class DMAPIDefinitions { + //========================================================= + // CFAPI version + // + public static final int CFAPI_VERSION_10 = 10; + //========================================================= + //========================================================= + // Device Management API versions + // + public static final int DMAPI_VERSION_30 =30; + public static final int DMAPI_VERSION_31 =31; + public static final int DMAPI_VERSION_32 =32; + public static final int DMAPI_VERSION_33 =33; + public static final int DMAPI_VERSION_34 =34; + public static final int DMAPI_VERSION_35 =35; + public static final int DMAPI_VERSION_36 =36; + public static final int DMAPI_VERSION_37 =37; + //========================================================= + // Device callback status values + public static final int CONAPI_DEVICE_LIST_UPDATED =0x00; // List is updated. No any specific information. + public static final int CONAPI_DEVICE_ADDED =0x01; // A new device is added to the list. + public static final int CONAPI_DEVICE_REMOVED =0x02; // Device is removed from the list. + public static final int CONAPI_DEVICE_UPDATED =0x04; // Device is updated. A connection is added or removed + // or device is renamed. Device still exist in the list. + // Device callback info values + public static final int CONAPI_CONNECTION_ADDED =0x01; // Note! HIBYTE == media, LOBYTE == CONAPI_CONNECTION_ADDED + public static final int CONAPI_CONNECTION_REMOVED =0x02; // Note! HIBYTE == media, LOBYTE == CONAPI_CONNECTION_REMOVED + public static final int CONAPI_DEVICE_RENAMED =0x04; // Friendly name of the device is changed + + // Device callback macros +// #define GET_CONAPI_CB_STATUS(Status) (0x0000FFFF & Status) +// #define GET_CONAPI_CB_INFO(Status) ((0x00FF0000 & Status)>>16) +// #define GET_CONAPI_CB_INFO_DATA(Status) ((0xFF000000 & Status)>>24) + public static final int GET_CONAPI_CB_STATUS(int status) { + return (0x0000FFFF & status); + } + public static final int GET_CONAPI_CB_INFO(int status) { + return ((0x00FF0000 & status) >>16); + } + public static final int GET_CONAPI_CB_INFO_DATA(int status) { + return ((0xFF000000 & status)>>24); + } + // Definitions used with dwState value in CONAPI_CONNECTION_INFO stucture: +// #define CONAPI_DEVICE_NOT_FUNCTIONAL 0x00000000 // Device is not working or unsupported device. +// #define CONAPI_DEVICE_UNPAIRED 0x00000001 // Device is not paired +// #define CONAPI_DEVICE_PAIRED 0x00000002 // Device is paired +// #define CONAPI_DEVICE_PCSUITE_TRUSTED 0x00000004 // Device is PC Suite trusted +// #define CONAPI_DEVICE_WRONG_MODE 0x00000008 // Device is connected in wrong mode. + public static final int CONAPI_DEVICE_NOT_FUNCTIONAL = 0x00000000; + public static final int CONAPI_DEVICE_UNPAIRED = 0x00000001; + public static final int CONAPI_DEVICE_PAIRED = 0x00000002; + public static final int CONAPI_DEVICE_PCSUITE_TRUSTED = 0x00000004; + public static final int CONAPI_DEVICE_WRONG_MODE = 0x00000008; + + // Definitions used also with dwState value in CONAPI_CONNECTION_INFO stucture if + // CONASetDeviceListOption function is called with DMAPI_OPTION_INCLUDE_USB_MODE_IN_LIST parameter: +// #define CONAPI_DEVICE_IN_PCSUITE_MODE 0x01000000 // PC Suite mode +// #define CONAPI_DEVICE_IN_MASSSTORAGE_MODE 0x02000000 // Mass storage mode +// #define CONAPI_DEVICE_IN_MTP_MODE 0x03000000 // Media Transfer mode +// #define CONAPI_DEVICE_IN_RNDIS_MODE 0x04000000 // RNDIS mode +// #define CONAPI_DEVICE_IN_PICTBRIDGE_MODE 0x05000000 // Picture bridge mode +// #define CONAPI_DEVICE_IN_UNKNOWN_MODE 0x0E000000 // Unknown mode + public static final int CONAPI_DEVICE_IN_PCSUITE_MODE = 0x01000000; + public static final int CONAPI_DEVICE_IN_MASSSTORAGE_MODE = 0x02000000; + public static final int CONAPI_DEVICE_IN_MTP_MODE = 0x03000000; + public static final int CONAPI_DEVICE_IN_RNDIS_MODE = 0x04000000; + public static final int CONAPI_DEVICE_IN_PICTBRIDGE_MODE = 0x05000000; + public static final int CONAPI_DEVICE_IN_UNKNOWN_MODE = 0x0E000000; + + + // Macros used to check device's swState value: +// #define CONAPI_IS_DEVICE_UNPAIRED(dwState) (dwState & 0x01) // Returns 1 if true +// #define CONAPI_IS_DEVICE_PAIRED(dwState) ((dwState >> 1) & 0x01) // Returns 1 if true +// #define CONAPI_IS_PCSUITE_TRUSTED(dwState) ((dwState >> 2) & 0x01) // Returns 1 if true +// #define CONAPI_IS_DEVICE_WRONG_MODE(dwState)((dwState >> 3) & 0x01) // Returns 1 if true +// #define CONAPI_GET_DEVICE_MODE(dwState) (dwState & 0x0F000000) // Returns CONAPI_DEVICE_IN_xxxx_MODE value + + public static final boolean CONAPI_IS_DEVICE_UNPAIRED(int state) { + return (state & 0x01) != 0; + } + public static final boolean CONAPI_IS_DEVICE_PAIRED(int state) { + return ((state >> 1) & 0x01) != 0; + } + public static final boolean CONAPI_IS_PCSUITE_TRUSTED(int state) { + return ((state >> 2) & 0x01) != 0; + } + public static final boolean CONAPI_IS_DEVICE_WRONG_MODE(int state) { + return ((state >> 3) & 0x01) != 0; + } + public static final int CONAPI_GET_DEVICE_MODE(int state) { + return (state & 0x0F000000); + } + public static final boolean CONAPI_IS_IN_PCSUITE_MODE(int state) { + return CONAPI_GET_DEVICE_MODE(state) == CONAPI_DEVICE_IN_PCSUITE_MODE; + } + public static final boolean CONAPI_IS_IN_MASSSTORAGE_MODE(int state) { + return CONAPI_GET_DEVICE_MODE(state) == CONAPI_DEVICE_IN_MASSSTORAGE_MODE; + } + public static final boolean CONAPI_IS_IN_RNDIS_MODE(int state) { + return CONAPI_GET_DEVICE_MODE(state) == CONAPI_DEVICE_IN_RNDIS_MODE; + } + + + public static final int CONAPI_SERIES60_2ED_DEVICE = 33554448; + public static final int CONAPI_FS_FILE_CONVERSION = 256; + public static final int CONAPI_DEVICE_PRODUCT_INFO = 1048576; + public static final int CONAPI_DEVICE_IS_APP_SUPPORTED = 2; + public static final int CONAPI_ALLOW_TO_USE_CACHE = 4096; + public static final int DMAPI_OPTION_SET_MANUFACTURER = 1; + public static final int CONAPI_UNKNOWN_DEVICE = 0; + public static final int CONAPI_SET_PCSUITE_UNTRUSTED = 2048; + public static final int CONAPI_SET_PCSUITE_TRUSTED = 1024; + public static final int CONAPI_DEVICE_GET_VERSION = 1048580; + public static final int CONAPI_DS_MMS_SERVICE = 20480; + public static final int CONAPI_SYNC_SA_DM = 2; + public static final int CONAPI_GET_PAIRED_PHONES = 16384; + public static final int CONAPI_DEVICE_GET_FOLDEREXCLUDE = 7340036; + public static final int CONAPI_NEF_SERVICE = 12288; + public static final int CONAPI_DEVICE_GENERAL_INFO = 65536; + public static final int CONAPI_SERIES80_DEVICE = 33554688; + public static final int CONAPI_FOLDER_BROWSING_SERVICE = 28672; + public static final int CONAPI_DS_SERVICE = 4096; + public static final int CONAPI_DEVICE_GET_PROPERTY = 1; + public static final int CONAPI_FS_INSTALL_JAVA_APPLICATIONS = 16; + public static final int CONAPI_GET_ALL_PHONES = 8192; + public static final int CONAPI_SYNC_CI_DS = 16; + public static final int CONAPI_DEVICE_GET_OBJTYPE = 3145732; + public static final int CONAPI_FS_LIST_APPLICATIONS = 512; + public static final int CONAPI_FS_INSTALL_SIS_APPLICATIONS = 32; + public static final int CONAPI_DEVICE_GET_NETWORK_ID = 50331652; + public static final int CONAPI_DS_BOOKMARKS_SERVICE = 24576; + public static final int CONAPI_DM_SERVICE = 8192; + public static final int CONAPI_DEVICE_GET_FOLDERMEMTYPE = 6291460; + public static final int CONAPI_FS_NOT_SUPPORTED = 0; + public static final int CONAPI_FS_SUPPORTED = 1; + public static final int CONAPI_NOKIA7710_DEVICE = 33558528; + public static final int CONAPI_USER_DEFINED_SERVICE = 32768; + public static final int CONAPI_GET_TRUSTED_PHONES = 32768; + public static final int CONAPI_DS_SMS_SERVICE = 16384; + public static final int CONAPI_SYNC_NOT_SUPPORTED = 0; + public static final int CONAPI_FS_INSTALL_SISX_APPLICATIONS = 64; + public static final int CONAPI_SERIES60_3ED_DEVICE = 33554464; + public static final int CONAPI_DEVICE_GET_FOLDERPATH = 5242884; + public static final int CONAPI_SYNC_SA_DS = 1; + public static final int CONAPI_DEVICE_GET_COUNTRY_CODE = 33554436; + public static final int CONAPI_FS_UNINSTALL_APPLICATIONS = 1024; + public static final int CONAPI_FS_EXTENDED_OPERATIONS = 2048; + public static final int CONAPI_UNPAIR_DEVICE = 512; + public static final int CONAPI_DEVICE_PROPERTIES_INFO = 16777216; + public static final int CONAPI_DEVICE_GET_CURRENT_NETWORK = 16777220; + public static final int CONAPI_DEVICE_GET_ALL_VALUES = 8388612; + public static final int CONAPI_SERIES40_DEVICE = 16777217; + public static final int CONAPI_DEVICE_GET_FILEPATH = 4194308; + public static final int CONAPI_DEVICE_GET_UUID = 2097156; + public static final int CONAPI_PAIR_DEVICE = 256; + public static final int CONAPI_DEVICE_ICON_INFO = 268435456; + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/DMHANDLE.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/DMHANDLE.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,42 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.FromNativeContext; +import com.sun.jna.Pointer; +import com.sun.jna.PointerType; + +public class DMHANDLE extends PointerType { + // Constant value representing an invalid HANDLE. + public static DMHANDLE INVALID_HANDLE_VALUE = new DMHANDLE(Pointer.createConstant(-1)); + + private boolean immutable; + public DMHANDLE() { } + public DMHANDLE(Pointer p) { setPointer(p); immutable = true; } + /** Override to the appropriate object for INVALID_HANDLE_VALUE. */ + public Object fromNative(Object nativeValue, FromNativeContext context) { + Object o = super.fromNative(nativeValue, context); + if (INVALID_HANDLE_VALUE.equals(o)) + return INVALID_HANDLE_VALUE; + return o; + } + public void setPointer(Pointer p) { + if (immutable) + throw new UnsupportedOperationException("immutable reference"); //$NON-NLS-1$ + super.setPointer(p); + } +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/DeviceConnectionInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/DeviceConnectionInfo.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,34 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +public class DeviceConnectionInfo { + + public int deviceID; + public String media; + public String deviceName; + public String address; + public int state; + public String comPort; + /** + * + */ + public DeviceConnectionInfo() { + // TODO Auto-generated constructor stub + } + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/DeviceInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/DeviceInfo.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,34 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import java.util.ArrayList; +import java.util.Collection; + +public class DeviceInfo { + public String serialNumber; + public String friendlyName; + public String model; + public String mfr; + public int numberOfConnections; + public Collection connections = new ArrayList(); + + public DeviceInfo() { + // TODO Auto-generated constructor stub + } + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/GUID.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/GUID.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,55 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.NativeLong; +import com.sun.jna.Structure; + +/** + * This file was originally autogenerated by JNAerator,
+ * but modified for use in Carbide + */ +public class GUID extends Structure { + public NativeLong Data1; + public short Data2; + public short Data3; + /// C type : unsigned char[8] + public byte[] Data4 = new byte[(8)]; + public GUID() { + super(); + } + /// @param Data4 C type : unsigned char[8] + public GUID(NativeLong Data1, short Data2, short Data3, byte Data4[]) { + super(); + this.Data1 = Data1; + this.Data2 = Data2; + this.Data3 = Data3; + if (Data4.length != this.Data4.length) + throw new java.lang.IllegalArgumentException("Wrong array size !"); + this.Data4 = Data4; + } + protected ByReference newByReference() { return new ByReference(); } + protected ByValue newByValue() { return new ByValue(); } + protected GUID newInstance() { return new GUID(); } + public static GUID[] newArray(int arrayLength) { + return null; +// return com.ochafik.lang.jnaerator.runtime.Structure.newArray(GUID.class, arrayLength); + } + public static class ByReference extends GUID implements com.sun.jna.Structure.ByReference {} + public static class ByValue extends GUID implements com.sun.jna.Structure.ByValue {} + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/IConnAPILibrary.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/IConnAPILibrary.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,91 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import java.nio.IntBuffer; +import java.nio.ShortBuffer; + +import org.eclipse.core.runtime.CoreException; + +import com.sun.jna.Callback; +import com.sun.jna.Native; +import com.sun.jna.ptr.IntByReference; +import com.sun.jna.ptr.ShortByReference; +import com.sun.jna.win32.StdCallLibrary; + +public interface IConnAPILibrary extends StdCallLibrary { + + // DMAPI Device Management + // DMAPI Callbacks + public interface IConnAPIDeviceCallback extends StdCallCallback { + int invoke(int dwStatus, ShortByReference pstrSerialNumber); + } + + // DMAPI APIs + int DMAPI_Initialize(int dwAPIVersion, IntByReference pdwParam); + int DMAPI_Terminate(IntByReference pdwParam); + int DMAPI_GetAPIVersion(); + int CONAOpenDM(LPDMHANDLE mHDMHandle); + int CONACloseDM(DMHANDLE mHDMHandle); + int CONAGetDeviceCount(DMHANDLE hDMHandle, IntByReference pdwCount); + int CONAGetDevices(DMHANDLE hDMHandle, IntByReference pdwCount, CONAPI_DEVICE[] pDevices ); + int CONAFreeDeviceStructure( int dwCount, CONAPI_DEVICE[] pDevices ); + int CONARegisterNotifyCallback(DMHANDLE hDMHandle, int dwState, IConnAPIDeviceCallback pfnNotify); + + // CFAPI Common APIs + int CFAPI_Initialize(int dwAPIVersion, IntByReference pdwParam); + int CFAPI_Terminate(IntByReference pdwParam); + + // MCAPI Media Control + // MCAPI Callbacks + public interface IConnAPIMediaCallback extends StdCallCallback { + int invoke(int dwStatus, CONAPI_MEDIA[] pMedia); + } + // MCAPI APIs + int MCAPI_Initialize(int dwAPIVersion, IntBuffer pdwParam); + int MCAPI_Terminate(IntBuffer pdwParam); + int MCAPI_GetAPIVersion(); + int CONAOpenMM(LPMCHANDLE phMCHandle, int dwValue); + int CONACloseMM(MCHANDLE hMCHandle); + int CONAMMGetMedia(MCHANDLE hMCHandle, IntBuffer pdwCountOfMedia, CONAPI_MEDIA.ByReference ppMedia[]); //TODO: c++ - CONAPI_MEDIA** ppMedia + int CONAMMSetMedia(MCHANDLE hMCHandle, CONAPI_MEDIA[] pMedia); + int CONAMMFreeMediaStructures(int dwCountOfMedia, CONAPI_MEDIA[] pMedia); + int MCAPI_GetMediaInfo(MCHANDLE hMCHandle, ShortBuffer pstrMediaID, CONAPI_MEDIA_INFO[] pMediaInfo); + int MCAPI_FreeMediaInfo(CONAPI_MEDIA_INFO[] pMediaInfo); + int CONARegisterMMNotifyCallback(MCHANDLE hMCHandle, int dwState, IConnAPIMediaCallback pfnNotify); + + + // UPAPI USB Personality + // UPAPI APIs + int UPAPI_Initialize(int dwAPIVersion, IntBuffer pdwParam); + int UPAPI_Terminate(IntBuffer pdwParam); + int UPAPI_GetAPIVersion(); + int UPAPI_OpenUSBPersonality(int dwVendorId, LPUPHANDLE phUPHandle); + int UPAPI_CloseUSBPersonality(UPHANDLE hUPHandle); + int UPAPI_QueryDeviceCount(UPHANDLE hUPHandle, IntBuffer pdwDeviceCount); + int UPAPI_QueryDevices(com.sun.jna.Pointer hUPHandle, IntBuffer pdwDeviceCount, UP_DEVICE_DESCRIPTOR[] pDeviceDescriptor); + int UPAPI_FreeDeviceDescriptor(int dwDeviceCount, UP_DEVICE_DESCRIPTOR[] pDeviceDescriptor); + int UPAPI_GetConfigurationDescriptor(UPHANDLE hUPHandle, ShortBuffer pstrDeviceId, UP_CONFIGURATION_DESCRIPTOR[] pConfigurationDescriptor); + int UPAPI_GetStringDescriptor(UPHANDLE hUPHandle, ShortBuffer pstrDeviceId, int dwDescriptorIndex, int dwLanguageID, UP_STRING_DESCRIPTOR[] pStringDescriptor); + int UPAPI_FreeStringDescriptor(UP_STRING_DESCRIPTOR[] pStringDescriptor); + int UPAPI_GetPersonalityDescriptors(UPHANDLE hUPHandle, ShortBuffer pstrDeviceId, UP_PERSONALITY_DESCRIPTORS[] pPersonalityDescriptors); + int UPAPI_FreePersonalityDescriptors(UP_PERSONALITY_DESCRIPTORS[] pPersonalityDescriptors); + int UPAPI_SetPersonality(UPHANDLE hUPHandle, ShortBuffer pstrDeviceId, int dwPersonalityCode); + int UPAPI_SendCommandToDevice(UPHANDLE hUPHandle, ShortBuffer pstrDeviceId, int dwDataDirection, UP_DATA_BUFFER[] pDataBuffer); + + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/LPDMHANDLE.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/LPDMHANDLE.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,43 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Pointer; +import com.sun.jna.ptr.ByReference; + +public class LPDMHANDLE extends ByReference { + public LPDMHANDLE() { + this(null); + } + public LPDMHANDLE(DMHANDLE h) { + super(Pointer.SIZE); + setValue(h); + } + public void setValue(DMHANDLE h) { + getPointer().setPointer(0, h != null ? h.getPointer() : null); + } + public DMHANDLE getValue() { + Pointer p = getPointer().getPointer(0); + if (p == null) + return null; + if (DMHANDLE.INVALID_HANDLE_VALUE.getPointer().equals(p)) + return DMHANDLE.INVALID_HANDLE_VALUE; + DMHANDLE h = new DMHANDLE(); + h.setPointer(p); + return h; + } +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/LPMCHANDLE.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/LPMCHANDLE.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,36 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +public class LPMCHANDLE extends LPDMHANDLE { + + /** + * + */ + public LPMCHANDLE() { + // TODO Auto-generated constructor stub + } + + /** + * @param h + */ + public LPMCHANDLE(DMHANDLE h) { + super(h); + // TODO Auto-generated constructor stub + } + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/LPUPHANDLE.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/LPUPHANDLE.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,21 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +public class LPUPHANDLE extends LPDMHANDLE { + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/MCAPIDefinitions.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/MCAPIDefinitions.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,99 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Structure; + +public class MCAPIDefinitions { + //========================================================= + // Media Control API versions + // + public static final int MCAPI_VERSION_30 =30; + public static final int MCAPI_VERSION_31 =31; + public static final int MCAPI_VERSION_32 =32; + //========================================================= + // ---------------------------------------------------- + // Media types used in CONAPI_MEDIA + // + public static final int CONAPI_MEDIA_ALL = 0x01; + public static final int CONAPI_MEDIA_IRDA = 0x02; + public static final int CONAPI_MEDIA_SERIAL = 0x04; + public static final int CONAPI_MEDIA_BLUETOOTH = 0x08; + public static final int CONAPI_MEDIA_USB = 0x10; + // ---------------------------------------------------- + + // ---------------------------------------------------- + // Media sub types used in CONAPI_MEDIA_INFO + // + // Infrared media + public static final int API_MEDIA_TYPE_INFRARED = 0x00000002; + // Serial media + public static final int API_MEDIA_TYPE_SERIAL = 0x00000004; + // Bluetooth media + public static final int API_MEDIA_TYPE_BLUETOOTH = 0x00000008; + public static final int API_MEDIA_TYPE_BT_MS = 0x00010008; + public static final int API_MEDIA_TYPE_BT_BC = 0x00020008; + public static final int API_MEDIA_TYPE_BT_TO = 0x00030008; + public static final int API_MEDIA_TYPE_BT_IVT = 0x00040008; + // USB media + public static final int API_MEDIA_TYPE_USB = 0x00000010; + // ---------------------------------------------------- + + // ---------------------------------------------------- + // Media specific parameters + // + public static final int CONAPI_MEDIA_ACTIVE =0x00000001; // Media is active. + public static final int CONAPI_MEDIA_NOT_ACTIVE =0x00000002; // Media is not active. + public static final int CONAPI_MEDIA_FUNCTIONAL =0x00000004; // Media is active and functional. + public static final int CONAPI_MEDIA_NOT_FUNCTIONAL =0x00000008; // Media is active but not functional. + public static final int CONAPI_MEDIA_IC_SUPPORTED =0x00000010; // Media is supporting incoming connections. + public static final int CONAPI_MEDIA_IC_NOT_SUPPORTED =0x00000020; // Media is not supporting incoming connections. + // ---------------------------------------------------- + + // ---------------------------------------------------- + // Macros. Use these to check values in the CONAPI_MEDIA structure. + // +// #define CONAPI_GET_MEDIA_TYPE(dwMedia) (0x000000FF & dwMedia) + public static int CONAPI_GET_MEDIA_TYPE(int dwMedia) { + return (0x000000FF & dwMedia); + } +// #define CONAPI_IS_MEDIA_ACTIVE(dwState) (0x00000001 & dwState) + public static boolean CONAPI_IS_MEDIA_ACTIVE(int dwState) { + return (0x00000001 & dwState) > 0; + } +// #define CONAPI_IS_MEDIA_UNACTIVE(dwState) ((0x00000002 & dwState)>>1) + public static boolean CONAPI_IS_MEDIA_UNACTIVE(int dwState) { + return ((0x00000002 & dwState)>>1) > 0; + } +// #define CONAPI_IS_MEDIA_FUNCTIONAL(dwState) ((0x00000004 & dwState)>>2) + public static boolean CONAPI_IS_MEDIA_FUNCTIONAL(int dwState) { + return ((0x00000004 & dwState)>>2) > 0; + } +// #define CONAPI_IS_MEDIA_NOT_FUNCTIONAL(dwState) ((0x00000008 & dwState)>>3) + public static boolean CONAPI_IS_MEDIA_NOT_FUNCTIONAL(int dwState) { + return ((0x00000008 & dwState)>>3) > 0; + } +// #define CONAPI_IS_IC_SUPPORTED(dwOptions) ((0x00000010 & dwOptions)>>4) + public static boolean CONAPI_IS_IC_SUPPORTED(int dwOptions) { + return ((0x00000010 & dwOptions)>>4) > 0; + } +// #define CONAPI_IS_IC_UNSUPPORTED(dwOptions) ((0x00000020 & dwOptions)>>5) + public static boolean CONAPI_IS_IC_UNSUPPORTED(int dwOptions) { + return ((0x00000020 & dwOptions)>>5) > 0; + } + // ---------------------------------------------------- +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/MCHANDLE.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/MCHANDLE.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,38 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Pointer; + +public class MCHANDLE extends DMHANDLE { + + /** + * + */ + public MCHANDLE() { + // TODO Auto-generated constructor stub + } + + /** + * @param p + */ + public MCHANDLE(Pointer p) { + super(p); + // TODO Auto-generated constructor stub + } + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/PCCSConnection.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/PCCSConnection.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,444 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; + +import org.eclipse.cdt.utils.WindowsRegistry; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.swt.widgets.Display; + +import com.nokia.carbide.remoteconnections.discovery.pccs.Activator; +import com.nokia.carbide.remoteconnections.discovery.pccs.Messages; +import com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.IConnAPILibrary.IConnAPIDeviceCallback; +import com.sun.jna.ptr.IntByReference; +import com.sun.jna.ptr.ShortByReference; + +public class PCCSConnection { + + private boolean DEBUG = false; + + /** + * @author chpeckha + * + */ + public class DeviceNotificationCallback implements IConnAPIDeviceCallback { + + /* (non-Javadoc) + * @see com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.IConnAPILibrary.IConnAPIDeviceCallback#invoke(int, com.sun.jna.ptr.ShortByReference) + */ + public int invoke(final int dwStatus, final ShortByReference pstrSerialNumber) { + Display.getDefault().asyncExec( + new Runnable () { + public void run() { + // check for NULL, since I am seeing bogus events coming from PCCS before the real one + // and the serial number is not filled in. If the serial number is null, + // everything else will be null (according to the PCCS docs) + // TODO: bug in PCCS API: + if (DEBUG) System.out.printf("DeviceNotificationCallback %x %s\n", dwStatus, (pstrSerialNumber == null ? "serNum: null" : pstrSerialNumber.getPointer().getString(0, true))); //$NON-NLS-1$ //$NON-NLS-2$ + String serialNumber = "unknown device"; //$NON-NLS-1$ + if (pstrSerialNumber != null) { + serialNumber = pstrSerialNumber.getPointer().getString(0, true); + } + if (DEBUG) System.out.printf("DeviceNotificationCallback %x %s\n", dwStatus, serialNumber); //$NON-NLS-1$ + + DeviceEventListener.DeviceEvent eventType = DeviceEventListener.DeviceEvent.DEVICE_LIST_UPDATED; + // decode dwStatus per PCCS docs + switch(DMAPIDefinitions.GET_CONAPI_CB_STATUS(dwStatus)) { + case DMAPIDefinitions.CONAPI_DEVICE_LIST_UPDATED: + eventType = DeviceEventListener.DeviceEvent.DEVICE_LIST_UPDATED; + break; + case DMAPIDefinitions.CONAPI_DEVICE_ADDED: + eventType = DeviceEventListener.DeviceEvent.DEVICE_ADDED; + break; + case DMAPIDefinitions.CONAPI_DEVICE_REMOVED: + eventType = DeviceEventListener.DeviceEvent.DEVICE_REMOVED; + break; + case DMAPIDefinitions.CONAPI_DEVICE_UPDATED: + switch(DMAPIDefinitions.GET_CONAPI_CB_INFO(dwStatus)) { + case DMAPIDefinitions.CONAPI_CONNECTION_ADDED: + eventType = DeviceEventListener.DeviceEvent.DEVICE_UPDATED_ADDEDCONNECTION; + break; + case DMAPIDefinitions.CONAPI_CONNECTION_REMOVED: + eventType = DeviceEventListener.DeviceEvent.DEVICE_UPDATED_REMOVEDCONNECTION; + break; + case DMAPIDefinitions.CONAPI_DEVICE_RENAMED: + eventType = DeviceEventListener.DeviceEvent.DEVICE_UPDATED_RENAMED; + break; + } + } + // fire events + Iterator iter = listeners.iterator(); + while (iter.hasNext()) { + iter.next().onDeviceEvent(eventType, serialNumber); + } + } + } + ); + return PCCSErrors.CONA_OK; + } + } + + private static final Collection listeners = new LinkedList(); + private IConnAPILibrary library; + private LPDMHANDLE dmHandle = new LPDMHANDLE(); + private DeviceNotificationCallback pfnCallback = new DeviceNotificationCallback(); + public static final int PCCS_NOT_FOUND = 1; + public static final int PCCS_WRONG_VERSION = 2; + + private LPMCHANDLE mcHandle = new LPMCHANDLE(); + + /** + * + */ + public PCCSConnection() { + } + + public void open() throws CoreException { + if (library == null) { + library = ConnAPILibrary.getInstance(); + } + loadDMAPI(); +// loadMCAPI(); TODO: not tested yet + } + + /** + * Initializes the Device Management API (DMAPI) for use. + * + * @throws CoreException + */ + private void loadDMAPI() throws CoreException { + + int dwResult = library.DMAPI_Initialize(DMAPIDefinitions.DMAPI_VERSION_34, null); + if (dwResult != PCCSErrors.CONA_OK) { + library.DMAPI_Terminate(null); + String msg; + if (Activator.isSymSEELayout()) { + msg = String.format("PCCS DMAPI_Initialize API returned error on initialization %x", dwResult); //$NON-NLS-1$ + if (dwResult == PCCSErrors.ECONA_UNSUPPORTED_API_VERSION) { + msg = Messages.PCCSConnection_PCCS_Version_Error + Activator.getLoadErrorURL(); + } + } else { + msg = Messages.PCCSConnection_PCSuite_Version_Error + Activator.getLoadErrorURL(); + } + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, PCCS_WRONG_VERSION, msg, null)); + } + + // initialize common API +// dwResult = library.CFAPI_Initialize(DMAPIDefinitions.CFAPI_VERSION_10, null); unnecessary +// if (dwResult != PCCSErrors.CONA_OK) { +// library.DMAPI_Terminate(null); +// String msg = String.format("PCCS CFAPI_Initialize API returned error on initialization %x", dwResult); +// throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, dwResult, msg, null)); +// } + + // open a DM handle + dmHandle.setValue(DMHANDLE.INVALID_HANDLE_VALUE); + dwResult = library.CONAOpenDM(dmHandle); + if (dwResult != PCCSErrors.CONA_OK) { + library.DMAPI_Terminate(null); + String msg = String.format(Messages.PCCSConnection_PCCS_CONAOpenDM_Error, dwResult); + if (dwResult == PCCSErrors.ECONA_NOT_ENOUGH_MEMORY) { + msg = Messages.PCCSConnection_PCCS_Not_Enough_Memory_Error; + } + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, dwResult, msg, null)); + } + + // register a call back + dwResult = library.CONARegisterNotifyCallback(dmHandle.getValue(), PCCSTypeDefinitions.API_REGISTER, pfnCallback); + if (dwResult != PCCSErrors.CONA_OK) { +// System.out.printf("CONAOpenDM returned: %x\n", dwResult); + library.DMAPI_Terminate(null); + library.CONACloseDM(dmHandle.getValue()); + dmHandle.setValue(DMHANDLE.INVALID_HANDLE_VALUE); + + String msg = String.format(Messages.PCCSConnection_PCCS_CONARegisterNotifyCallback_Error, dwResult); + if (dwResult == PCCSErrors.ECONA_INVALID_POINTER) { + msg = Messages.PCCSConnection_PCCS_CONARegisterNotifyCallback_Pointer_Error; + } + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, dwResult, msg, null)); + } + } + + private void loadMCAPI() throws CoreException { + int dwResult = PCCSErrors.CONA_OK; + dwResult = library.MCAPI_Initialize(MCAPIDefinitions.MCAPI_VERSION_32, null); + if (dwResult != PCCSErrors.CONA_OK) { + library.MCAPI_Terminate(null); + String msg; + if (Activator.isSymSEELayout()) { + msg = String.format("PCCS MCAPI_Initialize API returned error on initialization %x", dwResult); //$NON-NLS-1$ + if (dwResult == PCCSErrors.ECONA_UNSUPPORTED_API_VERSION) { + msg = Messages.PCCSConnection_PCCS_Version_Error + Activator.getLoadErrorURL(); + } + } else { + msg = Messages.PCCSConnection_PCSuite_Version_Error + Activator.getLoadErrorURL(); + } + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, PCCS_WRONG_VERSION, msg, null)); + } + dwResult = library.CONAOpenMM(mcHandle, 0); + + if (dwResult != PCCSErrors.CONA_OK) { + library.MCAPI_Terminate(null); + String msg = String.format("PCCS CONAOpenMM API returned error on initialization %x", dwResult); + if (dwResult == PCCSErrors.ECONA_NOT_ENOUGH_MEMORY) { + msg = Messages.PCCSConnection_PCCS_Not_Enough_Memory_Error; + } + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, dwResult, msg, null)); + } + } + + public void close() throws CoreException { + if (library == null) + return; + +// closeMCAPI(); TODO: not tested yet + closeDMAPI(); + } + + /** + * Closes the DMAPI. + * @throws CoreException + */ + private void closeDMAPI() throws CoreException { + int dwResult = PCCSErrors.CONA_OK; + if (dmHandle.getValue() != DMHANDLE.INVALID_HANDLE_VALUE) { + // unregister callback + dwResult = library.CONARegisterNotifyCallback(dmHandle.getValue(), PCCSTypeDefinitions.API_UNREGISTER, pfnCallback); + // close DM connection + dwResult = library.CONACloseDM(dmHandle.getValue()); + dmHandle.setValue(DMHANDLE.INVALID_HANDLE_VALUE); + // Terminate Common Functions API +// dwResult = library.CFAPI_Terminate(null); unnecessary + // Terminate Device management API + dwResult = library.DMAPI_Terminate(null); + } + } + + private void closeMCAPI() { + int dwResult = PCCSErrors.CONA_OK; + if (mcHandle.getValue() != MCHANDLE.INVALID_HANDLE_VALUE) { + // close DM connection + dwResult = library.CONACloseDM(mcHandle.getValue()); + mcHandle.setValue(MCHANDLE.INVALID_HANDLE_VALUE); + // Terminate Device management API + dwResult = library.MCAPI_Terminate(null); + } + } + /** + * @return null if no device found. + * @throws CoreException + */ + public DeviceInfo[] getDeviceList() throws CoreException { + + DeviceInfo[] deviceInfo = null; + + int dwResult = PCCSErrors.CONA_OK; + IntByReference pdwCount = new IntByReference(0); + dwResult = library.CONAGetDeviceCount(dmHandle.getValue(), pdwCount); + if (DEBUG) System.out.printf("CONAGetDeviceCount: %x number of devices: %d\n", dwResult, pdwCount.getValue()); //$NON-NLS-1$ + + int deviceCnt = pdwCount.getValue(); + if (dwResult != PCCSErrors.CONA_OK || deviceCnt == 0) + return deviceInfo; + + // array of structs in contiguous memory required ! + CONAPI_DEVICE[] pDevices = (CONAPI_DEVICE[])new CONAPI_DEVICE().toArray(deviceCnt); + dwResult = library.CONAGetDevices(dmHandle.getValue(), pdwCount, pDevices); + if (DEBUG) System.out.printf("CONAGetDevices: %x number of devices: %d\n", dwResult, deviceCnt); //$NON-NLS-1$ + + if (dwResult == PCCSErrors.CONA_OK) { + // extract to regular java types + if (deviceCnt > 0) { + deviceInfo = new DeviceInfo[deviceCnt]; + CONAPI_DEVICE[] devices = pDevices; + for (int i = 0; i < deviceCnt; i++) { + deviceInfo[i] = new DeviceInfo(); + if (devices[i].pstrSerialNumber != null) { + deviceInfo[i].serialNumber = devices[i].pstrSerialNumber.getPointer().getString(0, true); + } else { + // TODO: docs say if ser num == null --> device unsupported, but this is a bug in PCCS + deviceInfo[i].serialNumber = "not known"; //$NON-NLS-1$ + } + if (devices[i].pstrFriendlyName != null) { + deviceInfo[i].friendlyName = devices[i].pstrFriendlyName.getPointer().getString(0, true); + } else { + deviceInfo[i].friendlyName = "not known"; //$NON-NLS-1$ + } + if (devices[i].pstrModel != null) { + deviceInfo[i].model = devices[i].pstrModel.getPointer().getString(0, true); + } else { + deviceInfo[i].model = "not known"; //$NON-NLS-1$ + } + if (devices[i].pstrManufacturer != null) { + deviceInfo[i].mfr = devices[i].pstrManufacturer.getPointer().getString(0, true); + } else { + deviceInfo[i].mfr = "not known"; //$NON-NLS-1$ + } + int numItems = deviceInfo[i].numberOfConnections = devices[i].dwNumberOfItems; + + CONAPI_CONNECTION_INFO[] conn = null; + if (numItems > 0) + conn = (CONAPI_CONNECTION_INFO[])devices[i].pItems.toArray(numItems); + for (int j = 0; j < numItems; j++) { + DeviceConnectionInfo connInfo = new DeviceConnectionInfo(); + connInfo.deviceID = conn[j].dwDeviceID; + switch(conn[j].dwMedia){ + case PCCSTypeDefinitions.API_MEDIA_BLUETOOTH: + connInfo.media = "bluetooth"; //$NON-NLS-1$ + break; + case PCCSTypeDefinitions.API_MEDIA_IRDA: + connInfo.media = "irda"; //$NON-NLS-1$ + break; + case PCCSTypeDefinitions.API_MEDIA_SERIAL: + connInfo.media = "serial-ca42"; //$NON-NLS-1$ + break; + default: + case PCCSTypeDefinitions.API_MEDIA_USB: + connInfo.media = "usb"; //$NON-NLS-1$ + break; + } + if (conn[j].pstrDeviceName != null) { + connInfo.deviceName = conn[j].pstrDeviceName.getPointer().getString(0,true); + if (deviceInfo[i].friendlyName.equals("not known")) { //$NON-NLS-1$ + // use device name as friendly name (latter was null) + deviceInfo[i].friendlyName = connInfo.deviceName; + } + } else { + connInfo.deviceName = "not known"; //$NON-NLS-1$ + } + // Bomb if friendly name is not known or address is not known + // since these are essential to a connection + if (conn[j].pstrAddress == null || deviceInfo[i].friendlyName.equals("not known")) //$NON-NLS-1$ + continue; + + connInfo.address = conn[j].pstrAddress.getPointer().getString(0, true); + connInfo.state = conn[j].dwState; + + if (connInfo.media.equals("usb")) { //$NON-NLS-1$ + if (isGoodUSBState(connInfo.state)){ + connInfo.comPort = getUSBComPort(connInfo.address); + } else { + // don't store - not in good USB personality mode + continue; + } + } else if (connInfo.media.equals("bluetooth")) { //$NON-NLS-1$ + // TODO: implement BT + connInfo.comPort = getBTComPort(connInfo.address); + } else { + // IRDA and Serial(CA42) probably will not come here anyway + connInfo.comPort = null; + } + if (connInfo.comPort != null) + deviceInfo[i].connections.add(connInfo); + } + } + } + dwResult = library.CONAFreeDeviceStructure(deviceCnt, pDevices); + if (DEBUG) System.out.printf("CONAFreeDeviceStructure: %x\n", dwResult); //$NON-NLS-1$ + } + return deviceInfo; + } + + private boolean isGoodUSBState(int state) { + // This test is necessary since we're seeing + // on some devices PCSuite mode not set BUT PCSuite trusted flag is set + // OR PCSuite mode on device is selected BUT only Paired flag is set + // good if: + // in PCSuite mode + // OR is Paired + // OR is PCSuite trusted + // TODO: use UPAPI here instead + if (DMAPIDefinitions.CONAPI_IS_IN_PCSUITE_MODE(state)) + return true; + else if (DMAPIDefinitions.CONAPI_IS_DEVICE_PAIRED(state)) + return true; + else if (DMAPIDefinitions.CONAPI_IS_PCSUITE_TRUSTED(state)) + return true; + return false; + } + + private String getBTComPort(String address) { + // TODO Auto-generated method stub + return null; + } + + public String getUSBComPort(String address) { + if (address != null && address.length() > 0) { + String id, key, subKey, parentIdPrefix = null, portName; + + WindowsRegistry wr = WindowsRegistry.getRegistry(); + key = "SYSTEM\\ControlSet001\\Enum\\USB" + address.substring(address.indexOf('\\'), address.lastIndexOf('\\')); //$NON-NLS-1$ + id = address.substring(address.lastIndexOf('\\') + 1); + int i = 0; + do { + subKey = wr.getLocalMachineKeyName(key, i); + if (subKey != null && subKey.equalsIgnoreCase(id)) { + key += "\\" + subKey; //$NON-NLS-1$ + parentIdPrefix = wr.getLocalMachineValue(key, "ParentIdPrefix"); //$NON-NLS-1$ + break; + } + i++; + } while (subKey != null); + if (parentIdPrefix != null) { + key = "SYSTEM\\ControlSet001\\Enum\\NMWCD"; //$NON-NLS-1$ + subKey = address.substring(address.indexOf('\\'), address.lastIndexOf('\\')); + key += subKey + "&IF_JAVACOMM"; //$NON-NLS-1$ + i = 0; + do { + subKey = wr.getLocalMachineKeyName(key, i); + if (subKey != null && subKey.contains(parentIdPrefix)) { + key += "\\" + subKey + "\\Device Parameters"; //$NON-NLS-1$ //$NON-NLS-2$ + portName = wr.getLocalMachineValue(key, "PortName"); //$NON-NLS-1$ + if (portName != null) { + portName = portName.substring(portName.indexOf('M') + 1); + return portName; + } + break; + } + i++; + } while (subKey != null); + } + } + return null; + } + + public void addEventListenter(DeviceEventListener listener) { + listeners.add(listener); + } + + public void removeEventListener(DeviceEventListener listener) { + listeners.remove(listener); + } + + public interface DeviceEventListener { + public enum DeviceEvent { + DEVICE_LIST_UPDATED, // not any specific information + DEVICE_ADDED, + DEVICE_REMOVED, + DEVICE_UPDATED_ADDEDCONNECTION, + DEVICE_UPDATED_REMOVEDCONNECTION, + DEVICE_UPDATED_RENAMED, + DEVICE_UPDATED_UNKNOWN, + } + public void onDeviceEvent(DeviceEvent eventType, String serialNumber); + } +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/PCCSErrors.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/PCCSErrors.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,146 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +public class PCCSErrors { +/////////////////////////////////////////////////////////// + // Connectivity API errors + /////////////////////////////////////////////////////////// + + public static int CONA_OK =0x00000000; // Everything ok + public static int CONA_OK_UPDATED_MEMORY_VALUES =0x00000001; // Everything ok, given data is updated because (free, used and total) memory values are changed! + public static int CONA_OK_UPDATED_MEMORY_AND_FILES =0x00000002; // Everything ok, given data is updated because files and memory values are changed! + public static int CONA_OK_UPDATED =0x00000004; // Everything ok, given data is updated, unknown reason. + + public static int CONA_OK_BUT_USER_ACTION_NEEDED =0x00000100; // Everything ok, but operation needs + // some user action (device side) + public static int CONA_WAIT_CONNECTION_IS_BUSY =0x00000101; // Operation started ok but other application + // is reserved connection, please wait. This + // result code comes via FS nofication when ConnAPI + // is initialized by value 20 or bigger. + // Common error codes: + public static int ECONA_INIT_FAILED =0x80100000; // DLL initialization failed + public static int ECONA_INIT_FAILED_COM_INTERFACE =0x80100002; // Failed to get connection to System. + public static int ECONA_NOT_INITIALIZED =0x80100004; // API is not initialized + public static int ECONA_UNSUPPORTED_API_VERSION =0x80100005; // Failed, not supported API version + public static int ECONA_NOT_SUPPORTED_MANUFACTURER =0x80100006; // Failed, not supported manufacturer + + public static int ECONA_UNKNOWN_ERROR =0x80100010; // Failed, unknown error + public static int ECONA_UNKNOWN_ERROR_DEVICE =0x80100011; // Failed, unknown error from Device + public static int ECONA_INVALID_POINTER =0x80100012; // Required pointer is invalid + public static int ECONA_INVALID_PARAMETER =0x80100013; // Invalid Parameter value + public static int ECONA_INVALID_HANDLE =0x80100014; // Invalid HANDLE + public static int ECONA_NOT_ENOUGH_MEMORY =0x80100015; // Memory allocation failed in PC + public static int ECONA_WRONG_THREAD =0x80100016; // Failed, Called interface was marshalled for a different thread. + public static int ECONA_REGISTER_ALREADY_DONE =0x80100017; // Failed, notification interface is already registered. + + public static int ECONA_CANCELLED =0x80100020; // Operation cancelled by ConnectivityAPI-User + public static int ECONA_NOTHING_TO_CANCEL =0x80100021; // No running functions, or cancel has called too late. + public static int ECONA_FAILED_TIMEOUT =0x80100022; // Operation failed because of timeout + public static int ECONA_NOT_SUPPORTED_DEVICE =0x80100023; // Device do not support operation + public static int ECONA_NOT_SUPPORTED_PC =0x80100024; // ConnectivityAPI do not support operation (not implemented) + public static int ECONA_NOT_FOUND =0x80100025; // Item was not found + public static int ECONA_FAILED =0x80100026; // Failed, the called operation failed. + + public static int ECONA_API_NOT_FOUND =0x80100100; // Needed API module was not found from the system + public static int ECONA_API_FUNCTION_NOT_FOUND =0x80100101; // Called API function was not found from the loaded API module + + // Device manager and device connection releated error: + public static int ECONA_DEVICE_NOT_FOUND =0x80200000; // Given phone is not connected (refresh device list) + public static int ECONA_NO_CONNECTION_VIA_MEDIA =0x80200001; // Phone is connected but not via given Media + public static int ECONA_NO_CONNECTION_VIA_DEVID =0x80200002; // Phone is not connected with given DevID + public static int ECONA_INVALID_CONNECTION_TYPE =0x80200003; // Connection type was invalid + public static int ECONA_NOT_SUPPORTED_CONNECTION_TYPE =0x80200004; // Device do not support connection type + public static int ECONA_CONNECTION_BUSY =0x80200005; // Other application is recerved connection + public static int ECONA_CONNECTION_LOST =0x80200006; // Connection is lost to Device + public static int ECONA_CONNECTION_REMOVED =0x80200007; // Connection removed, other application is reserved connection. + public static int ECONA_CONNECTION_FAILED =0x80200008; // Connection failed, unknown reason + public static int ECONA_SUSPEND =0x80200009; // Connection removed, PC goes suspend state + public static int ECONA_NAME_ALREADY_EXISTS =0x8020000A; // Friendly name already exist + public static int ECONA_MEDIA_IS_NOT_WORKING =0x8020000B; // Failed, target media is active but it is not working (e.g. BT-hardware stopped or removed) + public static int ECONA_CACHE_IS_NOT_AVAILABLE =0x8020000C; // Failed, cache is not available (CONASearchDevices) + public static int ECONA_MEDIA_IS_NOT_ACTIVE =0x8020000D; // Failed, target media is not active (or ready yet) + public static int ECONA_PORT_OPEN_FAILED =0x8020000E; // Port opening failed (only when media is CONAPI_MEDIA_SERIAL and COM port is changed). + + // Device paring releated errors: + public static int ECONA_DEVICE_PAIRING_FAILED =0x80200100; // Failed, pairing failed + public static int ECONA_DEVICE_PASSWORD_WRONG =0x80200101; // Failed, wrong password on device. + public static int ECONA_DEVICE_PASSWORD_INVALID =0x80200102; // Failed, password includes invalid characters or missing. + + + // File System errors: + public static int ECONA_ALL_LISTED =0x80300000; // All items are listed + public static int ECONA_MEMORY_FULL =0x80300001; // Device memory full + + // File System error for file functions: + public static int ECONA_FILE_NAME_INVALID =0x80400001; // File name includes invalid characters in Device or PC + public static int ECONA_FILE_NAME_TOO_LONG =0x80400002; // Max unicode charaters in File name (includes current/target path) + // is limited to 256 charaters in device. (256 charaters includes + // two backlashs in begin of the path and one end of the path.) + public static int ECONA_FILE_ALREADY_EXIST =0x80400003; // File already exits in Device or PC + public static int ECONA_FILE_NOT_FOUND =0x80400004; // File does not exits in Device or PC + public static int ECONA_FILE_NO_PERMISSION =0x80400005; // Not allow to perform required operation to file in Device + public static int ECONA_FILE_COPYRIGHT_PROTECTED =0x80400006; // Not allow to perform required operation to file in Device + public static int ECONA_FILE_BUSY =0x80400007; // Other application is recerved file in Device or PC + public static int ECONA_FILE_TOO_BIG_DEVICE =0x80400008; // Device reject the operation because file size is too big + public static int ECONA_FILE_TYPE_NOT_SUPPORTED =0x80400009; // Device reject the operation because file unsupported type + public static int ECONA_FILE_NO_PERMISSION_ON_PC =0x8040000A; // Not allow to perform required operation to file in PC + public static int ECONA_FILE_EXIST =0x8040000B; // File move or rename: File is copied to target path with new name but removing the source file failed. + public static int ECONA_FILE_CONTENT_NOT_FOUND =0x8040000C; // Specified file content does not found (e.g. unknown file section or stored position). + public static int ECONA_FILE_OLD_FORMAT =0x8040000D; // Specified file content supports old engine. + public static int ECONA_FILE_INVALID_DATA =0x8040000E; // Specified file data is invalid. + + // File System error for folder functions: + public static int ECONA_INVALID_DATA_DEVICE =0x80500000; // Device's folder contain invalid data + public static int ECONA_CURRENT_FOLDER_NOT_FOUND =0x80500001; // Current/Target folder is invalid in device (e.g MMC card removed). + public static int ECONA_FOLDER_PATH_TOO_LONG =0x80500002; // Current/Target folder max unicode charaters count is limited to + // 245 charaters in device. (245 charaters includes two backlashs in + // begin of the path and one end of the path) + public static int ECONA_FOLDER_NAME_INVALID =0x80500003; // Folder name includes invalid characters in Device or PC + public static int ECONA_FOLDER_ALREADY_EXIST =0x80500004; // Folder is already exits in target folder + public static int ECONA_FOLDER_NOT_FOUND =0x80500005; // Folder not found (PC/Device) + public static int ECONA_FOLDER_NO_PERMISSION =0x80500006; // Not allow to perform required operation to folder in Devic + public static int ECONA_FOLDER_NOT_EMPTY =0x80500007; // Not allow to perform required operation because folder is not empty + public static int ECONA_FOLDER_NO_PERMISSION_ON_PC =0x80500008; // Not allow to perform required operation to folder in PC + + // Application Installation: + public static int ECONA_DEVICE_INSTALLER_BUSY =0x80600000; // Can not start Device's installer + + //Syncronization specific error codes : + public static int ECONA_UI_NOT_IDLE_DEVICE =0x80700000; // Failed, device rejects the operation. Maybe device's UI was not IDLE-state. + public static int ECONA_SYNC_CLIENT_BUSY_DEVICE =0x80700001; // Failed, device's SA sync client is busy. + public static int ECONA_UNAUTHORIZED_DEVICE =0x80700002; // Failed, device rejects the operation. No permission. + public static int ECONA_DATABASE_LOCKED_DEVICE =0x80700003; // Failed, device rejects the operation. Device is locked. + public static int ECONA_SETTINGS_NOT_OK_DEVICE =0x80700004; // Failed, device rejects the operation. Maybe settings in Sync profile are wrong on Device. + public static int ECONA_SYNC_ITEM_TOO_BIG =0x80700501; // + public static int ECONA_SYNC_ITEM_REJECT =0x80700502; // All commands,Device reject the operation... + public static int ECONA_SYNC_INSTALL_PLUGIN_FIRST =0x80700506; // + + // Versit conversion specific error codes : + public static int ECONA_VERSIT_INVALID_PARAM =0x80800001; // Invalid parameters passed to versit converter + public static int ECONA_VERSIT_UNKNOWN_TYPE =0x80800002; // Failed, trying to convert versit formats not supported in VersitConverter + public static int ECONA_VERSIT_INVALID_VERSIT_OBJECT =0x80800003; // Failed, validation of versit data not passed, contains invalid data + + // Database specific error codes : + public static int ECONA_DB_TRANSACTION_ALREADY_STARTED =0x80800100; // Another transaction is already in progress. + public static int ECONA_DB_TRANSACTION_FAILED =0x80800101; // Some of operations within a transaction failed and transaction was rolled back. + + //Backup specific error codes + public static int ECONA_DEVICE_BATTERY_LEVEL_TOO_LOW =0x80900000; // Failed, device rejects the restore operation. Device's battery level is low. + public static int ECONA_DEVICE_BUSY =0x80900001; // Failed, device rejects the backup/resore operation. Device's backup server busy. + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/PCCSTypeDefinitions.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/PCCSTypeDefinitions.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,43 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +public class PCCSTypeDefinitions { + // Type definition for API_VARIANT + public static final int API_VARIANT_TYPE_BYTE = 0x00000001; + public static final int API_VARIANT_TYPE_WORD = 0x00000002; + public static final int API_VARIANT_TYPE_DWORD = 0x00000004; + public static final int API_VARIANT_TYPE_INT64 = 0x00000008; + public static final int API_VARIANT_TYPE_DOUBLE = 0x00000010; + public static final int API_VARIANT_TYPE_LPBYTE = 0x00000100; + public static final int API_VARIANT_TYPE_LPWORD = 0x00000200; + public static final int API_VARIANT_TYPE_LPDWORD = 0x00000400; + public static final int API_VARIANT_TYPE_LPVOID = 0x00000800; + public static final int API_VARIANT_TYPE_LPAPIWCHAR = 0x00010000; + public static final int API_VARIANT_TYPE_DATETIME = 0x01000000; + + // Values used in API notification registration methods + public static final int API_REGISTER = 0x10; + public static final int API_UNREGISTER = 0x20; + + // Media types used in APIs + public static final int API_MEDIA_ALL = 0x01; + public static final int API_MEDIA_IRDA = 0x02; + public static final int API_MEDIA_SERIAL = 0x04; + public static final int API_MEDIA_BLUETOOTH = 0x08; + public static final int API_MEDIA_USB = 0x10; +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UPAPIDefinitions.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UPAPIDefinitions.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,45 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +public class UPAPIDefinitions { + // ---------------------------------------------------- + // Data direction used in UPAPI_SendCommandToDevice() + // function. + // + public static final int UPAPI_DATA_DIRECTION_HOST_TO_DEVICE =0x01; + public static final int UPAPI_DATA_DIRECTION_DEVICE_TO_HOST =0x02; + // ---------------------------------------------------- + // Personality codes + // + public static final int UPAPI_PERSONALITY_CODE_PC_SUITE =0x01; + public static final int UPAPI_PERSONALITY_CODE_REMOVABLE_DISC =0x02; + public static final int UPAPI_PERSONALITY_CODE_PICTURE_TRANSFER =0x03; + public static final int UPAPI_PERSONALITY_CODE_MEDIA_TRANSFER =0x04; + public static final int UPAPI_PERSONALITY_CODE_COMBINED =0x05; + public static final int UPAPI_PERSONALITY_CODE_PC_TO_WEB =0x06; + + // not from documentation - from email only + public static final int UPAPI_PERSONALITY_CODE_RNDIS =0x08; + + //========================================================= + // USB Personality API version + // + public static final int UPAPI_VERSION_10 =10; + //========================================================= + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UPHANDLE.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UPHANDLE.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,21 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +public class UPHANDLE extends DMHANDLE { + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_CONFIGURATION_DESCRIPTOR.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_CONFIGURATION_DESCRIPTOR.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,76 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Structure; + +/** + * This file was autogenerated by JNAerator,
+ * but modified for use by Carbide. + */ +public class UP_CONFIGURATION_DESCRIPTOR extends Structure { + /// Size of the structure + public int dwSize; + /// CONFIGURATION Descriptor Type + public byte bDescriptorType; + /// Total length of data returned for this configuration + public int dwTotalLength; + /// Number of interfaces supported by this configuration + public byte bNumOfInterfaces; + /// Value to use as an argument to the SetConfiguration() request to select this configuration + public byte bConfigurationValue; + /// Index of string descriptor describing this configuration + public byte bConfiguration; + /// Configuration characteristics + public byte bAttributes; + /// Maximum power consumption of the USB device from the bus + public byte bMaxPower; + public UP_CONFIGURATION_DESCRIPTOR() { + super(); + } + /** + * @param dwSize Size of the structure
+ * @param bDescriptorType CONFIGURATION Descriptor Type
+ * @param dwTotalLength Total length of data returned for this configuration
+ * @param bNumOfInterfaces Number of interfaces supported by this configuration
+ * @param bConfigurationValue Value to use as an argument to the SetConfiguration() request to select this configuration
+ * @param bConfiguration Index of string descriptor describing this configuration
+ * @param bAttributes Configuration characteristics
+ * @param bMaxPower Maximum power consumption of the USB device from the bus + */ + public UP_CONFIGURATION_DESCRIPTOR(int dwSize, byte bDescriptorType, int dwTotalLength, byte bNumOfInterfaces, byte bConfigurationValue, byte bConfiguration, byte bAttributes, byte bMaxPower) { + super(); + this.dwSize = dwSize; + this.bDescriptorType = bDescriptorType; + this.dwTotalLength = dwTotalLength; + this.bNumOfInterfaces = bNumOfInterfaces; + this.bConfigurationValue = bConfigurationValue; + this.bConfiguration = bConfiguration; + this.bAttributes = bAttributes; + this.bMaxPower = bMaxPower; + } + protected ByReference newByReference() { return new ByReference(); } + protected ByValue newByValue() { return new ByValue(); } + protected UP_CONFIGURATION_DESCRIPTOR newInstance() { return new UP_CONFIGURATION_DESCRIPTOR(); } + public static UP_CONFIGURATION_DESCRIPTOR[] newArray(int arrayLength) { + return null; +// return com.ochafik.lang.jnaerator.runtime.Structure.newArray(UP_CONFIGURATION_DESCRIPTOR.class, arrayLength); + } + public static class ByReference extends UP_CONFIGURATION_DESCRIPTOR implements com.sun.jna.Structure.ByReference {} + public static class ByValue extends UP_CONFIGURATION_DESCRIPTOR implements com.sun.jna.Structure.ByValue {} + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_DATA_BUFFER.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_DATA_BUFFER.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,73 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Pointer; +import com.sun.jna.Structure; + +/** + * This file was originally autogenerated by JNAerator,
+ * but modified to work with Carbide. + */ +public class UP_DATA_BUFFER extends Structure { + /// Size of the structure + public int dwSize; + /// Request type + public byte bRequest; + /// Data value + public short wValue; + /// Parameter for the request + public short wIndex; + /// Length of the pbData in bytes + public short wDataLength; + /** + * Pointer to BYTE data buffer
+ * C type : BYTE* + */ + public Pointer pbData; + public UP_DATA_BUFFER() { + super(); + } + /** + * @param dwSize Size of the structure
+ * @param bRequest Request type
+ * @param wValue Data value
+ * @param wIndex Parameter for the request
+ * @param wDataLength Length of the pbData in bytes
+ * @param pbData Pointer to BYTE data buffer
+ * C type : BYTE* + */ + public UP_DATA_BUFFER(int dwSize, byte bRequest, short wValue, short wIndex, short wDataLength, Pointer pbData) { + super(); + this.dwSize = dwSize; + this.bRequest = bRequest; + this.wValue = wValue; + this.wIndex = wIndex; + this.wDataLength = wDataLength; + this.pbData = pbData; + } + protected ByReference newByReference() { return new ByReference(); } + protected ByValue newByValue() { return new ByValue(); } + protected UP_DATA_BUFFER newInstance() { return new UP_DATA_BUFFER(); } + public static UP_DATA_BUFFER[] newArray(int arrayLength) { + return null; +// return com.ochafik.lang.jnaerator.runtime.Structure.newArray(UP_DATA_BUFFER.class, arrayLength); + } + public static class ByReference extends UP_DATA_BUFFER implements com.sun.jna.Structure.ByReference {} + public static class ByValue extends UP_DATA_BUFFER implements com.sun.jna.Structure.ByValue {} + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_DEVICE_DESCRIPTOR.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_DEVICE_DESCRIPTOR.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,78 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Structure; +import com.sun.jna.ptr.ShortByReference; + +/** + * This file was originally autogenerated by JNAerator,
+ * but modified to work with Carbide. + */ +public class UP_DEVICE_DESCRIPTOR extends Structure { + /// Size of the structure + public int dwSize; + /// DEVICE Descriptor Type + public byte bDescriptorType; + /** + * Device ID name
+ * C type : WCHAR* + */ + public ShortByReference pstrDeviceID; + /** + * Serial number of the device. Not set to all devices. Can be NULL.
+ * C type : WCHAR* + */ + public ShortByReference pstrSerialNumber; + /// USB Specification Release Number in Binary-Coded Decimal + public int dwUSB; + /// Class code (assigned by the USB-IF) + public byte bDeviceClass; + /// Subclass code (assigned by the USB-IF) + public byte bDeviceSubClass; + /// Protocol code (assigned by the USB-IF) + public byte bDeviceProtocol; + /// Maximum packet size for endpoint zero (only 8, 16, 32, or 64 are valid) + public byte bMaxPacketSize; + /// Vendor ID (assigned by the USB-IF) + public int dwVendor; + /// Product ID (assigned by the manufacturer) + public int dwProduct; + /// Device release number in binary-coded decimal + public int dwDevice; + /// Index of string descriptor describing manufacturer + public byte bManufacturer; + /// Index of string descriptor describing product + public byte bProduct; + /// Index of string descriptor describing the device\u2019s serial number + public byte bSerialNumber; + /// Number of possible configurations + public byte bNumOfConfigurations; + public UP_DEVICE_DESCRIPTOR() { + super(); + } + protected ByReference newByReference() { return new ByReference(); } + protected ByValue newByValue() { return new ByValue(); } + protected UP_DEVICE_DESCRIPTOR newInstance() { return new UP_DEVICE_DESCRIPTOR(); } + public static UP_DEVICE_DESCRIPTOR[] newArray(int arrayLength) { + return null; +// return com.ochafik.lang.jnaerator.runtime.Structure.newArray(UP_DEVICE_DESCRIPTOR.class, arrayLength); + } + public static class ByReference extends UP_DEVICE_DESCRIPTOR implements com.sun.jna.Structure.ByReference {} + public static class ByValue extends UP_DEVICE_DESCRIPTOR implements com.sun.jna.Structure.ByValue {} + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_PERSONALITY.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_PERSONALITY.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,56 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Structure; + +/** + * This file was originally autogenerated by JNAerator,
+ * but modified to work with Carbide. + */ +public class UP_PERSONALITY extends Structure { + /// Size of the structure + public int dwSize; + /// Personality code + public byte bPersonalityCode; + /// Index of String Descriptor describing Personality Code + public byte bPersonalityIndex; + public UP_PERSONALITY() { + super(); + } + /** + * @param dwSize Size of the structure
+ * @param bPersonalityCode Personality code
+ * @param bPersonalityIndex Index of String Descriptor describing Personality Code + */ + public UP_PERSONALITY(int dwSize, byte bPersonalityCode, byte bPersonalityIndex) { + super(); + this.dwSize = dwSize; + this.bPersonalityCode = bPersonalityCode; + this.bPersonalityIndex = bPersonalityIndex; + } + protected ByReference newByReference() { return new ByReference(); } + protected ByValue newByValue() { return new ByValue(); } + protected UP_PERSONALITY newInstance() { return new UP_PERSONALITY(); } + public static UP_PERSONALITY[] newArray(int arrayLength) { + return null; +// return com.ochafik.lang.jnaerator.runtime.Structure.newArray(UP_PERSONALITY.class, arrayLength); + } + public static class ByReference extends UP_PERSONALITY implements com.sun.jna.Structure.ByReference {} + public static class ByValue extends UP_PERSONALITY implements com.sun.jna.Structure.ByValue {} + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_PERSONALITY_DESCRIPTORS.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_PERSONALITY_DESCRIPTORS.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,68 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Structure; + +/** + * This file was originally autogenerated by JNAerator,
+ * but modified to work with Carbide. + */ +public class UP_PERSONALITY_DESCRIPTORS extends Structure { + /// Size of the structure + public int dwSize; + /// All personality descriptor type + public byte bDescriptorType; + /// Personality code that is currently selected in the device + public byte bCurrentPersonality; + /// Number of possible personalities that the device supports + public byte bNumOfPersonalities; + /** + * Pointer to UP_PERSONALITY structures
+ * C type : UP_PERSONALITY* + */ + public UP_PERSONALITY.ByReference pPersonalities; + public UP_PERSONALITY_DESCRIPTORS() { + super(); + } + /** + * @param dwSize Size of the structure
+ * @param bDescriptorType All personality descriptor type
+ * @param bCurrentPersonality Personality code that is currently selected in the device
+ * @param bNumOfPersonalities Number of possible personalities that the device supports
+ * @param pPersonalities Pointer to UP_PERSONALITY structures
+ * C type : UP_PERSONALITY* + */ + public UP_PERSONALITY_DESCRIPTORS(int dwSize, byte bDescriptorType, byte bCurrentPersonality, byte bNumOfPersonalities, UP_PERSONALITY.ByReference pPersonalities) { + super(); + this.dwSize = dwSize; + this.bDescriptorType = bDescriptorType; + this.bCurrentPersonality = bCurrentPersonality; + this.bNumOfPersonalities = bNumOfPersonalities; + this.pPersonalities = pPersonalities; + } + protected ByReference newByReference() { return new ByReference(); } + protected ByValue newByValue() { return new ByValue(); } + protected UP_PERSONALITY_DESCRIPTORS newInstance() { return new UP_PERSONALITY_DESCRIPTORS(); } + public static UP_PERSONALITY_DESCRIPTORS[] newArray(int arrayLength) { + return null; +// return com.ochafik.lang.jnaerator.runtime.Structure.newArray(UP_PERSONALITY_DESCRIPTORS.class, arrayLength); + } + public static class ByReference extends UP_PERSONALITY_DESCRIPTORS implements com.sun.jna.Structure.ByReference {} + public static class ByValue extends UP_PERSONALITY_DESCRIPTORS implements com.sun.jna.Structure.ByValue {} + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_STRING_DESCRIPTOR.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/UP_STRING_DESCRIPTOR.java Tue Feb 02 11:56:46 2010 -0600 @@ -0,0 +1,61 @@ +/* +* 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.remoteconnections.discovery.pccs.pccsnative; + +import com.sun.jna.Structure; +import com.sun.jna.ptr.ShortByReference; + +/** + * This file was originally autogenerated by JNAerator,
+ * but modified to work with Carbide. + */ +public class UP_STRING_DESCRIPTOR extends Structure { + /// Size of the structure + public int dwSize; + /// String descriptor type + public byte bDescriptorType; + /** + * Descriptor text
+ * C type : WCHAR* + */ + public ShortByReference pstrDescription; + public UP_STRING_DESCRIPTOR() { + super(); + } + /** + * @param dwSize Size of the structure
+ * @param bDescriptorType String descriptor type
+ * @param pstrDescription Descriptor text
+ * C type : WCHAR* + */ + public UP_STRING_DESCRIPTOR(int dwSize, byte bDescriptorType, ShortByReference pstrDescription) { + super(); + this.dwSize = dwSize; + this.bDescriptorType = bDescriptorType; + this.pstrDescription = pstrDescription; + } + protected ByReference newByReference() { return new ByReference(); } + protected ByValue newByValue() { return new ByValue(); } + protected UP_STRING_DESCRIPTOR newInstance() { return new UP_STRING_DESCRIPTOR(); } + public static UP_STRING_DESCRIPTOR[] newArray(int arrayLength) { + return null; +// return com.ochafik.lang.jnaerator.runtime.Structure.newArray(UP_STRING_DESCRIPTOR.class, arrayLength); + } + public static class ByReference extends UP_STRING_DESCRIPTOR implements com.sun.jna.Structure.ByReference {} + public static class ByValue extends UP_STRING_DESCRIPTOR implements com.sun.jna.Structure.ByValue {} + +} diff -r 00c3cae74cd6 -r 11480f2167ca connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IClientServiceSiteUI2.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IClientServiceSiteUI2.java Tue Feb 02 11:56:09 2010 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IClientServiceSiteUI2.java Tue Feb 02 11:56:46 2010 -0600 @@ -24,7 +24,7 @@ /** * The user interface for picking or defining a connection to use that can be added to client service user interfaces. *

- * This variant allows selecting a "default connection" which will map to the currently selected default at runtime. + * This variant allows selecting a "current connection" which will map to the currently selected connection at runtime. *

* This requires that you use {@link IConnectionsManager#ensureConnection(String, IService)} * to map from a persisted connection identifier to an IConnection. Do not rely on "validating" @@ -60,7 +60,7 @@ * Do not expect to find this identifier in the {@link IConnectionsManager#getConnections()} list. * Instead, use {@link IConnectionsManager#ensureConnection(String, IService)} to find * the actual IConnection at runtime. - * @return the connection id, which may represent a "default". + * @return the connection id, which may represent a "current" connection. */ String getSelectedConnection(); @@ -83,11 +83,11 @@ *

    *
  1. If a connection is selected and it's compatible, return OK. *
  2. If no connection is selected, return ERROR. - *
  3. If selected connection is a default, but the current default is incompatible, + *
  4. If selected connection is current, but the current connection is incompatible, * return WARNING. * (Normally, the concrete connections are already filtered to show only - * compatible ones, but the default may be anything.) This is only a warning - * because the default connection can be changed externally to this UI, thus + * compatible ones, but the current may be anything.) This is only a warning + * because the current connection can be changed externally to this UI, thus * isn't a fatal error. *
*/ diff -r 00c3cae74cd6 -r 11480f2167ca core/com.nokia.carbide.cpp-feature/feature.xml --- a/core/com.nokia.carbide.cpp-feature/feature.xml Tue Feb 02 11:56:09 2010 -0600 +++ b/core/com.nokia.carbide.cpp-feature/feature.xml Tue Feb 02 11:56:46 2010 -0600 @@ -589,6 +589,13 @@ unpack="false"/> + +