51 return read(connection, detail::createReadRequest(timestamps, nodesToRead));
59template <
typename CompletionToken>
61 return detail::sendRequestAsync<ReadRequest, ReadResponse>(
62 connection, request, std::forward<CompletionToken>(token)
67template <
typename CompletionToken>
72 CompletionToken&& token
76 detail::createReadRequest(timestamps, nodesToRead),
77 std::forward<CompletionToken>(token)
98template <
typename CompletionToken>
104 CompletionToken&& token
106 auto item = detail::createReadValueId(
id, attributeId);
107 const auto request = detail::createReadRequest(timestamps, item);
111 detail::TransformToken(
112 detail::wrapSingleResult<DataValue, UA_ReadResponse>,
113 std::forward<CompletionToken>(token)
148 return write(connection, detail::createWriteRequest(nodesToWrite));
156template <
typename CompletionToken>
158 return detail::sendRequestAsync<WriteRequest, WriteResponse>(
159 connection, request, std::forward<CompletionToken>(token)
164template <
typename CompletionToken>
167 connection, detail::createWriteRequest(nodesToWrite), std::forward<CompletionToken>(token)
188template <
typename CompletionToken>
194 CompletionToken&& token
196 auto item = detail::createWriteValue(
id, attributeId, value);
197 const auto request = detail::createWriteRequest(item);
201 detail::TransformToken(
202 detail::getSingleStatus<UA_WriteResponse>, std::forward<CompletionToken>(token)
215template <AttributeId Attribute,
typename T>
216auto readAttributeImpl(T& connection,
const NodeId&
id)
noexcept {
217 using Handler =
typename detail::AttributeHandler<Attribute>;
218 return readAttribute(connection,
id, Attribute, TimestampsToReturn::Neither)
219 .andThen(Handler::fromDataValue);
222template <AttributeId Attribute,
typename CompletionToken>
223auto readAttributeAsyncImpl(
Client& connection,
const NodeId&
id, CompletionToken&& token) {
224 using Handler =
typename detail::AttributeHandler<Attribute>;
229 TimestampsToReturn::Neither,
230 detail::TransformToken(
231 [](Result<DataValue>& result) {
232 return std::move(result).andThen(Handler::fromDataValue);
234 std::forward<CompletionToken>(token)
239template <AttributeId Attribute,
typename T,
typename U>
240StatusCode writeAttributeImpl(T& connection,
const NodeId&
id, U&& value)
noexcept {
241 using Handler = detail::AttributeHandler<Attribute>;
242 return writeAttribute(connection,
id, Attribute, Handler::toDataValue(std::forward<U>(value)));
245template <AttributeId Attribute,
typename T,
typename U,
typename CompletionToken>
246auto writeAttributeAsyncImpl(T& connection,
const NodeId&
id, U&& value, CompletionToken&& token) {
247 using Handler = detail::AttributeHandler<Attribute>;
252 Handler::toDataValue(std::forward<U>(value)),
253 std::forward<CompletionToken>(token)
276template <
typename CompletionToken>
282 TimestampsToReturn::Both,
283 std::forward<CompletionToken>(token)
305template <
typename CompletionToken>
Client * asWrapper(UA_Client *client) noexcept
Convert native UA_Client pointer to its wrapper instance.
UA_DataValue wrapper class.
The template class Result encapsulates a StatusCode and optionally a value.
View to a contiguous sequence of objects, similar to std::span in C++20.
UA_StatusCode wrapper class.
UA_ReadRequest wrapper class.
UA_ReadResponse wrapper class.
UA_WriteRequest wrapper class.
UA_WriteResponse wrapper class.
auto readDataValueAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::Value attribute of a node as a DataValue object.
Result< DataValue > readDataValue(T &connection, const NodeId &id) noexcept
Read the AttributeId::Value attribute of a node as a DataValue object.
ReadResponse read(Client &connection, const ReadRequest &request) noexcept
Read one or more attributes of one or more nodes (client only).
Result< DataValue > readAttribute(T &connection, const NodeId &id, AttributeId attributeId, TimestampsToReturn timestamps) noexcept
Read node attribute.
auto readAttributeAsync(Client &connection, const NodeId &id, AttributeId attributeId, TimestampsToReturn timestamps, CompletionToken &&token)
Read node attribute.
auto readAsync(Client &connection, const ReadRequest &request, CompletionToken &&token)
Read one or more attributes of one or more nodes (client only).
TimestampsToReturn
Timestamps to return.
StatusCode writeAttribute(T &connection, const NodeId &id, AttributeId attributeId, const DataValue &value) noexcept
Write node attribute.
auto writeAsync(Client &connection, const WriteRequest &request, CompletionToken &&token)
Write one or more attributes of one or more nodes (client only).
auto writeDataValueAsync(Client &connection, const NodeId &id, const DataValue &value, CompletionToken &&token)
Write the AttributeId::Value attribute of a node as a DataValue object.
auto writeAttributeAsync(Client &connection, const NodeId &id, AttributeId attributeId, const DataValue &value, CompletionToken &&token)
Write node attribute.
StatusCode writeDataValue(T &connection, const NodeId &id, const DataValue &value) noexcept
Write the AttributeId::Value attribute of a node as a DataValue object.
WriteResponse write(Client &connection, const WriteRequest &request) noexcept
Write one or more attributes of one or more nodes (client only).
OPC UA services as free functions.
AttributeId
Attribute identifiers.
@ NodeId
Unambiguous identifier of a node.
@ Value
The most recent value of the variable that the server has.