update to eModbus 1.7.4

This commit is contained in:
MichaelDvP
2025-08-04 10:16:50 +02:00
parent f10f3d5305
commit 7b0169bb68
24 changed files with 178 additions and 101 deletions

View File

@@ -83,7 +83,7 @@ protected:
return headRoom;
}
inline ModbusTCPhead& operator= (ModbusTCPhead& t) {
inline ModbusTCPhead& operator= (const ModbusTCPhead& t) {
transactionID = t.transactionID;
protocolID = t.protocolID;
len = t.len;
@@ -91,7 +91,7 @@ protected:
}
protected:
uint8_t headRoom[6]; // Buffer to hold MSB-first TCP header
uint8_t headRoom[6] = {0,0,0,0,0,0}; // Buffer to hold MSB-first TCP header
};
struct RequestEntry {
@@ -100,7 +100,7 @@ protected:
ModbusTCPhead head;
uint32_t sentTime;
bool isSyncRequest;
RequestEntry(uint32_t t, ModbusMessage m, bool syncReq = false) :
RequestEntry(uint32_t t, const ModbusMessage& m, bool syncReq = false) :
token(t),
msg(m),
head(ModbusTCPhead()),
@@ -109,8 +109,8 @@ protected:
};
// Base addRequest and syncRequest both must be present
Error addRequestM(ModbusMessage msg, uint32_t token);
ModbusMessage syncRequestM(ModbusMessage msg, uint32_t token);
Error addRequestM(ModbusMessage msg, uint32_t token) override;
ModbusMessage syncRequestM(ModbusMessage msg, uint32_t token) override;
// addToQueue: send freshly created request to queue
bool addToQueue(int32_t token, ModbusMessage request, bool syncReq = false);
@@ -121,8 +121,6 @@ protected:
// receive: get response via Client connection
// TCPResponse* receive(uint8_t* data, size_t length);
void isInstance() { return; } // make class instantiable
// TCP handling code, all static taking a class instancs as param
void onConnected();
void onDisconnected();