115 lines
4.1 KiB
C#
115 lines
4.1 KiB
C#
|
|
///
|
|||
|
|
/// 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>
|
|||
|
|
/// Get state of the connected data stream meter
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="state">Current state of the meter</param>
|
|||
|
|
/// <returns>true when successful</returns>
|
|||
|
|
bool GetState(out int state, out string parameter);
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Set state of the connected data stream meter
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="state">Required state of the meter</param>
|
|||
|
|
/// <returns>true when successful</returns>
|
|||
|
|
bool SetState(int state, string parameter);
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Establish connection with a data stream meter
|
|||
|
|
/// </summary>
|
|||
|
|
/// <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();
|
|||
|
|
|
|||
|
|
/// <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>
|
|||
|
|
/// <returns>true when successful</returns>
|
|||
|
|
bool StartMeasurement();
|
|||
|
|
|
|||
|
|
/// <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>
|
|||
|
|
/// <returns>true when successful</returns>
|
|||
|
|
bool StopMeasurement(out UInt64 lastFrameID);
|
|||
|
|
|
|||
|
|
///------------------------------------------------
|
|||
|
|
/// Units of time, volume and optional quantities
|
|||
|
|
///------------------------------------------------
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Returns time units (s, ms, ...)
|
|||
|
|
/// </summary>
|
|||
|
|
Unit GetTimeUnits();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Returns units of volume (ml, l, ...)
|
|||
|
|
/// </summary>
|
|||
|
|
Unit GetVolumeUnits();
|
|||
|
|
|
|||
|
|
///-----------------------------------------------
|
|||
|
|
/// Ooptional quantities: count, units, captions
|
|||
|
|
///-----------------------------------------------
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Returns count of optional quantities in each data frame
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns>Count of optional quantities</returns>
|
|||
|
|
int GetQuantitiesCount();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Returns units of the specified quantity
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="quanityNr">Zero based quantity number 0 .. quantites count-1</param>
|
|||
|
|
Unit GetQuantityUnits(int quanityNr);
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Returns caption of the specified quantity
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="quanityNr">Zero based quantity number 0 .. quantites count-1</param>
|
|||
|
|
string GetQuantityCaption(int quanityNr);
|
|||
|
|
|
|||
|
|
///---------------------------
|
|||
|
|
/// Datastream data exchange
|
|||
|
|
///---------------------------
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Retuns 'count' data frames starting with data frame with ID = 'id'
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="id">First frame ID</param>
|
|||
|
|
/// <param name="count">Frames count</param>
|
|||
|
|
/// <returns>Selected data frames</returns>
|
|||
|
|
DataFrame[] GetFrames(UInt64 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="time">Time</param>
|
|||
|
|
/// <returns>ID of the data frame at or after the pecified time</returns>
|
|||
|
|
UInt64 GetID(double time);
|
|||
|
|
}
|
|||
|
|
}
|