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

#include <type_traits>

static_assert(static_cast<uint32_t>(::M_ImageProcessing::InterpolationKind::Nearest_Neighbour) == 0u, "enum value M_ImageProcessing::InterpolationKind::Type::Nearest_Neighbour differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::InterpolationKind::Bilinear) == 1u, "enum value M_ImageProcessing::InterpolationKind::Type::Bilinear differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::InterpolationKind::Bicubic) == 2u, "enum value M_ImageProcessing::InterpolationKind::Type::Bicubic differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::InterpolationKind::Spline) == 3u, "enum value M_ImageProcessing::InterpolationKind::Type::Spline differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::InterpolationKind::Lanczos) == 4u, "enum value M_ImageProcessing::InterpolationKind::Type::Lanczos differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::InterpolationKind::Wavelet) == 5u, "enum value M_ImageProcessing::InterpolationKind::Type::Wavelet differs from the data model");
static_assert(std::is_same<::M_ImageProcessing::InterpolationOptionalType, std::vector<::M_ImageProcessing::InterpolationKind::Type>>::value, "typedef M_ImageProcessing::InterpolationOptionalType differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::FlipDirectionKind::None) == 0u, "enum value M_ImageProcessing::FlipDirectionKind::Type::None differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::FlipDirectionKind::Horizontal) == 1u, "enum value M_ImageProcessing::FlipDirectionKind::Type::Horizontal differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::FlipDirectionKind::Vertical) == 2u, "enum value M_ImageProcessing::FlipDirectionKind::Type::Vertical differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::FlipDirectionKind::Horizontal_Vertical) == 3u, "enum value M_ImageProcessing::FlipDirectionKind::Type::Horizontal_Vertical differs from the data model");
static_assert(std::is_same<::M_ImageProcessing::FlipDirectionOptionalType, std::vector<::M_ImageProcessing::FlipDirectionKind::Type>>::value, "typedef M_ImageProcessing::FlipDirectionOptionalType differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::FrameDropKind::PassEveryNthFrame) == 0u, "enum value M_ImageProcessing::FrameDropKind::Type::PassEveryNthFrame differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::FrameDropKind::DropEveryNthFrame) == 1u, "enum value M_ImageProcessing::FrameDropKind::Type::DropEveryNthFrame differs from the data model");
static_assert(static_cast<uint32_t>(::M_ImageProcessing::FrameDropKind::DropRandomPercentage) == 2u, "enum value M_ImageProcessing::FrameDropKind::Type::DropRandomPercentage differs from the data model");
static_assert(std::is_same<::M_ImageProcessing::FrameDropListType, std::vector<::M_ImageProcessing::FrameDropKind::Type>>::value, "typedef M_ImageProcessing::FrameDropListType differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::FrameDropType::Mode), ::M_ImageProcessing::FrameDropKind::Type>::value, "M_ImageProcessing::FrameDropType field Mode differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::FrameDropType::EveryNthFrameToPass), std::vector<int32_t>>::value, "M_ImageProcessing::FrameDropType field EveryNthFrameToPass differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::FrameDropType::EveryNthFrameToDrop), std::vector<int32_t>>::value, "M_ImageProcessing::FrameDropType field EveryNthFrameToDrop differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::FrameDropType::RandomFrameDropPercentage), std::vector<double>>::value, "M_ImageProcessing::FrameDropType field RandomFrameDropPercentage differs from the data model");
static_assert(std::is_same<::M_ImageProcessing::FrameDropOptionalType, std::vector<::M_ImageProcessing::FrameDropType>>::value, "typedef M_ImageProcessing::FrameDropOptionalType differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageInfoType::Region), ::M_Common::ImageRegionType>::value, "M_ImageProcessing::ImageInfoType field Region differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageInfoType::RotationAngle), std::vector<double>>::value, "M_ImageProcessing::ImageInfoType field RotationAngle differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageInfoType::FlipDirection), std::vector<::M_ImageProcessing::FlipDirectionKind::Type>>::value, "M_ImageProcessing::ImageInfoType field FlipDirection differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageInfoType::Interpolation), std::vector<::M_ImageProcessing::InterpolationKind::Type>>::value, "M_ImageProcessing::ImageInfoType field Interpolation differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageProcessingSettingsType::SupportedFrameDropModes), std::vector<::M_ImageProcessing::FrameDropKind::Type>>::value, "M_ImageProcessing::ImageProcessingSettingsType field SupportedFrameDropModes differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageProcessingSettingsType::IsCmdSetRegionSupported), bool>::value, "M_ImageProcessing::ImageProcessingSettingsType field IsCmdSetRegionSupported differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageProcessingSettingsType::IsCmdScaleSupported), bool>::value, "M_ImageProcessing::ImageProcessingSettingsType field IsCmdScaleSupported differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageProcessingSettingsType::IsCmdRotateSupported), bool>::value, "M_ImageProcessing::ImageProcessingSettingsType field IsCmdRotateSupported differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageProcessingSettingsType::IsCmdFlipSupported), bool>::value, "M_ImageProcessing::ImageProcessingSettingsType field IsCmdFlipSupported differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageProcessingStatusType::InputImageSize), ::M_Common::PixelRectSizeType>::value, "M_ImageProcessing::ImageProcessingStatusType field InputImageSize differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageProcessingStatusType::OutputImageInfo), ::M_ImageProcessing::ImageInfoType>::value, "M_ImageProcessing::ImageProcessingStatusType field OutputImageInfo differs from the data model");
static_assert(std::is_same<decltype(::M_ImageProcessing::ImageProcessingStatusType::FrameDropMethod), std::vector<::M_ImageProcessing::FrameDropType>>::value, "M_ImageProcessing::ImageProcessingStatusType field FrameDropMethod differs from the data model");

namespace M_ImageProcessing {
    void obapi_put(::obapi::Writer& w, FrameDropType const& v) {
        ::obapi::put(w, v.Mode);
        ::obapi::put(w, v.EveryNthFrameToPass);
        ::obapi::put(w, v.EveryNthFrameToDrop);
        ::obapi::put(w, v.RandomFrameDropPercentage);
    }
    void obapi_get(::obapi::Reader& r, FrameDropType& v) {
        ::obapi::get(r, v.Mode);
        ::obapi::get(r, v.EveryNthFrameToPass);
        ::obapi::get(r, v.EveryNthFrameToDrop);
        ::obapi::get(r, v.RandomFrameDropPercentage);
    }
    void obapi_put(::obapi::Writer& w, ImageInfoType const& v) {
        ::obapi::put(w, v.Region);
        ::obapi::put(w, v.RotationAngle);
        ::obapi::put(w, v.FlipDirection);
        ::obapi::put(w, v.Interpolation);
    }
    void obapi_get(::obapi::Reader& r, ImageInfoType& v) {
        ::obapi::get(r, v.Region);
        ::obapi::get(r, v.RotationAngle);
        ::obapi::get(r, v.FlipDirection);
        ::obapi::get(r, v.Interpolation);
    }
    void obapi_put(::obapi::Writer& w, ImageProcessingSettingsType const& v) {
        ::obapi::put(w, v.SupportedFrameDropModes);
        ::obapi::put(w, v.IsCmdSetRegionSupported);
        ::obapi::put(w, v.IsCmdScaleSupported);
        ::obapi::put(w, v.IsCmdRotateSupported);
        ::obapi::put(w, v.IsCmdFlipSupported);
    }
    void obapi_get(::obapi::Reader& r, ImageProcessingSettingsType& v) {
        ::obapi::get(r, v.SupportedFrameDropModes);
        ::obapi::get(r, v.IsCmdSetRegionSupported);
        ::obapi::get(r, v.IsCmdScaleSupported);
        ::obapi::get(r, v.IsCmdRotateSupported);
        ::obapi::get(r, v.IsCmdFlipSupported);
    }
    void obapi_put(::obapi::Writer& w, ImageProcessingStatusType const& v) {
        ::obapi::put(w, v.InputImageSize);
        ::obapi::put(w, v.OutputImageInfo);
        ::obapi::put(w, v.FrameDropMethod);
    }
    void obapi_get(::obapi::Reader& r, ImageProcessingStatusType& v) {
        ::obapi::get(r, v.InputImageSize);
        ::obapi::get(r, v.OutputImageInfo);
        ::obapi::get(r, v.FrameDropMethod);
    }
} // namespace M_ImageProcessing

namespace {
    struct ServiceCallbacks final : ::M_ImageProcessing::IService {
        ::obapi::Dispatcher dispatcher;
        void ConfigInterpolation(::M_ImageProcessing::InterpolationKind::Type Interpolation) override {
            ::obapi::Writer w;
            ::obapi::put(w, Interpolation);
            dispatcher.dispatch(0u, w);
        }
        void ConfigFrameDrop(::M_ImageProcessing::FrameDropType const& FrameDropMethod) override {
            ::obapi::Writer w;
            ::obapi::put(w, FrameDropMethod);
            dispatcher.dispatch(1u, w);
        }
        void ConfigBitrate(::M_Common::BitrateKiloBitsPerSecType Bitrate) override {
            ::obapi::Writer w;
            ::obapi::put(w, Bitrate);
            dispatcher.dispatch(2u, w);
        }
        void CmdSetRegion(::M_Common::ImageRegionType const& Region) override {
            ::obapi::Writer w;
            ::obapi::put(w, Region);
            dispatcher.dispatch(3u, w);
        }
        void CmdScale(::M_Common::PixelRectSizeType const& Size) override {
            ::obapi::Writer w;
            ::obapi::put(w, Size);
            dispatcher.dispatch(4u, w);
        }
        void CmdRotate(::M_Common::AngleDegreesType RotationAngle) override {
            ::obapi::Writer w;
            ::obapi::put(w, RotationAngle);
            dispatcher.dispatch(5u, w);
        }
        void CmdFlip(::M_ImageProcessing::FlipDirectionKind::Type FlipDirection) override {
            ::obapi::Writer w;
            ::obapi::put(w, FlipDirection);
            dispatcher.dispatch(6u, w);
        }
    };

    struct ClientCallbacks final : ::M_ImageProcessing::IClient {
        ::obapi::Dispatcher dispatcher;
        void ReportImageProcessingSettings(::M_ImageProcessing::ImageProcessingSettingsType const& Settings) override {
            ::obapi::Writer w;
            ::obapi::put(w, Settings);
            dispatcher.dispatch(0u, w);
        }
        void ReportImageProcessingStatus(::M_ImageProcessing::ImageProcessingStatusType const& Status, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, Status);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(1u, w);
        }
    };

    void service_send(::obapi::Holder<::M_ImageProcessing::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                ::M_ImageProcessing::ImageProcessingSettingsType Settings{};
                ::obapi::get(r, Settings);
                r.finish();
                h.endpoint->ReportImageProcessingSettings(Settings);
                return;
            }
            case 1u: {
                ::M_ImageProcessing::ImageProcessingStatusType Status{};
                ::obapi::get(r, Status);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportImageProcessingStatus(Status, IsRemoved);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

    void client_send(::obapi::Holder<::M_ImageProcessing::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                ::M_ImageProcessing::InterpolationKind::Type Interpolation{};
                ::obapi::get(r, Interpolation);
                r.finish();
                h.endpoint->ConfigInterpolation(Interpolation);
                return;
            }
            case 1u: {
                ::M_ImageProcessing::FrameDropType FrameDropMethod{};
                ::obapi::get(r, FrameDropMethod);
                r.finish();
                h.endpoint->ConfigFrameDrop(FrameDropMethod);
                return;
            }
            case 2u: {
                ::M_Common::BitrateKiloBitsPerSecType Bitrate{};
                ::obapi::get(r, Bitrate);
                r.finish();
                h.endpoint->ConfigBitrate(Bitrate);
                return;
            }
            case 3u: {
                ::M_Common::ImageRegionType Region{};
                ::obapi::get(r, Region);
                r.finish();
                h.endpoint->CmdSetRegion(Region);
                return;
            }
            case 4u: {
                ::M_Common::PixelRectSizeType Size{};
                ::obapi::get(r, Size);
                r.finish();
                h.endpoint->CmdScale(Size);
                return;
            }
            case 5u: {
                ::M_Common::AngleDegreesType RotationAngle{};
                ::obapi::get(r, RotationAngle);
                r.finish();
                h.endpoint->CmdRotate(RotationAngle);
                return;
            }
            case 6u: {
                ::M_ImageProcessing::FlipDirectionKind::Type FlipDirection{};
                ::obapi::get(r, FlipDirection);
                r.finish();
                h.endpoint->CmdFlip(FlipDirection);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

} // namespace

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