InertiaSDK

Loading...
Searching...
No Matches
SerialSettings.h
1#pragma once
2
3 namespace inertia
4{
5
7#define DEFAULT_BAUDRATE 460800
8
9
11 enum FlowControl : unsigned {
12 FLOW_CONTROL_NONE = 0,
13 FLOW_CONTROL_HARDWARE = 1
14};
15
16
18 enum ProtocolVersion : int {
19 PROTOCOL_NONE = -1,
20 PROTOCOL_V0 = 0,
21 PROTOCOL_V1 = 1,
22 PROTOCOL_V2 = 2,
23 PROTOCOL_V3 = 3,
24 PROTOCOL_V4 = 4,
25 PROTOCOL_FIRST = PROTOCOL_V3,
26 PROTOCOL_LAST = PROTOCOL_V4
27};
28
29
34 struct INERTIA_API SerialSettings
35{
36 std::wstring portname;
37 unsigned baudrate;
38 FlowControl flowControl;
39 std::wstring devicename;
40 ProtocolVersion forcedProtocolVersion;
41
45 SerialSettings();
46
54 SerialSettings(std::wstring const& portname, const unsigned baudrate, const FlowControl flow_control = FLOW_CONTROL_HARDWARE,
55 std::wstring const& devicename = std::wstring(), const ProtocolVersion forcedProtocolVersion = PROTOCOL_NONE);
56
61 SerialSettings(std::wstring const& argString);
62
63#ifdef WITH_BOOST_PROGRAM_OPTIONS
68 static const po::options_description GetOptionDescription();
69#endif
70
75 std::wstring const ToString() const;
76};
77
78}
inertia
Definition FlashCommands.h:6
inertia::ProtocolVersion
ProtocolVersion
Definition SerialSettings.h:18
inertia::PROTOCOL_LAST
@ PROTOCOL_LAST
Last supported protocol version.
Definition SerialSettings.h:26
inertia::PROTOCOL_FIRST
@ PROTOCOL_FIRST
First supported protocol version.
Definition SerialSettings.h:25
inertia::PROTOCOL_V4
@ PROTOCOL_V4
Protocol version 4.
Definition SerialSettings.h:24
inertia::PROTOCOL_NONE
@ PROTOCOL_NONE
Unspecified protocol version.
Definition SerialSettings.h:19
inertia::PROTOCOL_V0
@ PROTOCOL_V0
Protocol version 0 (obsolete).
Definition SerialSettings.h:20
inertia::PROTOCOL_V1
@ PROTOCOL_V1
Protocol version 1 (obsolete).
Definition SerialSettings.h:21
inertia::PROTOCOL_V3
@ PROTOCOL_V3
Protocol version 3.
Definition SerialSettings.h:23
inertia::PROTOCOL_V2
@ PROTOCOL_V2
Protocol version 2 (obsolete).
Definition SerialSettings.h:22
inertia::FlowControl
FlowControl
Definition SerialSettings.h:11
inertia::FLOW_CONTROL_NONE
@ FLOW_CONTROL_NONE
No flow control.
Definition SerialSettings.h:12
inertia::FLOW_CONTROL_HARDWARE
@ FLOW_CONTROL_HARDWARE
Hardware flow control.
Definition SerialSettings.h:13
inertia::SerialSettings::SerialSettings
SerialSettings(std::wstring const &argString)
inertia::SerialSettings::GetOptionDescription
static const po::options_description GetOptionDescription()
inertia::SerialSettings::baudrate
unsigned baudrate
The baudrate to use. Because serial-over-usb is used, this will generally not matter.
Definition SerialSettings.h:37
inertia::SerialSettings::flowControl
FlowControl flowControl
Type of flow control to use. Because serial-over-usb is used, this will generally not matter.
Definition SerialSettings.h:38
inertia::SerialSettings::devicename
std::wstring devicename
An optional device name to simplify identifying a device.
Definition SerialSettings.h:39
inertia::SerialSettings::SerialSettings
SerialSettings()
inertia::SerialSettings::SerialSettings
SerialSettings(std::wstring const &portname, const unsigned baudrate, const FlowControl flow_control=FLOW_CONTROL_HARDWARE, std::wstring const &devicename=std::wstring(), const ProtocolVersion forcedProtocolVersion=PROTOCOL_NONE)
inertia::SerialSettings::ToString
std::wstring const ToString() const
inertia::SerialSettings::forcedProtocolVersion
ProtocolVersion forcedProtocolVersion
USe this protocol version instead of the version indicated by the device.
Definition SerialSettings.h:40
inertia::SerialSettings::portname
std::wstring portname
The unique port identifier of the connection.
Definition SerialSettings.h:36