⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dmapidefinitions.vb

📁 以前做NOKIA手机与PC通信时所参考的源代码,里面包括两个程序,一个是手机文件夹浏览源码,另一个手机SIS安装程序.
💻 VB
📖 第 1 页 / 共 2 页
字号:
'Filename    : CONADefinitions.vb
'Part of     : PCSAPI VB.NET examples
'Description : Connectivity API data definitions, converted from CONADefinitions.h
'Version     : 3.2
'
'This example is only to be used with PC Connectivity API version 3.2.
'Compability ("as is") with future versions is not quaranteed.
'
'Copyright (c) 2007 Nokia Corporation.
'
'This material, including but not limited to documentation and any related
'computer programs, is protected by intellectual property rights of Nokia
'Corporation and/or its licensors.
'All rights are reserved. Reproducing, modifying, translating, or
'distributing any or all of this material requires the prior written consent
'of Nokia Corporation. Nokia Corporation retains the right to make changes
'to this material at any time without notice. A copyright license is hereby
'granted to download and print a copy of this material for personal use only.
'No other license to any other intellectual property rights is granted. The
'material is provided "as is" without warranty of any kind, either express or
'implied, including without limitation, any warranty of non-infringement,
'merchantability and fitness for a particular purpose. In no event shall
'Nokia Corporation be liable for any direct, indirect, special, incidental,
'or consequential loss or damages, including but not limited to, lost profits
'or revenue,loss of use, cost of substitute program, or loss of data or
'equipment arising out of the use or inability to use the material, even if
'Nokia Corporation has been advised of the likelihood of such damages occurring.

Option Strict Off
Option Explicit On 

Imports System.Runtime.InteropServices


Module CONADefinitions

    '=========================================================
    ' Device definitions used in Connectivity API
    '
    'Connection info structure
    Public Structure CONAPI_CONNECTION_INFO
        Dim iDeviceID As Integer
        Dim iMedia As Integer
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrDeviceName As String
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrAddress As String
        Dim iState As Integer
    End Structure

    'Device info structure
    Public Structure CONAPI_DEVICE
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrSerialNumber As String
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrFriendlyName As String
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrModel As String
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrManufacturer As String
        Dim iNumberOfItems As Integer
        Dim pItems As IntPtr    'Pointer to CONAPI_CONNECTION_INFO structures
    End Structure

    ' General device info structure
    Public Structure CONAPI_DEVICE_GEN_INFO
        Dim iSize As Integer
        Dim iType As Integer
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrTypeName As String
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrSWVersion As String
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrUsedLanguage As String
        Dim iSyncSupport As Integer
        Dim iFileSystemSupport As Integer
    End Structure

    ' Device product info structure
    Public Structure CONAPI_DEVICE_INFO_PRODUCT
        Dim iSize As Integer
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrProductCode As String
    End Structure

    ' Device device icon structure
    Public Structure CONAPI_DEVICE_INFO_ICON
        Dim iSize As Integer                                        ' [in] Size
        Dim iParam As Integer                                       ' [in] Reserved for future use. Must be 0.
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrTarget As String  ' [in] Target drive info. Must include memory type (e.g. "MMC" or "DEV").
        Dim iDataLength As Integer                                  ' [out]Icon data length.
        Dim pData As IntPtr                                         ' [out]Pointre to icon data.
    End Structure

    ' Device property info structure
    Public Structure CONAPI_GET_PROPERTY
        Dim iSize As Integer                                                ' [in] Size
        Dim iTargetPropertyType As Integer                                  ' [in] Target property type
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrPropertyName As String    ' [in] Target Property name
        Dim iResult As Integer                                          ' [out] Result code. CONA_OK if succeeded, otherwise error code
        <MarshalAs(UnmanagedType.LPWStr)> Dim pstrPropertyValue As String   ' [out] Result string. If not found pointer is NULL 
    End Structure

    Public Structure CONAPI_DEVICE_INFO_PROPERTIES
        Dim iSize As Integer                    ' [in] Size
        Dim iNumberOfStructs As Integer         ' [in] Count of CONAPI_GET_PROPERTY struct
        Dim pGetPropertyInfoStructs As IntPtr   ' [in] Pointer toCONAPI_GET_PROPERTY structs
    End Structure

    ' ----------------------------------------------------

    ' Search definitions used with CONASearchDevices function:
    Public Const CONAPI_DEVICE_NOT_FUNCTIONAL As Integer = &H0  ' Device is not working or unsupported device.
    Public Const CONAPI_DEVICE_UNPAIRED As Integer = &H1        ' Device is not paired
    Public Const CONAPI_DEVICE_PAIRED As Integer = &H2          ' Device is paired
    Public Const CONAPI_DEVICE_PCSUITE_TRUSTED As Integer = &H4 ' Device is PC Suite trusted
    Public Const CONAPI_DEVICE_WRONG_MODE As Integer = &H8      ' Device is connected in wrong mode.

    Public Const CONAPI_ALLOW_TO_USE_CACHE As Integer = &H1000  ' Get all devices from cache if available
    Public Const CONAPI_GET_ALL_PHONES As Integer = &H2000      ' Get all phones from target media
    Public Const CONAPI_GET_PAIRED_PHONES As Integer = &H4000   ' Get all paired phones from target media
    Public Const CONAPI_GET_TRUSTED_PHONES As Integer = &H8000  ' Get all PC Suite trusted phones from target media.

    ' Search macros used to check device's trusted/paired state: 
    Public Function CONAPI_IS_DEVICE_UNPAIRED(ByVal iState As Integer) As Integer
        CONAPI_IS_DEVICE_UNPAIRED = (iState And &H1)       ' Returns 1 if true
    End Function
    Public Function CONAPI_IS_DEVICE_PAIRED(ByVal iState As Integer) As Integer
        CONAPI_IS_DEVICE_PAIRED = ((iState >> 1) And &H1)  ' Returns 1 if true
    End Function
    Public Function CONAPI_IS_PCSUITE_TRUSTED(ByVal iState As Integer) As Integer
        CONAPI_IS_PCSUITE_TRUSTED = ((iState >> 2) And &H1) ' Returns 1 if true
    End Function

    ' Definitions used with CONAChangeDeviceTrustedState function:
    Public Const CONAPI_PAIR_DEVICE As Integer = &H100           ' Pair device
    Public Const CONAPI_UNPAIR_DEVICE As Integer = &H200         ' Unpair device
    Public Const CONAPI_SET_PCSUITE_TRUSTED As Integer = &H400   ' Set device to PC Suite trusted 
    Public Const CONAPI_SET_PCSUITE_UNTRUSTED As Integer = &H800 ' Remove PC Suite trusted information.
    ' Definitions used with CONAGetDeviceInfo function:
    Public Const CONAPI_DEVICE_GENERAL_INFO As Integer = &H10000      ' Get CONAPI_DEVICE_GEN_INFO struct.
    Public Const CONAPI_DEVICE_PRODUCT_INFO As Integer = &H100000     ' Get CONAPI_DEVICE_INFO_PRODUCT struct.
    Public Const CONAPI_DEVICE_PROPERTIES_INFO As Integer = &H1000000 ' Get CONAPI_DEVICE_INFO_PROPERTIES struct.
    Public Const CONAPI_DEVICE_ICON_INFO As Integer = &H10000000      ' Get CONAPI_DEVICE_ICON struct.

    ' Definitions used with CONAPI_DEVICE_INFO_PROPERTIES struct
    Public Const CONAPI_DEVICE_GET_PROPERTY As Integer = &H1     ' Get value from configuration file.
    '                                                            ' pstrPropertyName must be include target property name.
    Public Const CONAPI_DEVICE_IS_APP_SUPPORTED As Integer = &H2 ' Check is the application supported in configuration file.
    '                                                            ' pstrPropertyName must be include target application name.
    ' The next properties are returned from device's OBEX Capability object:
    Public Const CONAPI_DEVICE_GET_CURRENT_NETWORK As Integer = &H1000004   ' Get Current Network string.
    Public Const CONAPI_DEVICE_GET_COUNTRY_CODE As Integer = &H2000004      ' Get Country Code string.
    Public Const CONAPI_DEVICE_GET_NETWORK_ID As Integer = &H3000004        ' Get Network ID string.
    Public Const CONAPI_DEVICE_GET_VERSION As Integer = &H100004            ' Get Version string from CONAPI_CO_xxx_SERVICE Service.
    Public Const CONAPI_DEVICE_GET_UUID As Integer = &H200004               ' Get UUID string from CONAPI_CO_xxx_SERVICE Service.
    Public Const CONAPI_DEVICE_GET_OBJTYPE As Integer = &H300004            ' Get Object type string from CONAPI_CO_xxx_SERVICE Service.
    Public Const CONAPI_DEVICE_GET_FILEPATH As Integer = &H400004           ' Get file path string from CONAPI_CO_xxx_SERVICE Service.
    '                                                                       ' pstrPropertyName must be include type of file.
    Public Const CONAPI_DEVICE_GET_FOLDERPATH As Integer = &H500004         ' Get folder path string from CONAPI_CO_xxx_SERVICE Service.
    '                                                                       ' pstrPropertyName must be include type of folder (e.g. "Images").
    Public Const CONAPI_DEVICE_GET_FOLDERMEMTYPE As Integer = &H600004      ' Get folder memory type string from CONAPI_CO_xxx_SERVICE Service. 
    '                                                                       ' pstrPropertyName must be include type of folder.
    Public Const CONAPI_DEVICE_GET_FOLDEREXCLUDE As Integer = &H700004      ' Get folder exclude path string from CONAPI_CO_xxx_SERVICE Service.
    '                                                                       ' pstrPropertyName must be include type of folder.
    Public Const CONAPI_DEVICE_GET_ALL_VALUES As Integer = &H800004         ' Get all values from CONAPI_CO_xxx_SERVICE Service. Values are separated with hash mark (#).
    '                                                                       ' pstrPropertyName must be include type of item.
    ' Definitions for Services
    Public Const CONAPI_DS_SERVICE As Integer = &H1000              ' Data Synchronication Service
    Public Const CONAPI_DM_SERVICE As Integer = &H2000              ' Device Management Service
    Public Const CONAPI_NEF_SERVICE As Integer = &H3000             ' NEF Service
    Public Const CONAPI_DS_SMS_SERVICE As Integer = &H4000          ' Data Synchronication SMS Service
    Public Const CONAPI_DS_MMS_SERVICE As Integer = &H5000          ' Data Synchronication MMS Service
    Public Const CONAPI_DS_BOOKMARKS_SERVICE As Integer = &H6000    ' Data Synchronication Bookmarks Service
    Public Const CONAPI_FOLDER_BROWSING_SERVICE As Integer = &H7000 ' Folder-Browsing Service
    Public Const CONAPI_USER_DEFINED_SERVICE As Integer = &H8000    ' User defined Service. The service name must be set to pstrPropertyName. 
    ' Definitions used with General device info structure
    ' Device types:
    Public Const CONAPI_UNKNOWN_DEVICE As Integer = &H0            ' Unknown device.
    Public Const CONAPI_SERIES40_DEVICE As Integer = &H1000001     ' Series 40 device
    Public Const CONAPI_SERIES60_2ED_DEVICE As Integer = &H2000010 ' Series 60 the 2nd edition device.
    Public Const CONAPI_SERIES60_3ED_DEVICE As Integer = &H2000020 ' Series 60 the 3nd edition device.
    Public Const CONAPI_SERIES80_DEVICE As Integer = &H2000100     ' Series 80 device.
    Public Const CONAPI_NOKIA7710_DEVICE As Integer = &H2001000    ' Nokia 7710 device.
    ' Synchronication support:
    Public Const CONAPI_SYNC_NOT_SUPPORTED As Integer = &H0     ' Device is not supporting synchronication.
    Public Const CONAPI_SYNC_SA_DS As Integer = &H1             ' Device is supporting Server Alerted (SA) Data Synchronication. 
    Public Const CONAPI_SYNC_SA_DM As Integer = &H2             ' Device is supporting Server Alerted (SA) Device Management. 
    Public Const CONAPI_SYNC_CI_DS As Integer = &H10            ' Device is supporting Client Initated (CI) Data Synchronication.
    ' File System support: 
    Public Const CONAPI_FS_NOT_SUPPORTED As Integer = &H0               ' Device is not support file system.
    Public Const CONAPI_FS_SUPPORTED As Integer = &H1                   ' Device is support file system.
    Public Const CONAPI_FS_INSTALL_JAVA_APPLICATIONS As Integer = &H10  ' Device is supporting Java MIDlet installation.
    Public Const CONAPI_FS_INSTALL_SIS_APPLICATIONS As Integer = &H20   ' Device is supporting SIS applications installation. 
    Public Const CONAPI_FS_INSTALL_SISX_APPLICATIONS As Integer = &H40  ' Device supports SISX applications' installation. 
    Public Const CONAPI_FS_FILE_CONVERSION As Integer = &H100           ' Device is supporting file conversion.
    Public Const CONAPI_FS_LIST_APPLICATIONS As Integer = &H200         ' Device supports installed applications' listing.
    Public Const CONAPI_FS_UNINSTALL_APPLICATIONS As Integer = &H400    ' Device supports installed applications' uninstallation.
    Public Const CONAPI_FS_EXTENDED_OPERATIONS As Integer = &H800       ' Device supports extended File System operations (e.g. Copy folder).

    ' Definitions used in CONASetDeviceListOption function
    ' Option types:
    Public Const DMAPI_OPTION_SET_MANUFACTURER As Integer = &H1 ' pstrValue contains the manufacturer name

    ' ----------------------------------------------------
    ' DeviceNotifyCallbackFunction
    '
    '	This is the function prototype of the callback method
    '
    '	DWORD DeviceNotifyCallbackFunction(	DWORD dwStatus, WCHAR* pstrSerialNumber);
    '	
    '	Status value uses the following format:
    '
    '		----------------DWORD------------------
    '		WORD for info		WORD for status
    '		0000 0000 0000 0000 0000 0000 0000 0000
    '
    '	Status value is the one of the values defined below describing main reason for the notification.
    '	Info part consist of two parts:
    '		LOBYTE: Info part contains change info value. See info values below.
    '		HIBYTE:	Info data value. Depends of info value.
    '	See info value definitions for more information.
    '	Use predefined macros to extract needed part from the status value.
    '
    Public Delegate Function DeviceNotifyCallbackDelegate(ByRef iStatus As Integer, <MarshalAs(UnmanagedType.LPWStr)> ByVal pstrSerialNumber As String) As Integer

    'Device callback status values
    Public Const CONAPI_DEVICE_LIST_UPDATED As Integer = &H0 ' List is updated. No any specific information.
    Public Const CONAPI_DEVICE_ADDED As Integer = &H1        ' A new device is added to the list.
    Public Const CONAPI_DEVICE_REMOVED As Integer = &H2      ' Device is removed from the list.
    Public Const CONAPI_DEVICE_UPDATED As Integer = &H4      ' Device is updated. A connection is added or removed
    ' Device callback info values
    Public Const CONAPI_CONNECTION_ADDED As Integer = &H1   ' Note! HIBYTE == media, LOBYTE == CONAPI_CONNECTION_ADDED
    Public Const CONAPI_CONNECTION_REMOVED As Integer = &H2 ' Note! HIBYTE == media, LOBYTE == CONAPI_CONNECTION_REMOVED
    Public Const CONAPI_DEVICE_RENAMED As Integer = &H4     ' Friendly name of the device is changed

    ' Device callback macros
    Public Function GET_CONAPI_CB_STATUS(ByVal iStatus As Integer) As Integer
        GET_CONAPI_CB_STATUS = (&HFFFF And iStatus)
    End Function
	Public Function GET_CONAPI_CB_INFO(ByVal iStatus As Integer) As Integer
        GET_CONAPI_CB_INFO = ((&HFF0000 And iStatus) >> 16)
    End Function
	Public Function GET_CONAPI_CB_INFO_DATA(ByVal iStatus As Integer) As Integer
        GET_CONAPI_CB_INFO_DATA = ((&HFF000000 & iStatus) >> 24)
    End Function

    ' ----------------------------------------------------------------------
    ' DeviceSearchOperationCallbackFunction
    '
    ' Description
    ' Device Search operation callback functions are defined as: 
    '	DWORD (DeviceSearchOperationCallbackFunction)(DWORD dwState, 
    '					CONAPI_CONNECTION_INFO* pConnInfoStructure)
    '
    '	The Connectivity API calls this function at least every time period 
    '	(or if the System has found the device during this time) and adds one 
    '	to the function state value. The used time period counted by using 
    '	dwSearchTime parameter. E.g. If dwSearchTime paramater value is 240,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -