📄 dmapidefinitions.cs
字号:
//Filename : CONADefinitions.cs
//Part of : PCSAPI C# examples
//Description : Connectivity API data definitions, converted from DMAPIDefinitions.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.
using System.Runtime.InteropServices;
namespace CONADefinitions
{
class CONADefinitions
{
//=========================================================
// Common definitions used in Connectivity API
//
// Values used in callback registering methods
public const short API_REGISTER = 0x10;
public const short API_UNREGISTER = 0x20;
//=========================================================
// Device definitions used in Connectivity API
//
// Media types
public const short API_MEDIA_ALL = 1;
public const short API_MEDIA_IRDA = 2;
public const short API_MEDIA_SERIAL = 4;
public const short API_MEDIA_BLUETOOTH = 8;
public const short API_MEDIA_USB = 16;
//Connection info structure
public struct CONAPI_CONNECTION_INFO
{
public int iDeviceID;
public int iMedia;
[MarshalAs(UnmanagedType.LPWStr)]
public string pstrDeviceName;
[MarshalAs(UnmanagedType.LPWStr)]
public string pstrAddress;
public int iState;
}
//Device info structure
public struct CONAPI_DEVICE
{
[MarshalAs(UnmanagedType.LPWStr)]
public string pstrSerialNumber;
[MarshalAs(UnmanagedType.LPWStr)]
public string pstrFriendlyName;
[MarshalAs(UnmanagedType.LPWStr)]
public string pstrModel;
[MarshalAs(UnmanagedType.LPWStr)]
public string pstrManufacturer;
public int iNumberOfItems;
//Pointer to CONAPI_CONNECTION_INFO structures
public System.IntPtr pItems;
}
// General device info structure
public struct CONAPI_DEVICE_GEN_INFO
{
public int iSize;
public int iType;
[MarshalAs(UnmanagedType.LPWStr)]
public string pstrTypeName;
[MarshalAs(UnmanagedType.LPWStr)]
public string pstrSWVersion;
[MarshalAs(UnmanagedType.LPWStr)]
public string pstrUsedLanguage;
public int iSyncSupport;
public int iFileSystemSupport;
}
// Device product info structure
public struct CONAPI_DEVICE_INFO_PRODUCT
{
public int iSize;
[MarshalAs(UnmanagedType.LPWStr)]
public string pstrProductCode;
}
// Device device icon structure
public struct CONAPI_DEVICE_INFO_ICON
{
// [in] Size
public int iSize;
// [in] Reserved for future use. Must be 0.
public int iParam;
[MarshalAs(UnmanagedType.LPWStr)]
// [in] Target drive info. Must include memory type (e.g. "MMC" or "DEV").
public string pstrTarget;
// [out]Icon data length.
public int iDataLength;
// [out]Pointer to icon data.
public System.IntPtr pData;
}
// Device property info structure
public struct CONAPI_GET_PROPERTY
{
// [in] Size
public int iSize;
// [in] Target property type
public int iTargetPropertyType;
[MarshalAs(UnmanagedType.LPWStr)]
// [in] Target Property name
public string pstrPropertyName;
// [out] Result code. CONA_OK if succeeded, otherwise error code
public int iResult;
[MarshalAs(UnmanagedType.LPWStr)]
// [out] Result string. If not found pointer is NULL
public string pstrPropertyValue;
}
public struct CONAPI_DEVICE_INFO_PROPERTIES
{
// [in] Size
public int iSize;
// [in] Count of CONAPI_GET_PROPERTY struct
public int iNumberOfStructs;
// [in] Pointer toCONAPI_GET_PROPERTY structs
public System.IntPtr pGetPropertyInfoStructs;
}
// ----------------------------------------------------
// Search definitions used with CONASearchDevices function:
// Device is not working or unsupported device.
public const int CONAPI_DEVICE_NOT_FUNCTIONAL = 0;
// Device is not paired
public const int CONAPI_DEVICE_UNPAIRED = 1;
// Device is paired
public const int CONAPI_DEVICE_PAIRED = 2;
// Device is PC Suite trusted
public const int CONAPI_DEVICE_PCSUITE_TRUSTED = 4;
// Device is connected in wrong mode.
public const int CONAPI_DEVICE_WRONG_MODE = 8;
// Get all devices from cache if available
public const int CONAPI_ALLOW_TO_USE_CACHE = 4096;
// Get all phones from target media
public const int CONAPI_GET_ALL_PHONES = 8192;
// Get all paired phones from target media
public const int CONAPI_GET_PAIRED_PHONES = 16384;
// Get all PC Suite trusted phones from target media.
public const int CONAPI_GET_TRUSTED_PHONES = 32768;
// Search macros used to check device's trusted/paired state:
public static int CONAPI_IS_DEVICE_UNPAIRED(int iState)
{
return (iState & 1); // Returns 1 if true
}
public static int CONAPI_IS_DEVICE_PAIRED(int iState)
{
return ((iState >> 1) & 1); // Returns 1 if true
}
public static int CONAPI_IS_PCSUITE_TRUSTED(int iState)
{
return ((iState >> 2) & 1); // Returns 1 if true
}
// Definitions used with CONAChangeDeviceTrustedState function:
// Pair device
public const int CONAPI_PAIR_DEVICE = 256;
// Unpair device
public const int CONAPI_UNPAIR_DEVICE = 512;
// Set device to PC Suite trusted
public const int CONAPI_SET_PCSUITE_TRUSTED = 1024;
// Remove PC Suite trusted information.
public const int CONAPI_SET_PCSUITE_UNTRUSTED = 2048;
// Definitions used with CONAGetDeviceInfo function:
// Get CONAPI_DEVICE_GEN_INFO struct.
public const int CONAPI_DEVICE_GENERAL_INFO = 65536;
// Get CONAPI_DEVICE_INFO_PRODUCT struct.
public const int CONAPI_DEVICE_PRODUCT_INFO = 1048576;
// Get CONAPI_DEVICE_INFO_PROPERTIES struct.
public const int CONAPI_DEVICE_PROPERTIES_INFO = 16777216;
// Get CONAPI_DEVICE_ICON struct.
public const int CONAPI_DEVICE_ICON_INFO = 268435456;
// Definitions used with CONAPI_DEVICE_INFO_PROPERTIES struct
// Get value from configuration file.
public const int CONAPI_DEVICE_GET_PROPERTY = 1;
// Check is the application supported in configuration file.
// pstrPropertyName must be include target property name.
public const int CONAPI_DEVICE_IS_APP_SUPPORTED = 2;
// The next properties are returned from device's OBEX Capability object:
// Get Current Network string.
// pstrPropertyName must be include target application name.
public const int CONAPI_DEVICE_GET_CURRENT_NETWORK = 16777220;
// Get Country Code string.
public const int CONAPI_DEVICE_GET_COUNTRY_CODE = 33554436;
// Get Network ID string.
public const int CONAPI_DEVICE_GET_NETWORK_ID = 50331652;
// Get Version string from CONAPI_CO_xxx_SERVICE Service.
public const int CONAPI_DEVICE_GET_VERSION = 1048580;
// Get UUID string from CONAPI_CO_xxx_SERVICE Service.
public const int CONAPI_DEVICE_GET_UUID = 2097156;
// Get Object type string from CONAPI_CO_xxx_SERVICE Service.
public const int CONAPI_DEVICE_GET_OBJTYPE = 3145732;
// Get file path string from CONAPI_CO_xxx_SERVICE Service.
public const int CONAPI_DEVICE_GET_FILEPATH = 4194308;
// Get folder path string from CONAPI_CO_xxx_SERVICE Service.
// pstrPropertyName must be include type of file.
public const int CONAPI_DEVICE_GET_FOLDERPATH = 5242884;
// Get folder memory type string from CONAPI_CO_xxx_SERVICE Service.
// pstrPropertyName must be include type of folder (e.g. "Images").
public const int CONAPI_DEVICE_GET_FOLDERMEMTYPE = 6291460;
// Get folder exclude path string from CONAPI_CO_xxx_SERVICE Service.
// pstrPropertyName must be include type of folder.
public const int CONAPI_DEVICE_GET_FOLDEREXCLUDE = 7340036;
// Get all values from CONAPI_CO_xxx_SERVICE Service. Values are separated with hash mark (#).
// pstrPropertyName must be include type of folder.
public const int CONAPI_DEVICE_GET_ALL_VALUES = 8388612;
// Definitions for Services
// Data Synchronication Service
// pstrPropertyName must be include type of item.
public const int CONAPI_DS_SERVICE = 4096;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -