LibS7Adv/IPlcConnection.cs

41 lines
1.3 KiB
C#

using System;
namespace LibS7Adv
{
public interface IPlcConnection
{
bool IsConnected { get; }
string Status { get; }
string LastError { get; }
ConnectionType ConnectionType { get; }
// Connection methods
bool Connect(string ipAddress, string instanceName);
void Disconnect();
// Bool operations
bool? ReadBool(string address);
bool WriteBool(string address, bool value);
bool ReadOutputBool(byte pByte, int pBit);
void WriteInputBool(byte pByte, int pBit, bool value);
// Number operations
string ReadNumber(string address, bool signed = false);
bool WriteNumber(string address, object value);
// Tag operations (solo para AdvCoSimulator, retorna null para Snap7)
object? ReadTag(string tagName);
bool WriteTag(string tagName, object value);
bool? ReadTagBool(string tagName);
bool WriteTagBool(string tagName, bool value);
int? ReadTagInt16(string tagName);
bool WriteTagInt16(string tagName, int value);
int? ReadTagDInt(string tagName);
bool WriteTagDInt(string tagName, int value);
// Area access methods
byte[]? ReadBytes(EArea area, uint offset, int length);
bool WriteBytes(EArea area, uint offset, byte[] data);
}
}