pub trait DataSource {
// Required method
fn read(&mut self, context: &mut DataSourceReadContext) -> DataSourceResult;
// Provided method
fn write(
&mut self,
context: &mut DataSourceWriteContext,
) -> DataSourceResult { ... }
}Expand description
Data source with callbacks.
The read and write callbacks implement the operations on the variable when it is added via
Server::add_data_source_variable_node().
Required Methods§
Sourcefn read(&mut self, context: &mut DataSourceReadContext) -> DataSourceResult
fn read(&mut self, context: &mut DataSourceReadContext) -> DataSourceResult
Reads from variable.
This is called when a client wants to read the value from the variable. The value is
expected to be returned through the context argument. See
DataSourceReadContext::set_value() for details.
§Errors
This should return an appropriate error when the read is not possible. The underlying status code is forwarded to the client.
Provided Methods§
Sourcefn write(&mut self, context: &mut DataSourceWriteContext) -> DataSourceResult
fn write(&mut self, context: &mut DataSourceWriteContext) -> DataSourceResult
Writes to variable.
This is called when a client wants to write the value to the variable. The value is
transmitted through the context argument. See DataSourceWriteContext::value() for
details.
If this method is not implemented, ua::StatusCode::BADNOTSUPPORTED is returned to the
client.
§Errors
This should return an appropriate error when the write is not possible. The underlying status code is forwarded to the client.