Zero-copy TX: span_writer packer, static buffers, no vector returns
This commit is contained in:
@@ -5,12 +5,12 @@
|
||||
#include "net.h"
|
||||
#include "debug_log.h"
|
||||
|
||||
std::vector<std::vector<uint8_t>> handle_picoboot(uint32_t message_id, std::span<const uint8_t>) {
|
||||
size_t handle_picoboot(uint32_t message_id, std::span<const uint8_t>, span_writer &out) {
|
||||
dispatch_schedule_ms(100, []{ reset_usb_boot(0, 1); });
|
||||
return {encode_response(message_id, ResponsePICOBOOT{})};
|
||||
return encode_response_into(out, message_id, ResponsePICOBOOT{});
|
||||
}
|
||||
|
||||
std::vector<std::vector<uint8_t>> handle_info(uint32_t message_id, std::span<const uint8_t>) {
|
||||
size_t handle_info(uint32_t message_id, std::span<const uint8_t>, span_writer &out) {
|
||||
ResponseInfo resp;
|
||||
pico_unique_board_id_t uid;
|
||||
pico_get_unique_board_id(&uid);
|
||||
@@ -19,12 +19,12 @@ std::vector<std::vector<uint8_t>> handle_info(uint32_t message_id, std::span<con
|
||||
resp.mac = ns.mac;
|
||||
resp.ip = ns.ip;
|
||||
resp.firmware_name = firmware_name;
|
||||
return {encode_response(message_id, resp)};
|
||||
return encode_response_into(out, message_id, resp);
|
||||
}
|
||||
|
||||
std::vector<std::vector<uint8_t>> handle_log(uint32_t message_id, std::span<const uint8_t>) {
|
||||
size_t handle_log(uint32_t message_id, std::span<const uint8_t>, span_writer &out) {
|
||||
ResponseLog resp;
|
||||
for (auto& e : dlog_drain())
|
||||
resp.entries.push_back(LogEntry{e.timestamp_us, std::move(e.message)});
|
||||
return {encode_response(message_id, resp)};
|
||||
return encode_response_into(out, message_id, resp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user