mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 11:11:23 +00:00
Added string value to register base for viewmodel support
- counted up version number
This commit is contained in:
@@ -30,6 +30,12 @@ namespace Examples {
|
|||||||
//reading a value from the register collection
|
//reading a value from the register collection
|
||||||
Console.WriteLine($"BitValue is: {registers.BitValue}");
|
Console.WriteLine($"BitValue is: {registers.BitValue}");
|
||||||
|
|
||||||
|
interf.GetRegister(nameof(registers.TestInt16)).PropertyChanged += (s, e) => {
|
||||||
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
Console.WriteLine(interf.GetRegister(nameof(registers.TestInt16)).StringValue);
|
||||||
|
Console.ResetColor();
|
||||||
|
};
|
||||||
|
|
||||||
//writing a value to the registers
|
//writing a value to the registers
|
||||||
Task.Factory.StartNew(async () => {
|
Task.Factory.StartNew(async () => {
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,37 @@ namespace MewtocolNet.Registers {
|
|||||||
public event Action<object> ValueChanged;
|
public event Action<object> ValueChanged;
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The register name or null of not defined
|
||||||
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// The registers memory adress if not a special register
|
||||||
|
/// </summary>
|
||||||
public int MemoryAdress { get; set; }
|
public int MemoryAdress { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// The rgisters memory length
|
||||||
|
/// </summary>
|
||||||
public int MemoryLength { get; set; }
|
public int MemoryLength { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The value of the register auto converted to a string
|
||||||
|
/// </summary>
|
||||||
|
public string StringValue => GetValueString();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name the register would have in the PLC
|
||||||
|
/// </summary>
|
||||||
|
public string RegisterPLCName => GetRegisterPLCName();
|
||||||
|
|
||||||
internal bool isUsedBitwise { get; set; }
|
internal bool isUsedBitwise { get; set; }
|
||||||
|
|
||||||
|
internal Register () {
|
||||||
|
ValueChanged += (obj) => {
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(StringValue)));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public virtual string BuildMewtocolIdent() {
|
public virtual string BuildMewtocolIdent() {
|
||||||
|
|
||||||
StringBuilder asciistring = new StringBuilder("D");
|
StringBuilder asciistring = new StringBuilder("D");
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<PackageId>MewtocolNet</PackageId>
|
<PackageId>MewtocolNet</PackageId>
|
||||||
<Version>0.3.3</Version>
|
<Version>0.3.4</Version>
|
||||||
<Authors>Felix Weiss</Authors>
|
<Authors>Felix Weiss</Authors>
|
||||||
<Company>Womed</Company>
|
<Company>Womed</Company>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
|
|||||||
Reference in New Issue
Block a user