Class Connector
Abstract base class provides implementation contract for the PLC connector and basic common underlying logic.
Inherited Members
Namespace: AXSharp.Connector
Assembly: AXSharp.Connector.dll
Syntax
public abstract class Connector : RootTwinObject, ITwinObject, ITwinElement, INotifyPropertyChanged
Constructors
| Edit this page View SourceConnector()
Creates new instance of Connector class
Declaration
protected Connector()
Connector(object[])
Creates an instance of Connector class
Declaration
protected Connector(object[] parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| object[] | parameters | Connection parameters |
Examples
var connector = new IConnector();
Properties
| Edit this page View SourceConcurrentRequestDelay
Gets or sets delay between Concurrent Requests. It is applied when ConcurrentRequestMaxCount is reached.
Declaration
public int ConcurrentRequestDelay { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
ConcurrentRequestMaxCount
Gets or sets maximal count of Concurrent Request.
Maximum number of simultaneous requests is 4.
Note
The property will be capped to this value if higher value is assigned.
Important
When setting this value take into account that other devices may communicate with your target system.
Declaration
public int ConcurrentRequestMaxCount { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
ConnectorAdapter
Gets adapter for onliners.
Declaration
public ConnectorAdapter ConnectorAdapter { get; }
Property Value
| Type | Description |
|---|---|
| ConnectorAdapter |
CyclicRwDuration
Gets the last duration of Read/Write cycle in milliseconds.
Declaration
public long CyclicRwDuration { get; }
Property Value
| Type | Description |
|---|---|
| long |
ErrorCount
Gets or sets error counter of the adapter.
Declaration
public int ErrorCount { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
ExceptionBehaviour
Gets or sets how the connector should handle communication exceptions.
Declaration
public CommExceptionBehaviour ExceptionBehaviour { get; set; }
Property Value
| Type | Description |
|---|---|
| CommExceptionBehaviour |
IdentityProvider
Gets object identity provider.
Declaration
public TwinIdentityProvider IdentityProvider { get; }
Property Value
| Type | Description |
|---|---|
| TwinIdentityProvider |
IsRwLoopSuspended
Gets or set whether RW loop is suspended.
Declaration
public bool IsRwLoopSuspended { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Logger
Provides logging capability for this connector.
Declaration
public ILogger Logger { get; }
Property Value
| Type | Description |
|---|---|
| ILogger |
MonitorConnector
Gets or sets value indicating whether the performance of the monitor should be active.
Declaration
public bool MonitorConnector { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
OnlineTags
Gets online value items tags attached to this connector.
Declaration
public IEnumerable<ITwinPrimitive> OnlineTags { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<ITwinPrimitive> |
ReadWriteCycleDelay
Gets or sets delay between Read/Write cycles.
Declaration
public int ReadWriteCycleDelay { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
RwCycleCount
Gets the number of Read Write cycles from the start of the connector.
Declaration
public long RwCycleCount { get; protected set; }
Property Value
| Type | Description |
|---|---|
| long |
StartUpTime
Get the connector's startup timestamp.
Declaration
public DateTime StartUpTime { get; protected set; }
Property Value
| Type | Description |
|---|---|
| DateTime |
SubscriptionMode
Gets or sets subscription mode for reading data from the controller.
Declaration
public ReadSubscriptionMode SubscriptionMode { get; set; }
Property Value
| Type | Description |
|---|---|
| ReadSubscriptionMode |
Methods
| Edit this page View SourceBuildAndStart()
Builds and starts this connector.
Declaration
public abstract Connector BuildAndStart()
Returns
| Type | Description |
|---|---|
| Connector |
ClearPeriodicReadSet()
Declaration
protected void ClearPeriodicReadSet()
CreateHumanReadable(string, string)
Return humanized path combining parent's and member's names.
Declaration
public static string CreateHumanReadable(string parent, string member)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parent | Parent's name. |
| string | member | Members name. |
Returns
| Type | Description |
|---|---|
| string | Combine symbol of parent and member. |
CreateSymbol(string, string)
Return symbol path combining parent's and member's symbol.
Declaration
public static string CreateSymbol(string parent, string member)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parent | Parent's path. |
| string | member | Members name. |
Returns
| Type | Description |
|---|---|
| string | Combine symbol of parent and member. |
CyclicRead()
Reads online variables required to be read.
Declaration
protected Task CyclicRead()
Returns
| Type | Description |
|---|---|
| Task |
CyclicWrite()
Writes modified online variables.
Declaration
protected Task CyclicWrite()
Returns
| Type | Description |
|---|---|
| Task |
ReadBatchAsync(IEnumerable<ITwinPrimitive>)
Reads batch of value items from the plc.
Declaration
public abstract Task ReadBatchAsync(IEnumerable<ITwinPrimitive> primitives)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ITwinPrimitive> | primitives | Primitive items to be read. |
Returns
| Type | Description |
|---|---|
| Task |
ReloadConnector()
Forces the connector to reload symbols.
Declaration
public abstract void ReloadConnector()
SetCulture(CultureInfo)
Sets the culture for this connector.
Declaration
public static void SetCulture(CultureInfo culture)
Parameters
| Type | Name | Description |
|---|---|---|
| CultureInfo | culture | Desired culture |
SetField<T>(ref T, T, string)
Sets properties backing field value and notifies over INotifyPropertyChanged interface.
Declaration
protected bool SetField<T>(ref T field, T value, string propertyName)
Parameters
| Type | Name | Description |
|---|---|---|
| T | field | Field. |
| T | value | Value to be set. |
| string | propertyName | Property name. |
Returns
| Type | Description |
|---|---|
| bool |
Type Parameters
| Name | Description |
|---|---|
| T | Type of backing field. |
SetLoggerConfiguration(ILogger)
Sets logger for this connector.
![NOTE] The default logger is implemented. Default implementation will log into console and in simple text file.
Declaration
public void SetLoggerConfiguration(ILogger logger)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger | logger | Logger |
StartReadWriteOps()
Starts cyclical read write operation on this connector.
Declaration
protected void StartReadWriteOps()
WriteBatchAsync(IEnumerable<ITwinPrimitive>)
Writes batch of value items to the plc.
Declaration
public abstract Task WriteBatchAsync(IEnumerable<ITwinPrimitive> primitives)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ITwinPrimitive> | primitives | Primitive items to be written. |
Returns
| Type | Description |
|---|---|
| Task |
Events
| Edit this page View SourcePropertyChanged
Implementation of INotifyPropertyChanged
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
| Type | Description |
|---|---|
| PropertyChangedEventHandler |