C++ Instrument Catalog
USBRemoteBox.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Standard includes
4 #include <string>
5 
6 // Personal includes
7 #include "VISAInstrument.h"
8 
9 namespace MTL {
10  namespace Instrument {
11 
12  //----------------------------------------------------------------------//
13  // USB Remote Box Interrface //
14  //----------------------------------------------------------------------//
16  {
17  public:
18  static const std::string RSRC_FILTER;
19  union uLEDs {
20  struct sLEDs
21  {
22  uint32_t ON : 1;
23  uint32_t BUSY : 1;
24  } LEDs;
25  uint32_t Buf;
26  };
27  union uButtons
28  {
29  struct sButtons
30  {
31  uint32_t StartState : 1;
32  uint32_t StartEvent : 1;
33  uint32_t ResetState : 1;
34  uint32_t ResetEvent : 1;
35  } BUTs;
36  uint32_t Buf;
37  };
38  private:
39  const uint32_t m_Timeout_ms = 2000;
40  enum usb_request_type {
41  USB_REQUEST_TYPE_STANDARD = (0x00 << 5),
42  USB_REQUEST_TYPE_CLASS = (0x01 << 5),
43  USB_REQUEST_TYPE_VENDOR = (0x02 << 5),
44  USB_REQUEST_TYPE_RESERVED = (0x03 << 5)
45  };
46  enum usb_request_recipient {
47  USB_RECIPIENT_DEVICE = 0x00,
48  USB_RECIPIENT_INTERFACE = 0x01,
49  USB_RECIPIENT_ENDPOINT = 0x02,
50  USB_RECIPIENT_OTHER = 0x03,
51  };
52  enum usb_endpoint_direction {
53  USB_ENDPOINT_IN = 0x80, // Device to host
54  USB_ENDPOINT_OUT = 0x00 // Host to device
55  };
56 
57  public:
58  //----------------------------------------------------------------------//
59  // Constructors / destructors
60  CUSBRemoteBox(CVISAResourceManager & rRM, tResourceName Rsrc);
61  virtual ~CUSBRemoteBox();
62 
63  //----------------------------------------------------------------------//
64  // Open / Close
65  bool Connect();
66  void Disconnect();
67 
68  //----------------------------------------------------------------------//
69  // Read / Write
70  bool Update(const uLEDs LEDs, uButtons & rButtons);
71  };
72 
73  }
74 }
MTL::Instrument::CUSBRemoteBox::uButtons::sButtons::ResetEvent
uint32_t ResetEvent
Definition: USBRemoteBox.h:34
MTL::Instrument::CUSBRemoteBox::uLEDs
Definition: USBRemoteBox.h:19
MTL::Instrument::CUSBRemoteBox::uButtons::BUTs
struct MTL::Instrument::CUSBRemoteBox::uButtons::sButtons BUTs
MTL::Instrument::CUSBRemoteBox::uLEDs::Buf
uint32_t Buf
Definition: USBRemoteBox.h:25
MTL::Instrument::CUSBRemoteBox
Definition: USBRemoteBox.h:15
MTL::Instrument::CUSBRemoteBox::uButtons
Definition: USBRemoteBox.h:27
MTL::Instrument::CUSBRemoteBox::uButtons::sButtons::StartEvent
uint32_t StartEvent
Definition: USBRemoteBox.h:32
MTL
Definition: CPT2026PeripheralROM.h:19
MTL::Instrument::CUSBRemoteBox::uLEDs::sLEDs
Definition: USBRemoteBox.h:20
MTL::Instrument::CUSBRemoteBox::uButtons::sButtons::StartState
uint32_t StartState
Definition: USBRemoteBox.h:31
MTL::Instrument::CUSBRemoteBox::uButtons::sButtons
Definition: USBRemoteBox.h:29
MTL::Instrument::CUSBRemoteBox::~CUSBRemoteBox
virtual ~CUSBRemoteBox()
Definition: USBRemoteBox.cpp:35
MTL::Instrument::CUSBRemoteBox::uLEDs::sLEDs::BUSY
uint32_t BUSY
Definition: USBRemoteBox.h:23
MTL::Instrument::CUSBRemoteBox::uButtons::sButtons::ResetState
uint32_t ResetState
Definition: USBRemoteBox.h:33
MTL::Instrument::CUSBRemoteBox::Disconnect
void Disconnect()
Definition: USBRemoteBox.cpp:68
MTL::Instrument::CUSBRemoteBox::uLEDs::sLEDs::ON
uint32_t ON
Definition: USBRemoteBox.h:22
MTL::Instrument::CUSBRemoteBox::uButtons::Buf
uint32_t Buf
Definition: USBRemoteBox.h:36
MTL::Instrument::CUSBRemoteBox::CUSBRemoteBox
CUSBRemoteBox(CVISAResourceManager &rRM, tResourceName Rsrc)
Definition: USBRemoteBox.cpp:29
MTL::Instrument::tResourceName
std::string tResourceName
Definition: VISAInstrumentTypes.h:21
MTL::Instrument::CUSBRemoteBox::RSRC_FILTER
static const std::string RSRC_FILTER
Definition: USBRemoteBox.h:18
VISAInstrument.h
C++ wrapper for NI-VISA: interface definition.
MTL::Instrument::CUSBRemoteBox::Connect
bool Connect()
Definition: USBRemoteBox.cpp:40
MTL::Instrument::CVISAInstrument
VISA instrument class.
Definition: VISAInstrument.h:60
MTL::Instrument::CUSBRemoteBox::uLEDs::LEDs
struct MTL::Instrument::CUSBRemoteBox::uLEDs::sLEDs LEDs
MTL::Instrument::CUSBRemoteBox::Update
bool Update(const uLEDs LEDs, uButtons &rButtons)
Definition: USBRemoteBox.cpp:76