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

📄 pccapiutils.vb

📁 以前做NOKIA手机与PC通信时所参考的源代码,里面包括两个程序,一个是手机文件夹浏览源码,另一个手机SIS安装程序.
💻 VB
📖 第 1 页 / 共 2 页
字号:
'Filename    : PCCAPIUtils.vb
'Part of     : PCCAPI Example codes
'Description : Helper utilities, error management
'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) 2005-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 

Module PCCAPIUtils
    '===================================================================
	' CONAError2String --  Returns error text for given CONA error code
	'
	'
	'===================================================================
    Public Function CONAError2String(ByVal errorCode As Integer) As String
        CONAError2String = ""

        If errorCode = CONA_OK Then
            CONAError2String = "CONA_OK: Succeeded."
        ElseIf errorCode = CONA_OK_UPDATED_MEMORY_VALUES Then
            CONAError2String = "CONA_OK_UPDATED_MEMORY_VALUES: Everything OK, given data is updated because (free, used and total) memory values are changed!"
        ElseIf errorCode = CONA_OK_UPDATED_MEMORY_AND_FILES Then
            CONAError2String = "CONA_OK_UPDATED_MEMORY_AND_FILES: Everything OK, given data is updated because files and memory values are changed!"
        ElseIf errorCode = CONA_OK_UPDATED Then
            CONAError2String = "CONA_OK_UPDATED: Everything OK, given data is updated, unknown reason."
        ElseIf errorCode = CONA_OK_BUT_USER_ACTION_NEEDED Then
            CONAError2String = "CONA_OK_BUT_USER_ACTION_NEEDED: Operation needs some user action on Device"
        ElseIf errorCode = CONA_WAIT_CONNECTION_IS_BUSY Then
            CONAError2String = "CONA_WAIT_CONNECTION_IS_BUSY: Operation started ok but other application has reserved the connection"

            ' Common error codes:
        ElseIf errorCode = ECONA_INIT_FAILED Then
            CONAError2String = "ECONA_INIT_FAILED: DLL initialization failed."
        ElseIf errorCode = ECONA_INIT_FAILED_COM_INTERFACE Then
            CONAError2String = "ECONA_INIT_FAILED_COM_INTERFACE: Failed to get connection to system."
        ElseIf errorCode = ECONA_NOT_INITIALIZED Then
            CONAError2String = "ECONA_NOT_INITIALIZED: API is not initialized."
        ElseIf errorCode = ECONA_UNSUPPORTED_API_VERSION Then
            CONAError2String = "ECONA_UNSUPPORTED_API_VERSION: API version not supported."
        ElseIf errorCode = ECONA_NOT_SUPPORTED_MANUFACTURER Then
            CONAError2String = "ECONA_NOT_SUPPORTED_MANUFACTURER: Manufacturer is not supported."

        ElseIf errorCode = ECONA_UNKNOWN_ERROR Then
            CONAError2String = "ECONA_UNKNOWN_ERROR: Failed, unknown error."
        ElseIf errorCode = ECONA_UNKNOWN_ERROR_DEVICE Then
            CONAError2String = "ECONA_UNKNOWN_ERROR_DEVICE: Failed, unknown error from device."
        ElseIf errorCode = ECONA_INVALID_POINTER Then
            CONAError2String = "ECONA_INVALID_POINTER: Required pointer is invalid."
        ElseIf errorCode = ECONA_INVALID_PARAMETER Then
            CONAError2String = "ECONA_INVALID_PARAMETER: Invalid parameter value."
        ElseIf errorCode = ECONA_INVALID_HANDLE Then
            CONAError2String = "ECONA_INVALID_HANDLE: Invalid handle."
        ElseIf errorCode = ECONA_NOT_ENOUGH_MEMORY Then
            CONAError2String = "ECONA_NOT_ENOUGH_MEMORY: Memory allocation failed in PC."
        ElseIf errorCode = ECONA_WRONG_THREAD Then
            CONAError2String = "ECONA_WRONG_THREAD: Failed, called interface was marshalled for a different thread."
        ElseIf errorCode = ECONA_REGISTER_ALREADY_DONE Then
            CONAError2String = "ECONA_REGISTER_ALREADY_DONE: Failed, notification interface is already registered."

        ElseIf errorCode = ECONA_CANCELLED Then
            CONAError2String = "ECONA_CANCELLED: Operation cancelled by ConnectivityAPI-User."
        ElseIf errorCode = ECONA_NOTHING_TO_CANCEL Then
            CONAError2String = "ECONA_NOTHING_TO_CANCEL: No running functions."
        ElseIf errorCode = ECONA_FAILED_TIMEOUT Then
            CONAError2String = "ECONA_FAILED_TIMEOUT: Operation failed because of timeout."
        ElseIf errorCode = ECONA_NOT_SUPPORTED_DEVICE Then
            CONAError2String = "ECONA_NOT_SUPPORTED_DEVICE: Device does not support operation."
        ElseIf errorCode = ECONA_NOT_SUPPORTED_PC Then
            CONAError2String = "ECONA_NOT_SUPPORTED_PC: Connectivity API does not support operation (not implemented)."
        ElseIf errorCode = ECONA_NOT_FOUND Then
            CONAError2String = "ECONA_NOT_FOUND: Item was not found"
        ElseIf errorCode = ECONA_FAILED Then
            CONAError2String = "ECONA_FAILED: The called operation failed."

        ElseIf errorCode = ECONA_API_NOT_FOUND Then
            CONAError2String = "ECONA_API_NOT_FOUND: Needed API module was not found from the system"
        ElseIf errorCode = ECONA_API_FUNCTION_NOT_FOUND Then
            CONAError2String = "ECONA_API_FUNCTION_NOT_FOUND: Called API function was not found from the loaded API module"

            ' Device manager and device connection related errors:
        ElseIf errorCode = ECONA_DEVICE_NOT_FOUND Then
            CONAError2String = "ECONA_DEVICE_NOT_FOUND: Given phone is not connected (refresh device list)."
        ElseIf errorCode = ECONA_NO_CONNECTION_VIA_MEDIA Then
            CONAError2String = "ECONA_NO_CONNECTION_VIA_MEDIA: Phone is connected but not via given media."
        ElseIf errorCode = ECONA_NO_CONNECTION_VIA_DEVID Then
            CONAError2String = "ECONA_NO_CONNECTION_VIA_DEVID: Phone is not connected with given DevID."
        ElseIf errorCode = ECONA_INVALID_CONNECTION_TYPE Then
            CONAError2String = "ECONA_INVALID_CONNECTION_TYPE: Connection type was invalid."
        ElseIf errorCode = ECONA_NOT_SUPPORTED_CONNECTION_TYPE Then
            CONAError2String = "ECONA_NOT_SUPPORTED_CONNECTION_TYPE: Device does not support connection type."
        ElseIf errorCode = ECONA_CONNECTION_BUSY Then
            CONAError2String = "ECONA_CONNECTION_BUSY: Other application has reserved connection."
        ElseIf errorCode = ECONA_CONNECTION_LOST Then
            CONAError2String = "ECONA_CONNECTION_LOST: Connection lost to device."
        ElseIf errorCode = ECONA_CONNECTION_REMOVED Then
            CONAError2String = "ECONA_CONNECTION_REMOVED: Connection removed, other application has reserved connection."
        ElseIf errorCode = ECONA_CONNECTION_FAILED Then
            CONAError2String = "ECONA_CONNECTION_FAILED: Connection failed, unknown reason."
        ElseIf errorCode = ECONA_SUSPEND Then
            CONAError2String = "ECONA_SUSPEND: Connection removed, PC goes to standby state."
        ElseIf errorCode = ECONA_NAME_ALREADY_EXISTS Then
            CONAError2String = "ECONA_NAME_ALREADY_EXISTS: Friendly name already exists."
        ElseIf errorCode = ECONA_MEDIA_IS_NOT_WORKING Then
            CONAError2String = "ECONA_MEDIA_IS_NOT_WORKING: Target media is active but it is not working (e.g. BT hardware stopped or removed)."
        ElseIf errorCode = ECONA_CACHE_IS_NOT_AVAILABLE Then
            CONAError2String = "ECONA_CACHE_IS_NOT_AVAILABLE: Cache is not available (CONASearchDevices)."
        ElseIf errorCode = ECONA_MEDIA_IS_NOT_ACTIVE Then
            CONAError2String = "ECONA_MEDIA_IS_NOT_ACTIVE: Target media is busy (or not ready yet)."
        ElseIf errorCode = ECONA_PORT_OPEN_FAILED Then
            CONAError2String = "ECONA_PORT_OPEN_FAILED: Cannot open the changed COM port."

            ' Device pairing related errors:
        ElseIf errorCode = ECONA_DEVICE_PAIRING_FAILED Then
            CONAError2String = "ECONA_DEVICE_PAIRING_FAILED: Pairing failed."
        ElseIf ECONA_DEVICE_PASSWORD_WRONG Then
            errorCode = CONAError2String = "ECONA_DEVICE_PASSWORD_WRONG: Wrong password on device."
        ElseIf ECONA_DEVICE_PASSWORD_INVALID Then
            errorCode = CONAError2String = "ECONA_DEVICE_PASSWORD_INVALID: Password includes invalid characters or is missing."

            ' File System errors:
        ElseIf errorCode = ECONA_ALL_LISTED Then
            CONAError2String = "ECONA_ALL_LISTED: All items are listed."
        ElseIf errorCode = ECONA_MEMORY_FULL Then
            CONAError2String = "ECONA_MEMORY_FULL: Device memory full."

            ' File System errors for file functions:
        ElseIf errorCode = ECONA_FILE_NAME_INVALID Then
            CONAError2String = "ECONA_FILE_NAME_INVALID: File name contains invalid characters in Device or PC."
        ElseIf errorCode = ECONA_FILE_NAME_TOO_LONG Then
            CONAError2String = "ECONA_FILE_NAME_TOO_LONG: File name contains too many characters in Device or PC."
        ElseIf errorCode = ECONA_FILE_ALREADY_EXIST Then

⌨️ 快捷键说明

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