blob: ce6b13c2d535d11f8377f3e45c9c74fb74da519e [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_MTPSERVER_HPP
20#define MTP_MTPSERVER_HPP
21#include <utils/Log.h>
22
23#include <string>
24#include <stdio.h>
25#include <assert.h>
26#include <limits.h>
27#include <unistd.h>
28#include <fcntl.h>
29#include <utils/threads.h>
30
31#include "MtpServer.h"
32#include "MtpStorage.h"
33#include "mtp_MtpDatabase.hpp"
34
35typedef struct Storage {
36 std::string display;
37 std::string mount;
38 int mtpid;
39} storage;
40
41typedef std::vector<storage*> storages;
42
43class twmtp_MtpServer {
44 public:
45 void start();
Ethan Yonker20fd25c2014-09-03 14:04:43 -050046 int setup();
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040047 void run();
48 void cleanup();
49 void send_object_added(int handle);
50 void send_object_removed(int handle);
51 void add_storage();
52 void remove_storage(int storageId);
53 void set_storages(storages* mtpstorages);
54 storages *stores;
55 private:
56 bool usePtp;
57 MtpServer* server;
58 MtpServer* refserver;
59
60};
61#endif