| 1 |
/* |
| 2 |
This file is part of Android File Transfer For Linux. |
| 3 |
Copyright (C) 2015-2020 Vladimir Menshakov |
| 4 |
|
| 5 |
This library is free software; you can redistribute it and/or modify it |
| 6 |
under the terms of the GNU Lesser General Public License as published by |
| 7 |
the Free Software Foundation; either version 2.1 of the License, |
| 8 |
or (at your option) any later version. |
| 9 |
|
| 10 |
This library is distributed in the hope that it will be useful, but |
| 11 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
Lesser General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU Lesser General Public License |
| 16 |
along with this library; if not, write to the Free Software Foundation, |
| 17 |
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef AFTL_MTP_BACKEND_LIBUSB_USB_CONTEXT_H |
| 21 |
#define AFTL_MTP_BACKEND_LIBUSB_USB_CONTEXT_H |
| 22 |
|
| 23 |
#include <mtp/types.h> |
| 24 |
#include <usb/DeviceDescriptor.h> |
| 25 |
#include <vector> |
| 26 |
|
| 27 |
namespace mtp { namespace usb |
| 28 |
{ |
| 29 |
|
| 30 |
class Context : public BUSBRoster, Noncopyable |
| 31 |
{ |
| 32 |
public: |
| 33 |
typedef std::vector<DeviceDescriptorPtr> Devices; |
| 34 |
|
| 35 |
private: |
| 36 |
Devices _devices; |
| 37 |
|
| 38 |
status_t DeviceAdded(BUSBDevice*) final override; |
| 39 |
void DeviceRemoved(BUSBDevice*) final override; |
| 40 |
|
| 41 |
public: |
| 42 |
Context(int debugLevel = 3); |
| 43 |
~Context(); |
| 44 |
|
| 45 |
void Wait(); |
| 46 |
|
| 47 |
const Devices & GetDevices() const |
| 48 |
{ return _devices; } |
| 49 |
}; |
| 50 |
DECLARE_PTR(Context); |
| 51 |
|
| 52 |
}} |
| 53 |
|
| 54 |
#endif |
| 55 |
|