#pragma once #include #include #include "app_track_model.hpp" #include "track_core/scheme_decoder.hpp" namespace app::track { struct TrackSchemeDecoder { using proto_type = track_app_TrackScheme; static inline const pb_msgdesc_t *pb_fields = &track_app_TrackScheme_msg; TrackSchemeDecoder() = default; [[nodiscard]] static TrackSchemeDecoder from_proto(const proto_type &proto); [[nodiscard]] proto_type to_proto() const; [[nodiscard]] expected decode_core() const; uint8_t id = 0; std::vector binary; Color color; }; struct TrackSchemeMgr { using proto_type = track_app_TrackSchemeMgr; static inline const pb_msgdesc_t *pb_fields = &track_app_TrackSchemeMgr_msg; struct Add { using proto_type = track_app_TrackSchemeMgrAdd; static inline const pb_msgdesc_t *pb_fields = &track_app_TrackSchemeMgrAdd_msg; TrackSchemeDecoder scheme_decoder; error_t err{ESP_OK}; static Add from_proto(const proto_type &proto); [[nodiscard]] proto_type to_proto() const; }; struct Clear {}; using Unknown = std::monostate; enum class MessageType : uint8_t { NONE = 0, ADD = 1, CLEAR = 2 }; explicit TrackSchemeMgr() = default; static TrackSchemeMgr from_proto(const proto_type &proto); [[nodiscard]] proto_type to_proto() const; std::variant choice{Unknown{}}; }; } // namespace app::track