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 | |
| 17 | #ifndef _MTP_DATABASE_H |
| 18 | #define _MTP_DATABASE_H |
| 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 | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 25 | |
Mike Lockwood | 0250361 | 2010-07-02 14:03:31 -0400 | [diff] [blame] | 26 | class MtpDatabase { |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 27 | public: |
Mike Lockwood | dda7e2b | 2010-07-03 14:40:05 -0400 | [diff] [blame] | 28 | virtual ~MtpDatabase() {} |
Mike Lockwood | fceef46 | 2010-05-14 15:35:17 -0400 | [diff] [blame] | 29 | |
Mike Lockwood | 4714b07 | 2010-07-12 08:49:01 -0400 | [diff] [blame] | 30 | // called from SendObjectInfo to reserve a database entry for the incoming file |
| 31 | virtual MtpObjectHandle beginSendObject(const char* path, |
Mike Lockwood | 0250361 | 2010-07-02 14:03:31 -0400 | [diff] [blame] | 32 | MtpObjectFormat format, |
| 33 | MtpObjectHandle parent, |
| 34 | MtpStorageID storage, |
| 35 | uint64_t size, |
| 36 | time_t modified) = 0; |
| 37 | |
Mike Lockwood | 4714b07 | 2010-07-12 08:49:01 -0400 | [diff] [blame] | 38 | // called to report success or failure of the SendObject file transfer |
| 39 | // success should signal a notification of the new object's creation, |
| 40 | // failure should remove the database entry created in beginSendObject |
| 41 | virtual void endSendObject(const char* path, |
| 42 | MtpObjectHandle handle, |
| 43 | MtpObjectFormat format, |
| 44 | bool succeeded) = 0; |
| 45 | |
Mike Lockwood | 0250361 | 2010-07-02 14:03:31 -0400 | [diff] [blame] | 46 | virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID, |
Mike Lockwood | 4714b07 | 2010-07-12 08:49:01 -0400 | [diff] [blame] | 47 | MtpObjectFormat format, |
| 48 | MtpObjectHandle parent) = 0; |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 49 | |
Mike Lockwood | 0250361 | 2010-07-02 14:03:31 -0400 | [diff] [blame] | 50 | virtual MtpResponseCode getObjectProperty(MtpObjectHandle handle, |
| 51 | MtpObjectProperty property, |
| 52 | MtpDataPacket& packet) = 0; |
Mike Lockwood | fceef46 | 2010-05-14 15:35:17 -0400 | [diff] [blame] | 53 | |
Mike Lockwood | 0250361 | 2010-07-02 14:03:31 -0400 | [diff] [blame] | 54 | virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle, |
| 55 | MtpDataPacket& packet) = 0; |
Mike Lockwood | fceef46 | 2010-05-14 15:35:17 -0400 | [diff] [blame] | 56 | |
Mike Lockwood | 9c04c4c | 2010-08-02 10:37:41 -0400 | [diff] [blame^] | 57 | virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle, |
Mike Lockwood | 0250361 | 2010-07-02 14:03:31 -0400 | [diff] [blame] | 58 | MtpString& filePath, |
| 59 | int64_t& fileLength) = 0; |
Mike Lockwood | 9c04c4c | 2010-08-02 10:37:41 -0400 | [diff] [blame^] | 60 | virtual MtpResponseCode deleteFile(MtpObjectHandle handle) = 0; |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 61 | }; |
| 62 | |
Mike Lockwood | 7850ef9 | 2010-05-14 10:10:36 -0400 | [diff] [blame] | 63 | }; // namespace android |
| 64 | |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 65 | #endif // _MTP_DATABASE_H |