blob: c8cb016c81013d9c2ec1803487fe8b61a13cbfc7 [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 Lockwood8277cec2010-08-10 15:20:35 -040025class MtpProperty;
Mike Lockwood16864ba2010-05-11 17:16:59 -040026
Mike Lockwood02503612010-07-02 14:03:31 -040027class MtpDatabase {
Mike Lockwood16864ba2010-05-11 17:16:59 -040028public:
Mike Lockwooddda7e2b2010-07-03 14:40:05 -040029 virtual ~MtpDatabase() {}
Mike Lockwoodfceef462010-05-14 15:35:17 -040030
Mike Lockwood4714b072010-07-12 08:49:01 -040031 // called from SendObjectInfo to reserve a database entry for the incoming file
32 virtual MtpObjectHandle beginSendObject(const char* path,
Mike Lockwood02503612010-07-02 14:03:31 -040033 MtpObjectFormat format,
34 MtpObjectHandle parent,
35 MtpStorageID storage,
36 uint64_t size,
37 time_t modified) = 0;
38
Mike Lockwood4714b072010-07-12 08:49:01 -040039 // called to report success or failure of the SendObject file transfer
40 // success should signal a notification of the new object's creation,
41 // failure should remove the database entry created in beginSendObject
42 virtual void endSendObject(const char* path,
43 MtpObjectHandle handle,
44 MtpObjectFormat format,
45 bool succeeded) = 0;
46
Mike Lockwood02503612010-07-02 14:03:31 -040047 virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
Mike Lockwood4714b072010-07-12 08:49:01 -040048 MtpObjectFormat format,
49 MtpObjectHandle parent) = 0;
Mike Lockwood16864ba2010-05-11 17:16:59 -040050
Mike Lockwood343af4e2010-08-02 10:52:20 -040051 virtual int getNumObjects(MtpStorageID storageID,
52 MtpObjectFormat format,
53 MtpObjectHandle parent) = 0;
54
Mike Lockwood782aef12010-08-10 07:37:50 -040055 // 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 Lockwood8277cec2010-08-10 15:20:35 -040062 virtual MtpResponseCode getObjectPropertyValue(MtpObjectHandle handle,
Mike Lockwood02503612010-07-02 14:03:31 -040063 MtpObjectProperty property,
64 MtpDataPacket& packet) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040065
Mike Lockwood8277cec2010-08-10 15:20:35 -040066 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 Lockwood02503612010-07-02 14:03:31 -040078 virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle,
79 MtpDataPacket& packet) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040080
Mike Lockwood9c04c4c2010-08-02 10:37:41 -040081 virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle,
Mike Lockwood02503612010-07-02 14:03:31 -040082 MtpString& filePath,
83 int64_t& fileLength) = 0;
Mike Lockwood438344f2010-08-03 15:30:09 -040084
Mike Lockwood9c04c4c2010-08-02 10:37:41 -040085 virtual MtpResponseCode deleteFile(MtpObjectHandle handle) = 0;
Mike Lockwood438344f2010-08-03 15:30:09 -040086
87 virtual MtpObjectHandleList* getObjectReferences(MtpObjectHandle handle) = 0;
88
89 virtual MtpResponseCode setObjectReferences(MtpObjectHandle handle,
90 MtpObjectHandleList* references) = 0;
91
Mike Lockwood8277cec2010-08-10 15:20:35 -040092 virtual MtpProperty* getObjectPropertyDesc(MtpObjectProperty property,
93 MtpObjectFormat format) = 0;
94
95 virtual MtpProperty* getDevicePropertyDesc(MtpDeviceProperty property) = 0;
Mike Lockwood6b3a9d12010-08-31 16:25:12 -040096
97 virtual void sessionStarted() = 0;
98
99 virtual void sessionEnded() = 0;
Mike Lockwood16864ba2010-05-11 17:16:59 -0400100};
101
Mike Lockwood7850ef92010-05-14 10:10:36 -0400102}; // namespace android
103
Mike Lockwood16864ba2010-05-11 17:16:59 -0400104#endif // _MTP_DATABASE_H