source: thomson/elec/CrO2/software/device.h@ 96bc8fa

main
Last change on this file since 96bc8fa was 96bc8fa, checked in by Adrien Destugues <pulkomandy@…>, 12 years ago

C++ refactoring : move USB communication to device class.

git-svn-id: svn://localhost/thomson@11 85ae3b6b-dc8f-4344-a89d-598714f2e4e5

  • Property mode set to 100644
File size: 782 bytes
Line 
1/* CrO2 datassette emulator
2 * Copyright 2012, Adrien Destugues <pulkomandy@pulkomandy.ath.cx>
3 *
4 * Distributed under the terms of the MIT licence.
5 *
6 * Handles device communication through libusb
7 */
8
9#include <stdint.h>
10
11#include <lusb0_usb.h> /* this is libusb, see http://libusb.sourceforge.net/ */
12
13class Device
14{
15 public:
16 Device(); // Open device and set it up for communication
17 ~Device();
18
19 int read(uint8_t* buffer, size_t max); // Fill the buffer with data from device
20 int write(uint8_t* buffer, size_t size, int blktype);
21 uint8_t getStatus();
22
23 private:
24 usb_dev_handle* handle;
25
26 static bool initOnce;
27
28 static const uint32_t vid;
29 static const uint32_t pid;
30 static const char* vendor;
31 static const char* product;
32};
Note: See TracBrowser for help on using the repository browser.