Class WebApiConnector
Provides connector to mediate connection with AX# twins over WebAPI connection. This connector facilitates communication with Siemens S7 PLCs using WebAPI. Supports priority-based access control and configurable batch operations.
Inherited Members
Namespace: AXSharp.Connector.S71500.WebApi
Assembly: AXSharp.Connector.S71500.WebAPI.dll
Syntax
public class WebApiConnector : Connector, ITwinObject, ITwinElement, INotifyPropertyChanged
Constructors
| Edit this page View SourceWebApiConnector(string, string, string, bool, eTargetProjectPlatform, string, int, int)
Creates a new instance of WebApiConnector.
Declaration
public WebApiConnector(string ipAddress, string userName, string password, bool ignoreSSLErros, eTargetProjectPlatform platform = eTargetProjectPlatform.SIMATICAX, string dbName = "\"TGlobalVariablesDB\"", int maxConcurrentRequest = 4, int concurrentRequestDelay = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| string | ipAddress | Target's IP address. |
| string | userName | User name for authentication. |
| string | password | Password for authentication. |
| bool | ignoreSSLErros | When set to true, SSL errors are ignored. |
| eTargetProjectPlatform | platform | Target project platform (default is SIMATICAX). |
| string | dbName | Root DB name (default is 'TGlobalVariablesDB'). |
| int | maxConcurrentRequest | Determines max concurrent R/W requests against the controller. |
| int | concurrentRequestDelay | Determines delay between concurrent requests. |
WebApiConnector(string, string, string, Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool>?, bool, eTargetProjectPlatform, string, int, int)
Creates a new instance of WebApiConnector.
Declaration
public WebApiConnector(string ipAddress, string userName, string password, Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool>? customServerCertHandler, bool ignoreSSLErros, eTargetProjectPlatform platform = eTargetProjectPlatform.SIMATICAX, string dbName = "\"TGlobalVariablesDB\"", int maxConcurrentRequest = 4, int concurrentRequestDelay = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| string | ipAddress | Target's IP address. |
| string | userName | User name for authentication. |
| string | password | Password for authentication. |
| Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool> | customServerCertHandler | Optional custom server certificate handler. |
| bool | ignoreSSLErros | When set to true, SSL errors are ignored. |
| eTargetProjectPlatform | platform | Target project platform (default is SIMATICAX). |
| string | dbName | Root DB name (default is 'TGlobalVariablesDB'). |
| int | maxConcurrentRequest | Determines max concurrent R/W requests against the controller. |
| int | concurrentRequestDelay | Determines delay between concurrent requests. |
Properties
| Edit this page View SourceNumberOfInstances
Gets number of instance of WebAPI connector in this application.
Declaration
public static int NumberOfInstances { get; }
Property Value
| Type | Description |
|---|---|
| int |
TargetPlatform
Declaration
public eTargetProjectPlatform TargetPlatform { get; }
Property Value
| Type | Description |
|---|---|
| eTargetProjectPlatform |
TargetPlatformMoniker
Gets the target platform moniker.
Declaration
public override string TargetPlatformMoniker { get; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
Methods
| Edit this page View SourceBuildAndStart()
Builds and starts this connector.
Declaration
public override Connector BuildAndStart()
Returns
| Type | Description |
|---|---|
| Connector |
Overrides
| Edit this page View SourceReLoginToConnectorApi()
Re-authenticates the connector API session. Suspends cyclic read/write operations during the re-login process.
Declaration
public Task ReLoginToConnectorApi()
Returns
| Type | Description |
|---|---|
| Task |
ReadBatchAsync(IEnumerable<ITwinPrimitive>, eAccessPriority, int, int)
Reads a batch of primitives asynchronously with the specified priority and batch settings.
Declaration
public override Task ReadBatchAsync(IEnumerable<ITwinPrimitive> primitives, eAccessPriority priority = eAccessPriority.Normal, int chunkSize = 250, int interChunkDelay = 250)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ITwinPrimitive> | primitives | Collection of primitives to read. |
| eAccessPriority | priority | Access priority level that determines batch processing parameters. |
| int | chunkSize | Override for the number of items to process in each chunk. If not specified, uses the priority's default. |
| int | interChunkDelay | Override for the delay between chunks in milliseconds. If not specified, uses the priority's default. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous read operation. |
Overrides
| Edit this page View SourceReloadConnector()
Forces the connector to reload symbols.
Declaration
public override void ReloadConnector()
Overrides
| Edit this page View SourceWriteBatchAsync(IEnumerable<ITwinPrimitive>, eAccessPriority, int, int)
Writes a batch of primitives asynchronously with the specified priority and batch settings.
Declaration
public override Task WriteBatchAsync(IEnumerable<ITwinPrimitive> primitives, eAccessPriority priority = eAccessPriority.Normal, int chunkSize = 250, int interChunkDelay = 250)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ITwinPrimitive> | primitives | Collection of primitives to write. |
| eAccessPriority | priority | Access priority level that determines batch processing parameters. |
| int | chunkSize | Override for the number of items to process in each chunk. If not specified, uses the priority's default. |
| int | interChunkDelay | Override for the delay between chunks in milliseconds. If not specified, uses the priority's default. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous write operation. |