forked from open62541pp/open62541pp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservices_method.cpp
41 lines (33 loc) · 1.14 KB
/
services_method.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "open62541pp/services/method.hpp"
#ifdef UA_ENABLE_METHODCALLS
#include "open62541pp/client.hpp"
#include "open62541pp/server.hpp"
#include "open62541pp/ua/types.hpp"
namespace opcua::services {
CallResponse call(Client& connection, const CallRequest& request) noexcept {
return UA_Client_Service_call(connection.handle(), request);
}
template <>
CallMethodResult call(
Server& connection,
const NodeId& objectId,
const NodeId& methodId,
Span<const Variant> inputArguments
) noexcept {
const auto item = detail::createCallMethodRequest(objectId, methodId, inputArguments);
return UA_Server_call(connection.handle(), &item);
}
template <>
CallMethodResult call(
Client& connection,
const NodeId& objectId,
const NodeId& methodId,
Span<const Variant> inputArguments
) noexcept {
auto item = detail::createCallMethodRequest(objectId, methodId, inputArguments);
const auto request = detail::createCallRequest(item);
auto response = call(connection, asWrapper<CallRequest>(request));
return detail::wrapSingleResultWithStatus<CallMethodResult>(response);
}
} // namespace opcua::services
#endif