1 | /******************************************************************************* |
---|
2 | Copyright(c) 2010 Gerry Rozema. All rights reserved. |
---|
3 | |
---|
4 | This program is free software; you can redistribute it and/or modify it |
---|
5 | under the terms of the GNU General Public License as published by the Free |
---|
6 | Software Foundation; either version 2 of the License, or (at your option) |
---|
7 | any later version. |
---|
8 | |
---|
9 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
12 | more details. |
---|
13 | |
---|
14 | You should have received a copy of the GNU General Public License along with |
---|
15 | this program; if not, write to the Free Software Foundation, Inc., 59 |
---|
16 | Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
17 | |
---|
18 | The full GNU General Public License is included in this distribution in the |
---|
19 | file called LICENSE. |
---|
20 | *******************************************************************************/ |
---|
21 | |
---|
22 | #ifndef USBDEVICE_H |
---|
23 | #define USBDEVICE_H |
---|
24 | |
---|
25 | #pragma once |
---|
26 | |
---|
27 | #include <stdio.h> |
---|
28 | #include <stdlib.h> |
---|
29 | #include <unistd.h> |
---|
30 | #include <errno.h> |
---|
31 | |
---|
32 | #include <usb.h> |
---|
33 | |
---|
34 | #include "indibase.h" |
---|
35 | |
---|
36 | class INDI::USBDevice |
---|
37 | { |
---|
38 | protected: |
---|
39 | struct usb_device *dev; |
---|
40 | struct usb_dev_handle *usb_handle; |
---|
41 | |
---|
42 | int ProductId; |
---|
43 | int VendorId; |
---|
44 | |
---|
45 | int OutputType; |
---|
46 | int OutputEndpoint; |
---|
47 | int InputType; |
---|
48 | int InputEndpoint; |
---|
49 | |
---|
50 | struct usb_device * FindDevice(int,int,int); |
---|
51 | |
---|
52 | public: |
---|
53 | int WriteInterrupt(char *,int,int); |
---|
54 | int ReadInterrupt(char *,int,int); |
---|
55 | |
---|
56 | int ControlMessage(); |
---|
57 | |
---|
58 | int WriteBulk(char *,int,int); |
---|
59 | int ReadBulk(char *,int,int); |
---|
60 | int FindEndpoints(); |
---|
61 | int Open(); |
---|
62 | USBDevice(void); |
---|
63 | USBDevice(struct usb_device *); |
---|
64 | virtual ~USBDevice(void); |
---|
65 | }; |
---|
66 | |
---|
67 | #endif // USBDEVICE_H |
---|