UdonLibrary
1.0.0
機械システム研究部 C++ ライブラリ
Toggle main menu visibility
読み取り中…
検索中…
一致する文字列を見つけられません
SerialWriter.hpp
[詳解]
1
//
2
// Serial 送信クラス
3
//
4
// Copyright (c) 2022 udonrobo
5
//
6
// Sender --[Serial]--> Receiver
7
// ^^^^^^
8
//
9
10
#pragma once
11
12
#include <
Udon/Serializer/Serializer.hpp
>
13
#include <
Udon/Utility/Show.hpp
>
14
15
namespace
Udon
16
{
17
20
template
<
typename
Message>
21
class
SerialWriter
22
{
23
24
Stream& serial;
25
26
Message
message;
27
28
public
:
30
SerialWriter
(Stream& serial) noexcept
31
: serial(serial)
32
, message()
33
{
34
}
35
38
void
setMessage
(
const
Message
& rhs)
39
{
40
message = rhs;
41
for
(
auto
&& it :
Udon::Serialize
(message))
42
{
43
serial.write(it);
44
}
45
}
46
48
void
show
()
const
49
{
50
Udon::Show
(message);
51
}
52
54
void
showRaw
()
const
55
{
56
for
(
auto
&& it :
Udon::Serialize
(message))
57
{
58
Serial.print(it);
59
Serial.print(
' '
);
60
}
61
}
62
};
63
64
}
// namespace Udon
Serializer.hpp
Show.hpp
Udon::SerialWriter::showRaw
void showRaw() const
生の送信内容を表示
Definition
SerialWriter.hpp:54
Udon::SerialWriter::show
void show() const
送信内容を表示
Definition
SerialWriter.hpp:48
Udon::SerialWriter::SerialWriter
SerialWriter(Stream &serial) noexcept
コンストラクタ
Definition
SerialWriter.hpp:30
Udon::SerialWriter::setMessage
void setMessage(const Message &rhs)
送信内容を更新
Definition
SerialWriter.hpp:38
Udon::Message
Definition
AirCylinder.hpp:16
Udon
Definition
Bit.hpp:12
Udon::Serialize
bool Serialize(const T &object, ArrayView< uint8_t > buffer)
バッファにシリアル化する
Definition
Serializer.hpp:35
Udon::Show
void Show(Args &&... args)
区切り文字ありで出力する
Definition
Show.hpp:339