IMtpDatabase.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * Copyright (C) 2010 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef _I_MTP_DATABASE_H
  17. #define _I_MTP_DATABASE_H
  18. #include "MtpTypes.h"
  19. namespace android {
  20. class MtpDataPacket;
  21. class MtpProperty;
  22. class MtpObjectInfo;
  23. class MtpStringBuffer;
  24. class IMtpDatabase {
  25. public:
  26. virtual ~IMtpDatabase() {}
  27. // Called from SendObjectInfo to reserve a database entry for the incoming file.
  28. virtual MtpObjectHandle beginSendObject(const char* path,
  29. MtpObjectFormat format,
  30. MtpObjectHandle parent,
  31. MtpStorageID storage) = 0;
  32. // Called to report success or failure of the SendObject file transfer.
  33. virtual void endSendObject(MtpObjectHandle handle,
  34. bool succeeded) = 0;
  35. // Called to rescan a file, such as after an edit.
  36. virtual void rescanFile(const char* path,
  37. MtpObjectHandle handle,
  38. MtpObjectFormat format) = 0;
  39. virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
  40. MtpObjectFormat format,
  41. MtpObjectHandle parent) = 0;
  42. virtual int getNumObjects(MtpStorageID storageID,
  43. MtpObjectFormat format,
  44. MtpObjectHandle parent) = 0;
  45. // callee should delete[] the results from these
  46. // results can be NULL
  47. virtual MtpObjectFormatList* getSupportedPlaybackFormats() = 0;
  48. virtual MtpObjectFormatList* getSupportedCaptureFormats() = 0;
  49. virtual MtpObjectPropertyList* getSupportedObjectProperties(MtpObjectFormat format) = 0;
  50. virtual MtpDevicePropertyList* getSupportedDeviceProperties() = 0;
  51. virtual MtpResponseCode getObjectPropertyValue(MtpObjectHandle handle,
  52. MtpObjectProperty property,
  53. MtpDataPacket& packet) = 0;
  54. virtual MtpResponseCode setObjectPropertyValue(MtpObjectHandle handle,
  55. MtpObjectProperty property,
  56. MtpDataPacket& packet) = 0;
  57. virtual MtpResponseCode getDevicePropertyValue(MtpDeviceProperty property,
  58. MtpDataPacket& packet) = 0;
  59. virtual MtpResponseCode setDevicePropertyValue(MtpDeviceProperty property,
  60. MtpDataPacket& packet) = 0;
  61. virtual MtpResponseCode resetDeviceProperty(MtpDeviceProperty property) = 0;
  62. virtual MtpResponseCode getObjectPropertyList(MtpObjectHandle handle,
  63. uint32_t format, uint32_t property,
  64. int groupCode, int depth,
  65. MtpDataPacket& packet) = 0;
  66. virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle,
  67. MtpObjectInfo& info) = 0;
  68. virtual void* getThumbnail(MtpObjectHandle handle, size_t& outThumbSize) = 0;
  69. virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle,
  70. MtpStringBuffer& outFilePath,
  71. int64_t& outFileLength,
  72. MtpObjectFormat& outFormat) = 0;
  73. virtual MtpResponseCode beginDeleteObject(MtpObjectHandle handle) = 0;
  74. virtual void endDeleteObject(MtpObjectHandle handle, bool succeeded) = 0;
  75. virtual MtpObjectHandleList* getObjectReferences(MtpObjectHandle handle) = 0;
  76. virtual MtpResponseCode setObjectReferences(MtpObjectHandle handle,
  77. MtpObjectHandleList* references) = 0;
  78. virtual MtpProperty* getObjectPropertyDesc(MtpObjectProperty property,
  79. MtpObjectFormat format) = 0;
  80. virtual MtpProperty* getDevicePropertyDesc(MtpDeviceProperty property) = 0;
  81. virtual MtpResponseCode beginMoveObject(MtpObjectHandle handle, MtpObjectHandle newParent,
  82. MtpStorageID newStorage) = 0;
  83. virtual void endMoveObject(MtpObjectHandle oldParent, MtpObjectHandle newParent,
  84. MtpStorageID oldStorage, MtpStorageID newStorage,
  85. MtpObjectHandle handle, bool succeeded) = 0;
  86. virtual MtpResponseCode beginCopyObject(MtpObjectHandle handle, MtpObjectHandle newParent,
  87. MtpStorageID newStorage) = 0;
  88. virtual void endCopyObject(MtpObjectHandle handle, bool succeeded) = 0;
  89. };
  90. }; // namespace android
  91. #endif // _I_MTP_DATABASE_H