You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
136 lines
5.8 KiB
136 lines
5.8 KiB
6 years ago
|
EnableExplicit
|
||
|
|
||
|
Global PBEx_MTP
|
||
|
|
||
|
#PBEx_MTP_Type_File = 1
|
||
|
#PBEx_MTP_Type_Directory = 2
|
||
|
#PBEx_MTP_DeviceType_Generic = 0
|
||
|
#PBEx_MTP_DeviceType_Camera = 1
|
||
|
#PBEx_MTP_DeviceType_MediaPlayer = 2
|
||
|
#PBEx_MTP_DeviceType_Phone = 3
|
||
|
#PBEx_MTP_DeviceType_Video = 4
|
||
|
#PBEx_MTP_DeviceType_PersonalInformationManager = 5
|
||
|
#PBEx_MTP_DeviceType_AudioRecorder = 6
|
||
|
|
||
|
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
|
||
|
PBEx_MTP = OpenLibrary(#PB_Any, "PB.Ex_MTP_x86.dll")
|
||
|
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
|
||
|
PBEx_MTP = OpenLibrary(#PB_Any, "PB.Ex_MTP_x64.dll")
|
||
|
CompilerEndIf
|
||
|
|
||
|
If PBEx_MTP
|
||
|
Prototype ExamineMTP(ErrorOutput)
|
||
|
Global ExamineMTP.ExamineMTP = GetFunction(PBEx_MTP, "ExamineMTP")
|
||
|
Prototype NextMTPEntry(ErrorOutput)
|
||
|
Global NextMTPEntry.NextMTPEntry = GetFunction(PBEx_MTP, "NextMTPEntry")
|
||
|
Prototype FinishMTP(ErrorOutput)
|
||
|
Global FinishMTP.FinishMTP = GetFunction(PBEx_MTP, "FinishMTP")
|
||
|
Prototype MTPEntryName(Output, ErrorOutput)
|
||
|
Global MTPEntryName.MTPEntryName = GetFunction(PBEx_MTP, "MTPEntryName")
|
||
|
Prototype OpenMTP(ID, DeviceName.p-Unicode, ErrorOutput)
|
||
|
Global OpenMTP.OpenMTP = GetFunction(PBEx_MTP, "OpenMTP")
|
||
|
Prototype CloseMTP(ID, ErrorOutput)
|
||
|
Global CloseMTP.CloseMTP = GetFunction(PBEx_MTP, "CloseMTP")
|
||
|
Prototype IsMTP(ID, ErrorOutput)
|
||
|
Global IsMTP.IsMTP = GetFunction(PBEx_MTP, "IsMTP")
|
||
|
Prototype ExamineMTPDirectory(ID, ErrorOutput)
|
||
|
Global ExamineMTPDirectory.ExamineMTPDirectory = GetFunction(PBEx_MTP, "ExamineMTPDirectory")
|
||
|
Prototype FinishMTPDirectory(ID, ErrorOutput)
|
||
|
Global FinishMTPDirectory.FinishMTPDirectory = GetFunction(PBEx_MTP, "FinishMTPDirectory")
|
||
|
Prototype NextMTPDirectoryEntry(ID, ErrorOutput)
|
||
|
Global NextMTPDirectoryEntry.NextMTPDirectoryEntry = GetFunction(PBEx_MTP, "NextMTPDirectoryEntry")
|
||
|
Prototype MTPDirectoryEntryName(ID, Output, ErrorOutput)
|
||
|
Global MTPDirectoryEntryName.MTPDirectoryEntryName = GetFunction(PBEx_MTP, "MTPDirectoryEntryName")
|
||
|
Prototype SetMTPDirectory(ID, DirectoryPath.p-Unicode, ErrorOutput)
|
||
|
Global SetMTPDirectory.SetMTPDirectory = GetFunction(PBEx_MTP, "SetMTPDirectory")
|
||
|
Prototype GetMTPDirectory(ID, Output, ErrorOutput)
|
||
|
Global GetMTPDirectory.GetMTPDirectory = GetFunction(PBEx_MTP, "GetMTPDirectory")
|
||
|
Prototype MTPDirectoryEntryType(ID, ErrorOutput)
|
||
|
Global MTPDirectoryEntryType.MTPDirectoryEntryType = GetFunction(PBEx_MTP, "MTPDirectoryEntryType")
|
||
|
Prototype ReceiveMTPFile(ID, RemoteFileName.p-Unicode, FileName.p-Unicode, ErrorOutput)
|
||
|
Global ReceiveMTPFile.ReceiveMTPFile = GetFunction(PBEx_MTP, "ReceiveMTPFile")
|
||
|
Prototype MTPDirectoryEntrySize(ID, ErrorOutput)
|
||
|
Global MTPDirectoryEntrySize.MTPDirectoryEntrySize = GetFunction(PBEx_MTP, "MTPDirectoryEntrySize")
|
||
|
Prototype MTPDirectoryEntryDate(ID, ErrorOutput)
|
||
|
Global MTPDirectoryEntryDate.MTPDirectoryEntryDate = GetFunction(PBEx_MTP, "MTPDirectoryEntryDate")
|
||
|
Prototype GetMTPDescription(ID, Output, ErrorOutput)
|
||
|
Global GetMTPDescription.GetMTPDescription = GetFunction(PBEx_MTP, "GetMTPDescription")
|
||
|
Prototype GetMTPDeviceID(ID, Output, ErrorOutput)
|
||
|
Global GetMTPDeviceID.GetMTPDeviceID = GetFunction(PBEx_MTP, "GetMTPDeviceID")
|
||
|
Prototype GetMTPDeviceType(ID, ErrorOutput)
|
||
|
Global GetMTPDeviceType.GetMTPDeviceType = GetFunction(PBEx_MTP, "GetMTPDeviceType")
|
||
|
Prototype GetMTPFirmwareVersion(ID, Output, ErrorOutput)
|
||
|
Global GetMTPFirmwareVersion.GetMTPFirmwareVersion = GetFunction(PBEx_MTP, "GetMTPFirmwareVersion")
|
||
|
Prototype GetMTPFriendlyName(ID, Output, ErrorOutput)
|
||
|
Global GetMTPFriendlyName.GetMTPFriendlyName = GetFunction(PBEx_MTP, "GetMTPFriendlyName")
|
||
|
Prototype GetMTPManufacturer(ID, Output, ErrorOutput)
|
||
|
Global GetMTPManufacturer.GetMTPManufacturer = GetFunction(PBEx_MTP, "GetMTPManufacturer")
|
||
|
Prototype GetMTPModel(ID, Output, ErrorOutput)
|
||
|
Global GetMTPModel.GetMTPModel = GetFunction(PBEx_MTP, "GetMTPModel")
|
||
|
Prototype GetMTPPnPDeviceID(ID, Output, ErrorOutput)
|
||
|
Global GetMTPPnPDeviceID.GetMTPPnPDeviceID = GetFunction(PBEx_MTP, "GetMTPPnPDeviceID")
|
||
|
Prototype GetMTPSerialNumber(ID, Output, ErrorOutput)
|
||
|
Global GetMTPSerialNumber.GetMTPSerialNumber = GetFunction(PBEx_MTP, "GetMTPSerialNumber")
|
||
|
|
||
|
EndIf
|
||
|
|
||
|
Global Output$ = Space(1024)
|
||
|
Global ErrorOutput$ = Space(128)
|
||
|
|
||
|
;List all devices to determine the device name.
|
||
|
; If ExamineMTP(@ErrorOutput$)
|
||
|
; While NextMTPEntry(@ErrorOutput$)
|
||
|
; MTPEntryName(@Output$, @ErrorOutput$)
|
||
|
; Debug Output$
|
||
|
; Wend
|
||
|
; EndIf
|
||
|
|
||
|
;List all directories and files.
|
||
|
;If OpenMTP(1, "Canon IXUS 125 HS", @ErrorOutput$)
|
||
|
If OpenMTP(1, "Apple iPhone", @ErrorOutput$)
|
||
|
|
||
|
;Get device information
|
||
|
GetMTPFriendlyName(1, @Output$, @ErrorOutput$)
|
||
|
Debug "Friendly name: " + Output$
|
||
|
GetMTPManufacturer(1, @Output$, @ErrorOutput$)
|
||
|
Debug "Manufacturer: " + Output$
|
||
|
GetMTPFirmwareVersion(1, @Output$, @ErrorOutput$)
|
||
|
Debug "Firmware version: " + Output$
|
||
|
GetMTPPnPDeviceID(1, @Output$, @ErrorOutput$)
|
||
|
Debug "PnPDeviceID: " + Output$
|
||
|
|
||
|
Debug "--------------------------------------------------"
|
||
|
|
||
|
;SetMTPDirectory(1, "\Internal Storage\DCIM\100APPLE", @ErrorOutput$)
|
||
|
If ExamineMTPDirectory(1, @ErrorOutput$)
|
||
|
While NextMTPDirectoryEntry(1, @ErrorOutput$)
|
||
|
MTPDirectoryEntryName(1, @Output$, @ErrorOutput$)
|
||
|
If MTPDirectoryEntryType(1, @ErrorOutput$) = #PBEx_MTP_Type_Directory
|
||
|
Debug "Folder: " + Output$
|
||
|
ElseIf MTPDirectoryEntryType(1, @ErrorOutput$) = #PBEx_MTP_Type_File
|
||
|
Debug "File: " + Output$
|
||
|
Debug Str(MTPDirectoryEntrySize(1, @ErrorOutput$)) + " Bytes"
|
||
|
Debug FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss", MTPDirectoryEntryDate(1, @ErrorOutput$))
|
||
|
|
||
|
EndIf
|
||
|
|
||
|
Wend
|
||
|
EndIf
|
||
|
|
||
|
CloseMTP(1, @ErrorOutput$)
|
||
|
Else
|
||
|
Debug ErrorOutput$
|
||
|
EndIf
|
||
|
|
||
|
CloseLibrary(PBEx_MTP)
|
||
|
|
||
|
; IDE Options = PureBasic 5.70 LTS (Windows - x64)
|
||
|
; CursorPosition = 45
|
||
|
; FirstLine = 21
|
||
|
; EnableXP
|
||
|
; EnableUser
|
||
|
; Executable = PB.Ex_MSSQL.exe
|
||
|
; CompileSourceDirectory
|
||
|
; EnableCompileCount = 898
|
||
|
; EnableBuildCount = 7
|
||
|
; EnableUnicode
|