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
19class PortConfig {
20 public:
24 enum class StopBits {
26 kOne = 10,
27
29 kOnePointFive = 15,
30
32 kTwo = 20,
33 };
34
38 enum class Parity {
40 kNone,
41
43 kEven,
44
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 : baud_rate_(baud_rate),
66 data_bits_(data_bits),
67 stop_bits_(stop_bits),
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_
PortConfig() noexcept
PortConfigオブジェクトをデフォルト構築する。
Definition PortConfig.hpp:53
int GetBaudRate() const noexcept
ボーレート(bps単位)を取得する。
Definition PortConfig.hpp:73
StopBits GetStopBits() const noexcept
ストップビット数を取得する。
Definition PortConfig.hpp:97
void SetDataBits(int new_value) noexcept
データ(キャラクタ)のビット数を設定する。
Definition PortConfig.hpp:92
StopBits
Enumerated type representing the type of stop bit count.
Definition PortConfig.hpp:24
Parity GetParity() const noexcept
パリティを取得する。
Definition PortConfig.hpp:109
Parity
パリティチェックの種類を表す列挙型。
Definition PortConfig.hpp:38
void SetStopBits(StopBits new_value) noexcept
ストップビット数を取得する。
Definition PortConfig.hpp:104
int GetDataBits() const noexcept
データ(キャラクタ)のビット数を取得する。
Definition PortConfig.hpp:85
void SetBaudRate(int new_value) noexcept
ボーレート(bps単位)を設定する。
Definition PortConfig.hpp:80
PortConfig(int baud_rate, int data_bits, StopBits stop_bits, Parity parity) noexcept
PortConfigオブジェクトを初期値付きで構築する。
Definition PortConfig.hpp:63
void SetParity(Parity new_value) noexcept
パリティを設定する。
Definition PortConfig.hpp:116
class zep::serial::PortConfig PortConfig() noexcept
Default construction of PortConfig object.
Definition PortConfig.hpp:53
Namespace for ZEP SDK.
Definition FactoryInterface.hpp:19