| 1006 | } |
| 1007 | |
| 1008 | bool DataTransfer::WriteObjectModel(OutputBuffer *data) noexcept |
| 1009 | { |
| 1010 | // Try to write the packet header. This packet type cannot deal with truncated messages |
| 1011 | const size_t dataLength = (data != nullptr) ? data->Length() : 0; |
| 1012 | if (!CanWritePacket(sizeof(StringHeader) + dataLength)) |
| 1013 | { |
| 1014 | return false; |
| 1015 | } |
| 1016 | |
| 1017 | // Write packet header |
| 1018 | (void)WritePacketHeader(FirmwareRequest::ObjectModel, sizeof(StringHeader) + dataLength); |
| 1019 | |
| 1020 | // Write header |
| 1021 | StringHeader *header = WriteDataHeader<StringHeader>(); |
| 1022 | header->length = dataLength; |
| 1023 | header->padding = 0; |
| 1024 | |
| 1025 | // Write data |
| 1026 | while (data != nullptr) |
| 1027 | { |
| 1028 | WriteData(data->UnreadData(), data->BytesLeft()); |
| 1029 | data = OutputBuffer::Release(data); |
| 1030 | } |
| 1031 | return true; |
| 1032 | } |
| 1033 | |
| 1034 | bool DataTransfer::WriteCodeBufferUpdate(uint16_t bufferSpace) noexcept |
| 1035 | { |
no test coverage detected