Files
itgmania212121/stepmania/src/archutils/Win32/USB.h
T

49 lines
1.1 KiB
C++
Raw Normal View History

2003-03-19 20:34:40 +00:00
#ifndef WIN32_USB_H
#define WIN32_USB_H
2003-07-14 06:24:30 +00:00
#include <vector>
/* The API for Windows device I/O is obscenely horrible, so encapsulate it. */
class WindowsFileIO
2003-03-19 20:34:40 +00:00
{
public:
2003-07-14 06:24:30 +00:00
WindowsFileIO();
~WindowsFileIO();
bool Open(CString path, int blocksize);
bool IsOpen() const;
/* Returns the amount of data read. */
/* If nonblocking is true, this will */
/* Nonblocking read. size must always be the same. Returns the number of bytes
* read, or 0. */
int read(void *p);
static int read_several(const vector<WindowsFileIO *> &sources, void *p, int &actual, float timeout);
2003-03-19 20:34:40 +00:00
private:
HANDLE h;
OVERLAPPED ov;
2003-07-14 06:24:30 +00:00
char *buf;
int blocksize;
void queue_read();
int finish_read(void *p);
};
class USBDevice
{
public:
int GetPadEvent();
bool Open(int VID, int PID, int blocksize, int num);
bool IsOpen() const;
WindowsFileIO io;
2003-03-19 20:34:40 +00:00
};
#endif
/*
-----------------------------------------------------------------------------
Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
Glenn Maynard
-----------------------------------------------------------------------------
*/