blob: bbbbc38b5ca8386c27d847412c50fcda77b2e7c2 [file] [log] [blame]
Mike Lockwood16864ba2010-05-11 17:16:59 -04001/*
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 Lockwood335dd2b2010-05-19 10:33:39 -040020#include "MtpTypes.h"
Mike Lockwood16864ba2010-05-11 17:16:59 -040021
Mike Lockwood7850ef92010-05-14 10:10:36 -040022namespace android {
23
Mike Lockwood16864ba2010-05-11 17:16:59 -040024class MtpDataPacket;
Mike Lockwood16864ba2010-05-11 17:16:59 -040025
Mike Lockwood02503612010-07-02 14:03:31 -040026class MtpDatabase {
Mike Lockwood16864ba2010-05-11 17:16:59 -040027public:
Mike Lockwooddda7e2b2010-07-03 14:40:05 -040028 virtual ~MtpDatabase() {}
Mike Lockwoodfceef462010-05-14 15:35:17 -040029
Mike Lockwood4714b072010-07-12 08:49:01 -040030 // called from SendObjectInfo to reserve a database entry for the incoming file
31 virtual MtpObjectHandle beginSendObject(const char* path,
Mike Lockwood02503612010-07-02 14:03:31 -040032 MtpObjectFormat format,
33 MtpObjectHandle parent,
34 MtpStorageID storage,
35 uint64_t size,
36 time_t modified) = 0;
37
Mike Lockwood4714b072010-07-12 08:49:01 -040038 // 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 Lockwood02503612010-07-02 14:03:31 -040046 virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
Mike Lockwood4714b072010-07-12 08:49:01 -040047 MtpObjectFormat format,
48 MtpObjectHandle parent) = 0;
Mike Lockwood16864ba2010-05-11 17:16:59 -040049
Mike Lockwood343af4e2010-08-02 10:52:20 -040050 virtual int getNumObjects(MtpStorageID storageID,
51 MtpObjectFormat format,
52 MtpObjectHandle parent) = 0;
53
Mike Lockwood02503612010-07-02 14:03:31 -040054 virtual MtpResponseCode getObjectProperty(MtpObjectHandle handle,
55 MtpObjectProperty property,
56 MtpDataPacket& packet) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040057
Mike Lockwood02503612010-07-02 14:03:31 -040058 virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle,
59 MtpDataPacket& packet) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040060
Mike Lockwood9c04c4c2010-08-02 10:37:41 -040061 virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle,
Mike Lockwood02503612010-07-02 14:03:31 -040062 MtpString& filePath,
63 int64_t& fileLength) = 0;
Mike Lockwood9c04c4c2010-08-02 10:37:41 -040064 virtual MtpResponseCode deleteFile(MtpObjectHandle handle) = 0;
Mike Lockwood16864ba2010-05-11 17:16:59 -040065};
66
Mike Lockwood7850ef92010-05-14 10:10:36 -040067}; // namespace android
68
Mike Lockwood16864ba2010-05-11 17:16:59 -040069#endif // _MTP_DATABASE_H