| 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, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 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); |
| 1039 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 *); |
| 1040 | 1010 |
| 1041 /** | 1011 /** |
| 1042 * @} | 1012 * @} |
| 1043 * @defgroup objects The object management API. | 1013 * @defgroup objects The object management API. |
| 1044 * @{ | 1014 * @{ |
| 1045 */ | 1015 */ |
| 1046 int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); | 1016 int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); |
| 1047 int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); | 1017 int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); |
| 1048 int LIBMTP_GetPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, | |
| 1049 uint64_t, uint32_t, | |
| 1050 unsigned char **, unsigned int *); | |
| 1051 int LIBMTP_SendPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, | |
| 1052 uint64_t, unsigned char *, unsigned int); | |
| 1053 int LIBMTP_BeginEditObject(LIBMTP_mtpdevice_t *, uint32_t const); | |
| 1054 int LIBMTP_EndEditObject(LIBMTP_mtpdevice_t *, uint32_t const); | |
| 1055 int LIBMTP_TruncateObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t); | |
| 1056 | 1018 |
| 1057 /** | 1019 /** |
| 1058 * @} | 1020 * @} |
| 1059 * @defgroup files The events API. | 1021 * @defgroup files The events API. |
| 1060 * @{ | 1022 * @{ |
| 1061 */ | 1023 */ |
| 1062 typedef void(* LIBMTP_event_cb_fn) (int, LIBMTP_event_t, uint32_t, void *); | |
| 1063 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 *); |
| 1064 int LIBMTP_Read_Event_Async(LIBMTP_mtpdevice_t *, LIBMTP_event_cb_fn, void *); | 1025 |
| 1065 int LIBMTP_Handle_Events_Timeout_Completed(struct timeval *, int *); | |
| 1066 | 1026 |
| 1067 /** @} */ | 1027 /** @} */ |
| 1068 | 1028 |
| 1069 /* End of C++ exports */ | 1029 /* End of C++ exports */ |
| 1070 #ifdef __cplusplus | 1030 #ifdef __cplusplus |
| 1071 } | 1031 } |
| 1072 #endif | 1032 #endif |
| 1073 | 1033 |
| 1074 #endif /* LIBMTP_H_INCLUSION_GUARD */ | 1034 #endif /* LIBMTP_H_INCLUSION_GUARD */ |
| 1075 | 1035 |
| OLD | NEW |