diff --git a/DataStreamInterface/DataFrame.cs b/DataStreamInterface/DataFrame.cs index 6338df650..2f5835223 100644 --- a/DataStreamInterface/DataFrame.cs +++ b/DataStreamInterface/DataFrame.cs @@ -7,12 +7,12 @@ namespace DataStreamInterface { public class DataFrame { - public readonly UInt64 ID; /// Frame ID + public readonly Int64 ID; /// Frame ID public readonly double Time; /// Time stamp in units of time public readonly double Volume; /// Volume in units of volume public readonly double[] Quantity; /// An array of optional quantities in their respective units - public DataFrame(UInt64 id, double time, double volume, double[] quantity) + public DataFrame(Int64 id, double time, double volume, double[] quantity) { ID = id; Time = time; diff --git a/DataStreamInterface/DataStreamInterface.csproj b/DataStreamInterface/DataStreamInterface.csproj index 49ae9f254..df67cc35b 100644 --- a/DataStreamInterface/DataStreamInterface.csproj +++ b/DataStreamInterface/DataStreamInterface.csproj @@ -9,7 +9,7 @@ Properties DataStreamInterface DataStreamInterface - v4.0 + v4.7.2 512 @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,9 +30,11 @@ TRACE prompt 4 + false + diff --git a/DataStreamInterface/Doc/Software interface for datastream water meters.docx b/DataStreamInterface/Doc/Software interface for datastream water meters.docx index 09770fbc1..2fdd60f86 100644 Binary files a/DataStreamInterface/Doc/Software interface for datastream water meters.docx and b/DataStreamInterface/Doc/Software interface for datastream water meters.docx differ diff --git a/DataStreamInterface/IDataStreamMeter.cs b/DataStreamInterface/IDataStreamMeter.cs index 6255b1b0a..e4868b009 100644 --- a/DataStreamInterface/IDataStreamMeter.cs +++ b/DataStreamInterface/IDataStreamMeter.cs @@ -2,58 +2,82 @@ /// Copyright (c) 2020 Sensus Slovensko a.s. /// using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; 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(out int state, out string parameter); + 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 state, string parameter); + 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(string connectionParameters, out string meterId); - - /// - /// Closes connection with the data stream meter - /// - /// true when successful - bool CloseConnection(); + 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(); + 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. /// - /// ID of the last date frame + /// Index of the meter in range 0 .. (GetMetersCount() - 1) + /// Number of stored date frames /// true when successful - bool StopMeasurement(out UInt64 lastFrameID); + 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 @@ -70,7 +94,7 @@ namespace DataStreamInterface Unit GetVolumeUnits(); ///----------------------------------------------- - /// Ooptional quantities: count, units, captions + /// Optional quantities: count, units, captions ///----------------------------------------------- /// @@ -83,13 +107,13 @@ namespace DataStreamInterface /// Returns units of the specified quantity /// /// Zero based quantity number 0 .. quantites count-1 - Unit GetQuantityUnits(int quanityNr); + Unit GetQuantityUnits(int quantityNr); /// /// Returns caption of the specified quantity /// /// Zero based quantity number 0 .. quantites count-1 - string GetQuantityCaption(int quanityNr); + string GetQuantityCaption(int quantityNr); ///--------------------------- /// Datastream data exchange @@ -98,17 +122,19 @@ namespace DataStreamInterface /// /// 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(UInt64 id, int count); + 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 - UInt64 GetID(double time); + Int64 GetID(int meterIx, double time); } }