Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 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 | |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 17 | #ifndef _I_MTP_DATABASE_H |
| 18 | #define _I_MTP_DATABASE_H |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 19 | |
Mike Lockwood | 335dd2b | 2010-05-19 10:33:39 -0400 | [diff] [blame] | 20 | #include "MtpTypes.h" |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 21 | |
Mike Lockwood | 7850ef9 | 2010-05-14 10:10:36 -0400 | [diff] [blame] | 22 | namespace android { |
| 23 | |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 24 | class MtpDataPacket; |
Mike Lockwood | 8277cec | 2010-08-10 15:20:35 -0400 | [diff] [blame] | 25 | class MtpProperty; |
Mike Lockwood | 7d77dcf | 2011-04-21 17:05:55 -0700 | [diff] [blame] | 26 | class MtpObjectInfo; |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 27 | |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 28 | class IMtpDatabase { |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 29 | public: |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 30 | virtual ~IMtpDatabase() {} |
Mike Lockwood | fceef46 | 2010-05-14 15:35:17 -0400 | [diff] [blame] | 31 | |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 32 | // Called from SendObjectInfo to reserve a database entry for the incoming file. |
Mike Lockwood | 4714b07 | 2010-07-12 08:49:01 -0400 | [diff] [blame] | 33 | virtual MtpObjectHandle beginSendObject(const char* path, |
Mike Lockwood | 0250361 | 2010-07-02 14:03:31 -0400 | [diff] [blame] | 34 | MtpObjectFormat format, |
| 35 | MtpObjectHandle parent, |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 36 | MtpStorageID storage) = 0; |
Mike Lockwood | 0250361 | 2010-07-02 14:03:31 -0400 | [diff] [blame] | 37 | |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 38 | // Called to report success or failure of the SendObject file transfer. |
| 39 | virtual void endSendObject(MtpObjectHandle handle, |
Mike Lockwood | 4714b07 | 2010-07-12 08:49:01 -0400 | [diff] [blame] | 40 | bool succeeded) = 0; |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 41 | |
| 42 | // Called to rescan a file, such as after an edit. |
| 43 | virtual void rescanFile(const char* path, |
| 44 | MtpObjectHandle handle, |
| 45 | MtpObjectFormat format) = 0; |
kyle_tso | 6de1660 | 2017-11-22 18:14:51 +0800 | [diff] [blame] | 46 | |
Mike Lockwood | 0250361 | 2010-07-02 14:03:31 -0400 | [diff] [blame] | 47 | virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID, |
Mike Lockwood | 4714b07 | 2010-07-12 08:49:01 -0400 | [diff] [blame] | 48 | MtpObjectFormat format, |
| 49 | MtpObjectHandle parent) = 0; |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 50 | |
Mike Lockwood | 343af4e | 2010-08-02 10:52:20 -0400 | [diff] [blame] | 51 | virtual int getNumObjects(MtpStorageID storageID, |
| 52 | MtpObjectFormat format, |
| 53 | MtpObjectHandle parent) = 0; |
| 54 | |
Mike Lockwood | 782aef1 | 2010-08-10 07:37:50 -0400 | [diff] [blame] | 55 | // callee should delete[] the results from these |
| 56 | // results can be NULL |
| 57 | virtual MtpObjectFormatList* getSupportedPlaybackFormats() = 0; |
| 58 | virtual MtpObjectFormatList* getSupportedCaptureFormats() = 0; |
| 59 | virtual MtpObjectPropertyList* getSupportedObjectProperties(MtpObjectFormat format) = 0; |
| 60 | virtual MtpDevicePropertyList* getSupportedDeviceProperties() = 0; |
| 61 | |
Mike Lockwood | 8277cec | 2010-08-10 15:20:35 -0400 | [diff] [blame] | 62 | virtual MtpResponseCode getObjectPropertyValue(MtpObjectHandle handle, |
Mike Lockwood | 0250361 | 2010-07-02 14:03:31 -0400 | [diff] [blame] | 63 | MtpObjectProperty property, |
| 64 | MtpDataPacket& packet) = 0; |
Mike Lockwood | fceef46 | 2010-05-14 15:35:17 -0400 | [diff] [blame] | 65 | |
Mike Lockwood | 8277cec | 2010-08-10 15:20:35 -0400 | [diff] [blame] | 66 | virtual MtpResponseCode setObjectPropertyValue(MtpObjectHandle handle, |
| 67 | MtpObjectProperty property, |
| 68 | MtpDataPacket& packet) = 0; |
| 69 | |
| 70 | virtual MtpResponseCode getDevicePropertyValue(MtpDeviceProperty property, |
| 71 | MtpDataPacket& packet) = 0; |
| 72 | |
| 73 | virtual MtpResponseCode setDevicePropertyValue(MtpDeviceProperty property, |
| 74 | MtpDataPacket& packet) = 0; |
| 75 | |
| 76 | virtual MtpResponseCode resetDeviceProperty(MtpDeviceProperty property) = 0; |
| 77 | |
Mike Lockwood | b6da06e | 2010-10-14 18:03:25 -0400 | [diff] [blame] | 78 | virtual MtpResponseCode getObjectPropertyList(MtpObjectHandle handle, |
Mike Lockwood | 40ce1f2 | 2010-12-01 18:46:23 -0500 | [diff] [blame] | 79 | uint32_t format, uint32_t property, |
Mike Lockwood | b6da06e | 2010-10-14 18:03:25 -0400 | [diff] [blame] | 80 | int groupCode, int depth, |
| 81 | MtpDataPacket& packet) = 0; |
| 82 | |
Mike Lockwood | 0250361 | 2010-07-02 14:03:31 -0400 | [diff] [blame] | 83 | virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle, |
Mike Lockwood | 7d77dcf | 2011-04-21 17:05:55 -0700 | [diff] [blame] | 84 | MtpObjectInfo& info) = 0; |
Mike Lockwood | fceef46 | 2010-05-14 15:35:17 -0400 | [diff] [blame] | 85 | |
Mike Lockwood | 6400078 | 2011-04-24 18:40:17 -0700 | [diff] [blame] | 86 | virtual void* getThumbnail(MtpObjectHandle handle, size_t& outThumbSize) = 0; |
| 87 | |
Mike Lockwood | 9c04c4c | 2010-08-02 10:37:41 -0400 | [diff] [blame] | 88 | virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle, |
Mike Lockwood | fd34626 | 2010-12-08 16:08:01 -0800 | [diff] [blame] | 89 | MtpString& outFilePath, |
| 90 | int64_t& outFileLength, |
| 91 | MtpObjectFormat& outFormat) = 0; |
Mike Lockwood | 438344f | 2010-08-03 15:30:09 -0400 | [diff] [blame] | 92 | |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 93 | virtual MtpResponseCode beginDeleteObject(MtpObjectHandle handle) = 0; |
| 94 | virtual void endDeleteObject(MtpObjectHandle handle, bool succeeded) = 0; |
Mike Lockwood | 438344f | 2010-08-03 15:30:09 -0400 | [diff] [blame] | 95 | |
| 96 | virtual MtpObjectHandleList* getObjectReferences(MtpObjectHandle handle) = 0; |
| 97 | |
| 98 | virtual MtpResponseCode setObjectReferences(MtpObjectHandle handle, |
| 99 | MtpObjectHandleList* references) = 0; |
| 100 | |
Mike Lockwood | 8277cec | 2010-08-10 15:20:35 -0400 | [diff] [blame] | 101 | virtual MtpProperty* getObjectPropertyDesc(MtpObjectProperty property, |
| 102 | MtpObjectFormat format) = 0; |
| 103 | |
| 104 | virtual MtpProperty* getDevicePropertyDesc(MtpDeviceProperty property) = 0; |
Mike Lockwood | 6b3a9d1 | 2010-08-31 16:25:12 -0400 | [diff] [blame] | 105 | |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 106 | virtual MtpResponseCode beginMoveObject(MtpObjectHandle handle, MtpObjectHandle newParent, |
| 107 | MtpStorageID newStorage) = 0; |
Jerry Zhang | 708b3e0 | 2017-09-26 17:53:39 -0700 | [diff] [blame] | 108 | |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 109 | virtual void endMoveObject(MtpObjectHandle oldParent, MtpObjectHandle newParent, |
| 110 | MtpStorageID oldStorage, MtpStorageID newStorage, |
| 111 | MtpObjectHandle handle, bool succeeded) = 0; |
Mike Lockwood | 6b3a9d1 | 2010-08-31 16:25:12 -0400 | [diff] [blame] | 112 | |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 113 | virtual MtpResponseCode beginCopyObject(MtpObjectHandle handle, MtpObjectHandle newParent, |
| 114 | MtpStorageID newStorage); |
| 115 | virtual void endCopyObject(MtpObjectHandle handle, bool succeeded); |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 116 | }; |
| 117 | |
Mike Lockwood | 7850ef9 | 2010-05-14 10:10:36 -0400 | [diff] [blame] | 118 | }; // namespace android |
| 119 | |
Jerry Zhang | e5aa05d | 2017-10-13 12:14:42 -0700 | [diff] [blame] | 120 | #endif // _I_MTP_DATABASE_H |