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

#include <type_traits>

static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::LrfState::Unknown) == 0u, "enum value M_LaserRangeFinder::LrfState::Type::Unknown differs from the data model");
static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::LrfState::Firing_Inhibited) == 1u, "enum value M_LaserRangeFinder::LrfState::Type::Firing_Inhibited differs from the data model");
static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::LrfState::Firing_Enabled) == 2u, "enum value M_LaserRangeFinder::LrfState::Type::Firing_Enabled differs from the data model");
static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::LrfState::Firing_Multi_Pulse_Mode) == 3u, "enum value M_LaserRangeFinder::LrfState::Type::Firing_Multi_Pulse_Mode differs from the data model");
static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::LrfState::Firing_Single_Pulse_Mode) == 4u, "enum value M_LaserRangeFinder::LrfState::Type::Firing_Single_Pulse_Mode differs from the data model");
static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::LrfState::Firing_Inhibited_Multi_Pulse_Mode) == 5u, "enum value M_LaserRangeFinder::LrfState::Type::Firing_Inhibited_Multi_Pulse_Mode differs from the data model");
static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::FirstOrLast::Undefined) == 0u, "enum value M_LaserRangeFinder::FirstOrLast::Type::Undefined differs from the data model");
static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::FirstOrLast::First) == 1u, "enum value M_LaserRangeFinder::FirstOrLast::Type::First differs from the data model");
static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::FirstOrLast::Last) == 2u, "enum value M_LaserRangeFinder::FirstOrLast::Type::Last differs from the data model");
static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::MeasurementStrength::None) == 0u, "enum value M_LaserRangeFinder::MeasurementStrength::Type::None differs from the data model");
static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::MeasurementStrength::Strong) == 1u, "enum value M_LaserRangeFinder::MeasurementStrength::Type::Strong differs from the data model");
static_assert(static_cast<uint32_t>(::M_LaserRangeFinder::MeasurementStrength::Weak) == 2u, "enum value M_LaserRangeFinder::MeasurementStrength::Type::Weak differs from the data model");
static_assert(std::is_same<::M_LaserRangeFinder::MeasurementStrengthOptionalType, std::vector<::M_LaserRangeFinder::MeasurementStrength::Type>>::value, "typedef M_LaserRangeFinder::MeasurementStrengthOptionalType differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::RangeMeasurementType::Range), double>::value, "M_LaserRangeFinder::RangeMeasurementType field Range differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::RangeMeasurementType::Strength), std::vector<::M_LaserRangeFinder::MeasurementStrength::Type>>::value, "M_LaserRangeFinder::RangeMeasurementType field Strength differs from the data model");
static_assert(std::is_same<::M_LaserRangeFinder::RangeMeasurementListType, std::vector<::M_LaserRangeFinder::RangeMeasurementType>>::value, "typedef M_LaserRangeFinder::RangeMeasurementListType differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::MinimumRange), std::vector<double>>::value, "M_LaserRangeFinder::LrfSettingsType field MinimumRange differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::MaximumRange), std::vector<double>>::value, "M_LaserRangeFinder::LrfSettingsType field MaximumRange differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::IsSetFirstOrLastMeasurementSupported), bool>::value, "M_LaserRangeFinder::LrfSettingsType field IsSetFirstOrLastMeasurementSupported differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::IsSetUserRangeSupported), bool>::value, "M_LaserRangeFinder::LrfSettingsType field IsSetUserRangeSupported differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::IsInhibitLaserFiringSupported), bool>::value, "M_LaserRangeFinder::LrfSettingsType field IsInhibitLaserFiringSupported differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::IsMultiFireLaserSupported), bool>::value, "M_LaserRangeFinder::LrfSettingsType field IsMultiFireLaserSupported differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::IsSingleFireLaserSupported), bool>::value, "M_LaserRangeFinder::LrfSettingsType field IsSingleFireLaserSupported differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::IsMultiPulseSupported), bool>::value, "M_LaserRangeFinder::LrfSettingsType field IsMultiPulseSupported differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::IsUserMinimumRangeSupported), bool>::value, "M_LaserRangeFinder::LrfSettingsType field IsUserMinimumRangeSupported differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::IsUserMaximumRangeSupported), bool>::value, "M_LaserRangeFinder::LrfSettingsType field IsUserMaximumRangeSupported differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::RangeUncertainty), ::M_Common::UncertaintyType>::value, "M_LaserRangeFinder::LrfSettingsType field RangeUncertainty differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::MaximumDetectionsPerMeasurement), uint32_t>::value, "M_LaserRangeFinder::LrfSettingsType field MaximumDetectionsPerMeasurement differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfSettingsType::AdditionalInfo), std::vector<::M_Common::PropertyType>>::value, "M_LaserRangeFinder::LrfSettingsType field AdditionalInfo differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfStatusType::State), ::M_LaserRangeFinder::LrfState::Type>::value, "M_LaserRangeFinder::LrfStatusType field State differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfStatusType::UserDefinedMinimumRange), std::vector<double>>::value, "M_LaserRangeFinder::LrfStatusType field UserDefinedMinimumRange differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfStatusType::UserDefinedMaximumRange), std::vector<double>>::value, "M_LaserRangeFinder::LrfStatusType field UserDefinedMaximumRange differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfStatusType::StrongestMeasurement), ::M_LaserRangeFinder::FirstOrLast::Type>::value, "M_LaserRangeFinder::LrfStatusType field StrongestMeasurement differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfStatusType::MultiFireFrequency), std::vector<double>>::value, "M_LaserRangeFinder::LrfStatusType field MultiFireFrequency differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfStatusType::LaserFireCountTotal), std::vector<uint64_t>>::value, "M_LaserRangeFinder::LrfStatusType field LaserFireCountTotal differs from the data model");
static_assert(std::is_same<decltype(::M_LaserRangeFinder::LrfStatusType::FiringInhibitingComponentIds), std::vector<std::string>>::value, "M_LaserRangeFinder::LrfStatusType field FiringInhibitingComponentIds differs from the data model");

namespace M_LaserRangeFinder {
    void obapi_put(::obapi::Writer& w, RangeMeasurementType const& v) {
        ::obapi::put(w, v.Range);
        ::obapi::put(w, v.Strength);
    }
    void obapi_get(::obapi::Reader& r, RangeMeasurementType& v) {
        ::obapi::get(r, v.Range);
        ::obapi::get(r, v.Strength);
    }
    void obapi_put(::obapi::Writer& w, LrfSettingsType const& v) {
        ::obapi::put(w, v.MinimumRange);
        ::obapi::put(w, v.MaximumRange);
        ::obapi::put(w, v.IsSetFirstOrLastMeasurementSupported);
        ::obapi::put(w, v.IsSetUserRangeSupported);
        ::obapi::put(w, v.IsInhibitLaserFiringSupported);
        ::obapi::put(w, v.IsMultiFireLaserSupported);
        ::obapi::put(w, v.IsSingleFireLaserSupported);
        ::obapi::put(w, v.IsMultiPulseSupported);
        ::obapi::put(w, v.IsUserMinimumRangeSupported);
        ::obapi::put(w, v.IsUserMaximumRangeSupported);
        ::obapi::put(w, v.RangeUncertainty);
        ::obapi::put(w, v.MaximumDetectionsPerMeasurement);
        ::obapi::put(w, v.AdditionalInfo);
    }
    void obapi_get(::obapi::Reader& r, LrfSettingsType& v) {
        ::obapi::get(r, v.MinimumRange);
        ::obapi::get(r, v.MaximumRange);
        ::obapi::get(r, v.IsSetFirstOrLastMeasurementSupported);
        ::obapi::get(r, v.IsSetUserRangeSupported);
        ::obapi::get(r, v.IsInhibitLaserFiringSupported);
        ::obapi::get(r, v.IsMultiFireLaserSupported);
        ::obapi::get(r, v.IsSingleFireLaserSupported);
        ::obapi::get(r, v.IsMultiPulseSupported);
        ::obapi::get(r, v.IsUserMinimumRangeSupported);
        ::obapi::get(r, v.IsUserMaximumRangeSupported);
        ::obapi::get(r, v.RangeUncertainty);
        ::obapi::get(r, v.MaximumDetectionsPerMeasurement);
        ::obapi::get(r, v.AdditionalInfo);
    }
    void obapi_put(::obapi::Writer& w, LrfStatusType const& v) {
        ::obapi::put(w, v.State);
        ::obapi::put(w, v.UserDefinedMinimumRange);
        ::obapi::put(w, v.UserDefinedMaximumRange);
        ::obapi::put(w, v.StrongestMeasurement);
        ::obapi::put(w, v.MultiFireFrequency);
        ::obapi::put(w, v.LaserFireCountTotal);
        ::obapi::put(w, v.FiringInhibitingComponentIds);
    }
    void obapi_get(::obapi::Reader& r, LrfStatusType& v) {
        ::obapi::get(r, v.State);
        ::obapi::get(r, v.UserDefinedMinimumRange);
        ::obapi::get(r, v.UserDefinedMaximumRange);
        ::obapi::get(r, v.StrongestMeasurement);
        ::obapi::get(r, v.MultiFireFrequency);
        ::obapi::get(r, v.LaserFireCountTotal);
        ::obapi::get(r, v.FiringInhibitingComponentIds);
    }
} // namespace M_LaserRangeFinder

namespace {
    struct ServiceCallbacks final : ::M_LaserRangeFinder::IService {
        ::obapi::Dispatcher dispatcher;
        void CmdIsSensorAlive() override {
            ::obapi::Writer w;
            dispatcher.dispatch(0u, w);
        }
        void CmdDeleteTracks(::M_Common::ObjectIdListType const& KeyIdList) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyIdList);
            dispatcher.dispatch(1u, w);
        }
        void CmdDeleteAllTracks() override {
            ::obapi::Writer w;
            dispatcher.dispatch(2u, w);
        }
        void CmdDeactivateSensor(bool Deactivate) override {
            ::obapi::Writer w;
            ::obapi::put(w, Deactivate);
            dispatcher.dispatch(3u, w);
        }
        void ConfigSensorCoverage(::M_Common::ObjectIdType const& KeyId, ::M_Sensor::SensorCoverageType const& Coverage, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyId);
            ::obapi::put(w, Coverage);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(4u, w);
        }
        void CmdSetPreset(::M_Common::ObjectIdOptionalType const& Preset) override {
            ::obapi::Writer w;
            ::obapi::put(w, Preset);
            dispatcher.dispatch(5u, w);
        }
        void CmdLockOnTracks(::M_Common::ObjectIdListType const& KeyIdList) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyIdList);
            dispatcher.dispatch(6u, w);
        }
        void CmdMultiFireLaser(bool IsActivated) override {
            ::obapi::Writer w;
            ::obapi::put(w, IsActivated);
            dispatcher.dispatch(7u, w);
        }
        void CmdSingleFireLaser() override {
            ::obapi::Writer w;
            dispatcher.dispatch(8u, w);
        }
        void ConfigSetFirstOrLastMeasurement(::M_LaserRangeFinder::FirstOrLast::Type StrongestMeasurement) override {
            ::obapi::Writer w;
            ::obapi::put(w, StrongestMeasurement);
            dispatcher.dispatch(9u, w);
        }
        void ConfigSetUserRange(::M_Common::DistanceMetersOptionalType const& MinimumRange, ::M_Common::DistanceMetersOptionalType const& MaximumRange) override {
            ::obapi::Writer w;
            ::obapi::put(w, MinimumRange);
            ::obapi::put(w, MaximumRange);
            dispatcher.dispatch(10u, w);
        }
        void ConfigInhibitLaserFiring(::M_Common::ObjectIdType const& KeyComponentId, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyComponentId);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(11u, w);
        }
        void ConfigMultiFireFrequency(::M_Common::FrequencyHertzType Frequency) override {
            ::obapi::Writer w;
            ::obapi::put(w, Frequency);
            dispatcher.dispatch(12u, w);
        }
    };

    struct ClientCallbacks final : ::M_LaserRangeFinder::IClient {
        ::obapi::Dispatcher dispatcher;
        void ReportSensorSettings(::M_Sensor::SensorSettingsType const& Settings) override {
            ::obapi::Writer w;
            ::obapi::put(w, Settings);
            dispatcher.dispatch(0u, w);
        }
        void ReportSensorStatus(::M_Sensor::SensorStatusType const& Status, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, Status);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(1u, w);
        }
        void ReportSensorCoverage(::M_Common::ObjectIdType const& KeyId, ::M_Sensor::SensorCoverageType const& Coverage, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyId);
            ::obapi::put(w, Coverage);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(2u, w);
        }
        void EventSensorDetection(::M_Common::ObjectIdType const& DetectionId, ::M_Sensor::SensorDetectionType const& Detection) override {
            ::obapi::Writer w;
            ::obapi::put(w, DetectionId);
            ::obapi::put(w, Detection);
            dispatcher.dispatch(3u, w);
        }
        void ReportSensorTrack(::M_Common::ObjectIdType const& KeyId, ::M_Sensor::SensorDetectionType const& Track, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyId);
            ::obapi::put(w, Track);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(4u, w);
        }
        void ReportLrfSettings(::M_LaserRangeFinder::LrfSettingsType const& Settings) override {
            ::obapi::Writer w;
            ::obapi::put(w, Settings);
            dispatcher.dispatch(5u, w);
        }
        void ReportLrfStatus(::M_LaserRangeFinder::LrfStatusType const& Status, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, Status);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(6u, w);
        }
    };

    void service_send(::obapi::Holder<::M_LaserRangeFinder::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                ::M_Sensor::SensorSettingsType Settings{};
                ::obapi::get(r, Settings);
                r.finish();
                h.endpoint->ReportSensorSettings(Settings);
                return;
            }
            case 1u: {
                ::M_Sensor::SensorStatusType Status{};
                ::obapi::get(r, Status);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportSensorStatus(Status, IsRemoved);
                return;
            }
            case 2u: {
                ::M_Common::ObjectIdType KeyId{};
                ::obapi::get(r, KeyId);
                ::M_Sensor::SensorCoverageType Coverage{};
                ::obapi::get(r, Coverage);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportSensorCoverage(KeyId, Coverage, IsRemoved);
                return;
            }
            case 3u: {
                ::M_Common::ObjectIdType DetectionId{};
                ::obapi::get(r, DetectionId);
                ::M_Sensor::SensorDetectionType Detection{};
                ::obapi::get(r, Detection);
                r.finish();
                h.endpoint->EventSensorDetection(DetectionId, Detection);
                return;
            }
            case 4u: {
                ::M_Common::ObjectIdType KeyId{};
                ::obapi::get(r, KeyId);
                ::M_Sensor::SensorDetectionType Track{};
                ::obapi::get(r, Track);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportSensorTrack(KeyId, Track, IsRemoved);
                return;
            }
            case 5u: {
                ::M_LaserRangeFinder::LrfSettingsType Settings{};
                ::obapi::get(r, Settings);
                r.finish();
                h.endpoint->ReportLrfSettings(Settings);
                return;
            }
            case 6u: {
                ::M_LaserRangeFinder::LrfStatusType Status{};
                ::obapi::get(r, Status);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportLrfStatus(Status, IsRemoved);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

    void client_send(::obapi::Holder<::M_LaserRangeFinder::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                r.finish();
                h.endpoint->CmdIsSensorAlive();
                return;
            }
            case 1u: {
                ::M_Common::ObjectIdListType KeyIdList{};
                ::obapi::get(r, KeyIdList);
                r.finish();
                h.endpoint->CmdDeleteTracks(KeyIdList);
                return;
            }
            case 2u: {
                r.finish();
                h.endpoint->CmdDeleteAllTracks();
                return;
            }
            case 3u: {
                bool Deactivate{};
                ::obapi::get(r, Deactivate);
                r.finish();
                h.endpoint->CmdDeactivateSensor(Deactivate);
                return;
            }
            case 4u: {
                ::M_Common::ObjectIdType KeyId{};
                ::obapi::get(r, KeyId);
                ::M_Sensor::SensorCoverageType Coverage{};
                ::obapi::get(r, Coverage);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ConfigSensorCoverage(KeyId, Coverage, IsRemoved);
                return;
            }
            case 5u: {
                ::M_Common::ObjectIdOptionalType Preset{};
                ::obapi::get(r, Preset);
                r.finish();
                h.endpoint->CmdSetPreset(Preset);
                return;
            }
            case 6u: {
                ::M_Common::ObjectIdListType KeyIdList{};
                ::obapi::get(r, KeyIdList);
                r.finish();
                h.endpoint->CmdLockOnTracks(KeyIdList);
                return;
            }
            case 7u: {
                bool IsActivated{};
                ::obapi::get(r, IsActivated);
                r.finish();
                h.endpoint->CmdMultiFireLaser(IsActivated);
                return;
            }
            case 8u: {
                r.finish();
                h.endpoint->CmdSingleFireLaser();
                return;
            }
            case 9u: {
                ::M_LaserRangeFinder::FirstOrLast::Type StrongestMeasurement{};
                ::obapi::get(r, StrongestMeasurement);
                r.finish();
                h.endpoint->ConfigSetFirstOrLastMeasurement(StrongestMeasurement);
                return;
            }
            case 10u: {
                ::M_Common::DistanceMetersOptionalType MinimumRange{};
                ::obapi::get(r, MinimumRange);
                ::M_Common::DistanceMetersOptionalType MaximumRange{};
                ::obapi::get(r, MaximumRange);
                r.finish();
                h.endpoint->ConfigSetUserRange(MinimumRange, MaximumRange);
                return;
            }
            case 11u: {
                ::M_Common::ObjectIdType KeyComponentId{};
                ::obapi::get(r, KeyComponentId);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ConfigInhibitLaserFiring(KeyComponentId, IsRemoved);
                return;
            }
            case 12u: {
                ::M_Common::FrequencyHertzType Frequency{};
                ::obapi::get(r, Frequency);
                r.finish();
                h.endpoint->ConfigMultiFireFrequency(Frequency);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

} // namespace

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