Matter add internal debug option (#21634)

This commit is contained in:
s-hadinger 2024-06-15 10:56:48 +02:00 committed by GitHub
parent 0c49262d54
commit 2c1f6b24d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 4590 additions and 4565 deletions

View File

@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
- Berry `classof` extended to class methods (#21615)
- Extend command ``SetOption147 1`` to disable publish of IRReceived MQTT messages (#21574)
- Matter support for Rain sensor (#21633)
- Matter add internal debug option
### Breaking Changed

View File

@ -833,7 +833,7 @@ class Matter_IM
log(f"MTR: >Subscribe ({msg.session.local_session_id:6i}) event_requests_size={size(query.event_requests)}", 3)
end
var ret = self._inner_process_read_request(msg.session, query, msg, true #-no_log-#)
var ret = self._inner_process_read_request(msg.session, query, msg, !self.device.debug #-log only if debug enabled-#)
# ret is of type `Matter_ReportDataMessage`
ret.subscription_id = sub.subscription_id # enrich with subscription id TODO
self.send_subscribe_response(msg, ret, sub)

View File

@ -66,6 +66,7 @@ class Matter_Device
var ipv4only # advertize only IPv4 addresses (no IPv6)
var disable_bridge_mode # default is bridge mode, this flag disables this mode for some non-compliant controllers
var next_ep # next endpoint to be allocated for bridge, start at 1
var debug # debug mode, output all values when responding to read request with wildcard
# context for PBKDF
var root_iterations # PBKDF number of iterations
# PBKDF information used only during PASE (freed afterwards)
@ -649,11 +650,14 @@ class Matter_Device
self.update_remotes_info() # update self.plugins_config_remotes
var j = format('{"distinguish":%i,"passcode":%i,"ipv4only":%s,"disable_bridge_mode":%s,"nextep":%i', self.root_discriminator, self.root_passcode, self.ipv4only ? 'true':'false', self.disable_bridge_mode ? 'true':'false', self.next_ep)
if self.debug
j += ',"debug":true'
end
if self.plugins_persist
j += ',"config":'
j += ',\n"config":'
j += json.dump(self.plugins_config)
if size(self.plugins_config_remotes) > 0
j += ',"remotes":'
j += ',\n"remotes":'
j += json.dump(self.plugins_config_remotes)
end
end
@ -717,6 +721,7 @@ class Matter_Device
self.disable_bridge_mode = bool(j.find("disable_bridge_mode", false))
self.next_ep = j.find("nextep", self.next_ep)
self.plugins_config = j.find("config")
self.debug = bool(j.find("debug")) # bool converts nil to false
if self.plugins_config != nil
log(f"MTR: Load_config = {self.plugins_config}", 3)
self.adjust_next_ep()

View File

@ -3417,7 +3417,7 @@ be_local_closure(class_Matter_IM_subscribe_request, /* name */
0, /* has sup protos */
&be_class_Matter_IM,
1, /* has constants */
( &(const bvalue[32]) { /* constants */
( &(const bvalue[34]) { /* constants */
/* K0 */ be_nested_str_weak(matter),
/* K1 */ be_nested_str_weak(SubscribeRequestMessage),
/* K2 */ be_nested_str_weak(from_TLV),
@ -3449,11 +3449,13 @@ be_local_closure(class_Matter_IM_subscribe_request, /* name */
/* K28 */ be_nested_str_weak(event_requests),
/* K29 */ be_nested_str_weak(MTR_X3A_X20_X3ESubscribe_X20_X28_X256i_X29_X20event_requests_size_X3D_X25s),
/* K30 */ be_nested_str_weak(_inner_process_read_request),
/* K31 */ be_nested_str_weak(send_subscribe_response),
/* K31 */ be_nested_str_weak(device),
/* K32 */ be_nested_str_weak(debug),
/* K33 */ be_nested_str_weak(send_subscribe_response),
}),
be_str_weak(subscribe_request),
&be_const_str_solidified,
( &(const binstruction[99]) { /* code */
( &(const binstruction[103]) { /* code */
0xB80E0000, // 0000 GETNGBL R3 K0
0x8C0C0701, // 0001 GETMET R3 R3 K1
0x7C0C0200, // 0002 CALL R3 1
@ -3542,17 +3544,21 @@ be_local_closure(class_Matter_IM_subscribe_request, /* name */
0x88240306, // 0055 GETMBR R9 R1 K6
0x5C280600, // 0056 MOVE R10 R3
0x5C2C0200, // 0057 MOVE R11 R1
0x50300200, // 0058 LDBOOL R12 1 0
0x7C1C0A00, // 0059 CALL R7 5
0x88200919, // 005A GETMBR R8 R4 K25
0x901E3208, // 005B SETMBR R7 K25 R8
0x8C20011F, // 005C GETMET R8 R0 K31
0x5C280200, // 005D MOVE R10 R1
0x5C2C0E00, // 005E MOVE R11 R7
0x5C300800, // 005F MOVE R12 R4
0x7C200800, // 0060 CALL R8 4
0x50200200, // 0061 LDBOOL R8 1 0
0x80041000, // 0062 RET 1 R8
0x8830011F, // 0058 GETMBR R12 R0 K31
0x88301920, // 0059 GETMBR R12 R12 K32
0x78320000, // 005A JMPF R12 #005C
0x50300001, // 005B LDBOOL R12 0 1
0x50300200, // 005C LDBOOL R12 1 0
0x7C1C0A00, // 005D CALL R7 5
0x88200919, // 005E GETMBR R8 R4 K25
0x901E3208, // 005F SETMBR R7 K25 R8
0x8C200121, // 0060 GETMET R8 R0 K33
0x5C280200, // 0061 MOVE R10 R1
0x5C2C0E00, // 0062 MOVE R11 R7
0x5C300800, // 0063 MOVE R12 R4
0x7C200800, // 0064 CALL R8 4
0x50200200, // 0065 LDBOOL R8 1 0
0x80041000, // 0066 RET 1 R8
})
)
);