onboardapi-sys 9.10.0

Raw FFI to the Rheinmetall onboardapi C++ SDK through a generated extern "C" shim
Documentation
// @generated by onboardapi-codegen from the onboardapi .rmodel data model. Do not edit.
// SPDX-License-Identifier: EPL-2.0
#include "wire_OverlayCtrl.hpp"
#include "../obapi_runtime.hpp"

#include <type_traits>

static_assert(std::is_same<decltype(::M_OverlayCtrl::OverlayCtrlSettingsType::IsEnableOverlaySupported), bool>::value, "M_OverlayCtrl::OverlayCtrlSettingsType field IsEnableOverlaySupported differs from the data model");
static_assert(std::is_same<decltype(::M_OverlayCtrl::OverlayCtrlSettingsType::SupportedOverlaysList), std::vector<std::string>>::value, "M_OverlayCtrl::OverlayCtrlSettingsType field SupportedOverlaysList differs from the data model");
static_assert(std::is_same<decltype(::M_OverlayCtrl::OverlayCtrlStatusType::IsEnabled), bool>::value, "M_OverlayCtrl::OverlayCtrlStatusType field IsEnabled differs from the data model");
static_assert(std::is_same<decltype(::M_OverlayCtrl::OverlayCtrlStatusType::ColourStyle), std::vector<::M_Common::ColourStyleType>>::value, "M_OverlayCtrl::OverlayCtrlStatusType field ColourStyle differs from the data model");

namespace M_OverlayCtrl {
    void obapi_put(::obapi::Writer& w, OverlayCtrlSettingsType const& v) {
        ::obapi::put(w, v.IsEnableOverlaySupported);
        ::obapi::put(w, v.SupportedOverlaysList);
    }
    void obapi_get(::obapi::Reader& r, OverlayCtrlSettingsType& v) {
        ::obapi::get(r, v.IsEnableOverlaySupported);
        ::obapi::get(r, v.SupportedOverlaysList);
    }
    void obapi_put(::obapi::Writer& w, OverlayCtrlStatusType const& v) {
        ::obapi::put(w, v.IsEnabled);
        ::obapi::put(w, v.ColourStyle);
    }
    void obapi_get(::obapi::Reader& r, OverlayCtrlStatusType& v) {
        ::obapi::get(r, v.IsEnabled);
        ::obapi::get(r, v.ColourStyle);
    }
} // namespace M_OverlayCtrl

namespace {
    struct ServiceCallbacks final : ::M_OverlayCtrl::IService {
        ::obapi::Dispatcher dispatcher;
        void ConfigEnableOverlay(std::string const& KeyOverlayName, bool Enable, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyOverlayName);
            ::obapi::put(w, Enable);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(0u, w);
        }
        void ConfigColourStyle(std::string const& KeyOverlayName, ::M_Common::ColourStyleType const& ColourStyle, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyOverlayName);
            ::obapi::put(w, ColourStyle);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(1u, w);
        }
    };

    struct ClientCallbacks final : ::M_OverlayCtrl::IClient {
        ::obapi::Dispatcher dispatcher;
        void ReportOverlayCtrlSettings(::M_OverlayCtrl::OverlayCtrlSettingsType const& Settings) override {
            ::obapi::Writer w;
            ::obapi::put(w, Settings);
            dispatcher.dispatch(0u, w);
        }
        void ReportOverlayStatus(std::string const& KeyOverlayName, ::M_OverlayCtrl::OverlayCtrlStatusType const& Status, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyOverlayName);
            ::obapi::put(w, Status);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(1u, w);
        }
    };

    void service_send(::obapi::Holder<::M_OverlayCtrl::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                ::M_OverlayCtrl::OverlayCtrlSettingsType Settings{};
                ::obapi::get(r, Settings);
                r.finish();
                h.endpoint->ReportOverlayCtrlSettings(Settings);
                return;
            }
            case 1u: {
                std::string KeyOverlayName{};
                ::obapi::get(r, KeyOverlayName);
                ::M_OverlayCtrl::OverlayCtrlStatusType Status{};
                ::obapi::get(r, Status);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportOverlayStatus(KeyOverlayName, Status, IsRemoved);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

    void client_send(::obapi::Holder<::M_OverlayCtrl::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                std::string KeyOverlayName{};
                ::obapi::get(r, KeyOverlayName);
                bool Enable{};
                ::obapi::get(r, Enable);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ConfigEnableOverlay(KeyOverlayName, Enable, IsRemoved);
                return;
            }
            case 1u: {
                std::string KeyOverlayName{};
                ::obapi::get(r, KeyOverlayName);
                ::M_Common::ColourStyleType ColourStyle{};
                ::obapi::get(r, ColourStyle);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ConfigColourStyle(KeyOverlayName, ColourStyle, IsRemoved);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

} // namespace

extern "C" const obapi_vtable obapi_OverlayCtrl_service_vtable = ::obapi::Endpoint<::M_OverlayCtrl::Service, ServiceCallbacks, &service_send, false>::vtable("M_OverlayCtrl", "Service");
extern "C" const obapi_vtable obapi_OverlayCtrl_client_vtable = ::obapi::Endpoint<::M_OverlayCtrl::Client, ClientCallbacks, &client_send, true>::vtable("M_OverlayCtrl", "Client");