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

#include <type_traits>

static_assert(static_cast<uint32_t>(::M_BuiltInTest::IBitRoutineState::Go) == 0u, "enum value M_BuiltInTest::IBitRoutineState::Type::Go differs from the data model");
static_assert(static_cast<uint32_t>(::M_BuiltInTest::IBitRoutineState::No_Go) == 1u, "enum value M_BuiltInTest::IBitRoutineState::Type::No_Go differs from the data model");
static_assert(static_cast<uint32_t>(::M_BuiltInTest::IBitRoutineState::Running) == 2u, "enum value M_BuiltInTest::IBitRoutineState::Type::Running differs from the data model");
static_assert(static_cast<uint32_t>(::M_BuiltInTest::IBitRoutineState::Cancelled) == 3u, "enum value M_BuiltInTest::IBitRoutineState::Type::Cancelled differs from the data model");
static_assert(static_cast<uint32_t>(::M_BuiltInTest::IBitRoutineState::Aborted) == 4u, "enum value M_BuiltInTest::IBitRoutineState::Type::Aborted differs from the data model");
static_assert(static_cast<uint32_t>(::M_BuiltInTest::TestResult::Undefined) == 0u, "enum value M_BuiltInTest::TestResult::Type::Undefined differs from the data model");
static_assert(static_cast<uint32_t>(::M_BuiltInTest::TestResult::OK) == 1u, "enum value M_BuiltInTest::TestResult::Type::OK differs from the data model");
static_assert(static_cast<uint32_t>(::M_BuiltInTest::TestResult::Warning) == 2u, "enum value M_BuiltInTest::TestResult::Type::Warning differs from the data model");
static_assert(static_cast<uint32_t>(::M_BuiltInTest::TestResult::Reduced_Performance_Error) == 3u, "enum value M_BuiltInTest::TestResult::Type::Reduced_Performance_Error differs from the data model");
static_assert(static_cast<uint32_t>(::M_BuiltInTest::TestResult::Fatal_Error) == 4u, "enum value M_BuiltInTest::TestResult::Type::Fatal_Error differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::SupportedIBitRoutineType::RoutineName), std::string>::value, "M_BuiltInTest::SupportedIBitRoutineType field RoutineName differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::SupportedIBitRoutineType::SupportedIBitNames), std::vector<std::string>>::value, "M_BuiltInTest::SupportedIBitRoutineType field SupportedIBitNames differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::SupportedIBitRoutineType::DurationMs), std::vector<uint32_t>>::value, "M_BuiltInTest::SupportedIBitRoutineType field DurationMs differs from the data model");
static_assert(std::is_same<::M_BuiltInTest::SupportedIBitRoutineListType, std::vector<::M_BuiltInTest::SupportedIBitRoutineType>>::value, "typedef M_BuiltInTest::SupportedIBitRoutineListType differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitSettingsType::IsIBitSupported), bool>::value, "M_BuiltInTest::BitSettingsType field IsIBitSupported differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitSettingsType::IsCancelIBitRoutineSupported), bool>::value, "M_BuiltInTest::BitSettingsType field IsCancelIBitRoutineSupported differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitSettingsType::IsPBitSupported), bool>::value, "M_BuiltInTest::BitSettingsType field IsPBitSupported differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitSettingsType::IsCBitSupported), bool>::value, "M_BuiltInTest::BitSettingsType field IsCBitSupported differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitSettingsType::SupportedIBitRoutines), std::vector<::M_BuiltInTest::SupportedIBitRoutineType>>::value, "M_BuiltInTest::BitSettingsType field SupportedIBitRoutines differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitSettingsType::SupportedPBitNames), std::vector<std::string>>::value, "M_BuiltInTest::BitSettingsType field SupportedPBitNames differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitSettingsType::SupportedCBitNames), std::vector<std::string>>::value, "M_BuiltInTest::BitSettingsType field SupportedCBitNames differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitSettingsType::AdditionalInfo), std::vector<::M_Common::PropertyType>>::value, "M_BuiltInTest::BitSettingsType field AdditionalInfo differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitStatusType::RoutineName), std::string>::value, "M_BuiltInTest::BitStatusType field RoutineName differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitStatusType::Result), ::M_BuiltInTest::TestResult::Type>::value, "M_BuiltInTest::BitStatusType field Result differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitStatusType::ErrorCode), std::vector<uint32_t>>::value, "M_BuiltInTest::BitStatusType field ErrorCode differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitStatusType::ErrorCodeDescription), std::string>::value, "M_BuiltInTest::BitStatusType field ErrorCodeDescription differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTest::BitStatusType::AdditionalInfo), std::vector<::M_Common::PropertyType>>::value, "M_BuiltInTest::BitStatusType field AdditionalInfo differs from the data model");

namespace M_BuiltInTest {
    void obapi_put(::obapi::Writer& w, SupportedIBitRoutineType const& v) {
        ::obapi::put(w, v.RoutineName);
        ::obapi::put(w, v.SupportedIBitNames);
        ::obapi::put(w, v.DurationMs);
    }
    void obapi_get(::obapi::Reader& r, SupportedIBitRoutineType& v) {
        ::obapi::get(r, v.RoutineName);
        ::obapi::get(r, v.SupportedIBitNames);
        ::obapi::get(r, v.DurationMs);
    }
    void obapi_put(::obapi::Writer& w, BitSettingsType const& v) {
        ::obapi::put(w, v.IsIBitSupported);
        ::obapi::put(w, v.IsCancelIBitRoutineSupported);
        ::obapi::put(w, v.IsPBitSupported);
        ::obapi::put(w, v.IsCBitSupported);
        ::obapi::put(w, v.SupportedIBitRoutines);
        ::obapi::put(w, v.SupportedPBitNames);
        ::obapi::put(w, v.SupportedCBitNames);
        ::obapi::put(w, v.AdditionalInfo);
    }
    void obapi_get(::obapi::Reader& r, BitSettingsType& v) {
        ::obapi::get(r, v.IsIBitSupported);
        ::obapi::get(r, v.IsCancelIBitRoutineSupported);
        ::obapi::get(r, v.IsPBitSupported);
        ::obapi::get(r, v.IsCBitSupported);
        ::obapi::get(r, v.SupportedIBitRoutines);
        ::obapi::get(r, v.SupportedPBitNames);
        ::obapi::get(r, v.SupportedCBitNames);
        ::obapi::get(r, v.AdditionalInfo);
    }
    void obapi_put(::obapi::Writer& w, BitStatusType const& v) {
        ::obapi::put(w, v.RoutineName);
        ::obapi::put(w, v.Result);
        ::obapi::put(w, v.ErrorCode);
        ::obapi::put(w, v.ErrorCodeDescription);
        ::obapi::put(w, v.AdditionalInfo);
    }
    void obapi_get(::obapi::Reader& r, BitStatusType& v) {
        ::obapi::get(r, v.RoutineName);
        ::obapi::get(r, v.Result);
        ::obapi::get(r, v.ErrorCode);
        ::obapi::get(r, v.ErrorCodeDescription);
        ::obapi::get(r, v.AdditionalInfo);
    }
} // namespace M_BuiltInTest

namespace {
    struct ServiceCallbacks final : ::M_BuiltInTest::IService {
        ::obapi::Dispatcher dispatcher;
        void CmdStartIBitRoutine(std::string const& RoutineName) override {
            ::obapi::Writer w;
            ::obapi::put(w, RoutineName);
            dispatcher.dispatch(0u, w);
        }
        void CmdCancelIBitRoutine(std::string const& RoutineName) override {
            ::obapi::Writer w;
            ::obapi::put(w, RoutineName);
            dispatcher.dispatch(1u, w);
        }
    };

    struct ClientCallbacks final : ::M_BuiltInTest::IClient {
        ::obapi::Dispatcher dispatcher;
        void ReportBitSettings(::M_BuiltInTest::BitSettingsType const& Settings) override {
            ::obapi::Writer w;
            ::obapi::put(w, Settings);
            dispatcher.dispatch(0u, w);
        }
        void ReportIBitRoutineStatus(std::string const& KeyRoutineName, ::M_BuiltInTest::IBitRoutineState::Type RoutineState, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyRoutineName);
            ::obapi::put(w, RoutineState);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(1u, w);
        }
        void ReportIBitStatus(std::string const& KeyIBitName, ::M_BuiltInTest::BitStatusType const& Status, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyIBitName);
            ::obapi::put(w, Status);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(2u, w);
        }
        void ReportPBitStatus(std::string const& KeyPBitName, ::M_BuiltInTest::BitStatusType const& Status, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyPBitName);
            ::obapi::put(w, Status);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(3u, w);
        }
        void ReportCBitStatus(std::string const& KeyCBitName, ::M_BuiltInTest::BitStatusType const& Status, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyCBitName);
            ::obapi::put(w, Status);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(4u, w);
        }
    };

    void service_send(::obapi::Holder<::M_BuiltInTest::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                ::M_BuiltInTest::BitSettingsType Settings{};
                ::obapi::get(r, Settings);
                r.finish();
                h.endpoint->ReportBitSettings(Settings);
                return;
            }
            case 1u: {
                std::string KeyRoutineName{};
                ::obapi::get(r, KeyRoutineName);
                ::M_BuiltInTest::IBitRoutineState::Type RoutineState{};
                ::obapi::get(r, RoutineState);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportIBitRoutineStatus(KeyRoutineName, RoutineState, IsRemoved);
                return;
            }
            case 2u: {
                std::string KeyIBitName{};
                ::obapi::get(r, KeyIBitName);
                ::M_BuiltInTest::BitStatusType Status{};
                ::obapi::get(r, Status);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportIBitStatus(KeyIBitName, Status, IsRemoved);
                return;
            }
            case 3u: {
                std::string KeyPBitName{};
                ::obapi::get(r, KeyPBitName);
                ::M_BuiltInTest::BitStatusType Status{};
                ::obapi::get(r, Status);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportPBitStatus(KeyPBitName, Status, IsRemoved);
                return;
            }
            case 4u: {
                std::string KeyCBitName{};
                ::obapi::get(r, KeyCBitName);
                ::M_BuiltInTest::BitStatusType Status{};
                ::obapi::get(r, Status);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportCBitStatus(KeyCBitName, Status, IsRemoved);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

    void client_send(::obapi::Holder<::M_BuiltInTest::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                std::string RoutineName{};
                ::obapi::get(r, RoutineName);
                r.finish();
                h.endpoint->CmdStartIBitRoutine(RoutineName);
                return;
            }
            case 1u: {
                std::string RoutineName{};
                ::obapi::get(r, RoutineName);
                r.finish();
                h.endpoint->CmdCancelIBitRoutine(RoutineName);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

} // namespace

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