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

#include <type_traits>

static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::BitCtrlSettingsType::SupportedActions), std::vector<std::string>>::value, "M_BuiltInTestCtrl::BitCtrlSettingsType field SupportedActions differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::BitCtrlSettingsType::SupportedRecordNames), std::vector<std::string>>::value, "M_BuiltInTestCtrl::BitCtrlSettingsType field SupportedRecordNames differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::BitCtrlSettingsType::AdditionalInfo), std::vector<::M_Common::PropertyType>>::value, "M_BuiltInTestCtrl::BitCtrlSettingsType field AdditionalInfo differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::BitCtrlStatusType::CurrentAction), std::string>::value, "M_BuiltInTestCtrl::BitCtrlStatusType field CurrentAction differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::BitCtrlStatusType::IsTestRunning), bool>::value, "M_BuiltInTestCtrl::BitCtrlStatusType field IsTestRunning differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::BitCtrlStatusType::IsStartTestAllowed), bool>::value, "M_BuiltInTestCtrl::BitCtrlStatusType field IsStartTestAllowed differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::BitCtrlStatusType::TotalNoRecords), uint32_t>::value, "M_BuiltInTestCtrl::BitCtrlStatusType field TotalNoRecords differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::BitCtrlStatusType::AdditionalInfo), std::vector<::M_Common::PropertyType>>::value, "M_BuiltInTestCtrl::BitCtrlStatusType field AdditionalInfo differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::BitRecordType::RecordName), std::string>::value, "M_BuiltInTestCtrl::BitRecordType field RecordName differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::BitRecordType::Status), ::M_BuiltInTest::BitStatusType>::value, "M_BuiltInTestCtrl::BitRecordType field Status differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::BitRecordType::Timestamp), ::M_Common::TimeType>::value, "M_BuiltInTestCtrl::BitRecordType field Timestamp differs from the data model");
static_assert(std::is_same<::M_BuiltInTestCtrl::BitRecordListType, std::vector<::M_BuiltInTestCtrl::BitRecordType>>::value, "typedef M_BuiltInTestCtrl::BitRecordListType differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::HistoricalBitRecordParamsType::RecordListId), std::string>::value, "M_BuiltInTestCtrl::HistoricalBitRecordParamsType field RecordListId differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::HistoricalBitRecordParamsType::IndexOfFirstRecord), uint32_t>::value, "M_BuiltInTestCtrl::HistoricalBitRecordParamsType field IndexOfFirstRecord differs from the data model");
static_assert(std::is_same<decltype(::M_BuiltInTestCtrl::HistoricalBitRecordParamsType::FilterExpression), std::string>::value, "M_BuiltInTestCtrl::HistoricalBitRecordParamsType field FilterExpression differs from the data model");

namespace M_BuiltInTestCtrl {
    void obapi_put(::obapi::Writer& w, BitCtrlSettingsType const& v) {
        ::obapi::put(w, v.SupportedActions);
        ::obapi::put(w, v.SupportedRecordNames);
        ::obapi::put(w, v.AdditionalInfo);
    }
    void obapi_get(::obapi::Reader& r, BitCtrlSettingsType& v) {
        ::obapi::get(r, v.SupportedActions);
        ::obapi::get(r, v.SupportedRecordNames);
        ::obapi::get(r, v.AdditionalInfo);
    }
    void obapi_put(::obapi::Writer& w, BitCtrlStatusType const& v) {
        ::obapi::put(w, v.CurrentAction);
        ::obapi::put(w, v.IsTestRunning);
        ::obapi::put(w, v.IsStartTestAllowed);
        ::obapi::put(w, v.TotalNoRecords);
        ::obapi::put(w, v.AdditionalInfo);
    }
    void obapi_get(::obapi::Reader& r, BitCtrlStatusType& v) {
        ::obapi::get(r, v.CurrentAction);
        ::obapi::get(r, v.IsTestRunning);
        ::obapi::get(r, v.IsStartTestAllowed);
        ::obapi::get(r, v.TotalNoRecords);
        ::obapi::get(r, v.AdditionalInfo);
    }
    void obapi_put(::obapi::Writer& w, BitRecordType const& v) {
        ::obapi::put(w, v.RecordName);
        ::obapi::put(w, v.Status);
        ::obapi::put(w, v.Timestamp);
    }
    void obapi_get(::obapi::Reader& r, BitRecordType& v) {
        ::obapi::get(r, v.RecordName);
        ::obapi::get(r, v.Status);
        ::obapi::get(r, v.Timestamp);
    }
    void obapi_put(::obapi::Writer& w, HistoricalBitRecordParamsType const& v) {
        ::obapi::put(w, v.RecordListId);
        ::obapi::put(w, v.IndexOfFirstRecord);
        ::obapi::put(w, v.FilterExpression);
    }
    void obapi_get(::obapi::Reader& r, HistoricalBitRecordParamsType& v) {
        ::obapi::get(r, v.RecordListId);
        ::obapi::get(r, v.IndexOfFirstRecord);
        ::obapi::get(r, v.FilterExpression);
    }
} // namespace M_BuiltInTestCtrl

namespace {
    struct ServiceCallbacks final : ::M_BuiltInTestCtrl::IService {
        ::obapi::Dispatcher dispatcher;
        void ConfigAllowTest(bool IsAllowed) override {
            ::obapi::Writer w;
            ::obapi::put(w, IsAllowed);
            dispatcher.dispatch(0u, w);
        }
        void CmdStartTest(std::string const& Action) override {
            ::obapi::Writer w;
            ::obapi::put(w, Action);
            dispatcher.dispatch(1u, w);
        }
        void CmdCancelTest() override {
            ::obapi::Writer w;
            dispatcher.dispatch(2u, w);
        }
        void RequestHistoricalRecords(::M_BuiltInTestCtrl::HistoricalBitRecordParamsType const& RecordParams, uint16_t MaxNoRecords) override {
            ::obapi::Writer w;
            ::obapi::put(w, RecordParams);
            ::obapi::put(w, MaxNoRecords);
            dispatcher.dispatch(3u, w);
        }
    };

    struct ClientCallbacks final : ::M_BuiltInTestCtrl::IClient {
        ::obapi::Dispatcher dispatcher;
        void ReportBitCtrlSettings(::M_BuiltInTestCtrl::BitCtrlSettingsType const& Settings) override {
            ::obapi::Writer w;
            ::obapi::put(w, Settings);
            dispatcher.dispatch(0u, w);
        }
        void ReportBitCtrlStatus(::M_BuiltInTestCtrl::BitCtrlStatusType const& Status, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, Status);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(1u, w);
        }
        void ResponseHistoricalRecords(::M_BuiltInTestCtrl::HistoricalBitRecordParamsType const& RecordParams, ::M_BuiltInTestCtrl::BitRecordListType const& RecordList, uint32_t TotalNoFilteredRecords) override {
            ::obapi::Writer w;
            ::obapi::put(w, RecordParams);
            ::obapi::put(w, RecordList);
            ::obapi::put(w, TotalNoFilteredRecords);
            dispatcher.dispatch(2u, w);
        }
    };

    void service_send(::obapi::Holder<::M_BuiltInTestCtrl::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                ::M_BuiltInTestCtrl::BitCtrlSettingsType Settings{};
                ::obapi::get(r, Settings);
                r.finish();
                h.endpoint->ReportBitCtrlSettings(Settings);
                return;
            }
            case 1u: {
                ::M_BuiltInTestCtrl::BitCtrlStatusType Status{};
                ::obapi::get(r, Status);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportBitCtrlStatus(Status, IsRemoved);
                return;
            }
            case 2u: {
                ::M_BuiltInTestCtrl::HistoricalBitRecordParamsType RecordParams{};
                ::obapi::get(r, RecordParams);
                ::M_BuiltInTestCtrl::BitRecordListType RecordList{};
                ::obapi::get(r, RecordList);
                uint32_t TotalNoFilteredRecords{};
                ::obapi::get(r, TotalNoFilteredRecords);
                r.finish();
                h.endpoint->ResponseHistoricalRecords(RecordParams, RecordList, TotalNoFilteredRecords);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

    void client_send(::obapi::Holder<::M_BuiltInTestCtrl::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                bool IsAllowed{};
                ::obapi::get(r, IsAllowed);
                r.finish();
                h.endpoint->ConfigAllowTest(IsAllowed);
                return;
            }
            case 1u: {
                std::string Action{};
                ::obapi::get(r, Action);
                r.finish();
                h.endpoint->CmdStartTest(Action);
                return;
            }
            case 2u: {
                r.finish();
                h.endpoint->CmdCancelTest();
                return;
            }
            case 3u: {
                ::M_BuiltInTestCtrl::HistoricalBitRecordParamsType RecordParams{};
                ::obapi::get(r, RecordParams);
                uint16_t MaxNoRecords{};
                ::obapi::get(r, MaxNoRecords);
                r.finish();
                h.endpoint->RequestHistoricalRecords(RecordParams, MaxNoRecords);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

} // namespace

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