blob: 4d9a1ae3d6a47af209c5e920389dac55a9f84705 [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 Lockwoodb6da06e2010-10-14 18:03:25 -040078 virtual MtpResponseCode getObjectPropertyList(MtpObjectHandle handle,
Mike Lockwood40ce1f22010-12-01 18:46:23 -050079 uint32_t format, uint32_t property,
Mike Lockwoodb6da06e2010-10-14 18:03:25 -040080 int groupCode, int depth,
81 MtpDataPacket& packet) = 0;
82
Mike Lockwood02503612010-07-02 14:03:31 -040083 virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle,
84 MtpDataPacket& packet) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040085
Mike Lockwood9c04c4c2010-08-02 10:37:41 -040086 virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle,
Mike Lockwoodfd346262010-12-08 16:08:01 -080087 MtpString& outFilePath,
88 int64_t& outFileLength,
89 MtpObjectFormat& outFormat) = 0;
Mike Lockwood438344f2010-08-03 15:30:09 -040090
Mike Lockwood9c04c4c2010-08-02 10:37:41 -040091 virtual MtpResponseCode deleteFile(MtpObjectHandle handle) = 0;
Mike Lockwood438344f2010-08-03 15:30:09 -040092
93 virtual MtpObjectHandleList* getObjectReferences(MtpObjectHandle handle) = 0;
94
95 virtual MtpResponseCode setObjectReferences(MtpObjectHandle handle,
96 MtpObjectHandleList* references) = 0;
97
Mike Lockwood8277cec2010-08-10 15:20:35 -040098 virtual MtpProperty* getObjectPropertyDesc(MtpObjectProperty property,
99 MtpObjectFormat format) = 0;
100
101 virtual MtpProperty* getDevicePropertyDesc(MtpDeviceProperty property) = 0;
Mike Lockwood6b3a9d12010-08-31 16:25:12 -0400102
103 virtual void sessionStarted() = 0;
104
105 virtual void sessionEnded() = 0;
Mike Lockwood16864ba2010-05-11 17:16:59 -0400106};
107
Mike Lockwood7850ef92010-05-14 10:10:36 -0400108}; // namespace android
109
Mike Lockwood16864ba2010-05-11 17:16:59 -0400110#endif // _MTP_DATABASE_H