Adrien Destugues | e017851 | 2013-01-14 22:05:27 +0000 | [diff] [blame^] | 1 | /* CrO2 datassette emulator |
| 2 | * Copyright 2013, Adrien Destugues <pulkomandy@pulkomandy.tk> |
| 3 | * |
| 4 | * Distributed under the terms of the MIT licence. |
| 5 | * |
| 6 | * Handles device communication through Haiku USB Kit |
| 7 | */ |
| 8 | |
| 9 | #include "device.h" |
| 10 | |
| 11 | #include <stdint.h> |
| 12 | #include <USBKit.h> |
| 13 | |
| 14 | class Tape; |
| 15 | |
| 16 | class HaikuDevice: public Device, BUSBRoster |
| 17 | { |
| 18 | public: |
| 19 | ~HaikuDevice(); |
| 20 | |
| 21 | // Device |
| 22 | int read(uint8_t* buffer, size_t max); |
| 23 | // Fill the buffer with data from device |
| 24 | int write(const uint8_t* buffer, size_t size, int blktype); |
| 25 | uint8_t getStatus(); |
| 26 | |
| 27 | // BUSBRoster |
| 28 | status_t DeviceAdded(BUSBDevice* device); |
| 29 | void DeviceRemoved(BUSBDevice* device); |
| 30 | private: |
| 31 | HaikuDevice() throw(const char*); |
| 32 | // Open device and set it up for communication |
| 33 | HaikuDevice(const Device& other); |
| 34 | |
| 35 | BUSBDevice* handle; |
| 36 | |
| 37 | friend Device& Device::getDevice(); |
| 38 | }; |