99 lines
3.4 KiB
C#
99 lines
3.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace GenesisCordonelInterface.API
|
|
{
|
|
/// <summary>
|
|
/// Outside-facing facade for Genesis Cordonel Interface.
|
|
/// Exposes only selected operations intended for external callers.
|
|
/// </summary>
|
|
public class InterfaceOutsideToGCI
|
|
{
|
|
private readonly InterfaceGCIToLaatzen _innerMeterAPI;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="InterfaceOutsideToGCI"/> class.
|
|
/// </summary>
|
|
public InterfaceOutsideToGCI()
|
|
{
|
|
_innerMeterAPI = new InterfaceGCIToLaatzen();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets a value indicating whether the meter is currently connected and logged on.
|
|
/// </summary>
|
|
public bool IsConnected
|
|
{
|
|
get
|
|
{
|
|
return _innerMeterAPI.IsConnected;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Connects to the meter on the specified slot.
|
|
/// </summary>
|
|
/// <param name="slotNo">Slot number.</param>
|
|
/// <param name="usePasswordsSource">Specifies whether offline passwords should be used.</param>
|
|
/// <returns>Connect operation result.</returns>
|
|
public InterfaceGCIToLaatzen.ConnectResult Connect(int slotNo, int usePasswordSource, List<string> externPasswords)
|
|
{
|
|
return _innerMeterAPI.Connect(slotNo, usePasswordSource, externPasswords);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Disconnects from the currently connected meter.
|
|
/// </summary>
|
|
public void Disconnect()
|
|
{
|
|
_innerMeterAPI.Disconnect();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reads PCB ID from the specified slot.
|
|
/// </summary>
|
|
/// <param name="slot">Slot number.</param>
|
|
/// <returns>PCB ID string.</returns>
|
|
public string GetPcbId(int slot)
|
|
{
|
|
return _innerMeterAPI.GetPcbId(slot);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reads a register by name.
|
|
/// </summary>
|
|
/// <param name="registerName">Register name.</param>
|
|
/// <returns>Register read result.</returns>
|
|
public InterfaceGCIToLaatzen.RegisterReadResult ReadRegister(string registerName)
|
|
{
|
|
return _innerMeterAPI.ReadRegister(registerName);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Writes a value to a register.
|
|
/// </summary>
|
|
/// <param name="registerName">Register name.</param>
|
|
/// <param name="value">Value to write.</param>
|
|
/// <param name="storeToDevice">Specifies whether configuration should be stored after write.</param>
|
|
/// <param name="refreshSystemState">Specifies whether system state refresh should be triggered after write.</param>
|
|
/// <returns>Register write result.</returns>
|
|
public InterfaceGCIToLaatzen.RegisterWriteResult WriteRegister(
|
|
string registerName,
|
|
object value,
|
|
bool storeToDevice = false,
|
|
bool refreshSystemState = false)
|
|
{
|
|
return _innerMeterAPI.WriteRegister(registerName, value, storeToDevice, refreshSystemState);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets meter password.
|
|
/// </summary>
|
|
/// <param name="password">Password value.</param>
|
|
/// <returns>True if operation succeeded; otherwise false.</returns>
|
|
public bool SetMeterPassword(string password)
|
|
{
|
|
return _innerMeterAPI.SetMeterPassword(password);
|
|
}
|
|
}
|
|
} |