ifw-fcf 8.0.2
 
Loading...
Searching...
No Matches
fcfCommHelpers.hpp File Reference

FCF helpers for talking to ualib::Client. More...

#include <chrono>
#include <functional>
#include <stdexcept>
#include <string>
#include <utility>
#include <variant>
#include <vector>
#include <fmt/format.h>
#include <ifw/fnd/defs/iCommAdapter.hpp>
#include <eso/uatools/ualib/client.hpp>

Go to the source code of this file.

Namespaces

namespace  ifw
 
namespace  ifw::fcf
 ActionsEnable class source file.
 
namespace  ifw::fcf::devmgr
 actuatorLcsIf class header file.
 
namespace  ifw::fcf::devmgr::common
 ActionMgr class source file.
 

Functions

template<typename... Args>
std::vector< ifw::fnd::defs::CallArgument > ifw::fcf::devmgr::common::MakeCallArgs (Args &&... args)
 Build a vector of positional CallArguments from any number of typed values.
 
void ifw::fcf::devmgr::common::CheckRpcReply (const ifw::fnd::defs::CallResult &result, const std::string &what, const std::function< std::string(short)> &error_message_fn)
 Translate the short-typed reply of an FCF RPC call into a throw-if-non-zero check.
 
void ifw::fcf::devmgr::common::ExecuteRpcCall (ifw::fnd::defs::ICommAdapter &comm, const std::string &method_node_id, std::vector< ifw::fnd::defs::CallArgument > args, const std::string &what, const std::function< std::string(short)> &error_message_fn, const std::string &object_node_id="")
 

Variables

constexpr std::chrono::milliseconds ifw::fcf::devmgr::common::kRpcTimeout {60'000}
 Convenience: call + check in one go. Most FCF RPC call sites become a single line with this.
 

Detailed Description

FCF helpers for talking to ualib::Client.

FCF used to build call arguments through the templated CreateVariantVector(...) helper that produced ifw::core::protocol::base::VectorVariant. After the port to ICommAdapter the equivalent shape is a vector of ifw::fnd::defs::CallArgument, which is what ualib::Client::Call expects. MakeCallArgs(...) here is the drop-in replacement — positional values, no argument names (OPC UA Method calls are positional on the wire), one entry per forwarded value.

ExecuteRpcCall(...) then encapsulates the very common FCF idiom of "call a method, expect a single short reply, throw with the device-specific GetRpcError(reply) if it's non-zero." All the old m_comm->Rpc(...) → std::get<short>(result) → throw if reply != 0 boilerplate becomes one line at the call site.