blob: d87c22648e7f5b657ef653a78914d5ddd709aa11 [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_CLIENT_H
18#define _MTP_CLIENT_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 MtpClient {
25private:
Mike Lockwood5ed68d22010-05-25 19:08:48 -040026 MtpDeviceList mDeviceList;
27 bool mStarted;
Mike Lockwood16864ba2010-05-11 17:16:59 -040028
29public:
Mike Lockwood5ed68d22010-05-25 19:08:48 -040030 MtpClient();
Mike Lockwoode13401b2010-05-19 15:12:14 -040031 virtual ~MtpClient();
Mike Lockwood16864ba2010-05-11 17:16:59 -040032
Mike Lockwood5ed68d22010-05-25 19:08:48 -040033 bool start();
Mike Lockwood16864ba2010-05-11 17:16:59 -040034
Mike Lockwood5ed68d22010-05-25 19:08:48 -040035 inline MtpDeviceList& getDeviceList() { return mDeviceList; }
36 MtpDevice* getDevice(int id);
37
38
39 virtual void deviceAdded(MtpDevice *device) = 0;
40 virtual void deviceRemoved(MtpDevice *device) = 0;
Mike Lockwood335dd2b2010-05-19 10:33:39 -040041
Mike Lockwood16864ba2010-05-11 17:16:59 -040042private:
Mike Lockwood5ed68d22010-05-25 19:08:48 -040043 void usbDeviceAdded(const char *devname);
44 void usbDeviceRemoved(const char *devname);
45 static void usb_device_added(const char *devname, void* client_data);
46 static void usb_device_removed(const char *devname, void* client_data);
Mike Lockwood16864ba2010-05-11 17:16:59 -040047};
48
Mike Lockwood7850ef92010-05-14 10:10:36 -040049}; // namespace android
50
Mike Lockwood16864ba2010-05-11 17:16:59 -040051#endif // _MTP_CLIENT_H