ngscopeclient 0.1-dev+51fbda87c
Public Member Functions | Protected Attributes | List of all members
HID Class Reference

Wrapper class for a USB HID connection. More...

#include <HID.h>

Public Member Functions

 HID ()
 Constructor.
 
bool Connect (unsigned short vendorId, unsigned short productId, const char *serialNumber=NULL)
 Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number. More...
 
void Close ()
 Disconnects from the serial port.
 
virtual ~HID ()
 Destructor.
 
int Read (unsigned char *data, int len)
 
int Write (const unsigned char *data, int len)
 
hid_device * GetHandle ()
 
std::string GetManufacturerName ()
 
std::string GetProductName ()
 
std::string GetSerialNumber ()
 
bool IsValid () const
 

Protected Attributes

hid_device * m_handle
 
std::string m_manufacturerName
 
std::string m_productName
 
std::string m_serialNumber
 

Detailed Description

Wrapper class for a USB HID connection.

Member Function Documentation

◆ Connect()

bool HID::Connect ( unsigned short  vendorId,
unsigned short  productId,
const char *  serialNumber = NULL 
)

Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number.

If serial_number is NULL, the first device with the specified VID and PID is opened.

Parameters
vendorIdThe Vendor ID (VID) of the device to open.
productIdThe Product ID (PID) of the device to open.
serialNumberThe Serial Number of the device to open (Optionally NULL).
Returns
This function returns true if the device could be connected, false otherwise.

The documentation for this class was generated from the following files: