blob: 1566a111e62a3682aee9d729009ce6bcf6571f59 [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 Lockwood02503612010-07-02 14:03:31 -040030 virtual MtpObjectHandle addFile(const char* path,
31 MtpObjectFormat format,
32 MtpObjectHandle parent,
33 MtpStorageID storage,
34 uint64_t size,
35 time_t modified) = 0;
36
Mike Lockwood02503612010-07-02 14:03:31 -040037 virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
Mike Lockwood16864ba2010-05-11 17:16:59 -040038 MtpObjectFormat format,
Mike Lockwood02503612010-07-02 14:03:31 -040039 MtpObjectHandle parent) = 0;
Mike Lockwood16864ba2010-05-11 17:16:59 -040040
Mike Lockwood02503612010-07-02 14:03:31 -040041 virtual MtpResponseCode getObjectProperty(MtpObjectHandle handle,
42 MtpObjectProperty property,
43 MtpDataPacket& packet) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040044
Mike Lockwood02503612010-07-02 14:03:31 -040045 virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle,
46 MtpDataPacket& packet) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040047
Mike Lockwood02503612010-07-02 14:03:31 -040048 virtual bool getObjectFilePath(MtpObjectHandle handle,
49 MtpString& filePath,
50 int64_t& fileLength) = 0;
51 virtual bool deleteFile(MtpObjectHandle handle) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040052
Mike Lockwood02503612010-07-02 14:03:31 -040053 virtual void beginTransaction() = 0;
54 virtual void commitTransaction() = 0;
55 virtual void rollbackTransaction() = 0;
Mike Lockwood16864ba2010-05-11 17:16:59 -040056};
57
Mike Lockwood7850ef92010-05-14 10:10:36 -040058}; // namespace android
59
Mike Lockwood16864ba2010-05-11 17:16:59 -040060#endif // _MTP_DATABASE_H