Changeset e017851 in thomson for elec/CrO2/software/device.h
- Timestamp:
- Jan 14, 2013, 11:05:27 PM (11 years ago)
- Branches:
- main
- Children:
- 6bd7144
- Parents:
- 4a558d7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
elec/CrO2/software/device.h
r4a558d7 re017851 8 8 9 9 #include <stdint.h> 10 #include < lusb0_usb.h>10 #include <string.h> 11 11 12 12 class Tape; … … 15 15 { 16 16 public: 17 // Implemented in subclasses object files. Only one of them is linked 18 // and takes care of instanciating itself. 17 19 static Device& getDevice() throw(const char*); 18 20 19 ~Device(); 21 // High-level layer (will call functions below) 22 void write(const Tape& file) throw (const char*); 20 23 21 int read(uint8_t* buffer, size_t max); // Fill the buffer with data from device 22 int write(const uint8_t* buffer, size_t size, int blktype); 23 void write(const Tape& file) throw (const char*); 24 uint8_t getStatus(); 24 // Low-level layer (to be implemented by subclasses 25 virtual int read(uint8_t* buffer, size_t max) = 0; 26 // Fill the buffer with data from device 27 virtual int write(const uint8_t* buffer, size_t size, int blktype) = 0; 28 virtual uint8_t getStatus() = 0; 29 // Get the status word from the device 25 30 26 private: 27 Device() throw(const char*); // Open device and set it up for communication 28 Device(const Device& other); 29 30 31 usb_dev_handle* handle; 32 33 static bool initOnce; 34 static Device* instance; 31 protected: 32 /* These are the vendor specific commands implemented by our USB device */ 33 static const int PSCMD_CONFIG = 0; 34 static const int PSCMD_GET = 1; 35 static const int PSCMD_PUT = 2; 36 static const int PSCMD_STATUS = 3; 35 37 36 38 static const uint32_t vid; … … 38 40 static const char* vendor; 39 41 static const char* product; 42 private: 43 static bool initOnce; 44 static Device* instance; 40 45 };
Note:
See TracChangeset
for help on using the changeset viewer.