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

#include <type_traits>

static_assert(static_cast<uint32_t>(::M_FileTransfer::TransferStatusKind::Unknown) == 0u, "enum value M_FileTransfer::TransferStatusKind::Type::Unknown differs from the data model");
static_assert(static_cast<uint32_t>(::M_FileTransfer::TransferStatusKind::In_Progress) == 1u, "enum value M_FileTransfer::TransferStatusKind::Type::In_Progress differs from the data model");
static_assert(static_cast<uint32_t>(::M_FileTransfer::TransferStatusKind::Waiting) == 2u, "enum value M_FileTransfer::TransferStatusKind::Type::Waiting differs from the data model");
static_assert(static_cast<uint32_t>(::M_FileTransfer::TransferStatusKind::Paused) == 3u, "enum value M_FileTransfer::TransferStatusKind::Type::Paused differs from the data model");
static_assert(static_cast<uint32_t>(::M_FileTransfer::TransferStatusKind::Failed) == 4u, "enum value M_FileTransfer::TransferStatusKind::Type::Failed differs from the data model");
static_assert(static_cast<uint32_t>(::M_FileTransfer::TransferStatusKind::Success) == 5u, "enum value M_FileTransfer::TransferStatusKind::Type::Success differs from the data model");
static_assert(std::is_same<decltype(::M_FileTransfer::FileTransferInfoType::SourceFileUrl), std::string>::value, "M_FileTransfer::FileTransferInfoType field SourceFileUrl differs from the data model");
static_assert(std::is_same<decltype(::M_FileTransfer::FileTransferInfoType::TargetFileUrl), std::string>::value, "M_FileTransfer::FileTransferInfoType field TargetFileUrl differs from the data model");
static_assert(std::is_same<decltype(::M_FileTransfer::FileTransferInfoType::Offset), std::vector<uint64_t>>::value, "M_FileTransfer::FileTransferInfoType field Offset differs from the data model");
static_assert(std::is_same<decltype(::M_FileTransfer::FileTransferInfoType::Size), std::vector<uint64_t>>::value, "M_FileTransfer::FileTransferInfoType field Size differs from the data model");
static_assert(std::is_same<decltype(::M_FileTransfer::FileTransferInfoType::EncryptionInfo), std::vector<::M_Common::EncryptionType>>::value, "M_FileTransfer::FileTransferInfoType field EncryptionInfo differs from the data model");
static_assert(std::is_same<decltype(::M_FileTransfer::FileTransferInfoType::AdditionalInfo), std::vector<::M_Common::PropertyType>>::value, "M_FileTransfer::FileTransferInfoType field AdditionalInfo differs from the data model");
static_assert(std::is_same<::M_FileTransfer::FileTransferInfoOptionalType, std::vector<::M_FileTransfer::FileTransferInfoType>>::value, "typedef M_FileTransfer::FileTransferInfoOptionalType differs from the data model");
static_assert(std::is_same<decltype(::M_FileTransfer::FileTransferStatusType::TransferStatus), ::M_FileTransfer::TransferStatusKind::Type>::value, "M_FileTransfer::FileTransferStatusType field TransferStatus differs from the data model");
static_assert(std::is_same<decltype(::M_FileTransfer::FileTransferStatusType::TransferStatusDescription), std::string>::value, "M_FileTransfer::FileTransferStatusType field TransferStatusDescription differs from the data model");
static_assert(std::is_same<decltype(::M_FileTransfer::FileTransferStatusType::CurrentBytes), std::vector<uint64_t>>::value, "M_FileTransfer::FileTransferStatusType field CurrentBytes differs from the data model");
static_assert(std::is_same<decltype(::M_FileTransfer::FileTransferStatusType::TotalBytes), std::vector<uint64_t>>::value, "M_FileTransfer::FileTransferStatusType field TotalBytes differs from the data model");

namespace M_FileTransfer {
    void obapi_put(::obapi::Writer& w, FileTransferInfoType const& v) {
        ::obapi::put(w, v.SourceFileUrl);
        ::obapi::put(w, v.TargetFileUrl);
        ::obapi::put(w, v.Offset);
        ::obapi::put(w, v.Size);
        ::obapi::put(w, v.EncryptionInfo);
        ::obapi::put(w, v.AdditionalInfo);
    }
    void obapi_get(::obapi::Reader& r, FileTransferInfoType& v) {
        ::obapi::get(r, v.SourceFileUrl);
        ::obapi::get(r, v.TargetFileUrl);
        ::obapi::get(r, v.Offset);
        ::obapi::get(r, v.Size);
        ::obapi::get(r, v.EncryptionInfo);
        ::obapi::get(r, v.AdditionalInfo);
    }
    void obapi_put(::obapi::Writer& w, FileTransferStatusType const& v) {
        ::obapi::put(w, v.TransferStatus);
        ::obapi::put(w, v.TransferStatusDescription);
        ::obapi::put(w, v.CurrentBytes);
        ::obapi::put(w, v.TotalBytes);
    }
    void obapi_get(::obapi::Reader& r, FileTransferStatusType& v) {
        ::obapi::get(r, v.TransferStatus);
        ::obapi::get(r, v.TransferStatusDescription);
        ::obapi::get(r, v.CurrentBytes);
        ::obapi::get(r, v.TotalBytes);
    }
} // namespace M_FileTransfer

namespace {
    struct ServiceCallbacks final : ::M_FileTransfer::IService {
        ::obapi::Dispatcher dispatcher;
        void CmdStartFileTransfer(std::string const& KeyId, ::M_FileTransfer::FileTransferInfoType const& FileTransferInfo) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyId);
            ::obapi::put(w, FileTransferInfo);
            dispatcher.dispatch(0u, w);
        }
        void CmdCancelFileTransfer(std::string const& KeyId) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyId);
            dispatcher.dispatch(1u, w);
        }
        void CmdPauseFileTransfer(std::string const& KeyId) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyId);
            dispatcher.dispatch(2u, w);
        }
        void CmdResumeFileTransfer(std::string const& KeyId) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyId);
            dispatcher.dispatch(3u, w);
        }
    };

    struct ClientCallbacks final : ::M_FileTransfer::IClient {
        ::obapi::Dispatcher dispatcher;
        void ReportFileTransferStatus(std::string const& KeyId, ::M_FileTransfer::FileTransferStatusType const& Status, ::M_FileTransfer::FileTransferInfoOptionalType const& FileTransferInfo, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyId);
            ::obapi::put(w, Status);
            ::obapi::put(w, FileTransferInfo);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(0u, w);
        }
    };

    void service_send(::obapi::Holder<::M_FileTransfer::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                std::string KeyId{};
                ::obapi::get(r, KeyId);
                ::M_FileTransfer::FileTransferStatusType Status{};
                ::obapi::get(r, Status);
                ::M_FileTransfer::FileTransferInfoOptionalType FileTransferInfo{};
                ::obapi::get(r, FileTransferInfo);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportFileTransferStatus(KeyId, Status, FileTransferInfo, IsRemoved);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

    void client_send(::obapi::Holder<::M_FileTransfer::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                std::string KeyId{};
                ::obapi::get(r, KeyId);
                ::M_FileTransfer::FileTransferInfoType FileTransferInfo{};
                ::obapi::get(r, FileTransferInfo);
                r.finish();
                h.endpoint->CmdStartFileTransfer(KeyId, FileTransferInfo);
                return;
            }
            case 1u: {
                std::string KeyId{};
                ::obapi::get(r, KeyId);
                r.finish();
                h.endpoint->CmdCancelFileTransfer(KeyId);
                return;
            }
            case 2u: {
                std::string KeyId{};
                ::obapi::get(r, KeyId);
                r.finish();
                h.endpoint->CmdPauseFileTransfer(KeyId);
                return;
            }
            case 3u: {
                std::string KeyId{};
                ::obapi::get(r, KeyId);
                r.finish();
                h.endpoint->CmdResumeFileTransfer(KeyId);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

} // namespace

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