DataStreamInterface project synchronized with 2.26 branch.

This commit is contained in:
Milan Hanajik 2021-07-02 15:26:22 +02:00
parent 2a2eae0c6a
commit 6309796af5
4 changed files with 53 additions and 24 deletions

View File

@ -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;

View File

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataStreamInterface</RootNamespace>
<AssemblyName>DataStreamInterface</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -29,9 +30,11 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />

View File

@ -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
{
/// <summary>
/// Returns count of water meters supported by the data stream component
/// </summary>
/// <returns>Water meters count</returns>
int GetMetersCount();
/// <summary>
/// Get state of the connected data stream meter
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="state">Current state of the meter</param>
/// <param name="parameter">Current extra parameter of the meter</param>
/// <returns>true when successful</returns>
bool GetState(out int state, out string parameter);
bool GetState(int meterIx, out int state, out string parameter);
/// <summary>
/// Set state of the connected data stream meter
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="state">Required state of the meter</param>
/// <param name="parameter">Required extra parameter of the meter</param>
/// <returns>true when successful</returns>
bool SetState(int state, string parameter);
bool SetState(int meterIx, int state, string parameter);
bool SetStateAll(int state, string parameter);
/// <summary>
/// Establish connection with a data stream meter
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="connectionParameters">Connection parameters</param>
/// <param name="meterId">Meter ID (e.g. serial number)</param>
/// <returns>true when successful</returns>
bool OpenConnection(string connectionParameters, out string meterId);
/// <summary>
/// Closes connection with the data stream meter
/// </summary>
/// <returns>true when successful</returns>
bool CloseConnection();
bool OpenConnection(int meterIx, string connectionParameters, out string meterId);
/// <summary>
/// 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.
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <returns>true when successful</returns>
bool StartMeasurement();
bool StartMeasurement(int meterIx);
bool StartMeasurementAll();
/// <summary>
/// Stops saving measurement results into internal data structures of the component.
/// Updates ID of the last date frame received from the meter.
/// </summary>
/// <param name="lastFrameID">ID of the last date frame</param>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="storedFramesCount">Number of stored date frames</param>
/// <returns>true when successful</returns>
bool StopMeasurement(out UInt64 lastFrameID);
bool StopMeasurement(int meterIx, out Int64 storedFramesCount);
bool StopMeasurementAll(out Int64[] storedFramesCounts);
/// <summary>
/// Closes connection with the data stream meter
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <returns>true when successful</returns>
bool CloseConnection(int meterIx);
bool CloseConnectionAll();
/// <summary>
/// This function is called when TBF program is shutting down.
/// </summary>
/// <returns>true when successful</returns>
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
///-----------------------------------------------
/// <summary>
@ -83,13 +107,13 @@ namespace DataStreamInterface
/// Returns units of the specified quantity
/// </summary>
/// <param name="quanityNr">Zero based quantity number 0 .. quantites count-1</param>
Unit GetQuantityUnits(int quanityNr);
Unit GetQuantityUnits(int quantityNr);
/// <summary>
/// Returns caption of the specified quantity
/// </summary>
/// <param name="quanityNr">Zero based quantity number 0 .. quantites count-1</param>
string GetQuantityCaption(int quanityNr);
string GetQuantityCaption(int quantityNr);
///---------------------------
/// Datastream data exchange
@ -98,17 +122,19 @@ namespace DataStreamInterface
/// <summary>
/// Retuns 'count' data frames starting with data frame with ID = 'id'
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="id">First frame ID</param>
/// <param name="count">Frames count</param>
/// <returns>Selected data frames</returns>
DataFrame[] GetFrames(UInt64 id, int count);
DataFrame[] GetFrames(int meterIx, Int64 id, int count);
/// <summary>
/// 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.
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="time">Time</param>
/// <returns>ID of the data frame at or after the pecified time</returns>
UInt64 GetID(double time);
Int64 GetID(int meterIx, double time);
}
}