blob: 17823dfac15680ce58f9daf6abcb34137c99b4fe [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 Lockwood782aef12010-08-10 07:37:50 -040054 // callee should delete[] the results from these
55 // results can be NULL
56 virtual MtpObjectFormatList* getSupportedPlaybackFormats() = 0;
57 virtual MtpObjectFormatList* getSupportedCaptureFormats() = 0;
58 virtual MtpObjectPropertyList* getSupportedObjectProperties(MtpObjectFormat format) = 0;
59 virtual MtpDevicePropertyList* getSupportedDeviceProperties() = 0;
60
Mike Lockwood02503612010-07-02 14:03:31 -040061 virtual MtpResponseCode getObjectProperty(MtpObjectHandle handle,
62 MtpObjectProperty property,
63 MtpDataPacket& packet) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040064
Mike Lockwood02503612010-07-02 14:03:31 -040065 virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle,
66 MtpDataPacket& packet) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040067
Mike Lockwood9c04c4c2010-08-02 10:37:41 -040068 virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle,
Mike Lockwood02503612010-07-02 14:03:31 -040069 MtpString& filePath,
70 int64_t& fileLength) = 0;
Mike Lockwood438344f2010-08-03 15:30:09 -040071
Mike Lockwood9c04c4c2010-08-02 10:37:41 -040072 virtual MtpResponseCode deleteFile(MtpObjectHandle handle) = 0;
Mike Lockwood438344f2010-08-03 15:30:09 -040073
74 virtual MtpObjectHandleList* getObjectReferences(MtpObjectHandle handle) = 0;
75
76 virtual MtpResponseCode setObjectReferences(MtpObjectHandle handle,
77 MtpObjectHandleList* references) = 0;
78
Mike Lockwood16864ba2010-05-11 17:16:59 -040079};
80
Mike Lockwood7850ef92010-05-14 10:10:36 -040081}; // namespace android
82
Mike Lockwood16864ba2010-05-11 17:16:59 -040083#endif // _MTP_DATABASE_H