Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 1 | /* |
| 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 Lockwood | 335dd2b | 2010-05-19 10:33:39 -0400 | [diff] [blame] | 20 | #include "MtpTypes.h" |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 21 | |
Mike Lockwood | 7850ef9 | 2010-05-14 10:10:36 -0400 | [diff] [blame] | 22 | namespace android { |
| 23 | |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 24 | class MtpClient { |
| 25 | private: |
Mike Lockwood | 5ed68d2 | 2010-05-25 19:08:48 -0400 | [diff] [blame^] | 26 | MtpDeviceList mDeviceList; |
| 27 | bool mStarted; |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 28 | |
| 29 | public: |
Mike Lockwood | 5ed68d2 | 2010-05-25 19:08:48 -0400 | [diff] [blame^] | 30 | MtpClient(); |
Mike Lockwood | e13401b | 2010-05-19 15:12:14 -0400 | [diff] [blame] | 31 | virtual ~MtpClient(); |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 32 | |
Mike Lockwood | 5ed68d2 | 2010-05-25 19:08:48 -0400 | [diff] [blame^] | 33 | bool start(); |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 34 | |
Mike Lockwood | 5ed68d2 | 2010-05-25 19:08:48 -0400 | [diff] [blame^] | 35 | 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 Lockwood | 335dd2b | 2010-05-19 10:33:39 -0400 | [diff] [blame] | 41 | |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 42 | private: |
Mike Lockwood | 5ed68d2 | 2010-05-25 19:08:48 -0400 | [diff] [blame^] | 43 | 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 Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 47 | }; |
| 48 | |
Mike Lockwood | 7850ef9 | 2010-05-14 10:10:36 -0400 | [diff] [blame] | 49 | }; // namespace android |
| 50 | |
Mike Lockwood | 16864ba | 2010-05-11 17:16:59 -0400 | [diff] [blame] | 51 | #endif // _MTP_CLIENT_H |