| 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-2013 Linus Walleij <triad@df.lth.se> | 5 * Copyright (C) 2005-2012 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.12 | 32 #define LIBMTP_VERSION 1.1.5 |
| 33 #define LIBMTP_VERSION_STRING "1.1.12" | 33 #define LIBMTP_VERSION_STRING "1.1.5" |
| 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> | |
| 55 #endif | 53 #endif |
| 56 | 54 |
| 57 #include <stdio.h> | 55 #include <stdio.h> |
| 58 #include <stdint.h> | 56 #include <stdint.h> |
| 59 /* We use time_t */ | 57 /* We use time_t */ |
| 60 #include <time.h> | 58 #include <time.h> |
| 61 | 59 |
| 62 /** | 60 /** |
| 63 * @defgroup types libmtp global type definitions | 61 * @defgroup types libmtp global type definitions |
| 64 * @{ | 62 * @{ |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 LIBMTP_DATATYPE_UINT8, | 396 LIBMTP_DATATYPE_UINT8, |
| 399 LIBMTP_DATATYPE_INT16, | 397 LIBMTP_DATATYPE_INT16, |
| 400 LIBMTP_DATATYPE_UINT16, | 398 LIBMTP_DATATYPE_UINT16, |
| 401 LIBMTP_DATATYPE_INT32, | 399 LIBMTP_DATATYPE_INT32, |
| 402 LIBMTP_DATATYPE_UINT32, | 400 LIBMTP_DATATYPE_UINT32, |
| 403 LIBMTP_DATATYPE_INT64, | 401 LIBMTP_DATATYPE_INT64, |
| 404 LIBMTP_DATATYPE_UINT64, | 402 LIBMTP_DATATYPE_UINT64, |
| 405 } LIBMTP_datatype_t; | 403 } LIBMTP_datatype_t; |
| 406 | 404 |
| 407 /** | 405 /** |
| 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 /** | |
| 432 * These are the numbered error codes. You can also | 406 * These are the numbered error codes. You can also |
| 433 * get string representations for errors. | 407 * get string representations for errors. |
| 434 */ | 408 */ |
| 435 typedef enum { | 409 typedef enum { |
| 436 LIBMTP_ERROR_NONE, | 410 LIBMTP_ERROR_NONE, |
| 437 LIBMTP_ERROR_GENERAL, | 411 LIBMTP_ERROR_GENERAL, |
| 438 LIBMTP_ERROR_PTP_LAYER, | 412 LIBMTP_ERROR_PTP_LAYER, |
| 439 LIBMTP_ERROR_USB_LAYER, | 413 LIBMTP_ERROR_USB_LAYER, |
| 440 LIBMTP_ERROR_MEMORY_ALLOCATION, | 414 LIBMTP_ERROR_MEMORY_ALLOCATION, |
| 441 LIBMTP_ERROR_NO_DEVICE_ATTACHED, | 415 LIBMTP_ERROR_NO_DEVICE_ATTACHED, |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 LIBMTP_devicestorage_t *prev; /**< Previous storage */ | 764 LIBMTP_devicestorage_t *prev; /**< Previous storage */ |
| 791 }; | 765 }; |
| 792 | 766 |
| 793 /** | 767 /** |
| 794 * LIBMTP Event structure | 768 * LIBMTP Event structure |
| 795 * TODO: add all externally visible events here | 769 * TODO: add all externally visible events here |
| 796 */ | 770 */ |
| 797 enum LIBMTP_event_enum { | 771 enum LIBMTP_event_enum { |
| 798 LIBMTP_EVENT_NONE, | 772 LIBMTP_EVENT_NONE, |
| 799 LIBMTP_EVENT_STORE_ADDED, | 773 LIBMTP_EVENT_STORE_ADDED, |
| 800 LIBMTP_EVENT_STORE_REMOVED, | |
| 801 LIBMTP_EVENT_OBJECT_ADDED, | |
| 802 LIBMTP_EVENT_OBJECT_REMOVED, | |
| 803 }; | 774 }; |
| 804 typedef enum LIBMTP_event_enum LIBMTP_event_t; | 775 typedef enum LIBMTP_event_enum LIBMTP_event_t; |
| 805 | 776 |
| 806 /** @} */ | 777 /** @} */ |
| 807 | 778 |
| 808 /* Make functions available for C++ */ | 779 /* Make functions available for C++ */ |
| 809 #ifdef __cplusplus | 780 #ifdef __cplusplus |
| 810 extern "C" { | 781 extern "C" { |
| 811 #endif | 782 #endif |
| 812 | 783 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); | 815 char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); |
| 845 int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); | 816 int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); |
| 846 char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); | 817 char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); |
| 847 int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); | 818 int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); |
| 848 int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, | 819 int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, |
| 849 uint8_t * const, | 820 uint8_t * const, |
| 850 uint8_t * const); | 821 uint8_t * const); |
| 851 int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); | 822 int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); |
| 852 int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); | 823 int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); |
| 853 int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint
16_t * const); | 824 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); | |
| 855 LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*); | 825 LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*); |
| 856 void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*); | 826 void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*); |
| 857 void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*); | 827 void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*); |
| 858 | 828 |
| 859 #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 | 829 #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 |
| 860 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1 | 830 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1 |
| 861 #define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 | 831 #define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 |
| 862 | 832 |
| 863 int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const); | 833 int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const); |
| 864 int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *); | 834 int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 LIBMTP_folder_t *LIBMTP_new_folder_t(void); | 972 LIBMTP_folder_t *LIBMTP_new_folder_t(void); |
| 1003 void LIBMTP_destroy_folder_t(LIBMTP_folder_t*); | 973 void LIBMTP_destroy_folder_t(LIBMTP_folder_t*); |
| 1004 LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*); | 974 LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*); |
| 1005 LIBMTP_folder_t *LIBMTP_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t*, | 975 LIBMTP_folder_t *LIBMTP_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t*, |
| 1006 uint32_t const); | 976 uint32_t const); |
| 1007 LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const); | 977 LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const); |
| 1008 uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t); | 978 uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t); |
| 1009 int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *
); | 979 int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *
); |
| 1010 /** @} */ | 980 /** @} */ |
| 1011 | 981 |
| 1012 | 982 #if 0 |
| 1013 /** | 983 /** |
| 1014 * @} | 984 * @} |
| 1015 * @defgroup playlists The audio/video playlist management API. | 985 * @defgroup playlists The audio/video playlist management API. |
| 1016 * @{ | 986 * @{ |
| 1017 */ | 987 */ |
| 1018 LIBMTP_playlist_t *LIBMTP_new_playlist_t(void); | 988 LIBMTP_playlist_t *LIBMTP_new_playlist_t(void); |
| 1019 void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *); | 989 void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *); |
| 1020 LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *); | 990 LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *); |
| 1021 LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const); | 991 LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const); |
| 1022 int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); | 992 int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); |
| 1023 int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); | 993 int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); |
| 1024 int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const ch
ar *); | 994 int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const ch
ar *); |
| 995 #endif |
| 1025 | 996 |
| 1026 /** | 997 /** |
| 1027 * @} | 998 * @} |
| 1028 * @defgroup albums The audio/video album management API. | 999 * @defgroup albums The audio/video album management API. |
| 1029 * @{ | 1000 * @{ |
| 1030 */ | 1001 */ |
| 1031 LIBMTP_album_t *LIBMTP_new_album_t(void); | 1002 LIBMTP_album_t *LIBMTP_new_album_t(void); |
| 1032 void LIBMTP_destroy_album_t(LIBMTP_album_t *); | 1003 void LIBMTP_destroy_album_t(LIBMTP_album_t *); |
| 1033 LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *); | 1004 LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *); |
| 1034 LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *, uint32_t
const); | 1005 LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *, uint32_t
const); |
| 1035 LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const); | 1006 LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const); |
| 1036 int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const); | 1007 int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const); |
| 1037 int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const); | 1008 int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const); |
| 1038 int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *); | 1009 int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *); |
| 1039 | 1010 |
| 1040 /** | 1011 /** |
| 1041 * @} | 1012 * @} |
| 1042 * @defgroup objects The object management API. | 1013 * @defgroup objects The object management API. |
| 1043 * @{ | 1014 * @{ |
| 1044 */ | 1015 */ |
| 1045 int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); | 1016 int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); |
| 1046 int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); | 1017 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); | |
| 1055 | 1018 |
| 1056 /** | 1019 /** |
| 1057 * @} | 1020 * @} |
| 1058 * @defgroup files The events API. | 1021 * @defgroup files The events API. |
| 1059 * @{ | 1022 * @{ |
| 1060 */ | 1023 */ |
| 1061 typedef void(* LIBMTP_event_cb_fn) (int, LIBMTP_event_t, uint32_t, void *); | |
| 1062 int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *, uint32_t *); | 1024 int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *, uint32_t *); |
| 1063 int LIBMTP_Read_Event_Async(LIBMTP_mtpdevice_t *, LIBMTP_event_cb_fn, void *); | 1025 |
| 1064 int LIBMTP_Handle_Events_Timeout_Completed(struct timeval *, int *); | |
| 1065 | 1026 |
| 1066 /** @} */ | 1027 /** @} */ |
| 1067 | 1028 |
| 1068 /* End of C++ exports */ | 1029 /* End of C++ exports */ |
| 1069 #ifdef __cplusplus | 1030 #ifdef __cplusplus |
| 1070 } | 1031 } |
| 1071 #endif | 1032 #endif |
| 1072 | 1033 |
| 1073 #endif /* LIBMTP_H_INCLUSION_GUARD */ | 1034 #endif /* LIBMTP_H_INCLUSION_GUARD */ |
| 1074 | |
| OLD | NEW |