diff --git a/MewtocolNet/Mewtocol.cs b/MewtocolNet/Mewtocol.cs
index 98cac0d..5ba0302 100644
--- a/MewtocolNet/Mewtocol.cs
+++ b/MewtocolNet/Mewtocol.cs
@@ -444,6 +444,30 @@ namespace MewtocolNet
///
public EndInitSetup WithHeartbeatTask(Func heartBeatAsync, bool executeInProg = false) => WithHeartbeatTask(heartBeatAsync, executeInProg);
+ ///
+ /// Disables all heartbeat tasks
+ ///
+ ///
+ public EndInitSetup DisableHeartBeat() {
+
+ try {
+
+ var plc = (MewtocolInterface)(object)this.intf;
+
+ plc.disableHeartbeat = true;
+
+ return new EndInitSetup {
+ postInit = this,
+ };
+
+ } catch {
+
+ throw;
+
+ }
+
+ }
+
///
/// Builds and returns the final plc interface
///
diff --git a/MewtocolNet/MewtocolInterface.cs b/MewtocolNet/MewtocolInterface.cs
index 36e1bae..a9eb18a 100644
--- a/MewtocolNet/MewtocolInterface.cs
+++ b/MewtocolNet/MewtocolInterface.cs
@@ -79,6 +79,8 @@ namespace MewtocolNet {
private protected Task regularSendTask;
private protected bool wasInitialStatusReceived;
+ private protected bool supportsExtendedMessageHeader;
+ private protected string messageHeader = "%";
private protected MewtocolVersion mewtocolVersion;
#endregion
diff --git a/MewtocolNet/MewtocolInterfaceRegisterHandling.cs b/MewtocolNet/MewtocolInterfaceRegisterHandling.cs
index 017379c..8b8a5dc 100644
--- a/MewtocolNet/MewtocolInterfaceRegisterHandling.cs
+++ b/MewtocolNet/MewtocolInterfaceRegisterHandling.cs
@@ -24,6 +24,7 @@ namespace MewtocolNet {
internal Task heartbeatTask = Task.CompletedTask;
+ internal bool disableHeartbeat = false;
internal Func heartbeatCallbackTask;
internal bool execHeartBeatCallbackTaskInProg = false;
@@ -146,6 +147,13 @@ namespace MewtocolNet {
private async Task HeartbeatTickTask () {
+ if (disableHeartbeat) {
+
+ await Task.CompletedTask;
+ return;
+
+ }
+
if (regularSendTask != null && !regularSendTask.IsCompleted) await regularSendTask;
Logger.LogVerbose("Sending heartbeat", this);
diff --git a/MewtocolNet/MewtocolInterfaceRequests.cs b/MewtocolNet/MewtocolInterfaceRequests.cs
index 10c3d7a..a53d4ce 100644
--- a/MewtocolNet/MewtocolInterfaceRequests.cs
+++ b/MewtocolNet/MewtocolInterfaceRequests.cs
@@ -65,12 +65,21 @@ namespace MewtocolNet {
}
if (isConnectingStage) {
+
//set the intial obj
PlcInfo = plcInf;
+
+ //check if the plc supports the extended command header (<)
+ var res = await SendCommandInternalAsync($"<{GetStationNumber()}#RDD0000000001");
+ supportsExtendedMessageHeader = res.Success;
+ messageHeader = res.Success ? "<" : "%";
+
} else {
+
//update the obj with RT dynamic values only
PlcInfo.SelfDiagnosticError = plcInf.SelfDiagnosticError;
PlcInfo.OperationMode = plcInf.OperationMode;
+
}
return PlcInfo;
@@ -257,7 +266,7 @@ namespace MewtocolNet {
string startStr = start.ToString().PadLeft(5, '0');
string endStr = (start + wordLength - 1).ToString().PadLeft(5, '0');
- string requeststring = $"%{GetStationNumber()}#WDD{startStr}{endStr}{byteString}";
+ string requeststring = $"{messageHeader}{GetStationNumber()}#WDD{startStr}{endStr}{byteString}";
var result = await SendCommandInternalAsync(requeststring);
return result.Success;
@@ -270,6 +279,7 @@ namespace MewtocolNet {
///
/// Start adress
/// Number of bytes to get
+ /// The memory area to read
/// Gets invoked when the progress changes, contains the progress as a double from 0 - 1.0
/// A byte array of the requested DT area
public async Task ReadAreaByteRangeAsync(int start, int byteCount, RegisterPrefix areaPrefix = RegisterPrefix.DT, Action onProgress = null) {
@@ -316,7 +326,7 @@ namespace MewtocolNet {
int blockSize = wordEnd - wordStart + 1;
string startStr = wordStart.ToString().PadLeft(padLeftLen, '0');
string endStr = wordEnd.ToString().PadLeft(padLeftLen, '0');
- string requeststring = $"<{GetStationNumber()}#{areaCodeStr}{startStr}{endStr}";
+ string requeststring = $"{messageHeader}{GetStationNumber()}#{areaCodeStr}{startStr}{endStr}";
var result = await SendCommandInternalAsync(requeststring, onReceiveProgress: readProg);
diff --git a/MewtocolNet/Registers/Base/IRegister.cs b/MewtocolNet/Registers/Base/IRegister.cs
index 5d106f5..d38f9b3 100644
--- a/MewtocolNet/Registers/Base/IRegister.cs
+++ b/MewtocolNet/Registers/Base/IRegister.cs
@@ -81,8 +81,6 @@ namespace MewtocolNet.Registers {
///
uint MemoryAddress { get; }
- string MemoryAreaHash { get; }
-
///
/// Gets the value of the register as the plc representation string
///
diff --git a/MewtocolNet/Registers/Base/Register.cs b/MewtocolNet/Registers/Base/Register.cs
index 27de077..8fe87a3 100644
--- a/MewtocolNet/Registers/Base/Register.cs
+++ b/MewtocolNet/Registers/Base/Register.cs
@@ -101,8 +101,6 @@ namespace MewtocolNet.Registers {
public string MemoryAreaInfo => underlyingMemory.ToString();
- public string MemoryAreaHash => underlyingMemory.GetHashCode().ToString();
-
internal Register() { }
internal virtual void OnPlcConnected () {