connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/pccsnative/ConnAPILibrary.java
branchRCL_2_4
changeset 1125 07b11b189a25
parent 1124 f68b7751b408
child 1126 9b97d8b6f3e0
equal deleted inserted replaced
1124:f68b7751b408 1125:07b11b189a25
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 package com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative;
       
    18 
       
    19 import java.nio.IntBuffer;
       
    20 import java.nio.ShortBuffer;
       
    21 
       
    22 import org.eclipse.core.runtime.CoreException;
       
    23 import org.eclipse.core.runtime.IStatus;
       
    24 import org.eclipse.core.runtime.Status;
       
    25 
       
    26 import com.nokia.carbide.remoteconnections.discovery.pccs.Activator;
       
    27 import com.nokia.carbide.remoteconnections.discovery.pccs.Messages;
       
    28 import com.sun.jna.Native;
       
    29 import com.sun.jna.Pointer;
       
    30 import com.sun.jna.WString;
       
    31 import com.sun.jna.ptr.IntByReference;
       
    32 import com.sun.jna.ptr.PointerByReference;
       
    33 
       
    34 public class ConnAPILibrary implements IConnAPILibrary {
       
    35 
       
    36 	private static IConnAPILibrary Instance;
       
    37 	
       
    38 	/**
       
    39 	 * 
       
    40 	 */
       
    41 	public ConnAPILibrary() {
       
    42 	}
       
    43 
       
    44 	/* (non-Javadoc)
       
    45 	 * @see com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.ConnAPILibrary#getInstance()
       
    46 	 */
       
    47 	public static IConnAPILibrary getInstance() throws CoreException {
       
    48 		if (Instance == null) 
       
    49 			loadConnAPILibrary();
       
    50 		return Instance;
       
    51 	}
       
    52 
       
    53 	/* (non-Javadoc)
       
    54 	 * @see com.nokia.carbide.remoteconnections.discovery.pccs.pccsnative.ConnAPILibrary#loadConnAPILibrary()
       
    55 	 */
       
    56 	private static void loadConnAPILibrary() throws CoreException {
       
    57 		try {
       
    58 			Instance = (IConnAPILibrary) Native.loadLibrary("ConnAPI", IConnAPILibrary.class); //$NON-NLS-1$
       
    59 		} catch (UnsatisfiedLinkError e) {
       
    60 			String msg;
       
    61 			if (Activator.isSymSEELayout()) {
       
    62 				msg = Messages.ConnAPILibrary_PCCS_Not_Found_Error + Activator.getLoadErrorURL();
       
    63 			} else {
       
    64 				msg = Messages.ConnAPILibrary_PCSuite_Not_Found_Error + Activator.getLoadErrorURL();
       
    65 			}
       
    66 			throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, PCCSConnection.PCCS_NOT_FOUND, msg, e));
       
    67 		}
       
    68 	}
       
    69 
       
    70 	// these calls are here just to satisfy the interface
       
    71 	//   the real calls are marshalled through jna to the native library
       
    72 	public int CFAPI_Initialize(int dwAPIVersion, IntByReference pdwParam) {
       
    73 		// TODO Auto-generated method stub
       
    74 		return 0;
       
    75 	}
       
    76 
       
    77 	public int CFAPI_Terminate(IntByReference pdwParam) {
       
    78 		// TODO Auto-generated method stub
       
    79 		return 0;
       
    80 	}
       
    81 
       
    82 	public int CONACloseDM(APIHANDLE mHDMHandle) {
       
    83 		// TODO Auto-generated method stub
       
    84 		return 0;
       
    85 	}
       
    86 
       
    87 	public int CONAFreeDeviceStructure(int dwCount, CONAPI_DEVICE[] pDevices) {
       
    88 		// TODO Auto-generated method stub
       
    89 		return 0;
       
    90 	}
       
    91 
       
    92 	public int CONAGetDeviceCount(APIHANDLE hDMHandle, IntByReference pdwCount) {
       
    93 		// TODO Auto-generated method stub
       
    94 		return 0;
       
    95 	}
       
    96 
       
    97 	public int CONAGetDevices(APIHANDLE hDMHandle, IntByReference pdwCount,
       
    98 			CONAPI_DEVICE[] pDevices) {
       
    99 		// TODO Auto-generated method stub
       
   100 		return 0;
       
   101 	}
       
   102 
       
   103 	public int CONAOpenDM(LPAPIHANDLE mHDMHandle) {
       
   104 		// TODO Auto-generated method stub
       
   105 		return 0;
       
   106 	}
       
   107 
       
   108 	public int CONARegisterNotifyCallback(APIHANDLE hDMHandle, int dwState,
       
   109 			IConnAPIDeviceCallback pfnNotify) {
       
   110 		// TODO Auto-generated method stub
       
   111 		return 0;
       
   112 	}
       
   113 
       
   114 	public int DMAPI_GetAPIVersion() {
       
   115 		// TODO Auto-generated method stub
       
   116 		return 0;
       
   117 	}
       
   118 
       
   119 	public int DMAPI_Initialize(int dwAPIVersion, IntByReference pdwParam) {
       
   120 		// TODO Auto-generated method stub
       
   121 		return 0;
       
   122 	}
       
   123 
       
   124 	public int DMAPI_Terminate(IntByReference pdwParam) {
       
   125 		// TODO Auto-generated method stub
       
   126 		return 0;
       
   127 	}
       
   128 
       
   129 	public int CONACloseMM(APIHANDLE hMCHandle) {
       
   130 		// TODO Auto-generated method stub
       
   131 		return 0;
       
   132 	}
       
   133 
       
   134 	public int CONAMMFreeMediaStructures(int dwCountOfMedia, CONAPI_MEDIA[] pMedia) {
       
   135 		// TODO Auto-generated method stub
       
   136 		return 0;
       
   137 	}
       
   138 	public int CONAMMFreeMediaStructures(int dwCountOfMedia, Pointer pMedia) {
       
   139 		// TODO Auto-generated method stub
       
   140 		return 0;
       
   141 	}
       
   142 
       
   143 
       
   144 	public int CONAMMGetMedia(APIHANDLE hMCHandle, IntBuffer pdwCountOfMedia,
       
   145 			CONAPI_MEDIA.ByReference[] ppMedia) {
       
   146 		// TODO Auto-generated method stub
       
   147 		return 0;
       
   148 	}
       
   149 	public int CONAMMGetMedia(APIHANDLE hMCHandle, IntBuffer pdwCountOfMedia,
       
   150 			CONAPI_MEDIA.ByReference ppMedia) {
       
   151 		// TODO Auto-generated method stub
       
   152 		return 0;
       
   153 	}
       
   154 	public int CONAMMGetMedia(APIHANDLE hMCHandle, IntBuffer pdwCountOfMedia,
       
   155 			PointerByReference ppMedia) {
       
   156 		// TODO Auto-generated method stub
       
   157 		return 0;
       
   158 	}
       
   159 	public int CONAMMSetMedia(APIHANDLE hMCHandle, CONAPI_MEDIA[] pMedia) {
       
   160 		// TODO Auto-generated method stub
       
   161 		return 0;
       
   162 	}
       
   163 
       
   164 	public int CONAOpenMM(LPAPIHANDLE phMCHandle, int dwValue) {
       
   165 		// TODO Auto-generated method stub
       
   166 		return 0;
       
   167 	}
       
   168 
       
   169 	public int CONARegisterMMNotifyCallback(APIHANDLE hMCHandle, int dwState,
       
   170 			IConnAPIMediaCallback pfnNotify) {
       
   171 		// TODO Auto-generated method stub
       
   172 		return 0;
       
   173 	}
       
   174 
       
   175 	public int MCAPI_FreeMediaInfo(CONAPI_MEDIA_INFO[] pMediaInfo) {
       
   176 		// TODO Auto-generated method stub
       
   177 		return 0;
       
   178 	}
       
   179 
       
   180 	public int MCAPI_GetAPIVersion() {
       
   181 		// TODO Auto-generated method stub
       
   182 		return 0;
       
   183 	}
       
   184 
       
   185 	public int MCAPI_GetMediaInfo(APIHANDLE hMCHandle, ShortBuffer pstrMediaID,
       
   186 			CONAPI_MEDIA_INFO[] pMediaInfo) {
       
   187 		// TODO Auto-generated method stub
       
   188 		return 0;
       
   189 	}
       
   190 
       
   191 	public int MCAPI_Initialize(int dwAPIVersion, IntBuffer pdwParam) {
       
   192 		// TODO Auto-generated method stub
       
   193 		return 0;
       
   194 	}
       
   195 
       
   196 	public int MCAPI_Terminate(IntBuffer pdwParam) {
       
   197 		// TODO Auto-generated method stub
       
   198 		return 0;
       
   199 	}
       
   200 
       
   201 	public int UPAPI_CloseUSBPersonality(APIHANDLE hUPHandle) {
       
   202 		// TODO Auto-generated method stub
       
   203 		return 0;
       
   204 	}
       
   205 
       
   206 	public int UPAPI_FreeDeviceDescriptor(int dwDeviceCount,
       
   207 			UP_DEVICE_DESCRIPTOR[] pDeviceDescriptor) {
       
   208 		// TODO Auto-generated method stub
       
   209 		return 0;
       
   210 	}
       
   211 
       
   212 	public int UPAPI_FreePersonalityDescriptors(
       
   213 			UP_PERSONALITY_DESCRIPTORS[] pPersonalityDescriptors) {
       
   214 		// TODO Auto-generated method stub
       
   215 		return 0;
       
   216 	}
       
   217 
       
   218 	public int UPAPI_FreeStringDescriptor(
       
   219 			UP_STRING_DESCRIPTOR pStringDescriptor) {
       
   220 		// TODO Auto-generated method stub
       
   221 		return 0;
       
   222 	}
       
   223 
       
   224 	public int UPAPI_GetAPIVersion() {
       
   225 		// TODO Auto-generated method stub
       
   226 		return 0;
       
   227 	}
       
   228 
       
   229 	public int UPAPI_GetConfigurationDescriptor(APIHANDLE hUPHandle,
       
   230 			WString pstrDeviceId,
       
   231 			UP_CONFIGURATION_DESCRIPTOR[] pConfigurationDescriptor) {
       
   232 		// TODO Auto-generated method stub
       
   233 		return 0;
       
   234 	}
       
   235 
       
   236 	public int UPAPI_GetPersonalityDescriptors(APIHANDLE hUPHandle,
       
   237 			WString pstrDeviceId,
       
   238 			UP_PERSONALITY_DESCRIPTORS[] pPersonalityDescriptors) {
       
   239 		// TODO Auto-generated method stub
       
   240 		return 0;
       
   241 	}
       
   242 
       
   243 	public int UPAPI_GetStringDescriptor(APIHANDLE hUPHandle,
       
   244 			WString pstrDeviceId, int dwDescriptorIndex, int dwLanguageID,
       
   245 			UP_STRING_DESCRIPTOR pStringDescriptor) {
       
   246 		// TODO Auto-generated method stub
       
   247 		return 0;
       
   248 	}
       
   249 
       
   250 	public int UPAPI_Initialize(int dwAPIVersion, IntBuffer pdwParam) {
       
   251 		// TODO Auto-generated method stub
       
   252 		return 0;
       
   253 	}
       
   254 
       
   255 	public int UPAPI_OpenUSBPersonality(int dwVendorId, LPAPIHANDLE phUPHandle) {
       
   256 		// TODO Auto-generated method stub
       
   257 		return 0;
       
   258 	}
       
   259 
       
   260 	public int UPAPI_QueryDeviceCount(APIHANDLE hUPHandle,
       
   261 			IntBuffer pdwDeviceCount) {
       
   262 		// TODO Auto-generated method stub
       
   263 		return 0;
       
   264 	}
       
   265 
       
   266 	public int UPAPI_QueryDevices(APIHANDLE hUPHandle, IntBuffer pdwDeviceCount,
       
   267 			UP_DEVICE_DESCRIPTOR[] pDeviceDescriptor) {
       
   268 		// TODO Auto-generated method stub
       
   269 		return 0;
       
   270 	}
       
   271 
       
   272 	public int UPAPI_SendCommandToDevice(APIHANDLE hUPHandle,
       
   273 			WString pstrDeviceId, int dwDataDirection,
       
   274 			UP_DATA_BUFFER[] pDataBuffer) {
       
   275 		// TODO Auto-generated method stub
       
   276 		return 0;
       
   277 	}
       
   278 
       
   279 	public int UPAPI_SetPersonality(APIHANDLE hUPHandle,
       
   280 			WString pstrDeviceId, int dwPersonalityCode) {
       
   281 		// TODO Auto-generated method stub
       
   282 		return 0;
       
   283 	}
       
   284 
       
   285 	public int UPAPI_Terminate(IntBuffer pdwParam) {
       
   286 		// TODO Auto-generated method stub
       
   287 		return 0;
       
   288 	}
       
   289 
       
   290 	public int CONAMMSetMedia(APIHANDLE hMCHandle, Pointer pMedia) {
       
   291 		// TODO Auto-generated method stub
       
   292 		return 0;
       
   293 	}
       
   294 
       
   295 
       
   296 }