libmtp.h | libmtp.h | |||
---|---|---|---|---|
/** | /** | |||
* \file libmtp.h | * \file libmtp.h | |||
* | ||||
* Interface to the Media Transfer Protocol library. | * Interface to the Media Transfer Protocol library. | |||
* | * | |||
* Copyright (C) 2005-2007 Linus Walleij <triad@df.lth.se> | ||||
* Copyright (C) 2005-2007 Richard A. Low <richard@wentnet.com> | ||||
* Copyright (C) 2007 Ted Bullock | ||||
* | ||||
* This library is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU Lesser General Public | ||||
* License as published by the Free Software Foundation; either | ||||
* version 2 of the License, or (at your option) any later version. | ||||
* | ||||
* This library is distributed in the hope that it will be useful, | ||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
* Lesser General Public License for more details. | ||||
* | ||||
* You should have received a copy of the GNU Lesser General Public | ||||
* License along with this library; if not, write to the | ||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||||
* Boston, MA 02111-1307, USA. | ||||
* | ||||
* <code> | * <code> | |||
* #include <libmtp.h> | * #include <libmtp.h> | |||
* </code> | * </code> | |||
*/ | */ | |||
#ifndef LIBMTP_H_INCLUSION_GUARD | #ifndef LIBMTP_H_INCLUSION_GUARD | |||
#define LIBMTP_H_INCLUSION_GUARD | #define LIBMTP_H_INCLUSION_GUARD | |||
#define LIBMTP_VERSION 0.1.3 | #define LIBMTP_VERSION 0.1.4 | |||
/* This handles MSVC pecularities */ | /* This handles MSVC pecularities */ | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <windows.h> | #include <windows.h> | |||
#define __WIN32__ | #define __WIN32__ | |||
#define snprintf _snprintf | #define snprintf _snprintf | |||
#define ssize_t SSIZE_T | #define ssize_t SSIZE_T | |||
#endif | #endif | |||
#include <stdio.h> | #include <stdio.h> | |||
skipping to change at line 92 | skipping to change at line 110 | |||
LIBMTP_FILETYPE_M4A, | LIBMTP_FILETYPE_M4A, | |||
LIBMTP_FILETYPE_DOC, | LIBMTP_FILETYPE_DOC, | |||
LIBMTP_FILETYPE_XML, | LIBMTP_FILETYPE_XML, | |||
LIBMTP_FILETYPE_XLS, | LIBMTP_FILETYPE_XLS, | |||
LIBMTP_FILETYPE_PPT, | LIBMTP_FILETYPE_PPT, | |||
LIBMTP_FILETYPE_MHT, | LIBMTP_FILETYPE_MHT, | |||
LIBMTP_FILETYPE_JP2, | LIBMTP_FILETYPE_JP2, | |||
LIBMTP_FILETYPE_JPX, | LIBMTP_FILETYPE_JPX, | |||
LIBMTP_FILETYPE_UNKNOWN | LIBMTP_FILETYPE_UNKNOWN | |||
} LIBMTP_filetype_t; | } LIBMTP_filetype_t; | |||
/** | ||||
* These are the numbered error codes. You can also | ||||
* get string representations for errors. | ||||
*/ | ||||
typedef enum { | ||||
LIBMTP_ERROR_NONE, | ||||
LIBMTP_ERROR_GENERAL, | ||||
LIBMTP_ERROR_PTP_LAYER, | ||||
LIBMTP_ERROR_USB_LAYER, | ||||
LIBMTP_ERROR_MEMORY_ALLOCATION, | ||||
LIBMTP_ERROR_NO_DEVICE_ATTACHED, | ||||
LIBMTP_ERROR_STORAGE_FULL, | ||||
LIBMTP_ERROR_CONNECTING | ||||
} LIBMTP_error_number_t; | ||||
typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t; /**< @see LIBMTP_device_entry_struct */ | typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t; /**< @see LIBMTP_device_entry_struct */ | |||
typedef struct LIBMTP_error_struct LIBMTP_error_t; /**< @see LIBMTP_error_s truct */ | ||||
typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t; /**< @see LIBMTP _mtpdevice_struct */ | typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t; /**< @see LIBMTP _mtpdevice_struct */ | |||
typedef struct LIBMTP_file_struct LIBMTP_file_t; /**< @see LIBMTP_file_stru ct */ | typedef struct LIBMTP_file_struct LIBMTP_file_t; /**< @see LIBMTP_file_stru ct */ | |||
typedef struct LIBMTP_track_struct LIBMTP_track_t; /**< @see LIBMTP_track_s truct */ | typedef struct LIBMTP_track_struct LIBMTP_track_t; /**< @see LIBMTP_track_s truct */ | |||
typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t; /**< @see LIBMTP_p laylist_struct */ | typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t; /**< @see LIBMTP_p laylist_struct */ | |||
typedef struct LIBMTP_album_struct LIBMTP_album_t; /**< @see LIBMTP_album_s truct */ | typedef struct LIBMTP_album_struct LIBMTP_album_t; /**< @see LIBMTP_album_s truct */ | |||
typedef struct LIBMTP_folder_struct LIBMTP_folder_t; /**< @see LIBMTP_folde r_t */ | typedef struct LIBMTP_folder_struct LIBMTP_folder_t; /**< @see LIBMTP_folde r_t */ | |||
typedef struct LIBMTP_object_struct LIBMTP_object_t; /**< @see LIBMTP_objec t_t */ | typedef struct LIBMTP_object_struct LIBMTP_object_t; /**< @see LIBMTP_objec t_t */ | |||
typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t; /**< @ see LIBMTP_filesample_t */ | typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t; /**< @ see LIBMTP_filesample_t */ | |||
typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t; /**< @se e LIBMTP_devicestorage_t */ | typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t; /**< @se e LIBMTP_devicestorage_t */ | |||
skipping to change at line 123 | skipping to change at line 156 | |||
typedef int (* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total, | typedef int (* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total, | |||
void const * const data); | void const * const data); | |||
/** | /** | |||
* @} | * @} | |||
* @defgroup structar libmtp data structures | * @defgroup structar libmtp data structures | |||
* @{ | * @{ | |||
*/ | */ | |||
/** | /** | |||
* A data structure to hold MTP device entries | * A data structure to hold MTP device entries. | |||
*/ | */ | |||
struct LIBMTP_device_entry_struct { | struct LIBMTP_device_entry_struct { | |||
char *name; /**< The descriptive name of this device */ | char *name; /**< The descriptive name of this device */ | |||
uint16_t vendor_id; /**< Vendor ID for this device */ | uint16_t vendor_id; /**< Vendor ID for this device */ | |||
uint16_t product_id; /**< Product ID for this device */ | uint16_t product_id; /**< Product ID for this device */ | |||
uint32_t device_flags; /**< Bugs, device specifics etc */ | uint32_t device_flags; /**< Bugs, device specifics etc */ | |||
}; | }; | |||
/** | /** | |||
* A data structure to hold errors from the library. | ||||
*/ | ||||
struct LIBMTP_error_struct { | ||||
LIBMTP_error_number_t errornumber; | ||||
char *error_text; | ||||
LIBMTP_error_t *next; | ||||
}; | ||||
/** | ||||
* Main MTP device object struct | * Main MTP device object struct | |||
*/ | */ | |||
struct LIBMTP_mtpdevice_struct { | struct LIBMTP_mtpdevice_struct { | |||
/** Interface number of this device */ | /** Interface number of this device */ | |||
uint8_t interface_number; | uint8_t interface_number; | |||
/** | /** | |||
* Parameters for this device, must be cast into | * Parameters for this device, must be cast into | |||
* \c (PTPParams*) before internal use. | * \c (PTPParams*) before internal use. | |||
*/ | */ | |||
void *params; | void *params; | |||
skipping to change at line 154 | skipping to change at line 196 | |||
* USB device for this device, must be cast into | * USB device for this device, must be cast into | |||
* \c (PTP_USB*) before internal use. | * \c (PTP_USB*) before internal use. | |||
*/ | */ | |||
void *usbinfo; | void *usbinfo; | |||
/** | /** | |||
* The storage for this device, do not use strings in here without | * The storage for this device, do not use strings in here without | |||
* copying them first, and beware that this list may be rebuilt at | * copying them first, and beware that this list may be rebuilt at | |||
* any time. | * any time. | |||
*/ | */ | |||
LIBMTP_devicestorage_t *storage; | LIBMTP_devicestorage_t *storage; | |||
/** | ||||
* The error stack. This shall be handled using the error getting | ||||
* and clearing functions, not by dereferencing this list. | ||||
*/ | ||||
LIBMTP_error_t *errorstack; | ||||
/** The maximum battery level for this device */ | /** The maximum battery level for this device */ | |||
uint8_t maximum_battery_level; | uint8_t maximum_battery_level; | |||
/** Default music folder */ | /** Default music folder */ | |||
uint32_t default_music_folder; | uint32_t default_music_folder; | |||
/** Default playlist folder */ | /** Default playlist folder */ | |||
uint32_t default_playlist_folder; | uint32_t default_playlist_folder; | |||
/** Default picture folder */ | /** Default picture folder */ | |||
uint32_t default_picture_folder; | uint32_t default_picture_folder; | |||
/** Default video folder */ | /** Default video folder */ | |||
uint32_t default_video_folder; | uint32_t default_video_folder; | |||
/** Default organizer folder */ | /** Default organizer folder */ | |||
uint32_t default_organizer_folder; | uint32_t default_organizer_folder; | |||
/** Default ZENcast folder (only Creative devices...) */ | /** Default ZENcast folder (only Creative devices...) */ | |||
uint32_t default_zencast_folder; | uint32_t default_zencast_folder; | |||
/** Default Album folder */ | /** Default Album folder */ | |||
uint32_t default_album_folder; | uint32_t default_album_folder; | |||
/** Default Text folder */ | /** Default Text folder */ | |||
uint32_t default_text_folder; | uint32_t default_text_folder; | |||
/** Per device iconv() converters, only used internally */ | /** Per device iconv() converters, only used internally */ | |||
void *cd; | void *cd; | |||
/** Pointer to next device in linked list; NULL if this is the last devic | ||||
e */ | ||||
LIBMTP_mtpdevice_t *next; | ||||
}; | }; | |||
/** | /** | |||
* MTP file struct | * MTP file struct | |||
*/ | */ | |||
struct LIBMTP_file_struct { | struct LIBMTP_file_struct { | |||
uint32_t item_id; /**< Unique item ID */ | uint32_t item_id; /**< Unique item ID */ | |||
uint32_t parent_id; /**< ID of parent folder */ | uint32_t parent_id; /**< ID of parent folder */ | |||
char *filename; /**< Filename of this file */ | char *filename; /**< Filename of this file */ | |||
uint64_t filesize; /**< Size of file in bytes */ | uint64_t filesize; /**< Size of file in bytes */ | |||
skipping to change at line 296 | skipping to change at line 346 | |||
*/ | */ | |||
void LIBMTP_Init(void); | void LIBMTP_Init(void); | |||
int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const); | int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const); | |||
/** | /** | |||
* @} | * @} | |||
* @defgroup basic The basic device management API. | * @defgroup basic The basic device management API. | |||
* @{ | * @{ | |||
*/ | */ | |||
int LIBMTP_Detect_Descriptor(uint16_t*,uint16_t*); | int LIBMTP_Detect_Descriptor(uint16_t*,uint16_t*); | |||
LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void); | LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void); | |||
LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **); | ||||
uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *); | ||||
void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*); | ||||
void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*); | void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*); | |||
void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*); | void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*); | |||
char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*); | char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*); | |||
char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*); | char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*); | |||
char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*); | char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*); | |||
char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); | char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); | |||
int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); | int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); | |||
char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); | char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); | |||
int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); | int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); | |||
int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, | int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, | |||
uint8_t * const, | uint8_t * const, | |||
uint8_t * const); | uint8_t * const); | |||
int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); | int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); | |||
int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); | int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); | |||
int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const); | int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const); | |||
LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*); | ||||
void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*); | ||||
void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*); | ||||
#define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 | #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 | |||
#define LIBMTP_STORAGE_SORTBY_FREESPACE 1 | #define LIBMTP_STORAGE_SORTBY_FREESPACE 1 | |||
#define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 | #define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 | |||
int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const); | int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const); | |||
int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *); | int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *); | |||
/** | /** | |||
* @} | * @} | |||
End of changes. 11 change blocks. | ||||
3 lines changed or deleted | 60 lines changed or added | |||