mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 11:11:23 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea106416ee | ||
|
|
0afa146712 | ||
|
|
325aa56d8a | ||
|
|
f4fad297fb | ||
|
|
664b32b92e | ||
|
|
a639a8eda8 | ||
|
|
23c2b0efb4 |
@@ -47,6 +47,5 @@ namespace Examples {
|
|||||||
[Register(7012)]
|
[Register(7012)]
|
||||||
public TimeSpan TestTime { get; private set; }
|
public TimeSpan TestTime { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ namespace MewtocolNet {
|
|||||||
|
|
||||||
ContinousReaderRunning = true;
|
ContinousReaderRunning = true;
|
||||||
|
|
||||||
|
int getPLCinfoCycleCount = 0;
|
||||||
|
|
||||||
while (ContinousReaderRunning) {
|
while (ContinousReaderRunning) {
|
||||||
|
|
||||||
//do priority tasks first
|
//do priority tasks first
|
||||||
@@ -78,6 +80,11 @@ namespace MewtocolNet {
|
|||||||
|
|
||||||
await PriorityTasks.FirstOrDefault(x => !x.IsCompleted);
|
await PriorityTasks.FirstOrDefault(x => !x.IsCompleted);
|
||||||
|
|
||||||
|
} else if (getPLCinfoCycleCount > 25) {
|
||||||
|
|
||||||
|
await GetPLCInfoAsync();
|
||||||
|
getPLCinfoCycleCount = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var registerPair in Registers) {
|
foreach (var registerPair in Registers) {
|
||||||
@@ -159,6 +166,8 @@ namespace MewtocolNet {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPLCinfoCycleCount++;
|
||||||
|
|
||||||
//invoke cycle polled event
|
//invoke cycle polled event
|
||||||
InvokePolledCycleDone();
|
InvokePolledCycleDone();
|
||||||
|
|
||||||
|
|||||||
@@ -356,6 +356,14 @@ namespace MewtocolNet {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (collection != null)
|
||||||
|
collection.OnInterfaceLinked(this);
|
||||||
|
|
||||||
|
Connected += (i) => {
|
||||||
|
if(collection != null)
|
||||||
|
collection.OnInterfaceLinkedAndOnline(this);
|
||||||
|
};
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ namespace MewtocolNet {
|
|||||||
ErrorCode = error,
|
ErrorCode = error,
|
||||||
StationNumber = int.Parse(station ?? "0"),
|
StationNumber = int.Parse(station ?? "0"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PlcInfo = retInfo;
|
||||||
return retInfo;
|
return retInfo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,17 +10,34 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace MewtocolNet.RegisterAttributes {
|
namespace MewtocolNet.RegisterAttributes {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A register collection base with full auto read and notification support built in
|
||||||
|
/// </summary>
|
||||||
public class RegisterCollectionBase : INotifyPropertyChanged {
|
public class RegisterCollectionBase : INotifyPropertyChanged {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to its bound interface
|
||||||
|
/// </summary>
|
||||||
public MewtocolInterface PLCInterface { get; set; }
|
public MewtocolInterface PLCInterface { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whenever one of its props changes
|
||||||
|
/// </summary>
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
internal void TriggerPropertyChanged (string propertyName = null) {
|
/// <summary>
|
||||||
|
/// Triggers a property changed event
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="propertyName">Name of the property to trigger for</param>
|
||||||
|
public void TriggerPropertyChanged (string propertyName = null) {
|
||||||
var handler = PropertyChanged;
|
var handler = PropertyChanged;
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void OnInterfaceLinked (MewtocolInterface plc) { }
|
||||||
|
|
||||||
|
public virtual void OnInterfaceLinkedAndOnline (MewtocolInterface plc) { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<PackageId>MewtocolNet</PackageId>
|
<PackageId>MewtocolNet</PackageId>
|
||||||
<Version>0.3.0</Version>
|
<Version>0.3.2</Version>
|
||||||
<Authors>Felix Weiss</Authors>
|
<Authors>Felix Weiss</Authors>
|
||||||
<Company>Womed</Company>
|
<Company>Womed</Company>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<UserSecretsId>2ccdcc9b-94a3-4e76-8827-453ab889ea33</UserSecretsId>
|
<UserSecretsId>2ccdcc9b-94a3-4e76-8827-453ab889ea33</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<DocumentationFile>C:\Users\Felix Weiß\source\repos\WOmed\MewtocolNet\Builds\MewtocolNet.xml</DocumentationFile>
|
<DocumentationFile>..\Builds\MewtocolNet.xml</DocumentationFile>
|
||||||
<OutputPath>C:\Users\Felix Weiß\source\repos\WOmed\MewtocolNet\Builds</OutputPath>
|
<OutputPath>..\Builds</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
11
README.md
11
README.md
@@ -18,11 +18,10 @@ This software was written by WOLF Medizintechnik GmbH (@WOmed/dev).
|
|||||||
|
|
||||||
- [x] Read out stats from your PLC
|
- [x] Read out stats from your PLC
|
||||||
- [x] Read and write registers in real time
|
- [x] Read and write registers in real time
|
||||||
- [X] Dynamic register type casting from properties
|
- [x] Dynamic register type casting from properties
|
||||||
- [ ] Change run / prog modes
|
- [x] Change run / prog modes
|
||||||
- [ ] Write byte blocks in a whole chain
|
- [x] Write / read byte blocks in a whole chain
|
||||||
- [ ] Upload programs to the PLC
|
- [ ] Upload / Download programs to the PLC
|
||||||
- [ ] Download programs from the PLC
|
|
||||||
- [ ] Reading / writing PLC system registers
|
- [ ] Reading / writing PLC system registers
|
||||||
|
|
||||||
# Support
|
# Support
|
||||||
@@ -54,7 +53,7 @@ Where is the RS232/Serial support?
|
|||||||
|
|
||||||
Install this package by using [Nuget](https://www.nuget.org/packages/MewtocolNet/) or reference
|
Install this package by using [Nuget](https://www.nuget.org/packages/MewtocolNet/) or reference
|
||||||
```XML
|
```XML
|
||||||
<PackageReference Include="MewtocolNet" Version="0.2.5" />
|
<PackageReference Include="MewtocolNet" Version="0.3.0" />
|
||||||
```
|
```
|
||||||
in your dependencies.
|
in your dependencies.
|
||||||
Alternatively use the dotnet CLI and run
|
Alternatively use the dotnet CLI and run
|
||||||
|
|||||||
Reference in New Issue
Block a user