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

#include <type_traits>

static_assert(std::is_same<decltype(::M_MetSensor::AtmosphericType::Temperature), std::vector<::M_Common::TemperatureKelvinsSelectionType>>::value, "M_MetSensor::AtmosphericType field Temperature differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::AtmosphericType::Pressure), std::vector<::M_Common::PressurePascalsSelectionType>>::value, "M_MetSensor::AtmosphericType field Pressure differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::AtmosphericType::RelativeHumidity), std::vector<::M_Common::PercentSelectionType>>::value, "M_MetSensor::AtmosphericType field RelativeHumidity differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::AtmosphericType::WindVelocity), std::vector<::M_Common::LinearVelocitySelectionType>>::value, "M_MetSensor::AtmosphericType field WindVelocity differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::MetSensorSettingsType::IsTemperatureSupported), bool>::value, "M_MetSensor::MetSensorSettingsType field IsTemperatureSupported differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::MetSensorSettingsType::MinTemperature), std::vector<double>>::value, "M_MetSensor::MetSensorSettingsType field MinTemperature differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::MetSensorSettingsType::MaxTemperature), std::vector<double>>::value, "M_MetSensor::MetSensorSettingsType field MaxTemperature differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::MetSensorSettingsType::IsPressureSupported), bool>::value, "M_MetSensor::MetSensorSettingsType field IsPressureSupported differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::MetSensorSettingsType::MinPressure), std::vector<double>>::value, "M_MetSensor::MetSensorSettingsType field MinPressure differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::MetSensorSettingsType::MaxPressure), std::vector<double>>::value, "M_MetSensor::MetSensorSettingsType field MaxPressure differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::MetSensorSettingsType::IsWindVelocitySupported), bool>::value, "M_MetSensor::MetSensorSettingsType field IsWindVelocitySupported differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::MetSensorSettingsType::MaxWindSpeed), std::vector<double>>::value, "M_MetSensor::MetSensorSettingsType field MaxWindSpeed differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::MetSensorSettingsType::IsRelativeHumiditySupported), bool>::value, "M_MetSensor::MetSensorSettingsType field IsRelativeHumiditySupported differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::MetSensorSettingsType::MaxRelativeHumidity), std::vector<double>>::value, "M_MetSensor::MetSensorSettingsType field MaxRelativeHumidity differs from the data model");
static_assert(std::is_same<decltype(::M_MetSensor::MetSensorSettingsType::AdditionalInfo), std::vector<::M_Common::PropertyType>>::value, "M_MetSensor::MetSensorSettingsType field AdditionalInfo differs from the data model");

namespace M_MetSensor {
    void obapi_put(::obapi::Writer& w, AtmosphericType const& v) {
        ::obapi::put(w, v.Temperature);
        ::obapi::put(w, v.Pressure);
        ::obapi::put(w, v.RelativeHumidity);
        ::obapi::put(w, v.WindVelocity);
    }
    void obapi_get(::obapi::Reader& r, AtmosphericType& v) {
        ::obapi::get(r, v.Temperature);
        ::obapi::get(r, v.Pressure);
        ::obapi::get(r, v.RelativeHumidity);
        ::obapi::get(r, v.WindVelocity);
    }
    void obapi_put(::obapi::Writer& w, MetSensorSettingsType const& v) {
        ::obapi::put(w, v.IsTemperatureSupported);
        ::obapi::put(w, v.MinTemperature);
        ::obapi::put(w, v.MaxTemperature);
        ::obapi::put(w, v.IsPressureSupported);
        ::obapi::put(w, v.MinPressure);
        ::obapi::put(w, v.MaxPressure);
        ::obapi::put(w, v.IsWindVelocitySupported);
        ::obapi::put(w, v.MaxWindSpeed);
        ::obapi::put(w, v.IsRelativeHumiditySupported);
        ::obapi::put(w, v.MaxRelativeHumidity);
        ::obapi::put(w, v.AdditionalInfo);
    }
    void obapi_get(::obapi::Reader& r, MetSensorSettingsType& v) {
        ::obapi::get(r, v.IsTemperatureSupported);
        ::obapi::get(r, v.MinTemperature);
        ::obapi::get(r, v.MaxTemperature);
        ::obapi::get(r, v.IsPressureSupported);
        ::obapi::get(r, v.MinPressure);
        ::obapi::get(r, v.MaxPressure);
        ::obapi::get(r, v.IsWindVelocitySupported);
        ::obapi::get(r, v.MaxWindSpeed);
        ::obapi::get(r, v.IsRelativeHumiditySupported);
        ::obapi::get(r, v.MaxRelativeHumidity);
        ::obapi::get(r, v.AdditionalInfo);
    }
} // namespace M_MetSensor

namespace {
    struct ServiceCallbacks final : ::M_MetSensor::IService {
        ::obapi::Dispatcher dispatcher;
        void CmdIsMetSensorAlive() override {
            ::obapi::Writer w;
            dispatcher.dispatch(0u, w);
        }
    };

    struct ClientCallbacks final : ::M_MetSensor::IClient {
        ::obapi::Dispatcher dispatcher;
        void ReportMetSensorSettings(::M_MetSensor::MetSensorSettingsType const& Settings) override {
            ::obapi::Writer w;
            ::obapi::put(w, Settings);
            dispatcher.dispatch(0u, w);
        }
        void ReportMetSensorStatus(::M_MetSensor::AtmosphericType const& AtmosphericData, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, AtmosphericData);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(1u, w);
        }
    };

    void service_send(::obapi::Holder<::M_MetSensor::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                ::M_MetSensor::MetSensorSettingsType Settings{};
                ::obapi::get(r, Settings);
                r.finish();
                h.endpoint->ReportMetSensorSettings(Settings);
                return;
            }
            case 1u: {
                ::M_MetSensor::AtmosphericType AtmosphericData{};
                ::obapi::get(r, AtmosphericData);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportMetSensorStatus(AtmosphericData, IsRemoved);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

    void client_send(::obapi::Holder<::M_MetSensor::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                r.finish();
                h.endpoint->CmdIsMetSensorAlive();
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

} // namespace

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