Instrument Neutral Distributed Interface INDI  2.0.2
indiusbdevice.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2011 Gerry Rozema. All rights reserved.
3 
4  Upgrade to libusb 1.0 by CloudMakers, s. r. o.
5  Copyright(c) 2013 CloudMakers, s. r. o. All rights reserved.
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License version 2 as published by the Free Software Foundation.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 *******************************************************************************/
21 
22 #pragma once
23 
24 #include "indibase.h"
25 
26 #include <libusb.h>
27 
34 namespace INDI
35 {
36 
37 class USBDevice
38 {
39  protected:
40  libusb_device *dev;
41  libusb_device_handle *usb_handle;
42 
43  int ProductId;
44  int VendorId;
45 
48  int InputType;
50 
51  libusb_device *FindDevice(int, int, int);
52 
53  public:
54  int WriteInterrupt(unsigned char *, int, int);
55  int ReadInterrupt(unsigned char *, int, int);
56  int WriteBulk(unsigned char *buf, int nbytes, int timeout);
57  int ReadBulk(unsigned char *buf, int nbytes, int timeout);
58  int ControlMessage(unsigned char request_type, unsigned char request, unsigned int value, unsigned int index,
59  unsigned char *data, unsigned char len);
60  int FindEndpoints();
61  int Open();
62  void Close();
63  USBDevice();
64  USBDevice(libusb_device *dev);
65  virtual ~USBDevice();
66 };
67 }
int WriteBulk(unsigned char *buf, int nbytes, int timeout)
USBDevice(libusb_device *dev)
int WriteInterrupt(unsigned char *, int, int)
libusb_device * dev
Definition: indiusbdevice.h:40
int ReadBulk(unsigned char *buf, int nbytes, int timeout)
virtual ~USBDevice()
libusb_device_handle * usb_handle
Definition: indiusbdevice.h:41
int ReadInterrupt(unsigned char *, int, int)
int ControlMessage(unsigned char request_type, unsigned char request, unsigned int value, unsigned int index, unsigned char *data, unsigned char len)
libusb_device * FindDevice(int, int, int)
Namespace to encapsulate INDI client, drivers, and mediator classes.