/// /// Copyright (c) 2020 Sensus Slovensko a.s. /// using System; namespace DataStreamInterface { public interface IDataStreamMeter { /// /// Returns count of water meters supported by the data stream component /// /// Water meters count int GetMetersCount(); /// /// Get state of the connected data stream meter /// /// Index of the meter in range 0 .. (GetMetersCount() - 1) /// Current state of the meter /// Current extra parameter of the meter /// true when successful bool GetState(int meterIx, out int state, out string parameter); /// /// Set state of the connected data stream meter /// /// Index of the meter in range 0 .. (GetMetersCount() - 1) /// Required state of the meter /// Required extra parameter of the meter /// true when successful bool SetState(int meterIx, int state, string parameter); bool SetStateAll(int state, string parameter); /// /// Establish connection with a data stream meter /// /// Index of the meter in range 0 .. (GetMetersCount() - 1) /// Connection parameters /// Meter ID (e.g. serial number) /// true when successful bool OpenConnection(int meterIx, string connectionParameters, out string meterId); /// /// Stars saving measurement results into internal data structures of the component. /// Each data frame obtains a unique ID. /// The very first data fraim obrains ID = 0. /// /// Index of the meter in range 0 .. (GetMetersCount() - 1) /// true when successful bool StartMeasurement(int meterIx); bool StartMeasurementAll(); /// /// Stops saving measurement results into internal data structures of the component. /// Updates ID of the last date frame received from the meter. /// /// Index of the meter in range 0 .. (GetMetersCount() - 1) /// Number of stored date frames /// true when successful bool StopMeasurement(int meterIx, out Int64 storedFramesCount); bool StopMeasurementAll(out Int64[] storedFramesCounts); /// /// Closes connection with the data stream meter /// /// Index of the meter in range 0 .. (GetMetersCount() - 1) /// true when successful bool CloseConnection(int meterIx); bool CloseConnectionAll(); /// /// This function is called when TBF program is shutting down. /// /// true when successful bool Shutdown(); ///------------------------------------------------ /// Units of time, volume and optional quantities ///------------------------------------------------ /// /// Returns time units (s, ms, ...) /// Unit GetTimeUnits(); /// /// Returns units of volume (ml, l, ...) /// Unit GetVolumeUnits(); ///----------------------------------------------- /// Optional quantities: count, units, captions ///----------------------------------------------- /// /// Returns count of optional quantities in each data frame /// /// Count of optional quantities int GetQuantitiesCount(); /// /// Returns units of the specified quantity /// /// Zero based quantity number 0 .. quantites count-1 Unit GetQuantityUnits(int quantityNr); /// /// Returns caption of the specified quantity /// /// Zero based quantity number 0 .. quantites count-1 string GetQuantityCaption(int quantityNr); ///--------------------------- /// Datastream data exchange ///--------------------------- /// /// Retuns 'count' data frames starting with data frame with ID = 'id' /// /// Index of the meter in range 0 .. (GetMetersCount() - 1) /// First frame ID /// Frames count /// Selected data frames DataFrame[] GetFrames(int meterIx, Int64 id, int count); /// /// Returns ID of the data frame where time equals or exceeds the specified time. /// When time of the first frame (ID=0) is larger then specified time, function returns 0. /// /// Index of the meter in range 0 .. (GetMetersCount() - 1) /// Time /// ID of the data frame at or after the pecified time Int64 GetID(int meterIx, double time); } }