From 6499ec7142a487cfe984059764d82e26bc134624 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Sun, 2 Apr 2023 16:50:13 +0200 Subject: [PATCH] Matter increase retries (#18317) --- .../src/embedded/Matter_Commissioning.be | 10 +- .../src/embedded/Matter_Device.be | 4 +- .../berry_matter/src/embedded/Matter_IM.be | 4 +- .../src/embedded/Matter_IM_Message.be | 8 +- .../src/embedded/Matter_MessageHandler.be | 6 +- .../src/embedded/Matter_Plugin_Light3.be | 6 +- .../src/embedded/Matter_UDPServer.be | 12 +- .../solidified_Matter_Commissioning.h | 449 +++++++++--------- .../src/solidify/solidified_Matter_Device.h | 23 +- .../src/solidify/solidified_Matter_IM.h | 16 +- .../solidify/solidified_Matter_IM_Message.h | 176 +++---- .../solidified_Matter_MessageHandler.h | 111 ++--- .../solidified_Matter_Plugin_Light3.h | 150 +++--- .../solidify/solidified_Matter_UDPServer.h | 148 +++--- 14 files changed, 586 insertions(+), 537 deletions(-) diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Commissioning.be b/lib/libesp32/berry_matter/src/embedded/Matter_Commissioning.be index 39a54a989..85d7ac29a 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Commissioning.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Commissioning.be @@ -104,7 +104,7 @@ class Matter_Commisioning_Context var raw = resp.encode_frame(status_raw) - self.responder.send_response(raw, msg.remote_ip, msg.remote_port, reliable ? resp.message_counter : nil) + self.responder.send_response(raw, msg.remote_ip, msg.remote_port, reliable ? resp.message_counter : nil, msg.session.local_session_id) end def parse_PBKDFParamRequest(msg) @@ -153,7 +153,7 @@ class Matter_Commisioning_Context var resp = msg.build_response(0x21 #-PBKDR Response-#, true) var raw = resp.encode_frame(pbkdfparamresp_raw) - self.responder.send_response(raw, msg.remote_ip, msg.remote_port, resp.message_counter) + self.responder.send_response(raw, msg.remote_ip, msg.remote_port, resp.message_counter, msg.session.local_session_id) end def parse_Pake1(msg) @@ -233,7 +233,7 @@ class Matter_Commisioning_Context var resp = msg.build_response(0x23 #-pake-2-#, true) # no reliable flag var raw = resp.encode_frame(pake2_raw) - self.responder.send_response(raw, msg.remote_ip, msg.remote_port, resp.message_counter) + self.responder.send_response(raw, msg.remote_ip, msg.remote_port, resp.message_counter, msg.session.local_session_id) end def parse_Pake3(msg) @@ -406,7 +406,7 @@ class Matter_Commisioning_Context var resp = msg.build_response(0x33 #-sigma-2-resume-#, true) var raw = resp.encode_frame(sigma2resume_raw) - self.responder.send_response(raw, msg.remote_ip, msg.remote_port, resp.message_counter) + self.responder.send_response(raw, msg.remote_ip, msg.remote_port, resp.message_counter, msg.session.local_session_id) # session.close() session.set_keys(i2r, r2i, ac, created) @@ -485,7 +485,7 @@ class Matter_Commisioning_Context var resp = msg.build_response(0x31 #-sigma-2-#, true) # no reliable flag var raw = resp.encode_frame(sigma2_raw) - self.responder.send_response(raw, msg.remote_ip, msg.remote_port, resp.message_counter) + self.responder.send_response(raw, msg.remote_ip, msg.remote_port, resp.message_counter, msg.session.local_session_id) return true end diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Device.be b/lib/libesp32/berry_matter/src/embedded/Matter_Device.be index d7622bc86..65dd5b14b 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Device.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Device.be @@ -321,8 +321,8 @@ class Matter_Device ############################################################# # Global entry point for sending a message. # Delegates to `udp_server` - def msg_send(raw, addr, port, id) - return self.udp_server.send_response(raw, addr, port, id) + def msg_send(raw, addr, port, id, session_id) + return self.udp_server.send_response(raw, addr, port, id, session_id) end ############################################################# diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_IM.be b/lib/libesp32/berry_matter/src/embedded/Matter_IM.be index 07c51648b..96e15697b 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_IM.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_IM.be @@ -102,8 +102,8 @@ class Matter_IM resp.encrypt() import string tasmota.log(string.format("MTR: >>>> send elements after encrypt") tasmota.log(string.format("MTR: 0 @@ -337,7 +337,7 @@ class Matter_IM_ReportDataSubscribed : Matter_IM_ReportData resp.encode_frame() resp.encrypt() tasmota.log(string.format("MTR: