| OLD | NEW |
| 1 /** | 1 /** |
| 2 * \file libmtp.h | 2 * \file libmtp.h |
| 3 * Interface to the Media Transfer Protocol library. | 3 * Interface to the Media Transfer Protocol library. |
| 4 * | 4 * |
| 5 * Copyright (C) 2005-2012 Linus Walleij <triad@df.lth.se> | 5 * Copyright (C) 2005-2013 Linus Walleij <triad@df.lth.se> |
| 6 * Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com> | 6 * Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com> |
| 7 * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> | 7 * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> |
| 8 * Copyright (C) 2008 Florent Mertens <flomertens@gmail.com> | 8 * Copyright (C) 2008 Florent Mertens <flomertens@gmail.com> |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| 11 * modify it under the terms of the GNU Lesser General Public | 11 * modify it under the terms of the GNU Lesser General Public |
| 12 * License as published by the Free Software Foundation; either | 12 * License as published by the Free Software Foundation; either |
| 13 * version 2 of the License, or (at your option) any later version. | 13 * version 2 of the License, or (at your option) any later version. |
| 14 * | 14 * |
| 15 * This library is distributed in the hope that it will be useful, | 15 * This library is distributed in the hope that it will be useful, |
| 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 * Lesser General Public License for more details. | 18 * Lesser General Public License for more details. |
| 19 * | 19 * |
| 20 * You should have received a copy of the GNU Lesser General Public | 20 * You should have received a copy of the GNU Lesser General Public |
| 21 * License along with this library; if not, write to the | 21 * License along with this library; if not, write to the |
| 22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 23 * Boston, MA 02111-1307, USA. | 23 * Boston, MA 02111-1307, USA. |
| 24 * | 24 * |
| 25 * <code> | 25 * <code> |
| 26 * #include <libmtp.h> | 26 * #include <libmtp.h> |
| 27 * </code> | 27 * </code> |
| 28 */ | 28 */ |
| 29 #ifndef LIBMTP_H_INCLUSION_GUARD | 29 #ifndef LIBMTP_H_INCLUSION_GUARD |
| 30 #define LIBMTP_H_INCLUSION_GUARD | 30 #define LIBMTP_H_INCLUSION_GUARD |
| 31 | 31 |
| 32 #define LIBMTP_VERSION 1.1.5 | 32 #define LIBMTP_VERSION 1.1.12 |
| 33 #define LIBMTP_VERSION_STRING "1.1.5" | 33 #define LIBMTP_VERSION_STRING "1.1.12" |
| 34 | 34 |
| 35 /* This handles MSVC pecularities */ | 35 /* This handles MSVC pecularities */ |
| 36 #ifdef _MSC_VER | 36 #ifdef _MSC_VER |
| 37 #include <windows.h> | 37 #include <windows.h> |
| 38 #define __WIN32__ | 38 #define __WIN32__ |
| 39 #define snprintf _snprintf | 39 #define snprintf _snprintf |
| 40 #define ssize_t SSIZE_T | 40 #define ssize_t SSIZE_T |
| 41 /* | 41 /* |
| 42 * Types that do not exist in Windows | 42 * Types that do not exist in Windows |
| 43 * sys/types.h, but they exist in mingw32 | 43 * sys/types.h, but they exist in mingw32 |
| 44 * sys/types.h. | 44 * sys/types.h. |
| 45 */ | 45 */ |
| 46 typedef char int8_t; | 46 typedef char int8_t; |
| 47 typedef unsigned char uint8_t; | 47 typedef unsigned char uint8_t; |
| 48 typedef __int16 int16_t; | 48 typedef __int16 int16_t; |
| 49 typedef unsigned __int16 uint16_t; | 49 typedef unsigned __int16 uint16_t; |
| 50 typedef __int32 int32_t; | 50 typedef __int32 int32_t; |
| 51 typedef unsigned __int32 uint32_t; | 51 typedef unsigned __int32 uint32_t; |
| 52 typedef unsigned __int64 uint64_t; | 52 typedef unsigned __int64 uint64_t; |
| 53 #else |
| 54 #include <sys/time.h> |
| 53 #endif | 55 #endif |
| 54 | 56 |
| 55 #include <stdio.h> | 57 #include <stdio.h> |
| 56 #include <stdint.h> | 58 #include <stdint.h> |
| 57 /* We use time_t */ | 59 /* We use time_t */ |
| 58 #include <time.h> | 60 #include <time.h> |
| 59 | 61 |
| 60 /** | 62 /** |
| 61 * @defgroup types libmtp global type definitions | 63 * @defgroup types libmtp global type definitions |
| 62 * @{ | 64 * @{ |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 LIBMTP_DATATYPE_UINT8, | 398 LIBMTP_DATATYPE_UINT8, |
| 397 LIBMTP_DATATYPE_INT16, | 399 LIBMTP_DATATYPE_INT16, |
| 398 LIBMTP_DATATYPE_UINT16, | 400 LIBMTP_DATATYPE_UINT16, |
| 399 LIBMTP_DATATYPE_INT32, | 401 LIBMTP_DATATYPE_INT32, |
| 400 LIBMTP_DATATYPE_UINT32, | 402 LIBMTP_DATATYPE_UINT32, |
| 401 LIBMTP_DATATYPE_INT64, | 403 LIBMTP_DATATYPE_INT64, |
| 402 LIBMTP_DATATYPE_UINT64, | 404 LIBMTP_DATATYPE_UINT64, |
| 403 } LIBMTP_datatype_t; | 405 } LIBMTP_datatype_t; |
| 404 | 406 |
| 405 /** | 407 /** |
| 408 * These are device capabilities |
| 409 */ |
| 410 typedef enum { |
| 411 /** |
| 412 * This capability tells whether you can call the funcion getting |
| 413 * partial objects, @see LIBMTP_GetPartialObject() |
| 414 */ |
| 415 LIBMTP_DEVICECAP_GetPartialObject, |
| 416 /** |
| 417 * This capability tells whether you can call the function sending |
| 418 * partial objects. @see LIBMTP_SendPartialObject() |
| 419 */ |
| 420 LIBMTP_DEVICECAP_SendPartialObject, |
| 421 /** |
| 422 * This capability tells whether you can call the functions editing |
| 423 * objects in-place on a device. |
| 424 * @see LIBMTP_BeginEditObject() |
| 425 * @see LIBMTP_EndEditObject() |
| 426 * @see LIBMTP_TruncateObject() |
| 427 */ |
| 428 LIBMTP_DEVICECAP_EditObjects, |
| 429 } LIBMTP_devicecap_t; |
| 430 |
| 431 /** |
| 406 * These are the numbered error codes. You can also | 432 * These are the numbered error codes. You can also |
| 407 * get string representations for errors. | 433 * get string representations for errors. |
| 408 */ | 434 */ |
| 409 typedef enum { | 435 typedef enum { |
| 410 LIBMTP_ERROR_NONE, | 436 LIBMTP_ERROR_NONE, |
| 411 LIBMTP_ERROR_GENERAL, | 437 LIBMTP_ERROR_GENERAL, |
| 412 LIBMTP_ERROR_PTP_LAYER, | 438 LIBMTP_ERROR_PTP_LAYER, |
| 413 LIBMTP_ERROR_USB_LAYER, | 439 LIBMTP_ERROR_USB_LAYER, |
| 414 LIBMTP_ERROR_MEMORY_ALLOCATION, | 440 LIBMTP_ERROR_MEMORY_ALLOCATION, |
| 415 LIBMTP_ERROR_NO_DEVICE_ATTACHED, | 441 LIBMTP_ERROR_NO_DEVICE_ATTACHED, |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 LIBMTP_devicestorage_t *prev; /**< Previous storage */ | 790 LIBMTP_devicestorage_t *prev; /**< Previous storage */ |
| 765 }; | 791 }; |
| 766 | 792 |
| 767 /** | 793 /** |
| 768 * LIBMTP Event structure | 794 * LIBMTP Event structure |
| 769 * TODO: add all externally visible events here | 795 * TODO: add all externally visible events here |
| 770 */ | 796 */ |
| 771 enum LIBMTP_event_enum { | 797 enum LIBMTP_event_enum { |
| 772 LIBMTP_EVENT_NONE, | 798 LIBMTP_EVENT_NONE, |
| 773 LIBMTP_EVENT_STORE_ADDED, | 799 LIBMTP_EVENT_STORE_ADDED, |
| 800 LIBMTP_EVENT_STORE_REMOVED, |
| 801 LIBMTP_EVENT_OBJECT_ADDED, |
| 802 LIBMTP_EVENT_OBJECT_REMOVED, |
| 774 }; | 803 }; |
| 775 typedef enum LIBMTP_event_enum LIBMTP_event_t; | 804 typedef enum LIBMTP_event_enum LIBMTP_event_t; |
| 776 | 805 |
| 777 /** @} */ | 806 /** @} */ |
| 778 | 807 |
| 779 /* Make functions available for C++ */ | 808 /* Make functions available for C++ */ |
| 780 #ifdef __cplusplus | 809 #ifdef __cplusplus |
| 781 extern "C" { | 810 extern "C" { |
| 782 #endif | 811 #endif |
| 783 | 812 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); | 844 char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); |
| 816 int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); | 845 int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); |
| 817 char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); | 846 char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); |
| 818 int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); | 847 int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); |
| 819 int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, | 848 int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, |
| 820 uint8_t * const, | 849 uint8_t * const, |
| 821 uint8_t * const); | 850 uint8_t * const); |
| 822 int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); | 851 int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); |
| 823 int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); | 852 int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); |
| 824 int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint
16_t * const); | 853 int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint
16_t * const); |
| 854 int LIBMTP_Check_Capability(LIBMTP_mtpdevice_t *, LIBMTP_devicecap_t); |
| 825 LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*); | 855 LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*); |
| 826 void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*); | 856 void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*); |
| 827 void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*); | 857 void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*); |
| 828 | 858 |
| 829 #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 | 859 #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 |
| 830 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1 | 860 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1 |
| 831 #define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 | 861 #define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 |
| 832 | 862 |
| 833 int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const); | 863 int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const); |
| 834 int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *); | 864 int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 LIBMTP_folder_t *LIBMTP_new_folder_t(void); | 1002 LIBMTP_folder_t *LIBMTP_new_folder_t(void); |
| 973 void LIBMTP_destroy_folder_t(LIBMTP_folder_t*); | 1003 void LIBMTP_destroy_folder_t(LIBMTP_folder_t*); |
| 974 LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*); | 1004 LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*); |
| 975 LIBMTP_folder_t *LIBMTP_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t*, | 1005 LIBMTP_folder_t *LIBMTP_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t*, |
| 976 uint32_t const); | 1006 uint32_t const); |
| 977 LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const); | 1007 LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const); |
| 978 uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t); | 1008 uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t); |
| 979 int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *
); | 1009 int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *
); |
| 980 /** @} */ | 1010 /** @} */ |
| 981 | 1011 |
| 982 #if 0 | 1012 |
| 983 /** | 1013 /** |
| 984 * @} | 1014 * @} |
| 985 * @defgroup playlists The audio/video playlist management API. | 1015 * @defgroup playlists The audio/video playlist management API. |
| 986 * @{ | 1016 * @{ |
| 987 */ | 1017 */ |
| 988 LIBMTP_playlist_t *LIBMTP_new_playlist_t(void); | 1018 LIBMTP_playlist_t *LIBMTP_new_playlist_t(void); |
| 989 void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *); | 1019 void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *); |
| 990 LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *); | 1020 LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *); |
| 991 LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const); | 1021 LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const); |
| 992 int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); | 1022 int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); |
| 993 int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); | 1023 int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); |
| 994 int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const ch
ar *); | 1024 int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const ch
ar *); |
| 995 #endif | |
| 996 | 1025 |
| 997 /** | 1026 /** |
| 998 * @} | 1027 * @} |
| 999 * @defgroup albums The audio/video album management API. | 1028 * @defgroup albums The audio/video album management API. |
| 1000 * @{ | 1029 * @{ |
| 1001 */ | 1030 */ |
| 1002 LIBMTP_album_t *LIBMTP_new_album_t(void); | 1031 LIBMTP_album_t *LIBMTP_new_album_t(void); |
| 1003 void LIBMTP_destroy_album_t(LIBMTP_album_t *); | 1032 void LIBMTP_destroy_album_t(LIBMTP_album_t *); |
| 1004 LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *); | 1033 LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *); |
| 1005 LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *, uint32_t
const); | 1034 LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *, uint32_t
const); |
| 1006 LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const); | 1035 LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const); |
| 1007 int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const); | 1036 int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const); |
| 1008 int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const); | 1037 int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const); |
| 1009 int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *); | 1038 int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *); |
| 1010 | 1039 |
| 1011 /** | 1040 /** |
| 1012 * @} | 1041 * @} |
| 1013 * @defgroup objects The object management API. | 1042 * @defgroup objects The object management API. |
| 1014 * @{ | 1043 * @{ |
| 1015 */ | 1044 */ |
| 1016 int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); | 1045 int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); |
| 1017 int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); | 1046 int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); |
| 1047 int LIBMTP_GetPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, |
| 1048 uint64_t, uint32_t, |
| 1049 unsigned char **, unsigned int *); |
| 1050 int LIBMTP_SendPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, |
| 1051 uint64_t, unsigned char *, unsigned int); |
| 1052 int LIBMTP_BeginEditObject(LIBMTP_mtpdevice_t *, uint32_t const); |
| 1053 int LIBMTP_EndEditObject(LIBMTP_mtpdevice_t *, uint32_t const); |
| 1054 int LIBMTP_TruncateObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t); |
| 1018 | 1055 |
| 1019 /** | 1056 /** |
| 1020 * @} | 1057 * @} |
| 1021 * @defgroup files The events API. | 1058 * @defgroup files The events API. |
| 1022 * @{ | 1059 * @{ |
| 1023 */ | 1060 */ |
| 1061 typedef void(* LIBMTP_event_cb_fn) (int, LIBMTP_event_t, uint32_t, void *); |
| 1024 int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *, uint32_t *); | 1062 int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *, uint32_t *); |
| 1025 | 1063 int LIBMTP_Read_Event_Async(LIBMTP_mtpdevice_t *, LIBMTP_event_cb_fn, void *); |
| 1064 int LIBMTP_Handle_Events_Timeout_Completed(struct timeval *, int *); |
| 1026 | 1065 |
| 1027 /** @} */ | 1066 /** @} */ |
| 1028 | 1067 |
| 1029 /* End of C++ exports */ | 1068 /* End of C++ exports */ |
| 1030 #ifdef __cplusplus | 1069 #ifdef __cplusplus |
| 1031 } | 1070 } |
| 1032 #endif | 1071 #endif |
| 1033 | 1072 |
| 1034 #endif /* LIBMTP_H_INCLUSION_GUARD */ | 1073 #endif /* LIBMTP_H_INCLUSION_GUARD */ |
| 1074 |
| OLD | NEW |