Merge branch 'release/BeckHoffAdapter'
This commit is contained in:
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,131 @@
|
||||
TwinCAT ADS Reactive Extensions (ADS.Rx)
|
||||
========================================
|
||||
Extends the TwinCAT.Ads.TcAdsClient with Reactive Interfaces for ADS Notifications to support observable Streams of value changes.
|
||||
|
||||
## Prerequisites
|
||||
- a TwinCAT 2 or 3 Installation (XAR-Runtime or Full)
|
||||
- .NET Framework 4.6
|
||||
|
||||
## Features
|
||||
- Observable Streams of ADS Notifications (type safe or raw)
|
||||
- Observable Streams of ADS State changes
|
||||
- ... to be continued
|
||||
|
||||
## First Steps
|
||||
|
||||
```cs
|
||||
using TwinCAT.Ads;
|
||||
using TwinCAT.Ads.Reactive;
|
||||
|
||||
class ReactiveTest
|
||||
{
|
||||
public void Communicate()
|
||||
{
|
||||
// To Test the Observer run a project on the local PLC System (Port 851)
|
||||
using (TcAdsClient client = new TcAdsClient())
|
||||
{
|
||||
// Connect to target
|
||||
client.Connect(new AmsAddress(AmsNetId.Local, 851));
|
||||
|
||||
// Usage of ANY_TYPES in reactive stream (here the 'ushort' type) without usage of the 'SymbolLoader'
|
||||
var valueObserver = Observer.Create<ushort>(val =>
|
||||
{
|
||||
Console.WriteLine(string.Format("Value: {0}", val.ToString()));
|
||||
}
|
||||
);
|
||||
|
||||
// Turning ADS Notifications into sequences of Value Objects
|
||||
// and subscribe to them.
|
||||
IDisposable subscription = client.WhenNotification<ushort>(
|
||||
"TwinCAT_SystemInfoVarList._TaskInfo.CycleCount",
|
||||
NotificationSettings.Default
|
||||
)
|
||||
.Subscribe(valueObserver);
|
||||
|
||||
...
|
||||
subscription.Dispose(); // Dispose the Subscription
|
||||
|
||||
|
||||
// Polling of values to prevent the usage of Notifications
|
||||
// Create Symbol information
|
||||
var symbolLoader = SymbolLoaderFactory.Create(client, SymbolLoaderSettings.Default);
|
||||
IValueSymbol cycleCount = (IValueSymbol)symbolLoader
|
||||
.Symbols["TwinCAT_SystemInfoVarList._TaskInfo.CycleCount"];
|
||||
|
||||
// Reactive Notification Handler
|
||||
var valueObserver = Observer.Create<object>(val =>
|
||||
{
|
||||
Console.WriteLine(
|
||||
string.Format("Instance: {0}, Value: {1}", cycleCount.InstancePath, val.ToString())
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// Take Values in an Interval of 500ms triggered by an application timer (no notifications)
|
||||
IDisposable subscription = cycleCount
|
||||
.PollValues(TimeSpan.FromMilliseconds(500))
|
||||
.Subscribe(valueObserver);
|
||||
|
||||
...
|
||||
subscription.Dispose(); // Dispose the subscription
|
||||
|
||||
|
||||
// Create Symbol information
|
||||
var symbolLoader = SymbolLoaderFactory.Create(client, SymbolLoaderSettings.DefaultDynamic);
|
||||
|
||||
int eventCount = 1;
|
||||
|
||||
// Reactive Notification Handler
|
||||
var valueObserver = Observer.Create<TwinCAT.Ads.Reactive.SymbolNotification>(not =>
|
||||
{
|
||||
Console.WriteLine(
|
||||
string.Format("{0} {1:u} {2} = '{3}' ({4})",
|
||||
eventCount++,
|
||||
not.TimeStamp,
|
||||
not.Symbol.InstancePath,
|
||||
not.Value,
|
||||
not.Symbol.DataType)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// Collect the symbols that are registered as Notification sources for their changed values.
|
||||
|
||||
SymbolCollection notificationSymbols = new SymbolCollection();
|
||||
IArrayInstance taskInfo = (IArrayInstance)symbolLoader
|
||||
.Symbols["TwinCAT_SystemInfoVarList._TaskInfo"];
|
||||
|
||||
foreach(ISymbol element in taskInfo.Elements)
|
||||
{
|
||||
ISymbol cycleCount = element.SubSymbols["CycleCount"];
|
||||
ISymbol lastExecTime = element.SubSymbols["LastExecTime"];
|
||||
|
||||
notificationSymbols.Add(cycleCount);
|
||||
notificationSymbols.Add(lastExecTime);
|
||||
}
|
||||
|
||||
// Create a subscription for the first 200 Notifications on Symbol Value changes.
|
||||
IDisposable subscription = client.WhenNotification(notificationSymbols)
|
||||
.Take(200)
|
||||
.Subscribe(valueObserver);
|
||||
|
||||
...
|
||||
subscription.Dispose(); // Dispose the Subscription
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Documentation and further learning
|
||||
|
||||
[Extension classes in the TwinCAT.Ads.Reactive namespace](https://infosys.beckhoff.com/content/1033/tcadsnetref/7313610891.html?id=3925137517396292438)
|
||||
|
||||
[TcAdsClient class description with Samples](https://infosys.beckhoff.com/content/1033/tc3_adsnetref/7313399947.html?id=2143854398042839406)
|
||||
|
||||
[Documentation ADS .NET API](https://infosys.beckhoff.com/content/1033/tc3_adsnetref/7312567947.html?id=1468782086487140895)
|
||||
|
||||
[API Reference](https://infosys.beckhoff.com/content/1033/tc3_adsnetref/7312592011.html?id=7587521548766668780)
|
||||
|
||||
|
||||
## Links
|
||||
[Beckhoff Homepage](https://www.beckhoff.com)
|
||||
@@ -0,0 +1,41 @@
|
||||
The TwinCAT ADS API is a .NET Assembly enabling to develop own .NET applications (e.g. visualization, scientific automation) for communication with TwinCAT devices (e.g. PLC, NC or IO-devices).
|
||||
|
||||
## Prerequisites
|
||||
- a TwinCAT 2 or 3 Installation (XAR-Runtime or Full)
|
||||
- .NET Framework 4.0
|
||||
|
||||
## Features
|
||||
- the implementation of ADS Clients
|
||||
- the browsing of (ADS) server side symbolic information
|
||||
- Symbolic Read/Write from/to ADS Servers (Process Images)
|
||||
- Value Change Events (ADS Notifications)
|
||||
- Support of Raw ProcessImageData, AnyType concept or full dynamic typed (type safe) symbols
|
||||
|
||||
## First Steps
|
||||
```c#
|
||||
using TwinCAT.Ads;
|
||||
|
||||
public class AdsTest
|
||||
{
|
||||
public void Communicate()
|
||||
{
|
||||
using (TcAdsClient client = new TcAdsClient())
|
||||
{
|
||||
// Connect to Local System AdsPort 851 (First PLC)
|
||||
client.Connect(AmsNetId.Local,851);
|
||||
|
||||
client.Read ...
|
||||
client.Write ...
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Documentation and further learning
|
||||
[TcAdsClient class description with Samples](https://infosys.beckhoff.com/content/1033/tc3_adsnetref/7313399947.html?id=2143854398042839406)
|
||||
[Documentation ADS .NET API](https://infosys.beckhoff.com/content/1033/tc3_adsnetref/7312567947.html?id=1468782086487140895)
|
||||
[API Reference](https://infosys.beckhoff.com/content/1033/tc3_adsnetref/7312592011.html?id=7587521548766668780)
|
||||
|
||||
|
||||
## Links
|
||||
[Beckhoff Homepage](https://www.beckhoff.com)
|
||||
@@ -0,0 +1,105 @@
|
||||
4.4.7
|
||||
=====
|
||||
Enh: Optimization of ReadValue() methods internally using ValueByName instead of ValueByHandle reducing roundtrips.
|
||||
Enh: Using Project Encoding for TcAdsClient.ReadSymbol and TcAdsClient.WriteSymbol
|
||||
Enh: Adding TcAdsClient.ReadSymbolByName method.
|
||||
Enh: Ignoring DataType with wrong PointerSize preventing ArgumentOutOfRangeException in AdsParseSymbols.SetPlatformPointerSize
|
||||
Bug: Race condition accessing data via Symbol.ReadValue / Symbol.WriteValue (KeyAlreadyInListException)
|
||||
Bug: Fixing NullReferenceException on accessing ManagedType property on PVOID DataType
|
||||
|
||||
4.4.6
|
||||
=====
|
||||
Enh: Extended Handling for AmsNetIds (SubNets), AmsNetId.IsSameTarget and AmsNetId.NetIdsEqual extended.
|
||||
|
||||
4.4.5
|
||||
=====
|
||||
Fix: DefaultNotificationSettings on SymbolLoader are not derived to the NotificationSettings of the Symbol
|
||||
Fix: ArgumentOutOfRangeException when calling RpcMethods without Return parameter
|
||||
Fix: InvalidCastException on Writing Values on type 'T_MaxString'
|
||||
|
||||
4.4.4
|
||||
=====
|
||||
Fix: NullReferenceException on DynamicTree SymbolLoader if PVOID DataTypes are used in the symbols.
|
||||
|
||||
4.4.3
|
||||
=====
|
||||
Fix: InvokeRpcMethod checks for In and Out parameters corrected.
|
||||
Fix: TwinCAT.AdsSymbolLoaderSettings.Default corrected to 'Symbolic' Value Access.
|
||||
|
||||
4.4.2
|
||||
=====
|
||||
Enh: Refactoring InvokeRpcMethod (Support of out-parameters)
|
||||
Enh: Support of platform specific data types 'UXINT, XINT, XWORD'.
|
||||
Enh: Support of Recreating cached symbol handles on SymbolVersionChanged event when using TcAdsClients ReadSymbol, WriteSymbol methods and AddDeviceNotifications with SymbolPath.
|
||||
|
||||
4.4.1
|
||||
=======
|
||||
Fix: ArgumentOutOfRangeException with SByte types in PrimitiveTypeConverter.TryConvert
|
||||
Fix: Internal Exceptions when registering Notifications via AddRegisterDeviceNotification with UserData something different than ISymbol
|
||||
|
||||
4.4.0
|
||||
=====
|
||||
Enh: Upgrading the Beckhoff.TwinCAT.Ads Nuget Package to a new Minor AssemblyVersion number 4.4.0.0 to prevent Nuget package to clash with Software packages
|
||||
installing this DLL into the Global Assembly Cache (GAC) (reenabling Nuget Package Semantic versioning)
|
||||
|
||||
4.3.12.0
|
||||
========
|
||||
Fix: Fixing AdsErrorException.GetObjectData enabling Serialization of AdsErrorException derived types.
|
||||
|
||||
4.3.11.0
|
||||
========
|
||||
Fix: Corrections of text messages in 'Obsolete-warnings' where IndexGroup/IndexOffset is not used with the uint overload
|
||||
Fix: Gap year correction (year 2400) for PlcOpen DataTypes DT and DATE.
|
||||
Fix: Wrong implementation of the IsPersistant Datatype Flag (AdsDataTypeFlags.Persistent)
|
||||
Fix: SubSymbol resolution of PVOID and POINTER TO VOID types.
|
||||
Enh: Pointer support for InvokeRpcMethod in parameters.
|
||||
|
||||
4.3.10.0
|
||||
========
|
||||
Fix: AdsErrorCode TcAdsClient.TryReadWrite(uint,uint,AdsStream,int,int,AdsStream,int,int,out int) wrong parameter check.
|
||||
Fix: Some minor issues with creation of DynamicValues.
|
||||
|
||||
4.3.8.0
|
||||
=======
|
||||
Fix: TcAdsSymbolInfoCollection.GetSymbol now finds also Symbols that are not Main (Root) Symbols.
|
||||
Fix: Fixing issue with ReadSymbol/WriteSymbol using Structs and using this Struct type beforehand with reflection (.NET Type.GetFields caching issue)
|
||||
Enh: Support for jagged ANYSIZE Arrays.
|
||||
|
||||
4.3.7.0
|
||||
=======
|
||||
Enh: Adding ITcAdsRpcInvoke to IAdsConnection interface to support ITcAdsRpcInvoke overloads on AdsConnection object
|
||||
Fix: NullReferenceException in SymbolIterator (Symbol Browsing)
|
||||
Fix: Fixing some issues Dereferencing Pointers via Instance Names and Instance Paths.
|
||||
Fix: TcAdsClient.WriteAnyString(uint handle, string value, int chars, Encoding encoding) now supports also Unicode as encoding.
|
||||
|
||||
4.3.6.0
|
||||
=======
|
||||
Fix: NullReferencesExceptions and missing Symbols on Browsing TwinCAT 4018 Targets.
|
||||
|
||||
4.3.5.0
|
||||
=======
|
||||
Enh: Adding Connection Property on Symbols with Value Access (IValueSymbol2.Connection)
|
||||
Enh: Enhanced support for Pointer symbols in TcAdsClient.ReadSymbol / TcAdsClient.WriteSymbol
|
||||
Fix: IValueSymbol.ValueChanged deregistration could leak exceptions in older versions. Now exceptions will be handled internally.
|
||||
|
||||
4.3.4.0
|
||||
=======
|
||||
Enh: Support of ISubRangeType types that base on other base types than Int32.
|
||||
|
||||
4.3.3.0
|
||||
=======
|
||||
Enh: Support of runtime sized Array Instances (AnySizeArrayInstance)
|
||||
Enh: Adding SubSymbolCount property on TwinCAT.Ads.TypeSystem.Symbol
|
||||
|
||||
4.3.2.0
|
||||
=======
|
||||
Enh: Support of byte[] type for PrimitiveTypeConverter class
|
||||
|
||||
4.3.1.0
|
||||
=======
|
||||
Fix: NullReferenceException in SymbolLoaderV2 in .NET 2 Environment
|
||||
Enh: Version numbering of CLR2 aligned to CLR4
|
||||
|
||||
4.3.0.0
|
||||
=======
|
||||
First version of the 4.3.X.X series of the Beckhoff.TwinCAT.Ads package
|
||||
@@ -0,0 +1,29 @@
|
||||
4.4.7
|
||||
=====
|
||||
Bug: Nuget Package Dependencies are referencing System.Reactive Version 4.1. Changed to 4.4.1
|
||||
|
||||
4.4.2
|
||||
=====
|
||||
Enh: Reactive extension methods WhenNotification, WhenNotificationEx, WhenAdsStateChanges, PollAdsState, PollValues, WriteValues now detect the SymbolVersionChanged event and recreate internally stored
|
||||
handles. This enables the Observables to survive an upload of PlcPrograms (with still existing symbols.)
|
||||
Enh: Added WhenSymbolVersionChanges Observable.
|
||||
|
||||
4.4.0
|
||||
=====
|
||||
Enh: Referencing TwinCAT.Ads.dll AssemblyVersion 4.4.0.0 to prevent GAC usage in TwinCAT installations and restore Nuget Semantic Package Versioning.
|
||||
|
||||
4.3.10.0
|
||||
========
|
||||
Enh: Updated System.Reactive package from 4.1.0 to 4.1.6
|
||||
|
||||
4.3.7.0
|
||||
=======
|
||||
Enh: Some minor improvements.
|
||||
|
||||
4.3.1.0
|
||||
=======
|
||||
Enh: AdsClientExtensions.PollAdsState added
|
||||
|
||||
4.3.0.0
|
||||
=======
|
||||
First version of the 4.3.X.X series of the Beckhoff.TwinCAT.Ads.Reactive package
|
||||
Binary file not shown.
@@ -0,0 +1,786 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>TwinCAT.Ads.Reactive</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:TwinCAT.Ads.Reactive.AdsClientExtensions">
|
||||
<summary>
|
||||
Extension class for <see cref="T:TwinCAT.Ads.TcAdsClient"/> respective <see cref="T:TwinCAT.Ads.IAdsConnection"/> to provide reactive ADS extensions.
|
||||
</summary>
|
||||
<remarks>
|
||||
Reactive Extensions (Rx) are a library for composing asynchronous and event-based programs using observable sequences and LINQ-style
|
||||
query operators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using LINQ
|
||||
operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, Rx = Observables + LINQ + Schedulers.
|
||||
The ADS reactive extensions are build on top of this library to enable ADS Symbol and State Observables, seamlessly bound to the reactive
|
||||
extensions. To use the ADS reactive extensions the TwinCAT.Ads.Reactive Nuget package (or the included TwinCAT.Ads.Reactive.dll) must be referenced.
|
||||
(<a href="https://www.nuget.org/packages/Beckhoff.TwinCAT.Ads.Reactive/">Beckhoff.TwinCAT.Ads.Reactive package on Nuget</a>).
|
||||
</remarks>
|
||||
<example>
|
||||
The following sample shows how observe Value changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.AdsClientExtensions"/>
|
||||
<code language="C#" title="Observe changing ADS Symbols with reactive extensions." source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_SYMBOLS" />
|
||||
</example>
|
||||
<example>
|
||||
The following sample shows how observe <see cref="T:TwinCAT.Ads.AdsState"/> changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.AdsClientExtensions"/>
|
||||
<code language="C#" title="Observe changing ADS states with reactive extensions." source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_STATECHANGE" />
|
||||
</example>
|
||||
<seealso cref="T:TwinCAT.Ads.Reactive.AnyTypeExtensions"/>
|
||||
<seealso cref="T:TwinCAT.Ads.Reactive.ValueSymbolExtensions"/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotificationEx(TwinCAT.Ads.IAdsNotifications)">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.AdsNotificationExEventArgs"/>.
|
||||
</summary>
|
||||
<param name="connection">The client.</param>
|
||||
<returns>IObservable<AdsNotificationExEventArgs>.</returns>
|
||||
<exclude/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotification(TwinCAT.Ads.IAdsNotifications)">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.Reactive.Notification"/>s.
|
||||
</summary>
|
||||
<param name="connection">The client.</param>
|
||||
<returns>IObservable<NotificationValue>.</returns>
|
||||
<exclude/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotification(TwinCAT.Ads.IAdsNotifications,System.UInt32[])">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.Reactive.Notification"/>s.
|
||||
</summary>
|
||||
<param name="connection">The client.</param>
|
||||
<param name="handles">The handles.</param>
|
||||
<returns>IObservable<NotificationValue>.</returns>
|
||||
<exclude/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenAdsStateChanges(TwinCAT.Ads.IAdsConnection)">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.AdsState"/>s.
|
||||
</summary>
|
||||
<param name="connection">The client.</param>
|
||||
<returns>IObservable<AdsState>.</returns>
|
||||
<example>
|
||||
The following sample shows how observe <see cref="T:TwinCAT.Ads.AdsState"/> changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.AdsClientExtensions"/>
|
||||
<code language="C#" title="Observe changing ADS States with reactive extensions." source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_STATECHANGE" />
|
||||
</example>
|
||||
<seealso cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.PollAdsState(TwinCAT.Ads.IAdsConnection,System.IObservable{System.Reactive.Unit})"/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenSymbolVersionChanges(TwinCAT.Ads.IAdsConnection)">
|
||||
<summary>
|
||||
Gets an observable sequence of SymbolVersion changed counts.
|
||||
</summary>
|
||||
<param name="connection">The connection.</param>
|
||||
<returns>Counter, unique only within the <see cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenSymbolVersionChanges(TwinCAT.Ads.IAdsConnection)"/> observable.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenSymbolVersionChanges(TwinCAT.Ads.IAdsConnection,System.Reactive.Concurrency.IScheduler)">
|
||||
<summary>
|
||||
Gets an observable sequence of SymbolVersion changed counts.
|
||||
</summary>
|
||||
<param name="connection">The client.</param>
|
||||
<param name="scheduler">The scheduler.</param>
|
||||
<returns>Counter, unique only within the <see cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenSymbolVersionChanges(TwinCAT.Ads.IAdsConnection,System.Reactive.Concurrency.IScheduler)"/> observable.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.PollAdsState(TwinCAT.Ads.IAdsConnection,System.IObservable{System.Reactive.Unit})">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.AdsState" />s via Polling.
|
||||
</summary>
|
||||
<param name="connection">The client.</param>
|
||||
<param name="trigger">The polling trigger</param>
|
||||
<returns>IObservable<AdsState>.</returns>
|
||||
<example>
|
||||
The following sample shows how observe <see cref="T:TwinCAT.Ads.AdsState" /> via polling with the reactive <see cref="T:TwinCAT.Ads.Reactive.AdsClientExtensions" /><code language="C#" title="Observe changing ADS States with reactive extensions." source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_STATECHANGEPOLLING" /></example>
|
||||
<seealso cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenAdsStateChanges(TwinCAT.Ads.IAdsConnection)"/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.PollAdsState(TwinCAT.Ads.IAdsConnection,System.TimeSpan)">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.AdsState" />s via Polling.
|
||||
</summary>
|
||||
<param name="connection">The client.</param>
|
||||
<param name="period">The period.</param>
|
||||
<returns>IObservable<AdsState>.</returns>
|
||||
<example>
|
||||
The following sample shows how observe <see cref="T:TwinCAT.Ads.AdsState" /> via polling with the reactive <see cref="T:TwinCAT.Ads.Reactive.AdsClientExtensions" /><code language="C#" title="Observe changing ADS States with reactive extensions." source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_STATECHANGEPOLLING" />
|
||||
</example>
|
||||
<seealso cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenAdsStateChanges(TwinCAT.Ads.IAdsConnection)"/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotification(TwinCAT.Ads.IAdsConnection,TwinCAT.TypeSystem.ISymbol,TwinCAT.Ads.NotificationSettings)">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.Reactive.Notification" />s.
|
||||
</summary>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="symbol">The symbol to observe.</param>
|
||||
<param name="settings">Notification settings.</param>
|
||||
<returns>IObservable<NotificationValue>.</returns>
|
||||
<exception cref="T:System.ArgumentNullException">symbol</exception>
|
||||
<exception cref="T:System.ArgumentOutOfRangeException">Symbol is not an IValueSymbol - symbol</exception>
|
||||
<seealso cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotification(TwinCAT.Ads.IAdsConnection,TwinCAT.TypeSystem.ISymbolCollection,TwinCAT.Ads.NotificationSettings)" />
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotification(TwinCAT.Ads.IAdsConnection,TwinCAT.TypeSystem.ISymbol)">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.Reactive.Notification"/>s.
|
||||
</summary>
|
||||
<param name="connection">The client.</param>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<returns>IObservable<NotificationValue>.</returns>
|
||||
<seealso cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotification(TwinCAT.Ads.IAdsConnection,TwinCAT.TypeSystem.ISymbolCollection,TwinCAT.Ads.NotificationSettings)"/>
|
||||
<seealso cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotification(TwinCAT.Ads.IAdsConnection,TwinCAT.TypeSystem.ISymbol,TwinCAT.Ads.NotificationSettings)"/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotification(TwinCAT.Ads.IAdsConnection,TwinCAT.TypeSystem.ISymbolCollection,TwinCAT.Ads.NotificationSettings)">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.Reactive.Notification" /> objects.
|
||||
</summary>
|
||||
<param name="connection">The client.</param>
|
||||
<param name="symbols">The symbols to observe.</param>
|
||||
<param name="settings">The Notification settings.</param>
|
||||
<returns>IObservable<NotificationValue>.</returns>
|
||||
<example>
|
||||
The following sample shows how observe Value changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.AdsClientExtensions" /><code language="C#" title="Observe changing ADS Symbols with reactive extensions." source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_SYMBOLS" /></example>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotificationEx(TwinCAT.Ads.IAdsConnection,System.Collections.Generic.IList{TwinCAT.TypeSystem.AnySymbolSpecifier},TwinCAT.Ads.NotificationSettings,System.Object)">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.Reactive.Notification" /> objects.
|
||||
</summary>
|
||||
<param name="connection">The client.</param>
|
||||
<param name="symbols">The symbols to observe.</param>
|
||||
<param name="settings">The Notification settings.</param>
|
||||
<param name="userData">The user data.</param>
|
||||
<returns>IObservable<NotificationValue>.</returns>
|
||||
<exception cref="T:System.ArgumentNullException">symbols</exception>
|
||||
<exception cref="T:System.ArgumentOutOfRangeException">Symbols list is empty! - symbols</exception>
|
||||
<exclude/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotificationEx(TwinCAT.Ads.IAdsConnection,TwinCAT.TypeSystem.AnySymbolSpecifier,TwinCAT.Ads.NotificationSettings,System.Object)">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.Reactive.Notification" /> objects.
|
||||
</summary>
|
||||
<param name="connection">The client.</param>
|
||||
<param name="symbol">Symbol specifier.</param>
|
||||
<param name="settings">The Notification settings.</param>
|
||||
<param name="userData">The user data.</param>
|
||||
<returns>IObservable<NotificationValue>.</returns>
|
||||
<exception cref="T:System.ArgumentNullException">symbols</exception>
|
||||
<exception cref="T:System.ArgumentOutOfRangeException">Symbols list is empty! - symbols</exception>
|
||||
<exclude/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotification(TwinCAT.Ads.IAdsConnection,TwinCAT.TypeSystem.ISymbolCollection)">
|
||||
<summary>
|
||||
Gets an observable sequence of <see cref="T:TwinCAT.Ads.Reactive.Notification"/> objects.
|
||||
</summary>
|
||||
<param name="client">The client.</param>
|
||||
<param name="symbols">The symbols.</param>
|
||||
<returns>IObservable<NotificationValue>.</returns>
|
||||
<example>
|
||||
The following sample shows how observe Value changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.AdsClientExtensions"/>
|
||||
<code language="C#" title="Observe changing ADS Symbols with reactive extensions." source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_SYMBOLS" />
|
||||
</example>
|
||||
<seealso cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotification(TwinCAT.Ads.IAdsConnection,TwinCAT.TypeSystem.ISymbol,TwinCAT.Ads.NotificationSettings)"/>
|
||||
</member>
|
||||
<member name="T:TwinCAT.Ads.Reactive.NotificationBase">
|
||||
<summary>
|
||||
Base class for Notifications transported by observables bound to ADS Notifications.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:TwinCAT.Ads.Reactive.NotificationBase.timeStamp">
|
||||
<summary>
|
||||
Notification Time Stamp
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:TwinCAT.Ads.Reactive.NotificationBase.userData">
|
||||
<summary>
|
||||
User Data
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:TwinCAT.Ads.Reactive.NotificationBase.notificationHandle">
|
||||
<summary>
|
||||
Notification Handle
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:TwinCAT.Ads.Reactive.NotificationBase.val">
|
||||
<summary>
|
||||
The unmarshalled value.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:TwinCAT.Ads.Reactive.NotificationBase.TimeStamp">
|
||||
<summary>
|
||||
Gets the timestamp of this <see cref="T:TwinCAT.Ads.AdsNotificationEventArgs">Notification.</see>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:TwinCAT.Ads.Reactive.NotificationBase.UserData">
|
||||
<summary>
|
||||
Gets the user object. This object is passed by to AddDeviceNotification and can
|
||||
be used to store data.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:TwinCAT.Ads.Reactive.NotificationBase.NotificationHandle">
|
||||
<summary>
|
||||
Gets the handle of the connection.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:TwinCAT.Ads.Reactive.NotificationBase.Value">
|
||||
<summary>
|
||||
Gets the value of the <see cref="T:TwinCAT.Ads.Reactive.NotificationBase">Notification</see>.
|
||||
</summary>
|
||||
<value>The value.</value>
|
||||
</member>
|
||||
<member name="T:TwinCAT.Ads.Reactive.Notification">
|
||||
<summary>
|
||||
Notification object streamed by IObservables of ADS Notifications
|
||||
</summary>
|
||||
<seealso cref="E:TwinCAT.Ads.IAdsNotifications.AdsNotification"/>
|
||||
<seealso cref="o:AdsClientExtensions.WhenNotification"/>
|
||||
</member>
|
||||
<member name="F:TwinCAT.Ads.Reactive.Notification._bytes">
|
||||
<summary>
|
||||
Raw Data
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:TwinCAT.Ads.Reactive.Notification.RawValue">
|
||||
<summary>
|
||||
Streams that holds the notification data.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.Notification.#ctor(TwinCAT.Ads.AdsNotificationEventArgs)">
|
||||
<summary>
|
||||
Initializes a new instance of the AdsStream class AdsSyncNotificationEventArgs.
|
||||
</summary>
|
||||
<param name="args">The <see cref="T:TwinCAT.Ads.AdsNotificationEventArgs"/> instance containing the event data.</param>
|
||||
<remarks>The TwinCAT realtime target system (even when working locally) has its own TimeSystem which is synchronized with
|
||||
the Desktop/User time at TwinCAT Start. From this moment on the Desktop/User time can drift from the local Realtime/Target time.
|
||||
can differ.
|
||||
The TimeStamp can be converted to a .NET DateTime Object with <see cref="M:System.DateTime.FromFileTimeUtc(System.Int64)" /> or
|
||||
<see cref="M:System.DateTime.FromFileTime(System.Int64)" /></remarks>
|
||||
</member>
|
||||
<member name="T:TwinCAT.Ads.Reactive.SymbolNotification">
|
||||
<summary>
|
||||
Provides data for AdsNotificationEvent of the class <seealso cref="T:TwinCAT.Ads.TcAdsClient"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.SymbolNotification.#ctor(TwinCAT.Ads.AdsNotificationEventArgs,TwinCAT.TypeSystem.ISymbol,TwinCAT.ValueAccess.IAccessorValueFactory)">
|
||||
<summary>
|
||||
Initializes a new instance of the AdsStream class AdsSyncNotificationEventArgs.
|
||||
</summary>
|
||||
<param name="args">The <see cref="T:TwinCAT.Ads.AdsNotificationEventArgs" /> instance containing the event data.</param>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<param name="valueFactory">The value factory.</param>
|
||||
<remarks>The TwinCAT realtime target system (even when working locally) has its own TimeSystem which is synchronized with
|
||||
the Desktop/User time at TwinCAT Start. From this moment on the Desktop/User time can drift from the local Realtime/Target time.
|
||||
can differ.
|
||||
The TimeStamp can be converted to a .NET DateTime Object with <see cref="M:System.DateTime.FromFileTimeUtc(System.Int64)" /> or
|
||||
<see cref="M:System.DateTime.FromFileTime(System.Int64)" /></remarks>
|
||||
</member>
|
||||
<member name="F:TwinCAT.Ads.Reactive.SymbolNotification._valueFactory">
|
||||
<summary>
|
||||
The internal value factory.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:TwinCAT.Ads.Reactive.SymbolNotification.Symbol">
|
||||
<summary>
|
||||
Gets the symbol of the <see cref="T:TwinCAT.Ads.Reactive.SymbolNotification"/>.
|
||||
</summary>
|
||||
<value>The value symbol.</value>
|
||||
</member>
|
||||
<member name="F:TwinCAT.Ads.Reactive.SymbolNotification._valCreated">
|
||||
<summary>
|
||||
Indicates that the Value is created.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:TwinCAT.Ads.Reactive.SymbolNotification.Value">
|
||||
<summary>
|
||||
Gets the value of the <see cref="T:TwinCAT.Ads.Reactive.SymbolNotification">Notification</see>.
|
||||
</summary>
|
||||
<value>The value.</value>
|
||||
</member>
|
||||
<member name="T:TwinCAT.Ads.Reactive.NotificationEx">
|
||||
<summary>
|
||||
Notification data object created by Observables that are binding on the <see cref="E:TwinCAT.Ads.IAdsNotifications.AdsNotificationEx"/> event.
|
||||
</summary>
|
||||
<seealso cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotificationEx(TwinCAT.Ads.IAdsNotifications)"/>
|
||||
<seealso cref="E:TwinCAT.Ads.IAdsNotifications.AdsNotificationEx"/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.NotificationEx.#ctor(TwinCAT.Ads.AdsNotificationExEventArgs)">
|
||||
<summary>
|
||||
Initializes a new instance of the AdsStream class AdsSyncNotificationEventArgs.
|
||||
</summary>
|
||||
<param name="args">The <see cref="T:TwinCAT.Ads.AdsNotificationEventArgs" /> instance containing the event data.</param>
|
||||
<exception cref="T:System.ArgumentNullException">args</exception>
|
||||
<remarks>The TwinCAT realtime target system (even when working locally) has its own TimeSystem which is synchronized with
|
||||
the Desktop/User time at TwinCAT Start. From this moment on the Desktop/User time can drift from the local Realtime/Target time.
|
||||
can differ.
|
||||
The TimeStamp can be converted to a .NET DateTime Object with <see cref="M:System.DateTime.FromFileTimeUtc(System.Int64)" /> or
|
||||
<see cref="M:System.DateTime.FromFileTime(System.Int64)" /></remarks>
|
||||
</member>
|
||||
<member name="T:TwinCAT.Ads.Reactive.AnySymbolNotification">
|
||||
<summary>
|
||||
Notification data object created by Observables that are binding on the <see cref="E:TwinCAT.Ads.IAdsNotifications.AdsNotificationEx"/> event with specified symbol.
|
||||
</summary>
|
||||
<seealso cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotificationEx(TwinCAT.Ads.IAdsConnection,TwinCAT.TypeSystem.AnySymbolSpecifier,TwinCAT.Ads.NotificationSettings,System.Object)"/>
|
||||
<seealso cref="M:TwinCAT.Ads.Reactive.AdsClientExtensions.WhenNotificationEx(TwinCAT.Ads.IAdsConnection,System.Collections.Generic.IList{TwinCAT.TypeSystem.AnySymbolSpecifier},TwinCAT.Ads.NotificationSettings,System.Object)"/>
|
||||
<seealso cref="E:TwinCAT.Ads.IAdsNotifications.AdsNotificationEx"/>
|
||||
</member>
|
||||
<member name="F:TwinCAT.Ads.Reactive.AnySymbolNotification._specifier">
|
||||
<summary>
|
||||
The symbol specifier.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:TwinCAT.Ads.Reactive.AnySymbolNotification.SymbolSpecifier">
|
||||
<summary>
|
||||
Gets the bound symbol specification of the notification.
|
||||
</summary>
|
||||
<value>The symbol specifier.</value>
|
||||
</member>
|
||||
<member name="P:TwinCAT.Ads.Reactive.AnySymbolNotification.InstancePath">
|
||||
<summary>
|
||||
Gets the instance path of the Notification bound symbol.
|
||||
</summary>
|
||||
<value>The instance path.</value>
|
||||
</member>
|
||||
<member name="P:TwinCAT.Ads.Reactive.AnySymbolNotification.Type">
|
||||
<summary>
|
||||
Gets the Notification bound data type.
|
||||
</summary>
|
||||
<value>The type.</value>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnySymbolNotification.#ctor(TwinCAT.Ads.AdsNotificationExEventArgs,TwinCAT.TypeSystem.AnySymbolSpecifier)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:TwinCAT.Ads.Reactive.AnySymbolNotification"/> class.
|
||||
</summary>
|
||||
<param name="args">The <see cref="T:TwinCAT.Ads.AdsNotificationExEventArgs"/> instance containing the event data.</param>
|
||||
<param name="anySymbol">Any symbol.</param>
|
||||
<exception cref="T:System.ArgumentNullException">anySymbol</exception>
|
||||
</member>
|
||||
<member name="T:TwinCAT.Ads.Reactive.AnyTypeExtensions">
|
||||
<summary>
|
||||
Extension class for <see cref="T:TwinCAT.Ads.TcAdsClient"/> respective <see cref="T:TwinCAT.Ads.IAdsConnection"/> to provide reactive ADS extensions (accessing symbol value sequences with the ANY_TYPE concept)
|
||||
</summary>
|
||||
<remarks>
|
||||
Reactive Extensions (Rx) are a library for composing asynchronous and event-based programs using observable sequences and LINQ-style
|
||||
query operators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using LINQ
|
||||
operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, Rx = Observables + LINQ + Schedulers.
|
||||
The ADS reactive extensions are build on top of this library to enable ADS Symbol and State Observables, seamlessly bound to the reactive
|
||||
extensions. To use the ADS reactive extensions the TwinCAT.Ads.Reactive Nuget package (or the included TwinCAT.Ads.Reactive.dll) must be referenced.
|
||||
(<a href="https://www.nuget.org/packages/Beckhoff.TwinCAT.Ads.Reactive/">Beckhoff.TwinCAT.Ads.Reactive package on Nuget</a>).
|
||||
</remarks>
|
||||
<example>
|
||||
Example1: Observe Value changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.AnyTypeExtensions"/>
|
||||
<code language="C#" title="Observe a single changing ADS Symbols (Extended AdsNotifications, ANY_TYPE)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_ANYTYPE" />
|
||||
</example>
|
||||
<example>
|
||||
Example2: Polling ANY_TYPE values.
|
||||
<code language="C#" title="Observe changing ADS Symbols by polling (Read Polling) (ANY_TYPE)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_POLLANYTYPE" />
|
||||
</example>
|
||||
<example>
|
||||
Write values sequentially.
|
||||
<code language="C#" title="Write sequences of values to the target (ANY_TYPE)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_WRITEANYTYPE" />
|
||||
</example>
|
||||
<seealso cref="T:TwinCAT.Ads.Reactive.AdsClientExtensions"/>
|
||||
<seealso cref="T:TwinCAT.Ads.Reactive.ValueSymbolExtensions"/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.WhenNotification(TwinCAT.Ads.IAdsConnection,System.Collections.Generic.IDictionary{System.String,System.Type},TwinCAT.Ads.NotificationSettings,System.Object)">
|
||||
<summary>
|
||||
Creates an observable sequence of values
|
||||
</summary>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="symbols">InstancePath/Value Type mapping (ANYTYPE rules)</param>
|
||||
<param name="settings">The settings.</param>
|
||||
<param name="userData">The user data.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
<remarks>The values will be cast to the specified type. The .NET type must fit the Symbol type like all ANYTYPES.</remarks>
|
||||
<example>
|
||||
Observe multiple ANY_TYPES via reactive sequence.
|
||||
<code language="C#" title="Observe multiple ANY_TYPES via reactive sequence." source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_ANYTYPES" />
|
||||
</example>
|
||||
<exclude/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.WhenNotification``1(TwinCAT.Ads.IAdsConnection,System.String,TwinCAT.Ads.NotificationSettings)">
|
||||
<summary>
|
||||
Creates an observable sequence of values that are created by ADS Notifications.
|
||||
</summary>
|
||||
<typeparam name="T">The .NET Type representation of the specified symbols type.</typeparam>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="settings">The settings.</param>
|
||||
<returns>IObservable<T>.</returns>
|
||||
<remarks>The values will be cast to the specified type. The .NET type must fit the Symbol type like all ANYTYPES.</remarks>
|
||||
<example>
|
||||
The following sample shows how to observe Value changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.AnyTypeExtensions"/>
|
||||
<code language="C#" title="Observe changing ADS Symbols with reactive extensions (Extended AdsNotification, ANY_TYPE)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_ANYTYPE" />
|
||||
</example>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.WhenNotification(TwinCAT.Ads.IAdsConnection,System.String,System.Type,TwinCAT.Ads.NotificationSettings)">
|
||||
<summary>
|
||||
Creates an observable sequence of values that are created by ADS Notifications.
|
||||
</summary>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="type">The type.</param>
|
||||
<param name="settings">The settings.</param>
|
||||
<returns>IObservable<T>.</returns>
|
||||
<remarks>The values will be cast to the specified type. The .NET type must fit be one of the compatible 'ANYTYPES'.</remarks>
|
||||
<example>
|
||||
The following sample shows how to observe Value changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.AnyTypeExtensions"/>
|
||||
<code language="C#" title="Observe changing ADS Symbols with reactive extensions (Extended AdsNotifications, ANY_TYPE)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_ANYTYPE" />
|
||||
</example>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.WriteValues``1(TwinCAT.Ads.IAdsConnection,System.String,System.IObservable{``0},System.Action{System.Exception})">
|
||||
<summary>
|
||||
Writes the sequence of values to the symbol specified by the instance path.
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="valueSequence">Value sequence (Any type).</param>
|
||||
<param name="errorHandler">The error handler.</param>
|
||||
<returns>IDisposable.</returns>
|
||||
<example>
|
||||
Write values sequentially.
|
||||
<code language="C#" title="Write sequences of values to the target (ANY_TYPE)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_WRITEANYTYPE" />
|
||||
</example>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.WriteValues``1(TwinCAT.Ads.IAdsConnection,System.String,System.IObservable{``0})">
|
||||
<summary>
|
||||
Writes the sequence of values to the symbol specified by the instance path.
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="valueSequence">Value sequence (Any type).</param>
|
||||
<returns>IDisposable.</returns>
|
||||
<example>
|
||||
Write values sequentially.
|
||||
<code language="C#" title="Write sequences of values to the target (ANY_TYPE)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_WRITEANYTYPE" />
|
||||
</example>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues(TwinCAT.Ads.IAdsConnection,System.String,System.Type,System.Int32[],System.IObservable{System.Reactive.Unit},System.Func{System.Exception,System.Object})">
|
||||
<summary>
|
||||
Polls the symbol values on time points where the polling observable streams data / triggers
|
||||
</summary>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="type">The data type of the symbol (ANY_TYPE)</param>
|
||||
<param name="args">The ANY_TYPE arguments.</param>
|
||||
<param name="trigger">The Polling trigger</param>
|
||||
<param name="errorHandler">The error handler.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues(TwinCAT.Ads.IAdsConnection,System.String,System.Type,System.Int32[],System.TimeSpan,System.Func{System.Exception,System.Object})">
|
||||
<summary>
|
||||
Polls the symbol as value sequence of object values with a specified period time.
|
||||
</summary>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="type">The data type of the symbol (ANY_TYPE)</param>
|
||||
<param name="args">The ANY_TYPE arguments.</param>
|
||||
<param name="period">The period.</param>
|
||||
<param name="errorHandler">The error handler.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues(TwinCAT.Ads.IAdsConnection,System.String,System.Type,System.Int32[],System.TimeSpan)">
|
||||
<summary>
|
||||
Polls the symbol as value sequence of object values with a specified period time.
|
||||
</summary>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="type">The data type of the symbol (ANY_TYPE)</param>
|
||||
<param name="args">The ANY_TYPE arguments.</param>
|
||||
<param name="period">The period.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues(TwinCAT.Ads.IAdsConnection,System.String,System.Type,System.IObservable{System.Reactive.Unit},System.Func{System.Exception,System.Object})">
|
||||
<summary>
|
||||
Polls the symbol values on timepoints where the polling observable streams data / triggers
|
||||
</summary>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="type">The data type of the symbol (ANY_TYPE)</param>
|
||||
<param name="trigger">The Polling trigger</param>
|
||||
<param name="errorHandler">The error handler.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues(TwinCAT.Ads.IAdsConnection,System.String,System.Type,System.IObservable{System.Reactive.Unit})">
|
||||
<summary>
|
||||
Polls the symbol values on timepoints where the polling observable streams data / triggers
|
||||
</summary>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="type">The data type of the symbol (ANY_TYPE)</param>
|
||||
<param name="trigger">The Polling trigger</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues(TwinCAT.Ads.IAdsConnection,System.String,System.Type,System.TimeSpan,System.Func{System.Exception,System.Object})">
|
||||
<summary>
|
||||
Polls the symbol as value sequence of object values with a specified period time.
|
||||
</summary>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="type">The data type of the symbol (ANY_TYPE)</param>
|
||||
<param name="period">The period.</param>
|
||||
<param name="errorHandler">The error handler.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues(TwinCAT.Ads.IAdsConnection,System.String,System.Type,System.TimeSpan)">
|
||||
<summary>
|
||||
Polls the symbol as value sequence of object values with a specified period time.
|
||||
</summary>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="type">The data type of the symbol (ANY_TYPE)</param>
|
||||
<param name="period">The period.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues``1(TwinCAT.Ads.IAdsConnection,System.String,System.IObservable{System.Reactive.Unit},System.Func{System.Exception,``0})">
|
||||
<summary>
|
||||
Polls the symbol values on timepoints where the polling observable streams data / triggers
|
||||
</summary>
|
||||
<typeparam name="T">The ANY_TYPE compatible .NET Type.</typeparam>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="trigger">The Polling trigger</param>
|
||||
<param name="errorHandler">The error handler.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues``1(TwinCAT.Ads.IAdsConnection,System.String,System.IObservable{System.Reactive.Unit})">
|
||||
<summary>
|
||||
Polls the symbol values on timepoints where the polling observable streams data / triggers
|
||||
</summary>
|
||||
<typeparam name="T">The ANY_TYPE compatible .NET Type.</typeparam>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="trigger">The Polling trigger</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues``1(TwinCAT.Ads.IAdsConnection,System.String,System.TimeSpan,System.Func{System.Exception,``0})">
|
||||
<summary>
|
||||
Polls the symbol as value sequence of object values with a specified period time.
|
||||
</summary>
|
||||
<typeparam name="T">The ANY_TYPE compatible .NET Type.</typeparam>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="period">The period.</param>
|
||||
<param name="errorHandler">The error handler.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues``1(TwinCAT.Ads.IAdsConnection,System.String,System.TimeSpan)">
|
||||
<summary>
|
||||
Polls the symbol as value sequence of object values with a specified period time.
|
||||
</summary>
|
||||
<typeparam name="T">The ANY_TYPE compatible .NET Type.</typeparam>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="period">The period.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues``1(TwinCAT.Ads.IAdsConnection,System.String,System.Int32[],System.IObservable{System.Reactive.Unit},System.Func{System.Exception,``0})">
|
||||
<summary>
|
||||
Polls the symbol values on timepoints where the polling observable streams data / triggers
|
||||
</summary>
|
||||
<typeparam name="T">The ANY_TYPE compatible .NET Type.</typeparam>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="args">ANY_TYPE arguments</param>
|
||||
<param name="trigger">The Polling trigger</param>
|
||||
<param name="errorHandler">The error handler.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues``1(TwinCAT.Ads.IAdsConnection,System.String,System.Int32[],System.IObservable{System.Reactive.Unit})">
|
||||
<summary>
|
||||
Polls the symbol values on time points where the polling observable streams data / triggers
|
||||
</summary>
|
||||
<typeparam name="T">The ANY_TYPE compatible .NET Type.</typeparam>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="args">ANY_TYPE arguments</param>
|
||||
<param name="trigger">The Polling trigger</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues``1(TwinCAT.Ads.IAdsConnection,System.String,System.Int32[],System.TimeSpan,System.Func{System.Exception,``0})">
|
||||
<summary>
|
||||
Polls the symbol as value sequence of object values with a specified period time.
|
||||
</summary>
|
||||
<typeparam name="T">The ANY_TYPE compatible .NET Type.</typeparam>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="args">ANY_TYPE arguments.</param>
|
||||
<param name="period">The period.</param>
|
||||
<param name="errorHandler">The error handler.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
<example>
|
||||
Polling ANY_TYPE values.
|
||||
<code language="C#" title="Observe changing ADS Symbols by polling (Read Polling) (ANY_TYPE)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_POLLANYTYPE" />
|
||||
</example>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.AnyTypeExtensions.PollValues``1(TwinCAT.Ads.IAdsConnection,System.String,System.Int32[],System.TimeSpan)">
|
||||
<summary>
|
||||
Polls the symbol as value sequence of object values with a specified period time.
|
||||
</summary>
|
||||
<typeparam name="T">The ANY_TYPE compatible .NET Type.</typeparam>
|
||||
<param name="connection">The connection.</param>
|
||||
<param name="instancePath">The instance path.</param>
|
||||
<param name="args">ANY_TYPE arguments.</param>
|
||||
<param name="period">The period.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
<example>
|
||||
Polling ANY_TYPE values.
|
||||
<code language="C#" title="Observe changing ADS Symbols by polling (Read Polling) (ANY_TYPE)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_POLLANYTYPE" />
|
||||
</example>
|
||||
</member>
|
||||
<member name="T:TwinCAT.Ads.Reactive.ValueSymbolExtensions">
|
||||
<summary>
|
||||
Extension class for <see cref="T:TwinCAT.Ads.TcAdsClient"/> respective <see cref="T:TwinCAT.Ads.IAdsConnection"/> to provide reactive ADS extensions for accessing symbols that are loaded by the <see cref="T:TwinCAT.Ads.IAdsSymbolLoaderFactory"/>
|
||||
</summary>
|
||||
<remarks>
|
||||
Reactive Extensions (Rx) are a library for composing asynchronous and event-based programs using observable sequences and LINQ-style
|
||||
query operators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using LINQ
|
||||
operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, Rx = Observables + LINQ + Schedulers.
|
||||
The ADS reactive extensions are build on top of this library to enable ADS Symbol and State Observables, seamlessly bound to the reactive
|
||||
extensions. To use the ADS reactive extensions the TwinCAT.Ads.Reactive Nuget package (or the included TwinCAT.Ads.Reactive.dll) must be referenced from
|
||||
All types within are contained in the ADS companion package "Beckhoff.TwinCAT.Ads.Reactive" which must be referenced separately.
|
||||
(<a href="https://www.nuget.org/packages/Beckhoff.TwinCAT.Ads.Reactive/">Beckhoff.TwinCAT.Ads.Reactive package on Nuget</a>).
|
||||
</remarks>
|
||||
<example>
|
||||
The following sample shows how to observe Value changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.ValueSymbolExtensions"/> from an <see cref="T:TwinCAT.TypeSystem.IValueSymbol"/>.
|
||||
<code language="C#" title="Observe a single changing ADS Symbol (ADS Notifications)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_READSYMBOL" />
|
||||
</example>
|
||||
<example>
|
||||
The following sample shows how to observe Value changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.ValueSymbolExtensions"/> from an <see cref="T:TwinCAT.TypeSystem.DynamicSymbol"/>.
|
||||
<code language="C#" title="Observe a single changing ADS Symbol (ADS Notifications) with the dynamic language runtime (.NET DLR)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_READSYMBOL" />
|
||||
</example>
|
||||
<example>
|
||||
The same for more than one <see cref="T:TwinCAT.TypeSystem.IValueSymbol"/>.
|
||||
<code language="C#" title="Observe changing ADS Symbols (ADS Notifications)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_READSYMBOLS" />
|
||||
</example>
|
||||
<example>
|
||||
Here, the values are polled in a specific time period and sequential Reads are triggered (in opposite to ADS Notification in the latter example)
|
||||
<code language="C#" title="Observe changing ADS Symbols by polling (Read Polling)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_POLLSYMBOLS" />
|
||||
</example>
|
||||
<example>
|
||||
In the following example it is demonstrated how to write Values sequentially to a <see cref="T:TwinCAT.TypeSystem.IValueSymbol"/> with the help of the reactive extensions.
|
||||
<code language="C#" title="Write sequences of values to the target" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_WRITESYMBOLS" />
|
||||
</example>
|
||||
<seealso cref="T:TwinCAT.Ads.Reactive.AdsClientExtensions"/>
|
||||
<seealso cref="T:TwinCAT.Ads.Reactive.AnyTypeExtensions"/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.WhenValueChangedAnnotated(System.Collections.Generic.IEnumerable{TwinCAT.TypeSystem.ISymbol})">
|
||||
<summary>
|
||||
Observable sequence of Value changed events driven by ADS Notifications on the specified symbol.
|
||||
</summary>
|
||||
<param name="symbols">The symbols to observe.</param>
|
||||
<returns>IObservable<ValueChangedArgs>.</returns>
|
||||
<seealso cref="T:System.Reactive.Linq.Observable" />
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.WhenValueChanged(System.Collections.Generic.IEnumerable{TwinCAT.TypeSystem.ISymbol})">
|
||||
<summary>
|
||||
Observable sequence of Values driven by ADS Notifications on the specified symbol.
|
||||
</summary>
|
||||
<param name="symbols">The symbols to observe.</param>
|
||||
<returns>IObservable<ValueChangedArgs>.</returns>
|
||||
<seealso cref="T:System.Reactive.Linq.Observable" />
|
||||
<example>
|
||||
The same for more than one <see cref="T:TwinCAT.TypeSystem.IValueSymbol" />.
|
||||
<code language="C#" title="Observe changing ADS Symbols (ADS Notifications)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_READSYMBOLS" /></example>
|
||||
<example>
|
||||
The following sample shows how to observe Value changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.ValueSymbolExtensions" /> from an <see cref="T:TwinCAT.TypeSystem.DynamicSymbol" />.
|
||||
<code language="C#" title="Observe a single changing ADS Symbol (ADS Notifications) with the dynamic language runtime (.NET DLR)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_READSYMBOL" /></example>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.WhenValueChanged(TwinCAT.TypeSystem.IValueSymbol)">
|
||||
<summary>
|
||||
Gets an observable sequence when the value of the <see cref="T:TwinCAT.TypeSystem.IValueSymbol"/> has changed.
|
||||
</summary>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
<example>
|
||||
The following sample shows how to observe Value changed Notifications with the reactive <see cref="T:TwinCAT.Ads.Reactive.ValueSymbolExtensions"/> from an <see cref="T:TwinCAT.TypeSystem.IValueSymbol"/>.
|
||||
<code language="C#" title="Observe a single changing ADS Symbols (ADS Notifications)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_READSYMBOL" />
|
||||
</example>
|
||||
<see cref="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.WhenValueChangedAnnotated(TwinCAT.TypeSystem.IValueSymbol)"/>
|
||||
<see cref="E:TwinCAT.Ads.IAdsNotifications.AdsNotification"/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.WhenValueChangedAnnotated(TwinCAT.TypeSystem.IValueSymbol)">
|
||||
<summary>
|
||||
Gets an observable sequence when the value of the <see cref="T:TwinCAT.TypeSystem.IValueSymbol"/> has changed.
|
||||
</summary>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<returns>IObservable<ValueChangedArgs>.</returns>
|
||||
<exclude/>
|
||||
<remarks>In addition to the sequence of the pure values (like in <see cref="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.WhenValueChanged(TwinCAT.TypeSystem.IValueSymbol)"/>) the sequence contains
|
||||
<see cref="T:TwinCAT.TypeSystem.ValueChangedArgs"/> objects that contain additional notification timestamps.</remarks>
|
||||
<seealso cref="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.WhenValueChanged(TwinCAT.TypeSystem.IValueSymbol)"/>
|
||||
<seealso cref="E:TwinCAT.Ads.IAdsNotifications.AdsNotification"/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.WriteValues(TwinCAT.TypeSystem.IValueSymbol,System.IObservable{System.Object})">
|
||||
<summary>
|
||||
Subscribes the <see cref="T:TwinCAT.TypeSystem.IValueSymbol" /> to an observable sequence of values and writes them to the <see cref="T:TwinCAT.TypeSystem.IValueSymbol" />.
|
||||
</summary>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<param name="valueObservable">Observable of Values.</param>
|
||||
<returns>IDisposable.</returns>
|
||||
<example>
|
||||
In the following example it is demonstrated how to write Values sequentially to a <see cref="T:TwinCAT.TypeSystem.IValueSymbol"/> with the help of the reactive extensions.
|
||||
<code language="C#" title="Write sequences of values to the target" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_WRITESYMBOLS" />
|
||||
</example>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.WriteValues(TwinCAT.TypeSystem.IValueSymbol,System.IObservable{System.Object},System.Action{System.Exception})">
|
||||
<summary>
|
||||
Subscribes the <see cref="T:TwinCAT.TypeSystem.IValueSymbol" /> to an observable sequence of values and writes them to the <see cref="T:TwinCAT.TypeSystem.IValueSymbol" />.
|
||||
</summary>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<param name="valueObservable">Observable of Values.</param>
|
||||
<param name="errorHandler">The error handler or NULL.</param>
|
||||
<returns>IDisposable.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.WriteValues(TwinCAT.TypeSystem.IValueSymbol,System.IObservable{System.Object},System.Threading.CancellationToken)">
|
||||
<summary>
|
||||
Subscribes the <see cref="T:TwinCAT.TypeSystem.IValueSymbol" /> to an observable sequence of values and writes them to the <see cref="T:TwinCAT.TypeSystem.IValueSymbol" />.
|
||||
</summary>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<param name="valueObservable">Observable of Values.</param>
|
||||
<param name="cancel">The cancellation token.</param>
|
||||
<returns>IDisposable.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.WriteValues(TwinCAT.TypeSystem.IValueSymbol,System.IObservable{System.Object},System.Action{System.Exception},System.Threading.CancellationToken)">
|
||||
<summary>
|
||||
Subscribes the <see cref="T:TwinCAT.TypeSystem.IValueSymbol" /> to an observable sequence of values and writes them to the <see cref="T:TwinCAT.TypeSystem.IValueSymbol" />.
|
||||
</summary>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<param name="valueObservable">Observable of Values.</param>
|
||||
<param name="errorHandler">The error handler.</param>
|
||||
<param name="cancel">The cancellation token.</param>
|
||||
<returns>IDisposable.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.PollValues(TwinCAT.TypeSystem.IValueSymbol,System.IObservable{System.Reactive.Unit})">
|
||||
<summary>
|
||||
Polls the symbol values on time points where the polling observable/trigger streams data
|
||||
</summary>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<param name="trigger">The Polling trigger</param>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
<exclude/>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.PollValues(TwinCAT.TypeSystem.IValueSymbol,System.TimeSpan)">
|
||||
<summary>
|
||||
Polls the symbol as value sequence of object values with a specified period time.
|
||||
</summary>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<param name="period">The period.</param>
|
||||
<example>
|
||||
Here, the values are polled in a specific time period and sequential Reads are triggered (in opposite to ADS Notification in the latter example)
|
||||
<code language="C#" title="Observe changing ADS Symbols (Read Polling)" source="..\Samples\TwinCAT.ADS.NET_Samples\80_ADS.NET_Reactive\Program.cs" region="CODE_SAMPLE_POLLSYMBOLS" />
|
||||
</example>
|
||||
<returns>IObservable<System.Object>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.PollValuesAnnotated(TwinCAT.TypeSystem.IValueSymbol,System.IObservable{System.Reactive.Unit})">
|
||||
<summary>
|
||||
Polls the values as <see cref="T:TwinCAT.TypeSystem.ValueChangedArgs"/> sequence annotated value on trigger sequence
|
||||
</summary>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<param name="trigger">The polling Trigger.</param>
|
||||
<returns>IObservable<ValueChangedArgs>.</returns>
|
||||
</member>
|
||||
<member name="M:TwinCAT.Ads.Reactive.ValueSymbolExtensions.PollValuesAnnotated(TwinCAT.TypeSystem.IValueSymbol,System.TimeSpan)">
|
||||
<summary>
|
||||
Polls the values as <see cref="T:TwinCAT.TypeSystem.ValueChangedArgs"/> sequence with a specified period time.
|
||||
</summary>
|
||||
<param name="symbol">The symbol.</param>
|
||||
<param name="period">The polling period/interval.</param>
|
||||
<returns>IObservable<ValueChangedArgs>.</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,40 @@
|
||||
# Powershell Commandlets for TwinCAT ADS Communication and TwinCAT Ads Management tasks.
|
||||
|
||||
## Prerequisites:
|
||||
TwinCAT 2 or 3 (XAR Runtime or Full)
|
||||
.NET Framework 4.0
|
||||
Powershell 4
|
||||
|
||||
## Features:
|
||||
- Read/Write Values to Local or Remote Systems via ADS (Symbolic, Raw ProcessImage Data)
|
||||
- Start-Stop logical ADS Devices (PLC, SystemService) and setting Config Mode locally and remote
|
||||
- Collection Remote Target System Inforrmation (TwinCAT Version)
|
||||
- Broadcast Search (Browsing ADS Network infrastucture)
|
||||
- Adding / Removing ADS Routes
|
||||
- Session Management (ADS Sessions and connections)
|
||||
- Browsing symbolic information from TwinCAT Targets
|
||||
|
||||
## First Steps:
|
||||
|
||||
Getting global information
|
||||
```powershell
|
||||
PS> get-help about_TcXaeMgmt
|
||||
```
|
||||
|
||||
Getting List of commands
|
||||
```powershell
|
||||
PS> get-command -module TcXaeMgmt
|
||||
```
|
||||
|
||||
Getting Command Help:
|
||||
```powershell
|
||||
PS> get-help Read-TcValue -full
|
||||
```
|
||||
## Documentation and further learning
|
||||
|
||||
[Documentation TcXaeMgmt Module](https://infosys.beckhoff.com/content/1033/tc3_ads_ps_tcxaemgmt/3972231819.html?id=8731138690123386389)
|
||||
[About the TcXaeMgmt Module](https://infosys.beckhoff.com/content/1033/tc3_ads_ps_tcxaemgmt/4130762891.html?id=4912948515382920501)
|
||||
|
||||
|
||||
## Links
|
||||
[Beckhoff Homepage](https://www.beckhoff.com)
|
||||
@@ -0,0 +1,42 @@
|
||||
Powershell Commandlets for TwinCAT ADS Communication and TwinCAT Ads Management tasks.
|
||||
|
||||
Prerequisites:
|
||||
TwinCAT 2 or 3 (XAR Runtime or Full)
|
||||
.NET Framework 4.0
|
||||
Powershell 4
|
||||
|
||||
Features:
|
||||
- Read/Write Values to Local or Remote Systems via ADS (Symbolic, Raw ProcessImage Data)
|
||||
- Start-Stop logical ADS Devices (PLC, SystemService) and setting Config Mode locally and remote
|
||||
- Collection Remote Target System Information (TwinCAT Version)
|
||||
- Broadcast Search (Browsing ADS Network infrastucture)
|
||||
- Adding / Removing ADS Routes
|
||||
- Session Management (ADS Sessions and connections)
|
||||
- Browsing symbolic information from TwinCAT Targets
|
||||
|
||||
First Steps:
|
||||
|
||||
Getting global information
|
||||
```powershell
|
||||
PS> get-help about_TcXaeMgmt
|
||||
```
|
||||
|
||||
Getting List of commands
|
||||
```powershell
|
||||
PS> get-command -module TcXaeMgmt
|
||||
```
|
||||
|
||||
Getting Command Help:
|
||||
```powershell
|
||||
PS> get-help Read-TcValue -full
|
||||
```
|
||||
Documentation and further learning
|
||||
|
||||
[Documentation TcXaeMgmt Module]
|
||||
https://infosys.beckhoff.com/content/1033/tc3_ads_ps_tcxaemgmt/3972231819.html?id=8731138690123386389
|
||||
[About the TcXaeMgmt Module]
|
||||
https://infosys.beckhoff.com/content/1033/tc3_ads_ps_tcxaemgmt/4130762891.html?id=4912948515382920501
|
||||
|
||||
Links
|
||||
[Beckhoff Homepage]
|
||||
https://www.beckhoff.com
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 490 KiB |
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- edited with XMLSpy v2006 sp2 U (http://www.altova.com) by Ralf Heitmann (BECKHOFF Automation GmbH) -->
|
||||
<Types>
|
||||
<Type>
|
||||
<Name>TwinCAT.RouteTarget</Name>
|
||||
<TypeConverter>
|
||||
<TypeName>TwinCAT.Management.Automation.PSRouteTypeConverter</TypeName>
|
||||
</TypeConverter>
|
||||
</Type>
|
||||
<Type>
|
||||
<Name>TwinCAT.Ads.AmsPort</Name>
|
||||
<TypeConverter>
|
||||
<TypeName>TwinCAT.Management.Automation.PSPortTypeConverter</TypeName>
|
||||
</TypeConverter>
|
||||
</Type>
|
||||
</Types>
|
||||
@@ -0,0 +1,326 @@
|
||||
TOPIC
|
||||
PowerShell TwinCAT XAE Management Console (TcXaeMgmt)
|
||||
|
||||
SHORT DESCRIPTION
|
||||
Describes the Powershell TwinCAT Management Console (TcXaeMgmt) module and
|
||||
how to use the contained cmdlets and functions.
|
||||
|
||||
LONG DESCRIPTION
|
||||
Powershell TwinCAT Management Console is a PowerShell module that provides a
|
||||
number of useful cmdlets for TwinCAT System Management and for communicating
|
||||
with ADS devices with the ADS protocol.
|
||||
This includes TwinCAT Route Management as finding routes (find targets, broadcast search),
|
||||
establishing and removing route connections (Add-AdsRoute, Remove-AdsRoute) and the
|
||||
test of registered routes (Test-AdsRoute) or communication (Get-AdsState).
|
||||
Furthermore Ads Sessions can be established for further use (New-TcSession), Symbol information
|
||||
can be browsed (Get-TcSymbol, Get-TcDataType) and data read/write from/to to ADS Devices
|
||||
(Read-TcValue, Write-TcValue).
|
||||
Uploading and Downloading files to or from the TwinCAT Target systems is an additional feature
|
||||
(Copy-AdsFile).
|
||||
|
||||
POWERSHELL COMPATIBILITY
|
||||
Actually, the TwinCAT Management Console is written for and works with Powershell
|
||||
4.0.
|
||||
|
||||
PREFERENCE VARIABLES
|
||||
|
||||
CMDLETS
|
||||
To see what cmdlets are provided by the TcXaeMgmt Module, execute the command:
|
||||
Get-Command -Module TcXaeMgmt -CommandType Cmdlet
|
||||
The current TcXaeMgmt cmdlets are listed below:
|
||||
|
||||
Add-AdsRoute
|
||||
Cmdlet for adding TwinCAT Routes.
|
||||
|
||||
Close-TcSession
|
||||
Closes the specified session object.
|
||||
|
||||
Copy-AdsFile
|
||||
Uploads / Downloads files from/to TwinCAT target.
|
||||
|
||||
Get-AdsRoute
|
||||
List routes on a TwinCAT System / Broadcast search.
|
||||
|
||||
Get-AdsState
|
||||
Gets the Ads State of a TwinCAT Target.
|
||||
|
||||
Get-TcDataType
|
||||
Get the DataTypes from a TwinCAT target system / Device.
|
||||
|
||||
Get-TcSession
|
||||
List the currently established Sessions.
|
||||
|
||||
Get-TcSymbol
|
||||
Get the symbols from a TwinCAT target system / Device.
|
||||
|
||||
Get-TcTargetInfo
|
||||
Get TwinCAT Device Target information.
|
||||
|
||||
Get-TcVersion
|
||||
Get the TwinCAT Version of a target system.
|
||||
|
||||
New-TcSession
|
||||
Create a new session to a TwinCAT Target.
|
||||
|
||||
Read-TcValue
|
||||
Reads values from TwinCAT devices.
|
||||
|
||||
Remove-AdsRoute
|
||||
Remove an ADS Route.
|
||||
|
||||
Set-AdsState
|
||||
Set the ADS State of a TwinCAT Target.
|
||||
|
||||
Test-AdsRoute
|
||||
Test the specified route connection.
|
||||
|
||||
Write-TcValue
|
||||
Write values to TwinCAT devices.
|
||||
|
||||
|
||||
FIRSTSTEPS
|
||||
# Getting Route
|
||||
>PS $route = get-adsroute TC3TEST*
|
||||
>PS $route
|
||||
|
||||
Name NetId Address Sub Version RTSystem
|
||||
---- ----- ------- --- ------- --------
|
||||
TC3TESTA1-CP67X 172.17.62.105.1.1 172.17.62.105 0.0 Unknown
|
||||
|
||||
#Create Session
|
||||
PS> $session = New-TcSession -Route $route -Port 851
|
||||
PS> $session
|
||||
|
||||
ID Address IsConnected EstablishedAt
|
||||
-- ------- ----------- -------------
|
||||
1 172.17.62.105.1.1:851 True 12/12/2016 12:22:02 PM
|
||||
|
||||
# Read Ads Value (Struct)
|
||||
> $v1 = Read-TcValue -SessionId 1 -Path "GVL.vgStruct"
|
||||
> $v1
|
||||
|
||||
vBool : True
|
||||
vByte : 123
|
||||
vWord : 12345
|
||||
vDWord : 12345678
|
||||
vSInt : -121
|
||||
vUSInt : 212
|
||||
vInt : -12121
|
||||
vUInt : 21212
|
||||
vDInt : -1212121
|
||||
vUDInt : 2121212
|
||||
vReal : 123,456
|
||||
vLReal : 1234567890,12346
|
||||
vString : QWERTZUIOPÜASDFGHJKLÖÄYXCVBNM;:_
|
||||
vTime : 01:02:03.0040000
|
||||
vTod : 23:45:06.7890000
|
||||
vDate : 17.11.2005 00:00:00
|
||||
vDT : 17.11.2005 12:34:56
|
||||
vAlias : 8
|
||||
vEnum : 8
|
||||
vRange : 7
|
||||
PSValue : ...
|
||||
|
||||
# Read Ads Value (Boolean)
|
||||
> $v2 = Read-TcValue -SessionId 1 -Path "Main.bChange"
|
||||
> $v2
|
||||
False
|
||||
|
||||
# Read Ads Value (Array of Strings)
|
||||
> $v3 = Read-TcValue -SessionId 1 -path "GVL.vgaString"
|
||||
|
||||
Dimensions Elements PSValue
|
||||
---------- -------- -------
|
||||
{TwinCAT.TypeSystem.Dimension} {QWERTZUIOPÜASDFGHJKLÖÄYXCVBNM;:_, _:;MNBVCXYÄÖLKJHGFDSAÜPOIUZTREWQ} ...
|
||||
|
||||
# Read Array Of Structs
|
||||
> $v4 = Read-TcValue -SessionId 1 -path "GVL.vgastruct"
|
||||
|
||||
|
||||
Dimensions Elements
|
||||
---------- --------
|
||||
{TwinCAT.TypeSystem.Dimension} {@{vBool=True; vByte=123; vWord=12345; vDWord=12345678; vSInt=-121; vUSInt=212; vInt=-12121; vUInt=21212; vDInt=-1212121; vUD...
|
||||
|
||||
#Dump Array Elements
|
||||
> $v4.Dimensions.ElementCount
|
||||
2
|
||||
|
||||
> $v4.Elements
|
||||
|
||||
vBool : True
|
||||
vByte : 123
|
||||
vWord : 12345
|
||||
vDWord : 12345678
|
||||
vSInt : -121
|
||||
vUSInt : 212
|
||||
vInt : -12121
|
||||
vUInt : 21212
|
||||
vDInt : -1212121
|
||||
vUDInt : 2121212
|
||||
vReal : 123,456
|
||||
vLReal : 1234567890,12346
|
||||
vString : QWERTZUIOPÜASDFGHJKLÖÄYXCVBNM;:_
|
||||
vTime : 01:02:03.0040000
|
||||
vTod : 23:45:06.7890000
|
||||
vDate : 17.11.2005 00:00:00
|
||||
vDT : 17.11.2005 12:34:56
|
||||
vAlias : 8
|
||||
vEnum : 8
|
||||
vRange : 7
|
||||
PSValue : ...
|
||||
|
||||
vBool : False
|
||||
vByte : 234
|
||||
vWord : 23456
|
||||
vDWord : 23456789
|
||||
vSInt : 121
|
||||
vUSInt : 131
|
||||
vInt : 12121
|
||||
vUInt : 13131
|
||||
vDInt : 1212121
|
||||
vUDInt : 1313131
|
||||
vReal : 456,321
|
||||
vLReal : 987654321,123457
|
||||
vString : _:;MNBVCXYÄÖLKJHGFDSAÜPOIUZTREWQ
|
||||
vTime : 11:22:33.0440000
|
||||
vTod : 11:22:33.4440000
|
||||
vDate : 22.01.1999 00:00:00
|
||||
vDT : 22.01.1999 11:22:33
|
||||
vAlias : 9
|
||||
vEnum : 9
|
||||
vRange : -5
|
||||
PSValue : ...
|
||||
|
||||
# Browse Data Types (Query by Category)
|
||||
> $session | Get-TcDataType | where Category -eq "Array" }
|
||||
|
||||
Name Size Category Comment ElementType Dimensions Members
|
||||
---- ---- -------- ------- ----------- ---------- -------
|
||||
ARRAY [-1..1] OF INT 6 Array INT {TwinCAT.Type...
|
||||
ARRAY [-10..-8] OF BOOL 3 Array BOOL {TwinCAT.Type...
|
||||
ARRAY [0..1] OF A_Alias 4 Array A_Alias {TwinCAT.Type...
|
||||
....
|
||||
|
||||
# Browse DataTypes by name
|
||||
> $session | Get-TcDataType -name "Array*"
|
||||
|
||||
# Browse all Symbols recursively
|
||||
> $session | Get-TcSymbol -recurse
|
||||
... returns all symbols
|
||||
|
||||
# Browse Symbols recursivly by Symbol Path (Here specific array index 'TaskInfo[1]'(
|
||||
> $session | Get-TcSymbol -recurse -path "*TaskInfo``[1``]*","*.ProjectName"
|
||||
|
||||
InstanceName DataType Size InstancePath Comment
|
||||
------------ -------- ---- ------------ -------
|
||||
ProjectName STRING(63) 64 TwinCAT_SystemInfoVarList._AppInfo.ProjectName
|
||||
_TaskInfo[1] PLC.PlcTaskSystemInfo 128 TwinCAT_SystemInfoVarList._TaskInfo[1]
|
||||
ObjId OTCID 4 TwinCAT_SystemInfoVarList._TaskInfo[1].ObjId
|
||||
CycleTime UDINT 4 TwinCAT_SystemInfoVarList._TaskInfo[1].CycleTime
|
||||
Priority UINT 2 TwinCAT_SystemInfoVarList._TaskInfo[1].Priority
|
||||
AdsPort UINT 2 TwinCAT_SystemInfoVarList._TaskInfo[1].AdsPort
|
||||
CycleCount UDINT 4 TwinCAT_SystemInfoVarList._TaskInfo[1].CycleCount
|
||||
DcTaskTime LINT 8 TwinCAT_SystemInfoVarList._TaskInfo[1].DcTaskTime
|
||||
LastExecTime UDINT 4 TwinCAT_SystemInfoVarList._TaskInfo[1].LastExecTime
|
||||
FirstCycle BOOL 1 TwinCAT_SystemInfoVarList._TaskInfo[1].FirstCycle
|
||||
CycleTimeExceeded BOOL 1 TwinCAT_SystemInfoVarList._TaskInfo[1].CycleTimeExceeded
|
||||
InCallAfterOutputUpdate BOOL 1 TwinCAT_SystemInfoVarList._TaskInfo[1].InCallAfterOutputUpdate
|
||||
RTViolation BOOL 1 TwinCAT_SystemInfoVarList._TaskInfo[1].RTViolation
|
||||
TaskName STRING(63) 64 TwinCAT_SystemInfoVarList._TaskInfo[1].TaskName
|
||||
|
||||
# Browse only Symbols ending with path *.ProjectName
|
||||
>$project = Get-TcSymbol -Session $session -recurse -path "*.ProjectName"
|
||||
|
||||
InstanceName DataType Size InstancePath Comment
|
||||
------------ -------- ---- ------------ -------
|
||||
ProjectName STRING(63) 64 TwinCAT_SystemInfoVarList._AppInfo.ProjectName
|
||||
|
||||
# Ads Read ProjectName
|
||||
>$project | Read-TcValue -Session $session
|
||||
ADS_DynSymbols
|
||||
|
||||
# Ads Write ProjectName
|
||||
>$project | Write-TcValue -Session $session -Value "NewProjectName"
|
||||
>$project | Read-TcValue -Session $session
|
||||
NewProjectName
|
||||
|
||||
# ReadWrite by Symbol Path
|
||||
>Read-TcValue -SessionId 1 -Path "Main.bChange"
|
||||
false
|
||||
>Write-TcValue -SessionId 1 -Symbol "Main.bChange" -Value True
|
||||
>Read-TcValue -SessionId 1 -Path "GVL.vgBool"
|
||||
>Write-TcValue -SessionId 1 -Path "GVL.vgBool" -value $true
|
||||
|
||||
# ReadWrite by Piping
|
||||
> $projectNameSymbol = $session | Get-TcSymbol -Recurse -path "*ProjectName"
|
||||
> $projectNameSymbol | Read-TcValue -SessionId 1
|
||||
> $projectNameSymbol | Write-TcValue -SessionId 1 -Value "NewProjectName"
|
||||
> $projectNameSymbol | Read-TcValue -SessionId 1
|
||||
|
||||
# Get Target Information
|
||||
> get-adsroute | Get-TcTargetInfo
|
||||
|
||||
Target Version Level OS Image Device CPUArch
|
||||
------ ------- ----- -- ----- ------ -------
|
||||
TC3TESTA1-CP67X 3.1.4021.131 CP Win7 IntelX86
|
||||
|
||||
> get-adsroute | Get-TcVersion
|
||||
|
||||
Major Minor Build Revision
|
||||
----- ----- ----- --------
|
||||
3 1 4021 131
|
||||
|
||||
PROVIDERS
|
||||
The TcXaeMgmt module includes the AdsSymbolProvider, which binds the target
|
||||
device symbolic information to a PSDrive. To register a symbol server as
|
||||
PSDrive type (here the Target Route 'TC3TESTA1-CP67X' with AmsPort: 851)
|
||||
|
||||
> New-PSDrive -Name AdsSymbols -PSProvider AdsSymbolProvider -Address TC3TESTA1-CP67X -Port 851 -Root ''
|
||||
> cd AdsSymbols:
|
||||
> dir
|
||||
|
||||
get-help about_providers
|
||||
|
||||
FUNCTIONS
|
||||
To see what functions are provided by TcXaeMgmt, execute the command:
|
||||
Get-Command -Module TcXaeMgmt -CommandType Function
|
||||
The current TcXaeMgmt functions are listed below:
|
||||
|
||||
(Add-Route
|
||||
Adding a route to the specified TwinCAT System)
|
||||
|
||||
|
||||
TCXAEMGMT ALIASES
|
||||
To see what aliases get created by TcXaeMgmt, execute the command:
|
||||
Get-Command -Module TcXaeMgmt -CommandType Alias
|
||||
The current TcXaeMgmt defined aliases are listed below:
|
||||
|
||||
(fhex : alias for Format-Hex cmdlet)
|
||||
|
||||
MISCELLANOUS FEATURES
|
||||
|
||||
FEEDBACK
|
||||
Please submit any feedback, including defects and enhancement requests,
|
||||
to
|
||||
|
||||
support@beckhoff.com
|
||||
|
||||
We are also interested in suggestions you may have for cmdlets. Over
|
||||
time, we hope to be able to add some more features.
|
||||
|
||||
SEE ALSO
|
||||
For more information, most of the cmdlets have help associated with
|
||||
them e.g.:
|
||||
|
||||
PS> Get-Help Add-AdsRoute -full
|
||||
|
||||
The definitive information on a cmdlet's parameters can be obtained
|
||||
by executing:
|
||||
|
||||
PS> Get-Command Add-AdsRoute -syntax
|
||||
|
||||
or more tersely:
|
||||
|
||||
PS> gcm Add-AdsRoute -syn
|
||||
|
||||
about_providers
|
||||
@@ -0,0 +1,35 @@
|
||||
ADS API Versions
|
||||
----------------------------------------------------
|
||||
|
||||
- TcAdsDll.dll Version 2.11.0.38
|
||||
|
||||
- TcAdsDllCe.dll Version 2.10.0.5 for x86
|
||||
- TcAdsDllCe.dll Version 2.9.0.35 for Mips, Sh4, StrongARM (PPC) and StrongARM (HPC)
|
||||
|
||||
- TcAdsOcx Version 3.0.0.111 for x86 and x64
|
||||
|
||||
- TwinCAT.Ads.Dll Version 1.0.0.15 for .NET Framework v1.0.3705
|
||||
- TwinCAT.Ads.Dll Version 1.0.0.18 for .NET Framework v1.1.4322
|
||||
- TwinCAT.Ads.Dll Version 2.2.56.0 for .NET Framework v2.0.50727
|
||||
- TwinCAT.Ads.Dll Version 4.4.7 for .NET Framework v4.0.30319
|
||||
|
||||
- TwinCAT.Ads.Reactive.dll Version 4.4.7 for .NET Framework v4.6.1
|
||||
|
||||
- TwinCAT.Ads.Dll Version 1.0.0.18 for .NET Compact Framework v1.0.5000
|
||||
- TwinCAT.Ads.Dll Version 2.2.56.0 for .NET Compact Framework v2.0
|
||||
|
||||
- AdsToJava version 2.1.1.0 for PC(x86/x64)
|
||||
- TcJavaToAds.jar 2.1.0
|
||||
|
||||
- TcAdsWebService.dll Version 2.0.0.5 for CE
|
||||
- TcAdsWebService.dll Version 2.0.0.5 for PC
|
||||
|
||||
- TcAdsWebService.js Version 1.0.3.0
|
||||
|
||||
- TcAdsWcf Version 1.0.1.0
|
||||
|
||||
- SSLCert Version 1.0.1.0
|
||||
|
||||
- TcScript version 2.11.0.9
|
||||
|
||||
- TcXaeMgmt version 3.2.17 for Powershell v5.1 and newer
|
||||
@@ -0,0 +1,244 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File: TcAdsAPI.h
|
||||
// Description: Prototypes and Definitions for non C++ Applications
|
||||
// Author: RamonB
|
||||
// Created: Wed Nov 6 10:00:00 1996
|
||||
//
|
||||
//
|
||||
// BECKHOFF-Industrieelektronik-GmbH
|
||||
//
|
||||
// Modifications:
|
||||
// KlausBue 11/1999
|
||||
// Register Callback for Router notifications
|
||||
//
|
||||
// ChristophC 16/07/2001
|
||||
// Double definition of router callback function removed
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef __ADSAPI_H__
|
||||
#define __ADSAPI_H__
|
||||
|
||||
#define ADSAPIERR_NOERROR 0x0000
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsGetDllVersion( void );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsPortOpen( void );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsPortClose( void );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsGetLocalAddress( AmsAddr* pAddr );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncWriteReq( AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to write
|
||||
void* pData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to read
|
||||
void* pData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadReqEx( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to read
|
||||
void* pData, // pointer to the client buffer
|
||||
unsigned long* pcbReturn // count of bytes read
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadWriteReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long cbReadLength, // count of bytes to read
|
||||
void* pReadData, // pointer to the client buffer
|
||||
unsigned long cbWriteLength, // count of bytes to write
|
||||
void* pWriteData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadWriteReqEx( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long cbReadLength, // count of bytes to read
|
||||
void* pReadData, // pointer to the client buffer
|
||||
unsigned long cbWriteLength, // count of bytes to write
|
||||
void* pWriteData, // pointer to the client buffer
|
||||
unsigned long* pcbReturn // count of bytes read
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadDeviceInfoReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
char* pDevName,// fixed length string (16 Byte)
|
||||
AdsVersion* pVersion // client buffer to store server version
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncWriteControlReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned short adsState, // index group in ADS server interface
|
||||
unsigned short deviceState,// index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to write
|
||||
void* pData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadStateReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned short* pAdsState, // pointer to client buffer
|
||||
unsigned short* pDeviceState// pointer to the client buffer
|
||||
);
|
||||
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncAddDeviceNotificationReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset,// index offset in ADS server interface
|
||||
AdsNotificationAttrib* pNoteAttrib, // attributes of notification request
|
||||
PAdsNotificationFuncEx pNoteFunc, // address of notification callback
|
||||
unsigned long hUser, // user handle
|
||||
unsigned long *pNotification // pointer to notification handle (return value)
|
||||
);
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncDelDeviceNotificationReq( AmsAddr* pAddr,// Ams address of ADS server
|
||||
unsigned long hNotification // notification handle
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncSetTimeout( long nMs ); // Set timeout in ms
|
||||
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsGetLastError( void );
|
||||
|
||||
|
||||
/// register callback
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsAmsRegisterRouterNotification (PAmsRouterNotificationFuncEx pNoteFunc );
|
||||
|
||||
/// unregister callback
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsAmsUnRegisterRouterNotification ();
|
||||
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncGetTimeout(long *pnMs ); // client buffer to store timeout
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsAmsPortEnabled(BOOL *pbEnabled);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// new Ads functions for multithreading applications
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsPortOpenEx( );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsPortCloseEx( long port );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsGetLocalAddressEx(long port, AmsAddr* pAddr );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncWriteReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to write
|
||||
void* pData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadReqEx2( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to read
|
||||
void* pData, // pointer to the client buffer
|
||||
unsigned long* pcbReturn // count of bytes read
|
||||
);
|
||||
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadWriteReqEx2( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long cbReadLength, // count of bytes to read
|
||||
void* pReadData, // pointer to the client buffer
|
||||
unsigned long cbWriteLength, // count of bytes to write
|
||||
void* pWriteData, // pointer to the client buffer
|
||||
unsigned long* pcbReturn // count of bytes read
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadDeviceInfoReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
char* pDevName, // fixed length string (16 Byte)
|
||||
AdsVersion* pVersion // client buffer to store server version
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncWriteControlReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned short adsState, // index group in ADS server interface
|
||||
unsigned short deviceState, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to write
|
||||
void* pData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadStateReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned short* pAdsState, // pointer to client buffer
|
||||
unsigned short* pDeviceState // pointer to the client buffer
|
||||
);
|
||||
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncAddDeviceNotificationReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS ser
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
AdsNotificationAttrib* pNoteAttrib, // attributes of notification request
|
||||
PAdsNotificationFuncEx pNoteFunc, // address of notification callback
|
||||
unsigned long hUser, // user handle
|
||||
unsigned long *pNotification // pointer to notification handle (return value)
|
||||
);
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncDelDeviceNotificationReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS ser
|
||||
unsigned long hNotification // notification handle
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncSetTimeoutEx(long port, // Ams port of ADS client
|
||||
long nMs ); // Set timeout in ms
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncGetTimeoutEx(long port, // Ams port of ADS client
|
||||
long *pnMs ); // client buffer to store timeout
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsAmsPortEnabledEx(long nPort, BOOL *pbEnabled);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,416 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// This is a part of the Beckhoff TwinCAT ADS API
|
||||
// Copyright (C) Beckhoff Automation GmbH
|
||||
// All rights reserved.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __ADSDEF_H__
|
||||
#define __ADSDEF_H__
|
||||
|
||||
#ifndef ANYSIZE_ARRAY
|
||||
#define ANYSIZE_ARRAY 1
|
||||
#endif
|
||||
|
||||
#define ADS_FIXEDNAMESIZE 16
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AMS Ports
|
||||
#define AMSPORT_LOGGER 100
|
||||
#define AMSPORT_R0_RTIME 200
|
||||
#define AMSPORT_R0_TRACE (AMSPORT_R0_RTIME+90)
|
||||
#define AMSPORT_R0_IO 300
|
||||
#define AMSPORT_R0_SPS 400
|
||||
#define AMSPORT_R0_NC 500
|
||||
#define AMSPORT_R0_ISG 550
|
||||
#define AMSPORT_R0_PCS 600
|
||||
#define AMSPORT_R0_PLC 801
|
||||
#define AMSPORT_R0_PLC_RTS1 801
|
||||
#define AMSPORT_R0_PLC_RTS2 811
|
||||
#define AMSPORT_R0_PLC_RTS3 821
|
||||
#define AMSPORT_R0_PLC_RTS4 831
|
||||
#define AMSPORT_R0_PLC_TC3 851
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADS Cmd Ids
|
||||
#define ADSSRVID_INVALID 0x00
|
||||
#define ADSSRVID_READDEVICEINFO 0x01
|
||||
#define ADSSRVID_READ 0x02
|
||||
#define ADSSRVID_WRITE 0x03
|
||||
#define ADSSRVID_READSTATE 0x04
|
||||
#define ADSSRVID_WRITECTRL 0x05
|
||||
#define ADSSRVID_ADDDEVICENOTE 0x06
|
||||
#define ADSSRVID_DELDEVICENOTE 0x07
|
||||
#define ADSSRVID_DEVICENOTE 0x08
|
||||
#define ADSSRVID_READWRITE 0x09
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADS reserved index groups
|
||||
#define ADSIGRP_SYMTAB 0xF000
|
||||
#define ADSIGRP_SYMNAME 0xF001
|
||||
#define ADSIGRP_SYMVAL 0xF002
|
||||
|
||||
#define ADSIGRP_SYM_HNDBYNAME 0xF003
|
||||
#define ADSIGRP_SYM_VALBYNAME 0xF004
|
||||
#define ADSIGRP_SYM_VALBYHND 0xF005
|
||||
#define ADSIGRP_SYM_RELEASEHND 0xF006
|
||||
#define ADSIGRP_SYM_INFOBYNAME 0xF007
|
||||
#define ADSIGRP_SYM_VERSION 0xF008
|
||||
#define ADSIGRP_SYM_INFOBYNAMEEX 0xF009
|
||||
|
||||
#define ADSIGRP_SYM_DOWNLOAD 0xF00A
|
||||
#define ADSIGRP_SYM_UPLOAD 0xF00B
|
||||
#define ADSIGRP_SYM_UPLOADINFO 0xF00C
|
||||
#define ADSIGRP_SYM_DOWNLOAD2 0xF00D
|
||||
#define ADSIGRP_SYM_DT_UPLOAD 0xF00E
|
||||
#define ADSIGRP_SYM_UPLOADINFO2 0xF00F
|
||||
|
||||
#define ADSIGRP_SYMNOTE 0xF010 // notification of named handle
|
||||
|
||||
#define ADSIGRP_SUMUP_READ 0xF080 // AdsRW IOffs list size or 0 (=0 -> list size == WLength/3*sizeof(ULONG))
|
||||
// W: {list of IGrp, IOffs, Length}
|
||||
// if IOffs != 0 then R: {list of results} and {list of data}
|
||||
// if IOffs == 0 then R: only data (sum result)
|
||||
#define ADSIGRP_SUMUP_WRITE 0xF081 // AdsRW IOffs list size
|
||||
// W: {list of IGrp, IOffs, Length} followed by {list of data}
|
||||
// R: list of results
|
||||
#define ADSIGRP_SUMUP_READWRITE 0xF082 // AdsRW IOffs list size
|
||||
// W: {list of IGrp, IOffs, RLength, WLength} followed by {list of data}
|
||||
// R: {list of results, RLength} followed by {list of data}
|
||||
#define ADSIGRP_SUMUP_READEX 0xF083 // AdsRW IOffs list size
|
||||
// W: {list of IGrp, IOffs, Length}
|
||||
#define ADSIGRP_SUMUP_READEX2 0xF084 // AdsRW IOffs list size
|
||||
// W: {list of IGrp, IOffs, Length}
|
||||
// R: {list of results, Length} followed by {list of data (returned lengths)}
|
||||
#define ADSIGRP_SUMUP_ADDDEVNOTE 0xF085 // AdsRW IOffs list size
|
||||
// W: {list of IGrp, IOffs, Attrib}
|
||||
// R: {list of results, handles}
|
||||
#define ADSIGRP_SUMUP_DELDEVNOTE 0xF086 // AdsRW IOffs list size
|
||||
// W: {list of handles}
|
||||
// R: {list of results, Length} followed by {list of data}
|
||||
|
||||
#define ADSIGRP_IOIMAGE_RWIB 0xF020 // read/write input byte(s)
|
||||
#define ADSIGRP_IOIMAGE_RWIX 0xF021 // read/write input bit
|
||||
#define ADSIGRP_IOIMAGE_RISIZE 0xF025 // read input size (in byte)
|
||||
#define ADSIGRP_IOIMAGE_RWOB 0xF030 // read/write output byte(s)
|
||||
#define ADSIGRP_IOIMAGE_RWOX 0xF031 // read/write output bit
|
||||
#define ADSIGRP_IOIMAGE_CLEARI 0xF040 // write inputs to null
|
||||
#define ADSIGRP_IOIMAGE_CLEARO 0xF050 // write outputs to null
|
||||
#define ADSIGRP_IOIMAGE_RWIOB 0xF060 // read input and write output byte(s)
|
||||
|
||||
#define ADSIGRP_DEVICE_DATA 0xF100 // state, name, etc...
|
||||
#define ADSIOFFS_DEVDATA_ADSSTATE 0x0000 // ads state of device
|
||||
#define ADSIOFFS_DEVDATA_DEVSTATE 0x0002 // device state
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADS Return codes
|
||||
#define ADSERR_NOERR 0x00
|
||||
#define ERR_ADSERRS 0x0700
|
||||
|
||||
#define ADSERR_DEVICE_ERROR (0x00+ERR_ADSERRS) // Error class < device error >
|
||||
#define ADSERR_DEVICE_SRVNOTSUPP (0x01+ERR_ADSERRS) // Service is not supported by server
|
||||
#define ADSERR_DEVICE_INVALIDGRP (0x02+ERR_ADSERRS) // invalid indexGroup
|
||||
#define ADSERR_DEVICE_INVALIDOFFSET (0x03+ERR_ADSERRS) // invalid indexOffset
|
||||
#define ADSERR_DEVICE_INVALIDACCESS (0x04+ERR_ADSERRS) // reading/writing not permitted
|
||||
#define ADSERR_DEVICE_INVALIDSIZE (0x05+ERR_ADSERRS) // parameter size not correct
|
||||
#define ADSERR_DEVICE_INVALIDDATA (0x06+ERR_ADSERRS) // invalid parameter value(s)
|
||||
#define ADSERR_DEVICE_NOTREADY (0x07+ERR_ADSERRS) // device is not in a ready state
|
||||
#define ADSERR_DEVICE_BUSY (0x08+ERR_ADSERRS) // device is busy
|
||||
#define ADSERR_DEVICE_INVALIDCONTEXT (0x09+ERR_ADSERRS) // invalid context (must be InWindows)
|
||||
#define ADSERR_DEVICE_NOMEMORY (0x0A+ERR_ADSERRS) // out of memory
|
||||
#define ADSERR_DEVICE_INVALIDPARM (0x0B+ERR_ADSERRS) // invalid parameter value(s)
|
||||
#define ADSERR_DEVICE_NOTFOUND (0x0C+ERR_ADSERRS) // not found (files, ...)
|
||||
#define ADSERR_DEVICE_SYNTAX (0x0D+ERR_ADSERRS) // syntax error in comand or file
|
||||
#define ADSERR_DEVICE_INCOMPATIBLE (0x0E+ERR_ADSERRS) // objects do not match
|
||||
#define ADSERR_DEVICE_EXISTS (0x0F+ERR_ADSERRS) // object already exists
|
||||
#define ADSERR_DEVICE_SYMBOLNOTFOUND (0x10+ERR_ADSERRS) // symbol not found
|
||||
#define ADSERR_DEVICE_SYMBOLVERSIONINVALID (0x11+ERR_ADSERRS) // symbol version invalid
|
||||
#define ADSERR_DEVICE_INVALIDSTATE (0x12+ERR_ADSERRS) // server is in invalid state
|
||||
#define ADSERR_DEVICE_TRANSMODENOTSUPP (0x13+ERR_ADSERRS) // AdsTransMode not supported
|
||||
#define ADSERR_DEVICE_NOTIFYHNDINVALID (0x14+ERR_ADSERRS) // Notification handle is invalid
|
||||
#define ADSERR_DEVICE_CLIENTUNKNOWN (0x15+ERR_ADSERRS) // Notification client not registered
|
||||
#define ADSERR_DEVICE_NOMOREHDLS (0x16+ERR_ADSERRS) // no more notification handles
|
||||
#define ADSERR_DEVICE_INVALIDWATCHSIZE (0x17+ERR_ADSERRS) // size for watch to big
|
||||
#define ADSERR_DEVICE_NOTINIT (0x18+ERR_ADSERRS) // device not initialized
|
||||
#define ADSERR_DEVICE_TIMEOUT (0x19+ERR_ADSERRS) // device has a timeout
|
||||
#define ADSERR_DEVICE_NOINTERFACE (0x1A+ERR_ADSERRS) // query interface failed
|
||||
#define ADSERR_DEVICE_INVALIDINTERFACE (0x1B+ERR_ADSERRS) // wrong interface required
|
||||
#define ADSERR_DEVICE_INVALIDCLSID (0x1C+ERR_ADSERRS) // class ID is invalid
|
||||
#define ADSERR_DEVICE_INVALIDOBJID (0x1D+ERR_ADSERRS) // object ID is invalid
|
||||
#define ADSERR_DEVICE_PENDING (0x1E+ERR_ADSERRS) // request is pending
|
||||
#define ADSERR_DEVICE_ABORTED (0x1F+ERR_ADSERRS) // request is aborted
|
||||
#define ADSERR_DEVICE_WARNING (0x20+ERR_ADSERRS) // signal warning
|
||||
#define ADSERR_DEVICE_INVALIDARRAYIDX (0x21+ERR_ADSERRS) // invalid array index
|
||||
#define ADSERR_DEVICE_SYMBOLNOTACTIVE (0x22+ERR_ADSERRS) // symbol not active -> release handle and try again
|
||||
#define ADSERR_DEVICE_ACCESSDENIED (0x23+ERR_ADSERRS) // access denied
|
||||
#define ADSERR_DEVICE_LICENSENOTFOUND (0x24+ERR_ADSERRS) // no license found
|
||||
#define ADSERR_DEVICE_LICENSEEXPIRED (0x25+ERR_ADSERRS) // license expired
|
||||
#define ADSERR_DEVICE_LICENSEEXCEEDED (0x26+ERR_ADSERRS) // license exceeded
|
||||
#define ADSERR_DEVICE_LICENSEINVALID (0x27+ERR_ADSERRS) // license invalid
|
||||
#define ADSERR_DEVICE_LICENSESYSTEMID (0x28+ERR_ADSERRS) // license invalid system id
|
||||
#define ADSERR_DEVICE_LICENSENOTIMELIMIT (0x29+ERR_ADSERRS) // license not time limited
|
||||
#define ADSERR_DEVICE_LICENSEFUTUREISSUE (0x2A+ERR_ADSERRS) // license issue time in the future
|
||||
#define ADSERR_DEVICE_LICENSETIMETOLONG (0x2B+ERR_ADSERRS) // license time period to long
|
||||
#define ADSERR_DEVICE_EXCEPTION (0x2C+ERR_ADSERRS) // exception in device specific code
|
||||
#define ADSERR_DEVICE_LICENSEDUPLICATED (0x2D+ERR_ADSERRS) // license file read twice
|
||||
#define ADSERR_DEVICE_SIGNATUREINVALID (0x2E+ERR_ADSERRS) // invalid signature
|
||||
#define ADSERR_DEVICE_CERTIFICATEINVALID (0x2F+ERR_ADSERRS) // public key certificate
|
||||
//
|
||||
#define ADSERR_CLIENT_ERROR (0x40+ERR_ADSERRS) // Error class < client error >
|
||||
#define ADSERR_CLIENT_INVALIDPARM (0x41+ERR_ADSERRS) // invalid parameter at service call
|
||||
#define ADSERR_CLIENT_LISTEMPTY (0x42+ERR_ADSERRS) // polling list is empty
|
||||
#define ADSERR_CLIENT_VARUSED (0x43+ERR_ADSERRS) // var connection already in use
|
||||
#define ADSERR_CLIENT_DUPLINVOKEID (0x44+ERR_ADSERRS) // invoke id in use
|
||||
#define ADSERR_CLIENT_SYNCTIMEOUT (0x45+ERR_ADSERRS) // timeout elapsed
|
||||
#define ADSERR_CLIENT_W32ERROR (0x46+ERR_ADSERRS) // error in win32 subsystem
|
||||
#define ADSERR_CLIENT_TIMEOUTINVALID (0x47+ERR_ADSERRS) // ?
|
||||
#define ADSERR_CLIENT_PORTNOTOPEN (0x48+ERR_ADSERRS) // ads dll
|
||||
#define ADSERR_CLIENT_NOAMSADDR (0x49+ERR_ADSERRS) // ads dll
|
||||
#define ADSERR_CLIENT_SYNCINTERNAL (0x50+ERR_ADSERRS) // internal error in ads sync
|
||||
#define ADSERR_CLIENT_ADDHASH (0x51+ERR_ADSERRS) // hash table overflow
|
||||
#define ADSERR_CLIENT_REMOVEHASH (0x52+ERR_ADSERRS) // key not found in hash table
|
||||
#define ADSERR_CLIENT_NOMORESYM (0x53+ERR_ADSERRS) // no more symbols in cache
|
||||
#define ADSERR_CLIENT_SYNCRESINVALID (0x54+ERR_ADSERRS) // invalid response received
|
||||
#define ADSERR_CLIENT_SYNCPORTLOCKED (0x55+ERR_ADSERRS) // sync port is locked
|
||||
|
||||
#pragma pack( push, 1)
|
||||
typedef struct AmsNetId_
|
||||
{
|
||||
unsigned char b[6];
|
||||
|
||||
} AmsNetId, *PAmsNetId;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
AmsNetId netId;
|
||||
unsigned short port;
|
||||
} AmsAddr, *PAmsAddr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char version;
|
||||
unsigned char revision;
|
||||
unsigned short build;
|
||||
} AdsVersion;
|
||||
|
||||
typedef AdsVersion* PAdsVersion;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef enum nAdsTransMode
|
||||
{
|
||||
ADSTRANS_NOTRANS = 0,
|
||||
ADSTRANS_CLIENTCYCLE = 1,
|
||||
ADSTRANS_CLIENTONCHA = 2,
|
||||
ADSTRANS_SERVERCYCLE = 3,
|
||||
ADSTRANS_SERVERONCHA = 4,
|
||||
}ADSTRANSMODE;
|
||||
|
||||
typedef enum nAdsState
|
||||
{
|
||||
ADSSTATE_INVALID = 0,
|
||||
ADSSTATE_IDLE = 1,
|
||||
ADSSTATE_RESET = 2,
|
||||
ADSSTATE_INIT = 3,
|
||||
ADSSTATE_START = 4,
|
||||
ADSSTATE_RUN = 5,
|
||||
ADSSTATE_STOP = 6,
|
||||
ADSSTATE_SAVECFG = 7,
|
||||
ADSSTATE_LOADCFG = 8,
|
||||
ADSSTATE_POWERFAILURE = 9,
|
||||
ADSSTATE_POWERGOOD = 10,
|
||||
ADSSTATE_ERROR = 11,
|
||||
ADSSTATE_SHUTDOWN = 12,
|
||||
ADSSTATE_SUSPEND = 13,
|
||||
ADSSTATE_RESUME = 14,
|
||||
ADSSTATE_CONFIG = 15,
|
||||
ADSSTATE_RECONFIG = 16,
|
||||
ADSSTATE_STOPPING = 17,
|
||||
ADSSTATE_MAXSTATES
|
||||
} ADSSTATE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long cbLength;
|
||||
ADSTRANSMODE nTransMode;
|
||||
unsigned long nMaxDelay;
|
||||
union
|
||||
{
|
||||
unsigned long nCycleTime;
|
||||
unsigned long dwChangeFilter;
|
||||
};
|
||||
} AdsNotificationAttrib, *PAdsNotificationAttrib;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned long hNotification;
|
||||
__int64 nTimeStamp;
|
||||
unsigned long cbSampleSize;
|
||||
unsigned char data[ANYSIZE_ARRAY];
|
||||
} AdsNotificationHeader, *PAdsNotificationHeader;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define ADSNOTIFICATION_PDATA( pAdsNotificationHeader ) \
|
||||
( (unsigned char*) (((PAdsNotificationHeader)pAdsNotificationHeader->data )
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef void (__stdcall *PAdsNotificationFuncEx)( AmsAddr* pAddr,
|
||||
AdsNotificationHeader* pNotification,
|
||||
unsigned long hUser
|
||||
);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define ADSSYMBOLFLAG_PERSISTENT 0x00000001
|
||||
#define ADSSYMBOLFLAG_BITVALUE 0x00000002
|
||||
#define ADSSYMBOLFLAG_REFERENCETO 0x0004
|
||||
#define ADSSYMBOLFLAG_TYPEGUID 0x0008
|
||||
#define ADSSYMBOLFLAG_TCCOMIFACEPTR 0x0010
|
||||
#define ADSSYMBOLFLAG_READONLY 0x0020
|
||||
#define ADSSYMBOLFLAG_CONTEXTMASK 0x0F00
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADS data types
|
||||
typedef char ADS_INT8;
|
||||
typedef unsigned char ADS_UINT8;
|
||||
typedef short ADS_INT16;
|
||||
typedef unsigned short ADS_UINT16;
|
||||
typedef long ADS_INT32;
|
||||
typedef unsigned long ADS_UINT32;
|
||||
typedef __int64 ADS_INT64;
|
||||
typedef unsigned __int64 ADS_UINT64;
|
||||
typedef float ADS_REAL32;
|
||||
typedef double ADS_REAL64;
|
||||
typedef long double ADS_REAL80;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADS symbol information
|
||||
typedef struct
|
||||
{
|
||||
unsigned long entryLength; // length of complete symbol entry
|
||||
unsigned long iGroup; // indexGroup of symbol: input, output etc.
|
||||
unsigned long iOffs; // indexOffset of symbol
|
||||
unsigned long size; // size of symbol ( in bytes, 0 = bit )
|
||||
unsigned long dataType; // adsDataType of symbol
|
||||
unsigned long flags; // see above
|
||||
unsigned short nameLength; // length of symbol name (excl. \0)
|
||||
unsigned short typeLength; // length of type name (excl. \0)
|
||||
unsigned short commentLength; // length of comment (excl. \0)
|
||||
} AdsSymbolEntry, *PAdsSymbolEntry, **PPAdsSymbolEntry;
|
||||
|
||||
|
||||
#define PADSSYMBOLNAME(p) ((char*)(((PAdsSymbolEntry)p)+1))
|
||||
#define PADSSYMBOLTYPE(p) (((char*)(((PAdsSymbolEntry)p)+1))+((PAdsSymbolEntry)p)->nameLength+1)
|
||||
#define PADSSYMBOLCOMMENT(p) (((char*)(((PAdsSymbolEntry)p)+1))+((PAdsSymbolEntry)p)->nameLength+1+((PAdsSymbolEntry)p)->typeLength+1)
|
||||
|
||||
#define PADSNEXTSYMBOLENTRY(pEntry) (*((unsigned long*)(((char*)pEntry)+((PAdsSymbolEntry)pEntry)->entryLength)) \
|
||||
? ((PAdsSymbolEntry)(((char*)pEntry)+((PAdsSymbolEntry)pEntry)->entryLength)): NULL)
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define ADSDATATYPEFLAG_DATATYPE 0x00000001
|
||||
#define ADSDATATYPEFLAG_DATAITEM 0x00000002
|
||||
|
||||
#define ADSDATATYPE_VERSION_NEWEST 0x00000001
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long lBound;
|
||||
unsigned long elements;
|
||||
} AdsDatatypeArrayInfo, *PAdsDatatypeArrayInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ADS_UINT32 entryLength; // length of complete datatype entry
|
||||
ADS_UINT32 version; // version of datatype structure
|
||||
union {
|
||||
ADS_UINT32 hashValue; // hashValue of datatype to compare datatypes
|
||||
ADS_UINT32 offsGetCode; // code offset to getter method
|
||||
};
|
||||
union {
|
||||
ADS_UINT32 typeHashValue; // hashValue of base type
|
||||
ADS_UINT32 offsSetCode; // code offset to setter method
|
||||
};
|
||||
ADS_UINT32 size; // size of datatype ( in bytes )
|
||||
ADS_UINT32 offs; // offs of dataitem in parent datatype ( in bytes )
|
||||
ADS_UINT32 dataType; // adsDataType of symbol (if alias)
|
||||
ADS_UINT32 flags; //
|
||||
ADS_UINT16 nameLength; // length of datatype name (excl. \0)
|
||||
ADS_UINT16 typeLength; // length of dataitem type name (excl. \0)
|
||||
ADS_UINT16 commentLength; // length of comment (excl. \0)
|
||||
ADS_UINT16 arrayDim; //
|
||||
ADS_UINT16 subItems; //
|
||||
// ADS_INT8 name[]; // name of datatype with terminating \0
|
||||
// ADS_INT8 type[]; // type name of dataitem with terminating \0
|
||||
// ADS_INT8 comment[]; // comment of datatype with terminating \0
|
||||
// AdsDatatypeArrayInfo array[];
|
||||
// AdsDatatypeEntry subItems[];
|
||||
// GUID typeGuid; // typeGuid of this type if ADSDATATYPEFLAG_TYPEGUID is set
|
||||
// ADS_UINT8 copyMask[]; // "size" bytes containing 0xff or 0x00 - 0x00 means ignore byte (ADSIGRP_SYM_VALBYHND_WITHMASK)
|
||||
} AdsDatatypeEntry, *PAdsDatatypeEntry, **PPAdsDatatypeEntry;
|
||||
|
||||
#define PADSDATATYPENAME(p) ((PCHAR)(((PAdsDatatypeEntry)p)+1))
|
||||
#define PADSDATATYPETYPE(p) (((PCHAR)(((PAdsDatatypeEntry)p)+1))+((PAdsDatatypeEntry)p)->nameLength+1)
|
||||
#define PADSDATATYPECOMMENT(p) (((PCHAR)(((PAdsDatatypeEntry)p)+1))+((PAdsDatatypeEntry)p)->nameLength+1+((PAdsDatatypeEntry)p)->typeLength+1)
|
||||
#define PADSDATATYPEARRAYINFO(p) (PAdsDatatypeArrayInfo)(((PCHAR)(((PAdsDatatypeEntry)p)+1))+((PAdsDatatypeEntry)p)->nameLength+1+((PAdsDatatypeEntry)p)->typeLength+1+((PAdsDatatypeEntry)p)->commentLength+1)
|
||||
|
||||
__inline PAdsDatatypeEntry AdsDatatypeStructItem(PAdsDatatypeEntry p, unsigned short iItem)
|
||||
{
|
||||
unsigned short i;
|
||||
PAdsDatatypeEntry pItem;
|
||||
if ( iItem >= p->subItems )
|
||||
return NULL;
|
||||
pItem = (PAdsDatatypeEntry)(((unsigned char*)(p+1))+p->nameLength+p->typeLength+p->commentLength+3+p->arrayDim*sizeof(AdsDatatypeArrayInfo));
|
||||
for ( i=0; i < iItem; i++ )
|
||||
pItem = (PAdsDatatypeEntry)(((unsigned char*)pItem)+pItem->entryLength);
|
||||
return pItem;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned long nSymbols;
|
||||
unsigned long nSymSize;
|
||||
} AdsSymbolUploadInfo, *PAdsSymbolUploadInfo;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned long nSymbols;
|
||||
unsigned long nSymSize;
|
||||
unsigned long nDatatypes;
|
||||
unsigned long nDatatypeSize;
|
||||
unsigned long nMaxDynSymbols;
|
||||
unsigned long nUsedDynSymbols;
|
||||
} AdsSymbolUploadInfo2, *PAdsSymbolUploadInfo2;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned long indexGroup;
|
||||
unsigned long indexOffset;
|
||||
unsigned long cbLength;
|
||||
} AdsSymbolInfoByName, *PAdsSymbolInfoByName;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AMS events
|
||||
typedef enum nAmsRouterEvent
|
||||
{
|
||||
AMSEVENT_ROUTERSTOP = 0,
|
||||
AMSEVENT_ROUTERSTART = 1,
|
||||
AMSEVENT_ROUTERREMOVED = 2
|
||||
}AmsRouterEvent;
|
||||
|
||||
typedef void (*PAmsRouterNotificationFunc)( long nEvent );
|
||||
typedef void ( __stdcall *PAmsRouterNotificationFuncEx)( long nEvent );
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
#endif // __ADSDEF_H__
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,244 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File: TcAdsAPI.h
|
||||
// Description: Prototypes and Definitions for non C++ Applications
|
||||
// Author: RamonB
|
||||
// Created: Wed Nov 6 10:00:00 1996
|
||||
//
|
||||
//
|
||||
// BECKHOFF-Industrieelektronik-GmbH
|
||||
//
|
||||
// Modifications:
|
||||
// KlausBue 11/1999
|
||||
// Register Callback for Router notifications
|
||||
//
|
||||
// ChristophC 16/07/2001
|
||||
// Double definition of router callback function removed
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef __ADSAPI_H__
|
||||
#define __ADSAPI_H__
|
||||
|
||||
#define ADSAPIERR_NOERROR 0x0000
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsGetDllVersion( void );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsPortOpen( void );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsPortClose( void );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsGetLocalAddress( AmsAddr* pAddr );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncWriteReq( AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to write
|
||||
void* pData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to read
|
||||
void* pData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadReqEx( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to read
|
||||
void* pData, // pointer to the client buffer
|
||||
unsigned long* pcbReturn // count of bytes read
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadWriteReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long cbReadLength, // count of bytes to read
|
||||
void* pReadData, // pointer to the client buffer
|
||||
unsigned long cbWriteLength, // count of bytes to write
|
||||
void* pWriteData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadWriteReqEx( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long cbReadLength, // count of bytes to read
|
||||
void* pReadData, // pointer to the client buffer
|
||||
unsigned long cbWriteLength, // count of bytes to write
|
||||
void* pWriteData, // pointer to the client buffer
|
||||
unsigned long* pcbReturn // count of bytes read
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadDeviceInfoReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
char* pDevName,// fixed length string (16 Byte)
|
||||
AdsVersion* pVersion // client buffer to store server version
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncWriteControlReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned short adsState, // index group in ADS server interface
|
||||
unsigned short deviceState,// index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to write
|
||||
void* pData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadStateReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned short* pAdsState, // pointer to client buffer
|
||||
unsigned short* pDeviceState// pointer to the client buffer
|
||||
);
|
||||
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncAddDeviceNotificationReq( AmsAddr* pAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset,// index offset in ADS server interface
|
||||
AdsNotificationAttrib* pNoteAttrib, // attributes of notification request
|
||||
PAdsNotificationFuncEx pNoteFunc, // address of notification callback
|
||||
unsigned long hUser, // user handle
|
||||
unsigned long *pNotification // pointer to notification handle (return value)
|
||||
);
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncDelDeviceNotificationReq( AmsAddr* pAddr,// Ams address of ADS server
|
||||
unsigned long hNotification // notification handle
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncSetTimeout( long nMs ); // Set timeout in ms
|
||||
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsGetLastError( void );
|
||||
|
||||
|
||||
/// register callback
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsAmsRegisterRouterNotification (PAmsRouterNotificationFuncEx pNoteFunc );
|
||||
|
||||
/// unregister callback
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsAmsUnRegisterRouterNotification ();
|
||||
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncGetTimeout(long *pnMs ); // client buffer to store timeout
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsAmsPortEnabled(BOOL *pbEnabled);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// new Ads functions for multithreading applications
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsPortOpenEx( );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsPortCloseEx( long port );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsGetLocalAddressEx(long port, AmsAddr* pAddr );
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncWriteReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to write
|
||||
void* pData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadReqEx2( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to read
|
||||
void* pData, // pointer to the client buffer
|
||||
unsigned long* pcbReturn // count of bytes read
|
||||
);
|
||||
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadWriteReqEx2( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
unsigned long cbReadLength, // count of bytes to read
|
||||
void* pReadData, // pointer to the client buffer
|
||||
unsigned long cbWriteLength, // count of bytes to write
|
||||
void* pWriteData, // pointer to the client buffer
|
||||
unsigned long* pcbReturn // count of bytes read
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadDeviceInfoReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
char* pDevName, // fixed length string (16 Byte)
|
||||
AdsVersion* pVersion // client buffer to store server version
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncWriteControlReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned short adsState, // index group in ADS server interface
|
||||
unsigned short deviceState, // index offset in ADS server interface
|
||||
unsigned long length, // count of bytes to write
|
||||
void* pData // pointer to the client buffer
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncReadStateReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS server
|
||||
unsigned short* pAdsState, // pointer to client buffer
|
||||
unsigned short* pDeviceState // pointer to the client buffer
|
||||
);
|
||||
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncAddDeviceNotificationReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS ser
|
||||
unsigned long indexGroup, // index group in ADS server interface
|
||||
unsigned long indexOffset, // index offset in ADS server interface
|
||||
AdsNotificationAttrib* pNoteAttrib, // attributes of notification request
|
||||
PAdsNotificationFuncEx pNoteFunc, // address of notification callback
|
||||
unsigned long hUser, // user handle
|
||||
unsigned long *pNotification // pointer to notification handle (return value)
|
||||
);
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncDelDeviceNotificationReqEx( long port, // Ams port of ADS client
|
||||
AmsAddr* pServerAddr, // Ams address of ADS ser
|
||||
unsigned long hNotification // notification handle
|
||||
);
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncSetTimeoutEx(long port, // Ams port of ADS client
|
||||
long nMs ); // Set timeout in ms
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsSyncGetTimeoutEx(long port, // Ams port of ADS client
|
||||
long *pnMs ); // client buffer to store timeout
|
||||
|
||||
__declspec( dllexport )
|
||||
long __stdcall AdsAmsPortEnabledEx(long nPort, BOOL *pbEnabled);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,416 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// This is a part of the Beckhoff TwinCAT ADS API
|
||||
// Copyright (C) Beckhoff Automation GmbH
|
||||
// All rights reserved.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __ADSDEF_H__
|
||||
#define __ADSDEF_H__
|
||||
|
||||
#ifndef ANYSIZE_ARRAY
|
||||
#define ANYSIZE_ARRAY 1
|
||||
#endif
|
||||
|
||||
#define ADS_FIXEDNAMESIZE 16
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AMS Ports
|
||||
#define AMSPORT_LOGGER 100
|
||||
#define AMSPORT_R0_RTIME 200
|
||||
#define AMSPORT_R0_TRACE (AMSPORT_R0_RTIME+90)
|
||||
#define AMSPORT_R0_IO 300
|
||||
#define AMSPORT_R0_SPS 400
|
||||
#define AMSPORT_R0_NC 500
|
||||
#define AMSPORT_R0_ISG 550
|
||||
#define AMSPORT_R0_PCS 600
|
||||
#define AMSPORT_R0_PLC 801
|
||||
#define AMSPORT_R0_PLC_RTS1 801
|
||||
#define AMSPORT_R0_PLC_RTS2 811
|
||||
#define AMSPORT_R0_PLC_RTS3 821
|
||||
#define AMSPORT_R0_PLC_RTS4 831
|
||||
#define AMSPORT_R0_PLC_TC3 851
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADS Cmd Ids
|
||||
#define ADSSRVID_INVALID 0x00
|
||||
#define ADSSRVID_READDEVICEINFO 0x01
|
||||
#define ADSSRVID_READ 0x02
|
||||
#define ADSSRVID_WRITE 0x03
|
||||
#define ADSSRVID_READSTATE 0x04
|
||||
#define ADSSRVID_WRITECTRL 0x05
|
||||
#define ADSSRVID_ADDDEVICENOTE 0x06
|
||||
#define ADSSRVID_DELDEVICENOTE 0x07
|
||||
#define ADSSRVID_DEVICENOTE 0x08
|
||||
#define ADSSRVID_READWRITE 0x09
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADS reserved index groups
|
||||
#define ADSIGRP_SYMTAB 0xF000
|
||||
#define ADSIGRP_SYMNAME 0xF001
|
||||
#define ADSIGRP_SYMVAL 0xF002
|
||||
|
||||
#define ADSIGRP_SYM_HNDBYNAME 0xF003
|
||||
#define ADSIGRP_SYM_VALBYNAME 0xF004
|
||||
#define ADSIGRP_SYM_VALBYHND 0xF005
|
||||
#define ADSIGRP_SYM_RELEASEHND 0xF006
|
||||
#define ADSIGRP_SYM_INFOBYNAME 0xF007
|
||||
#define ADSIGRP_SYM_VERSION 0xF008
|
||||
#define ADSIGRP_SYM_INFOBYNAMEEX 0xF009
|
||||
|
||||
#define ADSIGRP_SYM_DOWNLOAD 0xF00A
|
||||
#define ADSIGRP_SYM_UPLOAD 0xF00B
|
||||
#define ADSIGRP_SYM_UPLOADINFO 0xF00C
|
||||
#define ADSIGRP_SYM_DOWNLOAD2 0xF00D
|
||||
#define ADSIGRP_SYM_DT_UPLOAD 0xF00E
|
||||
#define ADSIGRP_SYM_UPLOADINFO2 0xF00F
|
||||
|
||||
#define ADSIGRP_SYMNOTE 0xF010 // notification of named handle
|
||||
|
||||
#define ADSIGRP_SUMUP_READ 0xF080 // AdsRW IOffs list size or 0 (=0 -> list size == WLength/3*sizeof(ULONG))
|
||||
// W: {list of IGrp, IOffs, Length}
|
||||
// if IOffs != 0 then R: {list of results} and {list of data}
|
||||
// if IOffs == 0 then R: only data (sum result)
|
||||
#define ADSIGRP_SUMUP_WRITE 0xF081 // AdsRW IOffs list size
|
||||
// W: {list of IGrp, IOffs, Length} followed by {list of data}
|
||||
// R: list of results
|
||||
#define ADSIGRP_SUMUP_READWRITE 0xF082 // AdsRW IOffs list size
|
||||
// W: {list of IGrp, IOffs, RLength, WLength} followed by {list of data}
|
||||
// R: {list of results, RLength} followed by {list of data}
|
||||
#define ADSIGRP_SUMUP_READEX 0xF083 // AdsRW IOffs list size
|
||||
// W: {list of IGrp, IOffs, Length}
|
||||
#define ADSIGRP_SUMUP_READEX2 0xF084 // AdsRW IOffs list size
|
||||
// W: {list of IGrp, IOffs, Length}
|
||||
// R: {list of results, Length} followed by {list of data (returned lengths)}
|
||||
#define ADSIGRP_SUMUP_ADDDEVNOTE 0xF085 // AdsRW IOffs list size
|
||||
// W: {list of IGrp, IOffs, Attrib}
|
||||
// R: {list of results, handles}
|
||||
#define ADSIGRP_SUMUP_DELDEVNOTE 0xF086 // AdsRW IOffs list size
|
||||
// W: {list of handles}
|
||||
// R: {list of results, Length} followed by {list of data}
|
||||
|
||||
#define ADSIGRP_IOIMAGE_RWIB 0xF020 // read/write input byte(s)
|
||||
#define ADSIGRP_IOIMAGE_RWIX 0xF021 // read/write input bit
|
||||
#define ADSIGRP_IOIMAGE_RISIZE 0xF025 // read input size (in byte)
|
||||
#define ADSIGRP_IOIMAGE_RWOB 0xF030 // read/write output byte(s)
|
||||
#define ADSIGRP_IOIMAGE_RWOX 0xF031 // read/write output bit
|
||||
#define ADSIGRP_IOIMAGE_CLEARI 0xF040 // write inputs to null
|
||||
#define ADSIGRP_IOIMAGE_CLEARO 0xF050 // write outputs to null
|
||||
#define ADSIGRP_IOIMAGE_RWIOB 0xF060 // read input and write output byte(s)
|
||||
|
||||
#define ADSIGRP_DEVICE_DATA 0xF100 // state, name, etc...
|
||||
#define ADSIOFFS_DEVDATA_ADSSTATE 0x0000 // ads state of device
|
||||
#define ADSIOFFS_DEVDATA_DEVSTATE 0x0002 // device state
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADS Return codes
|
||||
#define ADSERR_NOERR 0x00
|
||||
#define ERR_ADSERRS 0x0700
|
||||
|
||||
#define ADSERR_DEVICE_ERROR (0x00+ERR_ADSERRS) // Error class < device error >
|
||||
#define ADSERR_DEVICE_SRVNOTSUPP (0x01+ERR_ADSERRS) // Service is not supported by server
|
||||
#define ADSERR_DEVICE_INVALIDGRP (0x02+ERR_ADSERRS) // invalid indexGroup
|
||||
#define ADSERR_DEVICE_INVALIDOFFSET (0x03+ERR_ADSERRS) // invalid indexOffset
|
||||
#define ADSERR_DEVICE_INVALIDACCESS (0x04+ERR_ADSERRS) // reading/writing not permitted
|
||||
#define ADSERR_DEVICE_INVALIDSIZE (0x05+ERR_ADSERRS) // parameter size not correct
|
||||
#define ADSERR_DEVICE_INVALIDDATA (0x06+ERR_ADSERRS) // invalid parameter value(s)
|
||||
#define ADSERR_DEVICE_NOTREADY (0x07+ERR_ADSERRS) // device is not in a ready state
|
||||
#define ADSERR_DEVICE_BUSY (0x08+ERR_ADSERRS) // device is busy
|
||||
#define ADSERR_DEVICE_INVALIDCONTEXT (0x09+ERR_ADSERRS) // invalid context (must be InWindows)
|
||||
#define ADSERR_DEVICE_NOMEMORY (0x0A+ERR_ADSERRS) // out of memory
|
||||
#define ADSERR_DEVICE_INVALIDPARM (0x0B+ERR_ADSERRS) // invalid parameter value(s)
|
||||
#define ADSERR_DEVICE_NOTFOUND (0x0C+ERR_ADSERRS) // not found (files, ...)
|
||||
#define ADSERR_DEVICE_SYNTAX (0x0D+ERR_ADSERRS) // syntax error in comand or file
|
||||
#define ADSERR_DEVICE_INCOMPATIBLE (0x0E+ERR_ADSERRS) // objects do not match
|
||||
#define ADSERR_DEVICE_EXISTS (0x0F+ERR_ADSERRS) // object already exists
|
||||
#define ADSERR_DEVICE_SYMBOLNOTFOUND (0x10+ERR_ADSERRS) // symbol not found
|
||||
#define ADSERR_DEVICE_SYMBOLVERSIONINVALID (0x11+ERR_ADSERRS) // symbol version invalid
|
||||
#define ADSERR_DEVICE_INVALIDSTATE (0x12+ERR_ADSERRS) // server is in invalid state
|
||||
#define ADSERR_DEVICE_TRANSMODENOTSUPP (0x13+ERR_ADSERRS) // AdsTransMode not supported
|
||||
#define ADSERR_DEVICE_NOTIFYHNDINVALID (0x14+ERR_ADSERRS) // Notification handle is invalid
|
||||
#define ADSERR_DEVICE_CLIENTUNKNOWN (0x15+ERR_ADSERRS) // Notification client not registered
|
||||
#define ADSERR_DEVICE_NOMOREHDLS (0x16+ERR_ADSERRS) // no more notification handles
|
||||
#define ADSERR_DEVICE_INVALIDWATCHSIZE (0x17+ERR_ADSERRS) // size for watch to big
|
||||
#define ADSERR_DEVICE_NOTINIT (0x18+ERR_ADSERRS) // device not initialized
|
||||
#define ADSERR_DEVICE_TIMEOUT (0x19+ERR_ADSERRS) // device has a timeout
|
||||
#define ADSERR_DEVICE_NOINTERFACE (0x1A+ERR_ADSERRS) // query interface failed
|
||||
#define ADSERR_DEVICE_INVALIDINTERFACE (0x1B+ERR_ADSERRS) // wrong interface required
|
||||
#define ADSERR_DEVICE_INVALIDCLSID (0x1C+ERR_ADSERRS) // class ID is invalid
|
||||
#define ADSERR_DEVICE_INVALIDOBJID (0x1D+ERR_ADSERRS) // object ID is invalid
|
||||
#define ADSERR_DEVICE_PENDING (0x1E+ERR_ADSERRS) // request is pending
|
||||
#define ADSERR_DEVICE_ABORTED (0x1F+ERR_ADSERRS) // request is aborted
|
||||
#define ADSERR_DEVICE_WARNING (0x20+ERR_ADSERRS) // signal warning
|
||||
#define ADSERR_DEVICE_INVALIDARRAYIDX (0x21+ERR_ADSERRS) // invalid array index
|
||||
#define ADSERR_DEVICE_SYMBOLNOTACTIVE (0x22+ERR_ADSERRS) // symbol not active -> release handle and try again
|
||||
#define ADSERR_DEVICE_ACCESSDENIED (0x23+ERR_ADSERRS) // access denied
|
||||
#define ADSERR_DEVICE_LICENSENOTFOUND (0x24+ERR_ADSERRS) // no license found
|
||||
#define ADSERR_DEVICE_LICENSEEXPIRED (0x25+ERR_ADSERRS) // license expired
|
||||
#define ADSERR_DEVICE_LICENSEEXCEEDED (0x26+ERR_ADSERRS) // license exceeded
|
||||
#define ADSERR_DEVICE_LICENSEINVALID (0x27+ERR_ADSERRS) // license invalid
|
||||
#define ADSERR_DEVICE_LICENSESYSTEMID (0x28+ERR_ADSERRS) // license invalid system id
|
||||
#define ADSERR_DEVICE_LICENSENOTIMELIMIT (0x29+ERR_ADSERRS) // license not time limited
|
||||
#define ADSERR_DEVICE_LICENSEFUTUREISSUE (0x2A+ERR_ADSERRS) // license issue time in the future
|
||||
#define ADSERR_DEVICE_LICENSETIMETOLONG (0x2B+ERR_ADSERRS) // license time period to long
|
||||
#define ADSERR_DEVICE_EXCEPTION (0x2C+ERR_ADSERRS) // exception in device specific code
|
||||
#define ADSERR_DEVICE_LICENSEDUPLICATED (0x2D+ERR_ADSERRS) // license file read twice
|
||||
#define ADSERR_DEVICE_SIGNATUREINVALID (0x2E+ERR_ADSERRS) // invalid signature
|
||||
#define ADSERR_DEVICE_CERTIFICATEINVALID (0x2F+ERR_ADSERRS) // public key certificate
|
||||
//
|
||||
#define ADSERR_CLIENT_ERROR (0x40+ERR_ADSERRS) // Error class < client error >
|
||||
#define ADSERR_CLIENT_INVALIDPARM (0x41+ERR_ADSERRS) // invalid parameter at service call
|
||||
#define ADSERR_CLIENT_LISTEMPTY (0x42+ERR_ADSERRS) // polling list is empty
|
||||
#define ADSERR_CLIENT_VARUSED (0x43+ERR_ADSERRS) // var connection already in use
|
||||
#define ADSERR_CLIENT_DUPLINVOKEID (0x44+ERR_ADSERRS) // invoke id in use
|
||||
#define ADSERR_CLIENT_SYNCTIMEOUT (0x45+ERR_ADSERRS) // timeout elapsed
|
||||
#define ADSERR_CLIENT_W32ERROR (0x46+ERR_ADSERRS) // error in win32 subsystem
|
||||
#define ADSERR_CLIENT_TIMEOUTINVALID (0x47+ERR_ADSERRS) // ?
|
||||
#define ADSERR_CLIENT_PORTNOTOPEN (0x48+ERR_ADSERRS) // ads dll
|
||||
#define ADSERR_CLIENT_NOAMSADDR (0x49+ERR_ADSERRS) // ads dll
|
||||
#define ADSERR_CLIENT_SYNCINTERNAL (0x50+ERR_ADSERRS) // internal error in ads sync
|
||||
#define ADSERR_CLIENT_ADDHASH (0x51+ERR_ADSERRS) // hash table overflow
|
||||
#define ADSERR_CLIENT_REMOVEHASH (0x52+ERR_ADSERRS) // key not found in hash table
|
||||
#define ADSERR_CLIENT_NOMORESYM (0x53+ERR_ADSERRS) // no more symbols in cache
|
||||
#define ADSERR_CLIENT_SYNCRESINVALID (0x54+ERR_ADSERRS) // invalid response received
|
||||
#define ADSERR_CLIENT_SYNCPORTLOCKED (0x55+ERR_ADSERRS) // sync port is locked
|
||||
|
||||
#pragma pack( push, 1)
|
||||
typedef struct AmsNetId_
|
||||
{
|
||||
unsigned char b[6];
|
||||
|
||||
} AmsNetId, *PAmsNetId;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
AmsNetId netId;
|
||||
unsigned short port;
|
||||
} AmsAddr, *PAmsAddr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char version;
|
||||
unsigned char revision;
|
||||
unsigned short build;
|
||||
} AdsVersion;
|
||||
|
||||
typedef AdsVersion* PAdsVersion;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef enum nAdsTransMode
|
||||
{
|
||||
ADSTRANS_NOTRANS = 0,
|
||||
ADSTRANS_CLIENTCYCLE = 1,
|
||||
ADSTRANS_CLIENTONCHA = 2,
|
||||
ADSTRANS_SERVERCYCLE = 3,
|
||||
ADSTRANS_SERVERONCHA = 4,
|
||||
}ADSTRANSMODE;
|
||||
|
||||
typedef enum nAdsState
|
||||
{
|
||||
ADSSTATE_INVALID = 0,
|
||||
ADSSTATE_IDLE = 1,
|
||||
ADSSTATE_RESET = 2,
|
||||
ADSSTATE_INIT = 3,
|
||||
ADSSTATE_START = 4,
|
||||
ADSSTATE_RUN = 5,
|
||||
ADSSTATE_STOP = 6,
|
||||
ADSSTATE_SAVECFG = 7,
|
||||
ADSSTATE_LOADCFG = 8,
|
||||
ADSSTATE_POWERFAILURE = 9,
|
||||
ADSSTATE_POWERGOOD = 10,
|
||||
ADSSTATE_ERROR = 11,
|
||||
ADSSTATE_SHUTDOWN = 12,
|
||||
ADSSTATE_SUSPEND = 13,
|
||||
ADSSTATE_RESUME = 14,
|
||||
ADSSTATE_CONFIG = 15,
|
||||
ADSSTATE_RECONFIG = 16,
|
||||
ADSSTATE_STOPPING = 17,
|
||||
ADSSTATE_MAXSTATES
|
||||
} ADSSTATE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long cbLength;
|
||||
ADSTRANSMODE nTransMode;
|
||||
unsigned long nMaxDelay;
|
||||
union
|
||||
{
|
||||
unsigned long nCycleTime;
|
||||
unsigned long dwChangeFilter;
|
||||
};
|
||||
} AdsNotificationAttrib, *PAdsNotificationAttrib;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned long hNotification;
|
||||
__int64 nTimeStamp;
|
||||
unsigned long cbSampleSize;
|
||||
unsigned char data[ANYSIZE_ARRAY];
|
||||
} AdsNotificationHeader, *PAdsNotificationHeader;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define ADSNOTIFICATION_PDATA( pAdsNotificationHeader ) \
|
||||
( (unsigned char*) (((PAdsNotificationHeader)pAdsNotificationHeader->data )
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef void (__stdcall *PAdsNotificationFuncEx)( AmsAddr* pAddr,
|
||||
AdsNotificationHeader* pNotification,
|
||||
unsigned long hUser
|
||||
);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define ADSSYMBOLFLAG_PERSISTENT 0x00000001
|
||||
#define ADSSYMBOLFLAG_BITVALUE 0x00000002
|
||||
#define ADSSYMBOLFLAG_REFERENCETO 0x0004
|
||||
#define ADSSYMBOLFLAG_TYPEGUID 0x0008
|
||||
#define ADSSYMBOLFLAG_TCCOMIFACEPTR 0x0010
|
||||
#define ADSSYMBOLFLAG_READONLY 0x0020
|
||||
#define ADSSYMBOLFLAG_CONTEXTMASK 0x0F00
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADS data types
|
||||
typedef char ADS_INT8;
|
||||
typedef unsigned char ADS_UINT8;
|
||||
typedef short ADS_INT16;
|
||||
typedef unsigned short ADS_UINT16;
|
||||
typedef long ADS_INT32;
|
||||
typedef unsigned long ADS_UINT32;
|
||||
typedef __int64 ADS_INT64;
|
||||
typedef unsigned __int64 ADS_UINT64;
|
||||
typedef float ADS_REAL32;
|
||||
typedef double ADS_REAL64;
|
||||
typedef long double ADS_REAL80;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADS symbol information
|
||||
typedef struct
|
||||
{
|
||||
unsigned long entryLength; // length of complete symbol entry
|
||||
unsigned long iGroup; // indexGroup of symbol: input, output etc.
|
||||
unsigned long iOffs; // indexOffset of symbol
|
||||
unsigned long size; // size of symbol ( in bytes, 0 = bit )
|
||||
unsigned long dataType; // adsDataType of symbol
|
||||
unsigned long flags; // see above
|
||||
unsigned short nameLength; // length of symbol name (excl. \0)
|
||||
unsigned short typeLength; // length of type name (excl. \0)
|
||||
unsigned short commentLength; // length of comment (excl. \0)
|
||||
} AdsSymbolEntry, *PAdsSymbolEntry, **PPAdsSymbolEntry;
|
||||
|
||||
|
||||
#define PADSSYMBOLNAME(p) ((char*)(((PAdsSymbolEntry)p)+1))
|
||||
#define PADSSYMBOLTYPE(p) (((char*)(((PAdsSymbolEntry)p)+1))+((PAdsSymbolEntry)p)->nameLength+1)
|
||||
#define PADSSYMBOLCOMMENT(p) (((char*)(((PAdsSymbolEntry)p)+1))+((PAdsSymbolEntry)p)->nameLength+1+((PAdsSymbolEntry)p)->typeLength+1)
|
||||
|
||||
#define PADSNEXTSYMBOLENTRY(pEntry) (*((unsigned long*)(((char*)pEntry)+((PAdsSymbolEntry)pEntry)->entryLength)) \
|
||||
? ((PAdsSymbolEntry)(((char*)pEntry)+((PAdsSymbolEntry)pEntry)->entryLength)): NULL)
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define ADSDATATYPEFLAG_DATATYPE 0x00000001
|
||||
#define ADSDATATYPEFLAG_DATAITEM 0x00000002
|
||||
|
||||
#define ADSDATATYPE_VERSION_NEWEST 0x00000001
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long lBound;
|
||||
unsigned long elements;
|
||||
} AdsDatatypeArrayInfo, *PAdsDatatypeArrayInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ADS_UINT32 entryLength; // length of complete datatype entry
|
||||
ADS_UINT32 version; // version of datatype structure
|
||||
union {
|
||||
ADS_UINT32 hashValue; // hashValue of datatype to compare datatypes
|
||||
ADS_UINT32 offsGetCode; // code offset to getter method
|
||||
};
|
||||
union {
|
||||
ADS_UINT32 typeHashValue; // hashValue of base type
|
||||
ADS_UINT32 offsSetCode; // code offset to setter method
|
||||
};
|
||||
ADS_UINT32 size; // size of datatype ( in bytes )
|
||||
ADS_UINT32 offs; // offs of dataitem in parent datatype ( in bytes )
|
||||
ADS_UINT32 dataType; // adsDataType of symbol (if alias)
|
||||
ADS_UINT32 flags; //
|
||||
ADS_UINT16 nameLength; // length of datatype name (excl. \0)
|
||||
ADS_UINT16 typeLength; // length of dataitem type name (excl. \0)
|
||||
ADS_UINT16 commentLength; // length of comment (excl. \0)
|
||||
ADS_UINT16 arrayDim; //
|
||||
ADS_UINT16 subItems; //
|
||||
// ADS_INT8 name[]; // name of datatype with terminating \0
|
||||
// ADS_INT8 type[]; // type name of dataitem with terminating \0
|
||||
// ADS_INT8 comment[]; // comment of datatype with terminating \0
|
||||
// AdsDatatypeArrayInfo array[];
|
||||
// AdsDatatypeEntry subItems[];
|
||||
// GUID typeGuid; // typeGuid of this type if ADSDATATYPEFLAG_TYPEGUID is set
|
||||
// ADS_UINT8 copyMask[]; // "size" bytes containing 0xff or 0x00 - 0x00 means ignore byte (ADSIGRP_SYM_VALBYHND_WITHMASK)
|
||||
} AdsDatatypeEntry, *PAdsDatatypeEntry, **PPAdsDatatypeEntry;
|
||||
|
||||
#define PADSDATATYPENAME(p) ((PCHAR)(((PAdsDatatypeEntry)p)+1))
|
||||
#define PADSDATATYPETYPE(p) (((PCHAR)(((PAdsDatatypeEntry)p)+1))+((PAdsDatatypeEntry)p)->nameLength+1)
|
||||
#define PADSDATATYPECOMMENT(p) (((PCHAR)(((PAdsDatatypeEntry)p)+1))+((PAdsDatatypeEntry)p)->nameLength+1+((PAdsDatatypeEntry)p)->typeLength+1)
|
||||
#define PADSDATATYPEARRAYINFO(p) (PAdsDatatypeArrayInfo)(((PCHAR)(((PAdsDatatypeEntry)p)+1))+((PAdsDatatypeEntry)p)->nameLength+1+((PAdsDatatypeEntry)p)->typeLength+1+((PAdsDatatypeEntry)p)->commentLength+1)
|
||||
|
||||
__inline PAdsDatatypeEntry AdsDatatypeStructItem(PAdsDatatypeEntry p, unsigned short iItem)
|
||||
{
|
||||
unsigned short i;
|
||||
PAdsDatatypeEntry pItem;
|
||||
if ( iItem >= p->subItems )
|
||||
return NULL;
|
||||
pItem = (PAdsDatatypeEntry)(((unsigned char*)(p+1))+p->nameLength+p->typeLength+p->commentLength+3+p->arrayDim*sizeof(AdsDatatypeArrayInfo));
|
||||
for ( i=0; i < iItem; i++ )
|
||||
pItem = (PAdsDatatypeEntry)(((unsigned char*)pItem)+pItem->entryLength);
|
||||
return pItem;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned long nSymbols;
|
||||
unsigned long nSymSize;
|
||||
} AdsSymbolUploadInfo, *PAdsSymbolUploadInfo;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned long nSymbols;
|
||||
unsigned long nSymSize;
|
||||
unsigned long nDatatypes;
|
||||
unsigned long nDatatypeSize;
|
||||
unsigned long nMaxDynSymbols;
|
||||
unsigned long nUsedDynSymbols;
|
||||
} AdsSymbolUploadInfo2, *PAdsSymbolUploadInfo2;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned long indexGroup;
|
||||
unsigned long indexOffset;
|
||||
unsigned long cbLength;
|
||||
} AdsSymbolInfoByName, *PAdsSymbolInfoByName;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AMS events
|
||||
typedef enum nAmsRouterEvent
|
||||
{
|
||||
AMSEVENT_ROUTERSTOP = 0,
|
||||
AMSEVENT_ROUTERSTART = 1,
|
||||
AMSEVENT_ROUTERREMOVED = 2
|
||||
}AmsRouterEvent;
|
||||
|
||||
typedef void (*PAmsRouterNotificationFunc)( long nEvent );
|
||||
typedef void ( __stdcall *PAmsRouterNotificationFuncEx)( long nEvent );
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
#endif // __ADSDEF_H__
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<access-policy>
|
||||
<cross-domain-access>
|
||||
<policy>
|
||||
<allow-from http-request-headers="*">
|
||||
<domain uri="http://*" />
|
||||
<domain uri="https://*" />
|
||||
</allow-from>
|
||||
<grant-to>
|
||||
<resource path="/" include-subpaths="true"/>
|
||||
<socket-resource port="4502-4534" protocol="tcp"/>
|
||||
</grant-to>
|
||||
</policy>
|
||||
</cross-domain-access>
|
||||
</access-policy>
|
||||
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
<?xml version ="1.0"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<requiredRuntime safemode="true" imageVersion="v2.0.50727" version="v2.0.50727"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,69 @@
|
||||
=================================================================================================================================================
|
||||
|
||||
Installation
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
1. Libraries
|
||||
|
||||
The following assemblies have to be installed to the "Global Assembly Cache":
|
||||
|
||||
"\Ads Api\TcAdsWcf\PollingDuplex\v3.0\System.ServiceModel.PollingDuplex.dll"
|
||||
"\Ads Api\TcAdsWcf\PollingDuplex\v4.0\System.ServiceModel.PollingDuplex.dll"
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
2. Install "TcAdsWcfHost.exe" as Windows Service
|
||||
|
||||
Step 1:
|
||||
|
||||
Open the command prompt as Administrator and use the InstallUtil.exe (part of the .NET Framework) to create the Windows service.
|
||||
|
||||
Step 2:
|
||||
|
||||
Switch to "Control Panel\Administrative Tools\Services" and start the "TcAdsWcfHost" Service.
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
3. Test if Service is running.
|
||||
|
||||
Open a browser and go to "http://localhost:8003/TwinCAT/Ads/Wcf/TcAdsService" to test the service.
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
=================================================================================================================================================
|
||||
|
||||
Logging
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Enable logging:
|
||||
|
||||
1. Open "TcAdsWcfHost.exe.config" in TcAdsWcf directory.
|
||||
|
||||
2. Navigate to the "userSettings/TwinCAT.Ads.Wcf.Properties.Settings" node.
|
||||
|
||||
<userSettings>
|
||||
<TwinCAT.Ads.Wcf.Properties.Settings>
|
||||
<setting name="LogLevel" serializeAs="String">
|
||||
<value>NONE</value>
|
||||
</setting>
|
||||
<setting name="LogFilePath" serializeAs="String">
|
||||
<value>C:\TcAdsWcf_Log.txt</value>
|
||||
</setting>
|
||||
</TwinCAT.Ads.Wcf.Properties.Settings>
|
||||
</userSettings>
|
||||
|
||||
3. Set the value of the "LogLevel" setting to "INFO" or "ERROR"
|
||||
|
||||
4. Define the path to the logfile as vaue of the "LogFilePath" setting.
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
LogLevel Description:
|
||||
|
||||
NONE: Nothing is logged.
|
||||
|
||||
INFO: Information about method calls with parameter values and errors are logged.
|
||||
|
||||
ERROR: Erros are logged.
|
||||
Binary file not shown.
@@ -0,0 +1,180 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="TwinCAT.Ads.Wcf.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<system.serviceModel>
|
||||
<services>
|
||||
<service behaviorConfiguration="MaxConcurrenceBehavior" name="TwinCAT.Ads.Wcf.TcAdsService">
|
||||
|
||||
<endpoint address="UnsecPollingDuplex3" binding="customBinding"
|
||||
bindingConfiguration="UnsecurePollingDuplex3BindingConfig" name="UnsecPollingDuplex3Endpoint"
|
||||
contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex" />
|
||||
|
||||
<endpoint address="SecPollingDuplex3" binding="customBinding"
|
||||
bindingConfiguration="SecurePollingDuplex3BindingConfig" name="SecPollingDuplex3Endpoint"
|
||||
contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="UnsecPollingDuplex4" binding="customBinding"
|
||||
bindingConfiguration="UnsecurePollingDuplex4BindingConfig" name="UnsecPollingDuplex4Endpoint"
|
||||
contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex" />
|
||||
|
||||
<endpoint address="SecPollingDuplex4" binding="customBinding"
|
||||
bindingConfiguration="SecurePollingDuplex4BindingConfig" name="SecPollingDuplex4Endpoint"
|
||||
contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="SecWsDualHttp" binding="wsDualHttpBinding"
|
||||
bindingConfiguration="SecureWsDualHttpBindingConfig" name="SecWsDualHttpEndpoint"
|
||||
contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="UnsecWsDualHttp" binding="wsDualHttpBinding"
|
||||
bindingConfiguration="UnsecureWsDualHttpBindingConfig" name="UnsecWsDualHttpEndpoint"
|
||||
contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="UnsecNetTcp" binding="netTcpBinding" bindingConfiguration="UnsecureNetTcpBindingConfig"
|
||||
name="UnsecNetTcpEndpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="SecNetTcp" binding="netTcpBinding" bindingConfiguration="SecureNetTcpBindingConfig"
|
||||
name="SecNetTcpEndpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="SecBasicHttp" binding="basicHttpBinding" bindingConfiguration="SecureBasicHttpBinding"
|
||||
name="SecBasicHttpEndpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceSimplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceSimplex"/>
|
||||
|
||||
<endpoint address="UnsecBasicHttp" binding="basicHttpBinding"
|
||||
bindingConfiguration="UnsecureBasicHttpBinding" name="UnsecBasicHttpEndpoint"
|
||||
contract="TwinCAT.Ads.Wcf.ITcAdsServiceSimplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceSimplex"/>
|
||||
|
||||
<endpoint address="SecWebHttp" binding="webHttpBinding" behaviorConfiguration="ScriptEnableBehavior"
|
||||
bindingConfiguration="SecureWebHttpBinding" name="SecWebHttpEndpoint"
|
||||
contract="TwinCAT.Ads.Wcf.ITcAdsServiceSimplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceSimplex" />
|
||||
|
||||
<endpoint address="UnsecWebHttp" binding="webHttpBinding" behaviorConfiguration="ScriptEnableBehavior"
|
||||
bindingConfiguration="UnsecureWebHttpBinding" name="UnsecWebHttpEndpoint"
|
||||
contract="TwinCAT.Ads.Wcf.ITcAdsServiceSimplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceSimplex" />
|
||||
|
||||
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
|
||||
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
|
||||
|
||||
<host>
|
||||
<baseAddresses>
|
||||
<add baseAddress="http://localhost:8003/TwinCAT/Ads/Wcf/TcAdsService" />
|
||||
<add baseAddress="https://localhost:8002/TwinCAT/Ads/Wcf/TcAdsService" />
|
||||
<add baseAddress="net.tcp://localhost:4508/TwinCAT/Ads/Wcf/TcAdsService" />
|
||||
</baseAddresses>
|
||||
</host>
|
||||
</service>
|
||||
<service behaviorConfiguration="TwinCAT.Ads.Wcf.ClientAccessPolicyProviderBehavior" name="TwinCAT.Ads.Wcf.ClientAccessPolicyProvider">
|
||||
<endpoint address="http://localhost:8003/" binding="webHttpBinding" bindingConfiguration="UnsecureWebHttpBinding" contract="TwinCAT.Ads.Wcf.IClientAccessPolicyProvider" behaviorConfiguration="HttpEnableBehavior"/>
|
||||
<endpoint address="https://localhost:8002/" binding="webHttpBinding" bindingConfiguration="SecureWebHttpBinding" contract="TwinCAT.Ads.Wcf.IClientAccessPolicyProvider" behaviorConfiguration="HttpEnableBehavior" />
|
||||
</service>
|
||||
</services>
|
||||
<bindings>
|
||||
<basicHttpBinding>
|
||||
<binding name="SecureBasicHttpBinding" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
|
||||
<security mode="Transport">
|
||||
<transport clientCredentialType="Windows"/>
|
||||
</security>
|
||||
</binding>
|
||||
<binding name="UnsecureBasicHttpBinding" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
|
||||
<security mode="None"/>
|
||||
</binding>
|
||||
</basicHttpBinding>
|
||||
<wsDualHttpBinding>
|
||||
<binding name="SecureWsDualHttpBindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
|
||||
<security mode="Message">
|
||||
<message clientCredentialType="Windows"/>
|
||||
</security>
|
||||
</binding>
|
||||
<binding name="UnsecureWsDualHttpBindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
|
||||
<security mode="None"></security>
|
||||
</binding>
|
||||
</wsDualHttpBinding>
|
||||
<customBinding>
|
||||
<binding name="SecurePollingDuplex3BindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10">
|
||||
<binaryMessageEncoding/>
|
||||
<pollingDuplex3 maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:00:10"/>
|
||||
<httpsTransport transferMode="StreamedResponse" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" proxyAuthenticationScheme="Ntlm" authenticationScheme="Ntlm"/>
|
||||
</binding>
|
||||
<binding name="UnsecurePollingDuplex3BindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10">
|
||||
<binaryMessageEncoding/>
|
||||
<pollingDuplex3 maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:00:10"/>
|
||||
<httpTransport transferMode="StreamedResponse" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
|
||||
</binding>
|
||||
<binding name="SecurePollingDuplex4BindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10">
|
||||
<binaryMessageEncoding/>
|
||||
<pollingDuplex4 duplexMode="MultipleMessagesPerPoll" maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:00:10" maxOutputDelay="00:00:00.2000000"/>
|
||||
<httpsTransport transferMode="StreamedResponse" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" proxyAuthenticationScheme="Ntlm" authenticationScheme="Ntlm"/>
|
||||
</binding>
|
||||
<binding name="UnsecurePollingDuplex4BindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10">
|
||||
<binaryMessageEncoding/>
|
||||
<pollingDuplex4 duplexMode="MultipleMessagesPerPoll" maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:00:10" maxOutputDelay="00:00:00.2000000"/>
|
||||
<httpTransport transferMode="StreamedResponse" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
|
||||
</binding>
|
||||
</customBinding>
|
||||
<netTcpBinding>
|
||||
<binding name="UnsecureNetTcpBindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxConnections="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" listenBacklog="2147483647" maxBufferPoolSize="2147483647">
|
||||
<security mode="None"></security>
|
||||
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
|
||||
</binding>
|
||||
<binding name="SecureNetTcpBindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxConnections="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" listenBacklog="2147483647" maxBufferPoolSize="2147483647">
|
||||
<security mode="Transport">
|
||||
<transport clientCredentialType="Windows"/>
|
||||
</security>
|
||||
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
|
||||
</binding>
|
||||
</netTcpBinding>
|
||||
<webHttpBinding>
|
||||
<binding name="SecureWebHttpBinding" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
|
||||
<security mode="Transport">
|
||||
<transport clientCredentialType="Windows"/>
|
||||
</security>
|
||||
</binding>
|
||||
<binding name="UnsecureWebHttpBinding" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
|
||||
<security mode="None" />
|
||||
</binding>
|
||||
</webHttpBinding>
|
||||
</bindings>
|
||||
<behaviors>
|
||||
<serviceBehaviors>
|
||||
<behavior name="MaxConcurrenceBehavior">
|
||||
<serviceMetadata httpGetEnabled="true" />
|
||||
<serviceDebug includeExceptionDetailInFaults="false" />
|
||||
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentSessions="100"
|
||||
maxConcurrentInstances="100" />
|
||||
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
|
||||
</behavior>
|
||||
<behavior name="TwinCAT.Ads.Wcf.ClientAccessPolicyProviderBehavior">
|
||||
<serviceMetadata httpGetEnabled="false" />
|
||||
<serviceDebug includeExceptionDetailInFaults="false" />
|
||||
</behavior>
|
||||
</serviceBehaviors>
|
||||
<endpointBehaviors>
|
||||
<behavior name="HttpEnableBehavior">
|
||||
<webHttp/>
|
||||
</behavior>
|
||||
<behavior name="ScriptEnableBehavior">
|
||||
<enableWebScript/>
|
||||
</behavior>
|
||||
</endpointBehaviors>
|
||||
</behaviors>
|
||||
<extensions>
|
||||
<bindingElementExtensions>
|
||||
<add name="pollingDuplex3" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="pollingDuplex4" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
</bindingElementExtensions>
|
||||
</extensions>
|
||||
<serviceHostingEnvironment aspNetCompatibilityEnabled="True" />
|
||||
</system.serviceModel>
|
||||
<userSettings>
|
||||
<TwinCAT.Ads.Wcf.Properties.Settings>
|
||||
<setting name="LogLevel" serializeAs="String">
|
||||
<value>NONE</value>
|
||||
</setting>
|
||||
<setting name="LogFilePath" serializeAs="String">
|
||||
<value>C:\TcAdsWcf_Log.txt</value>
|
||||
</setting>
|
||||
</TwinCAT.Ads.Wcf.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<access-policy>
|
||||
<cross-domain-access>
|
||||
<policy>
|
||||
<allow-from http-request-headers="*">
|
||||
<domain uri="http://*" />
|
||||
<domain uri="https://*" />
|
||||
</allow-from>
|
||||
<grant-to>
|
||||
<resource path="/" include-subpaths="true"/>
|
||||
<socket-resource port="4502-4534" protocol="tcp"/>
|
||||
</grant-to>
|
||||
</policy>
|
||||
</cross-domain-access>
|
||||
</access-policy>
|
||||
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
<?xml version ="1.0"?>
|
||||
<configuration>
|
||||
<startup useLegacyV2RuntimeActivationPolicy="true">
|
||||
<requiredRuntime safemode="true" imageVersion="v4.0.30319" version="v4.0.30319"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,68 @@
|
||||
=================================================================================================================================================
|
||||
|
||||
Installation
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
1. Libraries
|
||||
|
||||
The following assemblies have to be installed to the "Global Assembly Cache":
|
||||
|
||||
"\Ads Api\TcAdsWcf\PollingDuplex\v3.0\System.ServiceModel.PollingDuplex.dll"
|
||||
"\Ads Api\TcAdsWcf\PollingDuplex\v4.0\System.ServiceModel.PollingDuplex.dll"
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
2. Install "TcAdsWcfHost.exe" as Windows Service
|
||||
|
||||
Step 1:
|
||||
|
||||
Open the command prompt as Administrator and use the InstallUtil.exe (part of the .NET Framework) to create the Windows service.
|
||||
|
||||
Step 2:
|
||||
|
||||
Switch to "Control Panel\Administrative Tools\Services" and start the "TcAdsWcfHost" Service.
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
3. Test if Service is running.
|
||||
|
||||
Open a browser and go to "http://localhost:8003/TwinCAT/Ads/Wcf/TcAdsService" to test the service.
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
=================================================================================================================================================
|
||||
|
||||
Logging
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Enable logging:
|
||||
|
||||
1. Open "TcAdsWcfHost.exe.config" in TcAdsWcf directory.
|
||||
|
||||
2. Navigate to the "userSettings/TwinCAT.Ads.Wcf.Properties.Settings" node.
|
||||
|
||||
<userSettings>
|
||||
<TwinCAT.Ads.Wcf.Properties.Settings>
|
||||
<setting name="LogLevel" serializeAs="String">
|
||||
<value>NONE</value>
|
||||
</setting>
|
||||
<setting name="LogFilePath" serializeAs="String">
|
||||
<value>C:\TcAdsWcf_Log.txt</value>
|
||||
</setting>
|
||||
</TwinCAT.Ads.Wcf.Properties.Settings>
|
||||
</userSettings>
|
||||
|
||||
3. Set the value of the "LogLevel" setting to "INFO" or "ERROR"
|
||||
|
||||
4. Define the path to the logfile as vaue of the "LogFilePath" setting.
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
LogLevel Description:
|
||||
|
||||
NONE: Nothing is logged.
|
||||
|
||||
INFO: Information about method calls with parameter values and errors are logged.
|
||||
|
||||
ERROR: Erros are logged.
|
||||
Binary file not shown.
@@ -0,0 +1,158 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="TwinCAT.Ads.Wcf.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<system.serviceModel>
|
||||
<services>
|
||||
<service behaviorConfiguration="MaxConcurrenceBehavior" name="TwinCAT.Ads.Wcf.TcAdsService">
|
||||
|
||||
<endpoint address="UnsecPollingDuplex3" binding="customBinding" bindingConfiguration="UnsecurePollingDuplex3BindingConfig" name="UnsecPollingDuplex3Endpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="SecPollingDuplex3" binding="customBinding" bindingConfiguration="SecurePollingDuplex3BindingConfig" name="SecPollingDuplex3Endpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="UnsecPollingDuplex4" binding="customBinding" bindingConfiguration="UnsecurePollingDuplex4BindingConfig" name="UnsecPollingDuplex4Endpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="SecPollingDuplex4" binding="customBinding" bindingConfiguration="SecurePollingDuplex4BindingConfig" name="SecPollingDuplex4Endpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="SecWsDualHttp" binding="wsDualHttpBinding" bindingConfiguration="SecureWsDualHttpBindingConfig" name="SecWsDualHttpEndpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="UnsecWsDualHttp" binding="wsDualHttpBinding" bindingConfiguration="UnsecureWsDualHttpBindingConfig" name="UnsecWsDualHttpEndpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="UnsecNetTcp" binding="netTcpBinding" bindingConfiguration="UnsecureNetTcpBindingConfig" name="UnsecNetTcpEndpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="SecNetTcp" binding="netTcpBinding" bindingConfiguration="SecureNetTcpBindingConfig" name="SecNetTcpEndpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceDuplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceDuplex"/>
|
||||
|
||||
<endpoint address="SecBasicHttp" binding="basicHttpBinding" bindingConfiguration="SecureBasicHttpBinding" name="SecBasicHttpEndpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceSimplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceSimplex"/>
|
||||
|
||||
<endpoint address="UnsecBasicHttp" binding="basicHttpBinding" bindingConfiguration="UnsecureBasicHttpBinding" name="UnsecBasicHttpEndpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceSimplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceSimplex"/>
|
||||
|
||||
<endpoint address="SecWebHttp" binding="webHttpBinding" behaviorConfiguration="ScriptEnableBehavior" bindingConfiguration="SecureWebHttpBinding" name="SecWebHttpEndpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceSimplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceSimplex"/>
|
||||
|
||||
<endpoint address="UnsecWebHttp" binding="webHttpBinding" behaviorConfiguration="ScriptEnableBehavior" bindingConfiguration="UnsecureWebHttpBinding" name="UnsecWebHttpEndpoint" contract="TwinCAT.Ads.Wcf.ITcAdsServiceSimplex" bindingNamespace="http://beckhoff.com/TwinCAT/Ads/Wcf/TcAdsServiceSimplex"/>
|
||||
|
||||
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
|
||||
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
|
||||
|
||||
<host>
|
||||
<baseAddresses>
|
||||
<add baseAddress="http://localhost:8003/TwinCAT/Ads/Wcf/TcAdsService"/>
|
||||
<add baseAddress="https://localhost:8002/TwinCAT/Ads/Wcf/TcAdsService"/>
|
||||
<add baseAddress="net.tcp://localhost:4508/TwinCAT/Ads/Wcf/TcAdsService"/>
|
||||
</baseAddresses>
|
||||
</host>
|
||||
</service>
|
||||
<service behaviorConfiguration="TwinCAT.Ads.Wcf.ClientAccessPolicyProviderBehavior" name="TwinCAT.Ads.Wcf.ClientAccessPolicyProvider">
|
||||
<endpoint address="http://localhost:8003/" binding="webHttpBinding" bindingConfiguration="UnsecureWebHttpBinding" contract="TwinCAT.Ads.Wcf.IClientAccessPolicyProvider" behaviorConfiguration="HttpEnableBehavior"/>
|
||||
<endpoint address="https://localhost:8002/" binding="webHttpBinding" bindingConfiguration="SecureWebHttpBinding" contract="TwinCAT.Ads.Wcf.IClientAccessPolicyProvider" behaviorConfiguration="HttpEnableBehavior"/>
|
||||
</service>
|
||||
</services>
|
||||
<bindings>
|
||||
<basicHttpBinding>
|
||||
<binding name="SecureBasicHttpBinding" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
|
||||
<security mode="Transport">
|
||||
<transport clientCredentialType="Windows"/>
|
||||
</security>
|
||||
</binding>
|
||||
<binding name="UnsecureBasicHttpBinding" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
|
||||
<security mode="None"/>
|
||||
</binding>
|
||||
</basicHttpBinding>
|
||||
<wsDualHttpBinding>
|
||||
<binding name="SecureWsDualHttpBindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
|
||||
<security mode="Message">
|
||||
<message clientCredentialType="Windows"/>
|
||||
</security>
|
||||
</binding>
|
||||
<binding name="UnsecureWsDualHttpBindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
|
||||
<security mode="None"></security>
|
||||
</binding>
|
||||
</wsDualHttpBinding>
|
||||
<customBinding>
|
||||
<binding name="SecurePollingDuplex3BindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10">
|
||||
<binaryMessageEncoding/>
|
||||
<pollingDuplex3 maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:00:10"/>
|
||||
<httpsTransport transferMode="StreamedResponse" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" proxyAuthenticationScheme="Ntlm" authenticationScheme="Ntlm"/>
|
||||
</binding>
|
||||
<binding name="UnsecurePollingDuplex3BindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10">
|
||||
<binaryMessageEncoding/>
|
||||
<pollingDuplex3 maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:00:10"/>
|
||||
<httpTransport transferMode="StreamedResponse" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
|
||||
</binding>
|
||||
<binding name="SecurePollingDuplex4BindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10">
|
||||
<binaryMessageEncoding/>
|
||||
<pollingDuplex4 duplexMode="MultipleMessagesPerPoll" maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:00:10" maxOutputDelay="00:00:00.2000000"/>
|
||||
<httpsTransport transferMode="StreamedResponse" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" proxyAuthenticationScheme="Ntlm" authenticationScheme="Ntlm"/>
|
||||
</binding>
|
||||
<binding name="UnsecurePollingDuplex4BindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10">
|
||||
<binaryMessageEncoding/>
|
||||
<pollingDuplex4 duplexMode="MultipleMessagesPerPoll" maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:00:10" maxOutputDelay="00:00:00.2000000"/>
|
||||
<httpTransport transferMode="StreamedResponse" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
|
||||
</binding>
|
||||
</customBinding>
|
||||
<netTcpBinding>
|
||||
<binding name="UnsecureNetTcpBindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxConnections="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" listenBacklog="2147483647" maxBufferPoolSize="2147483647">
|
||||
<security mode="None"></security>
|
||||
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
|
||||
</binding>
|
||||
<binding name="SecureNetTcpBindingConfig" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxConnections="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" listenBacklog="2147483647" maxBufferPoolSize="2147483647">
|
||||
<security mode="Transport">
|
||||
<transport clientCredentialType="Windows"/>
|
||||
</security>
|
||||
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
|
||||
</binding>
|
||||
</netTcpBinding>
|
||||
<webHttpBinding>
|
||||
<binding name="SecureWebHttpBinding" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
|
||||
<security mode="Transport">
|
||||
<transport clientCredentialType="Windows"/>
|
||||
</security>
|
||||
</binding>
|
||||
<binding name="UnsecureWebHttpBinding" openTimeout="00:00:10" closeTimeout="00:00:10" receiveTimeout="02:00:00" sendTimeout="00:00:10" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
|
||||
<security mode="None"/>
|
||||
</binding>
|
||||
</webHttpBinding>
|
||||
</bindings>
|
||||
<behaviors>
|
||||
<serviceBehaviors>
|
||||
<behavior name="MaxConcurrenceBehavior">
|
||||
<serviceMetadata httpGetEnabled="true"/>
|
||||
<serviceDebug includeExceptionDetailInFaults="false"/>
|
||||
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentSessions="100" maxConcurrentInstances="100"/>
|
||||
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
|
||||
</behavior>
|
||||
<behavior name="TwinCAT.Ads.Wcf.ClientAccessPolicyProviderBehavior">
|
||||
<serviceMetadata httpGetEnabled="false"/>
|
||||
<serviceDebug includeExceptionDetailInFaults="false"/>
|
||||
</behavior>
|
||||
</serviceBehaviors>
|
||||
<endpointBehaviors>
|
||||
<behavior name="HttpEnableBehavior">
|
||||
<webHttp/>
|
||||
</behavior>
|
||||
<behavior name="ScriptEnableBehavior">
|
||||
<enableWebScript/>
|
||||
</behavior>
|
||||
</endpointBehaviors>
|
||||
</behaviors>
|
||||
<extensions>
|
||||
<bindingElementExtensions>
|
||||
<add name="pollingDuplex3" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="pollingDuplex4" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
</bindingElementExtensions>
|
||||
</extensions>
|
||||
<serviceHostingEnvironment aspNetCompatibilityEnabled="True"/>
|
||||
</system.serviceModel>
|
||||
<userSettings>
|
||||
<TwinCAT.Ads.Wcf.Properties.Settings>
|
||||
<setting name="LogLevel" serializeAs="String">
|
||||
<value>none</value>
|
||||
</setting>
|
||||
<setting name="LogFilePath" serializeAs="String">
|
||||
<value></value>
|
||||
</setting>
|
||||
</TwinCAT.Ads.Wcf.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,997 @@
|
||||
/*!
|
||||
----------------------------------------------------
|
||||
TcAdsWebService JavaScript Library
|
||||
----------------------------------------------------
|
||||
Version: v1.0.6.0
|
||||
----------------------------------------------------
|
||||
Copyright 2018, Beckhoff Automation GmbH & Co. KG
|
||||
http://www.beckhoff.com
|
||||
----------------------------------------------------
|
||||
*/
|
||||
////////////////////////////////////////////////////
|
||||
(function (window) {
|
||||
|
||||
var TcAdsWebService = new (function () {
|
||||
|
||||
this.Response = (function (hasError, error, reader, isBusy) {
|
||||
|
||||
this.isBusy = isBusy;
|
||||
this.hasError = hasError;
|
||||
this.error = error;
|
||||
this.reader = reader;
|
||||
this.getTypeString = (function () {
|
||||
return "TcAdsWebService.Response";
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
this.Error = (function (errorMessage, errorCode) {
|
||||
|
||||
this.errorMessage = errorMessage;
|
||||
this.errorCode = errorCode;
|
||||
this.getTypeString = (function () {
|
||||
return "TcAdsWebService.Error";
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
this.ResquestError = (function (requestStatus, requestStatusText) {
|
||||
|
||||
this.requestStatus = requestStatus;
|
||||
this.requestStatusText = requestStatusText;
|
||||
this.getTypeString = (function () {
|
||||
return "TcAdsWebService.ResquestError";
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
this.Client = (function (sServiceUrl, sServiceUser, sServicePassword) {
|
||||
|
||||
this.getTypeString = (function () {
|
||||
return "TcAdsWebService.Client";
|
||||
});
|
||||
|
||||
this.readwrite = (function (sNetId, nPort, nIndexGroup, nIndexOffset, cbRdLen, pwrData, pCallback, userState, ajaxTimeout, ajaxTimeoutCallback, async) {
|
||||
|
||||
var message =
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
||||
"<SOAP-ENV:Envelope " +
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance/\" " +
|
||||
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema/\" " +
|
||||
"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
|
||||
"SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" >" +
|
||||
"<SOAP-ENV:Body><q1:ReadWrite xmlns:q1=\"http://beckhoff.org/message/\">" +
|
||||
"<netId xsi:type=\"xsd:string\">" + sNetId + "</netId>" +
|
||||
"<nPort xsi:type=\"xsd:int\">" + nPort + "</nPort>" +
|
||||
"<indexGroup xsi:type=\"xsd:unsignedInt\">" + nIndexGroup + "</indexGroup>" +
|
||||
"<indexOffset xsi:type=\"xsd:unsignedInt\">" + nIndexOffset + "</indexOffset>" +
|
||||
"<cbRdLen xsi:type=\"xsd:int\">" + cbRdLen + "</cbRdLen>" +
|
||||
"<pwrData xsi:type=\"xsd:base64Binary\">" + pwrData + "</pwrData>" +
|
||||
"</q1:ReadWrite></SOAP-ENV:Body></SOAP-ENV:Envelope>";
|
||||
|
||||
return sendMessage(message, "http://beckhoff.org/action/TcAdsSync.Readwrite", pCallback, userState, ajaxTimeout, ajaxTimeoutCallback, async);
|
||||
|
||||
});
|
||||
|
||||
this.readState = (function (sNetId, nPort, pCallback, userState, ajaxTimeout, ajaxTimeoutCallback, async) {
|
||||
|
||||
var message =
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
||||
"<SOAP-ENV:Envelope " +
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance/\" " +
|
||||
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema/\" " +
|
||||
"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
|
||||
"SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" >" +
|
||||
"<SOAP-ENV:Body><q1:ReadState xmlns:q1=\"http://beckhoff.org/message/\">" +
|
||||
"<netId xsi:type=\"xsd:string\">" + sNetId + "</netId>" +
|
||||
"<nPort xsi:type=\"xsd:int\">" + nPort + "</nPort>" +
|
||||
"</q1:ReadState></SOAP-ENV:Body></SOAP-ENV:Envelope>";
|
||||
|
||||
return sendMessage(message, "http://beckhoff.org/action/TcAdsSync.ReadState", pCallback, userState, ajaxTimeout, ajaxTimeoutCallback, async);
|
||||
});
|
||||
|
||||
this.writeControl = (function (sNetId, nPort, adsState, deviceState, pData, pCallback, userState, ajaxTimeout, ajaxTimeoutCallback, async) {
|
||||
|
||||
var message =
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
||||
"<SOAP-ENV:Envelope " +
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance/\" " +
|
||||
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema/\" " +
|
||||
"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
|
||||
"SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" >" +
|
||||
"<SOAP-ENV:Body><q1:WriteControl xmlns:q1=\"http://beckhoff.org/message/\">" +
|
||||
"<netId xsi:type=\"xsd:string\">" + sNetId + "</netId>" +
|
||||
"<nPort xsi:type=\"xsd:int\">" + nPort + "</nPort>" +
|
||||
"<adsState xsi:type=\"xsd:int\">" + adsState + "</adsState>" +
|
||||
"<deviceState xsi:type=\"xsd:int\">" + deviceState + "</deviceState>" +
|
||||
"<pData xsi:type=\"xsd:base64Binary\">" + pData + "</pData>" +
|
||||
"</q1:WriteControl></SOAP-ENV:Body></SOAP-ENV:Envelope>";
|
||||
|
||||
return sendMessage(message, "http://beckhoff.org/action/TcAdsSync.WriteControl", pCallback, userState, ajaxTimeout, ajaxTimeoutCallback, async);
|
||||
});
|
||||
|
||||
this.write = (function (sNetId, nPort, nIndexGroup, nIndexOffset, pData, pCallback, userState, ajaxTimeout, ajaxTimeoutCallback, async) {
|
||||
|
||||
var message =
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
||||
"<SOAP-ENV:Envelope " +
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance/\" " +
|
||||
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema/\" " +
|
||||
"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
|
||||
"SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" >" +
|
||||
"<SOAP-ENV:Body><q1:Write xmlns:q1=\"http://beckhoff.org/message/\">" +
|
||||
"<netId xsi:type=\"xsd:string\">" + sNetId + "</netId>" +
|
||||
"<nPort xsi:type=\"xsd:int\">" + nPort + "</nPort>" +
|
||||
"<indexGroup xsi:type=\"xsd:unsignedInt\">" + nIndexGroup + "</indexGroup>" +
|
||||
"<indexOffset xsi:type=\"xsd:unsignedInt\">" + nIndexOffset + "</indexOffset>" +
|
||||
"<pData xsi:type=\"xsd:base64Binary\">" + pData + "</pData>" +
|
||||
"</q1:Write></SOAP-ENV:Body></SOAP-ENV:Envelope>";
|
||||
|
||||
return sendMessage(message, "http://beckhoff.org/action/TcAdsSync.Write", pCallback, userState, ajaxTimeout, ajaxTimeoutCallback, async);
|
||||
});
|
||||
|
||||
this.read = (function (sNetId, nPort, nIndexGroup, nIndexOffset, cbLen, pCallback, userState, ajaxTimeout, ajaxTimeoutCallback, async) {
|
||||
|
||||
var message =
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
||||
"<SOAP-ENV:Envelope " +
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance/\" " +
|
||||
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema/\" " +
|
||||
"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
|
||||
"SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" >" +
|
||||
"<SOAP-ENV:Body><q1:Read xmlns:q1=\"http://beckhoff.org/message/\">" +
|
||||
"<netId xsi:type=\"xsd:string\">" + sNetId + "</netId>" +
|
||||
"<nPort xsi:type=\"xsd:int\">" + nPort + "</nPort>" +
|
||||
"<indexGroup xsi:type=\"xsd:unsignedInt\">" + nIndexGroup + "</indexGroup>" +
|
||||
"<indexOffset xsi:type=\"xsd:unsignedInt\">" + nIndexOffset + "</indexOffset>" +
|
||||
"<cbLen xsi:type=\"xsd:int\">" + cbLen + "</cbLen>" +
|
||||
"</q1:Read></SOAP-ENV:Body></SOAP-ENV:Envelope>";
|
||||
|
||||
return sendMessage(message, "http://beckhoff.org/action/TcAdsSync.Read", pCallback, userState, ajaxTimeout, ajaxTimeoutCallback, async);
|
||||
});
|
||||
|
||||
var handleSyncResponse = function (xhr) {
|
||||
|
||||
var errorMessage = undefined, errorCode = 0;
|
||||
|
||||
if (xhr.readyState != 4 || xhr.status != 200) {
|
||||
// Request has been aborted.
|
||||
// Maybe because of timeout.
|
||||
var resp = undefined;
|
||||
try {
|
||||
resp = new TcAdsWebService.Response(
|
||||
true, new TcAdsWebService.ResquestError(xhr.status, xhr.statusText), undefined, false);
|
||||
} catch (err) {
|
||||
// Internet Explorer throws exception on abort
|
||||
resp = new TcAdsWebService.Response(
|
||||
true, new TcAdsWebService.ResquestError(0, 0), undefined, false);
|
||||
}
|
||||
|
||||
xhr = null;
|
||||
return resp;
|
||||
}
|
||||
|
||||
var sSoapResponse = xhr.responseXML.documentElement;
|
||||
var faultstringNodes = sSoapResponse.getElementsByTagName('faultstring');
|
||||
if (faultstringNodes.length != 0) {
|
||||
|
||||
errorMessage = faultstringNodes[0].firstChild.data;
|
||||
var errorCodeNodes = sSoapResponse.getElementsByTagName('errorcode');
|
||||
|
||||
if (errorCodeNodes.length != 0) {
|
||||
errorCode = sSoapResponse.getElementsByTagName('errorcode')[0].firstChild.data;
|
||||
} else {
|
||||
errorCode = "-";
|
||||
}
|
||||
|
||||
var resp = new TcAdsWebService.Response(
|
||||
true, new TcAdsWebService.Error(errorMessage, errorCode), undefined, false);
|
||||
|
||||
xhr = null;
|
||||
return resp;
|
||||
|
||||
} else {
|
||||
|
||||
var ppDataNodes = sSoapResponse.getElementsByTagName('ppData');
|
||||
var ppRdDataNodes = sSoapResponse.getElementsByTagName('ppRdData');
|
||||
var pAdsStateNodes = sSoapResponse.getElementsByTagName('pAdsState');
|
||||
var pDeviceStateNodes = sSoapResponse.getElementsByTagName('pDeviceState');
|
||||
|
||||
var soapData = "";
|
||||
if (ppDataNodes.length != 0) {
|
||||
//read
|
||||
for (var i = 0; i < ppDataNodes[0].childNodes.length; i++) {
|
||||
soapData += ppDataNodes[0].childNodes[i].data;
|
||||
}
|
||||
} else if (ppRdDataNodes.length != 0) {
|
||||
// readwrite
|
||||
for (var i = 0; i < ppRdDataNodes[0].childNodes.length; i++) {
|
||||
soapData += ppRdDataNodes[0].childNodes[i].data;
|
||||
}
|
||||
} else if (pAdsStateNodes.length != 0 && pDeviceStateNodes.length) {
|
||||
// readState
|
||||
var adsState = pAdsStateNodes[0].firstChild.data;
|
||||
var deviceState = pDeviceStateNodes[0].firstChild.data;
|
||||
|
||||
var writer = new TcAdsWebService.DataWriter();
|
||||
writer.writeWORD(parseInt(adsState, 10));
|
||||
writer.writeWORD(parseInt(deviceState, 10));
|
||||
|
||||
soapData = writer.getBase64EncodedData();
|
||||
}
|
||||
|
||||
if (soapData) {
|
||||
var resp = new TcAdsWebService.Response(
|
||||
false,
|
||||
undefined,
|
||||
new TcAdsWebService.DataReader(soapData), false);
|
||||
xhr = null;
|
||||
return resp;
|
||||
} else {
|
||||
// write completes without data in response
|
||||
var resp = new TcAdsWebService.Response(false, undefined, undefined, false);
|
||||
xhr = null;
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var handleAsyncResponse = function (readyState, status, statusText, responseXML, pCallback, userState) {
|
||||
|
||||
if (readyState < 4) {
|
||||
if (pCallback) {
|
||||
var resp = new TcAdsWebService.Response(false, undefined, undefined, true);
|
||||
pCallback(resp, userState);
|
||||
}
|
||||
}
|
||||
|
||||
if (readyState == 4) {
|
||||
|
||||
if (status == 200) {
|
||||
|
||||
var errorMessage = undefined, errorCode = 0;
|
||||
|
||||
var sSoapResponse = responseXML.documentElement;
|
||||
var faultstringNodes = sSoapResponse.getElementsByTagName('faultstring');
|
||||
if (faultstringNodes.length != 0) {
|
||||
|
||||
errorMessage = faultstringNodes[0].firstChild.data;
|
||||
var errorCodeNodes = sSoapResponse.getElementsByTagName('errorcode');
|
||||
|
||||
if (errorCodeNodes.length != 0) {
|
||||
errorCode = sSoapResponse.getElementsByTagName('errorcode')[0].firstChild.data;
|
||||
} else {
|
||||
errorCode = "-";
|
||||
}
|
||||
|
||||
if (pCallback) {
|
||||
var resp = new TcAdsWebService.Response(
|
||||
true, new TcAdsWebService.Error(errorMessage, errorCode), undefined, false);
|
||||
pCallback(resp, userState);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
var ppDataNodes = sSoapResponse.getElementsByTagName('ppData');
|
||||
var ppRdDataNodes = sSoapResponse.getElementsByTagName('ppRdData');
|
||||
var pAdsStateNodes = sSoapResponse.getElementsByTagName('pAdsState');
|
||||
var pDeviceStateNodes = sSoapResponse.getElementsByTagName('pDeviceState');
|
||||
|
||||
var soapData = "";
|
||||
if (ppDataNodes.length != 0) {
|
||||
//read
|
||||
for (var i = 0; i < ppDataNodes[0].childNodes.length; i++) {
|
||||
soapData += ppDataNodes[0].childNodes[i].data;
|
||||
}
|
||||
} else if (ppRdDataNodes.length != 0) {
|
||||
// readwrite
|
||||
for (var i = 0; i < ppRdDataNodes[0].childNodes.length; i++) {
|
||||
soapData += ppRdDataNodes[0].childNodes[i].data;
|
||||
}
|
||||
} else if (pAdsStateNodes.length != 0 && pDeviceStateNodes.length) {
|
||||
// readState
|
||||
var adsState = pAdsStateNodes[0].firstChild.data;
|
||||
var deviceState = pDeviceStateNodes[0].firstChild.data;
|
||||
|
||||
var writer = new TcAdsWebService.DataWriter();
|
||||
writer.writeWORD(parseInt(adsState, 10));
|
||||
writer.writeWORD(parseInt(deviceState, 10));
|
||||
|
||||
soapData = writer.getBase64EncodedData();
|
||||
}
|
||||
|
||||
if (soapData) {
|
||||
if (pCallback) {
|
||||
var resp = new TcAdsWebService.Response(
|
||||
false, undefined, new TcAdsWebService.DataReader(soapData), false);
|
||||
if (pCallback)
|
||||
pCallback(resp, userState);
|
||||
}
|
||||
} else {
|
||||
|
||||
// write completes without data in response
|
||||
if (pCallback) {
|
||||
var resp = new TcAdsWebService.Response(false, undefined, undefined, false);
|
||||
pCallback(resp, userState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Request has been aborted.
|
||||
// Maybe because of timeout.
|
||||
if (pCallback) {
|
||||
|
||||
var resp = undefined;
|
||||
try {
|
||||
resp = new TcAdsWebService.Response(
|
||||
true, new TcAdsWebService.ResquestError(status, statusText), undefined, false);
|
||||
} catch (err) {
|
||||
// Internet Explorer throws exception on abort
|
||||
resp = new TcAdsWebService.Response(
|
||||
true, new TcAdsWebService.ResquestError(0, 0), undefined, false);
|
||||
}
|
||||
pCallback(resp, userState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sendMessage = function (message, method, pCallback, userState, ajaxTimeout, ajaxTimeoutCallback, async) {
|
||||
|
||||
if (async == null || async == undefined)
|
||||
async = true;
|
||||
|
||||
var xhr = undefined;
|
||||
if (window.XMLHttpRequest) {
|
||||
xhr = new XMLHttpRequest();
|
||||
} else {
|
||||
try {
|
||||
// MS Internet Explorer (ab v6)
|
||||
xhr = ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
// MS Internet Explorer (ab v5)
|
||||
xhr = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
xhr = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (xhr == undefined)
|
||||
return null;
|
||||
|
||||
if (async) {
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState == 4) {
|
||||
handleAsyncResponse(this.readyState, this.status, this.statusText, this.responseXML, pCallback, userState);
|
||||
} else {
|
||||
handleAsyncResponse(this.readyState, undefined, undefined, undefined, pCallback, userState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sServiceUser && sServicePassword) {
|
||||
xhr.open("POST", sServiceUrl, async, sServiceUser, sServicePassword);
|
||||
} else {
|
||||
xhr.open("POST", sServiceUrl, async);
|
||||
}
|
||||
|
||||
if ("timeout" in xhr && ajaxTimeout)
|
||||
xhr.timeout = ajaxTimeout;
|
||||
|
||||
if ("ontimeout" in xhr && ajaxTimeoutCallback) {
|
||||
xhr.ontimeout = ajaxTimeoutCallback;
|
||||
}
|
||||
|
||||
xhr.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
|
||||
|
||||
xhr.send(message);
|
||||
|
||||
if (!async) {
|
||||
return handleSyncResponse(xhr);
|
||||
}
|
||||
else {
|
||||
xhr = null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.DataReader = (function (data) {
|
||||
|
||||
this.offset = 0;
|
||||
this.decodedData = Base64.decode(data);
|
||||
|
||||
this.getTypeString = (function () {
|
||||
return "TcAdsWebService.DataReader";
|
||||
});
|
||||
|
||||
this.readSINT = (function () {
|
||||
var res = convertDataToInt(this.decodedData.substr(this.offset, 1), 1);
|
||||
this.offset = this.offset + 1;
|
||||
return res;
|
||||
});
|
||||
|
||||
this.readINT = (function () {
|
||||
var res = convertDataToInt(this.decodedData.substr(this.offset, 2), 2);
|
||||
this.offset = this.offset + 2;
|
||||
return res;
|
||||
});
|
||||
|
||||
this.readDINT = (function () {
|
||||
var res = convertDataToInt(this.decodedData.substr(this.offset, 4), 4);
|
||||
this.offset = this.offset + 4;
|
||||
return res;
|
||||
});
|
||||
|
||||
this.readBYTE = (function () {
|
||||
var res = convertDataToUInt(this.decodedData.substr(this.offset, 1), 1);
|
||||
this.offset = this.offset + 1;
|
||||
return res;
|
||||
});
|
||||
|
||||
this.readWORD = (function () {
|
||||
var res = convertDataToUInt(this.decodedData.substr(this.offset, 2), 2);
|
||||
this.offset = this.offset + 2;
|
||||
return res;
|
||||
});
|
||||
|
||||
this.readDWORD = (function () {
|
||||
var res = convertDataToUInt(this.decodedData.substr(this.offset, 4), 4);
|
||||
this.offset = this.offset + 4;
|
||||
return res;
|
||||
});
|
||||
|
||||
this.readBOOL = (function () {
|
||||
var res = this.decodedData.substr(this.offset, 1).charCodeAt(0);
|
||||
this.offset = this.offset + 1;
|
||||
if (res === 0)
|
||||
return false;
|
||||
if (res === 1)
|
||||
return true;
|
||||
return res;
|
||||
});
|
||||
|
||||
this.readString = (function (length) {
|
||||
|
||||
if (isNaN(length)) {
|
||||
throw "Parameter \"length\" has to be a valid number.";
|
||||
}
|
||||
|
||||
var o = 0;
|
||||
var c;
|
||||
var ca = [];
|
||||
|
||||
while (o < length) { // Read until length or 0 termination
|
||||
c = this.decodedData.substr(this.offset + o, 1);
|
||||
var cc = c.charCodeAt(0);
|
||||
if (cc === 0) {
|
||||
break;
|
||||
}
|
||||
ca.push(c);
|
||||
o++;
|
||||
}
|
||||
|
||||
var res = ca.join('');
|
||||
this.offset = this.offset + length;
|
||||
|
||||
return res;
|
||||
});
|
||||
|
||||
this.readREAL = (function () {
|
||||
var decData = [];
|
||||
decData[0] = convertDataToUInt(this.decodedData.substr(this.offset + 0, 1), 1);
|
||||
decData[1] = convertDataToUInt(this.decodedData.substr(this.offset + 1, 1), 1);
|
||||
decData[2] = convertDataToUInt(this.decodedData.substr(this.offset + 2, 1), 1);
|
||||
decData[3] = convertDataToUInt(this.decodedData.substr(this.offset + 3, 1), 1);
|
||||
|
||||
var binData = [];
|
||||
binData[0] = dec2Binary(decData[0]);
|
||||
binData[1] = dec2Binary(decData[1]);
|
||||
binData[2] = dec2Binary(decData[2]);
|
||||
binData[3] = dec2Binary(decData[3]);
|
||||
|
||||
var binStr = binData[3] + binData[2] + binData[1] + binData[0];
|
||||
|
||||
var res = binary2Real(binStr, TcAdsWebService.TcAdsWebServiceDataTypes.REAL);
|
||||
this.offset = this.offset + 4;
|
||||
return res;
|
||||
});
|
||||
|
||||
this.readLREAL = (function () {
|
||||
var decData = [];
|
||||
decData[0] = convertDataToUInt(this.decodedData.substr(this.offset + 0, 1), 1);
|
||||
decData[1] = convertDataToUInt(this.decodedData.substr(this.offset + 1, 1), 1);
|
||||
decData[2] = convertDataToUInt(this.decodedData.substr(this.offset + 2, 1), 1);
|
||||
decData[3] = convertDataToUInt(this.decodedData.substr(this.offset + 3, 1), 1);
|
||||
decData[4] = convertDataToUInt(this.decodedData.substr(this.offset + 4, 1), 1);
|
||||
decData[5] = convertDataToUInt(this.decodedData.substr(this.offset + 5, 1), 1);
|
||||
decData[6] = convertDataToUInt(this.decodedData.substr(this.offset + 6, 1), 1);
|
||||
decData[7] = convertDataToUInt(this.decodedData.substr(this.offset + 7, 1), 1);
|
||||
|
||||
var binData = [];
|
||||
binData[0] = dec2Binary(decData[0]);
|
||||
binData[1] = dec2Binary(decData[1]);
|
||||
binData[2] = dec2Binary(decData[2]);
|
||||
binData[3] = dec2Binary(decData[3]);
|
||||
binData[4] = dec2Binary(decData[4]);
|
||||
binData[5] = dec2Binary(decData[5]);
|
||||
binData[6] = dec2Binary(decData[6]);
|
||||
binData[7] = dec2Binary(decData[7]);
|
||||
|
||||
var binStr = binData[7] + binData[6] + binData[5] + binData[4] + binData[3] + binData[2] + binData[1] + binData[0];
|
||||
|
||||
var res = binary2Real(binStr, TcAdsWebService.TcAdsWebServiceDataTypes.LREAL);
|
||||
this.offset = this.offset + 8;
|
||||
return res;
|
||||
});
|
||||
});
|
||||
|
||||
this.DataWriter = (function () {
|
||||
|
||||
this.getTypeString = (function () {
|
||||
return "TcAdsWebService.DataWriter";
|
||||
});
|
||||
|
||||
this.getBase64EncodedData = (function () {
|
||||
return Base64.encode(byteArrayToBinaryString(byteArray));
|
||||
});
|
||||
|
||||
this.writeSINT = (function (value) {
|
||||
byteArray = PrepareData(value, TcAdsWebService.TcAdsWebServiceDataTypes.Integer, 1, byteArray);
|
||||
});
|
||||
|
||||
this.writeINT = (function (value) {
|
||||
byteArray = PrepareData(value, TcAdsWebService.TcAdsWebServiceDataTypes.Integer, 2, byteArray);
|
||||
});
|
||||
|
||||
this.writeDINT = (function (value) {
|
||||
byteArray = PrepareData(value, TcAdsWebService.TcAdsWebServiceDataTypes.Integer, 4, byteArray);
|
||||
});
|
||||
|
||||
this.writeBYTE = (function (value) {
|
||||
byteArray = PrepareData(value, TcAdsWebService.TcAdsWebServiceDataTypes.UnsignedInteger, 1, byteArray);
|
||||
});
|
||||
|
||||
this.writeWORD = (function (value) {
|
||||
byteArray = PrepareData(value, TcAdsWebService.TcAdsWebServiceDataTypes.UnsignedInteger, 2, byteArray);
|
||||
});
|
||||
|
||||
this.writeDWORD = (function (value) {
|
||||
byteArray = PrepareData(value, TcAdsWebService.TcAdsWebServiceDataTypes.UnsignedInteger, 4, byteArray);
|
||||
});
|
||||
|
||||
this.writeBOOL = (function (value) {
|
||||
byteArray = PrepareData(value, TcAdsWebService.TcAdsWebServiceDataTypes.BOOL, 1, byteArray);
|
||||
});
|
||||
|
||||
this.writeString = (function (value, length) {
|
||||
byteArray = PrepareData(value, TcAdsWebService.TcAdsWebServiceDataTypes.String, length, byteArray);
|
||||
});
|
||||
|
||||
this.writeREAL = (function (value) {
|
||||
byteArray = PrepareData(value, TcAdsWebService.TcAdsWebServiceDataTypes.REAL, 4, byteArray);
|
||||
});
|
||||
|
||||
this.writeLREAL = (function (value) {
|
||||
byteArray = PrepareData(value, TcAdsWebService.TcAdsWebServiceDataTypes.LREAL, 8, byteArray);
|
||||
});
|
||||
|
||||
var byteArray = [];
|
||||
|
||||
var PrepareData = function (data, type, len, array) {
|
||||
var j = array.length;
|
||||
|
||||
if (type == TcAdsWebService.TcAdsWebServiceDataTypes.String) {
|
||||
var k;
|
||||
|
||||
for (k = 0; k < data.length; k++) {
|
||||
array[j++] = data.charCodeAt(k);
|
||||
}
|
||||
|
||||
for (; k < len; k++) {
|
||||
array[j++] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
else if (type == TcAdsWebService.TcAdsWebServiceDataTypes.BOOL) {
|
||||
array[j++] = data;
|
||||
}
|
||||
else if (type == TcAdsWebService.TcAdsWebServiceDataTypes.Integer || type == TcAdsWebService.TcAdsWebServiceDataTypes.UnsignedInteger) {
|
||||
|
||||
if (len == 1) {
|
||||
array[j++] = ToByte(parseInt((data >> (0)), 10));
|
||||
}
|
||||
else if (len == 2) {
|
||||
data = parseInt(data);
|
||||
array[j++] = ToByte(parseInt((data >> (0)), 10));
|
||||
array[j++] = ToByte(parseInt((data >> (8)), 10));
|
||||
}
|
||||
else if (len == 4) {
|
||||
data = parseInt(data);
|
||||
|
||||
if (isNaN(data))
|
||||
data = 0;
|
||||
|
||||
array[j++] = ToByte(parseInt((data >> (0)), 10));
|
||||
array[j++] = ToByte(parseInt((data >> (8)), 10));
|
||||
array[j++] = ToByte(parseInt((data >> (16)), 10));
|
||||
array[j++] = ToByte(parseInt((data >> (24)), 10));
|
||||
}
|
||||
}
|
||||
else if (type == TcAdsWebService.TcAdsWebServiceDataTypes.REAL) {
|
||||
var binary = real2Binary(data, type);
|
||||
|
||||
var subBytes = [];
|
||||
subBytes[0] = binary.substring(0, 8);
|
||||
subBytes[1] = binary.substring(8, 16);
|
||||
subBytes[2] = binary.substring(16, 24);
|
||||
subBytes[3] = binary.substring(24, 32);
|
||||
|
||||
array[j++] = binary2Dec(subBytes[3]);
|
||||
array[j++] = binary2Dec(subBytes[2]);
|
||||
array[j++] = binary2Dec(subBytes[1]);
|
||||
array[j++] = binary2Dec(subBytes[0]);
|
||||
}
|
||||
else if (type == TcAdsWebService.TcAdsWebServiceDataTypes.LREAL) {
|
||||
var binary = real2Binary(data, type);
|
||||
|
||||
var subBytes = [];
|
||||
subBytes[0] = binary.substring(0, 8);
|
||||
subBytes[1] = binary.substring(8, 16);
|
||||
subBytes[2] = binary.substring(16, 24);
|
||||
subBytes[3] = binary.substring(24, 32);
|
||||
|
||||
subBytes[4] = binary.substring(32, 40);
|
||||
subBytes[5] = binary.substring(40, 48);
|
||||
subBytes[6] = binary.substring(48, 56);
|
||||
subBytes[7] = binary.substring(56, 64);
|
||||
|
||||
array[j++] = binary2Dec(subBytes[7]);
|
||||
array[j++] = binary2Dec(subBytes[6]);
|
||||
array[j++] = binary2Dec(subBytes[5]);
|
||||
array[j++] = binary2Dec(subBytes[4]);
|
||||
array[j++] = binary2Dec(subBytes[3]);
|
||||
array[j++] = binary2Dec(subBytes[2]);
|
||||
array[j++] = binary2Dec(subBytes[1]);
|
||||
array[j++] = binary2Dec(subBytes[0]);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
});
|
||||
|
||||
this.TcAdsReservedIndexGroups = {
|
||||
"PlcRWMX": 16416,
|
||||
"PlcRWMB": 16416,
|
||||
"PlcRWRB": 16432,
|
||||
"PlcRWDB": 16448,
|
||||
"SymbolTable": 61440,
|
||||
"SymbolName": 61441,
|
||||
"SymbolValue": 61442,
|
||||
"SymbolHandleByName": 61443,
|
||||
"SymbolValueByName": 61444,
|
||||
"SymbolValueByHandle": 61445,
|
||||
"SymbolReleaseHandle": 61446,
|
||||
"SymbolInfoByName": 61447,
|
||||
"SymbolVersion": 61448,
|
||||
"SymbolInfoByNameEx": 61449,
|
||||
"SymbolDownload": 61450,
|
||||
"SymbolUpload": 61451,
|
||||
"SymbolUploadInfo": 61452,
|
||||
"SymbolNote": 61456,
|
||||
"IOImageRWIB": 61472,
|
||||
"IOImageRWIX": 61473,
|
||||
"IOImageRWOB": 61488,
|
||||
"IOImageRWOX": 61489,
|
||||
"IOImageClearI": 61504,
|
||||
"IOImageClearO": 61520,
|
||||
"DeviceData": 61696
|
||||
};
|
||||
|
||||
this.TcAdsWebServiceDataTypes = {
|
||||
"String": 0,
|
||||
"BOOL": 1,
|
||||
"Integer": 2,
|
||||
"UnsignedInteger": 3,
|
||||
"LREAL": 4,
|
||||
"REAL": 5
|
||||
};
|
||||
|
||||
this.AdsState = {
|
||||
"INVALID": 0,
|
||||
"IDLE": 1,
|
||||
"RESET": 2,
|
||||
"INIT": 3,
|
||||
"START": 4,
|
||||
"RUN": 5,
|
||||
"STOP": 6,
|
||||
"SAVECFG": 7,
|
||||
"LOADCFG": 8,
|
||||
"POWERFAILURE": 9,
|
||||
"POWERGOOD": 10,
|
||||
"ERROR": 11,
|
||||
"SHUTDOWN": 12,
|
||||
"SUSPEND": 13,
|
||||
"RESUME": 14,
|
||||
"CONFIG": 15,
|
||||
"RECONFIG": 16
|
||||
};
|
||||
|
||||
var byteArrayToBinaryString = function (arr) {
|
||||
var res = "";
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
res += String.fromCharCode(arr[i] & 0xFF);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
var Base64 = (function () {
|
||||
|
||||
var encode = function (data) {
|
||||
var out = "", c1, c2, c3, e1, e2, e3, e4;
|
||||
for (var i = 0; i < data.length;) {
|
||||
c1 = data.charCodeAt(i++);
|
||||
c2 = data.charCodeAt(i++);
|
||||
c3 = data.charCodeAt(i++);
|
||||
e1 = c1 >> 2;
|
||||
e2 = ((c1 & 3) << 4) + (c2 >> 4);
|
||||
e3 = ((c2 & 15) << 2) + (c3 >> 6);
|
||||
e4 = c3 & 63;
|
||||
if (isNaN(c2))
|
||||
e3 = e4 = 64;
|
||||
else if (isNaN(c3))
|
||||
e4 = 64;
|
||||
out += tab.charAt(e1) + tab.charAt(e2) + tab.charAt(e3) + tab.charAt(e4);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
var decode = function (data) {
|
||||
var out = "", c1, c2, c3, e1, e2, e3, e4;
|
||||
for (var i = 0; i < data.length;) {
|
||||
e1 = tab.indexOf(data.charAt(i++));
|
||||
e2 = tab.indexOf(data.charAt(i++));
|
||||
e3 = tab.indexOf(data.charAt(i++));
|
||||
e4 = tab.indexOf(data.charAt(i++));
|
||||
c1 = (e1 << 2) + (e2 >> 4);
|
||||
c2 = ((e2 & 15) << 4) + (e3 >> 2);
|
||||
c3 = ((e3 & 3) << 6) + e4;
|
||||
out += String.fromCharCode(c1);
|
||||
if (e3 != 64)
|
||||
out += String.fromCharCode(c2);
|
||||
if (e4 != 64)
|
||||
out += String.fromCharCode(c3);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
return { encode: encode, decode: decode };
|
||||
})();
|
||||
|
||||
var real2Binary = function (value, type) {
|
||||
|
||||
var exp = 0, man = 0, bias = 0;
|
||||
|
||||
switch (type) {
|
||||
|
||||
case TcAdsWebService.TcAdsWebServiceDataTypes.LREAL:
|
||||
exp = 11;
|
||||
man = 52;
|
||||
bias = 1023;
|
||||
break;
|
||||
|
||||
case TcAdsWebService.TcAdsWebServiceDataTypes.REAL:
|
||||
default:
|
||||
exp = 8;
|
||||
man = 23;
|
||||
bias = 127;
|
||||
}
|
||||
|
||||
var sign = (value >= 0.0) ? 0 : 1;
|
||||
|
||||
var n = 0, power, sign2;
|
||||
if (value > 0 || value < 0) {
|
||||
if (value < 2 && value > -2)
|
||||
sign2 = -1;
|
||||
else sign2 = 1;
|
||||
|
||||
for (power = 0; n < 1 || n > 2; ++power) {
|
||||
n = Math.pow(-1, sign) * value / (Math.pow(2, sign2 * power));
|
||||
}
|
||||
power--;
|
||||
} else {
|
||||
power = bias;
|
||||
sign2 = -1;
|
||||
}
|
||||
|
||||
var exponent = bias + (sign2 * power);
|
||||
exponent = exponent.toString(2);
|
||||
|
||||
for (var i = exponent.length; i < exp; i++) {
|
||||
exponent = "0" + exponent;
|
||||
}
|
||||
|
||||
var n2 = 0, temp = 0, fraction = "";
|
||||
n = n - 1;
|
||||
for (var i = 1; i < (man + 1) ; i++) {
|
||||
temp = n2 + 1 / Math.pow(2, i);
|
||||
if (temp <= n) {
|
||||
n2 = temp;
|
||||
fraction += "1";
|
||||
}
|
||||
else fraction += "0";
|
||||
}
|
||||
|
||||
var res = sign + exponent + fraction;
|
||||
return res;
|
||||
}
|
||||
|
||||
var binary2Real = function (binary, type) {
|
||||
var neg, nullE = true, nullF = true, oneE = true, strE = "", x = 0, exp, man, bias;
|
||||
|
||||
if ((binary.charAt(0) == 0))
|
||||
neg = false;
|
||||
else
|
||||
neg = true;
|
||||
|
||||
switch (type) {
|
||||
|
||||
case TcAdsWebService.TcAdsWebServiceDataTypes.LREAL:
|
||||
exp = 11;
|
||||
man = 52;
|
||||
bias = 1023;
|
||||
break;
|
||||
|
||||
case TcAdsWebService.TcAdsWebServiceDataTypes.REAL:
|
||||
default:
|
||||
exp = 8;
|
||||
man = 23;
|
||||
bias = 127;
|
||||
}
|
||||
|
||||
for (var i = 1; i <= exp; i++) {
|
||||
strE += binary.charAt(i);
|
||||
|
||||
if (binary.charAt(i) != "0")
|
||||
nullE = false;
|
||||
|
||||
if (binary.charAt(i) != "1")
|
||||
oneE = false;
|
||||
}
|
||||
|
||||
var strF = "";
|
||||
|
||||
for (var i = exp + 1; i <= exp + man; i++) {
|
||||
strF += binary.charAt(i);
|
||||
|
||||
if (binary.charAt(i) != "0")
|
||||
nullF = false;
|
||||
}
|
||||
|
||||
if (nullE && nullF) {
|
||||
//return ((!neg) ? "0" : "-0");
|
||||
// Return zero for negative and positive zero
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if (oneE && nullF)
|
||||
return Infinity;
|
||||
|
||||
if (oneE && nullF)
|
||||
return NaN;
|
||||
|
||||
var exponent = binary2Dec(strE) - bias;
|
||||
|
||||
var fraction = 0;
|
||||
|
||||
for (var i = 0; i < strF.length; ++i) {
|
||||
fraction = fraction + parseInt(strF.charAt(i)) * Math.pow(2, -(i + 1));
|
||||
}
|
||||
|
||||
fraction = fraction + 1;
|
||||
var ret = Math.pow(-1, binary.charAt(0)) * fraction * Math.pow(2, exponent);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
var ToByte = function (v) {
|
||||
return parseInt(v, 10) & 255;
|
||||
}
|
||||
|
||||
var dec2Binary = function (value) {
|
||||
var buf = "";
|
||||
var buf2 = "";
|
||||
var quotient = value;
|
||||
var i = 0;
|
||||
|
||||
do {
|
||||
buf += (Math.floor(quotient % 2) == 1 ? "1" : "0");
|
||||
quotient /= 2;
|
||||
i++;
|
||||
}
|
||||
while (i < 8);
|
||||
|
||||
buf = buf.split("").reverse().join("");
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
var binary2Dec = function (binary) {
|
||||
var ret = 0;
|
||||
|
||||
for (var i = 0; i < binary.length; ++i) {
|
||||
if (binary.charAt(i) == '1')
|
||||
ret = ret + Math.pow(2, (binary.length - i - 1));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
var convertDataToUInt = function (data, len) {
|
||||
var res = 0;
|
||||
|
||||
if (len == 4) {
|
||||
res = (data.charCodeAt(3) << 24 | data.charCodeAt(2) << 16 | data.charCodeAt(1) << 8 | data.charCodeAt(0 + 0)) >>> 0; // ">>> 0" = handle value as unsigned
|
||||
}
|
||||
else if (len == 2) {
|
||||
res = (data.charCodeAt(1) << 8 | data.charCodeAt(0)) >>> 0; // ">>> 0" = handle value as unsigned
|
||||
}
|
||||
else if (len == 1) {
|
||||
res = data.charCodeAt(0) >>> 0; // ">>> 0" = handle value as unsigned
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
var convertDataToInt = function (data, len) {
|
||||
var res = 0;
|
||||
|
||||
if (len == 4) {
|
||||
res = (data.charCodeAt(3) << 24 | data.charCodeAt(2) << 16 | data.charCodeAt(1) << 8 | data.charCodeAt(0));
|
||||
}
|
||||
else if (len == 2) {
|
||||
var cCode = (data.charCodeAt(1) << 8 | data.charCodeAt(0));
|
||||
var sign = (cCode & 0x8000);
|
||||
if (sign == 0x8000) {
|
||||
// Byte 1 = 100000, Byte 0 = 000000
|
||||
// Fill left 16 Bytes with 1
|
||||
cCode = cCode | 0xFFFF8000;
|
||||
} else {
|
||||
// Byte 1 = 000000, Byte 0 = 000000
|
||||
// Fill left 16 Bytes with 0
|
||||
cCode = cCode & 0x7FFF;
|
||||
}
|
||||
res = cCode;
|
||||
}
|
||||
else if (len == 1) {
|
||||
// JavaScript handles numbers always as 32 bit integer values;
|
||||
var cCode = data.charCodeAt(0);
|
||||
var sign = (cCode & 0x80);
|
||||
if (sign == 0x80) {
|
||||
// byte_0 = 100000
|
||||
// Fill left 24 Bytes with 1
|
||||
cCode = cCode | 0xFFFFFF80;
|
||||
} else {
|
||||
// byte_0 = 000000
|
||||
// Fill left 24 Bytes with 0
|
||||
cCode = cCode & 0x7F;
|
||||
}
|
||||
res = cCode;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
});
|
||||
////////////////////////////////////////////////////
|
||||
// Expose TcAdsWebService instance to window object.
|
||||
window.TcAdsWebService = TcAdsWebService;
|
||||
////////////////////////////////////////////////////
|
||||
})(window);
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,151 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!-- Generated 10/15/04 by Microsoft SOAP Toolkit WSDL File Generator, Version 1.02.813.0 -->
|
||||
<definitions name ='TcAdsWebService' targetNamespace = 'http://beckhoff.org/wsdl/'
|
||||
xmlns:wsdlns='http://beckhoff.org/wsdl/'
|
||||
xmlns:typens='http://beckhoff.org/type'
|
||||
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
|
||||
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
|
||||
xmlns:stk='http://schemas.microsoft.com/soap-toolkit/wsdl-extension'
|
||||
xmlns='http://schemas.xmlsoap.org/wsdl/'>
|
||||
<types>
|
||||
<schema targetNamespace='http://beckhoff.org/type'
|
||||
xmlns='http://www.w3.org/2001/XMLSchema'
|
||||
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'
|
||||
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
|
||||
elementFormDefault='qualified'>
|
||||
</schema>
|
||||
</types>
|
||||
<message name='TcAdsSync.Write'>
|
||||
<part name='netId' type='xsd:string'/>
|
||||
<part name='nPort' type='xsd:int'/>
|
||||
<part name='indexGroup' type='xsd:unsignedInt'/>
|
||||
<part name='indexOffset' type='xsd:unsignedInt'/>
|
||||
<part name='pData' type='xsd:base64Binary'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.WriteResponse'>
|
||||
</message>
|
||||
<message name='TcAdsSync.Read'>
|
||||
<part name='netId' type='xsd:string'/>
|
||||
<part name='nPort' type='xsd:int'/>
|
||||
<part name='indexGroup' type='xsd:unsignedInt'/>
|
||||
<part name='indexOffset' type='xsd:unsignedInt'/>
|
||||
<part name='cbLen' type='xsd:int'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.ReadResponse'>
|
||||
<part name='ppData' type='xsd:base64Binary'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.ReadWrite'>
|
||||
<part name='netId' type='xsd:string'/>
|
||||
<part name='nPort' type='xsd:int'/>
|
||||
<part name='indexGroup' type='xsd:unsignedInt'/>
|
||||
<part name='indexOffset' type='xsd:unsignedInt'/>
|
||||
<part name='cbRdLen' type='xsd:int'/>
|
||||
<part name='pwrData' type='xsd:base64Binary'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.ReadWriteResponse'>
|
||||
<part name='ppRdData' type='xsd:base64Binary'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.ReadState'>
|
||||
<part name='netId' type='xsd:string'/>
|
||||
<part name='nPort' type='xsd:int'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.ReadStateResponse'>
|
||||
<part name='pAdsState' type='xsd:int'/>
|
||||
<part name='pDeviceState' type='xsd:int'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.WriteControl'>
|
||||
<part name='netId' type='xsd:string'/>
|
||||
<part name='nPort' type='xsd:int'/>
|
||||
<part name='adsState' type='xsd:int'/>
|
||||
<part name='deviceState' type='xsd:int'/>
|
||||
<part name='pData' type='xsd:base64Binary'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.WriteControlResponse'>
|
||||
</message>
|
||||
<portType name='TcAdsSyncSoapPort'>
|
||||
<operation name='Write' parameterOrder='netId nPort indexGroup indexOffset pData'>
|
||||
<input message='wsdlns:TcAdsSync.Write' />
|
||||
<output message='wsdlns:TcAdsSync.WriteResponse' />
|
||||
</operation>
|
||||
<operation name='Read' parameterOrder='netId nPort indexGroup indexOffset cbLen ppData'>
|
||||
<input message='wsdlns:TcAdsSync.Read' />
|
||||
<output message='wsdlns:TcAdsSync.ReadResponse' />
|
||||
</operation>
|
||||
<operation name='ReadWrite' parameterOrder='netId nPort indexGroup indexOffset cbRdLen ppRdData pwrData'>
|
||||
<input message='wsdlns:TcAdsSync.ReadWrite' />
|
||||
<output message='wsdlns:TcAdsSync.ReadWriteResponse' />
|
||||
</operation>
|
||||
<operation name='ReadState' parameterOrder='netId nPort pAdsState pDeviceState'>
|
||||
<input message='wsdlns:TcAdsSync.ReadState' />
|
||||
<output message='wsdlns:TcAdsSync.ReadStateResponse' />
|
||||
</operation>
|
||||
<operation name='WriteControl' parameterOrder='netId nPort adsState deviceState pData'>
|
||||
<input message='wsdlns:TcAdsSync.WriteControl' />
|
||||
<output message='wsdlns:TcAdsSync.WriteControlResponse' />
|
||||
</operation>
|
||||
</portType>
|
||||
<binding name='TcAdsSyncSoapBinding' type='wsdlns:TcAdsSyncSoapPort' >
|
||||
<stk:binding preferredEncoding='UTF-8'/>
|
||||
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http' />
|
||||
<operation name='Write' >
|
||||
<soap:operation soapAction='http://beckhoff.org/action/TcAdsSync.Write' />
|
||||
<input>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</output>
|
||||
</operation>
|
||||
<operation name='Read' >
|
||||
<soap:operation soapAction='http://beckhoff.org/action/TcAdsSync.Read' />
|
||||
<input>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</output>
|
||||
</operation>
|
||||
<operation name='ReadWrite' >
|
||||
<soap:operation soapAction='http://beckhoff.org/action/TcAdsSync.ReadWrite' />
|
||||
<input>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</output>
|
||||
</operation>
|
||||
<operation name='ReadState' >
|
||||
<soap:operation soapAction='http://beckhoff.org/action/TcAdsSync.ReadState' />
|
||||
<input>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</output>
|
||||
</operation>
|
||||
<operation name='WriteControl' >
|
||||
<soap:operation soapAction='http://beckhoff.org/action/TcAdsSync.WriteControl' />
|
||||
<input>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
<service name='TcAdsWebService' >
|
||||
<port name='TcAdsSyncSoapPort' binding='wsdlns:TcAdsSyncSoapBinding' >
|
||||
<soap:address location='http://localhost/TcAdsWebService/TcAdsWebService.dll' />
|
||||
</port>
|
||||
</service>
|
||||
</definitions>
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
/*********************************/
|
||||
Binary file not shown.
@@ -0,0 +1,151 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!-- Generated 10/15/04 by Microsoft SOAP Toolkit WSDL File Generator, Version 1.02.813.0 -->
|
||||
<definitions name ='TcAdsWebService' targetNamespace = 'http://beckhoff.org/wsdl/'
|
||||
xmlns:wsdlns='http://beckhoff.org/wsdl/'
|
||||
xmlns:typens='http://beckhoff.org/type'
|
||||
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
|
||||
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
|
||||
xmlns:stk='http://schemas.microsoft.com/soap-toolkit/wsdl-extension'
|
||||
xmlns='http://schemas.xmlsoap.org/wsdl/'>
|
||||
<types>
|
||||
<schema targetNamespace='http://beckhoff.org/type'
|
||||
xmlns='http://www.w3.org/2001/XMLSchema'
|
||||
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'
|
||||
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
|
||||
elementFormDefault='qualified'>
|
||||
</schema>
|
||||
</types>
|
||||
<message name='TcAdsSync.Write'>
|
||||
<part name='netId' type='xsd:string'/>
|
||||
<part name='nPort' type='xsd:int'/>
|
||||
<part name='indexGroup' type='xsd:unsignedInt'/>
|
||||
<part name='indexOffset' type='xsd:unsignedInt'/>
|
||||
<part name='pData' type='xsd:base64Binary'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.WriteResponse'>
|
||||
</message>
|
||||
<message name='TcAdsSync.Read'>
|
||||
<part name='netId' type='xsd:string'/>
|
||||
<part name='nPort' type='xsd:int'/>
|
||||
<part name='indexGroup' type='xsd:unsignedInt'/>
|
||||
<part name='indexOffset' type='xsd:unsignedInt'/>
|
||||
<part name='cbLen' type='xsd:int'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.ReadResponse'>
|
||||
<part name='ppData' type='xsd:base64Binary'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.ReadWrite'>
|
||||
<part name='netId' type='xsd:string'/>
|
||||
<part name='nPort' type='xsd:int'/>
|
||||
<part name='indexGroup' type='xsd:unsignedInt'/>
|
||||
<part name='indexOffset' type='xsd:unsignedInt'/>
|
||||
<part name='cbRdLen' type='xsd:int'/>
|
||||
<part name='pwrData' type='xsd:base64Binary'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.ReadWriteResponse'>
|
||||
<part name='ppRdData' type='xsd:base64Binary'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.ReadState'>
|
||||
<part name='netId' type='xsd:string'/>
|
||||
<part name='nPort' type='xsd:int'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.ReadStateResponse'>
|
||||
<part name='pAdsState' type='xsd:int'/>
|
||||
<part name='pDeviceState' type='xsd:int'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.WriteControl'>
|
||||
<part name='netId' type='xsd:string'/>
|
||||
<part name='nPort' type='xsd:int'/>
|
||||
<part name='adsState' type='xsd:int'/>
|
||||
<part name='deviceState' type='xsd:int'/>
|
||||
<part name='pData' type='xsd:base64Binary'/>
|
||||
</message>
|
||||
<message name='TcAdsSync.WriteControlResponse'>
|
||||
</message>
|
||||
<portType name='TcAdsSyncSoapPort'>
|
||||
<operation name='Write' parameterOrder='netId nPort indexGroup indexOffset pData'>
|
||||
<input message='wsdlns:TcAdsSync.Write' />
|
||||
<output message='wsdlns:TcAdsSync.WriteResponse' />
|
||||
</operation>
|
||||
<operation name='Read' parameterOrder='netId nPort indexGroup indexOffset cbLen ppData'>
|
||||
<input message='wsdlns:TcAdsSync.Read' />
|
||||
<output message='wsdlns:TcAdsSync.ReadResponse' />
|
||||
</operation>
|
||||
<operation name='ReadWrite' parameterOrder='netId nPort indexGroup indexOffset cbRdLen ppRdData pwrData'>
|
||||
<input message='wsdlns:TcAdsSync.ReadWrite' />
|
||||
<output message='wsdlns:TcAdsSync.ReadWriteResponse' />
|
||||
</operation>
|
||||
<operation name='ReadState' parameterOrder='netId nPort pAdsState pDeviceState'>
|
||||
<input message='wsdlns:TcAdsSync.ReadState' />
|
||||
<output message='wsdlns:TcAdsSync.ReadStateResponse' />
|
||||
</operation>
|
||||
<operation name='WriteControl' parameterOrder='netId nPort adsState deviceState pData'>
|
||||
<input message='wsdlns:TcAdsSync.WriteControl' />
|
||||
<output message='wsdlns:TcAdsSync.WriteControlResponse' />
|
||||
</operation>
|
||||
</portType>
|
||||
<binding name='TcAdsSyncSoapBinding' type='wsdlns:TcAdsSyncSoapPort' >
|
||||
<stk:binding preferredEncoding='UTF-8'/>
|
||||
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http' />
|
||||
<operation name='Write' >
|
||||
<soap:operation soapAction='http://beckhoff.org/action/TcAdsSync.Write' />
|
||||
<input>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</output>
|
||||
</operation>
|
||||
<operation name='Read' >
|
||||
<soap:operation soapAction='http://beckhoff.org/action/TcAdsSync.Read' />
|
||||
<input>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</output>
|
||||
</operation>
|
||||
<operation name='ReadWrite' >
|
||||
<soap:operation soapAction='http://beckhoff.org/action/TcAdsSync.ReadWrite' />
|
||||
<input>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</output>
|
||||
</operation>
|
||||
<operation name='ReadState' >
|
||||
<soap:operation soapAction='http://beckhoff.org/action/TcAdsSync.ReadState' />
|
||||
<input>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</output>
|
||||
</operation>
|
||||
<operation name='WriteControl' >
|
||||
<soap:operation soapAction='http://beckhoff.org/action/TcAdsSync.WriteControl' />
|
||||
<input>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use='encoded' namespace='http://beckhoff.org/message/'
|
||||
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' />
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
<service name='TcAdsWebService' >
|
||||
<port name='TcAdsSyncSoapPort' binding='wsdlns:TcAdsSyncSoapBinding' >
|
||||
<soap:address location='http://localhost/TcAdsWebService/TcAdsWebService.dll' />
|
||||
</port>
|
||||
</service>
|
||||
</definitions>
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
/*********************************/
|
||||
Binary file not shown.
@@ -239,6 +239,16 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
SIMULA,
|
||||
|
||||
/// <summary>
|
||||
/// Adapter Beckhoff
|
||||
/// </summary>
|
||||
BECKHOFF,
|
||||
|
||||
/// <summary>
|
||||
/// Adapter Beckhoff x CPA (selezionatrici ex Jetco)
|
||||
/// </summary>
|
||||
BECKHOFF_CPA,
|
||||
|
||||
/// <summary>
|
||||
/// adapter FANUC
|
||||
/// </summary>
|
||||
|
||||
@@ -1156,6 +1156,12 @@ namespace IOB_WIN_NEXT
|
||||
start.Enabled = true;
|
||||
break;
|
||||
|
||||
case tipoAdapter.BECKHOFF:
|
||||
case tipoAdapter.BECKHOFF_CPA:
|
||||
iobObj = new IobBeckhoffCpa(this, IOBConf);
|
||||
start.Enabled = true;
|
||||
break;
|
||||
|
||||
case tipoAdapter.FILE_GEN:
|
||||
iobObj = new IobFile(this, IOBConf);
|
||||
start.Enabled = true;
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=BECKHOFF_CPA
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=CPA
|
||||
MODEL=SELEZ
|
||||
|
||||
[CNC]
|
||||
IP=5.97.72.66.1.1
|
||||
PORT=851
|
||||
GETPRGNAME=true
|
||||
|
||||
[SERVER]
|
||||
MPIP=http://192.168.1.7
|
||||
MPURL=/MP/IO
|
||||
CMDBASE=/IOB/input/
|
||||
CMDFLOG=/IOB/flog/
|
||||
CMDALIVE=/IOB
|
||||
CMDENABLED=/IOB/enabled/
|
||||
CMDADV1=?valore=
|
||||
CMDREBO=/sendReboot.aspx?idxMacchina=
|
||||
|
||||
[MEMORY]
|
||||
; Red: Y2.0 | Yellow: Y1.7 | Green Y2.1 | riscaldamento Y7.4 | D19.1 MANCA PEZZO (SE rosso)
|
||||
;;BIT0=CONN
|
||||
;BIT1=Y2.1
|
||||
;BIT2=PZCOUNT.PAR.6711
|
||||
;BIT3=Y2.0
|
||||
;BIT4=Y1.7
|
||||
;BIT5=Y7.4
|
||||
;AREAD_START=0
|
||||
;AREAD_SIZE=0
|
||||
;AREAG_SIZE=48
|
||||
;AREAR_START=0
|
||||
;AREAR_SIZE=0
|
||||
;AREAX_START=0
|
||||
;AREAX_SIZE=0
|
||||
;AREAY_START=0
|
||||
;AREAY_SIZE=8
|
||||
;PAR_START=6711
|
||||
;PAR_SIZE=3
|
||||
|
||||
[BLINK]
|
||||
;MAX_COUNTER_BLINK = 30
|
||||
MAX_COUNTER_BLINK = 15
|
||||
;bit0 = 0
|
||||
;bit1 = 0
|
||||
;bit2 = 0
|
||||
;bit3 = 0
|
||||
;bit4 = 1
|
||||
;bit5 = 0
|
||||
;bit6 = 0
|
||||
;bit7 = 0
|
||||
BLINK_FILT=0
|
||||
;BLINK_FILT=16
|
||||
|
||||
[OPTPAR]
|
||||
;;PZCOUNT_MODE=STD|BIT
|
||||
;PZCOUNT_MODE=STD.PAR.6711
|
||||
;PZGTOT_MODE=STD.PAR.6712
|
||||
;PZREQ_MODE=STD.PAR.6713
|
||||
;;PZCAD_MODE=STD.D.6408.DW
|
||||
;ENABLE_PZ_RESET=TRUE
|
||||
;ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
STATE_VAR=VarADS.StatoMacchina
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=5
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
EARLY_CONNECT=FALSE
|
||||
PARAM_CONF=3023.json
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"mMapWrite": {
|
||||
"setComm": {
|
||||
"name": "setComm",
|
||||
"description": "Commessa",
|
||||
"tipoMem": "String",
|
||||
"memAddr": "VarADS.NomeLancioRichiesto",
|
||||
"index": 0,
|
||||
"size": 0
|
||||
},
|
||||
"setArt": {
|
||||
"name": "setArt",
|
||||
"description": "Articolo",
|
||||
"tipoMem": "String",
|
||||
"memAddr": "VarADS.NomeDisegnoRichiesto",
|
||||
"index": 0,
|
||||
"size": 0
|
||||
},
|
||||
"setPzComm": {
|
||||
"name": "setPzComm",
|
||||
"description": "Qty",
|
||||
"memAddr": "VarADS.nQuantitaRichiesta",
|
||||
"tipoMem": "DInt",
|
||||
"index": 0,
|
||||
"size": 0
|
||||
}
|
||||
},
|
||||
"mMapRead": {
|
||||
//"StatoMacc": {
|
||||
// "name": "StatoMacc",
|
||||
// "description": "Stato Macchina",
|
||||
// "memAddr": "VarADS.StatoMacchina",
|
||||
// "tipoMem": "DInt",
|
||||
// "index": 0,
|
||||
// "size": 0,
|
||||
// "func": "POINT",
|
||||
// "period": 60,
|
||||
// "factor": 1
|
||||
//},
|
||||
"CurrArt": {
|
||||
"name": "CurrArt",
|
||||
"description": "Articolo Corrente",
|
||||
"memAddr": "VarADS.NomeDisegno",
|
||||
"tipoMem": "String",
|
||||
"index": 0,
|
||||
"size": 0,
|
||||
"func": "POINT",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
},
|
||||
"CurrComm": {
|
||||
"name": "CurrComm",
|
||||
"description": "Commessa Corrente",
|
||||
"memAddr": "VarADS.NomeLancio",
|
||||
"tipoMem": "String",
|
||||
"index": 0,
|
||||
"size": 0,
|
||||
"func": "POINT",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
},
|
||||
"ContTotali": {
|
||||
"name": "ContTotali",
|
||||
"description": "Pezzi Totali",
|
||||
"memAddr": "VarADS.TotaliLancio",
|
||||
"tipoMem": "DInt",
|
||||
"index": 0,
|
||||
"size": 0,
|
||||
"func": "POINT",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
},
|
||||
"ContBuoni": {
|
||||
"name": "ContBuoni",
|
||||
"description": "Pezzi Buoni",
|
||||
"memAddr": "VarADS.BuoniLancio",
|
||||
"tipoMem": "DInt",
|
||||
"index": 0,
|
||||
"size": 0,
|
||||
"func": "POINT",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
},
|
||||
"ContScarti": {
|
||||
"name": "ContScarti",
|
||||
"description": "Pezzi Scarto",
|
||||
"memAddr": "VarADS.ScartiLancio",
|
||||
"tipoMem": "DInt",
|
||||
"index": 0,
|
||||
"size": 0,
|
||||
"func": "POINT",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
},
|
||||
"ContGenerici": {
|
||||
"name": "ContGenerici",
|
||||
"description": "Pezzi Generici",
|
||||
"memAddr": "VarADS.GenericiLancio",
|
||||
"tipoMem": "DInt",
|
||||
"index": 0,
|
||||
"size": 0,
|
||||
"func": "POINT",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
},
|
||||
"LastMess": {
|
||||
"name": "LastMess",
|
||||
"description": "Ultimo Messaggio",
|
||||
"memAddr": "VarADS.MessaggioInterfaccia",
|
||||
"tipoMem": "String",
|
||||
"index": 0,
|
||||
"size": 0,
|
||||
"func": "POINT",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,6 +166,9 @@
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="TwinCAT.Ads">
|
||||
<HintPath>..\ExtLibs\AdsApi\.NET\v4.0.30319\TwinCAT.Ads.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WebDriver, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Selenium.WebDriver.4.0.1\lib\net46\WebDriver.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -175,9 +178,11 @@
|
||||
<Compile Include="..\VersGen\VersGen.cs">
|
||||
<Link>VersGen.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="TcAdsClient.cs" />
|
||||
<Compile Include="Enums.cs" />
|
||||
<Compile Include="ControlExtensions.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="IobBeckhoffCpa.cs" />
|
||||
<Compile Include="IobFileEurom63.cs" />
|
||||
<Compile Include="IobModbusTCPHam.cs" />
|
||||
<Compile Include="IobModbusTCP.cs" />
|
||||
@@ -186,6 +191,7 @@
|
||||
<Compile Include="IobOmron.cs" />
|
||||
<Compile Include="IobOpcUaCMS.cs" />
|
||||
<Compile Include="IobOpcUaEwon.cs" />
|
||||
<Compile Include="IobBeckhoff.cs" />
|
||||
<Compile Include="IobPing.cs" />
|
||||
<Compile Include="IobSiemensAt2001.cs" />
|
||||
<Compile Include="IobSiemensComeca.cs" />
|
||||
@@ -241,6 +247,12 @@
|
||||
<None Include="DATA\CONF\1033.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\3023.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\3023.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\FOV062.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
using IOB_UT_NEXT;
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace IOB_WIN_NEXT
|
||||
{
|
||||
public class IobBeckhoff : IobGeneric
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected TcAdsClient AdsCli;
|
||||
|
||||
/// <summary>
|
||||
/// Veto controllo status x log...
|
||||
/// </summary>
|
||||
protected DateTime vetoCheckStatus = DateTime.Now;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public List<string> dataVal = new List<string>();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="IOBConf"></param>
|
||||
public IobBeckhoff(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
{
|
||||
lgInfo("NEW IobBeckhoff Adapter");
|
||||
// gestione invio ritardato contapezzi
|
||||
pzCountDelay = utils.CRI("pzCountDelay");
|
||||
// init datetime counters
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
vetoCheckStatus = adesso;
|
||||
|
||||
// ora leggo il file di conf specifico....
|
||||
loadMemConf();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void AdsCli_ValueChanged(TcAdsClient sender, string key, string value)
|
||||
{
|
||||
lg.Info($"Status changed | sender: {sender} | key: {key} | value: {value}");
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupero dati dinamici...
|
||||
/// </summary>
|
||||
public override Dictionary<string, string> getDynData()
|
||||
{
|
||||
// valore non presente in vers default... se gestito fare override
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
if (utils.CRB("enableTSVC"))
|
||||
{
|
||||
try
|
||||
{
|
||||
// processo x ogni valore configurato...
|
||||
if (memMap.mMapRead.Count > 0)
|
||||
{
|
||||
// inizializzo i valori
|
||||
string valString = "";
|
||||
// procedo x ogni valore configurato......
|
||||
foreach (var item in memMap.mMapRead)
|
||||
{
|
||||
// leggo
|
||||
valString = AdsCli.ReadVariabile(item.Value.memAddr).ToString();
|
||||
outVal.Add(item.Value.name, valString);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgInfo($"getDynData: {memMap.mMapRead.Count} record in mMapRead");
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in getDynData x Siemens PLC");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgInfo($"Non processo getDynData: enableTSVC = false");
|
||||
}
|
||||
if (periodicLog || outVal.Count > 0)
|
||||
{
|
||||
lgInfo($"Esito getDynData: {outVal.Count} valori VALIDI in outVal");
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Leggo le variabili correnti (status, contapezzi)
|
||||
/// </summary>
|
||||
public virtual void readCurrVal()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void setEventHandler()
|
||||
{
|
||||
if (AdsCli != null)
|
||||
{
|
||||
AdsCli.ValueChanged += AdsCli_ValueChanged;
|
||||
}
|
||||
}
|
||||
|
||||
/// Override connessione
|
||||
/// </summary>
|
||||
public override void tryConnect()
|
||||
{
|
||||
if (!connectionOk)
|
||||
{
|
||||
int port = 851;
|
||||
int.TryParse(cIobConf.cncPort, out port);
|
||||
string addr = !string.IsNullOrEmpty(cIobConf.cncIpAddr) ? cIobConf.cncIpAddr : "local";
|
||||
lgInfo($"Parametri TC client | addr: {addr} | port: {port}");
|
||||
// predispongo dataVal
|
||||
foreach (var item in memMap.mMapRead)
|
||||
{
|
||||
dataVal.Add(item.Key);
|
||||
}
|
||||
|
||||
// vera connessione!
|
||||
AdsCli = new TcAdsClient(dataVal, addr, port);
|
||||
|
||||
connectionOk = AdsCli.Connected;
|
||||
if (connectionOk)
|
||||
{
|
||||
setEventHandler();
|
||||
readCurrVal();
|
||||
}
|
||||
lgInfo($"Connected: {connectionOk}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override disconnessione
|
||||
/// </summary>
|
||||
public override void tryDisconnect()
|
||||
{
|
||||
lgInfo("Richiesta disconnessione adapter");
|
||||
if (AdsCli != null)
|
||||
{
|
||||
AdsCli.dispose();
|
||||
}
|
||||
connectionOk = false;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
using IOB_UT_NEXT;
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_WIN_NEXT
|
||||
{
|
||||
public class IobBeckhoffCpa : IobBeckhoff
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private string counterVar = "VarADS.BuoniLancio";
|
||||
private string setArtVar = "VarADS.NomeDisegnoRichiesto";
|
||||
private string setCommVar = "VarADS.NomeLancioRichiesto";
|
||||
private string setParamsVar = "VarADS.bCambioArticolo";
|
||||
private string setPzReqVar = "VarADS.nQuantitaRichiesta";
|
||||
private string statusVar = "VarADS.StatoMacchina";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int currStatus = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="IOBConf"></param>
|
||||
public IobBeckhoffCpa(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
{
|
||||
lgInfo("START IobBeckhoffCPA Adapter specifico");
|
||||
|
||||
if (getOptPar("ADD_VARS").ToLower() == "true")
|
||||
{
|
||||
// fixme conf var gestite ad eventi da json
|
||||
dataVal.Add(statusVar);
|
||||
}
|
||||
|
||||
//var myArtCorr = myADS.ReadVariabile("VarADS.NomeDisegno");
|
||||
//myADS.WriteVariabile("VarADS.NomeDisegnoRichiesto", "NUOVO DISEGNO");
|
||||
//myADS.WriteVariabile("VarADS.bCambioArticolo", 1);
|
||||
|
||||
if (getOptPar("EARLY_CONNECT").ToLower() == "true")
|
||||
{
|
||||
tryConnect();
|
||||
}
|
||||
#if false
|
||||
// FIXME leggere conf da file parametri
|
||||
int port = 851;
|
||||
int.TryParse(IOBConf.cncPort, out port);
|
||||
string addr = !string.IsNullOrEmpty(IOBConf.cncIpAddr) ? IOBConf.cncIpAddr : "local";
|
||||
lgInfo($"Parametri TC client | addr: {addr} | port: {port}");
|
||||
AdsCli = new TcAdsClient(dataVal, addr, port);
|
||||
//AdsCli = new TcAdsClient(dataVal, "5.97.72.66.1.1", 851);
|
||||
#endif
|
||||
if (AdsCli != null)
|
||||
{
|
||||
readCurrVal();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void AdsCli_CountChanged(TcAdsClient sender, int newCount)
|
||||
{
|
||||
contapezziPLC = newCount;
|
||||
lg.Info($"Nuova lettura contapezzi | contapezziPLC: {contapezziPLC} | contapezziIOB: {contapezziIOB}");
|
||||
}
|
||||
|
||||
private void AdsCli_StatusChanged(TcAdsClient sender, int newStatus)
|
||||
{
|
||||
currStatus = newStatus;
|
||||
lg.Info($"Status changed: {newStatus}");
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Processo i task richiesti e li elimino dalla coda 1:1
|
||||
/// </summary>
|
||||
/// <param name="task2exe"></param>
|
||||
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
|
||||
{
|
||||
lgInfo($"Chiamata executeTasks specifica IobBeckhoffCpa: {task2exe.Count} task ricevuti");
|
||||
// Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti...
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
string taskVal = "";
|
||||
// inizio con 1 byte di default
|
||||
byte[] MemBlock = new byte[1];
|
||||
if (task2exe != null)
|
||||
{
|
||||
// cerco task specifici
|
||||
foreach (var item in task2exe)
|
||||
{
|
||||
taskVal = "";
|
||||
// converto richiesta in enum...
|
||||
taskType tName = taskType.nihil;
|
||||
Enum.TryParse(item.Key, out tName);
|
||||
// controllo sulla KEY
|
||||
switch (tName)
|
||||
{
|
||||
case taskType.nihil:
|
||||
case taskType.fixStopSetup:
|
||||
case taskType.forceResetPzCount:
|
||||
case taskType.forceSetPzCount:
|
||||
case taskType.setProg:
|
||||
case taskType.sendWatchDogMes2Plc:
|
||||
case taskType.startSetup:
|
||||
case taskType.stopSetup:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
break;
|
||||
|
||||
case taskType.setPzComm:
|
||||
AdsCli.WriteVariabile(setPzReqVar, item.Value);
|
||||
AdsCli.WriteVariabile(setParamsVar, 1);
|
||||
break;
|
||||
|
||||
case taskType.setArt:
|
||||
AdsCli.WriteVariabile(setArtVar, item.Value);
|
||||
AdsCli.WriteVariabile(setParamsVar, 1);
|
||||
break;
|
||||
|
||||
case taskType.setComm:
|
||||
AdsCli.WriteVariabile(setCommVar, item.Value);
|
||||
AdsCli.WriteVariabile(setParamsVar, 1);
|
||||
break;
|
||||
|
||||
case taskType.setParameter:
|
||||
// richiedo da URL i parametri WRITE da popolare
|
||||
lgInfo("Chiamata processMemWriteRequests");
|
||||
|
||||
taskVal = processMemWriteRequests();
|
||||
// se restituiscce "" faccio altra prova...
|
||||
if (string.IsNullOrEmpty(taskVal))
|
||||
{
|
||||
// i parametri me li aspetto come stringa composta paramName|paramvalue
|
||||
if (item.Value.Contains("|"))
|
||||
{
|
||||
string[] paramsJob = item.Value.Split('|');
|
||||
taskVal = $"REQUEST SET PARAMETERS: {paramsJob[0]} --> {paramsJob[1]}";
|
||||
}
|
||||
else
|
||||
{
|
||||
taskVal = $"WRONG REQUEST FOR SET PARAMETERS: {item.Value} doesnt contain pipe for splitting key/value";
|
||||
}
|
||||
}
|
||||
|
||||
// aggiunta finale bit a 1 x richiesta processing..
|
||||
AdsCli.WriteVariabile(setParamsVar, 1);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
taskVal = "SKIPPED | NO EXEC";
|
||||
break;
|
||||
}
|
||||
// aggiungo task!
|
||||
taskDone.Add(item.Key, taskVal);
|
||||
}
|
||||
}
|
||||
return taskDone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua vero processing contapezzi
|
||||
/// </summary>
|
||||
public override void processContapezzi()
|
||||
{
|
||||
if (utils.CRB("enableContapezzi"))
|
||||
{
|
||||
var rawCount = AdsCli.ReadVariabile(counterVar).ToString();
|
||||
if (!string.IsNullOrEmpty(rawCount))
|
||||
{
|
||||
int newVal = -1;
|
||||
int.TryParse(rawCount, out newVal);
|
||||
contapezziPLC = newVal > -1 ? newVal : contapezziPLC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Leggo le variabili correnti (status, contapezzi)
|
||||
/// </summary>
|
||||
public override void readCurrVal()
|
||||
{
|
||||
var rawStatus = AdsCli.ReadVariabile(statusVar).ToString();
|
||||
if (!string.IsNullOrEmpty(rawStatus))
|
||||
{
|
||||
int.TryParse(rawStatus, out currStatus);
|
||||
}
|
||||
var rawCount = AdsCli.ReadVariabile(counterVar).ToString();
|
||||
if (!string.IsNullOrEmpty(rawCount))
|
||||
{
|
||||
int newVal = -1;
|
||||
int.TryParse(rawCount, out newVal);
|
||||
contapezziPLC = newVal > -1 ? newVal : contapezziPLC;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua lettura semafori principale
|
||||
/// <paramref name="currDispData">Parametri da aggiornare x display in form</paramref>
|
||||
/// </summary>
|
||||
public override void readSemafori(ref newDisplayData currDispData)
|
||||
{
|
||||
/* -----------------------------------------------------
|
||||
* STATE MACHINE 60
|
||||
* --------------------------
|
||||
* bitmap MAPO
|
||||
* B0: POWER_ON
|
||||
* B1: RUN
|
||||
* B2: pzCount
|
||||
* B3: allarme
|
||||
* B4: manuale
|
||||
* B5: slowTC
|
||||
* B6: WarmUpCoolDown
|
||||
* B7: emergenza
|
||||
*
|
||||
* --------------------------
|
||||
* Enum Stato macchina
|
||||
* --------------------------
|
||||
* Errore = -1,
|
||||
* Ferma = 0,
|
||||
* Automatica = 1,
|
||||
* Manuale = 2,
|
||||
* Emergenza = 3,
|
||||
* AzzeraTavola = 4,
|
||||
* ManualeStazione = 5,
|
||||
* Avviamento = 7
|
||||
----------------------------------------------------- */
|
||||
|
||||
byte[] MemBlock = new byte[2];
|
||||
try
|
||||
{
|
||||
if (connectionOk)
|
||||
{
|
||||
B_input = 1;
|
||||
currDispData.semIn = Semaforo.SV;
|
||||
}
|
||||
else
|
||||
{
|
||||
B_input = 0;
|
||||
currDispData.semIn = Semaforo.SR;
|
||||
}
|
||||
// in base all'enum di status compilo valori...
|
||||
switch (currStatus)
|
||||
{
|
||||
case -1:
|
||||
B_input += (1 << 3);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
case 2:
|
||||
case 4:
|
||||
case 5:
|
||||
case 7:
|
||||
B_input += (1 << 4);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
B_input += (1 << 7);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
B_input += (1 << 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
currDispData.semIn = Semaforo.SR;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void setEventHandler()
|
||||
{
|
||||
base.setEventHandler();
|
||||
if (AdsCli != null)
|
||||
{
|
||||
AdsCli.StatusChanged += AdsCli_StatusChanged;
|
||||
AdsCli.CountChanged += AdsCli_CountChanged;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#if false
|
||||
public enum EnuStates //Stato Macchina
|
||||
{
|
||||
Errore = -1,
|
||||
Ferma = 0,
|
||||
Automatica = 1,
|
||||
Manuale = 2,
|
||||
Emergenza = 3,
|
||||
AzzeraTavola = 4,
|
||||
ManualeStazione = 5,
|
||||
Avviamento = 7,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,411 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Threading;
|
||||
using TwinCAT;
|
||||
using TwinCAT.Ads;
|
||||
using TwinCAT.Ads.TypeSystem;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TwinCAT.TypeSystem;
|
||||
|
||||
namespace IOB_WIN_NEXT
|
||||
{
|
||||
/// <summary>
|
||||
/// Client comunicazioni con PLC Beckhoff TwinCat
|
||||
/// </summary>
|
||||
|
||||
public class TcAdsClient
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// elenco delle variabili monitorate x change event
|
||||
/// </summary>
|
||||
private List<string> _MonitVars = new List<string>();
|
||||
|
||||
private int _status;
|
||||
|
||||
private List<int> addedSignalationList = new List<int>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario di conversione da indice a index group e index offset
|
||||
/// </summary>
|
||||
private Dictionary<int, Tuple<int, int>> addressList;
|
||||
|
||||
private TwinCAT.Ads.TcAdsClient adsClient;
|
||||
|
||||
private CancellationTokenSource cts;
|
||||
|
||||
//private Action<object> dispatcher;
|
||||
private System.Threading.Tasks.Task dispatchertask;
|
||||
|
||||
private int eventHandle;
|
||||
|
||||
private object lockobj = new object();
|
||||
|
||||
private AdsStream newNotificationStream;
|
||||
|
||||
private int notifyposition;
|
||||
|
||||
private AdsStream notifyStream;
|
||||
|
||||
private int SegnalazioniADSEventHandle, StatusChangedEventHandle, MessageQueuedEventHandle;
|
||||
|
||||
private Symbol StatoMacchina;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public System.Collections.Concurrent.ConcurrentQueue<ComandiADS> CodaComandi;
|
||||
|
||||
public TwinCAT.Ads.TcAdsSymbolInfoLoader InfoLoader;
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario delle variabili monitorate (gestite ad evento x modifica), chiave = nome var, valore = symbol x gestione variabile
|
||||
/// </summary>
|
||||
public Dictionary<string, Symbol> MonitoredItems = new Dictionary<string, Symbol>();
|
||||
|
||||
public TwinCAT.TypeSystem.ISymbolLoader SymbolLoaderInstance;
|
||||
|
||||
public TcAdsSymbolInfoCollection Symbols;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Inizializza un oggetto ADS x gestione classe comunicazione con TwinCat
|
||||
/// </summary>
|
||||
/// <param name="MonitVars">Lista dei nomi delle variabili da gestire ad eventChange (es stato macchina)</param>
|
||||
/// <param name="indirizzo">indirizzo tipo AmsNetId</param>
|
||||
/// <param name="porta">Porta comunicazione: Connect to local PLC - Runtime 1 - TwinCAT2 Port=801, TwinCAT3 Port=851</param>
|
||||
public TcAdsClient(List<string> MonitVars, string indirizzo = "local", int porta = 851)
|
||||
{
|
||||
_MonitVars = MonitVars;
|
||||
MonitoredItems = new Dictionary<string, Symbol>();
|
||||
notifyStream = new AdsStream();
|
||||
newNotificationStream = new AdsStream();
|
||||
addressList = new Dictionary<int, Tuple<int, int>>();
|
||||
bool ready = false;
|
||||
while (!ready)
|
||||
{
|
||||
try
|
||||
{
|
||||
//LETTURA DEL VETTORE DI INIZIALIZZAZIONE
|
||||
if (adsClient == null) adsClient = new TwinCAT.Ads.TcAdsClient();
|
||||
// Connect to local PLC - Runtime 1 - TwinCAT2 Port=801, TwinCAT3 Port=851
|
||||
if (indirizzo == "")
|
||||
{
|
||||
adsClient.Connect(porta);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (adsClient.IsConnected == false) adsClient.Connect(indirizzo, porta);
|
||||
}
|
||||
|
||||
SymbolLoaderInstance = SymbolLoaderFactory.Create(adsClient, SymbolLoaderSettings.Default);
|
||||
InfoLoader = adsClient.CreateSymbolInfoLoader();
|
||||
Symbols = InfoLoader.GetSymbols(true);
|
||||
ready = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Threading.Thread.Sleep(100);
|
||||
ready = false;
|
||||
Debug.Print(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
// inizializzo dizionario delle variabili gestite
|
||||
foreach (var item in _MonitVars)
|
||||
{
|
||||
var currSymbol = (Symbol)SymbolLoaderInstance.Symbols[item];
|
||||
currSymbol.NotificationSettings = new AdsNotificationSettings(AdsTransMode.OnChange, 100, 100);
|
||||
currSymbol.ValueChanged += MonItem_ValueChanged;
|
||||
// aggiungo al dict
|
||||
MonitoredItems.Add(item, currSymbol);
|
||||
}
|
||||
|
||||
StatoMacchina = (Symbol)SymbolLoaderInstance.Symbols["VarADS.StatoMacchina"];
|
||||
StatoMacchina.NotificationSettings = new AdsNotificationSettings(AdsTransMode.OnChange, 100, 100);
|
||||
StatoMacchina.ValueChanged += StatoMacchina_ValueChanged;
|
||||
|
||||
notifyposition = 0;
|
||||
cts = new CancellationTokenSource();
|
||||
|
||||
//adsClient.AdsNotification += new AdsNotificationEventHandler(adsClient_AdsNotification);
|
||||
|
||||
CodaComandi = new System.Collections.Concurrent.ConcurrentQueue<ComandiADS>();
|
||||
cts = new CancellationTokenSource(); //Task require CancellationToken.cancel() to stop
|
||||
Action<object> Azione = commandDispatcher;
|
||||
//Definisce e Crea un Task di base a priorità favorevole
|
||||
dispatchertask = new Task(Azione, cts.Token, TaskCreationOptions.PreferFairness);
|
||||
dispatchertask.Start();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Delegates
|
||||
|
||||
public delegate void CountChangedEventHandler(TcAdsClient sender, int newCount);
|
||||
|
||||
public delegate void StatusChangedEventHandler(TcAdsClient sender, int newStatus);
|
||||
|
||||
public delegate void ValueChangedEventHandler(TcAdsClient sender, string key, string value);
|
||||
|
||||
#endregion Public Delegates
|
||||
|
||||
#region Public Events
|
||||
|
||||
public event CountChangedEventHandler CountChanged;
|
||||
|
||||
public event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public event ValueChangedEventHandler ValueChanged;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public TwinCAT.Ads.TcAdsClient Client
|
||||
{
|
||||
get { return adsClient; }
|
||||
}
|
||||
|
||||
public bool Connected
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (adsClient != null)
|
||||
{
|
||||
answ = adsClient.IsConnected;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnableEvents { get; set; }
|
||||
|
||||
public int Status
|
||||
{
|
||||
get
|
||||
{
|
||||
var stato = ReadVariabile("VarADS.StatoMacchina");
|
||||
if (stato != null) _status = (int)stato;
|
||||
else
|
||||
{
|
||||
throw new Exception("Errore lettura stato");
|
||||
}
|
||||
return _status;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void commandDispatcher(object tk)
|
||||
{
|
||||
ComandiADS comando;
|
||||
Thread.CurrentThread.Name = "ADS Command Dispatcher";
|
||||
CancellationToken chiudi = (CancellationToken)tk;
|
||||
while (!chiudi.IsCancellationRequested)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
if (CodaComandi.Count <= 0)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
continue;
|
||||
}
|
||||
if (CodaComandi.Count > 100) Debug.Print("CODA COMANDI! " + CodaComandi.Count.ToString());
|
||||
if (!CodaComandi.TryDequeue(out comando)) continue;
|
||||
|
||||
if (CodaComandi.Count > 1000) continue;
|
||||
|
||||
if (comando.ComandoScrittua) //gestione scrittura
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comando.SymbolName != "")
|
||||
{
|
||||
if (comando.Symbol == null) comando.Symbol = GetSymbolInfo(comando.SymbolName);
|
||||
}
|
||||
else
|
||||
{
|
||||
comando.SymbolName = comando.Symbol.Name;
|
||||
}
|
||||
if (comando.Value is int && comando.Symbol.Category == TwinCAT.TypeSystem.DataTypeCategory.Array)
|
||||
{
|
||||
var newvalue = new int[comando.Symbol.ArrayInfos[0].Elements];
|
||||
newvalue[0] = (int)comando.Value;
|
||||
comando.Value = newvalue;
|
||||
}
|
||||
if (comando.Value is double && comando.Symbol.Category == TwinCAT.TypeSystem.DataTypeCategory.Array)
|
||||
{
|
||||
var newvalue = new double[comando.Symbol.ArrayInfos[0].Elements];
|
||||
newvalue[0] = (double)comando.Value;
|
||||
comando.Value = newvalue;
|
||||
}
|
||||
adsClient.WriteSymbol(comando.Symbol, comando.Value);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
comando.Error = true;
|
||||
Debug.Print(comando.SymbolName + " Scrittura " + err.Message);
|
||||
}
|
||||
comando.Updating.Set();
|
||||
}
|
||||
else // gestione lettura
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comando.SymbolName != "")
|
||||
{
|
||||
if (comando.Symbol == null) comando.Symbol = GetSymbolInfo(comando.SymbolName);
|
||||
}
|
||||
else
|
||||
{
|
||||
comando.SymbolName = comando.Symbol.Name;
|
||||
}
|
||||
|
||||
comando.Value = adsClient.ReadSymbol(comando.Symbol);
|
||||
}
|
||||
catch (Exception errore)
|
||||
{
|
||||
Debug.Print(errore.Message);
|
||||
comando.Error = true;
|
||||
Debug.Print("Error reading from ADS: VarName: " + comando.SymbolName);
|
||||
}
|
||||
comando.Updating.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MonItem_ValueChanged(object sender, TwinCAT.TypeSystem.ValueChangedArgs e)
|
||||
{
|
||||
string newStatus = $"{e.Value}";
|
||||
if (ValueChanged != null)
|
||||
{
|
||||
ValueChanged(this, $"{sender}", newStatus);
|
||||
}
|
||||
}
|
||||
|
||||
private object ReadVariabile(ComandiADS comando)
|
||||
{
|
||||
CodaComandi.Enqueue(comando);
|
||||
bool test = comando.Updating.Wait(3000);
|
||||
if (!test) Debug.Print("Errore attesa lettura: " + comando.SymbolName);
|
||||
if (comando.Value == null) Debug.Print("ADS Variabile non trovata: " + comando.SymbolName);
|
||||
return comando.Value;
|
||||
}
|
||||
|
||||
private void StatoMacchina_ValueChanged(object sender, TwinCAT.TypeSystem.ValueChangedArgs e)
|
||||
{
|
||||
int newStatus = (int)e.Value;
|
||||
if (StatusChanged != null) StatusChanged(this, newStatus);
|
||||
}
|
||||
|
||||
private bool WriteVariabile(ComandiADS comando, bool syncronous)
|
||||
{
|
||||
bool test = true;
|
||||
CodaComandi.Enqueue(comando);
|
||||
if (syncronous) test = comando.Updating.Wait(3000);
|
||||
if (!test) Debug.Print("Errore attesa lettura: " + comando.SymbolName);
|
||||
if (comando.Error) Debug.Print("Errore ADS durante la scrittura della variabile: " + comando.SymbolName);
|
||||
return !comando.Error;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
adsClient.Dispose();
|
||||
}
|
||||
|
||||
public TcAdsSymbolInfo GetSymbolInfo(string nome)
|
||||
{
|
||||
try
|
||||
{
|
||||
var symbol = InfoLoader.FindSymbol(nome);
|
||||
return symbol;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public object ReadVariabile(ref TcAdsSymbolInfo variabile)
|
||||
{
|
||||
var comando = new ComandiADS { ComandoScrittua = false, Symbol = variabile };
|
||||
return ReadVariabile(comando);
|
||||
}
|
||||
|
||||
public object ReadVariabile(string symbolName, Type type = null)
|
||||
{
|
||||
var comando = new ComandiADS { ComandoScrittua = false, SymbolName = symbolName };
|
||||
return ReadVariabile(comando);
|
||||
}
|
||||
|
||||
public bool WriteVariabile(string symbolName, object value, bool syncronous = false)
|
||||
{
|
||||
var comando = new ComandiADS { Value = value, ComandoScrittua = true, SymbolName = symbolName };
|
||||
return WriteVariabile(comando, syncronous);
|
||||
}
|
||||
|
||||
public bool WriteVariabile(TcAdsSymbolInfo symbol, object value, bool syncronous = false)
|
||||
{
|
||||
var comando = new ComandiADS { Value = value, ComandoScrittua = true, Symbol = symbol };
|
||||
return WriteVariabile(comando, syncronous);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Public Classes
|
||||
|
||||
public class ComandiADS
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public bool ComandoScrittua;
|
||||
public bool Error;
|
||||
public TcAdsSymbolInfo Symbol;
|
||||
public string SymbolName;
|
||||
public ManualResetEventSlim Updating;
|
||||
public object Value;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public ComandiADS()
|
||||
{
|
||||
Updating = new ManualResetEventSlim(false);
|
||||
}
|
||||
|
||||
public ComandiADS(string name)
|
||||
{
|
||||
SymbolName = name;
|
||||
Updating = new ManualResetEventSlim(false);
|
||||
}
|
||||
|
||||
public ComandiADS(TcAdsSymbolInfo info)
|
||||
{
|
||||
Symbol = info;
|
||||
Updating = new ManualResetEventSlim(false);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
[*.cs]
|
||||
|
||||
# IDE0058: Il valore dell'espressione non viene mai usato
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:none
|
||||
|
||||
# CA1051: Non dichiarare campi di istanza visibili
|
||||
dotnet_diagnostic.CA1051.severity = none
|
||||
|
||||
# CA1303: Non passare valori letterali come parametri localizzati
|
||||
dotnet_diagnostic.CA1303.severity = none
|
||||
|
||||
# CA1806: Non ignorare i risultati del metodo
|
||||
dotnet_diagnostic.CA1806.severity = none
|
||||
|
||||
# CA1305: Specificare IFormatProvider
|
||||
dotnet_diagnostic.CA1305.severity = none
|
||||
|
||||
# CA1031: Do not catch general exception types
|
||||
dotnet_diagnostic.CA1031.severity = none
|
||||
|
||||
# CA1707: Gli identificatori non devono contenere caratteri di sottolineatura
|
||||
dotnet_diagnostic.CA1707.severity = none
|
||||
|
||||
# CA1307: Specificare StringComparison
|
||||
dotnet_diagnostic.CA1307.severity = none
|
||||
|
||||
# CA1063: Implement IDisposable Correctly
|
||||
dotnet_diagnostic.CA1063.severity = none
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31402.337
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test-Beckhoff", "Test-Beckhoff\Test-Beckhoff.csproj", "{41930054-510F-4893-8973-D50CD2241C5C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{41930054-510F-4893-8973-D50CD2241C5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{41930054-510F-4893-8973-D50CD2241C5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{41930054-510F-4893-8973-D50CD2241C5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{41930054-510F-4893-8973-D50CD2241C5C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C43DB985-D122-49F0-AE6E-DADEFFC1AD3D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,324 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Threading;
|
||||
using TwinCAT;
|
||||
using TwinCAT.Ads;
|
||||
using TwinCAT.Ads.TypeSystem;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TwinCAT.TypeSystem;
|
||||
|
||||
namespace Test_Beckhoff
|
||||
{
|
||||
|
||||
//var handle = adsClient.AddDeviceNotification("MAIN.boolVal", dataStream, 0, 1,
|
||||
// AdsTransMode.OnChange, 100, 0, new object() );
|
||||
|
||||
// Structure declaration for handles
|
||||
|
||||
public enum EnuStates //Stato Macchina
|
||||
{
|
||||
Errore = -1,
|
||||
Ferma = 0,
|
||||
Automatica = 1,
|
||||
Manuale = 2,
|
||||
Emergenza = 3,
|
||||
AzzeraTavola = 4,
|
||||
ManualeStazione = 5,
|
||||
Avviamento = 7,
|
||||
}
|
||||
|
||||
public class ADS
|
||||
|
||||
{
|
||||
|
||||
public class ComandiADS
|
||||
{
|
||||
|
||||
public TcAdsSymbolInfo Symbol;
|
||||
public string SymbolName;
|
||||
public bool ComandoScrittua;
|
||||
public object Value;
|
||||
public ManualResetEventSlim Updating;
|
||||
public bool Error;
|
||||
public ComandiADS()
|
||||
{
|
||||
Updating = new ManualResetEventSlim(false);
|
||||
}
|
||||
public ComandiADS(string name)
|
||||
{
|
||||
SymbolName = name;
|
||||
Updating = new ManualResetEventSlim(false);
|
||||
}
|
||||
public ComandiADS(TcAdsSymbolInfo info)
|
||||
{
|
||||
Symbol = info;
|
||||
Updating = new ManualResetEventSlim(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario di conversione da indice a index group e index offset
|
||||
/// </summary>
|
||||
private Dictionary<int, Tuple<int, int>> addressList;
|
||||
public delegate void StatusChangedEventHandler(ADS sender, EnuStates newStatus);
|
||||
public TcAdsSymbolInfoCollection Symbols;
|
||||
private TcAdsClient adsClient;
|
||||
public TcAdsClient Client
|
||||
{
|
||||
get { return adsClient; }
|
||||
}
|
||||
public TwinCAT.Ads.TcAdsSymbolInfoLoader InfoLoader;
|
||||
public TwinCAT.TypeSystem.ISymbolLoader SymbolLoaderInstance;
|
||||
|
||||
private List<int> addedSignalationList = new List<int>();
|
||||
|
||||
private int notifyposition;
|
||||
private int eventHandle;
|
||||
private int SegnalazioniADSEventHandle, StatusChangedEventHandle, MessageQueuedEventHandle;
|
||||
|
||||
private AdsStream notifyStream;
|
||||
private AdsStream newNotificationStream;
|
||||
|
||||
public bool EnableEvents { get; set; }
|
||||
|
||||
private EnuStates _status;
|
||||
private object lockobj = new object();
|
||||
|
||||
//private Action<object> dispatcher;
|
||||
private System.Threading.Tasks.Task dispatchertask;
|
||||
public System.Collections.Concurrent.ConcurrentQueue<ComandiADS> CodaComandi;
|
||||
private CancellationTokenSource cts;
|
||||
|
||||
Symbol StatoMacchina;
|
||||
|
||||
|
||||
public event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
|
||||
public ADS(string indirizzo = "local", int porta = 851)
|
||||
{
|
||||
notifyStream = new AdsStream();
|
||||
newNotificationStream = new AdsStream();
|
||||
addressList = new Dictionary<int, Tuple<int, int>>();
|
||||
bool ready = false;
|
||||
while (!ready)
|
||||
{
|
||||
try
|
||||
{
|
||||
//LETTURA DEL VETTORE DI INIZIALIZZAZIONE
|
||||
if (adsClient == null) adsClient = new TcAdsClient();
|
||||
// Connect to local PLC - Runtime 1 - TwinCAT2 Port=801, TwinCAT3 Port=851
|
||||
if (indirizzo == "")
|
||||
{
|
||||
adsClient.Connect(porta);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (adsClient.IsConnected == false) adsClient.Connect(indirizzo, porta);
|
||||
}
|
||||
|
||||
SymbolLoaderInstance = SymbolLoaderFactory.Create(adsClient, SymbolLoaderSettings.Default);
|
||||
InfoLoader = adsClient.CreateSymbolInfoLoader();
|
||||
Symbols = InfoLoader.GetSymbols(true);
|
||||
ready = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Threading.Thread.Sleep(100);
|
||||
ready = false;
|
||||
Debug.Print(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
StatoMacchina = (Symbol)SymbolLoaderInstance.Symbols["VarADS.StatoMacchina"];
|
||||
StatoMacchina.NotificationSettings = new AdsNotificationSettings(AdsTransMode.OnChange, 100, 100);
|
||||
StatoMacchina.ValueChanged += StatoMacchina_ValueChanged;
|
||||
|
||||
|
||||
notifyposition = 0;
|
||||
cts = new CancellationTokenSource();
|
||||
|
||||
//adsClient.AdsNotification += new AdsNotificationEventHandler(adsClient_AdsNotification);
|
||||
|
||||
CodaComandi = new System.Collections.Concurrent.ConcurrentQueue<ComandiADS>();
|
||||
cts = new CancellationTokenSource(); //Task require CancellationToken.cancel() to stop
|
||||
Action<object> Azione = commandDispatcher;
|
||||
dispatchertask = new Task(Azione, cts.Token, TaskCreationOptions.PreferFairness); //Definisce e Crea un Task di base a priorità favorevole
|
||||
dispatchertask.Start();
|
||||
}
|
||||
|
||||
|
||||
private void StatoMacchina_ValueChanged(object sender, TwinCAT.TypeSystem.ValueChangedArgs e)
|
||||
{
|
||||
EnuStates newStatus = (EnuStates)e.Value;
|
||||
if (StatusChanged != null) StatusChanged(this, newStatus);
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
//adsClient.Dispose();
|
||||
}
|
||||
|
||||
|
||||
public TcAdsSymbolInfo GetSymbolInfo(string nome)
|
||||
{
|
||||
try
|
||||
{
|
||||
var symbol = InfoLoader.FindSymbol(nome);
|
||||
return symbol;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void commandDispatcher(object tk)
|
||||
{
|
||||
ComandiADS comando;
|
||||
Thread.CurrentThread.Name = "ADS Command Dispatcher";
|
||||
CancellationToken chiudi = (CancellationToken)tk;
|
||||
while (!chiudi.IsCancellationRequested)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
if (CodaComandi.Count <= 0)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
continue;
|
||||
}
|
||||
if (CodaComandi.Count > 100) Debug.Print("CODA COMANDI! " + CodaComandi.Count.ToString());
|
||||
if (!CodaComandi.TryDequeue(out comando)) continue;
|
||||
|
||||
if (CodaComandi.Count > 1000) continue;
|
||||
|
||||
if (comando.ComandoScrittua) //gestione scrittura
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comando.SymbolName != "")
|
||||
{
|
||||
if (comando.Symbol == null) comando.Symbol = GetSymbolInfo(comando.SymbolName);
|
||||
}
|
||||
else
|
||||
{
|
||||
comando.SymbolName = comando.Symbol.Name;
|
||||
}
|
||||
if (comando.Value is int && comando.Symbol.Category == TwinCAT.TypeSystem.DataTypeCategory.Array)
|
||||
{
|
||||
var newvalue = new int[comando.Symbol.ArrayInfos[0].Elements];
|
||||
newvalue[0] = (int)comando.Value;
|
||||
comando.Value = newvalue;
|
||||
}
|
||||
if (comando.Value is double && comando.Symbol.Category == TwinCAT.TypeSystem.DataTypeCategory.Array)
|
||||
{
|
||||
var newvalue = new double[comando.Symbol.ArrayInfos[0].Elements];
|
||||
newvalue[0] = (double)comando.Value;
|
||||
comando.Value = newvalue;
|
||||
}
|
||||
adsClient.WriteSymbol(comando.Symbol, comando.Value);
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
comando.Error = true;
|
||||
Debug.Print(comando.SymbolName + " Scrittura " + err.Message);
|
||||
}
|
||||
comando.Updating.Set();
|
||||
}
|
||||
else // gestione lettura
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comando.SymbolName != "")
|
||||
{
|
||||
if (comando.Symbol == null) comando.Symbol = GetSymbolInfo(comando.SymbolName);
|
||||
}
|
||||
else
|
||||
{
|
||||
comando.SymbolName = comando.Symbol.Name;
|
||||
}
|
||||
|
||||
comando.Value = adsClient.ReadSymbol(comando.Symbol);
|
||||
|
||||
}
|
||||
catch (Exception errore)
|
||||
{
|
||||
Debug.Print(errore.Message);
|
||||
comando.Error = true;
|
||||
Debug.Print("Error reading from ADS: VarName: " + comando.SymbolName);
|
||||
}
|
||||
comando.Updating.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object ReadVariabile(ref TcAdsSymbolInfo variabile)
|
||||
{
|
||||
var comando = new ComandiADS { ComandoScrittua = false, Symbol = variabile };
|
||||
return ReadVariabile(comando);
|
||||
}
|
||||
|
||||
public object ReadVariabile(string symbolName, Type type = null)
|
||||
{
|
||||
var comando = new ComandiADS { ComandoScrittua = false, SymbolName = symbolName };
|
||||
return ReadVariabile(comando);
|
||||
}
|
||||
|
||||
|
||||
private object ReadVariabile(ComandiADS comando)
|
||||
{
|
||||
CodaComandi.Enqueue(comando);
|
||||
bool test = comando.Updating.Wait(3000);
|
||||
if (!test) Debug.Print("Errore attesa lettura: " + comando.SymbolName);
|
||||
if (comando.Value == null) Debug.Print("ADS Variabile non trovata: " + comando.SymbolName);
|
||||
return comando.Value;
|
||||
}
|
||||
|
||||
public bool WriteVariabile(string symbolName, object value, bool syncronous = false)
|
||||
{
|
||||
var comando = new ComandiADS { Value = value, ComandoScrittua = true, SymbolName = symbolName };
|
||||
return WriteVariabile(comando, syncronous);
|
||||
}
|
||||
|
||||
public bool WriteVariabile(TcAdsSymbolInfo symbol, object value, bool syncronous = false)
|
||||
{
|
||||
var comando = new ComandiADS { Value = value, ComandoScrittua = true, Symbol = symbol };
|
||||
return WriteVariabile(comando, syncronous);
|
||||
}
|
||||
|
||||
private bool WriteVariabile(ComandiADS comando, bool syncronous)
|
||||
{
|
||||
bool test = true;
|
||||
CodaComandi.Enqueue(comando);
|
||||
if (syncronous) test = comando.Updating.Wait(3000);
|
||||
if (!test) Debug.Print("Errore attesa lettura: " + comando.SymbolName);
|
||||
if (comando.Error) Debug.Print("Errore ADS durante la scrittura della variabile: " + comando.SymbolName);
|
||||
return !comando.Error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public EnuStates Status
|
||||
{
|
||||
get
|
||||
{
|
||||
var stato = ReadVariabile("VarADS.StatoMacchina");
|
||||
if (stato != null) _status = (EnuStates)stato;
|
||||
else
|
||||
{
|
||||
throw new Exception("Errore lettura stato");
|
||||
}
|
||||
return _status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
Generated
+62
@@ -0,0 +1,62 @@
|
||||
|
||||
namespace Test_Beckhoff
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Variabile di progettazione necessaria.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Pulire le risorse in uso.
|
||||
/// </summary>
|
||||
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Codice generato da Progettazione Windows Form
|
||||
|
||||
/// <summary>
|
||||
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
|
||||
/// il contenuto del metodo con l'editor di codice.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(51, 49);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "Start ADS";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button button1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Test_Beckhoff
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
//var myADS = new ADS("local", 851);
|
||||
var myADS = new ADS("5.97.72.66.1.1", 851);
|
||||
|
||||
var myArtCorr = myADS.ReadVariabile("VarADS.NomeDisegno");
|
||||
|
||||
myADS.WriteVariabile("VarADS.NomeDisegnoRichiesto", "NUOVO DISEGNO");
|
||||
|
||||
myADS.WriteVariabile("VarADS.bCambioArticolo", 1);
|
||||
|
||||
myADS.StatusChanged += MyADS_StatusChanged;
|
||||
}
|
||||
|
||||
private void MyADS_StatusChanged(ADS sender, EnuStates newStatus)
|
||||
{
|
||||
// notifica evento valore modificato (stato)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Test_Beckhoff
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Punto di ingresso principale dell'applicazione.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Le informazioni generali relative a un assembly sono controllate dal seguente
|
||||
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
|
||||
// associate a un assembly.
|
||||
[assembly: AssemblyTitle("Test-Beckhoff")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Test-Beckhoff")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
|
||||
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
|
||||
// COM, impostare su true l'attributo ComVisible per tale tipo.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
|
||||
[assembly: Guid("41930054-510f-4893-8973-d50cd2241c5c")]
|
||||
|
||||
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
|
||||
//
|
||||
// Versione principale
|
||||
// Versione secondaria
|
||||
// Numero di build
|
||||
// Revisione
|
||||
//
|
||||
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
|
||||
// usando l'asterisco '*' come illustrato di seguito:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Codice generato da uno strumento.
|
||||
// Versione runtime:4.0.30319.42000
|
||||
//
|
||||
// Le modifiche apportate a questo file possono causare un comportamento non corretto e andranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace Test_Beckhoff.Properties
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
|
||||
/// </summary>
|
||||
// Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder
|
||||
// tramite uno strumento quale ResGen o Visual Studio.
|
||||
// Per aggiungere o rimuovere un membro, modificare il file .ResX, quindi eseguire di nuovo ResGen
|
||||
// con l'opzione /str oppure ricompilare il progetto VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce l'istanza di ResourceManager memorizzata nella cache e usata da questa classe.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test_Beckhoff.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte
|
||||
/// le ricerche di risorse che utilizzano questa classe di risorse fortemente tipizzata.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace Test_Beckhoff.Properties
|
||||
{
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{41930054-510F-4893-8973-D50CD2241C5C}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Test_Beckhoff</RootNamespace>
|
||||
<AssemblyName>Test-Beckhoff</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="TwinCAT.Ads, Version=4.2.169.0, Culture=neutral, PublicKeyToken=180016cd49e5e8c3, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\ExtLibs\AdsApi\.NET\v4.0.30319\TwinCAT.Ads.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ADS.cs" />
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="stdole">
|
||||
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user