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 17 #ifndef _I_MTP_DATABASE_H 18 #define _I_MTP_DATABASE_H 19 20 #include "MtpTypes.h" 21 22 namespace android { 23 24 class MtpDataPacket; 25 class MtpProperty; 26 class MtpObjectInfo; 27 class MtpStringBuffer; 28 29 class IMtpDatabase { 30 public: ~IMtpDatabase()31 virtual ~IMtpDatabase() {} 32 33 // Called from SendObjectInfo to reserve a database entry for the incoming file. 34 virtual MtpObjectHandle beginSendObject(const char* path, 35 MtpObjectFormat format, 36 MtpObjectHandle parent, 37 MtpStorageID storage) = 0; 38 39 // Called to report success or failure of the SendObject file transfer. 40 virtual void endSendObject(MtpObjectHandle handle, 41 bool succeeded) = 0; 42 43 // Called to rescan a file, such as after an edit. 44 virtual void rescanFile(const char* path, 45 MtpObjectHandle handle, 46 MtpObjectFormat format) = 0; 47 48 virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID, 49 MtpObjectFormat format, 50 MtpObjectHandle parent) = 0; 51 52 virtual int getNumObjects(MtpStorageID storageID, 53 MtpObjectFormat format, 54 MtpObjectHandle parent) = 0; 55 56 // callee should delete[] the results from these 57 // results can be NULL 58 virtual MtpObjectFormatList* getSupportedPlaybackFormats() = 0; 59 virtual MtpObjectFormatList* getSupportedCaptureFormats() = 0; 60 virtual MtpObjectPropertyList* getSupportedObjectProperties(MtpObjectFormat format) = 0; 61 virtual MtpDevicePropertyList* getSupportedDeviceProperties() = 0; 62 63 virtual MtpResponseCode getObjectPropertyValue(MtpObjectHandle handle, 64 MtpObjectProperty property, 65 MtpDataPacket& packet) = 0; 66 67 virtual MtpResponseCode setObjectPropertyValue(MtpObjectHandle handle, 68 MtpObjectProperty property, 69 MtpDataPacket& packet) = 0; 70 71 virtual MtpResponseCode getDevicePropertyValue(MtpDeviceProperty property, 72 MtpDataPacket& packet) = 0; 73 74 virtual MtpResponseCode setDevicePropertyValue(MtpDeviceProperty property, 75 MtpDataPacket& packet) = 0; 76 77 virtual MtpResponseCode resetDeviceProperty(MtpDeviceProperty property) = 0; 78 79 virtual MtpResponseCode getObjectPropertyList(MtpObjectHandle handle, 80 uint32_t format, uint32_t property, 81 int groupCode, int depth, 82 MtpDataPacket& packet) = 0; 83 84 virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle, 85 MtpObjectInfo& info) = 0; 86 87 virtual void* getThumbnail(MtpObjectHandle handle, size_t& outThumbSize) = 0; 88 89 virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle, 90 MtpStringBuffer& outFilePath, 91 int64_t& outFileLength, 92 MtpObjectFormat& outFormat) = 0; 93 94 virtual MtpResponseCode beginDeleteObject(MtpObjectHandle handle) = 0; 95 virtual void endDeleteObject(MtpObjectHandle handle, bool succeeded) = 0; 96 97 virtual MtpObjectHandleList* getObjectReferences(MtpObjectHandle handle) = 0; 98 99 virtual MtpResponseCode setObjectReferences(MtpObjectHandle handle, 100 MtpObjectHandleList* references) = 0; 101 102 virtual MtpProperty* getObjectPropertyDesc(MtpObjectProperty property, 103 MtpObjectFormat format) = 0; 104 105 virtual MtpProperty* getDevicePropertyDesc(MtpDeviceProperty property) = 0; 106 107 virtual MtpResponseCode beginMoveObject(MtpObjectHandle handle, MtpObjectHandle newParent, 108 MtpStorageID newStorage) = 0; 109 110 virtual void endMoveObject(MtpObjectHandle oldParent, MtpObjectHandle newParent, 111 MtpStorageID oldStorage, MtpStorageID newStorage, 112 MtpObjectHandle handle, bool succeeded) = 0; 113 114 virtual MtpResponseCode beginCopyObject(MtpObjectHandle handle, MtpObjectHandle newParent, 115 MtpStorageID newStorage) = 0; 116 virtual void endCopyObject(MtpObjectHandle handle, bool succeeded) = 0; 117 }; 118 119 }; // namespace android 120 121 #endif // _I_MTP_DATABASE_H 122