blob: a6aaf0f6987ef4d50aeb6c67e4b8c7fcb1e8ab3f [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#include "SqliteDatabase.h"
Mike Lockwood16864ba2010-05-11 17:16:59 -040022
Mike Lockwood7850ef92010-05-14 10:10:36 -040023namespace android {
24
Mike Lockwood16864ba2010-05-11 17:16:59 -040025class MtpDataPacket;
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 Lockwood02503612010-07-02 14:03:31 -040031 virtual MtpObjectHandle getObjectHandle(const char* path) = 0;
32 virtual MtpObjectHandle addFile(const char* path,
33 MtpObjectFormat format,
34 MtpObjectHandle parent,
35 MtpStorageID storage,
36 uint64_t size,
37 time_t modified) = 0;
38
Mike Lockwood02503612010-07-02 14:03:31 -040039 virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
Mike Lockwood16864ba2010-05-11 17:16:59 -040040 MtpObjectFormat format,
Mike Lockwood02503612010-07-02 14:03:31 -040041 MtpObjectHandle parent) = 0;
Mike Lockwood16864ba2010-05-11 17:16:59 -040042
Mike Lockwood02503612010-07-02 14:03:31 -040043 virtual MtpResponseCode getObjectProperty(MtpObjectHandle handle,
44 MtpObjectProperty property,
45 MtpDataPacket& packet) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040046
Mike Lockwood02503612010-07-02 14:03:31 -040047 virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle,
48 MtpDataPacket& packet) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040049
Mike Lockwood02503612010-07-02 14:03:31 -040050 virtual bool getObjectFilePath(MtpObjectHandle handle,
51 MtpString& filePath,
52 int64_t& fileLength) = 0;
53 virtual bool deleteFile(MtpObjectHandle handle) = 0;
Mike Lockwoodfceef462010-05-14 15:35:17 -040054
55 // helper for media scanner
Mike Lockwood02503612010-07-02 14:03:31 -040056 virtual MtpObjectHandle* getFileList(int& outCount) = 0;
57
58 virtual void beginTransaction() = 0;
59 virtual void commitTransaction() = 0;
60 virtual void rollbackTransaction() = 0;
Mike Lockwood16864ba2010-05-11 17:16:59 -040061};
62
Mike Lockwood7850ef92010-05-14 10:10:36 -040063}; // namespace android
64
Mike Lockwood16864ba2010-05-11 17:16:59 -040065#endif // _MTP_DATABASE_H