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_LINUX_USB_ENDPOINT_H
21 #define AFTL_MTP_BACKEND_LINUX_USB_ENDPOINT_H
22 
23 #include <mtp/types.h>
24 #include <mtp/usb/types.h>
25 #include <vector>
26 
27 namespace mtp { namespace usb
28 {
29 
30 	class Endpoint;
31 	DECLARE_PTR(Endpoint);
32 
33 	class Endpoint
34 	{
35 		EndpointDirection	_direction;
36 		EndpointType		_type;
37 		u8					_addr;
38 		u16					_maxPacketSize;
39 
40 	public:
41 		Endpoint(const std::string &path);
42 
GetAddress()43 		u8 GetAddress() const
44 		{ return _addr; }
45 
GetMaxPacketSize()46 		int GetMaxPacketSize() const
47 		{ return _maxPacketSize; }
48 
GetDirection()49 		EndpointDirection GetDirection() const
50 		{ return _direction; }
51 
GetType()52 		EndpointType GetType() const
53 		{ return _type; }
54 
55 		static EndpointPtr TryOpen(const std::string &path);
56 	};
57 	DECLARE_PTR(Endpoint);
58 
59 }}
60 
61 #endif
62