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

[Chef] Adding Generic Switch and RPC events #21

Closed
wants to merge 480 commits into from

Conversation

erwinpan1
Copy link
Owner

@erwinpan1 erwinpan1 commented Apr 15, 2024

The purpose of this PR is for

  • Adding Generic Switch devices supporting Latching and Momentary features
  • Implement a generic RPC call rpcs.chip.rpc.Event.Set(endpoint_id=1,cluster_id=1,event_payload='{ .. JSON .. }) to send JSON string (which defines a sequences of Events and AttributeWrites ) to SwitchCluster manager of Chef
  • Chef will need to emit Event or WriteValues sequentially one by one

ying-css and others added 24 commits April 30, 2024 15:05
* 1)Updated guide for Infineon Trust M provisioning

* Update docs/guides/infineon_trustm_provisioning.md

Co-authored-by: Andrei Litvin <[email protected]>

* Restyled by prettier-markdown

---------

Co-authored-by: Andrei Litvin <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
…L. (project-chip#33099)

* Updated unit tests in src/transport/tests/ to use PW instead of NL.

* Updated unit tests in src/protocols/bdx/tests/ to use PW instead of NL

* Updated unit tests in src/transport/raw/tests/ to use PW instead of NL.

* Undid the accidental reformatting of the comments at the top.

* Update src/transport/raw/tests/TestTCP.cpp

Co-authored-by: Arkadiusz Bokowy <[email protected]>

* Update src/transport/raw/tests/TestUDP.cpp

Co-authored-by: Arkadiusz Bokowy <[email protected]>

* Changed some EXPECT_ to ASSERT_.  Changed C-casts to unsigned literals.  Chagned strcmp to EXPECT_STREQ.

* Resolved merge conflicts in test_components[_nl].txt

* Added a destructor to TestUDP to delete the TestContext.

* Added destructor to TestTCP to delete the TestContext.

* Added destructor to TestTCP to delete TestContext.

* Fixed issue with SystemLayerTests being listed multiple times.

* Changed MemoryInit line to ASSERT instead of EXPECT.  Added corresponding MemoryShutdown.

* Inherited TCP test from IOContext so we don't have to create a new context.

* Moved ChckSimpleInitTest and CheckMessageTest into the test context class.

---------

Co-authored-by: Arkadiusz Bokowy <[email protected]>
…#33228)

* adding the led define for the 917 soc

* Restyled by gn

---------

Co-authored-by: Restyled.io <[email protected]>
* TC-DA-1.7: Use steps_function, add missing checks

Also adding in a new flag that will let us use this test in
post-cert (just introducing flag now, checks will be updated
in an upcoming PR).

* Restyled by autopep8

* Restyled by isort

* Make error message more specific

* whoops, missed some

* Use the flag from setup

---------

Co-authored-by: Restyled.io <[email protected]>
…c/lib/dnssd (project-chip#33200)

* std optional in recordwriter

* Fix a call

* Change some advertiser.h to std::optional

* Fix usage in advertiser.cpp

* Make more things compile

* Restyle

* make clang-tidy happy

* Replace chip optional from active resolveattempts

* Fix platform dns

* More test fixes

* Fix one more compile to not have optional at all in dnssd

* Restyle

* Add back removed header

* Some compile fixes for IP address

* more compile fixes - tested that qpg thermostat compiles for me now

* Fix tizen build

* Commissioner passcode fix

* make clang-tidy happy

* Use references for MRPConfig optionals, as the mrpconfig may be larger

* Reduce scope of optional usage

* Use references everywhere for Advertiser

* One more use of a reference

* One more const reference passing to try to reduce code size

* Restyle

* Attempt to make clang-tidy happy in unit tst

* Disable the check via a nolint

* Code review: use C++17 if initializers to scope out temporary optional values

* Use a few more references

* Apply code review comment

* Undo return as reference changes in getters for optional

---------

Co-authored-by: Andrei Litvin <[email protected]>
…milar (project-chip#33028)

* Uniform API: provide subject descriptor only for both value encode and decode

* Split out AttributeEncodeState and decouple things to use less friend classes

* Fix tests

* Slight move around based on pahole results, to try to make size differences a bit smaller

* Fix typo ... amazingly enough tests still pass, so test read is maybe broken

* Two more replacements for state compare logic

* Restyle

* Fix logic error in Descripto creation for test

* Update argument name

* Remove useless comments

* move AttributeEncodeState to a separate file

* Make the copy from a pointer logic cleaner

* Fix value passing

* Fix const correctness

* Fix one more compile

* Put back AccessingFabricIndex

* Updated back the comments and file layout

---------

Co-authored-by: Andrei Litvin <[email protected]>
* Move tests to icd/server/tests

* Remove App dependency from the TestICDManager and build it on its own

* Convert TestICDMonitoringTable to gtest

* Fix build and address review comments

* Add define guards in case some builds dont use TCP / UDP endpoints
And also enable the ApplicationInit
Add TCPConnect()/TCPDisconnect() API for explicit connection setup.
Currently, connecting to a peer is coupled with sending a message to the
peer.
This decouples the two and creates a clear API for connecting to a peer
address. Goes along with the existing Disconnect() API.
This would be essential during activation of retained sessions by solely
connecting to the peer and associating with the retained session.

Surface Connection completion and Closure callbacks and hook them
through SessionManager(TransportMgr delegate) and CASESession.

Mark SecureSession as defunct on connection closures.

Modify ActiveConnectionState in TCPBase to hold state for each
connection, so that it is able to handle the various control flow paths.

Associate a session with a connection object.

Associate the PeerAddress with the session early. Pass the PeerAddress
in the Find APIs. This helps check against the correct TransportType
when searching for a Sesssion in the SessionTable.

Add a `large payload` flag in EstablishSession() and Session lookup
functions to create/associate with the correct session and transport.

Have default configurations for TCP in a separate TCPConfig.h.

Refactor echo_requester.cpp and echo_responder.cpp to use the session
associated with the connection.

Handle Connection closure at ExchangeMgr and uplevel to corresponding
ExchangeContext using the corresponding session handle.

Add tests around connection establishment in TestTCP.
* pw_unit_test migration: lib support batch 5

* pw_unit_test migration: lib support batch 4 (project-chip#33199)

* pw_unit_test migration: lib support batch 4

* fix merge error BUILD.gn

* pw_unit_test migration: lib support batch 5

* newline

* removing commented-out code

* convert TestCHIPArgParser test
)

* [Python] Implement async friendly GetConnectedDevice

Currently GetConnectedDeviceSync() is blocking e.g. when a new session
needs to be created. This is not asyncio friendly as it blocks the
whole event loop.

Implement a asyncio friendly variant GetConnectedDevice() which is
a co-routine function which can be awaited.

* Drop bracket

* Skip timeout only when passing None

Change semantics slightly to make 0 mean don't wait at all.

* Add API docs
@github-actions github-actions bot added documentation Improvements or additions to documentation scripts integrations github labels May 1, 2024
wqx6 and others added 28 commits May 23, 2024 15:59
…roject-chip#33561)

* Fix android icd checkin message

* Restyled by clang-format

* Update CHIPDeviceController-JNI.cpp

* Update AndroidDeviceControllerWrapper.cpp

---------

Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: yunhanw-google <[email protected]>
* [fabric-admin] Remove unused dependency

* Address review comments
…p#33563)

* Create README.md for Matter Linux Contact Sensor Example

* Update README.md

* Update README.md

[PATCH] Restyled by prettier-markdown

* Update README.md

Fix 'RPC Console' section

* Update examples/contact-sensor-app/linux/README.md

Co-authored-by: Kiel Oleson <[email protected]>

* Update examples/contact-sensor-app/linux/README.md

Co-authored-by: Kiel Oleson <[email protected]>

* Update examples/contact-sensor-app/linux/README.md

Co-authored-by: Kiel Oleson <[email protected]>

* Restyled by prettier-markdown

---------

Co-authored-by: Kiel Oleson <[email protected]>
project-chip#33573)

* Address follow up review comments for not setting up subscription for XPC controllers

* Restyled by whitespace

* Apply suggestions from code review

Co-authored-by: Boris Zbarsky <[email protected]>

* Apply suggestions from code review

Co-authored-by: Boris Zbarsky <[email protected]>

* Address more comments

---------

Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
… flow (project-chip#33574)

* reset mNeedIcdRegistration to false when starting the commision flow

* address comments
* Fixing NSUserDefaults

* Fixing key

* Fixing name

* Moving this back for now

* Updating header

* Restyled by clang-format

* Fixing build

---------

Co-authored-by: Restyled.io <[email protected]>
…roject-chip#33535)

* [Darwin] MTRDevice should throttle writes to the attribute storage

* Tune unit test timing to avoid race condition that fails the test when the machine is slow

* Additional tuning of unit test timing to avoid timing conditions that fails the test when the machine is slow

* Tune base delay to 3 seconds, to account for slow testing machines

* Fix unit test

* Unit test timing fix and remove debug logging

* Fix TSAN issue with test values in unit test
* Adding dragons....

* Restyled by clang-format

* Fixing build

* Renaming

* Restyled by clang-format

* Fixing missing interface

* Restyled by clang-format

* Update src/darwin/Framework/CHIP/MTRDevice.mm

Co-authored-by: Boris Zbarsky <[email protected]>

---------

Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
* Updating format strings per feedback

* Restyled by clang-format

* Fixing static casts

* Fixing example

* Restyled by clang-format

* Found more static cast misses

* Restyled by clang-format

* Fixing format

* Restyled by clang-format

* Fixing format

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
* [Python] Make AttributePath more pythonic

Use dataclass default initializer to initialize AttributePath. Use
static method to initialize from Cluster or Attribute.

Also hash the integer fields directly, this is more efficient than
formatting a string first.

* Drop AttributePathWithListIndex

Drop AttributePathWithListIndex as it is unused.

* Make DataVersionFilter/EventPath pythonic as well

Use frozen data classes and static initializers similar to
AttributePath.

* Fix _parseEventPathTuple

* Fix _parseDataVersionFilterTuple
…-chip#33588)

* Fix dependency between tests

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
* Drop chip-device-ctrl and ZCL* APIs

Drop the deprecated chip-device-ctrl and remove the ZCL* API from the
Python CHIP controller.

* Update docs to reflect chip-repl commands

Update the Python CHIP controller docs to reflect the CHIP REPL
instead of the now removed chip-device-ctrl tool.

* Remove unused imports

* Replace chip-device-ctrl with chip-repl

* Update/reword main QUICK_START and READMEs

* Fix wrong/buggy cross-reference

* Remove common chip-device-ctrl example

Remove the outdated chip-device-ctrl example and refer to the Python
controller REPL documentation.

* Add --ble-adapter support to CHIP REPL and update docs

Add support to select the Bluetooth adapter using the common
--ble-adapter command line argument.

Update the advanced docs for the Python Controller.

* Address review feedback

* Trim list of commands/add link to official API docs
… Thread. (project-chip#33585)

* Fix dnssd callback thread

* Restyled by google-java-format

* comment

* Restyled by google-java-format

---------

Co-authored-by: Restyled.io <[email protected]>
We are going to change how the estimated latency is computed anyway,
at which point this test will no longer be valid.
…roject-chip#33520)

* Some refactoring to dac revocation set generation script

* restyle and linter fixes

* one last lint fix

* address comments

* Restyled by autopep8

* add logger

* Catch the exception when loading the CRL

* CRL entry extension do not have a AKID extension

---------

Co-authored-by: Restyled.io <[email protected]>
* Use a valid command id in TC_IDM_1_4.py

The test TC_IDM_1_4.py used 0xffff_ffff as test command id. In fact this is not valid MEI according to specification.

While chip seems to validate this fact later the test works.

In matter.js such datatype validations are handled earlier and thats why we throw an contraint error because the value is wrong data type wise. 

I did not found any place in the specification where it is defined when such "semantic" data value checks should be done (unless some very specific error cases in some adapters).

I think this is a theoretical topic in this case because it will hopefully never happen in real live devices 8and when it does the exact error should be irrelevant) for this test it matters because the test fails.

With the change of the command ID to be a still unknown, but valid, value the issue is gone. I also think that tests should still use basically "correct" values. ;-)

Thank you for considering this change.

* address review feedback
)

We had a few issues:

1) Our "round-trip timeout" only accounted for one side of the round-trip
needing to do MRP retransmits.  So if the sender retried a few times, the last
retry finally got through, then the response had to be retried a well, the
sender would time out the exchange before the response was received.  The fix
here is to add the MRP backoff times for both the initial message and the
response.

2) ReadClient could end up timing out a subscription before the server had
actually given up on receiving a StatusReport in response to its ReportData, in
situations where the server ended up doing MRP retries and the last MRP retry
took a few seconds to get through the network.  The fix here is to just estimate
how long the server will be waiting for the StatusReport and not time out the
subscription until then; at that point even if the server did in fact send its
report on time, it will have dropped the subscription on its end.
…r::New() (project-chip#33411)

* Fixes and additions of some of the bounds checks in
SystemPacketBuffer::New().

With the data length types changed to size_t, the bounds checks for the lengths
need to be appropriately modified so that we ensure that overflow does
not happen and the buffer allocation is performed correctly as requested
by the caller of the API.

* Apply suggestions from code review

Co-authored-by: Boris Zbarsky <[email protected]>

---------

Co-authored-by: Boris Zbarsky <[email protected]>
@erwinpan1 erwinpan1 closed this Jun 28, 2024
@erwinpan1 erwinpan1 deleted the 0415_add_rpc_event branch June 28, 2024 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment