シリアル通信
More...
#include <Serial.hpp>
|
enum | ByteSize : uint8 { ByteSize::FiveBits = 5,
ByteSize::SixBits = 6,
ByteSize::SevenBits = 7,
ByteSize::EightBits = 8
} |
| バイトサイズ More...
|
|
enum | Parity : uint8 {
Parity::None_ = 0,
Parity::Odd = 1,
Parity::Even = 2,
Parity::Mark = 3,
Parity::Space = 4
} |
| パリティ More...
|
|
enum | StopBits : uint8 { One = 1,
Two = 2,
OnePointFive
} |
| ストップビット More...
|
|
enum | FlowControl : uint8 { FlowControl::None_,
FlowControl::Software,
FlowControl::Hardware
} |
| Flow Control. More...
|
|
|
SIV3D_NODISCARD_CXX20 | Serial () |
| デフォルトコンストラクタ More...
|
|
SIV3D_NODISCARD_CXX20 | Serial (StringView port, int32 baudrate=9600, ByteSize byteSize=ByteSize::EightBits, Parity parity=Parity::None_, StopBits stopBits=StopBits::One, FlowControl flowControl=FlowControl::None_) |
| シリアルポートに接続します。 More...
|
|
| ~Serial () |
| デストラクタ More...
|
|
bool | open (StringView port, int32 baudrate=9600, ByteSize byteSize=ByteSize::EightBits, Parity parity=Parity::None_, StopBits stopBits=StopBits::One, FlowControl flowControl=FlowControl::None_) |
| シリアルポートに接続します。 More...
|
|
void | close () |
| シリアルポートとの接続を切断します。 More...
|
|
bool | isOpen () const |
| シリアルポートに接続されているかを返します。 More...
|
|
| operator bool () const |
| シリアルポートに接続されているかを返します。 More...
|
|
int32 | baudrate () const noexcept |
| ボーレートを返します。 More...
|
|
const String & | port () const noexcept |
| シリアルポートの名前を返します。 More...
|
|
size_t | available () |
| 受信済みで読み込み可能なデータのサイズ(バイト)を返します。 More...
|
|
void | clearInput () |
| 読み込みバッファを消去します。 More...
|
|
void | clearOutput () |
| 書き込みバッファを消去します。 More...
|
|
void | clear () |
| 読み込みバッファと書き込みバッファを消去します。 More...
|
|
size_t | read (void *dst, size_t size) |
| 受信したデータを読み込みます。 More...
|
|
Array< uint8 > | readBytes () |
| 受信したデータを読み込みます。 More...
|
|
bool | readBytes (Array< uint8 > &dst) |
| 受信したデータを読み込みます。 More...
|
|
SIV3D_CONCEPT_TRIVIALLY_COPYABLE bool | read (TriviallyCopyable &to) |
| 受信したデータを読み込みます。 More...
|
|
size_t | write (const void *src, size_t size) |
| バイナリデータを書き込みます。 More...
|
|
bool | writeByte (uint8 byte) |
| 1 バイトのデータを書き込みます。 More...
|
|
bool | writeByte (Byte byte) |
| 1 バイトのデータを書き込みます。 More...
|
|
SIV3D_CONCEPT_TRIVIALLY_COPYABLE bool | write (const TriviallyCopyable &from) |
| バイナリデータを書き込みます。 More...
|
|
void | setRTS (bool level) |
| RTS ハンドシェイクの状態を変更します。 More...
|
|
void | setDTR (bool level) |
| DTR ハンドシェイクの状態を変更します。 More...
|
|
bool | waitForChange () |
| CTS, DSR, RI, CD の変更、もしくは何らかの割り込みまで待機します。 More...
|
|
bool | getCTS () |
| CTS の状態を返します。 More...
|
|
bool | getDSR () |
| DSR の状態を返します。 More...
|
|
bool | getRI () |
| RI の状態を返します。 More...
|
|
bool | getCD () |
| CD の状態を返します。 More...
|
|
◆ ByteSize
バイトサイズ
Enumerator |
---|
FiveBits | |
SixBits | |
SevenBits | |
EightBits | |
◆ FlowControl
Flow Control.
Enumerator |
---|
None_ | |
Software | |
Hardware | |
◆ Parity
パリティ
Enumerator |
---|
None_ | |
Odd | |
Even | |
Mark | |
Space | |
◆ StopBits
ストップビット
Enumerator |
---|
One | |
Two | |
OnePointFive | |
◆ Serial() [1/2]
SIV3D_NODISCARD_CXX20 s3d::Serial::Serial |
( |
| ) |
|
◆ Serial() [2/2]
シリアルポートに接続します。
- Parameters
-
port | シリアルポートの名前 |
baudrate | ボーレート |
byteSize | バイトサイズ |
parity | パリティ |
stopBits | ストップビット |
flowControl | Flow Control |
◆ ~Serial()
◆ available()
size_t s3d::Serial::available |
( |
| ) |
|
受信済みで読み込み可能なデータのサイズ(バイト)を返します。
- Returns
- 読み込み可能なデータのサイズ(バイト)
◆ baudrate()
int32 s3d::Serial::baudrate |
( |
| ) |
const |
|
noexcept |
◆ clear()
void s3d::Serial::clear |
( |
| ) |
|
◆ clearInput()
void s3d::Serial::clearInput |
( |
| ) |
|
◆ clearOutput()
void s3d::Serial::clearOutput |
( |
| ) |
|
◆ close()
void s3d::Serial::close |
( |
| ) |
|
◆ getCD()
bool s3d::Serial::getCD |
( |
| ) |
|
CD の状態を返します。
- Returns
- CD の状態
◆ getCTS()
bool s3d::Serial::getCTS |
( |
| ) |
|
CTS の状態を返します。
- Returns
- CTS の状態
◆ getDSR()
bool s3d::Serial::getDSR |
( |
| ) |
|
DSR の状態を返します。
- Returns
- DSR の状態
◆ getRI()
bool s3d::Serial::getRI |
( |
| ) |
|
RI の状態を返します。
- Returns
- RI の状態
◆ isOpen()
bool s3d::Serial::isOpen |
( |
| ) |
const |
シリアルポートに接続されているかを返します。
- Returns
- 接続されている場合 true, それ以外の場合は false
◆ open()
シリアルポートに接続します。
- Parameters
-
port | シリアルポートの名前 |
baudrate | ボーレート |
byteSize | バイトサイズ |
parity | パリティ |
stopBits | ストップビット |
flowControl | Flow Control |
- Returns
- 接続に成功した場合 true, それ以外の場合は false
◆ operator bool()
s3d::Serial::operator bool |
( |
| ) |
const |
|
explicit |
シリアルポートに接続されているかを返します。
- Returns
- 接続されている場合 true, それ以外の場合は false
◆ port()
const String& s3d::Serial::port |
( |
| ) |
const |
|
noexcept |
シリアルポートの名前を返します。
- Returns
- シリアルポートの名前
◆ read() [1/2]
受信したデータを読み込みます。
- Template Parameters
-
- Parameters
-
- Returns
- 読み込みに成功した場合 true, それ以外の場合は false
◆ read() [2/2]
size_t s3d::Serial::read |
( |
void * |
dst, |
|
|
size_t |
size |
|
) |
| |
受信したデータを読み込みます。
- Parameters
-
dst | 読み込み先 |
size | 読み込むサイズ(バイト) |
- Returns
- 実際に読み込んだサイズ(バイト)
◆ readBytes() [1/2]
受信したデータを読み込みます。
- Returns
- 読み込んだデータ
◆ readBytes() [2/2]
bool s3d::Serial::readBytes |
( |
Array< uint8 > & |
dst | ) |
|
受信したデータを読み込みます。
- Parameters
-
- Returns
- 読み込みに成功した場合 true, それ以外の場合は false
◆ setDTR()
void s3d::Serial::setDTR |
( |
bool |
level | ) |
|
DTR ハンドシェイクの状態を変更します。
- Parameters
-
level | on にする場合 true, off にする場合 false |
◆ setRTS()
void s3d::Serial::setRTS |
( |
bool |
level | ) |
|
RTS ハンドシェイクの状態を変更します。
- Parameters
-
level | on にする場合 true, off にする場合 false |
◆ waitForChange()
bool s3d::Serial::waitForChange |
( |
| ) |
|
CTS, DSR, RI, CD の変更、もしくは何らかの割り込みまで待機します。
- Returns
- 変更があった場合は true, それ以外の何かが起こった場合は false
◆ write() [1/2]
バイナリデータを書き込みます。
- Template Parameters
-
- Parameters
-
- Returns
- 書き込みに成功した場合 true, それ以外の場合は false
◆ write() [2/2]
size_t s3d::Serial::write |
( |
const void * |
src, |
|
|
size_t |
size |
|
) |
| |
バイナリデータを書き込みます。
- Parameters
-
src | 書き込むデータの先頭ポインタ |
size | 書き込むデータのサイズ(バイト) |
- Returns
- 書き込みに成功したバイト数
◆ writeByte() [1/2]
bool s3d::Serial::writeByte |
( |
Byte |
byte | ) |
|
1 バイトのデータを書き込みます。
- Parameters
-
- Returns
- 書き込みに成功した場合 true, それ以外の場合は false
◆ writeByte() [2/2]
bool s3d::Serial::writeByte |
( |
uint8 |
byte | ) |
|
1 バイトのデータを書き込みます。
- Parameters
-
- Returns
- 書き込みに成功した場合 true, それ以外の場合は false
The documentation for this class was generated from the following file: