Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-execution command callback. #20357

Merged
merged 16 commits into from
Jul 14, 2022

Conversation

lnikulin
Copy link
Contributor

@lnikulin lnikulin commented Jul 6, 2022

Problem

Sometimes it is required to perform some kind of preparation work before command is handled. As it seems, there's no way for app to be notified before the command is executed.

Change overview

This PR adds the callback that could be implemented by application uses Matter. This callback is called before every command gets executed.

Resolve #20361

…er. This callback is called before every command gets executed.
Copy link
Contributor

@mrjerryjohns mrjerryjohns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an existing callback defined that could be used instead.

@lnikulin lnikulin requested a review from mrjerryjohns July 8, 2022 13:40
@lnikulin
Copy link
Contributor Author

lnikulin commented Jul 9, 2022

There's an existing callback defined that could be used instead.

done

@lnikulin
Copy link
Contributor Author

There's an existing callback defined that could be used instead.

Done, last commit contains extension for MatterPreCommandReceivedCallback(), added chip::Access::SubjectDescriptor parameter

@lnikulin lnikulin closed this Jul 12, 2022
@lnikulin lnikulin reopened this Jul 12, 2022
@github-actions
Copy link

github-actions bot commented Jul 14, 2022

PR #20357: Size comparison from 415ee2f to c93d8d2

Increases (43 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 415ee2f c93d8d2 change % change
bl602 lighting-app bl602 (read/write) 1397746 1398034 288 0.0
.text 1058716 1059008 292 0.0
bl602+rpc (read/write) 1443170 1443466 296 0.0
.text 1090400 1090692 292 0.0
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 666367 666407 40 0.0
.text 577884 577924 40 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 632167 632215 48 0.0
.text 554436 554484 48 0.0
lock-ftd LP_CC2652R7 (read only) 669283 669323 40 0.0
.text 592496 592536 40 0.0
lock-mtd LP_CC2652R7 (read only) 618683 618731 48 0.0
.text 542008 542056 48 0.0
pump-app LP_CC2652R7 (read only) 678515 678563 48 0.0
.text 589300 589348 48 0.0
pump-controller-app LP_CC2652R7 (read only) 664339 664379 40 0.0
.text 579264 579304 40 0.0
shell LP_CC2652R7 (read only) 658858 658906 48 0.0
.text 573596 573644 48 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 579662 579702 40 0.0
.app_xip_area 458416 458456 40 0.0
lock cyw930739m2evb_01 (read/write) 585614 585654 40 0.0
.app_xip_area 459640 459680 40 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 583114 583154 40 0.0
.app_xip_area 462716 462756 40 0.0
efr32 lighting-app BRD4161A (read/write) 1081772 1082220 448 0.0
.text 946708 947156 448 0.0
BRD4161A+rpc (read/write) 1136084 1136532 448 0.0
.text 984128 984576 448 0.0
BRD4161A+rs911x (read/write) 948248 948696 448 0.0
.text 805412 805860 448 0.1
lock-app BRD4161A+wf200 (read/write) 1129184 1129232 48 0.0
.text 982920 982968 48 0.0
window-app BRD4161A (read/write) 1075588 1076036 448 0.0
.text 939020 939468 448 0.0
esp32 all-clusters-app c3devkit (read only) 1020212 1020258 46 0.0
.flash.text 1020212 1020258 46 0.0
m5stack (read only) 1074119 1074191 72 0.0
.flash.text 1068735 1068807 72 0.0
k32w light k32w061+release (read/write) 658896 658944 48 0.0
.text 581588 581636 48 0.0
lock k32w061+release (read/write) 685776 685824 48 0.0
.text 607992 608040 48 0.0
linux all-clusters-app debug (read only) 2961193 2961321 128 0.0
.text 2520178 2520306 128 0.0
all-clusters-minimal-app debug (read only) 2813785 2813897 112 0.0
.text 2373218 2373330 112 0.0
bridge-app debug+rpc (read only) 2315833 2315945 112 0.0
.text 1955890 1956002 112 0.0
chip-tool debug (read only) 10353593 10353721 128 0.0
.text 8406164 8406292 128 0.0
chip-tool-ipv6only arm64 (read only) 10072172 10072268 96 0.0
.text 8029764 8029860 96 0.0
lighting-app debug+rpc (read only) 2551561 2551673 112 0.0
.text 2167698 2167810 112 0.0
lock-app debug (read only) 2516297 2516409 112 0.0
.text 2122194 2122306 112 0.0
ota-provider-app debug (read only) 2322673 2322785 112 0.0
.text 1956194 1956306 112 0.0
ota-requestor-app debug (read only) 2439745 2439857 112 0.0
.text 2061106 2061218 112 0.0
shell debug (read only) 2551537 2551649 112 0.0
.text 2166482 2166594 112 0.0
thermostat-no-ble arm64 (read only) 2595700 2595780 80 0.0
.text 2190256 2190336 80 0.0
tv-app debug (read only) 3102593 3102705 112 0.0
.text 2665474 2665586 112 0.0
tv-casting-app debug (read only) 5566841 5566969 128 0.0
.text 4946946 4947074 128 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read/write) 2448312 2448400 88 0.0
.text 1410956 1411044 88 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1175411 1175459 48 0.0
text 811552 811596 44 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1155607 1155655 48 0.0
text 800992 801036 44 0.0
p6 all-clusters-app default (read/write) 2566472 2566920 448 0.0
.text 1524736 1525184 448 0.0
all-clusters-minimal-app default (read/write) 2511768 2512216 448 0.0
.text 1470032 1470480 448 0.0
light-app default (read/write) 2441712 2442160 448 0.0
.text 1399976 1400424 448 0.0
lock-app default (read/write) 2468856 2469304 448 0.0
.text 1427120 1427568 448 0.0
telink light-switch-app tlsr9518adk80d (read/write) 797556 797596 40 0.0
text 565748 565790 42 0.0
lighting-app tlsr9518adk80d (read/write) 817380 817428 48 0.0
text 582072 582116 44 0.0
Decreases (5 builds for cc13x2_26x2)
platform target config section 415ee2f c93d8d2 change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read/write) 184856 184816 -40 -0.0
lock-ftd LP_CC2652R7 (read/write) 172084 172044 -40 -0.0
pump-app LP_CC2652R7 (read/write) 163700 163652 -48 -0.0
pump-controller-app LP_CC2652R7 (read/write) 177996 177956 -40 -0.0
shell LP_CC2652R7 (read/write) 187868 187820 -48 -0.0
Full report (43 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 415ee2f c93d8d2 change % change
bl602 lighting-app bl602 (read/write) 1397746 1398034 288 0.0
.bss 116978 116978 0 0.0
.data 4480 4480 0 0.0
.text 1058716 1059008 292 0.0
bl602+rpc (read/write) 1443170 1443466 296 0.0
.bss 124418 124418 0 0.0
.data 4600 4600 0 0.0
.text 1090400 1090692 292 0.0
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 666367 666407 40 0.0
(read/write) 184856 184816 -40 -0.0
.bss 74116 74116 0 0.0
.data 3356 3356 0 0.0
.rodata 88167 88167 0 0.0
.text 577884 577924 40 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 632167 632215 48 0.0
(read/write) 157684 157684 0 0.0
.bss 73412 73412 0 0.0
.data 3356 3356 0 0.0
.rodata 77407 77407 0 0.0
.text 554436 554484 48 0.0
lock-ftd LP_CC2652R7 (read only) 669283 669323 40 0.0
(read/write) 172084 172044 -40 -0.0
.bss 71148 71148 0 0.0
.data 3280 3280 0 0.0
.rodata 76307 76307 0 0.0
.text 592496 592536 40 0.0
lock-mtd LP_CC2652R7 (read only) 618683 618731 48 0.0
(read/write) 144264 144264 0 0.0
.bss 66868 66868 0 0.0
.data 3280 3280 0 0.0
.rodata 76187 76187 0 0.0
.text 542008 542056 48 0.0
pump-app LP_CC2652R7 (read only) 678515 678563 48 0.0
(read/write) 163700 163652 -48 -0.0
.bss 71228 71228 0 0.0
.data 3280 3280 0 0.0
.rodata 88731 88731 0 0.0
.text 589300 589348 48 0.0
pump-controller-app LP_CC2652R7 (read only) 664339 664379 40 0.0
(read/write) 177996 177956 -40 -0.0
.bss 71348 71348 0 0.0
.data 3276 3276 0 0.0
.rodata 84595 84595 0 0.0
.text 579264 579304 40 0.0
shell LP_CC2652R7 (read only) 658858 658906 48 0.0
(read/write) 187868 187820 -48 -0.0
.bss 76420 76420 0 0.0
.data 3360 3360 0 0.0
.rodata 84946 84946 0 0.0
.text 573596 573644 48 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 579662 579702 40 0.0
.app_xip_area 458416 458456 40 0.0
.bss 64184 64184 0 0.0
.data 716 716 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 585614 585654 40 0.0
.app_xip_area 459640 459680 40 0.0
.bss 68912 68912 0 0.0
.data 720 720 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 583114 583154 40 0.0
.app_xip_area 462716 462756 40 0.0
.bss 63392 63392 0 0.0
.data 660 660 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read/write) 1081772 1082220 448 0.0
.bss 132996 132996 0 0.0
.data 2048 2048 0 0.0
.text 946708 947156 448 0.0
BRD4161A+rpc (read/write) 1136084 1136532 448 0.0
.bss 149676 149676 0 0.0
.data 2260 2260 0 0.0
.text 984128 984576 448 0.0
BRD4161A+rs911x (read/write) 948248 948696 448 0.0
.bss 140768 140768 0 0.0
.data 2048 2048 0 0.0
.text 805412 805860 448 0.1
lock-app BRD4161A+wf200 (read/write) 1129184 1129232 48 0.0
.bss 144184 144184 0 0.0
.data 2060 2060 0 0.0
.text 982920 982968 48 0.0
window-app BRD4161A (read/write) 1075588 1076036 448 0.0
.bss 134468 134468 0 0.0
.data 2076 2076 0 0.0
.text 939020 939468 448 0.0
esp32 all-clusters-app c3devkit (read only) 1020212 1020258 46 0.0
(read/write) 1485874 1485874 0 0.0
.dram0.bss 70080 70080 0 0.0
.dram0.data 14600 14600 0 0.0
.flash.rodata 215760 215760 0 0.0
.flash.text 1020212 1020258 46 0.0
.iram0.text 62902 62902 0 0.0
m5stack (read only) 1074119 1074191 72 0.0
(read/write) 487928 487928 0 0.0
.dram0.bss 75600 75600 0 0.0
.dram0.data 34144 34144 0 0.0
.flash.rodata 246188 246188 0 0.0
.flash.text 1068735 1068807 72 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 658896 658944 48 0.0
.bss 69516 69516 0 0.0
.data 1992 1992 0 0.0
.text 581588 581636 48 0.0
lock k32w061+release (read/write) 685776 685824 48 0.0
.bss 69980 69980 0 0.0
.data 2004 2004 0 0.0
.text 607992 608040 48 0.0
linux all-clusters-app debug (read only) 2961193 2961321 128 0.0
(read/write) 154752 154752 0 0.0
.bss 61536 61536 0 0.0
.data 2048 2048 0 0.0
.data.rel.ro 84968 84968 0 0.0
.dynamic 608 608 0 0.0
.got 4536 4536 0 0.0
.init 27 27 0 0.0
.init_array 1048 1048 0 0.0
.rodata 263805 263805 0 0.0
.text 2520178 2520306 128 0.0
all-clusters-minimal-app debug (read only) 2813785 2813897 112 0.0
(read/write) 146688 146688 0 0.0
.bss 60864 60864 0 0.0
.data 2048 2048 0 0.0
.data.rel.ro 77608 77608 0 0.0
.dynamic 608 608 0 0.0
.got 4488 4488 0 0.0
.init 27 27 0 0.0
.init_array 1048 1048 0 0.0
.rodata 265533 265533 0 0.0
.text 2373218 2373330 112 0.0
bridge-app debug+rpc (read only) 2315833 2315945 112 0.0
(read/write) 125504 125504 0 0.0
.bss 48928 48928 0 0.0
.data 3824 3824 0 0.0
.data.rel.ro 66984 66984 0 0.0
.dynamic 608 608 0 0.0
.got 4392 4392 0 0.0
.init 27 27 0 0.0
.init_array 728 728 0 0.0
.rodata 198208 198208 0 0.0
.text 1955890 1956002 112 0.0
chip-tool debug (read only) 10353593 10353721 128 0.0
(read/write) 621760 621760 0 0.0
.bss 24728 24728 0 0.0
.data 3234 3234 0 0.0
.data.rel.ro 587392 587392 0 0.0
.dynamic 608 608 0 0.0
.got 5096 5096 0 0.0
.init 27 27 0 0.0
.init_array 640 640 0 0.0
.rodata 517013 517013 0 0.0
.text 8406164 8406292 128 0.0
chip-tool-ipv6only arm64 (read only) 10072172 10072268 96 0.0
(read/write) 686961 686961 0 0.0
.bss 42961 42961 0 0.0
.data 3304 3304 0 0.0
.data.rel.ro 623032 623032 0 0.0
.dynamic 528 528 0 0.0
.got 13736 13736 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 479804 479804 0 0.0
.text 8029764 8029860 96 0.0
lighting-app debug+rpc (read only) 2551561 2551673 112 0.0
(read/write) 129528 129528 0 0.0
.bss 49440 49440 0 0.0
.data 2096 2096 0 0.0
.data.rel.ro 72136 72136 0 0.0
.dynamic 608 608 0 0.0
.got 4392 4392 0 0.0
.init 27 27 0 0.0
.init_array 816 816 0 0.0
.rodata 213896 213896 0 0.0
.text 2167698 2167810 112 0.0
lock-app debug (read only) 2516297 2516409 112 0.0
(read/write) 124512 124512 0 0.0
.bss 47840 47840 0 0.0
.data 1712 1712 0 0.0
.data.rel.ro 69096 69096 0 0.0
.dynamic 608 608 0 0.0
.got 4424 4424 0 0.0
.init 27 27 0 0.0
.init_array 792 792 0 0.0
.rodata 228936 228936 0 0.0
.text 2122194 2122306 112 0.0
ota-provider-app debug (read only) 2322673 2322785 112 0.0
(read/write) 118312 118312 0 0.0
.bss 47488 47488 0 0.0
.data 1944 1944 0 0.0
.data.rel.ro 63096 63096 0 0.0
.dynamic 608 608 0 0.0
.got 4488 4488 0 0.0
.init 27 27 0 0.0
.init_array 672 672 0 0.0
.rodata 203704 203704 0 0.0
.text 1956194 1956306 112 0.0
ota-requestor-app debug (read only) 2439745 2439857 112 0.0
(read/write) 125216 125216 0 0.0
.bss 49856 49856 0 0.0
.data 2232 2232 0 0.0
.data.rel.ro 67288 67288 0 0.0
.dynamic 608 608 0 0.0
.got 4480 4480 0 0.0
.init 27 27 0 0.0
.init_array 728 728 0 0.0
.rodata 207488 207488 0 0.0
.text 2061106 2061218 112 0.0
shell debug (read only) 2551537 2551649 112 0.0
(read/write) 141104 141104 0 0.0
.bss 57448 57448 0 0.0
.data 1264 1264 0 0.0
.data.rel.ro 76688 76688 0 0.0
.dynamic 608 608 0 0.0
.got 4136 4136 0 0.0
.init 27 27 0 0.0
.init_array 928 928 0 0.0
.rodata 227954 227954 0 0.0
.text 2166482 2166594 112 0.0
thermostat-no-ble arm64 (read only) 2595700 2595780 80 0.0
(read/write) 158289 158289 0 0.0
.bss 65249 65249 0 0.0
.data 1704 1704 0 0.0
.data.rel.ro 83240 83240 0 0.0
.dynamic 528 528 0 0.0
.got 5072 5072 0 0.0
.init 24 24 0 0.0
.init_array 400 400 0 0.0
.rodata 165668 165668 0 0.0
.text 2190256 2190336 80 0.0
tv-app debug (read only) 3102593 3102705 112 0.0
(read/write) 257704 257704 0 0.0
.bss 167016 167016 0 0.0
.data 4848 4848 0 0.0
.data.rel.ro 79392 79392 0 0.0
.dynamic 608 608 0 0.0
.got 4848 4848 0 0.0
.init 27 27 0 0.0
.init_array 952 952 0 0.0
.rodata 249216 249216 0 0.0
.text 2665474 2665586 112 0.0
tv-casting-app debug (read only) 5566841 5566969 128 0.0
(read/write) 161456 161456 0 0.0
.bss 50248 50248 0 0.0
.data 2416 2416 0 0.0
.data.rel.ro 102536 102536 0 0.0
.dynamic 608 608 0 0.0
.got 4744 4744 0 0.0
.init 27 27 0 0.0
.init_array 864 864 0 0.0
.rodata 343241 343241 0 0.0
.text 4946946 4947074 128 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2448312 2448400 88 0.0
.bss 213940 213940 0 0.0
.data 5872 5872 0 0.0
.text 1410956 1411044 88 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1175411 1175459 48 0.0
bss 142900 142900 0 0.0
rodata 142060 142060 0 0.0
text 811552 811596 44 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1155607 1155655 48 0.0
bss 142136 142136 0 0.0
rodata 133608 133608 0 0.0
text 800992 801036 44 0.0
p6 all-clusters-app default (read/write) 2566472 2566920 448 0.0
.bss 149120 149120 0 0.0
.data 2776 2776 0 0.0
.text 1524736 1525184 448 0.0
all-clusters-minimal-app default (read/write) 2511768 2512216 448 0.0
.bss 148400 148400 0 0.0
.data 2776 2776 0 0.0
.text 1470032 1470480 448 0.0
light-app default (read/write) 2441712 2442160 448 0.0
.bss 140456 140456 0 0.0
.data 2592 2592 0 0.0
.text 1399976 1400424 448 0.0
lock-app default (read/write) 2468856 2469304 448 0.0
.bss 140304 140304 0 0.0
.data 2600 2600 0 0.0
.text 1427120 1427568 448 0.0
telink light-switch-app tlsr9518adk80d (read/write) 797556 797596 40 0.0
bss 70576 70576 0 0.0
noinit 40416 40416 0 0.0
text 565748 565790 42 0.0
lighting-app tlsr9518adk80d (read/write) 817380 817428 48 0.0
bss 71420 71420 0 0.0
noinit 40416 40416 0 0.0
text 582072 582116 44 0.0

@andy31415 andy31415 merged commit c04457c into project-chip:master Jul 14, 2022
github-actions bot pushed a commit that referenced this pull request Jul 14, 2022
* Added the callback that could be implemented by application uses Matter. This callback is called before every command gets executed.

* Restyled by astyle

* Restyled by clang-format

* Restyled by whitespace

* Regenerate all callback-stub.cpp and IMCLusterCommandHandler.cpp

* Restyled by astyle

* Restyled by clang-format

* Add pre-execution command callback. #20361
- move MatterPreExecuteCommandCallback() into DispatchSingleClusterCommand()
- regenerate all IMClusterCommandHandler.cpp files

* Restyled by astyle

* Restyled by clang-format

* Removed a modified MTRCallbackBridge.mm file from pull request

* Removed a modified zzz_generated/chip-tool/zap-generated/test/Commands.h file from pull request

* remove all autogenerated files from PR

* Use existing callback MatterPreCommandReceivedCallback to notify "cmd exec" (add fabricIndex parameter)

* Added parameter subjectDescriptor into callbacks Matter(Pre/Post)CommandReceivedCallback (#20361)

Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Andrei Litvin <[email protected]>
@lnikulin lnikulin deleted the preexecute_command_callback branch October 11, 2022 09:45
vivien-apple added a commit to vivien-apple/connectedhomeip-1 that referenced this pull request Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add pre-execution command callback.
6 participants