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