blob: c25e9b24c0fc39866a27ba929914acf2a4ce0c1d [file] [log] [blame]
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -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 * Copyright (C) 2014 TeamWin - bigbiff and Dees_Troy mtp database conversion to c++
17 */
18
19#ifndef _MTP_DATABASE_H
20#define _MTP_DATABASE_H
21
22#include "MtpTypes.h"
23
24class MtpDataPacket;
25class MtpProperty;
26class MtpObjectInfo;
27
28class MtpDatabase {
29public:
30 virtual ~MtpDatabase() {}
31
32 // called from SendObjectInfo to reserve a database entry for the incoming file
33 virtual MtpObjectHandle beginSendObject(const char* path,
34 MtpObjectFormat format,
35 MtpObjectHandle parent,
36 MtpStorageID storage,
37 uint64_t size,
38 time_t modified) = 0;
39
40 // called to report success or failure of the SendObject file transfer
41 // success should signal a notification of the new object's creation,
42 // failure should remove the database entry created in beginSendObject
43 virtual void endSendObject(const char* path,
44 MtpObjectHandle handle,
45 MtpObjectFormat format,
46 bool succeeded) = 0;
47
48 virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
49 MtpObjectFormat format,
50 MtpObjectHandle parent) = 0;
51
52 virtual int getNumObjects(MtpStorageID storageID,
53 MtpObjectFormat format,
54 MtpObjectHandle parent) = 0;
55
56 // callee should delete[] the results from these
57 // results can be NULL
58 virtual MtpObjectFormatList* getSupportedPlaybackFormats() = 0;
59 virtual MtpObjectFormatList* getSupportedCaptureFormats() = 0;
60 virtual MtpObjectPropertyList* getSupportedObjectProperties(MtpObjectFormat format) = 0;
61 virtual MtpDevicePropertyList* getSupportedDeviceProperties() = 0;
62
63 virtual void createDB(MtpStorage* storage, MtpStorageID storageID) = 0;
64
65 virtual MtpResponseCode getObjectPropertyValue(MtpObjectHandle handle,
66 MtpObjectProperty property,
67 MtpDataPacket& packet) = 0;
68
69 virtual MtpResponseCode setObjectPropertyValue(MtpObjectHandle handle,
70 MtpObjectProperty property,
71 MtpDataPacket& packet) = 0;
72
73 virtual MtpResponseCode getDevicePropertyValue(MtpDeviceProperty property,
74 MtpDataPacket& packet) = 0;
75
76 virtual MtpResponseCode setDevicePropertyValue(MtpDeviceProperty property,
77 MtpDataPacket& packet) = 0;
78
79 virtual MtpResponseCode resetDeviceProperty(MtpDeviceProperty property) = 0;
80
81 virtual MtpResponseCode getObjectPropertyList(MtpObjectHandle handle,
82 uint32_t format, uint32_t property,
83 int groupCode, int depth,
84 MtpDataPacket& packet) = 0;
85
86 virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle,
87 MtpObjectInfo& info) = 0;
88
89 virtual void* getThumbnail(MtpObjectHandle handle, size_t& outThumbSize) = 0;
90
91 virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle,
92 MtpString& outFilePath,
93 int64_t& outFileLength,
94 MtpObjectFormat& outFormat) = 0;
95
96 virtual MtpResponseCode deleteFile(MtpObjectHandle handle) = 0;
97
98 virtual MtpObjectHandleList* getObjectReferences(MtpObjectHandle handle) = 0;
99
100 virtual MtpResponseCode setObjectReferences(MtpObjectHandle handle,
101 MtpObjectHandleList* references) = 0;
102
103 virtual MtpProperty* getObjectPropertyDesc(MtpObjectProperty property,
104 MtpObjectFormat format) = 0;
105
106 virtual MtpProperty* getDevicePropertyDesc(MtpDeviceProperty property) = 0;
107
108 virtual void sessionStarted() = 0;
109
110 virtual void sessionEnded() = 0;
111 virtual void lockMutex() = 0;
112 virtual void unlockMutex() = 0;
113};
114
115#endif // _MTP_DATABASE_H