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_Alignment.hpp"
#include "../obapi_runtime.hpp"

#include <type_traits>

static_assert(std::is_same<decltype(::M_Alignment::AlignmentSettingsType::MinLateralStepsize), std::vector<::M_Common::SphericalPositionType>>::value, "M_Alignment::AlignmentSettingsType field MinLateralStepsize differs from the data model");
static_assert(std::is_same<decltype(::M_Alignment::AlignmentSettingsType::MaxLateralStepsize), std::vector<::M_Common::SphericalPositionType>>::value, "M_Alignment::AlignmentSettingsType field MaxLateralStepsize differs from the data model");
static_assert(std::is_same<decltype(::M_Alignment::AlignmentSettingsType::MinLongitudinalStepsize), std::vector<double>>::value, "M_Alignment::AlignmentSettingsType field MinLongitudinalStepsize differs from the data model");
static_assert(std::is_same<decltype(::M_Alignment::AlignmentSettingsType::MaxLongitudinalStepsize), std::vector<double>>::value, "M_Alignment::AlignmentSettingsType field MaxLongitudinalStepsize differs from the data model");
static_assert(std::is_same<decltype(::M_Alignment::AlignmentSettingsType::IsCmdAllowExternalAlignmentSupported), bool>::value, "M_Alignment::AlignmentSettingsType field IsCmdAllowExternalAlignmentSupported differs from the data model");
static_assert(std::is_same<decltype(::M_Alignment::AlignmentStatusType::IsAlignmentActive), bool>::value, "M_Alignment::AlignmentStatusType field IsAlignmentActive differs from the data model");
static_assert(std::is_same<decltype(::M_Alignment::AlignmentStatusType::IsAlignmentAllowed), bool>::value, "M_Alignment::AlignmentStatusType field IsAlignmentAllowed differs from the data model");
static_assert(std::is_same<decltype(::M_Alignment::AlignmentStatusType::IsExternalAlignmentAllowed), bool>::value, "M_Alignment::AlignmentStatusType field IsExternalAlignmentAllowed differs from the data model");
static_assert(std::is_same<decltype(::M_Alignment::AlignmentStatusType::LateralOffset), std::vector<::M_Common::SphericalPositionType>>::value, "M_Alignment::AlignmentStatusType field LateralOffset differs from the data model");
static_assert(std::is_same<decltype(::M_Alignment::AlignmentStatusType::LongitudinalOffset), std::vector<double>>::value, "M_Alignment::AlignmentStatusType field LongitudinalOffset differs from the data model");
static_assert(std::is_same<decltype(::M_Alignment::AlignmentStatusType::IsParallaxCorrectionEnabled), bool>::value, "M_Alignment::AlignmentStatusType field IsParallaxCorrectionEnabled differs from the data model");

namespace M_Alignment {
    void obapi_put(::obapi::Writer& w, AlignmentSettingsType const& v) {
        ::obapi::put(w, v.MinLateralStepsize);
        ::obapi::put(w, v.MaxLateralStepsize);
        ::obapi::put(w, v.MinLongitudinalStepsize);
        ::obapi::put(w, v.MaxLongitudinalStepsize);
        ::obapi::put(w, v.IsCmdAllowExternalAlignmentSupported);
    }
    void obapi_get(::obapi::Reader& r, AlignmentSettingsType& v) {
        ::obapi::get(r, v.MinLateralStepsize);
        ::obapi::get(r, v.MaxLateralStepsize);
        ::obapi::get(r, v.MinLongitudinalStepsize);
        ::obapi::get(r, v.MaxLongitudinalStepsize);
        ::obapi::get(r, v.IsCmdAllowExternalAlignmentSupported);
    }
    void obapi_put(::obapi::Writer& w, AlignmentStatusType const& v) {
        ::obapi::put(w, v.IsAlignmentActive);
        ::obapi::put(w, v.IsAlignmentAllowed);
        ::obapi::put(w, v.IsExternalAlignmentAllowed);
        ::obapi::put(w, v.LateralOffset);
        ::obapi::put(w, v.LongitudinalOffset);
        ::obapi::put(w, v.IsParallaxCorrectionEnabled);
    }
    void obapi_get(::obapi::Reader& r, AlignmentStatusType& v) {
        ::obapi::get(r, v.IsAlignmentActive);
        ::obapi::get(r, v.IsAlignmentAllowed);
        ::obapi::get(r, v.IsExternalAlignmentAllowed);
        ::obapi::get(r, v.LateralOffset);
        ::obapi::get(r, v.LongitudinalOffset);
        ::obapi::get(r, v.IsParallaxCorrectionEnabled);
    }
} // namespace M_Alignment

namespace {
    struct ServiceCallbacks final : ::M_Alignment::IService {
        ::obapi::Dispatcher dispatcher;
        void CmdAlignmentState(std::string const& ComponentId, bool IsActive, ::M_Common::BooleanOptionalType const& ParallaxCorrection) override {
            ::obapi::Writer w;
            ::obapi::put(w, ComponentId);
            ::obapi::put(w, IsActive);
            ::obapi::put(w, ParallaxCorrection);
            dispatcher.dispatch(0u, w);
        }
        void CmdLateralAlignment(std::string const& ComponentId, ::M_Common::SphericalPositionType const& Offset) override {
            ::obapi::Writer w;
            ::obapi::put(w, ComponentId);
            ::obapi::put(w, Offset);
            dispatcher.dispatch(1u, w);
        }
        void CmdLongitudinalAlignment(std::string const& ComponentId, ::M_Common::AngleDegreesType Offset) override {
            ::obapi::Writer w;
            ::obapi::put(w, ComponentId);
            ::obapi::put(w, Offset);
            dispatcher.dispatch(2u, w);
        }
        void CmdSaveAlignment(std::string const& ComponentId) override {
            ::obapi::Writer w;
            ::obapi::put(w, ComponentId);
            dispatcher.dispatch(3u, w);
        }
        void CmdClearAlignment(std::string const& ComponentId) override {
            ::obapi::Writer w;
            ::obapi::put(w, ComponentId);
            dispatcher.dispatch(4u, w);
        }
        void CmdAllowExternalAlignment(std::string const& ComponentId, bool IsAllowed) override {
            ::obapi::Writer w;
            ::obapi::put(w, ComponentId);
            ::obapi::put(w, IsAllowed);
            dispatcher.dispatch(5u, w);
        }
    };

    struct ClientCallbacks final : ::M_Alignment::IClient {
        ::obapi::Dispatcher dispatcher;
        void ReportAlignmentSettings(::M_Alignment::AlignmentSettingsType const& Settings) override {
            ::obapi::Writer w;
            ::obapi::put(w, Settings);
            dispatcher.dispatch(0u, w);
        }
        void ReportAlignmentStatus(std::string const& KeyComponentId, ::M_Alignment::AlignmentStatusType const& Status, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyComponentId);
            ::obapi::put(w, Status);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(1u, w);
        }
    };

    void service_send(::obapi::Holder<::M_Alignment::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                ::M_Alignment::AlignmentSettingsType Settings{};
                ::obapi::get(r, Settings);
                r.finish();
                h.endpoint->ReportAlignmentSettings(Settings);
                return;
            }
            case 1u: {
                std::string KeyComponentId{};
                ::obapi::get(r, KeyComponentId);
                ::M_Alignment::AlignmentStatusType Status{};
                ::obapi::get(r, Status);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportAlignmentStatus(KeyComponentId, Status, IsRemoved);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

    void client_send(::obapi::Holder<::M_Alignment::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                std::string ComponentId{};
                ::obapi::get(r, ComponentId);
                bool IsActive{};
                ::obapi::get(r, IsActive);
                ::M_Common::BooleanOptionalType ParallaxCorrection{};
                ::obapi::get(r, ParallaxCorrection);
                r.finish();
                h.endpoint->CmdAlignmentState(ComponentId, IsActive, ParallaxCorrection);
                return;
            }
            case 1u: {
                std::string ComponentId{};
                ::obapi::get(r, ComponentId);
                ::M_Common::SphericalPositionType Offset{};
                ::obapi::get(r, Offset);
                r.finish();
                h.endpoint->CmdLateralAlignment(ComponentId, Offset);
                return;
            }
            case 2u: {
                std::string ComponentId{};
                ::obapi::get(r, ComponentId);
                ::M_Common::AngleDegreesType Offset{};
                ::obapi::get(r, Offset);
                r.finish();
                h.endpoint->CmdLongitudinalAlignment(ComponentId, Offset);
                return;
            }
            case 3u: {
                std::string ComponentId{};
                ::obapi::get(r, ComponentId);
                r.finish();
                h.endpoint->CmdSaveAlignment(ComponentId);
                return;
            }
            case 4u: {
                std::string ComponentId{};
                ::obapi::get(r, ComponentId);
                r.finish();
                h.endpoint->CmdClearAlignment(ComponentId);
                return;
            }
            case 5u: {
                std::string ComponentId{};
                ::obapi::get(r, ComponentId);
                bool IsAllowed{};
                ::obapi::get(r, IsAllowed);
                r.finish();
                h.endpoint->CmdAllowExternalAlignment(ComponentId, IsAllowed);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

} // namespace

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