Simplify handler signatures: return response struct, typed_handler does encoding
This commit is contained in:
@@ -21,7 +21,7 @@ size_t typed_handler(uint32_t message_id, std::span<const uint8_t> payload, span
|
||||
return encode_response_into(out, message_id, DeviceError{1, "decode request ext_id=" +
|
||||
std::to_string(Req::ext_id) + ": msgpack error " + std::to_string(static_cast<int>(r.error()))});
|
||||
}
|
||||
return Fn(message_id, req, out);
|
||||
return encode_response_into(out, message_id, Fn(req));
|
||||
}
|
||||
|
||||
void dispatch_init();
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <span>
|
||||
#include <string_view>
|
||||
#include "wire.h"
|
||||
|
||||
extern std::string_view firmware_name;
|
||||
|
||||
size_t handle_picoboot(uint32_t message_id, std::span<const uint8_t> payload, span_writer &out);
|
||||
size_t handle_info(uint32_t message_id, std::span<const uint8_t> payload, span_writer &out);
|
||||
size_t handle_log(uint32_t message_id, std::span<const uint8_t> payload, span_writer &out);
|
||||
ResponsePICOBOOT handle_picoboot(const RequestPICOBOOT&);
|
||||
ResponseInfo handle_info(const RequestInfo&);
|
||||
ResponseLog handle_log(const RequestLog&);
|
||||
|
||||
Reference in New Issue
Block a user