Class S7Connector
Inheritance
Namespace: TeleScope.Connectors.Plc.Siemens
Assembly: TeleScope.Connectors.Plc.Siemens.dll
Syntax
public class S7Connector : object, IPlcConnectable, IConnectable
Constructors
| Improve this Doc View SourceS7Connector(S7Setup)
The default empty constructor instanciates the internal S7 client.
Declaration
public S7Connector(S7Setup s7Setup)
Parameters
Type | Name | Description |
---|---|---|
S7Setup | s7Setup |
Properties
| Improve this Doc View SourceIsConnected
Gets the information if the client is instanciated and connected or not.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Result
Gets the last received result as a string representation from the connected PLC. Attention: Async or concurrent calls may override the value.
Declaration
public string Result { get; }
Property Value
Type | Description |
---|---|
System.String |
ResultCode
Gets the last received result code from the connected PLC. Attention: Async or concurrent calls may override the value.
Declaration
public int ResultCode { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceConnect()
Opens the connection to the PLC.
Declaration
public IConnectable Connect()
Returns
Type | Description |
---|---|
IConnectable | The calling instance. |
Disconnect()
Closes the connection from the PLC.
Declaration
public IConnectable Disconnect()
Returns
Type | Description |
---|---|
IConnectable | The calling instance. |
Read<T>()
A generic read method that covers most common types.
Declaration
public T Read<T>()
Returns
Type | Description |
---|---|
T | The result value of type T. |
Type Parameters
Name | Description |
---|---|
T | The return type of the method. |
Select(Object)
Stores the select parameters in the internal structure Sharp7Parameter and validates the input. Supported types are S7Selector, strings with proper structure and integer arrays, representing the datablock [0], the bit offset [1] and count [2] for bit offsets or character counts.
Declaration
public IPlcConnectable Select(object parameter)
Parameters
Type | Name | Description |
---|---|---|
System.Object | parameter | The generic object may contain the select parameters in different forms. |
Returns
Type | Description |
---|---|
IPlcConnectable | The calling instance. |
Select(Object[])
Stores the select parameters in the internal structure Sharp7Parameter and validates the array beforehand. The parameter array must contain three integers repesenting the datablock [0], the bit offset [1] and the count [2] for bit offsets or character counts.
Declaration
public IPlcConnectable Select(object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | parameters | The array of S7 parameters to select and read lateron the data. |
Returns
Type | Description |
---|---|
IPlcConnectable | The calling instance. |
Select(S7Selector)
Stores the select parameters to read or write to the PLC lateron.
Declaration
public IPlcConnectable Select(S7Selector parameter)
Parameters
Type | Name | Description |
---|---|---|
S7Selector | parameter | The S7 specific parameters. |
Returns
Type | Description |
---|---|
IPlcConnectable | The calling instance. |
Write<T>(T)
Declaration
public void Write<T>(T data)
Parameters
Type | Name | Description |
---|---|---|
T | data |
Type Parameters
Name | Description |
---|---|
T |
Events
| Improve this Doc View SourceCompleted
Declaration
public event ConnectorCompletedEventHandler Completed
Event Type
Type | Description |
---|---|
ConnectorCompletedEventHandler |
Connected
Declaration
public event ConnectorEventHandler Connected
Event Type
Type | Description |
---|---|
ConnectorEventHandler |
Disconnected
Declaration
public event ConnectorEventHandler Disconnected
Event Type
Type | Description |
---|---|
ConnectorEventHandler |
Failed
Declaration
public event ConnectorFailedEventHandler Failed
Event Type
Type | Description |
---|---|
ConnectorFailedEventHandler |