36 std::vector<DataValue> values = services->Attributes()->Read(attrs);
46 const std::vector<DataValue> result =
GetServices()->Attributes()->Read(params);
48 if (result.size() != 1)
50 throw std::runtime_error(
"Cannot read variable value. Server returned invalid number of values.");
53 return result.front();
67 writeValue.
Value = value;
69 std::vector<StatusCode> result =
GetServices()->Attributes()->Write({writeValue});
71 if (result.size() != 1)
73 throw std::runtime_error(
"Failed to write data. Server returned wron nunber of status codes.");
Variable(NodeId variableId, Services::SharedPtr services)
std::vector< OpcUa::ReadValueId > AttributesToRead
void CheckStatusCode(StatusCode code)
OpcUa Error codes. GNU LGPL.
ReadValueId ToReadValueId(NodeId id, AttributeId attr)
DataValue GetValue() const
void SetSourceTimestamp(const DateTime &t)
void SetValue(const Variant &value)
OPC UA Address space part. GNU LGPL.
VariantType DataTypeToVariantType(const NodeId &dataType)
LocalizedText DisplayName
static DateTime Current()
Services::SharedPtr GetServices() const
std::vector< Variable > Variables() const
OpcUa::AttributeId AttributeId