Skip to content

DataLogReader

class DataLogReader : public karabo::core::Device

@brief DataLogReader devices read archived information from the Karabo data loggers

DataLogReader devices read archived information from the Karabo data loggers. They are managed by karabo::devices::DataLoggerManager devices. Calls to them should usually not happen directly, but rather through a karabo::core::DeviceClient and it's karabo::core::DeviceClient::getPropertyHistory and karabo::core::DeviceClient::getConfigurationFromPast methods.

Functions

Name Description
slotGetPropertyHistory Use this slot to get the history of a given property deviceId : for which to get the history for property : path to the property for which to get the history from params : Hash containing optional limitations for the query: - from: iso8601 timestamp indicating the start of the interval to get history from - to: iso8601 timestamp indicating the end of the interval to get history from - maxNumData: maximum number of data points to retrieve starting from start The slot replies a vector of Hashes where each entry consists of a Hash with a key "v" holding the value of the property at timepoint signified in "v"'s attributes using a format compatible with karabo::data::Timestamp::fromHashAttributes
slotGetConfigurationFromPast Request the configuration Hash and schema of a device at a given point at time.
onOk helper functions to handle state transition in derived classes: onOk: sets the State to ON
onException helper functions to handle state transition in derived classes: onException: sets the State to ERROR, logs the exception trace to status and to the Karabo Logs message : a string to be prepended to the trace Return : the exception trace

Function Details

onException

const std::string onException(const std::string& message)

helper functions to handle state transition in derived classes: onException: sets the State to ERROR, logs the exception trace to status and to the Karabo Logs

message : a string to be prepended to the trace

Return : the exception trace

onOk

void onOk()

helper functions to handle state transition in derived classes: onOk: sets the State to ON

slotGetConfigurationFromPast

void slotGetConfigurationFromPast(const std::string& deviceId, const std::string& timepoint)

Request the configuration Hash and schema of a device at a given point at time. Depending on the device status and on the availability of logged data, the configuration and schema returned will be:

  1. If the device was online and logging data at the given timepoint, the configuration and the schema will be the ones that were active at the timepoint;
  2. If the device was offline at the given timepoint, but there is data logged for it before the timepoint, the last active configuration and schema before that timepoint will be returned;
  3. If the device was offline at the given timepoint and there's no data logged before the timepoint, an empty configuration and an empty schema will be returned.

deviceId : of the device to get the configuration from

timepoint : in iso8601 format for which to get the information

The slot replies with a tuple of 4 values. The first two are the Hash and Schema objects containing the configuration Hash and the corresponding device schema for timepoint. The third is a boolean whose true value indicates the device was online and actively logging data at the timepoint. The fourth value is the string form of the timepoint for the configuration returned and will be the latest timestamp among the timestamps of the properties in the configuration returned.

An important note: if no configuration is found for the device at the timepoint (or before the timepoint), the third value in the reply will be false and the fourth will be the string form of the Epoch (01/01/1970 at 00:00:00).

slotGetPropertyHistory

void slotGetPropertyHistory(const std::string& deviceId, const std::string& property, const karabo::data::Hash& params)

Use this slot to get the history of a given property

deviceId : for which to get the history for

property : path to the property for which to get the history from

params : Hash containing optional limitations for the query: - from: iso8601 timestamp indicating the start of the interval to get history from - to: iso8601 timestamp indicating the end of the interval to get history from - maxNumData: maximum number of data points to retrieve starting from start

The slot replies a vector of Hashes where each entry consists of a Hash with a key "v" holding the value of the property at timepoint signified in "v"'s attributes using a format compatible with karabo::data::Timestamp::fromHashAttributes