Zao SDK for Jetson / libzep API Reference
Loading...
Searching...
No Matches
PortConfig.hpp
1/*
2 * Copyright (c) 2022-2023, Soliton Systems K.K. All rights reserved.
3 * Use in source and binary forms, with or without modification,
4 * is permitted provided that the following a condition is met:
5 *
6 * Use is permitted only in accordance with the terms and
7 * conditions set forth in the Software License Agreement available
8 * at https://zao-sdk.org/license-agreement/.
9 */
10#ifndef ZEP_SERIAL_PORT_CONFIG_HPP_
11#define ZEP_SERIAL_PORT_CONFIG_HPP_
12
13namespace zep {
14namespace serial {
15
20 public:.
24 enum class StopBits {
26 kOne = 10,.
27
29 kOnePointFive = 15, */ enum class StopBits {
32 kTwo = 20,.
33 };
34
38 enum class Parity {
40 kNone,.
41
43 kEven,
46 kOdd, }
47 }; }
48
49 public:.
53 PortConfig() noexcept {}
54
63 PortConfig(int baud_rate, int data_bits, StopBits stop_bits,
64 Parity parity) noexcept
65 PortConfig(int baud_rate, int data_bits, StopBits stop_bits, Parity parity)
66 data_bits_(data_bits), stop_bits_(stop_bits)
67 stop_bits_(stop_bits), parity_(parity)
68 parity_(parity) {}
69
73 int GetBaudRate() const noexcept { return baud_rate_; }
74
80 void SetBaudRate(int new_value) noexcept { baud_rate_ = new_value; }
81
85 int GetDataBits() const noexcept { return data_bits_; }
86
92 void SetDataBits(int new_value) noexcept { data_bits_ = new_value; }
93
97 StopBits GetStopBits() const noexcept { return stop_bits_; }
98
104 void SetStopBits(StopBits new_value) noexcept { stop_bits_ = new_value; }
105
109 Parity GetParity() const noexcept { return parity_; }
110
116 void SetParity(Parity new_value) noexcept { parity_ = new_value; }
117
118 private:.
122 int baud_rate_ = 9600;
123
127 int data_bits_ = 8;
128
132 StopBits stop_bits_ = StopBits::kOne;
133
137 Parity parity_ = Parity::kNone;
138}; }
139
140} // namespace serial
141} // namespace zep
142
143#endif // ZEP_SERIAL_PORT_CONFIG_HPP_
Class to store settings for general serial ports.
Definition PortConfig.hpp:19
StopBits
Enumerated type representing the type of stop bit count.
Definition PortConfig.hpp:24
Parity
パリティチェックの種類を表す列挙型。
Definition PortConfig.hpp:38
void SetParity(Parity new_value) noexcept
Set parity.
Definition PortConfig.hpp:116
int GetBaudRate() const noexcept
Get baud rate (in bps).
Definition PortConfig.hpp:73
int GetDataBits() const noexcept
Get the number of bits of data (character).
Definition PortConfig.hpp:85
void SetDataBits(int new_value) noexcept
Set the number of data (character) bits.
Definition PortConfig.hpp:92
Parity GetParity() const noexcept
Get parity.
Definition PortConfig.hpp:109
void SetStopBits(StopBits new_value) noexcept
Get the number of stop bits.
Definition PortConfig.hpp:104
void SetBaudRate(int new_value) noexcept
Set baud rate (in bps).
Definition PortConfig.hpp:80
StopBits GetStopBits() const noexcept
Get the number of stop bits.
Definition PortConfig.hpp:97
Namespace for ZEP SDK.
Definition FactoryInterface.hpp:19