blob: 143a6f05ea6da91217a991d9890caf2a952d6c5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// SPDX-License-Identifier: BSD-3-Clause
#include "device.h"
namespace voltronic {
void SharedIOBuffer::resetWith(const u8* inbuf,
size_t inbufSize,
u8* outbuf,
size_t outbufSize) {
// set input
inputBuffer = inbuf;
inputBufferSize = inbufSize;
outputBuffer = outbuf;
outputBufferSize = outbufSize;
// clean output
errorType = ErrorType::None;
errorMessage.erase();
dataSize = 0;
// mark as ready
state = SharedIOBufferState::Ready;
}
void SharedIOBuffer::setResult(ErrorType type, std::string message) {
errorType = type;
errorMessage = std::move(message);
state = SharedIOBufferState::Done;
}
void SharedIOBuffer::setResult(size_t _dataSize) {
dataSize = _dataSize;
state = SharedIOBufferState::Done;
}
}
|