blob: 18aabb8acec0be95fad6179d9952b92eebe4703a [file] [log] [blame]
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -05001/*
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
20#include "MtpTypes.h"
21#include "MtpStringBuffer.h"
22
23class MtpDataPacket;
24class MtpProperty;
25class MtpObjectInfo;
26
27class MtpDatabase {
28public:
29 virtual ~MtpDatabase() {}
30
31 // called from SendObjectInfo to reserve a database entry for the incoming file
32 virtual MtpObjectHandle beginSendObject(const char* path,
33 MtpObjectFormat format,
34 MtpObjectHandle parent,
35 MtpStorageID storage,
36 uint64_t size,
37 time_t modified) = 0;
38
39 // 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
47 virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
48 MtpObjectFormat format,
49 MtpObjectHandle parent) = 0;
50
51 virtual int getNumObjects(MtpStorageID storageID,
52 MtpObjectFormat format,
53 MtpObjectHandle parent) = 0;
54
55 // 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
62 virtual void createDB(MtpStorage* storage, MtpStorageID storageID) = 0;
63
64 virtual MtpResponseCode getObjectPropertyValue(MtpObjectHandle handle,
65 MtpObjectProperty property,
66 MtpDataPacket& packet) = 0;
67
68 virtual MtpResponseCode setObjectPropertyValue(MtpObjectHandle handle,
69 MtpObjectProperty property,
70 MtpDataPacket& packet) = 0;
71
72 virtual MtpResponseCode getDevicePropertyValue(MtpDeviceProperty property,
73 MtpDataPacket& packet) = 0;
74
75 virtual MtpResponseCode setDevicePropertyValue(MtpDeviceProperty property,
76 MtpDataPacket& packet) = 0;
77
78 virtual MtpResponseCode resetDeviceProperty(MtpDeviceProperty property) = 0;
79
80 virtual MtpResponseCode getObjectPropertyList(MtpObjectHandle handle,
81 uint32_t format, uint32_t property,
82 int groupCode, int depth,
83 MtpDataPacket& packet) = 0;
84
85 virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle,
86 MtpObjectInfo& info) = 0;
87
88 virtual void* getThumbnail(MtpObjectHandle handle, size_t& outThumbSize) = 0;
89
90 virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle,
91 MtpStringBuffer& outFilePath,
92 int64_t& outFileLength,
93 MtpObjectFormat& outFormat) = 0;
94
95 // virtual MtpResponseCode deleteFile(MtpObjectHandle handle) = 0;
96
97 virtual MtpObjectHandleList* getObjectReferences(MtpObjectHandle handle) = 0;
98
99 virtual MtpResponseCode setObjectReferences(MtpObjectHandle handle,
100 MtpObjectHandleList* references) = 0;
101
102 virtual MtpProperty* getObjectPropertyDesc(MtpObjectProperty property,
103 MtpObjectFormat format) = 0;
104
105 virtual MtpProperty* getDevicePropertyDesc(MtpDeviceProperty property) = 0;
106
107 virtual void sessionStarted() = 0;
108
109 virtual void sessionEnded() = 0;
110};
111
112#endif // _MTP_DATABASE_H