OSVR-Core  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
USBSerialDevice.h
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_USBSerialEnum_h_GUID_B17561E7_ADC2_438C_87B9_D05321AF6BD6
26 #define INCLUDED_USBSerialEnum_h_GUID_B17561E7_ADC2_438C_87B9_D05321AF6BD6
27 
28 // Internal Includes
29 #include <osvr/USBSerial/Export.h>
30 #include <osvr/Util/StdInt.h>
31 
32 // Library/third-party includes
33 // - none
34 
35 // Standard includes
36 #include <string>
37 
38 namespace osvr {
39 namespace usbserial {
40 
41  class USBSerialDevice {
42  public:
43  OSVR_USBSERIAL_EXPORT USBSerialDevice(uint16_t vendorID,
44  uint16_t productID,
45  const std::string &devPath,
46  const std::string &port);
47  OSVR_USBSERIAL_EXPORT USBSerialDevice();
48 
49  OSVR_USBSERIAL_EXPORT uint16_t getVID() const;
50  OSVR_USBSERIAL_EXPORT uint16_t getPID() const;
51  OSVR_USBSERIAL_EXPORT std::string getPlatformSpecificPath() const;
52  OSVR_USBSERIAL_EXPORT std::string getPort() const;
53 
54  private:
55  uint16_t m_vendorID;
56  uint16_t m_productID;
57  std::string m_devicePath;
58  std::string m_devicePort;
59  };
60 
61  inline USBSerialDevice::USBSerialDevice(uint16_t vendorID,
62  uint16_t productID,
63  const std::string &devPath,
64  const std::string &port)
65  : m_vendorID(vendorID), m_productID(productID), m_devicePath(devPath),
66  m_devicePort(port) {
67  // do nothing
68  }
69 
70  inline USBSerialDevice::USBSerialDevice() {
71  // do nothing
72  }
73 
74  inline uint16_t USBSerialDevice::getVID() const { return m_vendorID; }
75 
76  inline uint16_t USBSerialDevice::getPID() const { return m_productID; }
77 
78  inline std::string USBSerialDevice::getPlatformSpecificPath() const {
79  return m_devicePath;
80  }
81 
82  inline std::string USBSerialDevice::getPort() const { return m_devicePort; }
83 
84 } // namespace usbserial
85 } // namespace osvr
86 
87 #endif // INCLUDED_USBSerialEnum_h_GUID_B17561E7_ADC2_438C_87B9_D05321AF6BD6
Header wrapping the C99 standard stdint header.
The main namespace for all C++ elements of the framework, internal and external.
Definition: ClientKit.h:31