Skip to content

Commit c9b37ae

Browse files
committed
upd
1 parent 1ca6d21 commit c9b37ae

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=StreamPacket
2-
version=1.0.0
2+
version=1.0.1
33
author=AlexGyver <[email protected]>
44
maintainer=AlexGyver <[email protected]>
55
sentence=Simple and universal binary protocol for Stream interface

src/StreamPacket.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class StreamPacket {
1818
// chunked отправщик
1919
class Sender {
2020
public:
21-
Sender(Stream& s) : _s(s) {}
21+
Sender(Print& s) : _s(s) {}
2222

2323
// начать пакет
2424
template <typename Tp>
@@ -44,7 +44,7 @@ class StreamPacket {
4444
}
4545

4646
private:
47-
Stream& _s;
47+
Print& _s;
4848
uint8_t _crc = 0;
4949
};
5050

@@ -117,13 +117,13 @@ class StreamPacket {
117117

118118
// отправить данные
119119
template <typename Tp, typename Td>
120-
static bool send(Stream& s, Tp type, const Td& data) {
120+
static bool send(Print& s, Tp type, const Td& data) {
121121
return send(s, type, &data, sizeof(Td));
122122
}
123123

124124
// отправить данные
125125
template <typename Tp>
126-
static bool send(Stream& s, Tp type, const void* data, size_t len) {
126+
static bool send(Print& s, Tp type, const void* data, size_t len) {
127127
return _beginSend(s, type, len) &&
128128
s.write((uint8_t*)data, len) == len &&
129129
s.write(_crc8(data, len)) == 1;
@@ -186,7 +186,7 @@ class StreamPacket {
186186

187187
// начать отправку
188188
template <typename Tp>
189-
static bool _beginSend(Stream& s, Tp type, size_t len) {
189+
static bool _beginSend(Print& s, Tp type, size_t len) {
190190
Packet p{len, (uint8_t)type};
191191
p.crc = _crc8(&p, sizeof(p) - 1);
192192
return s.write((uint8_t)SP_START) == 1 && s.write((uint8_t*)&p, sizeof(p)) == sizeof(p);

0 commit comments

Comments
 (0)