Module: Wavesync::Libmtp::FFIBindings

Extended by:
FFI::Library
Defined in:
lib/wavesync/libmtp.rb

Defined Under Namespace

Classes: DeviceEntry, DeviceStorage, File, Folder, MtpDevice, RawDevice

Constant Summary collapse

LIBMTP_STORAGE_SORTBY_NOTSORTED =
0
LIBMTP_FILETYPE_WAV =
1
LIBMTP_FILETYPE_MP3 =
2
LIBMTP_FILETYPE_OGG =
4
LIBMTP_FILETYPE_AAC =
30
LIBMTP_FILETYPE_FLAC =
32
LIBMTP_FILETYPE_M4A =
34
LIBMTP_FILETYPE_UNKNOWN =
44

Class Method Summary collapse

Class Method Details

.bind!Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/wavesync/libmtp.rb', line 97

def self.bind!
  return if @bound

  attach_function :LIBMTP_Init,                            [],                          :void
  attach_function :LIBMTP_Detect_Raw_Devices,              %i[pointer pointer],         :int
  attach_function :LIBMTP_Open_Raw_Device,                 [:pointer],                  :pointer
  attach_function :LIBMTP_Get_Storage,                     %i[pointer int],             :int
  attach_function :LIBMTP_Get_Folder_List_For_Storage,     %i[pointer uint32],          :pointer
  attach_function :LIBMTP_Get_Filelisting_With_Callback,   %i[pointer pointer pointer], :pointer
  attach_function :LIBMTP_Send_File_From_File,             %i[pointer string pointer pointer pointer], :int
  attach_function :LIBMTP_Create_Folder,                   %i[pointer pointer uint32 uint32], :uint32
  attach_function :LIBMTP_Delete_Object,                   %i[pointer uint32], :int
  attach_function :LIBMTP_Get_File_To_File,                %i[pointer uint32 string pointer pointer], :int
  attach_function :LIBMTP_destroy_folder_t,                [:pointer],                  :void
  attach_function :LIBMTP_destroy_file_t,                  [:pointer],                  :void
  attach_function :LIBMTP_Release_Device,                  [:pointer],                  :void
  attach_function :LIBMTP_FreeMemory,                      [:pointer],                  :void
  attach_function :LIBMTP_Dump_Errorstack,                 [:pointer],                  :void
  attach_function :LIBMTP_Clear_Errorstack,                [:pointer],                  :void
  @bound = true
end