📄 dmapidefinitions.vb
字号:
' time period (240/100) is 2.4 seconds.
' If the function state is 100 and any device does not have found during
' this (dwSearchTime) time the CONASearchDevices function fails with the
' error code ECONA_FAILED_TIMEOUT.
'
' Parameters
' dwState [in] Function state (0-100%).
' pConnInfoStructure [in] Reserved for future use, the value is NULL.
'
' Return values
' The Connectivity API-user must return the CONA_OK value. If the callback
' function returns the error code ECONA_CANCELLED to the Connectivity API,
' the CONASearchDevices function will be cancelled with the error code ECONA_CANCELLED.
'
' Type definition:
Public Delegate Function SearchCallbackDelegate(ByVal iState As Integer, ByVal pConnInfoStructure As IntPtr) As Integer
'================================
' File system API definitions
'===============================
'Used for changing current folder:
Public Const GO_TO_ROOT_FOLDER As String = "\\"
Public Const GO_TO_PARENT_FOLDER As String = "..\"
Public Const FOLDER_SEPARATOR As String = "\"
'Options for CONADeleteFolder:
Public Const CONA_DELETE_FOLDER_EMPTY As Integer = &H0
Public Const CONA_DELETE_FOLDER_WITH_FILES As Integer = &H1
'Direction options for CONACopyFile and CONAMoveFile:
Public Const CONA_DIRECT_PHONE_TO_PC As Integer = &H2
Public Const CONA_DIRECT_PC_TO_PHONE As Integer = &H4
Public Const CONA_DIRECT_PHONE_TO_PHONE As Integer = &H8 ' Not used at the moment.
'Other options for CONACopyFile and CONAMoveFile:
Public Const CONA_OVERWRITE As Integer = &H10
Public Const CONA_RENAME As Integer = &H20 ' Used only with CONACopyFile
Public Const CONA_TRANSFER_ALL As Integer = &H40 ' Not used at the moment.
'Options for CONAFindBegin:
Public Const CONA_FIND_USE_CACHE As Integer = &H80
'Attribute defines for CONAPI_FOLDER_INFO and CONAPI_FILE_INFO structures:
Public Const CONA_FPERM_READ As Integer = &H100 'Both structure
Public Const CONA_FPERM_WRITE As Integer = &H200 'Both structure
Public Const CONA_FPERM_DELETE As Integer = &H400 'Both structure
Public Const CONA_FPERM_FOLDER As Integer = &H800 'Only for CONAPI_FOLDER_INFO
Public Const CONA_FPERM_DRIVE As Integer = &H1000 'Only for CONAPI_FOLDER_INFO
Public Const CONA_FPERM_HIDDEN As Integer = &H2000 ' Only for CONAPI_FOLDER_INFO2
Public Const CONA_FPERM_ROOT As Integer = &H4000 ' Only for CONAPI_FOLDER_INFO2
'Options for CONAGetFolderInfo
Public Const CONA_GET_FOLDER_INFO As Integer = &H1 ' Gets target folder info
Public Const CONA_GET_FOLDER_CONTENT As Integer = &H2 ' Gets target folder info and contents
Public Const CONA_GET_FOLDER_AND_SUB_FOLDERS_CONTENT As Integer = &H4 ' Gets target folder info, content and sub folder(s) contents also
Public Const CONA_COMPARE_AND_UPDATE_IF_NEEDED As Integer = &H100 ' Compare exist folder content. If change has happened, updates content
' and returns CONA_OK_UPDATED. If no change, returns CONA_OK.
Public Const CONA_DEFAULT_FOLDER As Integer = &H10000 'Used only with CONAInstallApplication
Public Const CONA_INFORM_IF_USER_ACTION_NEEDED As Integer = &H20000 'Used only with CONAInstallApplication
Public Const CONA_WAIT_THAT_USER_ACTION_IS_DONE As Integer = &H40000 'Used only with CONAInstallApplication
Public Const CONA_USE_IF_NOTICATION As Integer = &H1000000 ' Used only with CONAReadFileInBlocks and CONAWriteFileInBlocks
Public Const CONA_USE_CB_NOTICATION As Integer = &H2000000 ' Used only with CONAReadFileInBlocks and CONAWriteFileInBlocks
Public Const CONA_NOT_SET_FILE_DETAILS As Integer = &H4000000 ' Used only with CONAReadFileInBlocks
Public Const CONA_ALL_DATA_SENT As Integer = &H8000000 ' Used only with IFSAPIBlockNotify and CONABlockDataCallbackFunction
Public Function CONA_IS_ALL_DATA_RECEIVED(ByVal iState As Integer) As Integer 'Used only with IFSAPIBlockNotify and CONABlockDataCallbackFunction
CONA_IS_ALL_DATA_RECEIVED = ((iState >> 27) And &H1)
End Function
' ----------------------------------------------------
' Folder info structure
Public Structure CONAPI_FOLDER_INFO
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrName As String ' Folder or Drive name
Dim iAttributes As Integer ' Folder or Drive type and permission
Dim tFolderTime As ComTypes.FILETIME ' Folder time
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrLabel As String ' Drive lable name
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrMemoryType As String ' Folder or Drive memory type
End Structure
' File info structure
Public Structure CONAPI_FILE_INFO
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrName As String ' File name
Dim iAttributes As Integer ' File permission
Dim tFileTime As ComTypes.FILETIME ' File modified time
Dim iFileSize As Integer ' File size
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrMIMEType As String ' File MIME type
End Structure
' Folder info structure
Public Structure CONAPI_FOLDER_INFO2
Dim iSize As Integer ' Size of struct
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrName As String ' Folder or Drive name
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrLocation As String ' Absolute location path to folder or drive
Dim iAttributes As Integer ' Folder or Drive type and permission
Dim tFolderTime As ComTypes.FILETIME ' Folder time
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrLabel As String ' Drive lable name
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrMemoryType As String ' Folder or Drive memory type
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrID As String ' Identification ID
Dim dlFreeMemory As Long ' Free memory in drive
Dim dlTotalMemory As Long ' Total memory in drive
Dim dlUsedMemory As Long ' Used memory in drive
Dim iContainFiles As Integer ' Number of files in target folder or drive
Dim iContainFolders As Integer ' Number of folders in target folder or drive
Dim dlTotalSize As Long ' Size of folder content (including content of subfolders)
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrValue As String ' Reserved for future
End Structure
' Folder content structure
Public Structure CONAPI_FOLDER_CONTENT
Dim iSize As Integer ' Size of struct
' CONAPI_FOLDER_INFO2* pFolderInfo; ' Folder info struct
Dim pFolderInfo As IntPtr
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrPath As String ' Absolute path of sub files and sub folders
Dim iNumberOfFileInfo As Integer ' Number of file structs
' CONAPI_FILE_INFO* pFileInfo; ' File structs
Dim pFileInfo As IntPtr
Dim iNumberOfSubFolderContent As Integer ' Number of file structs
' CONAPI_FOLDER_CONTENT* pSubFolderContent; ' File structs
Dim pSubFolderContent As IntPtr
' CONAPI_FOLDER_CONTENT* pParentFolder; ' Pointer to the parent folder content struct
Dim pParentFolder As IntPtr
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrValue As String ' Reserved for future
End Structure
' ----------------------------------------------------
' FSNotifyCallbackDelegate function:
'
' ----------------------------------------------------
' This is the function prototype of the callback method
'
Public Delegate Function FSNotifyCallbackDelegate(ByVal iOperation As Integer, ByVal iStatus As Integer, ByVal iTransferredBytes As Integer, ByVal iAllBytes As Integer) As Integer
' ----------------------------------------------------
' FSFolderInfoCallbackDelegate function:
'
' ----------------------------------------------------
' This is the function prototype of the callback method
'
' typedef DWORD (CALLBACK *PFN_CONA_FS_FOLDERINFO_CALLBACK)(LPCONAPI_FOLDER_INFO2 pFolderInfo);
Public Delegate Function FSFolderInfoCallbackDelegate(ByVal pFolderInfo As IntPtr) As Integer
' ----------------------------------------------------
' CONABlockDataCallbackFunction function:
'
' Callback function prototype:
' typedef DWORD (CALLBACK *PFN_CONA_FS_BLOCKDATA_CALLBACK)(
' DWORD dwFSFunction,
' DWORD *pdwState,
' const DWORD dwSizeOfFileDataBlockBuffer,
' DWORD *pdwFileDataBlockLenght,
' unsigned char* pFileDataBlock);
Public Delegate Function FSBlockDataCallbackDelegate(ByVal iFSFunction As Integer, ByRef iState As Integer, ByVal iSizeOfFileDataBlockBuffer As Integer, ByRef iFileDataBlockLenght As Integer, ByVal pFileDataBlock As IntPtr) As Integer
' ----------------------------------------------------
' FSFunction values:
Public Const CONARefreshDeviceMemoryValuesNtf As Integer = &H1
Public Const CONASetCurrentFolderNtf As Integer = &H2
Public Const CONAFindBeginNtf As Integer = &H4
Public Const CONACreateFolderNtf As Integer = &H8
Public Const CONADeleteFolderNtf As Integer = &H10
Public Const CONARenameFolderNtf As Integer = &H20
Public Const CONAGetFileInfoNtf As Integer = &H40
Public Const CONADeleteFileNtf As Integer = &H80
Public Const CONAMoveFileNtf As Integer = &H100
Public Const CONACopyFileNtf As Integer = &H200
Public Const CONARenameFileNtf As Integer = &H400
Public Const CONAReadFileNtf As Integer = &H800
Public Const CONAWriteFileNtf As Integer = &H1000
Public Const CONAConnectionLostNtf As Integer = &H2000
Public Const CONAInstallApplicationNtf As Integer = &H4000
Public Const CONAConvertFileNtf As Integer = &H8000
Public Const CONAGetFolderInfoNtf As Integer = &H10000
Public Const CONAListApplicationNtf As Integer = &H20000
Public Const CONAUninstallApplicationNtf As Integer = &H40000
Public Const CONAReadFileInBlocksNtf As Integer = &H80000
Public Const CONAWriteFileInBlocksNtf As Integer = &H100000
Public Const CONAMoveFolderNtf As Integer = &H200000
Public Const CONACopyFolderNtf As Integer = &H400000
Public Const CONAGetFileMetadataNtf As Integer = &H800000
' The next function do not send notifications:
' CONAOpenFS
' CONACloseFS
' CONARegisterFSNotifyCallback
' CONAGetMemoryTypes
' CONAGetMemoryValues
' CONAGetCurrentFolder
' CONAFindNextFolder
' CONAFindNextFile
' CONAFindEnd
' CONACancel
' Possible error codes value in dwStatus parameter when
' FSFunction value is CONAConnectionLost:
' ECONA_CONNECTION_LOST
' ECONA_CONNECTION_REMOVED
' ECONA_CONNECTION_FAILED
' ECONA_SUSPEND
' ----------------------------------------------------
' CONAMediaCallback
'
' This is the function prototype of the callback method
'
' DWORD CALLBACK CONAMediaCallback(DWORD dwStatus, API_MEDIA* pMedia);
Public Delegate Function MediaCallbackDelegate(ByVal iStatus As Integer, ByVal pMedia As IntPtr) As Integer
' ----------------------------------------------------
' Media info structure
Public Structure API_MEDIA
Dim iSize As Integer
Dim iMedia As Integer
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrDescription As String
Dim iState As Integer
Dim iOptions As Integer
Dim iMediaData As Integer
<MarshalAs(UnmanagedType.LPWStr)> Dim pstrID As String
End Structure
'Synchronication support:
Public Const API_MEDIA_ACTIVE As Integer = &H1 ' Media is active.
Public Const API_MEDIA_NOT_ACTIVE As Integer = &H2 ' Media is not active.
Public Const API_MEDIA_IC_SUPPORTED As Integer = &H10 ' Media is supporting incoming connections.
Public Const API_MEDIA_IC_NOT_SUPPORTED As Integer = &H20 ' Media is not supporting incoming connections.
Public Function CONAPI_GET_MEDIA_TYPE(ByVal iMedia As Integer) As Integer
CONAPI_GET_MEDIA_TYPE = &HFF And iMedia
End Function
Public Function CONAPI_IS_MEDIA_ACTIVE(ByVal iState As Integer) As Integer
CONAPI_IS_MEDIA_ACTIVE = &H1 And iState
End Function
Public Function CONAPI_IS_MEDIA_UNACTIVE(ByVal iState As Integer) As Integer
CONAPI_IS_MEDIA_UNACTIVE = (&H2 And iState) >> 1
End Function
Public Function CONAPI_IS_IC_SUPPORTED(ByVal iOptions As Integer) As Integer
CONAPI_IS_IC_SUPPORTED = (&H10 And iOptions) >> 4
End Function
Public Function CONAPI_IS_IC_UNSUPPORTED(ByVal iOptions As Integer) As Integer
CONAPI_IS_IC_UNSUPPORTED = (&H20 And iOptions) >> 5
End Function
End Module
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -