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

#include <type_traits>

static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanCtrlMode::Off) == 0u, "enum value M_ScanCtrl::ScanCtrlMode::Type::Off differs from the data model");
static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanCtrlMode::Init) == 1u, "enum value M_ScanCtrl::ScanCtrlMode::Type::Init differs from the data model");
static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanCtrlMode::Reset) == 2u, "enum value M_ScanCtrl::ScanCtrlMode::Type::Reset differs from the data model");
static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanCtrlMode::Pause_Auto) == 3u, "enum value M_ScanCtrl::ScanCtrlMode::Type::Pause_Auto differs from the data model");
static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanCtrlMode::Run_Auto) == 4u, "enum value M_ScanCtrl::ScanCtrlMode::Type::Run_Auto differs from the data model");
static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanCtrlMode::Passive) == 5u, "enum value M_ScanCtrl::ScanCtrlMode::Type::Passive differs from the data model");
static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanCtrlMode::Active) == 6u, "enum value M_ScanCtrl::ScanCtrlMode::Type::Active differs from the data model");
static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanCtrlMode::Run_Auto_Swivel_In) == 7u, "enum value M_ScanCtrl::ScanCtrlMode::Type::Run_Auto_Swivel_In differs from the data model");
static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanDirectionKind::Azimuth_Continuous_Elevation_Step) == 0u, "enum value M_ScanCtrl::ScanDirectionKind::Type::Azimuth_Continuous_Elevation_Step differs from the data model");
static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanDirectionKind::Elevation_Continuous_Azimuth_Step) == 1u, "enum value M_ScanCtrl::ScanDirectionKind::Type::Elevation_Continuous_Azimuth_Step differs from the data model");
static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanDirectionKind::Both_Continuous) == 2u, "enum value M_ScanCtrl::ScanDirectionKind::Type::Both_Continuous differs from the data model");
static_assert(static_cast<uint32_t>(::M_ScanCtrl::ScanDirectionKind::Both_Step) == 3u, "enum value M_ScanCtrl::ScanDirectionKind::Type::Both_Step differs from the data model");
static_assert(std::is_same<::M_ScanCtrl::ScanDirectionOptionalType, std::vector<::M_ScanCtrl::ScanDirectionKind::Type>>::value, "typedef M_ScanCtrl::ScanDirectionOptionalType differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanParameterType::ScanVelocity), std::vector<::M_Common::LinearVelocityType>>::value, "M_ScanCtrl::ScanParameterType field ScanVelocity differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanParameterType::ScanPointWaitTime), std::vector<double>>::value, "M_ScanCtrl::ScanParameterType field ScanPointWaitTime differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanParameterType::ReferenceOffset), std::vector<::M_Common::PositionType>>::value, "M_ScanCtrl::ScanParameterType field ReferenceOffset differs from the data model");
static_assert(std::is_same<::M_ScanCtrl::ScanParameterOptionalType, std::vector<::M_ScanCtrl::ScanParameterType>>::value, "typedef M_ScanCtrl::ScanParameterOptionalType differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::GridType::ScanSector), ::M_Common::PositionType>::value, "M_ScanCtrl::GridType field ScanSector differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::GridType::GridDistance), std::vector<::M_Common::PositionType>>::value, "M_ScanCtrl::GridType field GridDistance differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::GridType::Direction), std::vector<::M_ScanCtrl::ScanDirectionKind::Type>>::value, "M_ScanCtrl::GridType field Direction differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::GridType::StartDirectionHorizontal), ::M_Common::HorizontalDirection::Type>::value, "M_ScanCtrl::GridType field StartDirectionHorizontal differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::GridType::StartDirectionVertical), ::M_Common::VerticalDirection::Type>::value, "M_ScanCtrl::GridType field StartDirectionVertical differs from the data model");
static_assert(std::is_same<::M_ScanCtrl::GridOptionalType, std::vector<::M_ScanCtrl::GridType>>::value, "typedef M_ScanCtrl::GridOptionalType differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanPatternType::PositionList), std::vector<::M_Common::MultiPositionType>>::value, "M_ScanCtrl::ScanPatternType field PositionList differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanPatternType::GridMotion), std::vector<::M_ScanCtrl::GridType>>::value, "M_ScanCtrl::ScanPatternType field GridMotion differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanPatternType::SearchTime), std::vector<double>>::value, "M_ScanCtrl::ScanPatternType field SearchTime differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanPatternType::ScanParameter), ::M_ScanCtrl::ScanParameterType>::value, "M_ScanCtrl::ScanPatternType field ScanParameter differs from the data model");
static_assert(std::is_same<::M_ScanCtrl::ScanPatternOptionalType, std::vector<::M_ScanCtrl::ScanPatternType>>::value, "typedef M_ScanCtrl::ScanPatternOptionalType differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ActionSupportedType::IsResetSupported), bool>::value, "M_ScanCtrl::ActionSupportedType field IsResetSupported differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ActionSupportedType::IsPauseAutoSupported), bool>::value, "M_ScanCtrl::ActionSupportedType field IsPauseAutoSupported differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ActionSupportedType::IsRunAutoSupported), bool>::value, "M_ScanCtrl::ActionSupportedType field IsRunAutoSupported differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanCtrlSettingsType::SupportedActions), ::M_ScanCtrl::ActionSupportedType>::value, "M_ScanCtrl::ScanCtrlSettingsType field SupportedActions differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanCtrlSettingsType::IsCmdStoreScanPatternSupported), bool>::value, "M_ScanCtrl::ScanCtrlSettingsType field IsCmdStoreScanPatternSupported differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanCtrlSettingsType::MaxNumberOfScanPoints), std::vector<uint32_t>>::value, "M_ScanCtrl::ScanCtrlSettingsType field MaxNumberOfScanPoints differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanCtrlSettingsType::AdditionalInfo), std::vector<::M_Common::PropertyType>>::value, "M_ScanCtrl::ScanCtrlSettingsType field AdditionalInfo differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanCtrlStatusType::Mode), ::M_ScanCtrl::ScanCtrlMode::Type>::value, "M_ScanCtrl::ScanCtrlStatusType field Mode differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanCtrlStatusType::CurrentPatternName), std::string>::value, "M_ScanCtrl::ScanCtrlStatusType field CurrentPatternName differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanCtrlStatusType::ScanPattern), ::M_ScanCtrl::ScanPatternType>::value, "M_ScanCtrl::ScanCtrlStatusType field ScanPattern differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanCtrlStatusType::NumberOfScanCycles), std::vector<uint32_t>>::value, "M_ScanCtrl::ScanCtrlStatusType field NumberOfScanCycles differs from the data model");
static_assert(std::is_same<decltype(::M_ScanCtrl::ScanCtrlStatusType::NumberOfScanPoint), std::vector<uint32_t>>::value, "M_ScanCtrl::ScanCtrlStatusType field NumberOfScanPoint differs from the data model");

namespace M_ScanCtrl {
    void obapi_put(::obapi::Writer& w, ScanParameterType const& v) {
        ::obapi::put(w, v.ScanVelocity);
        ::obapi::put(w, v.ScanPointWaitTime);
        ::obapi::put(w, v.ReferenceOffset);
    }
    void obapi_get(::obapi::Reader& r, ScanParameterType& v) {
        ::obapi::get(r, v.ScanVelocity);
        ::obapi::get(r, v.ScanPointWaitTime);
        ::obapi::get(r, v.ReferenceOffset);
    }
    void obapi_put(::obapi::Writer& w, GridType const& v) {
        ::obapi::put(w, v.ScanSector);
        ::obapi::put(w, v.GridDistance);
        ::obapi::put(w, v.Direction);
        ::obapi::put(w, v.StartDirectionHorizontal);
        ::obapi::put(w, v.StartDirectionVertical);
    }
    void obapi_get(::obapi::Reader& r, GridType& v) {
        ::obapi::get(r, v.ScanSector);
        ::obapi::get(r, v.GridDistance);
        ::obapi::get(r, v.Direction);
        ::obapi::get(r, v.StartDirectionHorizontal);
        ::obapi::get(r, v.StartDirectionVertical);
    }
    void obapi_put(::obapi::Writer& w, ScanPatternType const& v) {
        ::obapi::put(w, v.PositionList);
        ::obapi::put(w, v.GridMotion);
        ::obapi::put(w, v.SearchTime);
        ::obapi::put(w, v.ScanParameter);
    }
    void obapi_get(::obapi::Reader& r, ScanPatternType& v) {
        ::obapi::get(r, v.PositionList);
        ::obapi::get(r, v.GridMotion);
        ::obapi::get(r, v.SearchTime);
        ::obapi::get(r, v.ScanParameter);
    }
    void obapi_put(::obapi::Writer& w, ActionSupportedType const& v) {
        ::obapi::put(w, v.IsResetSupported);
        ::obapi::put(w, v.IsPauseAutoSupported);
        ::obapi::put(w, v.IsRunAutoSupported);
    }
    void obapi_get(::obapi::Reader& r, ActionSupportedType& v) {
        ::obapi::get(r, v.IsResetSupported);
        ::obapi::get(r, v.IsPauseAutoSupported);
        ::obapi::get(r, v.IsRunAutoSupported);
    }
    void obapi_put(::obapi::Writer& w, ScanCtrlSettingsType const& v) {
        ::obapi::put(w, v.SupportedActions);
        ::obapi::put(w, v.IsCmdStoreScanPatternSupported);
        ::obapi::put(w, v.MaxNumberOfScanPoints);
        ::obapi::put(w, v.AdditionalInfo);
    }
    void obapi_get(::obapi::Reader& r, ScanCtrlSettingsType& v) {
        ::obapi::get(r, v.SupportedActions);
        ::obapi::get(r, v.IsCmdStoreScanPatternSupported);
        ::obapi::get(r, v.MaxNumberOfScanPoints);
        ::obapi::get(r, v.AdditionalInfo);
    }
    void obapi_put(::obapi::Writer& w, ScanCtrlStatusType const& v) {
        ::obapi::put(w, v.Mode);
        ::obapi::put(w, v.CurrentPatternName);
        ::obapi::put(w, v.ScanPattern);
        ::obapi::put(w, v.NumberOfScanCycles);
        ::obapi::put(w, v.NumberOfScanPoint);
    }
    void obapi_get(::obapi::Reader& r, ScanCtrlStatusType& v) {
        ::obapi::get(r, v.Mode);
        ::obapi::get(r, v.CurrentPatternName);
        ::obapi::get(r, v.ScanPattern);
        ::obapi::get(r, v.NumberOfScanCycles);
        ::obapi::get(r, v.NumberOfScanPoint);
    }
} // namespace M_ScanCtrl

namespace {
    struct ServiceCallbacks final : ::M_ScanCtrl::IService {
        ::obapi::Dispatcher dispatcher;
        void CmdScanPattern(std::string const& PatternName, ::M_ScanCtrl::ScanPatternOptionalType const& ScanPattern) override {
            ::obapi::Writer w;
            ::obapi::put(w, PatternName);
            ::obapi::put(w, ScanPattern);
            dispatcher.dispatch(0u, w);
        }
        void CmdScanAction(::M_ScanCtrl::ScanCtrlMode::Type Action) override {
            ::obapi::Writer w;
            ::obapi::put(w, Action);
            dispatcher.dispatch(1u, w);
        }
        void ConfigStoreScanPattern(std::string const& KeyPatternName, ::M_ScanCtrl::ScanPatternType const& ScanPattern, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyPatternName);
            ::obapi::put(w, ScanPattern);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(2u, w);
        }
        void CmdDeleteScanPattern(std::string const& PatternName) override {
            ::obapi::Writer w;
            ::obapi::put(w, PatternName);
            dispatcher.dispatch(3u, w);
        }
    };

    struct ClientCallbacks final : ::M_ScanCtrl::IClient {
        ::obapi::Dispatcher dispatcher;
        void ReportScanCtrlSettings(::M_ScanCtrl::ScanCtrlSettingsType const& Settings) override {
            ::obapi::Writer w;
            ::obapi::put(w, Settings);
            dispatcher.dispatch(0u, w);
        }
        void ReportScanCtrlStatus(::M_ScanCtrl::ScanCtrlStatusType const& Status, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, Status);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(1u, w);
        }
        void ReportStoredScanPattern(std::string const& KeyPatternName, ::M_ScanCtrl::ScanPatternType const& ScanPattern, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyPatternName);
            ::obapi::put(w, ScanPattern);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(2u, w);
        }
        void ReportAssignmentSearchOffset(::M_Common::PositionType const& Offset) override {
            ::obapi::Writer w;
            ::obapi::put(w, Offset);
            dispatcher.dispatch(3u, w);
        }
    };

    void service_send(::obapi::Holder<::M_ScanCtrl::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                ::M_ScanCtrl::ScanCtrlSettingsType Settings{};
                ::obapi::get(r, Settings);
                r.finish();
                h.endpoint->ReportScanCtrlSettings(Settings);
                return;
            }
            case 1u: {
                ::M_ScanCtrl::ScanCtrlStatusType Status{};
                ::obapi::get(r, Status);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportScanCtrlStatus(Status, IsRemoved);
                return;
            }
            case 2u: {
                std::string KeyPatternName{};
                ::obapi::get(r, KeyPatternName);
                ::M_ScanCtrl::ScanPatternType ScanPattern{};
                ::obapi::get(r, ScanPattern);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportStoredScanPattern(KeyPatternName, ScanPattern, IsRemoved);
                return;
            }
            case 3u: {
                ::M_Common::PositionType Offset{};
                ::obapi::get(r, Offset);
                r.finish();
                h.endpoint->ReportAssignmentSearchOffset(Offset);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

    void client_send(::obapi::Holder<::M_ScanCtrl::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                std::string PatternName{};
                ::obapi::get(r, PatternName);
                ::M_ScanCtrl::ScanPatternOptionalType ScanPattern{};
                ::obapi::get(r, ScanPattern);
                r.finish();
                h.endpoint->CmdScanPattern(PatternName, ScanPattern);
                return;
            }
            case 1u: {
                ::M_ScanCtrl::ScanCtrlMode::Type Action{};
                ::obapi::get(r, Action);
                r.finish();
                h.endpoint->CmdScanAction(Action);
                return;
            }
            case 2u: {
                std::string KeyPatternName{};
                ::obapi::get(r, KeyPatternName);
                ::M_ScanCtrl::ScanPatternType ScanPattern{};
                ::obapi::get(r, ScanPattern);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ConfigStoreScanPattern(KeyPatternName, ScanPattern, IsRemoved);
                return;
            }
            case 3u: {
                std::string PatternName{};
                ::obapi::get(r, PatternName);
                r.finish();
                h.endpoint->CmdDeleteScanPattern(PatternName);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

} // namespace

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