Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file libmtp.h |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 3 | * Interface to the Media Transfer Protocol library. |
| 4 | * |
Linus Walleij | a389561 | 2013-04-29 21:56:38 +0200 | [diff] [blame] | 5 | * Copyright (C) 2005-2013 Linus Walleij <triad@df.lth.se> |
Richard Low | 36e447c | 2008-01-20 15:24:55 +0000 | [diff] [blame] | 6 | * Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com> |
Linus Walleij | de8193f | 2008-01-27 14:55:31 +0000 | [diff] [blame] | 7 | * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> |
| 8 | * Copyright (C) 2008 Florent Mertens <flomertens@gmail.com> |
Linus Walleij | 7b7a0e2 | 2007-02-05 18:22:27 +0000 | [diff] [blame] | 9 | * |
| 10 | * This library is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU Lesser General Public |
| 12 | * License as published by the Free Software Foundation; either |
| 13 | * version 2 of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This library is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | * Lesser General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Lesser General Public |
| 21 | * License along with this library; if not, write to the |
| 22 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 23 | * Boston, MA 02111-1307, USA. |
| 24 | * |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 25 | * <code> |
| 26 | * #include <libmtp.h> |
| 27 | * </code> |
| 28 | */ |
| 29 | #ifndef LIBMTP_H_INCLUSION_GUARD |
| 30 | #define LIBMTP_H_INCLUSION_GUARD |
| 31 | |
| 32 | #define LIBMTP_VERSION @VERSION@ |
tedbullock | cd9f499 | 2007-03-29 06:00:40 +0000 | [diff] [blame] | 33 | #define LIBMTP_VERSION_STRING "@VERSION@" |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 34 | |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 35 | /* This handles MSVC pecularities */ |
| 36 | #ifdef _MSC_VER |
| 37 | #include <windows.h> |
| 38 | #define __WIN32__ |
| 39 | #define snprintf _snprintf |
| 40 | #define ssize_t SSIZE_T |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 41 | /* |
Linus Walleij | 5b4a4d2 | 2009-01-10 12:18:14 +0000 | [diff] [blame] | 42 | * Types that do not exist in Windows |
| 43 | * sys/types.h, but they exist in mingw32 |
| 44 | * sys/types.h. |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 45 | */ |
| 46 | typedef char int8_t; |
| 47 | typedef unsigned char uint8_t; |
| 48 | typedef __int16 int16_t; |
| 49 | typedef unsigned __int16 uint16_t; |
| 50 | typedef __int32 int32_t; |
| 51 | typedef unsigned __int32 uint32_t; |
| 52 | typedef unsigned __int64 uint64_t; |
Philip Langdale | 0a57651 | 2016-04-09 14:22:25 -0700 | [diff] [blame] | 53 | #else |
| 54 | #include <sys/time.h> |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 55 | #endif |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 56 | |
Linus Walleij | 5b4a4d2 | 2009-01-10 12:18:14 +0000 | [diff] [blame] | 57 | #include <stdio.h> |
Linus Walleij | 5b4a4d2 | 2009-01-10 12:18:14 +0000 | [diff] [blame] | 58 | #include <stdint.h> |
Linus Walleij | cbc5e81 | 2010-01-02 00:25:58 +0000 | [diff] [blame] | 59 | /* We use time_t */ |
| 60 | #include <time.h> |
Jerry Zhang | 60d0226 | 2017-06-08 18:19:59 -0700 | [diff] [blame] | 61 | #include <utime.h> |
Linus Walleij | 5b4a4d2 | 2009-01-10 12:18:14 +0000 | [diff] [blame] | 62 | |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 63 | /** |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 64 | * @defgroup types libmtp global type definitions |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 65 | * @{ |
nicklas79 | 0358408 | 2009-09-28 18:20:16 +0000 | [diff] [blame] | 66 | */ |
| 67 | |
| 68 | /** |
| 69 | * The debug flags defined here are the external flags used |
| 70 | * by the libmtp library interface. |
Catalin Patulea | 406d5f9 | 2012-07-20 19:00:24 -0400 | [diff] [blame] | 71 | * |
| 72 | * Please keep this list in sync with libmtp.c. |
nicklas79 | 0358408 | 2009-09-28 18:20:16 +0000 | [diff] [blame] | 73 | */ |
| 74 | #define LIBMTP_DEBUG_NONE 0x00 |
| 75 | #define LIBMTP_DEBUG_PTP 0x01 |
| 76 | #define LIBMTP_DEBUG_PLST 0x02 |
| 77 | #define LIBMTP_DEBUG_USB 0x04 |
| 78 | #define LIBMTP_DEBUG_DATA 0x08 |
| 79 | #define LIBMTP_DEBUG_ALL 0xFF |
| 80 | |
| 81 | |
| 82 | /** |
Linus Walleij | 83f57eb | 2006-05-31 19:57:56 +0000 | [diff] [blame] | 83 | * The filetypes defined here are the external types used |
| 84 | * by the libmtp library interface. The types used internally |
| 85 | * as PTP-defined enumerator types is something different. |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 86 | */ |
Linus Walleij | b9256fd | 2006-02-15 09:40:43 +0000 | [diff] [blame] | 87 | typedef enum { |
Linus Walleij | a8b8889 | 2011-03-03 19:58:26 +0100 | [diff] [blame] | 88 | LIBMTP_FILETYPE_FOLDER, |
Linus Walleij | f6bc178 | 2006-03-24 15:12:47 +0000 | [diff] [blame] | 89 | LIBMTP_FILETYPE_WAV, |
| 90 | LIBMTP_FILETYPE_MP3, |
| 91 | LIBMTP_FILETYPE_WMA, |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 92 | LIBMTP_FILETYPE_OGG, |
Linus Walleij | e46f12e | 2006-06-22 17:53:25 +0000 | [diff] [blame] | 93 | LIBMTP_FILETYPE_AUDIBLE, |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 94 | LIBMTP_FILETYPE_MP4, |
| 95 | LIBMTP_FILETYPE_UNDEF_AUDIO, |
Linus Walleij | f6bc178 | 2006-03-24 15:12:47 +0000 | [diff] [blame] | 96 | LIBMTP_FILETYPE_WMV, |
| 97 | LIBMTP_FILETYPE_AVI, |
| 98 | LIBMTP_FILETYPE_MPEG, |
| 99 | LIBMTP_FILETYPE_ASF, |
| 100 | LIBMTP_FILETYPE_QT, |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 101 | LIBMTP_FILETYPE_UNDEF_VIDEO, |
Linus Walleij | 83f57eb | 2006-05-31 19:57:56 +0000 | [diff] [blame] | 102 | LIBMTP_FILETYPE_JPEG, |
Linus Walleij | f6bc178 | 2006-03-24 15:12:47 +0000 | [diff] [blame] | 103 | LIBMTP_FILETYPE_JFIF, |
| 104 | LIBMTP_FILETYPE_TIFF, |
| 105 | LIBMTP_FILETYPE_BMP, |
| 106 | LIBMTP_FILETYPE_GIF, |
| 107 | LIBMTP_FILETYPE_PICT, |
| 108 | LIBMTP_FILETYPE_PNG, |
Linus Walleij | 16c51f0 | 2006-05-04 13:20:22 +0000 | [diff] [blame] | 109 | LIBMTP_FILETYPE_VCALENDAR1, |
| 110 | LIBMTP_FILETYPE_VCALENDAR2, |
| 111 | LIBMTP_FILETYPE_VCARD2, |
| 112 | LIBMTP_FILETYPE_VCARD3, |
| 113 | LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT, |
| 114 | LIBMTP_FILETYPE_WINEXEC, |
| 115 | LIBMTP_FILETYPE_TEXT, |
| 116 | LIBMTP_FILETYPE_HTML, |
Linus Walleij | a05b980 | 2006-12-08 08:50:30 +0000 | [diff] [blame] | 117 | LIBMTP_FILETYPE_FIRMWARE, |
Linus Walleij | 5fb4713 | 2006-12-30 15:35:48 +0000 | [diff] [blame] | 118 | LIBMTP_FILETYPE_AAC, |
| 119 | LIBMTP_FILETYPE_MEDIACARD, |
| 120 | LIBMTP_FILETYPE_FLAC, |
| 121 | LIBMTP_FILETYPE_MP2, |
| 122 | LIBMTP_FILETYPE_M4A, |
| 123 | LIBMTP_FILETYPE_DOC, |
| 124 | LIBMTP_FILETYPE_XML, |
| 125 | LIBMTP_FILETYPE_XLS, |
| 126 | LIBMTP_FILETYPE_PPT, |
| 127 | LIBMTP_FILETYPE_MHT, |
| 128 | LIBMTP_FILETYPE_JP2, |
| 129 | LIBMTP_FILETYPE_JPX, |
Richard Low | d3b1702 | 2009-04-11 12:37:39 +0000 | [diff] [blame] | 130 | LIBMTP_FILETYPE_ALBUM, |
| 131 | LIBMTP_FILETYPE_PLAYLIST, |
Linus Walleij | f6bc178 | 2006-03-24 15:12:47 +0000 | [diff] [blame] | 132 | LIBMTP_FILETYPE_UNKNOWN |
| 133 | } LIBMTP_filetype_t; |
Linus Walleij | 10e0ce7 | 2008-05-04 19:20:33 +0000 | [diff] [blame] | 134 | |
| 135 | /** |
Linus Walleij | 2832a20 | 2008-09-17 18:58:20 +0000 | [diff] [blame] | 136 | * \def LIBMTP_FILETYPE_IS_AUDIO |
| 137 | * Audio filetype test. |
| 138 | * |
| 139 | * For filetypes that can be either audio |
| 140 | * or video, use LIBMTP_FILETYPE_IS_AUDIOVIDEO |
Linus Walleij | 10e0ce7 | 2008-05-04 19:20:33 +0000 | [diff] [blame] | 141 | */ |
| 142 | #define LIBMTP_FILETYPE_IS_AUDIO(a)\ |
| 143 | (a == LIBMTP_FILETYPE_WAV ||\ |
| 144 | a == LIBMTP_FILETYPE_MP3 ||\ |
| 145 | a == LIBMTP_FILETYPE_MP2 ||\ |
| 146 | a == LIBMTP_FILETYPE_WMA ||\ |
| 147 | a == LIBMTP_FILETYPE_OGG ||\ |
| 148 | a == LIBMTP_FILETYPE_FLAC ||\ |
| 149 | a == LIBMTP_FILETYPE_AAC ||\ |
| 150 | a == LIBMTP_FILETYPE_M4A ||\ |
Richard Low | 6f07084 | 2009-05-03 10:26:16 +0000 | [diff] [blame] | 151 | a == LIBMTP_FILETYPE_AUDIBLE ||\ |
Linus Walleij | 10e0ce7 | 2008-05-04 19:20:33 +0000 | [diff] [blame] | 152 | a == LIBMTP_FILETYPE_UNDEF_AUDIO) |
Linus Walleij | 2832a20 | 2008-09-17 18:58:20 +0000 | [diff] [blame] | 153 | |
| 154 | /** |
| 155 | * \def LIBMTP_FILETYPE_IS_VIDEO |
| 156 | * Video filetype test. |
| 157 | * |
| 158 | * For filetypes that can be either audio |
| 159 | * or video, use LIBMTP_FILETYPE_IS_AUDIOVIDEO |
| 160 | */ |
Linus Walleij | 10e0ce7 | 2008-05-04 19:20:33 +0000 | [diff] [blame] | 161 | #define LIBMTP_FILETYPE_IS_VIDEO(a)\ |
| 162 | (a == LIBMTP_FILETYPE_WMV ||\ |
| 163 | a == LIBMTP_FILETYPE_AVI ||\ |
| 164 | a == LIBMTP_FILETYPE_MPEG ||\ |
| 165 | a == LIBMTP_FILETYPE_UNDEF_VIDEO) |
Linus Walleij | 2832a20 | 2008-09-17 18:58:20 +0000 | [diff] [blame] | 166 | |
| 167 | /** |
| 168 | * \def LIBMTP_FILETYPE_IS_AUDIOVIDEO |
| 169 | * Audio and&slash;or video filetype test. |
| 170 | */ |
Linus Walleij | 10e0ce7 | 2008-05-04 19:20:33 +0000 | [diff] [blame] | 171 | #define LIBMTP_FILETYPE_IS_AUDIOVIDEO(a)\ |
| 172 | (a == LIBMTP_FILETYPE_MP4 ||\ |
| 173 | a == LIBMTP_FILETYPE_ASF ||\ |
| 174 | a == LIBMTP_FILETYPE_QT) |
Linus Walleij | 2832a20 | 2008-09-17 18:58:20 +0000 | [diff] [blame] | 175 | |
| 176 | /** |
| 177 | * \def LIBMTP_FILETYPE_IS_TRACK |
| 178 | * Test if filetype is a track. |
| 179 | * Use this to determine if the File API or Track API |
| 180 | * should be used to upload or download an object. |
| 181 | */ |
Linus Walleij | 10e0ce7 | 2008-05-04 19:20:33 +0000 | [diff] [blame] | 182 | #define LIBMTP_FILETYPE_IS_TRACK(a)\ |
| 183 | (LIBMTP_FILETYPE_IS_AUDIO(a) ||\ |
| 184 | LIBMTP_FILETYPE_IS_VIDEO(a) ||\ |
| 185 | LIBMTP_FILETYPE_IS_AUDIOVIDEO(a)) |
| 186 | |
Linus Walleij | 2715c44 | 2007-01-20 22:35:29 +0000 | [diff] [blame] | 187 | /** |
Linus Walleij | 2832a20 | 2008-09-17 18:58:20 +0000 | [diff] [blame] | 188 | * \def LIBMTP_FILETYPE_IS_IMAGE |
| 189 | * Image filetype test |
| 190 | */ |
| 191 | #define LIBMTP_FILETYPE_IS_IMAGE(a)\ |
| 192 | (a == LIBMTP_FILETYPE_JPEG ||\ |
| 193 | a == LIBMTP_FILETYPE_JFIF ||\ |
| 194 | a == LIBMTP_FILETYPE_TIFF ||\ |
| 195 | a == LIBMTP_FILETYPE_BMP ||\ |
| 196 | a == LIBMTP_FILETYPE_GIF ||\ |
| 197 | a == LIBMTP_FILETYPE_PICT ||\ |
| 198 | a == LIBMTP_FILETYPE_PNG ||\ |
| 199 | a == LIBMTP_FILETYPE_JP2 ||\ |
| 200 | a == LIBMTP_FILETYPE_JPX ||\ |
| 201 | a == LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT) |
| 202 | |
| 203 | /** |
| 204 | * \def LIBMTP_FILETYPE_IS_ADDRESSBOOK |
| 205 | * Addressbook and Business card filetype test |
| 206 | */ |
| 207 | #define LIBMTP_FILETYPE_IS_ADDRESSBOOK(a)\ |
| 208 | (a == LIBMTP_FILETYPE_VCARD2 ||\ |
Linus Walleij | f942481 | 2012-06-27 22:16:57 +0200 | [diff] [blame] | 209 | a == LIBMTP_FILETYPE_VCARD3) |
Linus Walleij | 2832a20 | 2008-09-17 18:58:20 +0000 | [diff] [blame] | 210 | |
| 211 | /** |
| 212 | * \def LIBMTP_FILETYPE_IS_CALENDAR |
| 213 | * Calendar and Appointment filetype test |
| 214 | */ |
| 215 | #define LIBMTP_FILETYPE_IS_CALENDAR(a)\ |
| 216 | (a == LIBMTP_FILETYPE_VCALENDAR1 ||\ |
| 217 | a == LIBMTP_FILETYPE_VCALENDAR2) |
| 218 | |
| 219 | /** |
Richard Low | 6f07084 | 2009-05-03 10:26:16 +0000 | [diff] [blame] | 220 | * The properties defined here are the external types used |
| 221 | * by the libmtp library interface. |
| 222 | */ |
| 223 | typedef enum { |
| 224 | LIBMTP_PROPERTY_StorageID, |
| 225 | LIBMTP_PROPERTY_ObjectFormat, |
| 226 | LIBMTP_PROPERTY_ProtectionStatus, |
| 227 | LIBMTP_PROPERTY_ObjectSize, |
| 228 | LIBMTP_PROPERTY_AssociationType, |
| 229 | LIBMTP_PROPERTY_AssociationDesc, |
| 230 | LIBMTP_PROPERTY_ObjectFileName, |
| 231 | LIBMTP_PROPERTY_DateCreated, |
| 232 | LIBMTP_PROPERTY_DateModified, |
| 233 | LIBMTP_PROPERTY_Keywords, |
| 234 | LIBMTP_PROPERTY_ParentObject, |
| 235 | LIBMTP_PROPERTY_AllowedFolderContents, |
| 236 | LIBMTP_PROPERTY_Hidden, |
| 237 | LIBMTP_PROPERTY_SystemObject, |
| 238 | LIBMTP_PROPERTY_PersistantUniqueObjectIdentifier, |
| 239 | LIBMTP_PROPERTY_SyncID, |
| 240 | LIBMTP_PROPERTY_PropertyBag, |
| 241 | LIBMTP_PROPERTY_Name, |
| 242 | LIBMTP_PROPERTY_CreatedBy, |
| 243 | LIBMTP_PROPERTY_Artist, |
| 244 | LIBMTP_PROPERTY_DateAuthored, |
| 245 | LIBMTP_PROPERTY_Description, |
| 246 | LIBMTP_PROPERTY_URLReference, |
| 247 | LIBMTP_PROPERTY_LanguageLocale, |
| 248 | LIBMTP_PROPERTY_CopyrightInformation, |
| 249 | LIBMTP_PROPERTY_Source, |
| 250 | LIBMTP_PROPERTY_OriginLocation, |
| 251 | LIBMTP_PROPERTY_DateAdded, |
| 252 | LIBMTP_PROPERTY_NonConsumable, |
| 253 | LIBMTP_PROPERTY_CorruptOrUnplayable, |
| 254 | LIBMTP_PROPERTY_ProducerSerialNumber, |
| 255 | LIBMTP_PROPERTY_RepresentativeSampleFormat, |
| 256 | LIBMTP_PROPERTY_RepresentativeSampleSize, |
| 257 | LIBMTP_PROPERTY_RepresentativeSampleHeight, |
| 258 | LIBMTP_PROPERTY_RepresentativeSampleWidth, |
| 259 | LIBMTP_PROPERTY_RepresentativeSampleDuration, |
| 260 | LIBMTP_PROPERTY_RepresentativeSampleData, |
| 261 | LIBMTP_PROPERTY_Width, |
| 262 | LIBMTP_PROPERTY_Height, |
| 263 | LIBMTP_PROPERTY_Duration, |
| 264 | LIBMTP_PROPERTY_Rating, |
| 265 | LIBMTP_PROPERTY_Track, |
| 266 | LIBMTP_PROPERTY_Genre, |
| 267 | LIBMTP_PROPERTY_Credits, |
| 268 | LIBMTP_PROPERTY_Lyrics, |
| 269 | LIBMTP_PROPERTY_SubscriptionContentID, |
| 270 | LIBMTP_PROPERTY_ProducedBy, |
| 271 | LIBMTP_PROPERTY_UseCount, |
| 272 | LIBMTP_PROPERTY_SkipCount, |
| 273 | LIBMTP_PROPERTY_LastAccessed, |
| 274 | LIBMTP_PROPERTY_ParentalRating, |
| 275 | LIBMTP_PROPERTY_MetaGenre, |
| 276 | LIBMTP_PROPERTY_Composer, |
| 277 | LIBMTP_PROPERTY_EffectiveRating, |
| 278 | LIBMTP_PROPERTY_Subtitle, |
| 279 | LIBMTP_PROPERTY_OriginalReleaseDate, |
| 280 | LIBMTP_PROPERTY_AlbumName, |
| 281 | LIBMTP_PROPERTY_AlbumArtist, |
| 282 | LIBMTP_PROPERTY_Mood, |
| 283 | LIBMTP_PROPERTY_DRMStatus, |
| 284 | LIBMTP_PROPERTY_SubDescription, |
| 285 | LIBMTP_PROPERTY_IsCropped, |
| 286 | LIBMTP_PROPERTY_IsColorCorrected, |
| 287 | LIBMTP_PROPERTY_ImageBitDepth, |
| 288 | LIBMTP_PROPERTY_Fnumber, |
| 289 | LIBMTP_PROPERTY_ExposureTime, |
| 290 | LIBMTP_PROPERTY_ExposureIndex, |
| 291 | LIBMTP_PROPERTY_DisplayName, |
| 292 | LIBMTP_PROPERTY_BodyText, |
| 293 | LIBMTP_PROPERTY_Subject, |
| 294 | LIBMTP_PROPERTY_Priority, |
| 295 | LIBMTP_PROPERTY_GivenName, |
| 296 | LIBMTP_PROPERTY_MiddleNames, |
| 297 | LIBMTP_PROPERTY_FamilyName, |
| 298 | LIBMTP_PROPERTY_Prefix, |
| 299 | LIBMTP_PROPERTY_Suffix, |
| 300 | LIBMTP_PROPERTY_PhoneticGivenName, |
| 301 | LIBMTP_PROPERTY_PhoneticFamilyName, |
| 302 | LIBMTP_PROPERTY_EmailPrimary, |
| 303 | LIBMTP_PROPERTY_EmailPersonal1, |
| 304 | LIBMTP_PROPERTY_EmailPersonal2, |
| 305 | LIBMTP_PROPERTY_EmailBusiness1, |
| 306 | LIBMTP_PROPERTY_EmailBusiness2, |
| 307 | LIBMTP_PROPERTY_EmailOthers, |
| 308 | LIBMTP_PROPERTY_PhoneNumberPrimary, |
| 309 | LIBMTP_PROPERTY_PhoneNumberPersonal, |
| 310 | LIBMTP_PROPERTY_PhoneNumberPersonal2, |
| 311 | LIBMTP_PROPERTY_PhoneNumberBusiness, |
| 312 | LIBMTP_PROPERTY_PhoneNumberBusiness2, |
| 313 | LIBMTP_PROPERTY_PhoneNumberMobile, |
| 314 | LIBMTP_PROPERTY_PhoneNumberMobile2, |
| 315 | LIBMTP_PROPERTY_FaxNumberPrimary, |
| 316 | LIBMTP_PROPERTY_FaxNumberPersonal, |
| 317 | LIBMTP_PROPERTY_FaxNumberBusiness, |
| 318 | LIBMTP_PROPERTY_PagerNumber, |
| 319 | LIBMTP_PROPERTY_PhoneNumberOthers, |
| 320 | LIBMTP_PROPERTY_PrimaryWebAddress, |
| 321 | LIBMTP_PROPERTY_PersonalWebAddress, |
| 322 | LIBMTP_PROPERTY_BusinessWebAddress, |
| 323 | LIBMTP_PROPERTY_InstantMessengerAddress, |
| 324 | LIBMTP_PROPERTY_InstantMessengerAddress2, |
| 325 | LIBMTP_PROPERTY_InstantMessengerAddress3, |
| 326 | LIBMTP_PROPERTY_PostalAddressPersonalFull, |
| 327 | LIBMTP_PROPERTY_PostalAddressPersonalFullLine1, |
| 328 | LIBMTP_PROPERTY_PostalAddressPersonalFullLine2, |
| 329 | LIBMTP_PROPERTY_PostalAddressPersonalFullCity, |
| 330 | LIBMTP_PROPERTY_PostalAddressPersonalFullRegion, |
| 331 | LIBMTP_PROPERTY_PostalAddressPersonalFullPostalCode, |
| 332 | LIBMTP_PROPERTY_PostalAddressPersonalFullCountry, |
| 333 | LIBMTP_PROPERTY_PostalAddressBusinessFull, |
| 334 | LIBMTP_PROPERTY_PostalAddressBusinessLine1, |
| 335 | LIBMTP_PROPERTY_PostalAddressBusinessLine2, |
| 336 | LIBMTP_PROPERTY_PostalAddressBusinessCity, |
| 337 | LIBMTP_PROPERTY_PostalAddressBusinessRegion, |
| 338 | LIBMTP_PROPERTY_PostalAddressBusinessPostalCode, |
| 339 | LIBMTP_PROPERTY_PostalAddressBusinessCountry, |
| 340 | LIBMTP_PROPERTY_PostalAddressOtherFull, |
| 341 | LIBMTP_PROPERTY_PostalAddressOtherLine1, |
| 342 | LIBMTP_PROPERTY_PostalAddressOtherLine2, |
| 343 | LIBMTP_PROPERTY_PostalAddressOtherCity, |
| 344 | LIBMTP_PROPERTY_PostalAddressOtherRegion, |
| 345 | LIBMTP_PROPERTY_PostalAddressOtherPostalCode, |
| 346 | LIBMTP_PROPERTY_PostalAddressOtherCountry, |
| 347 | LIBMTP_PROPERTY_OrganizationName, |
| 348 | LIBMTP_PROPERTY_PhoneticOrganizationName, |
| 349 | LIBMTP_PROPERTY_Role, |
| 350 | LIBMTP_PROPERTY_Birthdate, |
| 351 | LIBMTP_PROPERTY_MessageTo, |
| 352 | LIBMTP_PROPERTY_MessageCC, |
| 353 | LIBMTP_PROPERTY_MessageBCC, |
| 354 | LIBMTP_PROPERTY_MessageRead, |
| 355 | LIBMTP_PROPERTY_MessageReceivedTime, |
| 356 | LIBMTP_PROPERTY_MessageSender, |
| 357 | LIBMTP_PROPERTY_ActivityBeginTime, |
| 358 | LIBMTP_PROPERTY_ActivityEndTime, |
| 359 | LIBMTP_PROPERTY_ActivityLocation, |
| 360 | LIBMTP_PROPERTY_ActivityRequiredAttendees, |
| 361 | LIBMTP_PROPERTY_ActivityOptionalAttendees, |
| 362 | LIBMTP_PROPERTY_ActivityResources, |
| 363 | LIBMTP_PROPERTY_ActivityAccepted, |
| 364 | LIBMTP_PROPERTY_Owner, |
| 365 | LIBMTP_PROPERTY_Editor, |
| 366 | LIBMTP_PROPERTY_Webmaster, |
| 367 | LIBMTP_PROPERTY_URLSource, |
| 368 | LIBMTP_PROPERTY_URLDestination, |
| 369 | LIBMTP_PROPERTY_TimeBookmark, |
| 370 | LIBMTP_PROPERTY_ObjectBookmark, |
| 371 | LIBMTP_PROPERTY_ByteBookmark, |
| 372 | LIBMTP_PROPERTY_LastBuildDate, |
| 373 | LIBMTP_PROPERTY_TimetoLive, |
| 374 | LIBMTP_PROPERTY_MediaGUID, |
| 375 | LIBMTP_PROPERTY_TotalBitRate, |
| 376 | LIBMTP_PROPERTY_BitRateType, |
| 377 | LIBMTP_PROPERTY_SampleRate, |
| 378 | LIBMTP_PROPERTY_NumberOfChannels, |
| 379 | LIBMTP_PROPERTY_AudioBitDepth, |
| 380 | LIBMTP_PROPERTY_ScanDepth, |
| 381 | LIBMTP_PROPERTY_AudioWAVECodec, |
| 382 | LIBMTP_PROPERTY_AudioBitRate, |
| 383 | LIBMTP_PROPERTY_VideoFourCCCodec, |
| 384 | LIBMTP_PROPERTY_VideoBitRate, |
| 385 | LIBMTP_PROPERTY_FramesPerThousandSeconds, |
| 386 | LIBMTP_PROPERTY_KeyFrameDistance, |
| 387 | LIBMTP_PROPERTY_BufferSize, |
| 388 | LIBMTP_PROPERTY_EncodingQuality, |
| 389 | LIBMTP_PROPERTY_EncodingProfile, |
| 390 | LIBMTP_PROPERTY_BuyFlag, |
| 391 | LIBMTP_PROPERTY_UNKNOWN |
| 392 | } LIBMTP_property_t; |
| 393 | |
| 394 | /** |
| 395 | * These are the data types |
| 396 | */ |
| 397 | typedef enum { |
| 398 | LIBMTP_DATATYPE_INT8, |
| 399 | LIBMTP_DATATYPE_UINT8, |
| 400 | LIBMTP_DATATYPE_INT16, |
| 401 | LIBMTP_DATATYPE_UINT16, |
| 402 | LIBMTP_DATATYPE_INT32, |
| 403 | LIBMTP_DATATYPE_UINT32, |
| 404 | LIBMTP_DATATYPE_INT64, |
| 405 | LIBMTP_DATATYPE_UINT64, |
| 406 | } LIBMTP_datatype_t; |
| 407 | |
| 408 | /** |
Linus Walleij | a389561 | 2013-04-29 21:56:38 +0200 | [diff] [blame] | 409 | * These are device capabilities |
| 410 | */ |
| 411 | typedef enum { |
| 412 | /** |
| 413 | * This capability tells whether you can call the funcion getting |
| 414 | * partial objects, @see LIBMTP_GetPartialObject() |
| 415 | */ |
| 416 | LIBMTP_DEVICECAP_GetPartialObject, |
| 417 | /** |
| 418 | * This capability tells whether you can call the function sending |
| 419 | * partial objects. @see LIBMTP_SendPartialObject() |
| 420 | */ |
| 421 | LIBMTP_DEVICECAP_SendPartialObject, |
| 422 | /** |
| 423 | * This capability tells whether you can call the functions editing |
| 424 | * objects in-place on a device. |
| 425 | * @see LIBMTP_BeginEditObject() |
| 426 | * @see LIBMTP_EndEditObject() |
| 427 | * @see LIBMTP_TruncateObject() |
| 428 | */ |
| 429 | LIBMTP_DEVICECAP_EditObjects, |
| 430 | } LIBMTP_devicecap_t; |
| 431 | |
| 432 | /** |
Linus Walleij | 2715c44 | 2007-01-20 22:35:29 +0000 | [diff] [blame] | 433 | * These are the numbered error codes. You can also |
| 434 | * get string representations for errors. |
| 435 | */ |
| 436 | typedef enum { |
| 437 | LIBMTP_ERROR_NONE, |
Linus Walleij | 2e1c8a3 | 2007-01-22 06:46:08 +0000 | [diff] [blame] | 438 | LIBMTP_ERROR_GENERAL, |
Linus Walleij | 070e9b4 | 2007-01-22 08:49:28 +0000 | [diff] [blame] | 439 | LIBMTP_ERROR_PTP_LAYER, |
| 440 | LIBMTP_ERROR_USB_LAYER, |
| 441 | LIBMTP_ERROR_MEMORY_ALLOCATION, |
tedbullock | 433d217 | 2007-02-23 22:39:12 +0000 | [diff] [blame] | 442 | LIBMTP_ERROR_NO_DEVICE_ATTACHED, |
Linus Walleij | 550d6d5 | 2007-01-24 14:32:51 +0000 | [diff] [blame] | 443 | LIBMTP_ERROR_STORAGE_FULL, |
Linus Walleij | 25d33b5 | 2007-09-16 21:36:19 +0000 | [diff] [blame] | 444 | LIBMTP_ERROR_CONNECTING, |
| 445 | LIBMTP_ERROR_CANCELLED |
Linus Walleij | 2715c44 | 2007-01-20 22:35:29 +0000 | [diff] [blame] | 446 | } LIBMTP_error_number_t; |
Linus Walleij | 38d7ee8 | 2010-07-24 22:17:21 +0000 | [diff] [blame] | 447 | |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 448 | typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t; /**< @see LIBMTP_device_entry_struct */ |
Linus Walleij | 63fd1e6 | 2008-04-23 23:49:43 +0000 | [diff] [blame] | 449 | typedef struct LIBMTP_raw_device_struct LIBMTP_raw_device_t; /**< @see LIBMTP_raw_device_struct */ |
Linus Walleij | 2715c44 | 2007-01-20 22:35:29 +0000 | [diff] [blame] | 450 | typedef struct LIBMTP_error_struct LIBMTP_error_t; /**< @see LIBMTP_error_struct */ |
Richard Low | 6f07084 | 2009-05-03 10:26:16 +0000 | [diff] [blame] | 451 | typedef struct LIBMTP_allowed_values_struct LIBMTP_allowed_values_t; /**< @see LIBMTP_allowed_values_struct */ |
Linus Walleij | 38d7ee8 | 2010-07-24 22:17:21 +0000 | [diff] [blame] | 452 | typedef struct LIBMTP_device_extension_struct LIBMTP_device_extension_t; /** < @see LIBMTP_device_extension_struct */ |
Linus Walleij | b9256fd | 2006-02-15 09:40:43 +0000 | [diff] [blame] | 453 | typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t; /**< @see LIBMTP_mtpdevice_struct */ |
Linus Walleij | f6bc178 | 2006-03-24 15:12:47 +0000 | [diff] [blame] | 454 | typedef struct LIBMTP_file_struct LIBMTP_file_t; /**< @see LIBMTP_file_struct */ |
| 455 | typedef struct LIBMTP_track_struct LIBMTP_track_t; /**< @see LIBMTP_track_struct */ |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 456 | typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t; /**< @see LIBMTP_playlist_struct */ |
Linus Walleij | 0c33ec0 | 2006-10-27 10:15:40 +0000 | [diff] [blame] | 457 | typedef struct LIBMTP_album_struct LIBMTP_album_t; /**< @see LIBMTP_album_struct */ |
ravelox | d9a2864 | 2006-05-26 23:42:22 +0000 | [diff] [blame] | 458 | typedef struct LIBMTP_folder_struct LIBMTP_folder_t; /**< @see LIBMTP_folder_t */ |
| 459 | typedef struct LIBMTP_object_struct LIBMTP_object_t; /**< @see LIBMTP_object_t */ |
rreardon | 5332f9c | 2006-12-05 10:18:23 +0000 | [diff] [blame] | 460 | typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t; /**< @see LIBMTP_filesample_t */ |
Linus Walleij | 9e1b081 | 2006-12-12 19:22:02 +0000 | [diff] [blame] | 461 | typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t; /**< @see LIBMTP_devicestorage_t */ |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 462 | |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 463 | /** |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 464 | * The callback type definition. Notice that a progress percentage ratio |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 465 | * is easy to calculate by dividing <code>sent</code> by |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 466 | * <code>total</code>. |
| 467 | * @param sent the number of bytes sent so far |
| 468 | * @param total the total number of bytes to send |
| 469 | * @param data a user-defined dereferencable pointer |
| 470 | * @return if anything else than 0 is returned, the current transfer will be |
| 471 | * interrupted / cancelled. |
| 472 | */ |
Linus Walleij | d214b9b | 2006-08-26 22:08:37 +0000 | [diff] [blame] | 473 | typedef int (* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total, |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 474 | void const * const data); |
| 475 | |
Richard Low | 6f07084 | 2009-05-03 10:26:16 +0000 | [diff] [blame] | 476 | /** |
| 477 | * Callback function for get by handler function |
| 478 | * @param params the device parameters |
| 479 | * @param priv a user-defined dereferencable pointer |
| 480 | * @param wantlen the number of bytes wanted |
| 481 | * @param data a buffer to write the data to |
| 482 | * @param gotlen pointer to the number of bytes actually written |
| 483 | * to data |
| 484 | * @return LIBMTP_HANDLER_RETURN_OK if successful, |
| 485 | * LIBMTP_HANDLER_RETURN_ERROR on error or |
| 486 | * LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer |
| 487 | */ |
| 488 | typedef uint16_t (* MTPDataGetFunc) (void* params, void* priv, |
Richard Low | 5b4023c | 2009-04-16 19:14:38 +0000 | [diff] [blame] | 489 | uint32_t wantlen, unsigned char *data, uint32_t *gotlen); |
Richard Low | d3b1702 | 2009-04-11 12:37:39 +0000 | [diff] [blame] | 490 | |
Richard Low | 6f07084 | 2009-05-03 10:26:16 +0000 | [diff] [blame] | 491 | /** |
| 492 | * Callback function for put by handler function |
| 493 | * @param params the device parameters |
| 494 | * @param priv a user-defined dereferencable pointer |
| 495 | * @param sendlen the number of bytes available |
| 496 | * @param data a buffer to read the data from |
| 497 | * @param putlen pointer to the number of bytes actually read |
| 498 | * from data |
| 499 | * @return LIBMTP_HANDLER_RETURN_OK if successful, |
| 500 | * LIBMTP_HANDLER_RETURN_ERROR on error or |
| 501 | * LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer |
| 502 | */ |
| 503 | typedef uint16_t (* MTPDataPutFunc) (void* params, void* priv, |
Richard Low | 5b4023c | 2009-04-16 19:14:38 +0000 | [diff] [blame] | 504 | uint32_t sendlen, unsigned char *data, uint32_t *putlen); |
Richard Low | d3b1702 | 2009-04-11 12:37:39 +0000 | [diff] [blame] | 505 | |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 506 | /** |
Richard Low | 6f07084 | 2009-05-03 10:26:16 +0000 | [diff] [blame] | 507 | * The return codes for the get/put functions |
| 508 | */ |
| 509 | #define LIBMTP_HANDLER_RETURN_OK 0 |
| 510 | #define LIBMTP_HANDLER_RETURN_ERROR 1 |
| 511 | #define LIBMTP_HANDLER_RETURN_CANCEL 2 |
| 512 | |
| 513 | /** |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 514 | * @} |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 515 | * @defgroup structar libmtp data structures |
| 516 | * @{ |
| 517 | */ |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 518 | |
| 519 | /** |
Linus Walleij | 2715c44 | 2007-01-20 22:35:29 +0000 | [diff] [blame] | 520 | * A data structure to hold MTP device entries. |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 521 | */ |
| 522 | struct LIBMTP_device_entry_struct { |
jefferai | da9687e | 2007-10-16 16:44:15 +0000 | [diff] [blame] | 523 | char *vendor; /**< The vendor of this device */ |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 524 | uint16_t vendor_id; /**< Vendor ID for this device */ |
jefferai | da9687e | 2007-10-16 16:44:15 +0000 | [diff] [blame] | 525 | char *product; /**< The product name of this device */ |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 526 | uint16_t product_id; /**< Product ID for this device */ |
Linus Walleij | 0558ac5 | 2006-09-07 06:55:03 +0000 | [diff] [blame] | 527 | uint32_t device_flags; /**< Bugs, device specifics etc */ |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 528 | }; |
| 529 | |
| 530 | /** |
Linus Walleij | 63fd1e6 | 2008-04-23 23:49:43 +0000 | [diff] [blame] | 531 | * A data structure to hold a raw MTP device connected |
| 532 | * to the bus. |
| 533 | */ |
| 534 | struct LIBMTP_raw_device_struct { |
| 535 | LIBMTP_device_entry_t device_entry; /**< The device entry for this raw device */ |
| 536 | uint32_t bus_location; /**< Location of the bus, if device available */ |
| 537 | uint8_t devnum; /**< Device number on the bus, if device available */ |
| 538 | }; |
| 539 | |
| 540 | /** |
Linus Walleij | 2715c44 | 2007-01-20 22:35:29 +0000 | [diff] [blame] | 541 | * A data structure to hold errors from the library. |
| 542 | */ |
| 543 | struct LIBMTP_error_struct { |
| 544 | LIBMTP_error_number_t errornumber; |
| 545 | char *error_text; |
| 546 | LIBMTP_error_t *next; |
| 547 | }; |
| 548 | |
| 549 | /** |
Richard Low | 6f07084 | 2009-05-03 10:26:16 +0000 | [diff] [blame] | 550 | * A data structure to hold allowed ranges of values |
| 551 | */ |
| 552 | struct LIBMTP_allowed_values_struct { |
| 553 | uint8_t u8max; |
| 554 | uint8_t u8min; |
| 555 | uint8_t u8step; |
| 556 | uint8_t* u8vals; |
| 557 | int8_t i8max; |
| 558 | int8_t i8min; |
| 559 | int8_t i8step; |
| 560 | int8_t* i8vals; |
| 561 | uint16_t u16max; |
| 562 | uint16_t u16min; |
| 563 | uint16_t u16step; |
| 564 | uint16_t* u16vals; |
| 565 | int16_t i16max; |
| 566 | int16_t i16min; |
| 567 | int16_t i16step; |
| 568 | int16_t* i16vals; |
| 569 | uint32_t u32max; |
| 570 | uint32_t u32min; |
| 571 | uint32_t u32step; |
| 572 | uint32_t* u32vals; |
| 573 | int32_t i32max; |
| 574 | int32_t i32min; |
| 575 | int32_t i32step; |
| 576 | int32_t* i32vals; |
| 577 | uint64_t u64max; |
| 578 | uint64_t u64min; |
| 579 | uint64_t u64step; |
| 580 | uint64_t* u64vals; |
| 581 | int64_t i64max; |
| 582 | int64_t i64min; |
| 583 | int64_t i64step; |
| 584 | int64_t* i64vals; |
| 585 | /** |
| 586 | * Number of entries in the vals array |
| 587 | */ |
| 588 | uint16_t num_entries; |
| 589 | /** |
| 590 | * The datatype specifying which of the above is used |
| 591 | */ |
| 592 | LIBMTP_datatype_t datatype; |
| 593 | /** |
| 594 | * Non zero for range, 0 for enum |
| 595 | */ |
| 596 | int is_range; |
| 597 | }; |
| 598 | |
| 599 | /** |
Linus Walleij | 38d7ee8 | 2010-07-24 22:17:21 +0000 | [diff] [blame] | 600 | * MTP device extension holder struct |
| 601 | */ |
| 602 | struct LIBMTP_device_extension_struct { |
| 603 | /** |
| 604 | * Name of extension e.g. "foo.com" |
| 605 | */ |
| 606 | char *name; |
| 607 | /** |
| 608 | * Major revision of extension |
| 609 | */ |
| 610 | int major; |
| 611 | /** |
| 612 | * Minor revision of extension |
| 613 | */ |
| 614 | int minor; |
| 615 | /** |
| 616 | * Pointer to the next extension or NULL if this is the |
| 617 | * last extension. |
| 618 | */ |
| 619 | LIBMTP_device_extension_t *next; |
| 620 | }; |
| 621 | |
| 622 | /** |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 623 | * Main MTP device object struct |
| 624 | */ |
Linus Walleij | b9256fd | 2006-02-15 09:40:43 +0000 | [diff] [blame] | 625 | struct LIBMTP_mtpdevice_struct { |
Linus Walleij | ddaba2f | 2007-10-02 21:20:30 +0000 | [diff] [blame] | 626 | /** |
| 627 | * Object bitsize, typically 32 or 64. |
Linus Walleij | b0ab548 | 2007-08-29 21:08:54 +0000 | [diff] [blame] | 628 | */ |
Linus Walleij | ddaba2f | 2007-10-02 21:20:30 +0000 | [diff] [blame] | 629 | uint8_t object_bitsize; |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 630 | /** |
| 631 | * Parameters for this device, must be cast into |
Linus Walleij | 9b28da3 | 2006-03-16 13:47:58 +0000 | [diff] [blame] | 632 | * \c (PTPParams*) before internal use. |
| 633 | */ |
| 634 | void *params; |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 635 | /** |
Linus Walleij | 2d411db | 2006-03-22 12:13:09 +0000 | [diff] [blame] | 636 | * USB device for this device, must be cast into |
| 637 | * \c (PTP_USB*) before internal use. |
| 638 | */ |
| 639 | void *usbinfo; |
Linus Walleij | a8b8889 | 2011-03-03 19:58:26 +0100 | [diff] [blame] | 640 | /** |
| 641 | * The storage for this device, do not use strings in here without |
Linus Walleij | f849191 | 2006-12-15 10:23:30 +0000 | [diff] [blame] | 642 | * copying them first, and beware that this list may be rebuilt at |
| 643 | * any time. |
Linus Walleij | 6a82104 | 2008-05-23 21:30:15 +0000 | [diff] [blame] | 644 | * @see LIBMTP_Get_Storage() |
Linus Walleij | f849191 | 2006-12-15 10:23:30 +0000 | [diff] [blame] | 645 | */ |
Linus Walleij | 9e1b081 | 2006-12-12 19:22:02 +0000 | [diff] [blame] | 646 | LIBMTP_devicestorage_t *storage; |
Linus Walleij | 2715c44 | 2007-01-20 22:35:29 +0000 | [diff] [blame] | 647 | /** |
| 648 | * The error stack. This shall be handled using the error getting |
| 649 | * and clearing functions, not by dereferencing this list. |
| 650 | */ |
| 651 | LIBMTP_error_t *errorstack; |
Linus Walleij | 9b28da3 | 2006-03-16 13:47:58 +0000 | [diff] [blame] | 652 | /** The maximum battery level for this device */ |
| 653 | uint8_t maximum_battery_level; |
Linus Walleij | 05ccbe7 | 2006-06-13 07:46:58 +0000 | [diff] [blame] | 654 | /** Default music folder */ |
| 655 | uint32_t default_music_folder; |
| 656 | /** Default playlist folder */ |
| 657 | uint32_t default_playlist_folder; |
| 658 | /** Default picture folder */ |
| 659 | uint32_t default_picture_folder; |
| 660 | /** Default video folder */ |
| 661 | uint32_t default_video_folder; |
| 662 | /** Default organizer folder */ |
| 663 | uint32_t default_organizer_folder; |
| 664 | /** Default ZENcast folder (only Creative devices...) */ |
| 665 | uint32_t default_zencast_folder; |
Linus Walleij | ccf28ce | 2006-11-16 16:06:38 +0000 | [diff] [blame] | 666 | /** Default Album folder */ |
| 667 | uint32_t default_album_folder; |
Linus Walleij | 9316e65 | 2006-12-07 09:55:21 +0000 | [diff] [blame] | 668 | /** Default Text folder */ |
| 669 | uint32_t default_text_folder; |
Linus Walleij | 3ec8631 | 2006-08-21 13:25:24 +0000 | [diff] [blame] | 670 | /** Per device iconv() converters, only used internally */ |
| 671 | void *cd; |
Linus Walleij | 38d7ee8 | 2010-07-24 22:17:21 +0000 | [diff] [blame] | 672 | /** Extension list */ |
| 673 | LIBMTP_device_extension_t *extensions; |
Linus Walleij | a8b8889 | 2011-03-03 19:58:26 +0100 | [diff] [blame] | 674 | /** Whether the device uses caching, only used internally */ |
| 675 | int cached; |
| 676 | |
Linus Walleij | 2d3f7b8 | 2007-02-14 09:24:20 +0000 | [diff] [blame] | 677 | /** Pointer to next device in linked list; NULL if this is the last device */ |
| 678 | LIBMTP_mtpdevice_t *next; |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 679 | }; |
| 680 | |
Linus Walleij | b9256fd | 2006-02-15 09:40:43 +0000 | [diff] [blame] | 681 | /** |
Linus Walleij | f6bc178 | 2006-03-24 15:12:47 +0000 | [diff] [blame] | 682 | * MTP file struct |
| 683 | */ |
| 684 | struct LIBMTP_file_struct { |
| 685 | uint32_t item_id; /**< Unique item ID */ |
Linus Walleij | d208f9c | 2006-04-27 14:16:06 +0000 | [diff] [blame] | 686 | uint32_t parent_id; /**< ID of parent folder */ |
Linus Walleij | ea68f1f | 2008-06-22 21:54:44 +0000 | [diff] [blame] | 687 | uint32_t storage_id; /**< ID of storage holding this file */ |
Linus Walleij | f6bc178 | 2006-03-24 15:12:47 +0000 | [diff] [blame] | 688 | char *filename; /**< Filename of this file */ |
| 689 | uint64_t filesize; /**< Size of file in bytes */ |
Richard Low | d3b1702 | 2009-04-11 12:37:39 +0000 | [diff] [blame] | 690 | time_t modificationdate; /**< Date of last alteration of the file */ |
Linus Walleij | f6bc178 | 2006-03-24 15:12:47 +0000 | [diff] [blame] | 691 | LIBMTP_filetype_t filetype; /**< Filetype used for the current file */ |
| 692 | LIBMTP_file_t *next; /**< Next file in list or NULL if last file */ |
| 693 | }; |
| 694 | |
| 695 | /** |
Linus Walleij | b9256fd | 2006-02-15 09:40:43 +0000 | [diff] [blame] | 696 | * MTP track struct |
| 697 | */ |
| 698 | struct LIBMTP_track_struct { |
| 699 | uint32_t item_id; /**< Unique item ID */ |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 700 | uint32_t parent_id; /**< ID of parent folder */ |
Linus Walleij | ea68f1f | 2008-06-22 21:54:44 +0000 | [diff] [blame] | 701 | uint32_t storage_id; /**< ID of storage holding this track */ |
Linus Walleij | b9256fd | 2006-02-15 09:40:43 +0000 | [diff] [blame] | 702 | char *title; /**< Track title */ |
| 703 | char *artist; /**< Name of recording artist */ |
Linus Walleij | 31b7429 | 2008-05-02 23:29:06 +0000 | [diff] [blame] | 704 | char *composer; /**< Name of recording composer */ |
Linus Walleij | b9256fd | 2006-02-15 09:40:43 +0000 | [diff] [blame] | 705 | char *genre; /**< Genre name for track */ |
| 706 | char *album; /**< Album name for track */ |
| 707 | char *date; /**< Date of original recording as a string */ |
| 708 | char *filename; /**< Original filename of this track */ |
| 709 | uint16_t tracknumber; /**< Track number (in sequence on recording) */ |
| 710 | uint32_t duration; /**< Duration in milliseconds */ |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 711 | uint32_t samplerate; /**< Sample rate of original file, min 0x1f80 max 0xbb80 */ |
Linus Walleij | cf223e6 | 2006-06-19 09:31:53 +0000 | [diff] [blame] | 712 | uint16_t nochannels; /**< Number of channels in this recording 0 = unknown, 1 or 2 */ |
| 713 | uint32_t wavecodec; /**< FourCC wave codec name */ |
| 714 | uint32_t bitrate; /**< (Average) bitrate for this file min=1 max=0x16e360 */ |
| 715 | uint16_t bitratetype; /**< 0 = unused, 1 = constant, 2 = VBR, 3 = free */ |
| 716 | uint16_t rating; /**< User rating 0-100 (0x00-0x64) */ |
| 717 | uint32_t usecount; /**< Number of times used/played */ |
Linus Walleij | b9256fd | 2006-02-15 09:40:43 +0000 | [diff] [blame] | 718 | uint64_t filesize; /**< Size of track file in bytes */ |
Richard Low | d3b1702 | 2009-04-11 12:37:39 +0000 | [diff] [blame] | 719 | time_t modificationdate; /**< Date of last alteration of the track */ |
Linus Walleij | f6bc178 | 2006-03-24 15:12:47 +0000 | [diff] [blame] | 720 | LIBMTP_filetype_t filetype; /**< Filetype used for the current track */ |
Linus Walleij | b9256fd | 2006-02-15 09:40:43 +0000 | [diff] [blame] | 721 | LIBMTP_track_t *next; /**< Next track in list or NULL if last track */ |
| 722 | }; |
| 723 | |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 724 | /** |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 725 | * MTP Playlist structure |
| 726 | */ |
| 727 | struct LIBMTP_playlist_struct { |
| 728 | uint32_t playlist_id; /**< Unique playlist ID */ |
Linus Walleij | 5ce59db | 2008-03-12 21:22:58 +0000 | [diff] [blame] | 729 | uint32_t parent_id; /**< ID of parent folder */ |
Linus Walleij | ea68f1f | 2008-06-22 21:54:44 +0000 | [diff] [blame] | 730 | uint32_t storage_id; /**< ID of storage holding this playlist */ |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 731 | char *name; /**< Name of playlist */ |
| 732 | uint32_t *tracks; /**< The tracks in this playlist */ |
| 733 | uint32_t no_tracks; /**< The number of tracks in this playlist */ |
| 734 | LIBMTP_playlist_t *next; /**< Next playlist or NULL if last playlist */ |
| 735 | }; |
| 736 | |
| 737 | /** |
Linus Walleij | 0c33ec0 | 2006-10-27 10:15:40 +0000 | [diff] [blame] | 738 | * MTP Album structure |
| 739 | */ |
| 740 | struct LIBMTP_album_struct { |
| 741 | uint32_t album_id; /**< Unique playlist ID */ |
Linus Walleij | 5ce59db | 2008-03-12 21:22:58 +0000 | [diff] [blame] | 742 | uint32_t parent_id; /**< ID of parent folder */ |
Linus Walleij | ea68f1f | 2008-06-22 21:54:44 +0000 | [diff] [blame] | 743 | uint32_t storage_id; /**< ID of storage holding this album */ |
Linus Walleij | 0c33ec0 | 2006-10-27 10:15:40 +0000 | [diff] [blame] | 744 | char *name; /**< Name of album */ |
Linus Walleij | adce4a5 | 2007-04-23 07:28:11 +0000 | [diff] [blame] | 745 | char *artist; /**< Name of album artist */ |
Linus Walleij | 31b7429 | 2008-05-02 23:29:06 +0000 | [diff] [blame] | 746 | char *composer; /**< Name of recording composer */ |
Linus Walleij | adce4a5 | 2007-04-23 07:28:11 +0000 | [diff] [blame] | 747 | char *genre; /**< Genre of album */ |
Linus Walleij | 0c33ec0 | 2006-10-27 10:15:40 +0000 | [diff] [blame] | 748 | uint32_t *tracks; /**< The tracks in this album */ |
| 749 | uint32_t no_tracks; /**< The number of tracks in this album */ |
| 750 | LIBMTP_album_t *next; /**< Next album or NULL if last album */ |
| 751 | }; |
| 752 | |
| 753 | /** |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 754 | * MTP Folder structure |
| 755 | */ |
| 756 | struct LIBMTP_folder_struct { |
| 757 | uint32_t folder_id; /**< Unique folder ID */ |
| 758 | uint32_t parent_id; /**< ID of parent folder */ |
Linus Walleij | ea68f1f | 2008-06-22 21:54:44 +0000 | [diff] [blame] | 759 | uint32_t storage_id; /**< ID of storage holding this folder */ |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 760 | char *name; /**< Name of folder */ |
| 761 | LIBMTP_folder_t *sibling; /**< Next folder at same level or NULL if no more */ |
| 762 | LIBMTP_folder_t *child; /**< Child folder or NULL if no children */ |
| 763 | }; |
| 764 | |
rreardon | 5332f9c | 2006-12-05 10:18:23 +0000 | [diff] [blame] | 765 | /** |
| 766 | * LIBMTP Object RepresentativeSampleData Structure |
| 767 | */ |
| 768 | struct LIBMTP_filesampledata_struct { |
| 769 | uint32_t width; /**< Width of sample if it is an image */ |
| 770 | uint32_t height; /**< Height of sample if it is an image */ |
| 771 | uint32_t duration; /**< Duration in milliseconds if it is audio */ |
| 772 | LIBMTP_filetype_t filetype; /**< Filetype used for the sample */ |
| 773 | uint64_t size; /**< Size of sample data in bytes */ |
| 774 | char *data; /**< Sample data */ |
| 775 | }; |
| 776 | |
Linus Walleij | 9e1b081 | 2006-12-12 19:22:02 +0000 | [diff] [blame] | 777 | /** |
| 778 | * LIBMTP Device Storage structure |
| 779 | */ |
| 780 | struct LIBMTP_devicestorage_struct { |
Linus Walleij | f849191 | 2006-12-15 10:23:30 +0000 | [diff] [blame] | 781 | uint32_t id; /**< Unique ID for this storage */ |
| 782 | uint16_t StorageType; /**< Storage type */ |
| 783 | uint16_t FilesystemType; /**< Filesystem type */ |
| 784 | uint16_t AccessCapability; /**< Access capability */ |
| 785 | uint64_t MaxCapacity; /**< Maximum capability */ |
| 786 | uint64_t FreeSpaceInBytes; /**< Free space in bytes */ |
| 787 | uint64_t FreeSpaceInObjects; /**< Free space in objects */ |
| 788 | char *StorageDescription; /**< A brief description of this storage */ |
| 789 | char *VolumeIdentifier; /**< A volume identifier */ |
| 790 | LIBMTP_devicestorage_t *next; /**< Next storage, follow this link until NULL */ |
| 791 | LIBMTP_devicestorage_t *prev; /**< Previous storage */ |
Linus Walleij | 9e1b081 | 2006-12-12 19:22:02 +0000 | [diff] [blame] | 792 | }; |
Linus Walleij | a8b8889 | 2011-03-03 19:58:26 +0100 | [diff] [blame] | 793 | |
Linus Walleij | 335b6fb | 2011-03-22 23:43:32 +0100 | [diff] [blame] | 794 | /** |
| 795 | * LIBMTP Event structure |
| 796 | * TODO: add all externally visible events here |
| 797 | */ |
| 798 | enum LIBMTP_event_enum { |
| 799 | LIBMTP_EVENT_NONE, |
Philip Langdale | da26879 | 2012-09-02 14:48:25 -0700 | [diff] [blame] | 800 | LIBMTP_EVENT_STORE_ADDED, |
Philip Langdale | 50dd347 | 2013-03-10 12:22:51 -0700 | [diff] [blame] | 801 | LIBMTP_EVENT_STORE_REMOVED, |
| 802 | LIBMTP_EVENT_OBJECT_ADDED, |
| 803 | LIBMTP_EVENT_OBJECT_REMOVED, |
Linus Walleij | 335b6fb | 2011-03-22 23:43:32 +0100 | [diff] [blame] | 804 | }; |
| 805 | typedef enum LIBMTP_event_enum LIBMTP_event_t; |
Linus Walleij | 9e1b081 | 2006-12-12 19:22:02 +0000 | [diff] [blame] | 806 | |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 807 | /** @} */ |
| 808 | |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 809 | /* Make functions available for C++ */ |
| 810 | #ifdef __cplusplus |
| 811 | extern "C" { |
| 812 | #endif |
| 813 | |
nicklas79 | daadbf2 | 2009-09-28 18:19:34 +0000 | [diff] [blame] | 814 | extern int LIBMTP_debug; |
| 815 | |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 816 | /** |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 817 | * @defgroup internals The libmtp internals API. |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 818 | * @{ |
| 819 | */ |
nicklas79 | daadbf2 | 2009-09-28 18:19:34 +0000 | [diff] [blame] | 820 | void LIBMTP_Set_Debug(int); |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 821 | void LIBMTP_Init(void); |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 822 | int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const); |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 823 | /** |
| 824 | * @} |
| 825 | * @defgroup basic The basic device management API. |
| 826 | * @{ |
| 827 | */ |
Linus Walleij | a700d22 | 2008-05-28 23:06:14 +0000 | [diff] [blame] | 828 | LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t **, int *); |
Linus Walleij | 549f49a | 2010-12-05 14:00:34 +0000 | [diff] [blame] | 829 | int LIBMTP_Check_Specific_Device(int busno, int devno); |
Linus Walleij | bdb89bd | 2008-05-28 23:32:35 +0000 | [diff] [blame] | 830 | LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device(LIBMTP_raw_device_t *); |
Linus Walleij | a8b8889 | 2011-03-03 19:58:26 +0100 | [diff] [blame] | 831 | LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device_Uncached(LIBMTP_raw_device_t *); |
Linus Walleij | bdb89bd | 2008-05-28 23:32:35 +0000 | [diff] [blame] | 832 | /* Begin old, legacy interface */ |
Linus Walleij | b9256fd | 2006-02-15 09:40:43 +0000 | [diff] [blame] | 833 | LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void); |
Linus Walleij | 2d3f7b8 | 2007-02-14 09:24:20 +0000 | [diff] [blame] | 834 | LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **); |
tedbullock | 848009b | 2007-03-03 23:20:12 +0000 | [diff] [blame] | 835 | uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *); |
tedbullock | 0f033cb | 2007-02-14 20:56:54 +0000 | [diff] [blame] | 836 | void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*); |
Linus Walleij | bdb89bd | 2008-05-28 23:32:35 +0000 | [diff] [blame] | 837 | /* End old, legacy interface */ |
Linus Walleij | b9256fd | 2006-02-15 09:40:43 +0000 | [diff] [blame] | 838 | void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*); |
Linus Walleij | 8c45b29 | 2006-04-26 14:12:44 +0000 | [diff] [blame] | 839 | void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*); |
Linus Walleij | 5d533bb | 2007-07-17 21:48:57 +0000 | [diff] [blame] | 840 | int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*); |
Linus Walleij | 2350b71 | 2008-01-14 22:54:37 +0000 | [diff] [blame] | 841 | char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*); |
Linus Walleij | 8012406 | 2006-03-15 10:26:09 +0000 | [diff] [blame] | 842 | char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*); |
| 843 | char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*); |
| 844 | char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*); |
Linus Walleij | 3065879 | 2006-08-19 22:18:55 +0000 | [diff] [blame] | 845 | char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); |
| 846 | int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); |
Linus Walleij | fae2748 | 2006-08-19 20:13:25 +0000 | [diff] [blame] | 847 | char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); |
Linus Walleij | 3065879 | 2006-08-19 22:18:55 +0000 | [diff] [blame] | 848 | int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 849 | int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, |
| 850 | uint8_t * const, |
Linus Walleij | fa1374c | 2006-02-27 07:41:46 +0000 | [diff] [blame] | 851 | uint8_t * const); |
Linus Walleij | 8ab5426 | 2006-06-21 07:12:28 +0000 | [diff] [blame] | 852 | int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); |
| 853 | int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); |
| 854 | int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const); |
Linus Walleij | a389561 | 2013-04-29 21:56:38 +0200 | [diff] [blame] | 855 | int LIBMTP_Check_Capability(LIBMTP_mtpdevice_t *, LIBMTP_devicecap_t); |
Linus Walleij | 2715c44 | 2007-01-20 22:35:29 +0000 | [diff] [blame] | 856 | LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*); |
| 857 | void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*); |
| 858 | void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*); |
Linus Walleij | f6bc178 | 2006-03-24 15:12:47 +0000 | [diff] [blame] | 859 | |
Jerry Zhang | 60d0226 | 2017-06-08 18:19:59 -0700 | [diff] [blame] | 860 | void LIBMTP_Set_Device_Timeout(LIBMTP_mtpdevice_t *device, int milliseconds); |
| 861 | void LIBMTP_Get_Device_Timeout(LIBMTP_mtpdevice_t *device, int *milliseconds); |
| 862 | |
Linus Walleij | 9e1b081 | 2006-12-12 19:22:02 +0000 | [diff] [blame] | 863 | #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 |
| 864 | #define LIBMTP_STORAGE_SORTBY_FREESPACE 1 |
| 865 | #define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 |
| 866 | |
| 867 | int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const); |
Linus Walleij | f849191 | 2006-12-15 10:23:30 +0000 | [diff] [blame] | 868 | int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *); |
| 869 | |
Richard Low | 6f07084 | 2009-05-03 10:26:16 +0000 | [diff] [blame] | 870 | /** |
| 871 | * Get/set arbitrary properties. These do not update the cache; should only be used on |
| 872 | * properties not stored in structs |
| 873 | */ |
| 874 | char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const); |
| 875 | uint64_t LIBMTP_Get_u64_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, |
| 876 | LIBMTP_property_t const, uint64_t const); |
| 877 | uint32_t LIBMTP_Get_u32_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, |
| 878 | LIBMTP_property_t const, uint32_t const); |
| 879 | uint16_t LIBMTP_Get_u16_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, |
| 880 | LIBMTP_property_t const, uint16_t const); |
| 881 | uint8_t LIBMTP_Get_u8_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, |
| 882 | LIBMTP_property_t const, uint8_t const); |
| 883 | int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *, uint32_t const, |
| 884 | LIBMTP_property_t const, char const * const); |
| 885 | int LIBMTP_Set_Object_u32(LIBMTP_mtpdevice_t *, uint32_t const, |
| 886 | LIBMTP_property_t const, uint32_t const); |
| 887 | int LIBMTP_Set_Object_u16(LIBMTP_mtpdevice_t *, uint32_t const, |
| 888 | LIBMTP_property_t const, uint16_t const); |
| 889 | int LIBMTP_Set_Object_u8(LIBMTP_mtpdevice_t *, uint32_t const, |
| 890 | LIBMTP_property_t const, uint8_t const); |
| 891 | char const * LIBMTP_Get_Property_Description(LIBMTP_property_t inproperty); |
| 892 | int LIBMTP_Is_Property_Supported(LIBMTP_mtpdevice_t*, LIBMTP_property_t const, |
| 893 | LIBMTP_filetype_t const); |
| 894 | int LIBMTP_Get_Allowed_Property_Values(LIBMTP_mtpdevice_t*, LIBMTP_property_t const, |
| 895 | LIBMTP_filetype_t const, LIBMTP_allowed_values_t*); |
| 896 | void LIBMTP_destroy_allowed_values_t(LIBMTP_allowed_values_t*); |
Linus Walleij | 9e1b081 | 2006-12-12 19:22:02 +0000 | [diff] [blame] | 897 | |
Linus Walleij | f6bc178 | 2006-03-24 15:12:47 +0000 | [diff] [blame] | 898 | /** |
| 899 | * @} |
| 900 | * @defgroup files The file management API. |
| 901 | * @{ |
| 902 | */ |
| 903 | LIBMTP_file_t *LIBMTP_new_file_t(void); |
| 904 | void LIBMTP_destroy_file_t(LIBMTP_file_t*); |
Linus Walleij | 16c51f0 | 2006-05-04 13:20:22 +0000 | [diff] [blame] | 905 | char const * LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t); |
Linus Walleij | 2e4b5f9 | 2006-06-16 14:00:49 +0000 | [diff] [blame] | 906 | LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *); |
Richard Low | dc0b6c7 | 2006-11-13 09:22:23 +0000 | [diff] [blame] | 907 | LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *, |
| 908 | LIBMTP_progressfunc_t const, void const * const); |
Stanisław Pitucha | 4c162fa | 2017-02-04 09:35:54 +1100 | [diff] [blame] | 909 | |
| 910 | #define LIBMTP_FILES_AND_FOLDERS_ROOT 0xffffffff |
| 911 | |
Linus Walleij | a8b8889 | 2011-03-03 19:58:26 +0100 | [diff] [blame] | 912 | LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *, |
Linus Walleij | 8a19928 | 2011-03-05 22:28:41 +0100 | [diff] [blame] | 913 | uint32_t const, |
Linus Walleij | 71c7929 | 2011-03-05 22:08:07 +0100 | [diff] [blame] | 914 | uint32_t const); |
Linus Walleij | 2e4b5f9 | 2006-06-16 14:00:49 +0000 | [diff] [blame] | 915 | LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const); |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 916 | int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const, |
Linus Walleij | ee73ef2 | 2006-08-27 19:56:00 +0000 | [diff] [blame] | 917 | LIBMTP_progressfunc_t const, void const * const); |
Linus Walleij | 71c7929 | 2011-03-05 22:08:07 +0100 | [diff] [blame] | 918 | int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*, |
| 919 | uint32_t const, |
| 920 | int const, |
| 921 | LIBMTP_progressfunc_t const, |
| 922 | void const * const); |
| 923 | int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *, |
| 924 | uint32_t const, |
| 925 | MTPDataPutFunc, |
| 926 | void *, |
| 927 | LIBMTP_progressfunc_t const, |
| 928 | void const * const); |
| 929 | int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *, |
| 930 | char const * const, |
| 931 | LIBMTP_file_t * const, |
| 932 | LIBMTP_progressfunc_t const, |
| 933 | void const * const); |
| 934 | int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *, |
| 935 | int const, |
| 936 | LIBMTP_file_t * const, |
| 937 | LIBMTP_progressfunc_t const, |
| 938 | void const * const); |
| 939 | int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *, |
| 940 | MTPDataGetFunc, void *, |
| 941 | LIBMTP_file_t * const, |
| 942 | LIBMTP_progressfunc_t const, |
| 943 | void const * const); |
| 944 | int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *, |
| 945 | LIBMTP_file_t *, |
| 946 | const char *); |
rreardon | 5332f9c | 2006-12-05 10:18:23 +0000 | [diff] [blame] | 947 | LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void); |
Linus Walleij | f1b02f2 | 2006-12-06 09:03:23 +0000 | [diff] [blame] | 948 | void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t *); |
| 949 | int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *, |
| 950 | LIBMTP_filetype_t const, |
| 951 | LIBMTP_filesampledata_t **); |
rreardon | 5332f9c | 2006-12-05 10:18:23 +0000 | [diff] [blame] | 952 | int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, |
| 953 | LIBMTP_filesampledata_t *); |
Richard Low | 36e447c | 2008-01-20 15:24:55 +0000 | [diff] [blame] | 954 | int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, |
| 955 | LIBMTP_filesampledata_t *); |
Philip Langdale | 99351a4 | 2012-08-18 15:32:12 -0700 | [diff] [blame] | 956 | int LIBMTP_Get_Thumbnail(LIBMTP_mtpdevice_t *, uint32_t const, |
| 957 | unsigned char **data, unsigned int *size); |
rreardon | 5332f9c | 2006-12-05 10:18:23 +0000 | [diff] [blame] | 958 | |
Jerry Zhang | 60d0226 | 2017-06-08 18:19:59 -0700 | [diff] [blame] | 959 | void LIBMTP_Set_Load_Cache_On_Demand(int flag); |
| 960 | |
Linus Walleij | dcde608 | 2006-02-17 16:16:34 +0000 | [diff] [blame] | 961 | /** |
| 962 | * @} |
| 963 | * @defgroup tracks The track management API. |
| 964 | * @{ |
| 965 | */ |
Linus Walleij | 95698cd | 2006-02-24 10:40:40 +0000 | [diff] [blame] | 966 | LIBMTP_track_t *LIBMTP_new_track_t(void); |
| 967 | void LIBMTP_destroy_track_t(LIBMTP_track_t*); |
| 968 | LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t*); |
Richard Low | dc0b6c7 | 2006-11-13 09:22:23 +0000 | [diff] [blame] | 969 | LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback(LIBMTP_mtpdevice_t*, |
| 970 | LIBMTP_progressfunc_t const, void const * const); |
nicklas79 | 18b54d7 | 2009-11-07 19:54:07 +0000 | [diff] [blame] | 971 | LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback_For_Storage(LIBMTP_mtpdevice_t*, uint32_t const, |
| 972 | LIBMTP_progressfunc_t const, void const * const); |
Linus Walleij | 2e4b5f9 | 2006-06-16 14:00:49 +0000 | [diff] [blame] | 973 | LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t*, uint32_t const); |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 974 | int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const, |
Linus Walleij | ee73ef2 | 2006-08-27 19:56:00 +0000 | [diff] [blame] | 975 | LIBMTP_progressfunc_t const, void const * const); |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 976 | int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const, |
Linus Walleij | ee73ef2 | 2006-08-27 19:56:00 +0000 | [diff] [blame] | 977 | LIBMTP_progressfunc_t const, void const * const); |
Richard Low | d3b1702 | 2009-04-11 12:37:39 +0000 | [diff] [blame] | 978 | int LIBMTP_Get_Track_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc, |
| 979 | void *, LIBMTP_progressfunc_t const, void const * const); |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 980 | int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *, |
Linus Walleij | 394bbbe | 2006-02-22 16:10:53 +0000 | [diff] [blame] | 981 | char const * const, LIBMTP_track_t * const, |
Linus Walleij | ee73ef2 | 2006-08-27 19:56:00 +0000 | [diff] [blame] | 982 | LIBMTP_progressfunc_t const, |
Linus Walleij | ea68f1f | 2008-06-22 21:54:44 +0000 | [diff] [blame] | 983 | void const * const); |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 984 | int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *, |
Linus Walleij | 394bbbe | 2006-02-22 16:10:53 +0000 | [diff] [blame] | 985 | int const, LIBMTP_track_t * const, |
Linus Walleij | ee73ef2 | 2006-08-27 19:56:00 +0000 | [diff] [blame] | 986 | LIBMTP_progressfunc_t const, |
Linus Walleij | ea68f1f | 2008-06-22 21:54:44 +0000 | [diff] [blame] | 987 | void const * const); |
Richard Low | d3b1702 | 2009-04-11 12:37:39 +0000 | [diff] [blame] | 988 | int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *, |
| 989 | MTPDataGetFunc, void *, LIBMTP_track_t * const, |
| 990 | LIBMTP_progressfunc_t const, |
| 991 | void const * const); |
mopoke | 3136444 | 2006-11-20 04:53:04 +0000 | [diff] [blame] | 992 | int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *, |
Linus Walleij | 95698cd | 2006-02-24 10:40:40 +0000 | [diff] [blame] | 993 | LIBMTP_track_t const * const); |
Linus Walleij | 4841ffc | 2011-03-05 22:54:22 +0100 | [diff] [blame] | 994 | int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *, uint32_t const); |
Linus Walleij | 8d8c435 | 2008-09-23 23:04:16 +0000 | [diff] [blame] | 995 | int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *, LIBMTP_track_t *, const char *); |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 996 | /** @} */ |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 997 | |
| 998 | /** |
| 999 | * @} |
| 1000 | * @defgroup folders The folder management API. |
| 1001 | * @{ |
| 1002 | */ |
| 1003 | LIBMTP_folder_t *LIBMTP_new_folder_t(void); |
| 1004 | void LIBMTP_destroy_folder_t(LIBMTP_folder_t*); |
| 1005 | LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*); |
Linus Walleij | 1e4dfea | 2011-03-05 22:50:39 +0100 | [diff] [blame] | 1006 | LIBMTP_folder_t *LIBMTP_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t*, |
| 1007 | uint32_t const); |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 1008 | LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const); |
Richard Low | f8cd3d7 | 2009-05-04 16:38:33 +0000 | [diff] [blame] | 1009 | uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t); |
Linus Walleij | 8d8c435 | 2008-09-23 23:04:16 +0000 | [diff] [blame] | 1010 | int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *); |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 1011 | /** @} */ |
| 1012 | |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 1013 | |
| 1014 | /** |
| 1015 | * @} |
| 1016 | * @defgroup playlists The audio/video playlist management API. |
| 1017 | * @{ |
| 1018 | */ |
| 1019 | LIBMTP_playlist_t *LIBMTP_new_playlist_t(void); |
| 1020 | void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *); |
| 1021 | LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *); |
Linus Walleij | 2e4b5f9 | 2006-06-16 14:00:49 +0000 | [diff] [blame] | 1022 | LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const); |
Linus Walleij | ea68f1f | 2008-06-22 21:54:44 +0000 | [diff] [blame] | 1023 | int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); |
alistair_boyle | 5e5fcb7 | 2008-11-17 14:38:19 +0000 | [diff] [blame] | 1024 | int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); |
Linus Walleij | 8d8c435 | 2008-09-23 23:04:16 +0000 | [diff] [blame] | 1025 | int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const char *); |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 1026 | |
Linus Walleij | 0c33ec0 | 2006-10-27 10:15:40 +0000 | [diff] [blame] | 1027 | /** |
| 1028 | * @} |
| 1029 | * @defgroup albums The audio/video album management API. |
| 1030 | * @{ |
| 1031 | */ |
| 1032 | LIBMTP_album_t *LIBMTP_new_album_t(void); |
| 1033 | void LIBMTP_destroy_album_t(LIBMTP_album_t *); |
| 1034 | LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *); |
nicklas79 | 5e0100b | 2009-11-07 19:53:46 +0000 | [diff] [blame] | 1035 | LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *, uint32_t const); |
Linus Walleij | 0c33ec0 | 2006-10-27 10:15:40 +0000 | [diff] [blame] | 1036 | LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const); |
Linus Walleij | ea68f1f | 2008-06-22 21:54:44 +0000 | [diff] [blame] | 1037 | int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const); |
Linus Walleij | 0c33ec0 | 2006-10-27 10:15:40 +0000 | [diff] [blame] | 1038 | int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const); |
Linus Walleij | 8d8c435 | 2008-09-23 23:04:16 +0000 | [diff] [blame] | 1039 | int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *); |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 1040 | |
ravelox | d9a2864 | 2006-05-26 23:42:22 +0000 | [diff] [blame] | 1041 | /** |
| 1042 | * @} |
| 1043 | * @defgroup objects The object management API. |
| 1044 | * @{ |
| 1045 | */ |
Linus Walleij | 438bd7f | 2006-06-08 11:35:44 +0000 | [diff] [blame] | 1046 | int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); |
Linus Walleij | de8193f | 2008-01-27 14:55:31 +0000 | [diff] [blame] | 1047 | int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); |
Philip Langdale | 31e831c | 2013-03-04 20:58:19 -0800 | [diff] [blame] | 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); |
Linus Walleij | 335b6fb | 2011-03-22 23:43:32 +0100 | [diff] [blame] | 1056 | |
Linus Walleij | cb2794e | 2013-03-06 04:48:24 +0100 | [diff] [blame] | 1057 | /** |
| 1058 | * @} |
| 1059 | * @defgroup files The events API. |
| 1060 | * @{ |
| 1061 | */ |
Philip Langdale | 0a57651 | 2016-04-09 14:22:25 -0700 | [diff] [blame] | 1062 | typedef void(* LIBMTP_event_cb_fn) (int, LIBMTP_event_t, uint32_t, void *); |
Linus Walleij | cb2794e | 2013-03-06 04:48:24 +0100 | [diff] [blame] | 1063 | int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *, uint32_t *); |
Philip Langdale | 0a57651 | 2016-04-09 14:22:25 -0700 | [diff] [blame] | 1064 | int LIBMTP_Read_Event_Async(LIBMTP_mtpdevice_t *, LIBMTP_event_cb_fn, void *); |
| 1065 | int LIBMTP_Handle_Events_Timeout_Completed(struct timeval *, int *); |
Linus Walleij | cb2794e | 2013-03-06 04:48:24 +0100 | [diff] [blame] | 1066 | |
Marcin Niestroj | 718b290 | 2017-06-10 16:36:18 +0200 | [diff] [blame] | 1067 | /** |
| 1068 | * @} |
| 1069 | * @defgroup custom Custom operations API. |
| 1070 | * @{ |
| 1071 | */ |
| 1072 | int LIBMTP_Custom_Operation(LIBMTP_mtpdevice_t *, uint16_t, int, ...); |
| 1073 | |
ravelox | d9a2864 | 2006-05-26 23:42:22 +0000 | [diff] [blame] | 1074 | /** @} */ |
| 1075 | |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 1076 | /* End of C++ exports */ |
| 1077 | #ifdef __cplusplus |
| 1078 | } |
| 1079 | #endif |
| 1080 | |
| 1081 | #endif /* LIBMTP_H_INCLUSION_GUARD */ |
| 1082 | |