diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f738660104089f..f33e83f87b17fa 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,7 +14,7 @@ "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], - "initializeCommand": ".devcontainer/build.sh --tag matter-dev-environment:local --version 1", + "initializeCommand": ".devcontainer/build.sh --tag matter-dev-environment:local --version 20", "image": "matter-dev-environment:local", "remoteUser": "vscode", "customizations": { diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index f16d617c7c6e1c..cb8e31e28b2d23 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -477,6 +477,7 @@ edaf edc EDR ee +eea EEE eef ef diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 944ecefe9a2336..faad378d35a657 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d091dc346b9bf6..5d3adfa3bf3e16 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 volumes: - "/tmp/log_output:/tmp/test_logs" options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 @@ -131,7 +131,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 volumes: - "/tmp/log_output:/tmp/test_logs" options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 @@ -279,7 +279,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 volumes: - "/tmp/log_output:/tmp/test_logs" options: --sysctl "net.ipv6.conf.all.disable_ipv6=0 @@ -414,7 +414,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 volumes: - "/tmp/log_output:/tmp/test_logs" options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index 330118bd958cfc..7b03a66931cb60 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -33,7 +33,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 options: --user root steps: @@ -54,7 +54,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:2 + image: ghcr.io/project-chip/chip-build-esp32:20 options: --user root steps: @@ -75,7 +75,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:1 + image: ghcr.io/project-chip/chip-build-nrf-platform:20 options: --user root steps: @@ -96,7 +96,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:16 + image: ghcr.io/project-chip/chip-build-telink:20 options: --user root steps: diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 94bef11c9f8999..86007a7b7aad83 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -40,7 +40,7 @@ jobs: # need to run with privilege, which isn't supported by job.XXX.contaner # https://github.com/actions/container-action/issues/2 # container: - # image: ghcr.io/project-chip/chip-build-cirque:0.8 + # image: ghcr.io/project-chip/chip-build-cirque:20 # volumes: # - "/tmp:/tmp" # - "/dev/pts:/dev/pts" diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index 82d90dc86366f0..eea17e3affd5b0 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -81,7 +81,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-doxygen:1 + image: ghcr.io/project-chip/chip-build-doxygen:20 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 48b7cf10fcc950..672214d546cbb2 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ameba:9 + image: ghcr.io/project-chip/chip-build-ameba:20 options: --user root steps: diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index ef7445519a25b4..6f39cfa75c001a 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-asr:1 + image: ghcr.io/project-chip/chip-build-asr:20 options: --user root steps: diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index 6fa03b295db295..532e1bfb963cce 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-bouffalolab:1 + image: ghcr.io/project-chip/chip-build-bouffalolab:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc13x2x7_26x2x7.yaml b/.github/workflows/examples-cc13x2x7_26x2x7.yaml index cbfc1be847416a..6243ecd9f06fe5 100644 --- a/.github/workflows/examples-cc13x2x7_26x2x7.yaml +++ b/.github/workflows/examples-cc13x2x7_26x2x7.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:1 + image: ghcr.io/project-chip/chip-build-ti:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index b208314e4160ba..336dcf1fde5e97 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:1 + image: ghcr.io/project-chip/chip-build-ti:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index ab80a86bb1dc10..40b3bb18dbf84e 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-efr32:19 + image: ghcr.io/project-chip/chip-build-efr32:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index a0dd03c6c65f03..084de904c7e269 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:2 + image: ghcr.io/project-chip/chip-build-esp32:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -130,7 +130,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:2 + image: ghcr.io/project-chip/chip-build-esp32:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index 371c7f39203ecd..11a904625f1903 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-infineon:1 + image: ghcr.io/project-chip/chip-build-infineon:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-k32w.yaml b/.github/workflows/examples-k32w.yaml index 1f9c2f5871c8b6..21b4b4520ea028 100644 --- a/.github/workflows/examples-k32w.yaml +++ b/.github/workflows/examples-k32w.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-k32w:6 + image: ghcr.io/project-chip/chip-build-k32w:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index 88b0ea72303973..2ec789d65a5ff7 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-crosscompile:1 + image: ghcr.io/project-chip/chip-build-crosscompile:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index 596b9416bafbcb..dae9832961b138 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-imx:1 + image: ghcr.io/project-chip/chip-build-imx:20 steps: - name: Checkout diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index a981082ffa308a..90f29da0d30ff0 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index 08a75943140d13..3c03d0c78c1018 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-mbed-os:1 + image: ghcr.io/project-chip/chip-build-mbed-os:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 06d3239b586d43..8a0254b691f3c4 100644 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index d980f8079d8947..757c32c02bdbde 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:1 + image: ghcr.io/project-chip/chip-build-nrf-platform:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 7f09a2ee57bdce..a2fb61c1ceda79 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-openiotsdk:1 + image: ghcr.io/project-chip/chip-build-openiotsdk:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index d9d5a85fa28234..c62c8bd18b8b38 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index 567a8da7d711d7..9abcbc240f0bdf 100644 --- a/.github/workflows/examples-stm32.yaml +++ b/.github/workflows/examples-stm32.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 0f7a42d4ab8a04..04fcdb33aac8ac 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:16 + image: ghcr.io/project-chip/chip-build-telink:20 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index b0232751874a1a..84ca0651ae2ee4 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen:1 + image: ghcr.io/project-chip/chip-build-tizen:20 options: --user root volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index 2fdee8ea806308..ae6603f18d36e5 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:1 + image: ghcr.io/project-chip/chip-build-android:20 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 50a07a3b8820bb..c27928850c8f14 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -33,7 +33,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5320d093400ed0..0755b8afaea2f9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -29,7 +29,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 steps: - name: Checkout diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index b8c3af0a88874a..b3d4790c9a86d9 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:1 + image: ghcr.io/project-chip/chip-build-minimal:20 steps: - name: Checkout diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index e5bc7b4dede1fd..d029d3a010eaae 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32-qemu:2 + image: ghcr.io/project-chip/chip-build-esp32-qemu:20 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -76,7 +76,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen-qemu:1 + image: ghcr.io/project-chip/chip-build-tizen-qemu:20 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index 54339e0325ceae..cfb8991bd052da 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-esp32:2 + image: ghcr.io/project-chip/chip-build-esp32:20 steps: - name: Checkout @@ -68,7 +68,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-efr32:1 + image: ghcr.io/project-chip/chip-build-efr32:20 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index 14d98dd5544b1f..5a206aea079a93 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:1 + image: ghcr.io/project-chip/chip-build-android:20 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 2274cd3a30872f..134a288fa2ef0e 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -47,7 +47,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -402,7 +402,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index ec1c499ee6538b..6b816198d38197 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 volumes: - "/tmp/log_output:/tmp/test_logs" options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 2be032fb771b94..9910303eba3a7e 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index dcc5baf5110402..2971823a653805 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:1 + image: ghcr.io/project-chip/chip-build:20 defaults: run: shell: sh diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index f4d14a49f75c8b..928c49a98a9056 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -2158,7 +2158,6 @@ server cluster Switch = 59 { readonly attribute int8u numberOfPositions = 0; readonly attribute int8u currentPosition = 1; - readonly attribute int8u multiPressMax = 2; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -3636,8 +3635,6 @@ server cluster DoorLock = 257 { readonly attribute int16u numberOfPINUsersSupported = 18; readonly attribute int16u numberOfRFIDUsersSupported = 19; readonly attribute int8u numberOfWeekDaySchedulesSupportedPerUser = 20; - readonly attribute int8u numberOfYearDaySchedulesSupportedPerUser = 21; - readonly attribute int8u numberOfHolidaySchedulesSupported = 22; readonly attribute int8u maxPINCodeLength = 23; readonly attribute int8u minPINCodeLength = 24; readonly attribute int8u maxRFIDCodeLength = 25; @@ -6854,7 +6851,6 @@ endpoint 1 { emits event SwitchLatched; ram attribute numberOfPositions default = 2; ram attribute currentPosition; - ram attribute multiPressMax default = 2; ram attribute featureMap default = 1; ram attribute clusterRevision default = 1; } @@ -7152,8 +7148,6 @@ endpoint 1 { ram attribute numberOfPINUsersSupported default = 10; ram attribute numberOfRFIDUsersSupported default = 10; ram attribute numberOfWeekDaySchedulesSupportedPerUser default = 10; - ram attribute numberOfYearDaySchedulesSupportedPerUser default = 10; - ram attribute numberOfHolidaySchedulesSupported default = 0; ram attribute maxPINCodeLength default = 6; ram attribute minPINCodeLength default = 6; ram attribute maxRFIDCodeLength default = 20; @@ -7172,7 +7166,7 @@ endpoint 1 { ram attribute wrongCodeEntryLimit default = 3; ram attribute userCodeTemporaryDisableTime default = 10; ram attribute requirePINforRemoteOperation default = 0; - ram attribute featureMap default = 0x1D13; + ram attribute featureMap default = 0x11B3; ram attribute clusterRevision default = 6; handle command LockDoor; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index dcb6cdccd0aa3c..cb23f5ed0a34f7 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -17,6 +17,12 @@ } ], "package": [ + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" + }, { "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json", @@ -24,12 +30,6 @@ "category": "matter", "version": 1, "description": "Matter SDK ZCL data with some extensions" - }, - { - "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "version": "chip-v1" } ], "endpointTypes": [ @@ -8423,22 +8423,6 @@ "maxInterval": 65344, "reportableChange": 0 }, - { - "name": "MultiPressMax", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "2", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "FeatureMap", "code": 65532, @@ -11997,38 +11981,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "NumberOfYearDaySchedulesSupportedPerUser", - "code": 21, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "10", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "NumberOfHolidaySchedulesSupported", - "code": 22, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "MaxPINCodeLength", "code": 23, @@ -12327,7 +12279,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x1D13", + "defaultValue": "0x11B3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -23373,4 +23325,4 @@ } ], "log": [] -} \ No newline at end of file +} diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index eed2ad0142b9c9..e5cff1adfdfe4b 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -27,11 +27,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:9 + $ docker pull ghcr.io/project-chip/chip-build-ameba:20 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:9 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:20 - Setup build environment: diff --git a/examples/all-clusters-app/asr/BUILD.gn b/examples/all-clusters-app/asr/BUILD.gn index 89c9607b53448d..9447bbe9d3c45d 100755 --- a/examples/all-clusters-app/asr/BUILD.gn +++ b/examples/all-clusters-app/asr/BUILD.gn @@ -117,7 +117,7 @@ asr_executable("clusters_app") { defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL" ] sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] include_dirs += [ "${examples_plat_dir}/shell" ] } diff --git a/examples/all-clusters-minimal-app/ameba/README.md b/examples/all-clusters-minimal-app/ameba/README.md index d791c1b1b4a537..044352fa323cef 100644 --- a/examples/all-clusters-minimal-app/ameba/README.md +++ b/examples/all-clusters-minimal-app/ameba/README.md @@ -27,13 +27,13 @@ The CHIP demo application is supported on - Pull docker image: ``` - $ docker pull ghcr.io/project-chip/chip-build-ameba:9 + $ docker pull ghcr.io/project-chip/chip-build-ameba:20 ``` - Run docker container: ``` - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:9 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:20 ``` - Setup build environment: diff --git a/examples/all-clusters-minimal-app/asr/BUILD.gn b/examples/all-clusters-minimal-app/asr/BUILD.gn index f918700d18e314..33401d925e7b54 100755 --- a/examples/all-clusters-minimal-app/asr/BUILD.gn +++ b/examples/all-clusters-minimal-app/asr/BUILD.gn @@ -111,7 +111,7 @@ asr_executable("clusters_minimal_app") { defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL" ] sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] include_dirs += [ "${examples_plat_dir}/shell" ] } diff --git a/examples/bridge-app/asr/BUILD.gn b/examples/bridge-app/asr/BUILD.gn index ebd3619278423e..93c512203129b2 100755 --- a/examples/bridge-app/asr/BUILD.gn +++ b/examples/bridge-app/asr/BUILD.gn @@ -44,7 +44,7 @@ asr_sdk_sources("bridge_app_sdk_sources") { "ASR_LOG_ENABLED=1", "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}", "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}", - "ENABLE_ASR_BRIDGE_SUBDEVICE_TEST=1", + "ENABLE_ASR_BRIDGE_SUBDEVICE_TEST", ] if (chip_enable_factory_data) { @@ -109,7 +109,7 @@ asr_executable("bridge_app") { defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL" ] sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] include_dirs += [ "${examples_plat_dir}/shell" ] } diff --git a/examples/bridge-app/asr/subdevice/SubDevice.cpp b/examples/bridge-app/asr/subdevice/SubDevice.cpp index c0b60cc3d90f81..437fc05b4b5baf 100644 --- a/examples/bridge-app/asr/subdevice/SubDevice.cpp +++ b/examples/bridge-app/asr/subdevice/SubDevice.cpp @@ -21,7 +21,7 @@ extern "C" { #endif #include -#if CONFIG_ENABLE_ASR_APP_MESH +#ifdef CONFIG_ENABLE_ASR_APP_MESH #include "app.h" #include "sonata_gap_api.h" #include "sonata_gatt_api.h" @@ -65,7 +65,7 @@ void SubDevice::SetOnOff(bool aOn) changed = (mState != kState_On); mState = kState_On; ChipLogProgress(DeviceLayer, "SubDevice[%s]: ON", mName); -#if CONFIG_ENABLE_ASR_APP_MESH +#ifdef CONFIG_ENABLE_ASR_APP_MESH if (strcmp(mName, "Light 1") == 0) { app_mesh_control_fan(1); @@ -81,7 +81,7 @@ void SubDevice::SetOnOff(bool aOn) changed = (mState != kState_Off); mState = kState_Off; ChipLogProgress(DeviceLayer, "SubDevice[%s]: OFF", mName); -#if CONFIG_ENABLE_ASR_APP_MESH +#ifdef CONFIG_ENABLE_ASR_APP_MESH if (strcmp(mName, "Light 1") == 0) { app_mesh_control_fan(0); diff --git a/examples/bridge-app/asr/subdevice/subdevice_test.cpp b/examples/bridge-app/asr/subdevice/subdevice_test.cpp index 7691b5c11dc707..c173e9b2b5da75 100644 --- a/examples/bridge-app/asr/subdevice/subdevice_test.cpp +++ b/examples/bridge-app/asr/subdevice/subdevice_test.cpp @@ -42,7 +42,7 @@ using namespace ::chip::System; using namespace ::chip::Platform; using namespace ::chip::app::Clusters; -#if ENABLE_ASR_BRIDGE_SUBDEVICE_TEST +#ifdef ENABLE_ASR_BRIDGE_SUBDEVICE_TEST static const int kNodeLabelSize = 32; // Current ZCL implementation of Struct uses a max-size array of 254 bytes diff --git a/examples/chef/README.md b/examples/chef/README.md index ab239b39a939ce..11a15261b08d97 100644 --- a/examples/chef/README.md +++ b/examples/chef/README.md @@ -101,7 +101,7 @@ relevant platform image. You can simulate the workflow locally by mounting your CHIP repo into a container and executing the CI command: ```shell -docker run -it --mount source=$(pwd),target=/workspace,type=bind ghcr.io/project-chip/chip-build-$PLATFORM:1$VERSION +docker run -it --mount source=$(pwd),target=/workspace,type=bind ghcr.io/project-chip/chip-build-$PLATFORM:$VERSION ``` In the container: @@ -128,7 +128,7 @@ chef_$PLATFORM: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-$PLATFORM:1$VERSION + image: ghcr.io/project-chip/chip-build-$PLATFORM:$VERSION options: --user root steps: @@ -183,7 +183,7 @@ command for these targets. To test your configuration locally, you may employ a similar strategy as in CI: ```shell -docker run -it --mount source=$(pwd),target=/workspace,type=bind ghcr.io/project-chip/chip-build-vscode:1$VERSION +docker run -it --mount source=$(pwd),target=/workspace,type=bind ghcr.io/project-chip/chip-build-vscode:$VERSION ``` In the container: diff --git a/examples/chip-tool/commands/pairing/PairingCommand.h b/examples/chip-tool/commands/pairing/PairingCommand.h index 38b56b23e5d9bb..19d4a50471ed95 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.h +++ b/examples/chip-tool/commands/pairing/PairingCommand.h @@ -21,7 +21,6 @@ #include "../common/CHIPCommand.h" #include #include -#include #include #include diff --git a/examples/dishwasher-app/asr/BUILD.gn b/examples/dishwasher-app/asr/BUILD.gn index 5a288f7a46ebdb..eaf4c855eefc17 100755 --- a/examples/dishwasher-app/asr/BUILD.gn +++ b/examples/dishwasher-app/asr/BUILD.gn @@ -106,7 +106,7 @@ asr_executable("dishwasher_app") { defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL" ] sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] include_dirs += [ "${examples_plat_dir}/shell" ] } diff --git a/examples/dishwasher-app/asr/src/AppTask.cpp b/examples/dishwasher-app/asr/src/AppTask.cpp index 55acdfb95d6aea..8e9cb88b8f5b34 100644 --- a/examples/dishwasher-app/asr/src/AppTask.cpp +++ b/examples/dishwasher-app/asr/src/AppTask.cpp @@ -32,7 +32,7 @@ #include #include "init_Matter.h" -#if CONFIG_ENABLE_CHIP_SHELL +#ifdef CONFIG_ENABLE_CHIP_SHELL #include "matter_shell.h" #endif #include diff --git a/examples/light-switch-app/ameba/README.md b/examples/light-switch-app/ameba/README.md index 65289c41a81b82..14d4e4aa92b2e3 100644 --- a/examples/light-switch-app/ameba/README.md +++ b/examples/light-switch-app/ameba/README.md @@ -26,11 +26,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:9 + $ docker pull ghcr.io/project-chip/chip-build-ameba:20 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:9 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:20 - Setup build environment: diff --git a/examples/light-switch-app/asr/BUILD.gn b/examples/light-switch-app/asr/BUILD.gn index 8e2e620c18abea..7eac5d28b65858 100755 --- a/examples/light-switch-app/asr/BUILD.gn +++ b/examples/light-switch-app/asr/BUILD.gn @@ -106,7 +106,7 @@ asr_executable("light_switch_app") { defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL" ] sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] include_dirs += [ "${examples_plat_dir}/shell" ] } diff --git a/examples/lighting-app/ameba/README.md b/examples/lighting-app/ameba/README.md index 43934484597b52..eeca656961da20 100644 --- a/examples/lighting-app/ameba/README.md +++ b/examples/lighting-app/ameba/README.md @@ -23,11 +23,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:9 + $ docker pull ghcr.io/project-chip/chip-build-ameba:20 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:9 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:20 - Setup build environment: diff --git a/examples/lighting-app/asr/BUILD.gn b/examples/lighting-app/asr/BUILD.gn index 3420374296aca5..576a50b92aa7f8 100755 --- a/examples/lighting-app/asr/BUILD.gn +++ b/examples/lighting-app/asr/BUILD.gn @@ -105,7 +105,7 @@ asr_executable("lighting_app") { defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL" ] sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] include_dirs += [ "${examples_plat_dir}/shell" ] } diff --git a/examples/lighting-app/asr/src/AppTask.cpp b/examples/lighting-app/asr/src/AppTask.cpp index 3aba980a5414e6..e9467d294ef136 100755 --- a/examples/lighting-app/asr/src/AppTask.cpp +++ b/examples/lighting-app/asr/src/AppTask.cpp @@ -34,7 +34,7 @@ #include #include "init_Matter.h" -#if CONFIG_ENABLE_CHIP_SHELL +#ifdef CONFIG_ENABLE_CHIP_SHELL #include "matter_shell.h" #endif #include @@ -164,7 +164,7 @@ void AppTask::AppTaskMain(void * pvParameter) /* get led onoff status and level value */ led_startup_status(); -#if CONFIG_ENABLE_CHIP_SHELL +#ifdef CONFIG_ENABLE_CHIP_SHELL RegisterLightCommands(); #endif /* Delete task */ diff --git a/examples/lighting-app/bouffalolab/bl602/BUILD.gn b/examples/lighting-app/bouffalolab/bl602/BUILD.gn index 0a25abda2a2ce0..b24c8731b08efe 100644 --- a/examples/lighting-app/bouffalolab/bl602/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl602/BUILD.gn @@ -79,9 +79,9 @@ bl_iot_sdk("sdk") { "CHIP_SYSTEM_CRYPTO_HEADER_RESERVE_SIZE=48", ] + defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ] if (chip_enable_pw_rpc) { include_dirs += [ "${examples_plat_dir}/common/rpc" ] - defines += [ "PW_RPC_ENABLED=1" ] defines += [ "DISABLE_PRINT=1" ] } else if (chip_build_libshell) { include_dirs += [ "${examples_plat_dir}/common/plat" ] @@ -101,26 +101,20 @@ bouffalolab_executable("lighting_app") { defines = [ "APP_TASK_STACK_SIZE=2044", "CHIP_UART_BAUDRATE=${baudrate}", - "BL602_ENABLE=1", "START_ENTRY=bfl_main", "SYS_AOS_LOOP_ENABLE", ] - if (enable_debug_frame_ptr) { - defines += [ "CONF_ENABLE_FRAME_PTR=1" ] - } - if (false == enable_reset_counter) { defines += [ "BOOT_PIN_RESET=8" ] } - if (chip_enable_factory_data) { - defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=1" ] - } - - if (chip_enable_factory_data_test) { - defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=1" ] - } + defines += [ "CONF_ENABLE_FRAME_PTR=${enable_debug_frame_ptr}" ] + defines += + [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ] + defines += [ + "CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=${chip_enable_factory_data_test}", + ] bl_plat_name = "bl602" sources = [ @@ -140,8 +134,8 @@ bouffalolab_executable("lighting_app") { "${example_dir}/common/ZclCallbacks.cpp", "${examples_plat_dir}/common/iot_sdk/aos_task.c", "${examples_plat_dir}/common/iot_sdk/demo_pwm.c", - "${examples_plat_dir}/common/iot_sdk/platform_port.c", - "${examples_plat_dir}/common/iot_sdk/uart.c", + "${examples_plat_dir}/common/iot_sdk/platform_port.cpp", + "${examples_plat_dir}/common/iot_sdk/uart.cpp", "${examples_plat_dir}/common/plat/LEDWidget.cpp", "${examples_plat_dir}/common/plat/OTAConfig.cpp", "${examples_plat_dir}/common/plat/main.cpp", @@ -167,9 +161,10 @@ bouffalolab_executable("lighting_app") { "${examples_plat_dir}/common/iot_sdk", ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ] + defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ] if (chip_enable_pw_rpc) { defines += [ - "PW_RPC_ENABLED", "PW_RPC_ATTRIBUTE_SERVICE=1", "PW_RPC_BUTTON_SERVICE=1", "PW_RPC_DESCRIPTOR_SERVICE=1", @@ -216,8 +211,6 @@ bouffalolab_executable("lighting_app") { "${chip_root}/examples/common/pigweed/bouffalolab", ] } else if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] - deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ] include_dirs += [ @@ -226,9 +219,9 @@ bouffalolab_executable("lighting_app") { ] } + defines += [ "HEAP_MONITORING=${enable_heap_monitoring}" ] if (enable_heap_monitoring) { sources += [ "${examples_plat_dir}/common/plat/MemMonitoring.cpp" ] - defines += [ "HEAP_MONITORING=1" ] } cflags_c = [ "-Wno-sign-compare" ] diff --git a/examples/lighting-app/bouffalolab/bl702/BUILD.gn b/examples/lighting-app/bouffalolab/bl702/BUILD.gn index 0becfce3e9e117..7d6ae4db39c8f2 100644 --- a/examples/lighting-app/bouffalolab/bl702/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702/BUILD.gn @@ -82,20 +82,21 @@ bl_iot_sdk("sdk") { "PRINT_DEBUG=0", ] + defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ] if (chip_enable_pw_rpc) { include_dirs += [ "${examples_plat_dir}/common/rpc" ] - defines += [ "PW_RPC_ENABLED=1" ] defines += [ "DISABLE_PRINT=1" ] - } else if (chip_build_libshell) { - include_dirs += [ "${examples_plat_dir}/common/plat" ] + } else { + if (chip_build_libshell) { + include_dirs += [ "${examples_plat_dir}/common/plat" ] + } } - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_ETHERNET=${chip_enable_ethernet}" ] - if (chip_enable_wifi || chip_enable_ethernet) { include_dirs += [ "${examples_plat_dir}/bl702/lwipopts" ] } + defines += [ "CHIP_DEVICE_CONFIG_ENABLE_ETHERNET=${chip_enable_ethernet}" ] if (chip_enable_ethernet) { defines += [ "CHIP_SYSTEM_CRYPTO_HEADER_RESERVE_SIZE=48" ] } @@ -133,14 +134,15 @@ bouffalolab_executable("lighting_app") { defines = [ "APP_TASK_STACK_SIZE=2048", "CHIP_UART_BAUDRATE=${baudrate}", - "BL702_ENABLE=1", "START_ENTRY=bl702_main", ] - if (enable_debug_frame_ptr) { - defines += [ "CONF_ENABLE_FRAME_PTR=1" ] - } - + defines += [ "CONF_ENABLE_FRAME_PTR=${enable_debug_frame_ptr}" ] + defines += + [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ] + defines += [ + "CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=${chip_enable_factory_data_test}", + ] if (chip_config_network_layer_ble) { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=1" ] } @@ -149,14 +151,6 @@ bouffalolab_executable("lighting_app") { defines += [ "BOOT_PIN_RESET=31" ] } - if (chip_enable_factory_data) { - defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=1" ] - } - - if (chip_enable_factory_data_test) { - defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=1" ] - } - if ("XT-ZB6-DevKit" == board) { defines += [ "XT_ZB6_DevKit" ] } else if ("BL706-NIGHT-LIGHT" == board) { @@ -168,8 +162,8 @@ bouffalolab_executable("lighting_app") { "${example_dir}/common/ZclCallbacks.cpp", "${examples_plat_dir}/common/iot_sdk/aos_task.c", "${examples_plat_dir}/common/iot_sdk/demo_pwm.c", - "${examples_plat_dir}/common/iot_sdk/platform_port.c", - "${examples_plat_dir}/common/iot_sdk/uart.c", + "${examples_plat_dir}/common/iot_sdk/platform_port.cpp", + "${examples_plat_dir}/common/iot_sdk/uart.cpp", "${examples_plat_dir}/common/plat/LEDWidget.cpp", "${examples_plat_dir}/common/plat/OTAConfig.cpp", "${examples_plat_dir}/common/plat/main.cpp", @@ -196,10 +190,6 @@ bouffalolab_executable("lighting_app") { include_dirs += [ "${examples_plat_dir}/bl702/lwipopts" ] } - if (enable_psram) { - defines += [ "CFG_USE_PSRAM=1" ] - } - if (defined(enable_cdc_module) && enable_cdc_module) { defines += [ "CFG_USB_CDC_ENABLE" ] } @@ -238,9 +228,10 @@ bouffalolab_executable("lighting_app") { } } + defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ] + defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ] if (chip_enable_pw_rpc) { defines += [ - "PW_RPC_ENABLED=1", "PW_RPC_ATTRIBUTE_SERVICE=1", "PW_RPC_BUTTON_SERVICE=1", "PW_RPC_DESCRIPTOR_SERVICE=1", @@ -289,23 +280,24 @@ bouffalolab_executable("lighting_app") { "${chip_root}/examples/common", "${chip_root}/examples/common/pigweed/bouffalolab", ] - } else if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ] - - include_dirs += [ - "${chip_root}/src/lib/shell", - "${chip_root}/examples/shell/shell_common/include", - ] + } else { + if (chip_build_libshell) { + include_dirs += [ + "${chip_root}/src/lib/shell", + "${chip_root}/examples/shell/shell_common/include", + ] - deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ] + deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ] + } } + defines += [ "HEAP_MONITORING=${enable_heap_monitoring}" ] if (enable_heap_monitoring) { sources += [ "${examples_plat_dir}/common/plat/MemMonitoring.cpp" ] - defines += [ "HEAP_MONITORING=1" ] } if (enable_psram) { + defines += [ "CFG_USE_PSRAM=1" ] ldscript = "${examples_plat_dir}/bl702/ldscripts/psram_flash.ld" } else { ldscript = "${examples_plat_dir}/bl702/ldscripts/flash.ld" diff --git a/examples/lighting-app/bouffalolab/bl702l/BUILD.gn b/examples/lighting-app/bouffalolab/bl702l/BUILD.gn index 6c081df89860cf..c21ffe472b5a7b 100644 --- a/examples/lighting-app/bouffalolab/bl702l/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702l/BUILD.gn @@ -80,9 +80,9 @@ bl_iot_sdk("sdk") { "PRINT_DEBUG=0", ] + defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ] if (chip_enable_pw_rpc) { include_dirs += [ "${examples_plat_dir}/common/rpc" ] - defines += [ "PW_RPC_ENABLED=1" ] defines += [ "DISABLE_PRINT=1" ] } else if (chip_build_libshell) { include_dirs += [ "${examples_plat_dir}/common/plat" ] @@ -111,14 +111,15 @@ bouffalolab_executable("lighting_app") { defines = [ "APP_TASK_STACK_SIZE=2048", "CHIP_UART_BAUDRATE=${baudrate}", - "BL702L_ENABLE=1", "START_ENTRY=bl702_main", ] - if (enable_debug_frame_ptr) { - defines += [ "CONF_ENABLE_FRAME_PTR=1" ] - } - + defines += [ "CONF_ENABLE_FRAME_PTR=${enable_debug_frame_ptr}" ] + defines += + [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ] + defines += [ + "CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=${chip_enable_factory_data_test}", + ] if (chip_config_network_layer_ble) { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=1" ] } @@ -127,14 +128,6 @@ bouffalolab_executable("lighting_app") { defines += [ "BOOT_PIN_RESET=16" ] } - if (chip_enable_factory_data) { - defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=1" ] - } - - if (chip_enable_factory_data_test) { - defines += [ "CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST=1" ] - } - if ("BL704LDK" == board) { defines += [ "XT_ZB6_DevKit" ] } @@ -144,8 +137,8 @@ bouffalolab_executable("lighting_app") { "${example_dir}/common/ZclCallbacks.cpp", "${examples_plat_dir}/common/iot_sdk/aos_task.c", "${examples_plat_dir}/common/iot_sdk/demo_pwm.c", - "${examples_plat_dir}/common/iot_sdk/platform_port.c", - "${examples_plat_dir}/common/iot_sdk/uart.c", + "${examples_plat_dir}/common/iot_sdk/platform_port.cpp", + "${examples_plat_dir}/common/iot_sdk/uart.cpp", "${examples_plat_dir}/common/plat/LEDWidget.cpp", "${examples_plat_dir}/common/plat/OTAConfig.cpp", "${examples_plat_dir}/common/plat/main.cpp", @@ -168,10 +161,6 @@ bouffalolab_executable("lighting_app") { "${examples_plat_dir}/common/iot_sdk", ] - if (enable_psram) { - defines += [ "CFG_USE_PSRAM=1" ] - } - if (chip_enable_openthread) { deps += [ "${chip_root}/third_party/openthread/platforms:libopenthread-platform", @@ -201,9 +190,10 @@ bouffalolab_executable("lighting_app") { ] } + defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ] + defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ] if (chip_enable_pw_rpc) { defines += [ - "PW_RPC_ENABLED=1", "PW_RPC_ATTRIBUTE_SERVICE=1", "PW_RPC_BUTTON_SERVICE=1", "PW_RPC_DESCRIPTOR_SERVICE=1", @@ -252,23 +242,24 @@ bouffalolab_executable("lighting_app") { "${chip_root}/examples/common", "${chip_root}/examples/common/pigweed/bouffalolab", ] - } else if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ] - - deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ] + } else { + if (chip_build_libshell) { + include_dirs += [ + "${chip_root}/src/lib/shell", + "${chip_root}/examples/shell/shell_common/include", + ] - include_dirs += [ - "${chip_root}/src/lib/shell", - "${chip_root}/examples/shell/shell_common/include", - ] + deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ] + } } + defines += [ "HEAP_MONITORING=${enable_heap_monitoring}" ] if (enable_heap_monitoring) { sources += [ "${examples_plat_dir}/common/plat/MemMonitoring.cpp" ] - defines += [ "HEAP_MONITORING=1" ] } if (enable_psram) { + defines += [ "CFG_USE_PSRAM=1" ] ldscript = "${examples_plat_dir}/bl702l/ldscripts/psram_flash_rom.ld" } else { ldscript = "${examples_plat_dir}/bl702l/ldscripts/flash_rom.ld" diff --git a/examples/lighting-app/bouffalolab/common/AppTask.cpp b/examples/lighting-app/bouffalolab/common/AppTask.cpp index ee0ead05c6e8c6..a0eb17fd747eec 100644 --- a/examples/lighting-app/bouffalolab/common/AppTask.cpp +++ b/examples/lighting-app/bouffalolab/common/AppTask.cpp @@ -135,7 +135,7 @@ void AppTask::AppTaskMain(void * pvParameter) app_event_t appEvent; bool onoff = false; -#if !(BL702_ENABLE && CHIP_DEVICE_CONFIG_ENABLE_ETHERNET) +#if !(CHIP_DEVICE_LAYER_TARGET_BL702 && CHIP_DEVICE_CONFIG_ENABLE_ETHERNET) sLightLED.Init(); #endif diff --git a/examples/lock-app/asr/BUILD.gn b/examples/lock-app/asr/BUILD.gn index e4db0d8b2f7329..07d6adf3689c7f 100755 --- a/examples/lock-app/asr/BUILD.gn +++ b/examples/lock-app/asr/BUILD.gn @@ -106,7 +106,7 @@ asr_executable("lock_app") { defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL" ] sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] include_dirs += [ "${examples_plat_dir}/shell" ] } diff --git a/examples/ota-requestor-app/ameba/README.md b/examples/ota-requestor-app/ameba/README.md index d591080a9332a7..cc070ed27b367c 100644 --- a/examples/ota-requestor-app/ameba/README.md +++ b/examples/ota-requestor-app/ameba/README.md @@ -6,11 +6,11 @@ A prototype application that demonstrates OTA Requestor capabilities. - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:9 + $ docker pull ghcr.io/project-chip/chip-build-ameba:20 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:9 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:20 - Setup build environment: diff --git a/examples/ota-requestor-app/asr/BUILD.gn b/examples/ota-requestor-app/asr/BUILD.gn index e4365a59d2ea9b..42bddbc7f07d9b 100755 --- a/examples/ota-requestor-app/asr/BUILD.gn +++ b/examples/ota-requestor-app/asr/BUILD.gn @@ -104,7 +104,7 @@ asr_executable("ota_requestor_app") { defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL" ] sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] include_dirs += [ "${examples_plat_dir}/shell" ] } diff --git a/examples/pigweed-app/ameba/README.md b/examples/pigweed-app/ameba/README.md index 9198b4e1ea822a..30e1b2b1c56f9d 100644 --- a/examples/pigweed-app/ameba/README.md +++ b/examples/pigweed-app/ameba/README.md @@ -31,11 +31,11 @@ following features are available: - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:9 + $ docker pull ghcr.io/project-chip/chip-build-ameba:20 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:9 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:20 - Setup build environment: diff --git a/examples/platform/asr/init_Matter.cpp b/examples/platform/asr/init_Matter.cpp index 8f46ac4f9ed423..130d01479de4f9 100644 --- a/examples/platform/asr/init_Matter.cpp +++ b/examples/platform/asr/init_Matter.cpp @@ -25,7 +25,7 @@ #include #include #include -#if CONFIG_ENABLE_CHIP_SHELL +#ifdef CONFIG_ENABLE_CHIP_SHELL #include #endif #include @@ -113,7 +113,7 @@ CHIP_ERROR MatterInitializer::Init_Matter_Server(void) err = PlatformMgr().StartEventLoopTask(); ReturnErrorOnFailure(err); -#if CONFIG_ENABLE_CHIP_SHELL +#ifdef CONFIG_ENABLE_CHIP_SHELL chip::LaunchShell(); #endif diff --git a/examples/platform/asr/init_asrPlatform.cpp b/examples/platform/asr/init_asrPlatform.cpp index d54cdd2a3530a9..9127b31947394f 100755 --- a/examples/platform/asr/init_asrPlatform.cpp +++ b/examples/platform/asr/init_asrPlatform.cpp @@ -174,7 +174,7 @@ void init_asrPlatform(void) lega_recovery_phy_fsm_config(); #endif asr_security_engine_init(); -#if !CONFIG_ENABLE_CHIP_SHELL +#ifndef CONFIG_ENABLE_CHIP_SHELL lega_at_init(); #endif lega_at_cmd_register_all(); diff --git a/examples/platform/asr/shell/matter_shell.cpp b/examples/platform/asr/shell/matter_shell.cpp index f84d6946f6a425..dcd412af5f033e 100644 --- a/examples/platform/asr/shell/matter_shell.cpp +++ b/examples/platform/asr/shell/matter_shell.cpp @@ -42,7 +42,7 @@ using namespace ::chip; using namespace ::chip::Credentials; using namespace ::chip::DeviceLayer; -#if CONFIG_ENABLE_CHIP_SHELL +#ifdef CONFIG_ENABLE_CHIP_SHELL #include "lib/shell/Engine.h" using chip::Shell::Engine; @@ -94,7 +94,7 @@ void asr_matter_onoff(int value) void asr_matter_sensors(bool enable, int temp, int humi, int pressure) { -#if ASR_BOARD_ENABLE_SENSORS +#ifdef ASR_BOARD_ENABLE_SENSORS if (enable) { chip::app::Clusters::TemperatureMeasurement::Attributes::MeasuredValue::Set( @@ -120,7 +120,7 @@ void asr_matter_ota(uint32_t timeout) #endif } -#if CONFIG_ENABLE_CHIP_SHELL +#ifdef CONFIG_ENABLE_CHIP_SHELL static CHIP_ERROR sLightCommandHandler(int argc, char ** argv) { if (argc == 1 && strcmp(argv[0], "on") == 0) diff --git a/examples/platform/asr/shell/matter_shell.h b/examples/platform/asr/shell/matter_shell.h index e0f2c86f2818aa..fea7f49f0e164e 100644 --- a/examples/platform/asr/shell/matter_shell.h +++ b/examples/platform/asr/shell/matter_shell.h @@ -43,7 +43,7 @@ void asr_matter_reset(Reset_t type); void asr_matter_onoff(int value); void asr_matter_sensors(bool enable, int temp, int humi, int pressure); void asr_matter_ota(uint32_t timeout); -#if CONFIG_ENABLE_CHIP_SHELL +#ifdef CONFIG_ENABLE_CHIP_SHELL void RegisterLightCommands(); #endif #ifdef __cplusplus diff --git a/examples/platform/bouffalolab/bl602/lwipopts/lwipopts.h b/examples/platform/bouffalolab/bl602/lwipopts/lwipopts.h index dd304f96d66a15..dea0e2e715136d 100644 --- a/examples/platform/bouffalolab/bl602/lwipopts/lwipopts.h +++ b/examples/platform/bouffalolab/bl602/lwipopts/lwipopts.h @@ -249,6 +249,7 @@ a lot of data that needs to be copied, this should be set high. */ #define LWIP_NETIF_LINK_CALLBACK 1 /*Enable dns*/ +#define LWIP_DNS_SERVER 0 #define LWIP_DNS 1 #define LWIP_DNS_SECURE 0 @@ -271,6 +272,8 @@ a lot of data that needs to be copied, this should be set high. */ /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS + 40 + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN) +#define LWIP_PBUF_FROM_CUSTOM_POOLS (0) + /* --------------------------------- ---------- MISC. options ---------- diff --git a/examples/platform/bouffalolab/bl702/lwipopts/lwipopts.h b/examples/platform/bouffalolab/bl702/lwipopts/lwipopts.h index 0ed28096088524..981b17d14d9869 100644 --- a/examples/platform/bouffalolab/bl702/lwipopts/lwipopts.h +++ b/examples/platform/bouffalolab/bl702/lwipopts/lwipopts.h @@ -261,6 +261,7 @@ a lot of data that needs to be copied, this should be set high. */ #define LWIP_NETIF_LINK_CALLBACK 1 /*Enable dns*/ +#define LWIP_DNS_SERVER 0 #define LWIP_DNS 1 #define LWIP_DNS_SECURE 0 @@ -283,6 +284,7 @@ a lot of data that needs to be copied, this should be set high. */ /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS + 40 + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN) +#define LWIP_PBUF_FROM_CUSTOM_POOLS (0) /* --------------------------------- ---------- MISC. options ---------- diff --git a/examples/platform/bouffalolab/common/iot_sdk/platform_port.c b/examples/platform/bouffalolab/common/iot_sdk/platform_port.cpp similarity index 76% rename from examples/platform/bouffalolab/common/iot_sdk/platform_port.c rename to examples/platform/bouffalolab/common/iot_sdk/platform_port.cpp index 472615ac33cd8b..55748704056a82 100644 --- a/examples/platform/bouffalolab/common/iot_sdk/platform_port.c +++ b/examples/platform/bouffalolab/common/iot_sdk/platform_port.cpp @@ -23,39 +23,44 @@ #include #include +#include + #include #include -#if BL702_ENABLE +#if CHIP_DEVICE_LAYER_TARGET_BL702 #include #include -#elif BL702L_ENABLE +#elif CHIP_DEVICE_LAYER_TARGET_BL702L #include #include -#elif BL602_ENABLE -#include -#endif -#include -#if BL702L_ENABLE -#include #endif -#include -#include + #ifdef CFG_USE_PSRAM #include #endif #include -#include -#include #include -#if BL702L_ENABLE +extern "C" { +#include +#include +#include +#include +#include +#include +#if CHIP_DEVICE_LAYER_TARGET_BL602 +#include +#endif + +#if CHIP_DEVICE_LAYER_TARGET_BL702L #include #include #include #endif +} #include @@ -65,21 +70,21 @@ HOSAL_UART_DEV_DECL(uart_stdio, CHIP_UART_PORT, CHIP_UART_PIN_TX, CHIP_UART_PIN_RX, CHIP_UART_BAUDRATE); #ifdef SYS_AOS_LOOP_ENABLE -void aos_loop_start(void); +extern "C" void aos_loop_start(void); #endif // ================================================================================ // FreeRTOS Callbacks // ================================================================================ -unsigned int sleep(unsigned int seconds) +extern "C" unsigned int sleep(unsigned int seconds) { const TickType_t xDelay = 1000 * seconds / portTICK_PERIOD_MS; vTaskDelay(xDelay); return 0; } -#if !BL702L_ENABLE -void vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName) +#if !CHIP_DEVICE_LAYER_TARGET_BL702L +extern "C" void vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName) { printf("Stack Overflow checked. Stack name %s", pcTaskName); while (true) @@ -88,7 +93,7 @@ void vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName) } } -void vApplicationMallocFailedHook(void) +extern "C" void vApplicationMallocFailedHook(void) { printf("Memory Allocate Failed. Current left size is %d bytes", xPortGetFreeHeapSize()); while (true) @@ -97,14 +102,14 @@ void vApplicationMallocFailedHook(void) } } -void vApplicationIdleHook(void) +extern "C" void vApplicationIdleHook(void) { // bl_wdt_feed(); __asm volatile(" wfi "); } -void vApplicationGetIdleTaskMemory(StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, - uint32_t * pulIdleTaskStackSize) +extern "C" void vApplicationGetIdleTaskMemory(StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize) { /* If the buffers to be provided to the Idle task are declared inside this function then they must be declared static - otherwise they will be allocated on @@ -126,8 +131,8 @@ void vApplicationGetIdleTaskMemory(StaticTask_t ** ppxIdleTaskTCBBuffer, StackTy /* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the application must provide an implementation of vApplicationGetTimerTaskMemory() to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory(StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, - uint32_t * pulTimerTaskStackSize) +extern "C" void vApplicationGetTimerTaskMemory(StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize) { /* If the buffers to be provided to the Timer task are declared inside this function then they must be declared static - otherwise they will be allocated on @@ -147,7 +152,7 @@ void vApplicationGetTimerTaskMemory(StaticTask_t ** ppxTimerTaskTCBBuffer, Stack } #if (configUSE_TICK_HOOK != 0) -void vApplicationTickHook(void) +extern "C" void vApplicationTickHook(void) { #if defined(CFG_USB_CDC_ENABLE) extern void usb_cdc_monitor(void); @@ -156,9 +161,9 @@ void vApplicationTickHook(void) } #endif -void vApplicationSleep(TickType_t xExpectedIdleTime) {} +extern "C" void vApplicationSleep(TickType_t xExpectedIdleTime) {} -void vAssertCalled(void) +extern "C" void vAssertCalled(void) { void * ra = (void *) __builtin_return_address(0); @@ -184,8 +189,8 @@ void vAssertCalled(void) } #endif -#if BL702L_ENABLE -void __attribute__((weak)) user_vAssertCalled(void) +#if CHIP_DEVICE_LAYER_TARGET_BL702L +extern "C" void __attribute__((weak)) user_vAssertCalled(void) { void * ra = (void *) __builtin_return_address(0); @@ -204,7 +209,7 @@ void __attribute__((weak)) user_vAssertCalled(void) ; } -void __attribute__((weak)) user_vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName) +extern "C" void __attribute__((weak)) user_vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName) { puts("Stack Overflow checked\r\n"); if (pcTaskName) @@ -217,7 +222,7 @@ void __attribute__((weak)) user_vApplicationStackOverflowHook(TaskHandle_t xTask } } -void __attribute__((weak)) user_vApplicationMallocFailedHook(void) +extern "C" void __attribute__((weak)) user_vApplicationMallocFailedHook(void) { printf("Memory Allocate Failed. Current left size is %d bytes\r\n", xPortGetFreeHeapSize()); #if defined(CFG_USE_PSRAM) @@ -229,35 +234,35 @@ void __attribute__((weak)) user_vApplicationMallocFailedHook(void) } } -void bflb_assert(void) __attribute__((weak, alias("user_vAssertCalled"))); +extern "C" void bflb_assert(void) __attribute__((weak, alias("user_vAssertCalled"))); #else -void user_vAssertCalled(void) __attribute__((weak, alias("vAssertCalled"))); -void bflb_assert(void) __attribute__((weak, alias("vAssertCalled"))); +extern "C" void user_vAssertCalled(void) __attribute__((weak, alias("vAssertCalled"))); +extern "C" void bflb_assert(void) __attribute__((weak, alias("vAssertCalled"))); #endif // ================================================================================ // Main Code // ================================================================================ -extern uint8_t _heap_start; -extern size_t _heap_size; // @suppress("Type cannot be resolved") +extern "C" uint8_t _heap_start; +extern "C" size_t _heap_size; // @suppress("Type cannot be resolved") -#if BL602_ENABLE -extern uint8_t _heap_wifi_start; -extern uint8_t _heap_wifi_size; // @suppress("Type cannot be resolved") +#if CHIP_DEVICE_LAYER_TARGET_BL602 +extern "C" uint8_t _heap_wifi_start; +extern "C" uint8_t _heap_wifi_size; // @suppress("Type cannot be resolved") static const HeapRegion_t xHeapRegions[] = { { &_heap_start, (unsigned int) &_heap_size }, // set on runtime { &_heap_wifi_start, (unsigned int) &_heap_wifi_size }, { NULL, 0 } /* Terminates the array. */ }; -#elif BL702_ENABLE -extern uint8_t _heap2_start; -extern uint8_t _heap2_size; // @suppress("Type cannot be resolved") +#elif CHIP_DEVICE_LAYER_TARGET_BL702 +extern "C" uint8_t _heap2_start; +extern "C" uint8_t _heap2_size; // @suppress("Type cannot be resolved") static const HeapRegion_t xHeapRegions[] = { { &_heap_start, (size_t) &_heap_size }, // set on runtime { &_heap2_start, (size_t) &_heap2_size }, // set on runtime { NULL, 0 } /* Terminates the array. */ }; -#elif BL702L_ENABLE +#elif CHIP_DEVICE_LAYER_TARGET_BL702L static const HeapRegion_t xHeapRegions[] = { { &_heap_start, (size_t) &_heap_size }, // set on runtime { NULL, 0 } /* Terminates the array. */ @@ -265,18 +270,18 @@ static const HeapRegion_t xHeapRegions[] = { #endif #ifdef CFG_USE_PSRAM -extern uint32_t __psram_bss_init_start; -extern uint32_t __psram_bss_init_end; +extern "C" uint8_t __psram_bss_init_start; +extern "C" uint8_t __psram_bss_init_end; static uint32_t __attribute__((section(".rsvd_data"))) psram_reset_count; -extern uint8_t _heap3_start; -extern size_t _heap3_size; // @suppress("Type cannot be resolved") +extern "C" uint8_t _heap3_start; +extern "C" size_t _heap3_size; // @suppress("Type cannot be resolved") static const HeapRegion_t xPsramHeapRegions[] = { { &_heap3_start, (size_t) &_heap3_size }, { NULL, 0 } /* Terminates the array. */ }; -size_t get_heap3_size(void) +extern "C" size_t get_heap3_size(void) { return (size_t) &_heap3_size; } @@ -303,7 +308,7 @@ void do_psram_test() break; } - arch_memset4(&__psram_bss_init_start, 0, &__psram_bss_init_end - &__psram_bss_init_start); + memset(&__psram_bss_init_start, 0, &__psram_bss_init_end - &__psram_bss_init_start); psram_reset_count = 0xffffff00; return; @@ -325,13 +330,13 @@ void do_psram_test() } #endif -void setup_heap() +extern "C" void setup_heap() { bl_sys_init(); -#if BL702_ENABLE +#if CHIP_DEVICE_LAYER_TARGET_BL702 bl_sys_em_config(); -#elif BL702L_ENABLE +#elif CHIP_DEVICE_LAYER_TARGET_BL702L bl_sys_em_config(); // Initialize rom data @@ -341,7 +346,7 @@ void setup_heap() memcpy((void *) &_rom_data_run, (void *) &_rom_data_load, (size_t) &_rom_data_size); #endif -#if BL702_ENABLE +#if CHIP_DEVICE_LAYER_TARGET_BL702 extern uint8_t __ocram_bss_start[], __ocram_bss_end[]; if (NULL != __ocram_bss_start && NULL != __ocram_bss_end && __ocram_bss_end > __ocram_bss_start) { @@ -358,16 +363,16 @@ void setup_heap() #endif } -size_t get_heap_size(void) +extern "C" size_t get_heap_size(void) { return (size_t) &_heap_size; } -void app_init(void) +extern "C" void app_init(void) { bl_sys_early_init(); -#if BL702L_ENABLE +#if CHIP_DEVICE_LAYER_TARGET_BL702L rom_freertos_init(256, 400); rom_hal_init(); rom_lmac154_hook_init(); @@ -377,11 +382,11 @@ void app_init(void) blog_init(); bl_irq_init(); -#if BL702L_ENABLE +#if CHIP_DEVICE_LAYER_TARGET_BL702L bl_rtc_init(); #endif bl_sec_init(); -#if BL702_ENABLE +#if CHIP_DEVICE_LAYER_TARGET_BL702 bl_timer_init(); #endif @@ -390,15 +395,15 @@ void app_init(void) /* board config is set after system is init*/ hal_board_cfg(0); -#if BL702L_ENABLE || CHIP_DEVICE_CONFIG_ENABLE_WIFI || CHIP_DEVICE_CONFIG_ENABLE_ETHERNET +#if CHIP_DEVICE_LAYER_TARGET_BL702L || CHIP_DEVICE_CONFIG_ENABLE_WIFI || CHIP_DEVICE_CONFIG_ENABLE_ETHERNET hosal_dma_init(); #endif -#if BL602_ENABLE +#if CHIP_DEVICE_LAYER_TARGET_BL602 wifi_td_diagnosis_init(); #endif } -void platform_port_init(void) +extern "C" void platform_port_init(void) { app_init(); diff --git a/examples/platform/bouffalolab/common/iot_sdk/uart.c b/examples/platform/bouffalolab/common/iot_sdk/uart.cpp similarity index 100% rename from examples/platform/bouffalolab/common/iot_sdk/uart.c rename to examples/platform/bouffalolab/common/iot_sdk/uart.cpp diff --git a/examples/platform/bouffalolab/common/plat/platform.cpp b/examples/platform/bouffalolab/common/plat/platform.cpp index a9dee08583cc56..ea6548327847b1 100644 --- a/examples/platform/bouffalolab/common/plat/platform.cpp +++ b/examples/platform/bouffalolab/common/plat/platform.cpp @@ -61,10 +61,10 @@ #if CHIP_DEVICE_CONFIG_ENABLE_ETHERNET || CHIP_DEVICE_CONFIG_ENABLE_WIFI #include #include -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI && BL602_ENABLE +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI && CHIP_DEVICE_LAYER_TARGET_BL602 #include #endif -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI && BL702_ENABLE +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI && CHIP_DEVICE_LAYER_TARGET_BL702 #include #endif #if CHIP_DEVICE_CONFIG_ENABLE_ETHERNET diff --git a/examples/platform/bouffalolab/common/plat/uart.h b/examples/platform/bouffalolab/common/plat/uart.h index ff2a398a395dd7..77cd7de39bdab8 100644 --- a/examples/platform/bouffalolab/common/plat/uart.h +++ b/examples/platform/bouffalolab/common/plat/uart.h @@ -20,10 +20,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - void uartInit(void); int16_t uartWrite(const char * Buf, uint16_t BufLength); int16_t uartRead(char * Buf, uint16_t NbBytesToRead); @@ -31,7 +27,3 @@ int16_t uartRead(char * Buf, uint16_t NbBytesToRead); #ifdef CFG_USB_CDC_ENABLE void aosUartRxCallback(int fd, void * param); #endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/examples/platform/bouffalolab/common/route_hook/bl_lwip_hooks.h b/examples/platform/bouffalolab/common/route_hook/bl_lwip_hooks.h index 61f12f3c082632..e69383c73fb8ef 100644 --- a/examples/platform/bouffalolab/common/route_hook/bl_lwip_hooks.h +++ b/examples/platform/bouffalolab/common/route_hook/bl_lwip_hooks.h @@ -4,10 +4,6 @@ #include "lwip/err.h" #include "lwip/ip_addr.h" -#if BL616_ENABLE -#include "lwiphooks.h" -#endif - extern struct netif * lwip_hook_ip6_route(const ip6_addr_t * src, const ip6_addr_t * dest); #define LWIP_HOOK_IP6_ROUTE lwip_hook_ip6_route diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index 5eb8a6886ea72f..e5b5c0ba58f2a3 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -114,8 +114,6 @@ app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::SlWiFiDriver::GetInstance())); #endif /* SL_WIFI */ -bool sIsProvisioned = false; - #if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) bool sIsEnabled = false; bool sIsAttached = false; @@ -148,6 +146,7 @@ Identify gIdentify = { #endif // EMBER_AF_PLUGIN_IDENTIFY_SERVER } // namespace +bool BaseApplication::sIsProvisioned = false; #ifdef DIC_ENABLE namespace { @@ -259,10 +258,10 @@ CHIP_ERROR BaseApplication::Init() PlatformMgr().AddEventHandler(OnPlatformEvent, 0); #ifdef SL_WIFI - sIsProvisioned = ConnectivityMgr().IsWiFiStationProvisioned(); + BaseApplication::sIsProvisioned = ConnectivityMgr().IsWiFiStationProvisioned(); #endif /* SL_WIFI */ #if CHIP_ENABLE_OPENTHREAD - sIsProvisioned = ConnectivityMgr().IsThreadProvisioned(); + BaseApplication::sIsProvisioned = ConnectivityMgr().IsThreadProvisioned(); #endif return err; @@ -375,7 +374,7 @@ bool BaseApplication::ActivateStatusLedPatterns() if (!isPatternSet) { // Apply different status feedbacks - if (sIsProvisioned && sIsEnabled) + if (BaseApplication::sIsProvisioned && sIsEnabled) { if (sIsAttached) { @@ -413,9 +412,9 @@ void BaseApplication::LightEventHandler() if (PlatformMgr().TryLockChipStack()) { #ifdef SL_WIFI - sIsProvisioned = ConnectivityMgr().IsWiFiStationProvisioned(); - sIsEnabled = ConnectivityMgr().IsWiFiStationEnabled(); - sIsAttached = ConnectivityMgr().IsWiFiStationConnected(); + BaseApplication::sIsProvisioned = ConnectivityMgr().IsWiFiStationProvisioned(); + sIsEnabled = ConnectivityMgr().IsWiFiStationEnabled(); + sIsAttached = ConnectivityMgr().IsWiFiStationConnected(); #endif /* SL_WIFI */ #if CHIP_ENABLE_OPENTHREAD sIsEnabled = ConnectivityMgr().IsThreadEnabled(); @@ -491,7 +490,7 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent) #ifdef SL_WIFI if (!ConnectivityMgr().IsWiFiStationProvisioned()) #else - if (!sIsProvisioned) + if (!BaseApplication::sIsProvisioned) #endif /* !SL_WIFI */ { // Open Basic CommissioningWindow. Will start BLE advertisements @@ -722,7 +721,7 @@ void BaseApplication::OnPlatformEvent(const ChipDeviceEvent * event, intptr_t) { if (event->Type == DeviceEventType::kServiceProvisioningChange) { - sIsProvisioned = event->ServiceProvisioningChange.IsServiceProvisioned; + BaseApplication::sIsProvisioned = event->ServiceProvisioningChange.IsServiceProvisioned; } } @@ -752,3 +751,8 @@ void BaseApplication::OutputQrCode(bool refreshLCD) SILABS_LOG("Getting QR code failed!"); } } + +bool BaseApplication::getWifiProvisionStatus() +{ + return BaseApplication::sIsProvisioned; +} diff --git a/examples/platform/silabs/BaseApplication.h b/examples/platform/silabs/BaseApplication.h index b3a9db893183e5..8bf67836b9c47a 100644 --- a/examples/platform/silabs/BaseApplication.h +++ b/examples/platform/silabs/BaseApplication.h @@ -70,6 +70,7 @@ class BaseApplication public: BaseApplication() = default; virtual ~BaseApplication(){}; + static bool sIsProvisioned; /** * @brief Create AppTask task and Event Queue @@ -103,6 +104,7 @@ class BaseApplication * Turns off Status LED before stopping timer */ static void StopStatusLEDTimer(void); + static bool getWifiProvisionStatus(void); #ifdef EMBER_AF_PLUGIN_IDENTIFY_SERVER // Idenfiy server command callbacks. diff --git a/examples/platform/silabs/display/demo-ui.c b/examples/platform/silabs/display/demo-ui.c index e430e01ddb82dd..082f79eea0e10f 100644 --- a/examples/platform/silabs/display/demo-ui.c +++ b/examples/platform/silabs/display/demo-ui.c @@ -23,11 +23,11 @@ #include "dmd/dmd.h" #include "em_types.h" #include "glib.h" +#if SL_WIFI && !SIWX_917 +#include "spi_multiplex.h" +#endif // SL_WIFI && !SIWX_917 #include #include -#if (defined(EFR32MG24) && defined(SL_WIFI)) -#include "spi_multiplex.h" -#endif // Main Logo and App image #define SILICONLABS_X_POSITION ((glibContext.pDisplayGeometry->xSize - SILICONLABS_BITMAP_WIDTH) / 2) @@ -102,13 +102,13 @@ void demoUIInit(GLIB_Context_t * context) sl_status_t updateDisplay(void) { -#if (defined(EFR32MG24) && defined(SL_WIFI)) +#if SL_LCDCTRL_MUX sl_wfx_host_pre_lcd_spi_transfer(); -#endif +#endif // SL_LCDCTRL_MUX sl_status_t status = DMD_updateDisplay(); -#if (defined(EFR32MG24) && defined(SL_WIFI)) +#if SL_LCDCTRL_MUX sl_wfx_host_post_lcd_spi_transfer(); -#endif +#endif // SL_LCDCTRL_MUX if (status != DMD_OK) return SL_STATUS_FAIL; return SL_STATUS_OK; diff --git a/examples/platform/silabs/display/lcd.cpp b/examples/platform/silabs/display/lcd.cpp index 63a91795487963..adcb4aea019e40 100644 --- a/examples/platform/silabs/display/lcd.cpp +++ b/examples/platform/silabs/display/lcd.cpp @@ -35,9 +35,6 @@ #include "sl_board_control.h" -#if (defined(EFR32MG24) && defined(SL_WIFI)) -#include "spi_multiplex.h" -#endif #define LCD_SIZE 128 #define QR_CODE_VERSION 4 #define QR_CODE_MODULE_SIZE 3 diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c index aff756aad8888a..1e30b8bdf2f9c6 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c @@ -22,6 +22,11 @@ #include #include +#include "FreeRTOS.h" +#include "event_groups.h" +#include "semphr.h" +#include "task.h" + #include "dmadrv.h" #include "em_chip.h" #include "em_cmu.h" @@ -29,28 +34,24 @@ #include "em_device.h" #include "em_gpio.h" #include "em_ldma.h" -#if defined(EFR32MG12) -#include "em_usart.h" -#elif defined(EFR32MG24) -#include "em_eusart.h" -#endif +#include "gpiointerrupt.h" #include "spidrv.h" -#include "silabs_utils.h" - -#include "gpiointerrupt.h" #include "sl_device_init_clocks.h" -#include "sl_memlcd.h" +#include "sl_device_init_dpll.h" +#include "sl_device_init_hfxo.h" +#include "sl_spidrv_instances.h" #include "sl_status.h" -#include "FreeRTOS.h" -#include "event_groups.h" -#include "task.h" - -#include "btl_interface.h" +#include "silabs_utils.h" +#include "spi_multiplex.h" #include "wfx_host_events.h" #include "wfx_rsi.h" +#if defined(SL_CATALOG_POWER_MANAGER_PRESENT) +#include "sl_power_manager.h" +#endif + #ifdef CHIP_9117 #include "cmsis_os2.h" #include "sl_board_configuration.h" @@ -60,28 +61,48 @@ #include "sl_wifi_callback_framework.h" #include "sl_wifi_constants.h" #include "sl_wifi_types.h" + +// macro to drive semaphore block minimum timer in milli seconds +// ported from rsi_hal.h (rs911x) +#define RSI_SEM_BLOCK_MIN_TIMER_VALUE_MS (50) #else #include "rsi_board_configuration.h" #include "rsi_driver.h" -#endif +#endif // CHIP_9117 -#include "sl_device_init_dpll.h" -#include "sl_device_init_hfxo.h" +#if SL_BTLCTRL_MUX +#include "btl_interface.h" +#endif // SL_BTLCTRL_MUX +#if SL_LCDCTRL_MUX +#include "sl_memlcd.h" +#endif // SL_LCDCTRL_MUX +#if SL_MX25CTRL_MUX +#include "sl_mx25_flash_shutdown_usart_config.h" +#endif // SL_MX25CTRL_MUX -#define DEFAULT_SPI_TRASFER_MODE 0 -// Macro to drive semaphore block minimun timer in milli seconds -#define RSI_SEM_BLOCK_MIN_TIMER_VALUE_MS (50) -#if defined(SL_CATALOG_POWER_MANAGER_PRESENT) -#include "sl_power_manager.h" -#endif +#if defined(EFR32MG12) +#include "em_usart.h" + +#define SL_SPIDRV_HANDLE sl_spidrv_exp_handle + +#elif defined(EFR32MG24) +#include "em_eusart.h" +#include "sl_spidrv_eusart_exp_config.h" + +#define SL_SPIDRV_HANDLE sl_spidrv_eusart_exp_handle +#define SL_SPIDRV_EXP_BITRATE_MULTIPLEXED SL_SPIDRV_EUSART_EXP_BITRATE +#define SL_SPIDRV_UART_CONSOLE_BITRATE SL_UARTDRV_EUSART_VCOM_BAUDRATE +#define SL_SPIDRV_FRAME_LENGTH SL_SPIDRV_EUSART_EXP_FRAME_LENGTH + +#endif // EFR32MG12 || EFR32MG24 #define CONCAT(A, B) (A##B) #define SPI_CLOCK(N) CONCAT(cmuClock_USART, N) -#if defined(EFR32MG24) +#if SL_SPICTRL_MUX StaticSemaphore_t spi_sem_peripheral; -SemaphoreHandle_t spi_sem_sync_hdl; -#endif /* EFR32MG24 */ +static SemaphoreHandle_t spi_sem_sync_hdl; +#endif // SL_SPICTRL_MUX StaticSemaphore_t xEfxSpiIntfSemaBuffer; static SemaphoreHandle_t spiTransferLock; @@ -89,16 +110,6 @@ static TaskHandle_t spiInitiatorTaskHandle = NULL; static uint32_t dummy_buffer; /* Used for DMA - when results don't matter */ -#if defined(EFR32MG12) -#include "sl_spidrv_exp_config.h" -extern SPIDRV_Handle_t sl_spidrv_exp_handle; -#define SL_SPIDRV_HANDLE sl_spidrv_exp_handle -#elif defined(EFR32MG24) -#include "spi_multiplex.h" -#else -#error "Unknown platform" -#endif - // variable to identify spi configured for expansion header // EUSART configuration available on the SPIDRV static bool spi_enabled = false; @@ -175,14 +186,14 @@ void rsi_hal_board_init(void) spiTransferLock = xSemaphoreCreateBinaryStatic(&xEfxSpiIntfSemaBuffer); xSemaphoreGive(spiTransferLock); -#if defined(EFR32MG24) +#if SL_SPICTRL_MUX if (spi_sem_sync_hdl == NULL) { spi_sem_sync_hdl = xSemaphoreCreateBinaryStatic(&spi_sem_peripheral); } configASSERT(spi_sem_sync_hdl); xSemaphoreGive(spi_sem_sync_hdl); -#endif /* EFR32MG24 */ +#endif /* SL_SPICTRL_MUX */ /* GPIO INIT of MG12 & MG24 : Reset, Wakeup, Interrupt */ sl_wfx_host_gpio_init(); @@ -203,8 +214,7 @@ void sl_si91x_host_enable_high_speed_bus() // dummy function for wifi-sdk } -#if defined(EFR32MG24) - +#if SL_SPICTRL_MUX void SPIDRV_SetBaudrate(uint32_t baudrate) { if (EUSART_BaudrateGet(MY_USART) == baudrate) @@ -222,9 +232,11 @@ sl_status_t sl_wfx_host_spi_cs_assert(void) if (!spi_enabled) // Reduce sl_spidrv_init_instances { sl_spidrv_init_instances(); +#if defined(EFR32MG24) + GPIO_PinOutClear(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN); +#endif // EFR32MG24 spi_enabled = true; } - GPIO_PinOutClear(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN); return SL_STATUS_OK; } @@ -235,16 +247,21 @@ sl_status_t sl_wfx_host_spi_cs_deassert(void) if (ECODE_EMDRV_SPIDRV_OK != SPIDRV_DeInit(SL_SPIDRV_HANDLE)) { xSemaphoreGive(spi_sem_sync_hdl); + SILABS_LOG("%s error.", __func__); return SL_STATUS_FAIL; } +#if defined(EFR32MG24) + GPIO_PinOutSet(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN); + GPIO->EUSARTROUTE[SL_SPIDRV_EUSART_EXP_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR; +#endif // EFR32MG24 spi_enabled = false; } - GPIO_PinOutSet(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN); - GPIO->EUSARTROUTE[SL_SPIDRV_EUSART_EXP_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR; xSemaphoreGive(spi_sem_sync_hdl); return SL_STATUS_OK; } +#endif // SL_SPICTRL_MUX +#if SL_MX25CTRL_MUX sl_status_t sl_wfx_host_spiflash_cs_assert(void) { GPIO_PinOutClear(SL_MX25_FLASH_SHUTDOWN_CS_PORT, SL_MX25_FLASH_SHUTDOWN_CS_PIN); @@ -256,28 +273,31 @@ sl_status_t sl_wfx_host_spiflash_cs_deassert(void) GPIO_PinOutSet(SL_MX25_FLASH_SHUTDOWN_CS_PORT, SL_MX25_FLASH_SHUTDOWN_CS_PIN); return SL_STATUS_OK; } +#endif // SL_MX25CTRL_MUX +#if SL_BTLCTRL_MUX sl_status_t sl_wfx_host_pre_bootloader_spi_transfer(void) { - xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY); - if (spi_enabled) +#if SL_SPICTRL_MUX + if (sl_wfx_host_spi_cs_deassert() != SL_STATUS_OK) { - if (ECODE_EMDRV_SPIDRV_OK != SPIDRV_DeInit(SL_SPIDRV_HANDLE)) - { - xSemaphoreGive(spi_sem_sync_hdl); - return SL_STATUS_FAIL; - } - spi_enabled = false; + return SL_STATUS_FAIL; } + xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY); +#endif // SL_SPICTRL_MUX // bootloader_init takes care of SPIDRV_Init() int32_t status = bootloader_init(); if (status != BOOTLOADER_OK) { SILABS_LOG("bootloader_init error: %x", status); +#if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); +#endif // SL_SPICTRL_MUX return SL_STATUS_FAIL; } +#if SL_MX25CTRL_MUX sl_wfx_host_spiflash_cs_assert(); +#endif // SL_MX25CTRL_MUX return SL_STATUS_OK; } @@ -288,31 +308,39 @@ sl_status_t sl_wfx_host_post_bootloader_spi_transfer(void) if (status != BOOTLOADER_OK) { SILABS_LOG("bootloader_deinit error: %x", status); +#if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); +#endif // SL_SPICTRL_MUX return SL_STATUS_FAIL; } GPIO->USARTROUTE[SL_MX25_FLASH_SHUTDOWN_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR; +#if SL_MX25CTRL_MUX sl_wfx_host_spiflash_cs_deassert(); +#endif // SL_MX25CTRL_MUX +#if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); +#endif // SL_SPICTRL_MUX return SL_STATUS_OK; } +#endif // SL_BTLCTRL_MUX +#if SL_LCDCTRL_MUX sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void) { - xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY); - if (spi_enabled) +#if SL_SPICTRL_MUX + if (sl_wfx_host_spi_cs_deassert() != SL_STATUS_OK) { - if (ECODE_EMDRV_SPIDRV_OK != SPIDRV_DeInit(SL_SPIDRV_HANDLE)) - { - xSemaphoreGive(spi_sem_sync_hdl); - return SL_STATUS_FAIL; - } - spi_enabled = false; + return SL_STATUS_FAIL; } + xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY); +#endif // SL_SPICTRL_MUX // sl_memlcd_refresh takes care of SPIDRV_Init() if (SL_STATUS_OK != sl_memlcd_refresh(sl_memlcd_get())) { +#if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); +#endif // SL_SPICTRL_MUX + SILABS_LOG("%s error.", __func__); return SL_STATUS_FAIL; } return SL_STATUS_OK; @@ -323,11 +351,12 @@ sl_status_t sl_wfx_host_post_lcd_spi_transfer(void) USART_Enable(SL_MEMLCD_SPI_PERIPHERAL, usartDisable); CMU_ClockEnable(SPI_CLOCK(SL_MEMLCD_SPI_PERIPHERAL_NO), false); GPIO->USARTROUTE[SL_MEMLCD_SPI_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR; +#if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); +#endif // SL_SPICTRL_MUX return SL_STATUS_OK; } - -#endif /* EFR32MG24 */ +#endif // SL_LCDCTRL_MUX /***************************************************************************** *@brief @@ -351,26 +380,30 @@ static void spi_dmaTransfertComplete(SPIDRV_HandleData_t * pxHandle, Ecode_t tra } /********************************************************************* - * @fn int16_t rsi_spi_transfer(uint8_t *tx_buf, uint8_t *rx_buf, uint16_t xlen, uint8_t mode) - * @brief - * Do a SPI transfer - Mode is 8/16 bit - But every 8 bit is aligned - * @param[in] tx_buf: - * @param[in] rx_buf: - * @param[in] xlen: - * @param[in] mode: - * @return - * None + * @fn int16_t rsi_spi_transfer(uint8_t *ptrBuf, uint16_t bufLen, uint8_t *valBuf, uint8_t mode) + * @param[in] uint8_t *tx_buff, pointer to the buffer with the data to be transfered + * @param[in] uint8_t *rx_buff, pointer to the buffer to store the data received + * @param[in] uint16_t transfer_length, Number of bytes to send and receive + * @param[in] uint8_t mode, To indicate mode 8 BIT/32 BIT mode transfers. + * @param[out] None + * @return 0, 0=success + * @section description + * This API is used to transfer/receive data to the Wi-Fi module through the SPI interface. **************************************************************************/ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint8_t mode) { -#if defined(EFR32MG24) +#if SL_SPICTRL_MUX sl_wfx_host_spi_cs_assert(); -#endif /* EFR32MG24 */ +#endif // SL_SPICTRL_MUX /* TODO: tx_buf and rx_buf needs to be replaced with a dummy buffer of length xlen to align with SDK of WiFi */ if (xlen <= MIN_XLEN || (tx_buf == NULL && rx_buf == NULL)) { + if (xlen > sizeof(dummy_buffer)) + { + return RSI_ERROR_INVALID_PARAM; // Ensuring that the dummy buffer won't corrupt the memory + } rx_buf = (uint8_t *) &dummy_buffer; tx_buf = (uint8_t *) &dummy_buffer; } @@ -423,24 +456,25 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint } xSemaphoreGive(spiTransferLock); -#if defined(EFR32MG24) +#if SL_SPICTRL_MUX sl_wfx_host_spi_cs_deassert(); -#endif /* EFR32MG24 */ +#endif // SL_SPICTRL_MUX return rsiError; } +#ifdef CHIP_9117 /********************************************************************* - * @fn int16_t rsi_spi_transfer(uint8_t *tx_buf, uint8_t *rx_buf, uint16_t xlen, uint8_t mode) - * @brief - * Do a SPI transfer - Mode is 8/16 bit - But every 8 bit is aligned - * @param[in] tx_buf: - * @param[in] rx_buf: - * @param[in] xlen: - * @param[in] mode: - * @return - * None + * @fn int16_t sl_si91x_host_spi_transfer(uint8_t *tx_buf, uint8_t *rx_buf, uint16_t xlen) + * @param[in] uint8_t *tx_buff, pointer to the buffer with the data to be transferred + * @param[in] uint8_t *rx_buff, pointer to the buffer to store the data received + * @param[in] uint16_t transfer_length, Number of bytes to send and receive + * @param[out] None + * @return 0, 0=success + * @section description + * This API is used to transfer/receive data to the Wi-Fi module through the SPI interface. **************************************************************************/ sl_status_t sl_si91x_host_spi_transfer(const void * tx_buf, void * rx_buf, uint16_t xlen) { - return (rsi_spi_transfer((uint8_t *) tx_buf, rx_buf, xlen, DEFAULT_SPI_TRASFER_MODE)); + return (rsi_spi_transfer((uint8_t *) tx_buf, rx_buf, xlen, RSI_MODE_8BIT)); } +#endif // CHIP_9117 diff --git a/examples/platform/silabs/efr32/spi_multiplex.h b/examples/platform/silabs/efr32/spi_multiplex.h index 0c926b809fab1a..82eaf3991bdf4e 100644 --- a/examples/platform/silabs/efr32/spi_multiplex.h +++ b/examples/platform/silabs/efr32/spi_multiplex.h @@ -24,41 +24,32 @@ #pragma once -#if defined(EFR32MG24) +#ifndef SL_LCDCTRL_MUX +#define SL_LCDCTRL_MUX (EFR32MG24 && SL_WIFI && DISPLAY_ENABLED) +#endif // SL_LCDCTRL_MUX + +#ifndef SL_UARTCTRL_MUX +#define SL_UARTCTRL_MUX (EFR32MG24 && WF200_WIFI && ENABLE_CHIP_SHELL) +#endif // SL_UARTCTRL_MUX + +#ifndef SL_MX25CTRL_MUX +#define SL_MX25CTRL_MUX (EFR32MG24 && SL_WIFI && CONFIG_USE_EXTERNAL_FLASH) +#endif // SL_MX25CTRL_MUX + +#ifndef SL_BTLCTRL_MUX +#define SL_BTLCTRL_MUX (EFR32MG24 && SL_WIFI && CONFIG_USE_EXTERNAL_FLASH) +#endif // SL_BTLCTRL_MUX + +#ifndef SL_SPICTRL_MUX +#define SL_SPICTRL_MUX (EFR32MG24 && SL_WIFI && (SL_LCDCTRL_MUX || SL_UARTCTRL_MUX || SL_MX25CTRL_MUX || SL_BTLCTRL_MUX)) +#endif // SL_SPICTRL_MUX + +#if SL_SPICTRL_MUX #ifdef __cplusplus extern "C" { #endif -#include "FreeRTOS.h" -#include "em_eusart.h" -#include "semphr.h" -#include "sl_memlcd_display.h" -#include "sl_mx25_flash_shutdown_usart_config.h" -#include "sl_spidrv_instances.h" -#include "spidrv.h" - -#define SL_SPIDRV_LCD_BITRATE SL_MEMLCD_SCLK_FREQ -#define SL_SPIDRV_MX25_FLASH_BITRATE 16000000 - -#ifdef RS911X_WIFI -#include "sl_spidrv_eusart_exp_config.h" - -#define SL_SPIDRV_EXP_BITRATE_MULTIPLEXED SL_SPIDRV_EUSART_EXP_BITRATE -#define SL_SPIDRV_UART_CONSOLE_BITRATE SL_UARTDRV_EUSART_VCOM_BAUDRATE -#define SL_SPIDRV_FRAME_LENGTH SL_SPIDRV_EUSART_EXP_FRAME_LENGTH -#define SL_SPIDRV_HANDLE sl_spidrv_eusart_exp_handle - -#elif WF200_WIFI -#include "sl_spidrv_exp_config.h" -#include "sl_wfx_host_api.h" - -// TODO: (MATTER-1906) Investigate why using SL_SPIDRV_EXP_BITRATE is causing WF200 init failure -// REF: sl_spidrv_exp_config.h -#define SL_SPIDRV_EXP_BITRATE_MULTIPLEXED 10000000 -#define SL_SPIDRV_UART_CONSOLE_BITRATE SL_UARTDRV_USART_VCOM_BAUDRATE -#define SL_SPIDRV_FRAME_LENGTH SL_SPIDRV_EXP_FRAME_LENGTH -#define SL_SPIDRV_HANDLE sl_spidrv_exp_handle -#endif /* RS911X_WIFI || WF200_WIFI */ +#if SL_SPICTRL_MUX /**************************************************************************** * @fn void SPIDRV_SetBaudrate() * @brief @@ -87,7 +78,9 @@ sl_status_t sl_wfx_host_spi_cs_assert(void); *****************************************************************************/ sl_status_t sl_wfx_host_spi_cs_deassert(void); #endif /* RS911X_WIFI */ +#endif // SL_SPICTRL_MUX +#if SL_MUX25CTRL_MUX /**************************************************************************** * @fn sl_status_t sl_wfx_host_spiflash_cs_assert() * @brief @@ -105,7 +98,9 @@ sl_status_t sl_wfx_host_spiflash_cs_assert(void); * @return returns SL_STATUS_OK *****************************************************************************/ sl_status_t sl_wfx_host_spiflash_cs_deassert(void); +#endif // SL_MUX25CTRL_MUX +#if SL_BTLCTRL_MUX /**************************************************************************** * @fn sl_status_t sl_wfx_host_pre_bootloader_spi_transfer() * @brief @@ -123,7 +118,9 @@ sl_status_t sl_wfx_host_pre_bootloader_spi_transfer(void); * @return SL_STATUS_OK *****************************************************************************/ sl_status_t sl_wfx_host_post_bootloader_spi_transfer(void); +#endif // SL_BTLCTRL_MUX +#if SL_LCDCTRL_MUX /**************************************************************************** * @fn sl_status_t sl_wfx_host_pre_lcd_spi_transfer() * @brief @@ -141,8 +138,9 @@ sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void); * @return SL_STATUS_OK *****************************************************************************/ sl_status_t sl_wfx_host_post_lcd_spi_transfer(void); +#endif // SL_LCDCTRL_MUX -#if defined(WF200_WIFI) +#if SL_UARTCTRL_MUX /**************************************************************************** * @fn sl_status_t sl_wfx_host_pre_uart_transfer() * @brief @@ -160,9 +158,9 @@ sl_status_t sl_wfx_host_pre_uart_transfer(void); * @return SL_STATUS_OK *****************************************************************************/ sl_status_t sl_wfx_host_post_uart_transfer(void); -#endif /* WF200_WIFI */ +#endif // SL_UARTCTRL_MUX #ifdef __cplusplus } #endif -#endif /* EFR32MG24 */ +#endif // SL_SPICTRL_MUX diff --git a/examples/platform/silabs/efr32/uart.cpp b/examples/platform/silabs/efr32/uart.cpp index 1576e67f4fc907..3941114218a664 100644 --- a/examples/platform/silabs/efr32/uart.cpp +++ b/examples/platform/silabs/efr32/uart.cpp @@ -32,11 +32,11 @@ extern "C" { #include "sl_board_control.h" #endif #include "sl_uartdrv_instances.h" +#if SL_WIFI +#include "spi_multiplex.h" +#endif // SL_WIFI #ifdef SL_CATALOG_UARTDRV_EUSART_PRESENT #include "sl_uartdrv_eusart_vcom_config.h" -#if (defined(EFR32MG24) && defined(WF200_WIFI)) -#include "spi_multiplex.h" -#endif /* EFR32MG24 && WF200_WIFI */ #endif #ifdef SL_CATALOG_UARTDRV_USART_PRESENT #include "sl_uartdrv_usart_vcom_config.h" @@ -474,18 +474,21 @@ void uartSendBytes(uint8_t * buffer, uint16_t nbOfBytes) #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) sl_power_manager_add_em_requirement(SL_POWER_MANAGER_EM1); #endif - +#if SL_UARTCTRL_MUX + sl_wfx_host_pre_uart_transfer(); +#endif // SL_UARTCTRL_MUX #if (defined(EFR32MG24) && defined(WF200_WIFI)) // Blocking transmit for the MG24 + WF200 since UART TX is multiplexed with // WF200 SPI IRQ - sl_wfx_host_pre_uart_transfer(); UARTDRV_ForceTransmit(vcom_handle, (uint8_t *) buffer, nbOfBytes); - sl_wfx_host_post_uart_transfer(); #else // Non Blocking Transmit UARTDRV_Transmit(vcom_handle, (uint8_t *) buffer, nbOfBytes, UART_tx_callback); ulTaskNotifyTake(pdTRUE, portMAX_DELAY); #endif /* EFR32MG24 && WF200_WIFI */ +#if SL_UARTCTRL_MUX + sl_wfx_host_post_uart_transfer(); +#endif // SL_UARTCTRL_MUX #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1); diff --git a/examples/platform/silabs/efr32/wf200/efr_spi.c b/examples/platform/silabs/efr32/wf200/efr_spi.c index ab5a4e64ab73c1..4cb83427ca3a49 100644 --- a/examples/platform/silabs/efr32/wf200/efr_spi.c +++ b/examples/platform/silabs/efr32/wf200/efr_spi.c @@ -14,21 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#include "sl_wfx_configuration_defaults.h" - -#include "sl_wfx.h" -#include "sl_wfx_board.h" -#include "sl_wfx_host_api.h" - -#include "dmadrv.h" -#include "em_bus.h" -#include "em_cmu.h" -#include "em_gpio.h" -#include "em_ldma.h" -#include "em_usart.h" -#include "spidrv.h" - #include #include #include @@ -37,34 +22,52 @@ #include "FreeRTOS.h" #include "semphr.h" +#include "dmadrv.h" +#include "em_bus.h" +#include "em_cmu.h" +#include "em_gpio.h" +#include "em_ldma.h" +#include "em_usart.h" #include "gpiointerrupt.h" - +#include "sl_spidrv_exp_config.h" +#include "sl_spidrv_instances.h" +#include "sl_wfx.h" #include "sl_wfx_board.h" +#include "sl_wfx_configuration_defaults.h" #include "sl_wfx_host.h" +#include "sl_wfx_host_api.h" #include "sl_wfx_task.h" +#include "spidrv.h" + +#include "spi_multiplex.h" #include "wfx_host_events.h" #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) #include "sl_power_manager.h" #endif -#if defined(EFR32MG12) -#include "sl_spidrv_exp_config.h" -extern SPIDRV_Handle_t sl_spidrv_exp_handle; +#if SL_LCDCTRL_MUX +#include "sl_memlcd_display.h" +#define SL_SPIDRV_LCD_BITRATE SL_MEMLCD_SCLK_FREQ +#endif // SL_LCDCTRL_MUX +#if SL_MX25CTRL_MUX +#include "sl_mx25_flash_shutdown_usart_config.h" +#define SL_SPIDRV_MX25_FLASH_BITRATE 16000000 +#endif // SL_MX25CTRL_MUX + +// TODO: (MATTER-1906) Investigate why using SL_SPIDRV_EXP_BITRATE is causing WF200 init failure +// REF: sl_spidrv_exp_config.h +#define SL_SPIDRV_EXP_BITRATE_MULTIPLEXED 10000000 +#define SL_SPIDRV_UART_CONSOLE_BITRATE SL_UARTDRV_USART_VCOM_BAUDRATE +#define SL_SPIDRV_FRAME_LENGTH SL_SPIDRV_EXP_FRAME_LENGTH #define SL_SPIDRV_HANDLE sl_spidrv_exp_handle -#elif defined(EFR32MG24) -#include "sl_spidrv_eusart_exp_config.h" -#include "spi_multiplex.h" -#else -#error "Unknown platform" -#endif #define USART SL_WFX_HOST_PINOUT_SPI_PERIPHERAL -#if defined(EFR32MG24) +#if SL_SPICTRL_MUX StaticSemaphore_t spi_sem_peripheral; -SemaphoreHandle_t spi_sem_sync_hdl; -#endif /* EFR32MG24 */ +static SemaphoreHandle_t spi_sem_sync_hdl; +#endif // SL_SPICTRL_MUX StaticSemaphore_t xEfrSpiSemaBuffer; static SemaphoreHandle_t spi_sem; @@ -113,23 +116,23 @@ sl_status_t sl_wfx_host_init_bus(void) spi_sem = xSemaphoreCreateBinaryStatic(&xEfrSpiSemaBuffer); xSemaphoreGive(spi_sem); -#if defined(EFR32MG24) +#if SL_SPICTRL_MUX if (spi_sem_sync_hdl == NULL) { spi_sem_sync_hdl = xSemaphoreCreateBinaryStatic(&spi_sem_peripheral); } configASSERT(spi_sem_sync_hdl); xSemaphoreGive(spi_sem_sync_hdl); -#endif /* EFR32MG24 */ +#endif /* SL_SPICTRL_MUX */ return SL_STATUS_OK; } sl_status_t sl_wfx_host_deinit_bus(void) { vSemaphoreDelete(spi_sem); -#if defined(EFR32MG24) +#if SL_SPICTRL_MUX vSemaphoreDelete(spi_sem_sync_hdl); -#endif /* EFR32MG24 */ +#endif /* SL_SPICTRL_MUX */ // Stop DMAs. DMADRV_StopTransfer(rx_dma_channel); DMADRV_StopTransfer(tx_dma_channel); @@ -142,10 +145,10 @@ sl_status_t sl_wfx_host_deinit_bus(void) sl_status_t sl_wfx_host_spi_cs_assert() { -#if defined(EFR32MG24) +#if SL_SPICTRL_MUX xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY); SPIDRV_SetBaudrate(SL_SPIDRV_EXP_BITRATE_MULTIPLEXED); -#endif /* EFR32MG24 */ +#endif /* SL_SPICTRL_MUX */ GPIO_PinOutClear(SL_SPIDRV_EXP_CS_PORT, SL_SPIDRV_EXP_CS_PIN); return SL_STATUS_OK; } @@ -153,9 +156,9 @@ sl_status_t sl_wfx_host_spi_cs_assert() sl_status_t sl_wfx_host_spi_cs_deassert() { GPIO_PinOutSet(SL_SPIDRV_EXP_CS_PORT, SL_SPIDRV_EXP_CS_PIN); -#if defined(EFR32MG24) +#if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); -#endif /* EFR32MG24 */ +#endif /* SL_SPICTRL_MUX */ return SL_STATUS_OK; } @@ -370,9 +373,7 @@ void sl_wfx_host_gpio_init(void) NVIC_SetPriority(GPIO_EVEN_IRQn, 5); NVIC_SetPriority(GPIO_ODD_IRQn, 5); } - -#if defined(EFR32MG24) - +#if SL_SPICTRL_MUX void SPIDRV_SetBaudrate(uint32_t baudrate) { if (USART_BaudrateGet(MY_USART) == baudrate) @@ -391,7 +392,8 @@ void SPIDRV_SetBaudrate(uint32_t baudrate) USART_InitSync(MY_USART, &usartInit); } - +#endif // SL_SPICTRL_MUX +#if SL_MX25CTRL_MUX sl_status_t sl_wfx_host_spiflash_cs_assert(void) { GPIO_PinOutClear(SL_MX25_FLASH_SHUTDOWN_CS_PORT, SL_MX25_FLASH_SHUTDOWN_CS_PIN); @@ -403,15 +405,21 @@ sl_status_t sl_wfx_host_spiflash_cs_deassert(void) GPIO_PinOutSet(SL_MX25_FLASH_SHUTDOWN_CS_PORT, SL_MX25_FLASH_SHUTDOWN_CS_PIN); return SL_STATUS_OK; } +#endif // SL_MX25CTRL_MUX +#if SL_BTLCTRL_MUX sl_status_t sl_wfx_host_pre_bootloader_spi_transfer(void) { +#if SL_SPICTRL_MUX xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY); +#endif // SL_SPICTRL_MUX /* * Assert CS pin for EXT SPI Flash */ SPIDRV_SetBaudrate(SL_SPIDRV_MX25_FLASH_BITRATE); +#if SL_MX25CTRL_MUX sl_wfx_host_spiflash_cs_assert(); +#endif // SL_MX25CTRL_MUX return SL_STATUS_OK; } @@ -420,14 +428,22 @@ sl_status_t sl_wfx_host_post_bootloader_spi_transfer(void) /* * De-Assert CS pin for EXT SPI Flash */ +#if SL_MX25CTRL_MUX sl_wfx_host_spiflash_cs_deassert(); +#endif // SL_MX25CTRL_MUX +#if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); +#endif // SL_SPICTRL_MUX return SL_STATUS_OK; } +#endif // SL_BTLCTRL_MUX +#if SL_LCDCTRL_MUX sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void) { +#if SL_SPICTRL_MUX xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY); +#endif // SL_SPICTRL_MUX SPIDRV_SetBaudrate(SL_SPIDRV_LCD_BITRATE); /*LCD CS is handled as part of LCD gsdk*/ return SL_STATUS_OK; @@ -435,36 +451,50 @@ sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void) sl_status_t sl_wfx_host_post_lcd_spi_transfer(void) { +#if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); +#endif // SL_SPICTRL_MUX return SL_STATUS_OK; } +#endif // SL_LCDCTRL_MUX +#if SL_UARTCTRL_MUX sl_status_t sl_wfx_host_pre_uart_transfer(void) { +#if SL_SPICTRL_MUX if (spi_sem_sync_hdl == NULL) { - // UART is initialized before host SPI interface - // spi_sem_sync_hdl will not be initalized during execution +#endif // SL_SPICTRL_MUX + // UART is initialized before host SPI interface + // spi_sem_sync_hdl will not be initalized during execution GPIO_PinModeSet(gpioPortA, 8, gpioModePushPull, 1); +#if SL_SPICTRL_MUX return SL_STATUS_OK; } +#endif // SL_SPICTRL_MUX sl_wfx_disable_irq(); sl_wfx_host_disable_platform_interrupt(); +#if SL_SPICTRL_MUX xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY); +#endif // SL_SPICTRL_MUX GPIO_PinModeSet(gpioPortA, 8, gpioModePushPull, 1); return SL_STATUS_OK; } sl_status_t sl_wfx_host_post_uart_transfer(void) { +#if SL_SPICTRL_MUX if (spi_sem_sync_hdl == NULL) { return SL_STATUS_OK; } +#endif // SL_SPICTRL_MUX GPIO_PinModeSet(gpioPortA, 8, gpioModeInputPull, 1); +#if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); +#endif // SL_SPICTRL_MUX sl_wfx_host_enable_platform_interrupt(); sl_wfx_enable_irq(); return SL_STATUS_OK; } -#endif /* EFR32MG24 */ +#endif // SL_UARTCTRL_MUX diff --git a/examples/refrigerator-app/asr/BUILD.gn b/examples/refrigerator-app/asr/BUILD.gn index 5ec5ae20d35c48..ec5abde393fcf6 100755 --- a/examples/refrigerator-app/asr/BUILD.gn +++ b/examples/refrigerator-app/asr/BUILD.gn @@ -105,7 +105,7 @@ asr_executable("refrigerator_app") { defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL" ] sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] include_dirs += [ "${examples_plat_dir}/shell" ] } diff --git a/examples/refrigerator-app/asr/src/AppTask.cpp b/examples/refrigerator-app/asr/src/AppTask.cpp index 7c1f82f73021d5..7e2481ebc05e3f 100644 --- a/examples/refrigerator-app/asr/src/AppTask.cpp +++ b/examples/refrigerator-app/asr/src/AppTask.cpp @@ -32,7 +32,7 @@ #include #include "init_Matter.h" -#if CONFIG_ENABLE_CHIP_SHELL +#ifdef CONFIG_ENABLE_CHIP_SHELL #include "matter_shell.h" #endif #include diff --git a/examples/temperature-measurement-app/asr/BUILD.gn b/examples/temperature-measurement-app/asr/BUILD.gn index 12806d35bd46f4..dd6ea2665eb8c3 100755 --- a/examples/temperature-measurement-app/asr/BUILD.gn +++ b/examples/temperature-measurement-app/asr/BUILD.gn @@ -104,7 +104,7 @@ asr_executable("temperature_measurement_app") { defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL" ] sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] include_dirs += [ "${examples_plat_dir}/shell" ] } diff --git a/examples/thermostat/asr/BUILD.gn b/examples/thermostat/asr/BUILD.gn index 3b782253cab086..ad1a4dbcab72be 100755 --- a/examples/thermostat/asr/BUILD.gn +++ b/examples/thermostat/asr/BUILD.gn @@ -107,7 +107,7 @@ asr_executable("thermostat") { defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] if (chip_build_libshell) { - defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] + defines += [ "CONFIG_ENABLE_CHIP_SHELL" ] sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] include_dirs += [ "${examples_plat_dir}/shell" ] } diff --git a/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/doorlock/GetLockStateFlowUseCase.kt b/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/doorlock/GetLockStateFlowUseCase.kt new file mode 100644 index 00000000000000..b167997c0294e2 --- /dev/null +++ b/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/doorlock/GetLockStateFlowUseCase.kt @@ -0,0 +1,12 @@ +package com.matter.virtual.device.app.core.domain.usecase.matter.cluster.doorlock + +import com.matter.virtual.device.app.core.data.repository.cluster.DoorLockManagerRepository +import javax.inject.Inject +import kotlinx.coroutines.flow.StateFlow + +class GetLockStateFlowUseCase +@Inject +constructor(private val doorLockManagerRepository: DoorLockManagerRepository) { + + operator fun invoke(): StateFlow = doorLockManagerRepository.getLockStateFlow() +} diff --git a/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/doorlock/SendLockAlarmEventUseCase.kt b/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/doorlock/SendLockAlarmEventUseCase.kt new file mode 100644 index 00000000000000..e5e79a1c18062a --- /dev/null +++ b/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/doorlock/SendLockAlarmEventUseCase.kt @@ -0,0 +1,19 @@ +package com.matter.virtual.device.app.core.domain.usecase.matter.cluster.doorlock + +import com.matter.virtual.device.app.core.common.di.IoDispatcher +import com.matter.virtual.device.app.core.data.repository.cluster.DoorLockManagerRepository +import com.matter.virtual.device.app.core.domain.NonParamCoroutineUseCase +import javax.inject.Inject +import kotlinx.coroutines.CoroutineDispatcher + +class SendLockAlarmEventUseCase +@Inject +constructor( + private val doorLockManagerRepository: DoorLockManagerRepository, + @IoDispatcher dispatcher: CoroutineDispatcher +) : NonParamCoroutineUseCase(dispatcher) { + + override suspend fun execute() { + return doorLockManagerRepository.sendLockAlarmEvent() + } +} diff --git a/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/doorlock/SetLockStateUseCase.kt b/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/doorlock/SetLockStateUseCase.kt new file mode 100644 index 00000000000000..3bec41f20a59f8 --- /dev/null +++ b/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/doorlock/SetLockStateUseCase.kt @@ -0,0 +1,19 @@ +package com.matter.virtual.device.app.core.domain.usecase.matter.cluster.doorlock + +import com.matter.virtual.device.app.core.common.di.IoDispatcher +import com.matter.virtual.device.app.core.data.repository.cluster.DoorLockManagerRepository +import com.matter.virtual.device.app.core.domain.CoroutineUseCase +import javax.inject.Inject +import kotlinx.coroutines.CoroutineDispatcher + +class SetLockStateUseCase +@Inject +constructor( + private val doorLockManagerRepository: DoorLockManagerRepository, + @IoDispatcher dispatcher: CoroutineDispatcher +) : CoroutineUseCase(dispatcher) { + + override suspend fun execute(param: Boolean) { + doorLockManagerRepository.setLockState(param) + } +} diff --git a/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/powersource/GetBatPercentRemainingUseCase.kt b/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/powersource/GetBatPercentRemainingUseCase.kt new file mode 100644 index 00000000000000..9ff150824659eb --- /dev/null +++ b/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/powersource/GetBatPercentRemainingUseCase.kt @@ -0,0 +1,13 @@ +package com.matter.virtual.device.app.core.domain.usecase.matter.cluster.powersource + +import com.matter.virtual.device.app.core.data.repository.cluster.PowerSourceManagerRepository +import javax.inject.Inject +import kotlinx.coroutines.flow.StateFlow + +class GetBatPercentRemainingUseCase +@Inject +constructor( + private val powerSourceManagerRepository: PowerSourceManagerRepository, +) { + operator fun invoke(): StateFlow = powerSourceManagerRepository.getBatPercent() +} diff --git a/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/powersource/SetBatPercentRemainingUseCase.kt b/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/powersource/SetBatPercentRemainingUseCase.kt new file mode 100644 index 00000000000000..00840676483ff6 --- /dev/null +++ b/examples/virtual-device-app/android/App/core/domain/src/main/java/com/matter/virtual/device/app/core/domain/usecase/matter/cluster/powersource/SetBatPercentRemainingUseCase.kt @@ -0,0 +1,19 @@ +package com.matter.virtual.device.app.core.domain.usecase.matter.cluster.powersource + +import com.matter.virtual.device.app.core.common.di.IoDispatcher +import com.matter.virtual.device.app.core.data.repository.cluster.PowerSourceManagerRepository +import com.matter.virtual.device.app.core.domain.CoroutineUseCase +import javax.inject.Inject +import kotlinx.coroutines.CoroutineDispatcher + +class SetBatPercentRemainingUseCase +@Inject +constructor( + private val powerSourceManagerRepository: PowerSourceManagerRepository, + @IoDispatcher dispatcher: CoroutineDispatcher +) : CoroutineUseCase(dispatcher) { + + override suspend fun execute(param: Int) { + powerSourceManagerRepository.setBatPercentRemaining(param) + } +} diff --git a/examples/window-app/silabs/include/WindowManager.h b/examples/window-app/silabs/include/WindowManager.h index 0249ddc5e67051..33121118c7b60c 100644 --- a/examples/window-app/silabs/include/WindowManager.h +++ b/examples/window-app/silabs/include/WindowManager.h @@ -160,7 +160,6 @@ class WindowManager LEDWidget mStatusLED; LEDWidget mActionLED; - #ifdef DISPLAY_ENABLED Timer mIconTimer; LcdIcon mIcon = LcdIcon::None; diff --git a/examples/window-app/silabs/src/WindowManager.cpp b/examples/window-app/silabs/src/WindowManager.cpp index c4358e13409225..46e883abe37dbc 100644 --- a/examples/window-app/silabs/src/WindowManager.cpp +++ b/examples/window-app/silabs/src/WindowManager.cpp @@ -657,30 +657,6 @@ void WindowManager::UpdateLEDs() } else { - if (mState.isWinking) - { - mStatusLED.Blink(200, 200); - } - else -#if CHIP_ENABLE_OPENTHREAD - if (mState.isThreadProvisioned && mState.isThreadEnabled) -#else - if (mState.isWiFiProvisioned && mState.isWiFiEnabled) -#endif - - { - - mStatusLED.Blink(950, 50); - } - else if (mState.haveBLEConnections) - { - mStatusLED.Blink(100, 100); - } - else - { - mStatusLED.Blink(50, 950); - } - // Action LED NPercent100ths current; LimitStatus liftLimit = LimitStatus::Intermediate; @@ -725,7 +701,7 @@ void WindowManager::UpdateLCD() #if CHIP_ENABLE_OPENTHREAD if (mState.isThreadProvisioned) #else - if (mState.isWiFiProvisioned) + if (BaseApplication::getWifiProvisionStatus()) #endif // CHIP_ENABLE_OPENTHREAD { Cover & cover = GetCover(); @@ -739,12 +715,10 @@ void WindowManager::UpdateLCD() Attributes::CurrentPositionTilt::Get(cover.mEndpoint, tilt); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); -#ifdef DISPLAY_ENABLED if (!tilt.IsNull() && !lift.IsNull()) { LcdPainter::Paint(slLCD, type, lift.Value(), tilt.Value(), mIcon); } -#endif } #endif // DISPLAY_ENABLED } diff --git a/integrations/docker/images/base/chip-build/version b/integrations/docker/images/base/chip-build/version index 0263af9f1516db..366e70bb2f0bce 100644 --- a/integrations/docker/images/base/chip-build/version +++ b/integrations/docker/images/base/chip-build/version @@ -1 +1 @@ -20 : [Chip-build] Decrease some image sizes +21 : [chip-build-java] Ensure java is actually available in the docker image diff --git a/integrations/docker/images/stage-2/chip-build-java/Dockerfile b/integrations/docker/images/stage-2/chip-build-java/Dockerfile index 16308a3af485f2..8b1834cceda0a0 100644 --- a/integrations/docker/images/stage-2/chip-build-java/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-java/Dockerfile @@ -2,6 +2,14 @@ ARG VERSION=1 FROM ghcr.io/project-chip/chip-build:${VERSION} LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip +# Ensure some java is installed +RUN set -x \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -fy \ + openjdk-8-jdk \ + && rm -rf /var/lib/apt/lists/ \ + && : # last line + # Download and install kotlin compiler RUN set -x \ && cd /usr/lib \ diff --git a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile index 8f3a177272b785..d824716800004e 100644 --- a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile @@ -72,22 +72,22 @@ RUN set -x \ && chmod -R a+w /opt/android/sdk/licenses \ && : # last line -# Required for the Tizen SDK +# Required for the Tizen SDK: +# - zip +# Required for the Open IoT SDK platform +# - expect +# - telnet +# - srecord +# For java builds: +# - openjdk-8-jdk RUN set -x \ && apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \ zip \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ - && : # last line - -# Required for the Open IoT SDK platform -RUN set -x \ - && apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -fy \ expect \ telnet \ srecord \ + openjdk-8-jdk \ && apt-get clean \ && rm -rf /var/lib/apt/lists/ \ && : # last line diff --git a/scripts/build/builders/android.py b/scripts/build/builders/android.py index 14802fe5e83e80..a6f2186da6e1e7 100644 --- a/scripts/build/builders/android.py +++ b/scripts/build/builders/android.py @@ -354,7 +354,7 @@ def generate(self): args_str = "" for key, value in gn_args.items(): - if type(value) == bool: + if type(value) is bool: if value: args_str += "%s=true " % (key) else: diff --git a/scripts/py_matter_idl/matter_idl/matter_idl_parser.py b/scripts/py_matter_idl/matter_idl/matter_idl_parser.py index e2abbc26e4ce84..0d1bfb8d869e49 100755 --- a/scripts/py_matter_idl/matter_idl/matter_idl_parser.py +++ b/scripts/py_matter_idl/matter_idl/matter_idl_parser.py @@ -491,17 +491,17 @@ def cluster(self, meta, api_maturity, side, name, code, *content): code=code, api_maturity=api_maturity) for item in content: - if type(item) == Enum: + if isinstance(item, Enum): result.enums.append(item) - elif type(item) == Bitmap: + elif isinstance(item, Bitmap): result.bitmaps.append(item) - elif type(item) == Event: + elif isinstance(item, Event): result.events.append(item) - elif type(item) == Attribute: + elif isinstance(item, Attribute): result.attributes.append(item) - elif type(item) == Struct: + elif isinstance(item, Struct): result.structs.append(item) - elif type(item) == Command: + elif isinstance(item, Command): result.commands.append(item) else: raise Exception("UNKNOWN cluster content item: %r" % item) @@ -513,9 +513,9 @@ def idl(self, items): endpoints = [] for item in items: - if type(item) == Cluster: + if isinstance(item, Cluster): clusters.append(item) - elif type(item) == Endpoint: + elif isinstance(item, Endpoint): endpoints.append(item) else: raise Exception("UNKNOWN idl content item: %r" % item) diff --git a/scripts/setup/zap.json b/scripts/setup/zap.json index 6441453d10d724..f3869514ca7356 100644 --- a/scripts/setup/zap.json +++ b/scripts/setup/zap.json @@ -8,13 +8,13 @@ "mac-amd64", "windows-amd64" ], - "tags": ["version:2@v2023.10.09-nightly.1"] + "tags": ["version:2@v2023.10.14-nightly.1"] }, { "_comment": "Always get the amd64 version on mac until usable arm64 zap build is available", "path": "fuchsia/third_party/zap/mac-amd64", "platforms": ["mac-arm64"], - "tags": ["version:2@v2023.10.09-nightly.1"] + "tags": ["version:2@v2023.10.14-nightly.1"] } ] } diff --git a/scripts/setup/zap.version b/scripts/setup/zap.version index 62285c8a118cb4..443586d7cdbe6c 100644 --- a/scripts/setup/zap.version +++ b/scripts/setup/zap.version @@ -1 +1 @@ -v2023.10.09-nightly +v2023.10.14-nightly diff --git a/scripts/tools/check_includes_config.py b/scripts/tools/check_includes_config.py index ae06b487cbaba8..bfd7f15c5ccf17 100644 --- a/scripts/tools/check_includes_config.py +++ b/scripts/tools/check_includes_config.py @@ -162,5 +162,6 @@ # Not intended for embedded clients 'src/lib/support/jsontlv/JsonToTlv.cpp': {'sstream'}, 'src/lib/support/jsontlv/JsonToTlv.h': {'string'}, - 'src/lib/support/jsontlv/TlvToJson.h': {'string'} + 'src/lib/support/jsontlv/TlvToJson.h': {'string'}, + 'src/lib/support/jsontlv/TextFormat.h': {'string'} } diff --git a/scripts/tools/memory/memdf/util/nd.py b/scripts/tools/memory/memdf/util/nd.py index 3cfb99e62165eb..7cc8331d79ca12 100644 --- a/scripts/tools/memory/memdf/util/nd.py +++ b/scripts/tools/memory/memdf/util/nd.py @@ -73,7 +73,7 @@ def update(nd: MutableMapping, src: Mapping) -> None: nd[k] += v else: nd[k].append(v) - elif type(nd[k]) == type(v): + elif type(nd[k]) is type(v): nd[k] = v else: raise TypeError(f"type mismatch {k},{v} was {nd[k]}") diff --git a/scripts/tools/zap/zap_execution.py b/scripts/tools/zap/zap_execution.py index 2f6098a3184d2e..3bf36e7d40a33f 100644 --- a/scripts/tools/zap/zap_execution.py +++ b/scripts/tools/zap/zap_execution.py @@ -23,7 +23,7 @@ # Use scripts/tools/zap/version_update.py to manage ZAP versioning as many # files may need updating for versions # -MIN_ZAP_VERSION = '2023.10.9' +MIN_ZAP_VERSION = '2023.10.14' class ZapTool: diff --git a/src/app/app-platform/ContentAppPlatform.cpp b/src/app/app-platform/ContentAppPlatform.cpp index d162ec4bbab7ad..4162693b19508f 100644 --- a/src/app/app-platform/ContentAppPlatform.cpp +++ b/src/app/app-platform/ContentAppPlatform.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -31,7 +32,6 @@ #include #include #include -#include #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED @@ -684,7 +684,7 @@ CHIP_ERROR ContentAppPlatform::ManageClientAccess(Messaging::ExchangeManager & e ChipLogProgress(Controller, "Attempting to update Binding list"); BindingListType bindingList(bindings.data(), bindings.size()); - chip::Controller::BindingCluster cluster(exchangeMgr, sessionHandle, kTargetBindingClusterEndpointId); + Controller::ClusterBase cluster(exchangeMgr, sessionHandle, kTargetBindingClusterEndpointId); ReturnErrorOnFailure( cluster.WriteAttribute(bindingList, nullptr, successCb, failureCb)); diff --git a/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp b/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp index fa56ab0fd571a9..5f02c4df3f3dd5 100644 --- a/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp +++ b/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp @@ -22,12 +22,12 @@ #include #include +#include #include #include #include #include #include -#include #include "BDXDownloader.h" #include "DefaultOTARequestor.h" @@ -765,7 +765,7 @@ CHIP_ERROR DefaultOTARequestor::SendQueryImageRequest(Messaging::ExchangeManager } args.metadataForProvider = mMetadataForProvider; - Controller::OtaSoftwareUpdateProviderCluster cluster(exchangeMgr, sessionHandle, mProviderLocation.Value().endpoint); + Controller::ClusterBase cluster(exchangeMgr, sessionHandle, mProviderLocation.Value().endpoint); return cluster.InvokeCommand(args, this, OnQueryImageResponse, OnQueryImageFailure); } @@ -839,7 +839,7 @@ CHIP_ERROR DefaultOTARequestor::SendApplyUpdateRequest(Messaging::ExchangeManage args.updateToken = mUpdateToken; args.newVersion = mTargetVersion; - Controller::OtaSoftwareUpdateProviderCluster cluster(exchangeMgr, sessionHandle, mProviderLocation.Value().endpoint); + Controller::ClusterBase cluster(exchangeMgr, sessionHandle, mProviderLocation.Value().endpoint); return cluster.InvokeCommand(args, this, OnApplyUpdateResponse, OnApplyUpdateFailure); } @@ -854,7 +854,7 @@ CHIP_ERROR DefaultOTARequestor::SendNotifyUpdateAppliedRequest(Messaging::Exchan args.updateToken = mUpdateToken; args.softwareVersion = mCurrentVersion; - Controller::OtaSoftwareUpdateProviderCluster cluster(exchangeMgr, sessionHandle, mProviderLocation.Value().endpoint); + Controller::ClusterBase cluster(exchangeMgr, sessionHandle, mProviderLocation.Value().endpoint); // There is no response for a notify so consider this OTA complete. Clear the provider location and reset any states to indicate // so. diff --git a/src/controller/java/AndroidCallbacks.cpp b/src/controller/java/AndroidCallbacks.cpp index 69e5a0b68ad304..93344a5e1bc7eb 100644 --- a/src/controller/java/AndroidCallbacks.cpp +++ b/src/controller/java/AndroidCallbacks.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -41,130 +40,67 @@ static const int MILLIS_SINCE_EPOCH = 1; // Add the bytes for attribute tag(1:control + 8:tag + 8:length) and structure(1:struct + 1:close container) static const int EXTRA_SPACE_FOR_ATTRIBUTE_TAG = 19; -class JniChipAttributePath +CHIP_ERROR CreateChipAttributePath(JNIEnv * env, const app::ConcreteDataAttributePath & aPath, jobject & outObj) { -public: - JniChipAttributePath(JNIEnv * env, const app::ConcreteDataAttributePath & aPath) : mEnv(env) - { - jclass attributePathCls = nullptr; - ReturnOnFailure(mError = JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/model/ChipAttributePath", - attributePathCls)); - JniObject attributePathJniCls(env, static_cast(attributePathCls)); - - jmethodID attributePathCtor = - env->GetStaticMethodID(attributePathCls, "newInstance", "(IJJ)Lchip/devicecontroller/model/ChipAttributePath;"); - VerifyOrReturn(attributePathCtor != nullptr, mError = CHIP_JNI_ERROR_METHOD_NOT_FOUND); - jobject localRef = - env->CallStaticObjectMethod(attributePathCls, attributePathCtor, static_cast(aPath.mEndpointId), - static_cast(aPath.mClusterId), static_cast(aPath.mAttributeId)); - VerifyOrReturn(localRef != nullptr, mError = CHIP_JNI_ERROR_NULL_OBJECT); - mData = env->NewGlobalRef(localRef); - VerifyOrReturn(mData != nullptr, mError = CHIP_JNI_ERROR_NULL_OBJECT); - return; - } - - ~JniChipAttributePath() - { - if (mEnv != nullptr && mData != nullptr) - { - mEnv->DeleteGlobalRef(mData); - mData = nullptr; - } - } - - CHIP_ERROR GetError() { return mError; } - jobject GetData() { return mData; } - -private: - JNIEnv * mEnv = nullptr; - jobject mData = nullptr; - CHIP_ERROR mError = CHIP_NO_ERROR; -}; + jclass attributePathCls = nullptr; + ReturnErrorOnFailure( + JniReferences::GetInstance().GetLocalClassRef(env, "chip/devicecontroller/model/ChipAttributePath", attributePathCls)); + jmethodID attributePathCtor = + env->GetStaticMethodID(attributePathCls, "newInstance", "(IJJ)Lchip/devicecontroller/model/ChipAttributePath;"); + VerifyOrReturnError(attributePathCtor != nullptr, CHIP_JNI_ERROR_METHOD_NOT_FOUND); + outObj = env->CallStaticObjectMethod(attributePathCls, attributePathCtor, static_cast(aPath.mEndpointId), + static_cast(aPath.mClusterId), static_cast(aPath.mAttributeId)); + VerifyOrReturnError(outObj != nullptr, CHIP_JNI_ERROR_NULL_OBJECT); + return CHIP_NO_ERROR; +} -class JniChipEventPath +CHIP_ERROR ReportCallback::CreateChipEventPath(JNIEnv * env, const app::ConcreteEventPath & aPath, jobject & outObj) { -public: - JniChipEventPath(JNIEnv * env, const app::ConcreteEventPath & aPath) : mEnv(env) - { - jclass eventPathCls = nullptr; - ReturnOnFailure( - mError = JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/model/ChipEventPath", eventPathCls)); - JniObject eventPathJniCls(env, static_cast(eventPathCls)); - - jmethodID eventPathCtor = - env->GetStaticMethodID(eventPathCls, "newInstance", "(IJJ)Lchip/devicecontroller/model/ChipEventPath;"); - VerifyOrReturn(eventPathCtor != nullptr, mError = CHIP_JNI_ERROR_METHOD_NOT_FOUND); - - jobject localRef = env->CallStaticObjectMethod(eventPathCls, eventPathCtor, static_cast(aPath.mEndpointId), - static_cast(aPath.mClusterId), static_cast(aPath.mEventId)); - VerifyOrReturn(localRef != nullptr, mError = CHIP_JNI_ERROR_NULL_OBJECT); - mData = (jclass) env->NewGlobalRef(localRef); - VerifyOrReturn(mData != nullptr, mError = CHIP_JNI_ERROR_NULL_OBJECT); - return; - } - - ~JniChipEventPath() - { - if (mEnv != nullptr && mData != nullptr) - { - mEnv->DeleteGlobalRef(mData); - mData = nullptr; - } - } + jclass eventPathCls = nullptr; + ReturnErrorOnFailure( + JniReferences::GetInstance().GetLocalClassRef(env, "chip/devicecontroller/model/ChipEventPath", eventPathCls)); - CHIP_ERROR GetError() { return mError; } - jobject GetData() { return mData; } + jmethodID eventPathCtor = + env->GetStaticMethodID(eventPathCls, "newInstance", "(IJJ)Lchip/devicecontroller/model/ChipEventPath;"); + VerifyOrReturnError(eventPathCtor != nullptr, CHIP_JNI_ERROR_METHOD_NOT_FOUND); -private: - JNIEnv * mEnv = nullptr; - jobject mData = nullptr; - CHIP_ERROR mError = CHIP_NO_ERROR; -}; + outObj = env->CallStaticObjectMethod(eventPathCls, eventPathCtor, static_cast(aPath.mEndpointId), + static_cast(aPath.mClusterId), static_cast(aPath.mEventId)); + VerifyOrReturnError(outObj != nullptr, CHIP_JNI_ERROR_NULL_OBJECT); + return CHIP_NO_ERROR; +} GetConnectedDeviceCallback::GetConnectedDeviceCallback(jobject wrapperCallback, jobject javaCallback) : mOnSuccess(OnDeviceConnectedFn, this), mOnFailure(OnDeviceConnectionFailureFn, this) { - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - mWrapperCallbackRef = env->NewGlobalRef(wrapperCallback); - if (mWrapperCallbackRef == nullptr) - { - ChipLogError(Controller, "Could not create global reference for Java callback"); - } - mJavaCallbackRef = env->NewGlobalRef(javaCallback); - if (mJavaCallbackRef == nullptr) - { - ChipLogError(Controller, "Could not create global reference for Java callback"); - } + VerifyOrReturn(mWrapperCallbackRef.Init(wrapperCallback) == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not init mWrapperCallbackRef in %s", __func__)); + VerifyOrReturn(mJavaCallbackRef.Init(javaCallback) == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not init mJavaCallbackRef in %s", __func__)); } -GetConnectedDeviceCallback::~GetConnectedDeviceCallback() -{ - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - if (mJavaCallbackRef != nullptr) - { - env->DeleteGlobalRef(mJavaCallbackRef); - } -} +GetConnectedDeviceCallback::~GetConnectedDeviceCallback() {} void GetConnectedDeviceCallback::OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - auto * self = static_cast(context); - jobject javaCallback = self->mJavaCallbackRef; + auto * self = static_cast(context); + VerifyOrReturn(self->mJavaCallbackRef.HasValidObjectRef(), + ChipLogError(Controller, "mJavaCallbackRef is not valid in %s", __func__)); + jobject javaCallback = self->mJavaCallbackRef.ObjectRef(); JniLocalReferenceManager manager(env); - // Release global ref so application can clean up. - env->DeleteGlobalRef(self->mWrapperCallbackRef); + // Release wrapper's global ref so application can clean up the actual callback underneath. + VerifyOrReturn(self->mWrapperCallbackRef.HasValidObjectRef(), + ChipLogError(Controller, "mWrapperCallbackRef is not valid in %s", __func__)); + JniGlobalReference globalRef(std::move(self->mWrapperCallbackRef)); jclass getConnectedDeviceCallbackCls = nullptr; - JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/GetConnectedDeviceCallbackJni$GetConnectedDeviceCallback", - getConnectedDeviceCallbackCls); + JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/GetConnectedDeviceCallbackJni$GetConnectedDeviceCallback", getConnectedDeviceCallbackCls); VerifyOrReturn(getConnectedDeviceCallbackCls != nullptr, ChipLogError(Controller, "Could not find GetConnectedDeviceCallback class")); - JniObject getConnectedDeviceCallbackJniCls(env, static_cast(getConnectedDeviceCallbackCls)); jmethodID successMethod; JniReferences::GetInstance().FindMethod(env, javaCallback, "onDeviceConnected", "(J)V", &successMethod); @@ -182,16 +118,17 @@ void GetConnectedDeviceCallback::OnDeviceConnectionFailureFn(void * context, con { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - auto * self = static_cast(context); - jobject javaCallback = self->mJavaCallbackRef; + auto * self = static_cast(context); + VerifyOrReturn(self->mJavaCallbackRef.HasValidObjectRef(), + ChipLogError(Controller, "mJavaCallbackRef is not valid in %s", __func__)); + jobject javaCallback = self->mJavaCallbackRef.ObjectRef(); JniLocalReferenceManager manager(env); jclass getConnectedDeviceCallbackCls = nullptr; - JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/GetConnectedDeviceCallbackJni$GetConnectedDeviceCallback", - getConnectedDeviceCallbackCls); + JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/GetConnectedDeviceCallbackJni$GetConnectedDeviceCallback", getConnectedDeviceCallbackCls); VerifyOrReturn(getConnectedDeviceCallbackCls != nullptr, ChipLogError(Controller, "Could not find GetConnectedDeviceCallback class")); - JniObject getConnectedDeviceCallbackJniCls(env, static_cast(getConnectedDeviceCallbackCls)); jmethodID failureMethod; JniReferences::GetInstance().FindMethod(env, javaCallback, "onConnectionFailure", "(JLjava/lang/Exception;)V", &failureMethod); @@ -205,7 +142,6 @@ void GetConnectedDeviceCallback::OnDeviceConnectionFailureFn(void * context, con ChipLogError(Controller, "Unable to create AndroidControllerException on GetConnectedDeviceCallback::OnDeviceConnectionFailureFn: %s", ErrorStr(err))); - JniObject exceptionJniCls(env, static_cast(exception)); DeviceLayer::StackUnlock unlock; env->CallVoidMethod(javaCallback, failureMethod, peerId.GetNodeId(), exception); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); @@ -219,54 +155,24 @@ ReportCallback::ReportCallback(jobject wrapperCallback, jobject subscriptionEsta VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); if (subscriptionEstablishedCallback != nullptr) { - mSubscriptionEstablishedCallbackRef = env->NewGlobalRef(subscriptionEstablishedCallback); - if (mSubscriptionEstablishedCallbackRef == nullptr) - { - ChipLogError(Controller, "Could not create global reference for Java callback"); - } - } - mReportCallbackRef = env->NewGlobalRef(reportCallback); - if (mReportCallbackRef == nullptr) - { - ChipLogError(Controller, "Could not create global reference for Java callback"); - } - mWrapperCallbackRef = env->NewGlobalRef(wrapperCallback); - if (mWrapperCallbackRef == nullptr) - { - ChipLogError(Controller, "Could not create global reference for Java callback"); + VerifyOrReturn(mSubscriptionEstablishedCallbackRef.Init(subscriptionEstablishedCallback) == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not init mSubscriptionEstablishedCallbackRef in %s", __func__)); } + + VerifyOrReturn(mReportCallbackRef.Init(reportCallback) == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not init mReportCallbackRef in %s", __func__)); + VerifyOrReturn(mWrapperCallbackRef.Init(wrapperCallback) == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not init mWrapperCallbackRef in %s", __func__)); + if (resubscriptionAttemptCallback != nullptr) { - mResubscriptionAttemptCallbackRef = env->NewGlobalRef(resubscriptionAttemptCallback); - if (mResubscriptionAttemptCallbackRef == nullptr) - { - ChipLogError(Controller, "Could not create global reference for Java callback"); - } + VerifyOrReturn(mResubscriptionAttemptCallbackRef.Init(resubscriptionAttemptCallback) == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not init mResubscriptionAttemptCallbackRef in %s", __func__)); } } ReportCallback::~ReportCallback() { - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - if (mSubscriptionEstablishedCallbackRef != nullptr) - { - env->DeleteGlobalRef(mSubscriptionEstablishedCallbackRef); - mSubscriptionEstablishedCallbackRef = nullptr; - } - - if (mReportCallbackRef != nullptr) - { - env->DeleteGlobalRef(mReportCallbackRef); - mReportCallbackRef = nullptr; - } - - if (mResubscriptionAttemptCallbackRef != nullptr) - { - env->DeleteGlobalRef(mResubscriptionAttemptCallbackRef); - mResubscriptionAttemptCallbackRef = nullptr; - } - if (mReadClient != nullptr) { Platform::Delete(mReadClient); @@ -279,14 +185,14 @@ void ReportCallback::OnReportBegin() VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); JniLocalReferenceManager manager(env); jclass nodeStateCls = nullptr; - CHIP_ERROR err = JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/model/NodeState", nodeStateCls); + CHIP_ERROR err = JniReferences::GetInstance().GetLocalClassRef(env, "chip/devicecontroller/model/NodeState", nodeStateCls); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Could not get NodeState class")); jmethodID nodeStateCtor = env->GetMethodID(nodeStateCls, "", "()V"); VerifyOrReturn(nodeStateCtor != nullptr, ChipLogError(Controller, "Could not find NodeState constructor")); jobject nodeState = env->NewObject(nodeStateCls, nodeStateCtor); VerifyOrReturn(nodeState != nullptr, ChipLogError(Controller, "Could not create local object for nodeState")); - mNodeStateObj = env->NewGlobalRef(nodeState); - VerifyOrReturn(mNodeStateObj != nullptr, ChipLogError(Controller, "Could not create glboal reference for mNodeStateObj")); + VerifyOrReturn(mNodeStateObj.Init(nodeState) == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not init mNodeStateObj in %s", __func__)); } void ReportCallback::OnDeallocatePaths(app::ReadPrepareParams && aReadPrepareParams) @@ -311,17 +217,17 @@ void ReportCallback::OnReportEnd() JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); JniLocalReferenceManager manager(env); - - jobject nodeStateObj = env->NewLocalRef(mNodeStateObj); - env->DeleteGlobalRef(mNodeStateObj); - VerifyOrReturn(nodeStateObj != nullptr, ChipLogError(Controller, "Could not create local reference for nodeStateObj")); + VerifyOrReturn(mReportCallbackRef.HasValidObjectRef(), + ChipLogError(Controller, "mReportCallbackRef is not valid in %s", __func__)); + jobject reportCallback = mReportCallbackRef.ObjectRef(); + JniGlobalReference globalRef(std::move(mNodeStateObj)); jmethodID onReportMethod; - err = JniReferences::GetInstance().FindMethod(env, mReportCallbackRef, "onReport", "(Lchip/devicecontroller/model/NodeState;)V", + err = JniReferences::GetInstance().FindMethod(env, reportCallback, "onReport", "(Lchip/devicecontroller/model/NodeState;)V", &onReportMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find onReport method")); DeviceLayer::StackUnlock unlock; - env->CallVoidMethod(mReportCallbackRef, onReportMethod, nodeStateObj); + env->CallVoidMethod(reportCallback, onReportMethod, globalRef.ObjectRef()); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); } @@ -358,25 +264,26 @@ void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPat JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); JniLocalReferenceManager manager(env); - JniChipAttributePath attributePathObj(env, aPath); - VerifyOrReturn(attributePathObj.GetError() == CHIP_NO_ERROR, - ChipLogError(Controller, "Unable to create Java ChipAttributePath: %s", ErrorStr(err))); + + jobject attributePathObj = nullptr; + err = CreateChipAttributePath(env, aPath, attributePathObj); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to create Java ChipAttributePath: %s", ErrorStr(err))); if (aPath.IsListItemOperation()) { - ReportError(attributePathObj.GetData(), nullptr, CHIP_ERROR_INCORRECT_STATE); + ReportError(attributePathObj, nullptr, CHIP_ERROR_INCORRECT_STATE); return; } if (aStatus.mStatus != Protocols::InteractionModel::Status::Success) { - ReportError(attributePathObj.GetData(), nullptr, aStatus.mStatus); + ReportError(attributePathObj, nullptr, aStatus.mStatus); return; } if (apData == nullptr) { - ReportError(attributePathObj.GetData(), nullptr, CHIP_ERROR_INVALID_ARGUMENT); + ReportError(attributePathObj, nullptr, CHIP_ERROR_INVALID_ARGUMENT); return; } @@ -395,9 +302,9 @@ void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPat err = CHIP_NO_ERROR; } - VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(attributePathObj.GetData(), nullptr, err)); + VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(attributePathObj, nullptr, err)); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe(), - ReportError(attributePathObj.GetData(), nullptr, CHIP_JNI_ERROR_EXCEPTION_THROWN)); + ReportError(attributePathObj, nullptr, CHIP_JNI_ERROR_EXCEPTION_THROWN)); #endif // Create TLV byte array to pass to Java layer size_t bufferLen = readerForJavaTLV.GetRemainingLength() + readerForJavaTLV.GetLengthRead(); @@ -410,35 +317,35 @@ void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPat TLV::TLVWriter writer; writer.Init(buffer.get(), bufferLen); err = writer.CopyElement(TLV::AnonymousTag(), readerForJavaTLV); - VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(attributePathObj.GetData(), nullptr, err)); + VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(attributePathObj, nullptr, err)); size = writer.GetLengthWritten(); chip::ByteArray jniByteArray(env, reinterpret_cast(buffer.get()), size); // Convert TLV to JSON std::string json; err = ConvertReportTlvToJson(static_cast(aPath.mAttributeId), *apData, json); - VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(attributePathObj.GetData(), nullptr, err)); + VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(attributePathObj, nullptr, err)); UtfString jsonString(env, json.c_str()); // Create AttributeState object jclass attributeStateCls; - err = JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/model/AttributeState", attributeStateCls); + err = JniReferences::GetInstance().GetLocalClassRef(env, "chip/devicecontroller/model/AttributeState", attributeStateCls); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find AttributeState class")); VerifyOrReturn(attributeStateCls != nullptr, ChipLogError(Controller, "Could not find AttributeState class")); - JniObject attributeStateJniCls(env, static_cast(attributeStateCls)); jmethodID attributeStateCtor = env->GetMethodID(attributeStateCls, "", "(Ljava/lang/Object;[BLjava/lang/String;)V"); VerifyOrReturn(attributeStateCtor != nullptr, ChipLogError(Controller, "Could not find AttributeState constructor")); jobject attributeStateObj = env->NewObject(attributeStateCls, attributeStateCtor, value, jniByteArray.jniValue(), jsonString.jniValue()); VerifyOrReturn(attributeStateObj != nullptr, ChipLogError(Controller, "Could not create AttributeState object")); + jobject nodeState = mNodeStateObj.ObjectRef(); // Add AttributeState to NodeState jmethodID addAttributeMethod; - err = JniReferences::GetInstance().FindMethod(env, mNodeStateObj, "addAttribute", + err = JniReferences::GetInstance().FindMethod(env, nodeState, "addAttribute", "(IJJLchip/devicecontroller/model/AttributeState;)V", &addAttributeMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find addAttribute method")); - env->CallVoidMethod(mNodeStateObj, addAttributeMethod, static_cast(aPath.mEndpointId), - static_cast(aPath.mClusterId), static_cast(aPath.mAttributeId), attributeStateObj); + env->CallVoidMethod(nodeState, addAttributeMethod, static_cast(aPath.mEndpointId), static_cast(aPath.mClusterId), + static_cast(aPath.mAttributeId), attributeStateObj); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); UpdateClusterDataVersion(); @@ -470,11 +377,13 @@ void ReportCallback::UpdateClusterDataVersion() return; } + jobject nodeState = mNodeStateObj.ObjectRef(); + // SetDataVersion to NodeState jmethodID setDataVersionMethod; - CHIP_ERROR err = JniReferences::GetInstance().FindMethod(env, mNodeStateObj, "setDataVersion", "(IJJ)V", &setDataVersionMethod); + CHIP_ERROR err = JniReferences::GetInstance().FindMethod(env, nodeState, "setDataVersion", "(IJJ)V", &setDataVersionMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find setDataVersion method")); - env->CallVoidMethod(mNodeStateObj, setDataVersionMethod, static_cast(lastConcreteClusterPath.mEndpointId), + env->CallVoidMethod(nodeState, setDataVersionMethod, static_cast(lastConcreteClusterPath.mEndpointId), static_cast(lastConcreteClusterPath.mClusterId), static_cast(committedDataVersion.Value())); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); } @@ -484,13 +393,13 @@ void ReportCallback::OnEventData(const app::EventHeader & aEventHeader, TLV::TLV CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - JniChipEventPath eventPathObj(env, aEventHeader.mPath); - VerifyOrReturn(eventPathObj.GetError() == CHIP_NO_ERROR, - ChipLogError(Controller, "Unable to create Java ChipEventPath: %s", ErrorStr(err))); + jobject eventPathObj = nullptr; + err = CreateChipEventPath(env, aEventHeader.mPath, eventPathObj); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to create Java ChipEventPath: %s", ErrorStr(err))); if (apData == nullptr) { - ReportError(nullptr, eventPathObj.GetData(), CHIP_ERROR_INVALID_ARGUMENT); + ReportError(nullptr, eventPathObj, CHIP_ERROR_INVALID_ARGUMENT); return; } @@ -513,7 +422,7 @@ void ReportCallback::OnEventData(const app::EventHeader & aEventHeader, TLV::TLV else { ChipLogError(Controller, "Unsupported event timestamp type"); - ReportError(nullptr, eventPathObj.GetData(), CHIP_ERROR_INVALID_ARGUMENT); + ReportError(nullptr, eventPathObj, CHIP_ERROR_INVALID_ARGUMENT); return; } @@ -527,9 +436,9 @@ void ReportCallback::OnEventData(const app::EventHeader & aEventHeader, TLV::TLV { err = CHIP_NO_ERROR; } - VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(nullptr, eventPathObj.GetData(), err)); + VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(nullptr, eventPathObj, err)); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe(), - ReportError(nullptr, eventPathObj.GetData(), CHIP_JNI_ERROR_EXCEPTION_THROWN)); + ReportError(nullptr, eventPathObj, CHIP_JNI_ERROR_EXCEPTION_THROWN)); #endif // Create TLV byte array to pass to Java layer @@ -542,22 +451,21 @@ void ReportCallback::OnEventData(const app::EventHeader & aEventHeader, TLV::TLV TLV::TLVWriter writer; writer.Init(buffer.get(), bufferLen); err = writer.CopyElement(TLV::AnonymousTag(), readerForJavaTLV); - VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(nullptr, eventPathObj.GetData(), err)); + VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(nullptr, eventPathObj, err)); size = writer.GetLengthWritten(); chip::ByteArray jniByteArray(env, reinterpret_cast(buffer.get()), size); // Convert TLV to JSON std::string json; err = ConvertReportTlvToJson(static_cast(aEventHeader.mPath.mEventId), *apData, json); - VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(eventPathObj.GetData(), nullptr, err)); + VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(eventPathObj, nullptr, err)); UtfString jsonString(env, json.c_str()); // Create EventState object jclass eventStateCls; - err = JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/model/EventState", eventStateCls); + err = JniReferences::GetInstance().GetLocalClassRef(env, "chip/devicecontroller/model/EventState", eventStateCls); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Failed to find EventState class")); VerifyOrReturn(eventStateCls != nullptr, ChipLogError(Controller, "Could not find EventState class")); - JniObject eventStateJniCls(env, static_cast(eventStateCls)); jmethodID eventStateCtor = env->GetMethodID(eventStateCls, "", "(JIIJLjava/lang/Object;[BLjava/lang/String;)V"); VerifyOrReturn(eventStateCtor != nullptr, ChipLogError(Controller, "Could not find EventState constructor")); jobject eventStateObj = env->NewObject(eventStateCls, eventStateCtor, eventNumber, priorityLevel, timestampType, timestampValue, @@ -566,10 +474,11 @@ void ReportCallback::OnEventData(const app::EventHeader & aEventHeader, TLV::TLV // Add EventState to NodeState jmethodID addEventMethod; - err = JniReferences::GetInstance().FindMethod(env, mNodeStateObj, "addEvent", "(IJJLchip/devicecontroller/model/EventState;)V", + jobject nodeState = mNodeStateObj.ObjectRef(); + err = JniReferences::GetInstance().FindMethod(env, nodeState, "addEvent", "(IJJLchip/devicecontroller/model/EventState;)V", &addEventMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find addEvent method")); - env->CallVoidMethod(mNodeStateObj, addEventMethod, static_cast(aEventHeader.mPath.mEndpointId), + env->CallVoidMethod(nodeState, addEventMethod, static_cast(aEventHeader.mPath.mEndpointId), static_cast(aEventHeader.mPath.mClusterId), static_cast(aEventHeader.mPath.mEventId), eventStateObj); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); @@ -581,9 +490,8 @@ CHIP_ERROR InvokeCallback::CreateInvokeElement(JNIEnv * env, const app::Concrete CHIP_ERROR err = CHIP_NO_ERROR; jclass invokeElementCls = nullptr; jobject localRef = nullptr; - err = JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/model/InvokeElement", invokeElementCls); + err = JniReferences::GetInstance().GetLocalClassRef(env, "chip/devicecontroller/model/InvokeElement", invokeElementCls); ReturnErrorOnFailure(err); - JniObject invokeElementJniCls(env, static_cast(invokeElementCls)); jmethodID invokeElementCtor = env->GetStaticMethodID(invokeElementCls, "newInstance", "(IJJ[BLjava/lang/String;)Lchip/devicecontroller/model/InvokeElement;"); @@ -643,9 +551,15 @@ void ReportCallback::OnDone(app::ReadClient *) CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - + JniLocalReferenceManager manager(env); + VerifyOrReturn(mWrapperCallbackRef.HasValidObjectRef(), + ChipLogError(Controller, "mWrapperCallbackRef is not valid in %s", __func__)); + JniGlobalReference globalRef(std::move(mWrapperCallbackRef)); jmethodID onDoneMethod; - err = JniReferences::GetInstance().FindMethod(env, mReportCallbackRef, "onDone", "()V", &onDoneMethod); + VerifyOrReturn(mReportCallbackRef.HasValidObjectRef(), + ChipLogError(Controller, "mReportCallbackRef is not valid in %s", __func__)); + jobject reportCallback = mReportCallbackRef.ObjectRef(); + err = JniReferences::GetInstance().FindMethod(env, reportCallback, "onDone", "()V", &onDoneMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find onDone method")); if (mReadClient != nullptr) @@ -655,13 +569,8 @@ void ReportCallback::OnDone(app::ReadClient *) mReadClient = nullptr; DeviceLayer::StackUnlock unlock; - env->CallVoidMethod(mReportCallbackRef, onDoneMethod); + env->CallVoidMethod(reportCallback, onDoneMethod); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); - if (mWrapperCallbackRef != nullptr) - { - env->DeleteGlobalRef(mWrapperCallbackRef); - mWrapperCallbackRef = nullptr; - } } void ReportCallback::OnSubscriptionEstablished(SubscriptionId aSubscriptionId) @@ -670,23 +579,25 @@ void ReportCallback::OnSubscriptionEstablished(SubscriptionId aSubscriptionId) VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); JniLocalReferenceManager manager(env); DeviceLayer::StackUnlock unlock; - JniReferences::GetInstance().CallSubscriptionEstablished(mSubscriptionEstablishedCallbackRef, aSubscriptionId); + VerifyOrReturn(mSubscriptionEstablishedCallbackRef.HasValidObjectRef(), + ChipLogError(Controller, " mSubscriptionEstablishedCallbackRef is not valid in %s", __func__)); + JniReferences::GetInstance().CallSubscriptionEstablished(mSubscriptionEstablishedCallbackRef.ObjectRef(), aSubscriptionId); } CHIP_ERROR ReportCallback::OnResubscriptionNeeded(app::ReadClient * apReadClient, CHIP_ERROR aTerminationCause) { - VerifyOrReturnLogError(mResubscriptionAttemptCallbackRef != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturnError(env != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT); ReturnErrorOnFailure(app::ReadClient::Callback::OnResubscriptionNeeded(apReadClient, aTerminationCause)); JniLocalReferenceManager manager(env); jmethodID onResubscriptionAttemptMethod; + VerifyOrReturnLogError(mResubscriptionAttemptCallbackRef.HasValidObjectRef(), CHIP_ERROR_INCORRECT_STATE); + jobject resubscriptionAttemptCallbackRef = mResubscriptionAttemptCallbackRef.ObjectRef(); ReturnLogErrorOnFailure(JniReferences::GetInstance().FindMethod( - env, mResubscriptionAttemptCallbackRef, "onResubscriptionAttempt", "(JJ)V", &onResubscriptionAttemptMethod)); + env, resubscriptionAttemptCallbackRef, "onResubscriptionAttempt", "(JJ)V", &onResubscriptionAttemptMethod)); DeviceLayer::StackUnlock unlock; - env->CallVoidMethod(mResubscriptionAttemptCallbackRef, onResubscriptionAttemptMethod, + env->CallVoidMethod(resubscriptionAttemptCallbackRef, onResubscriptionAttemptMethod, static_cast(aTerminationCause.AsInteger()), static_cast(apReadClient->ComputeTimeTillNextSubscription())); VerifyOrReturnError(!env->ExceptionCheck(), CHIP_JNI_ERROR_EXCEPTION_THROWN); @@ -710,55 +621,36 @@ void ReportCallback::ReportError(jobject attributePath, jobject eventPath, const JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); JniLocalReferenceManager manager(env); - ChipLogError(Controller, "ReportCallback::ReportError is called with %u", errorCode); + VerifyOrReturn(mReportCallbackRef.HasValidObjectRef(), + ChipLogError(Controller, "mReportCallbackRef is not valid in %s", __func__)); + jobject reportCallback = mReportCallbackRef.ObjectRef(); jthrowable exception; err = AndroidControllerExceptions::GetInstance().CreateAndroidControllerException(env, message, errorCode, exception); VerifyOrReturn( err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to create AndroidControllerException on ReportCallback::ReportError: %s", ErrorStr(err))); - JniObject exceptionJniCls(env, static_cast(exception)); jmethodID onErrorMethod; err = JniReferences::GetInstance().FindMethod( - env, mReportCallbackRef, "onError", + env, reportCallback, "onError", "(Lchip/devicecontroller/model/ChipAttributePath;Lchip/devicecontroller/model/ChipEventPath;Ljava/lang/Exception;)V", &onErrorMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to find onError method: %s", ErrorStr(err))); DeviceLayer::StackUnlock unlock; - env->CallVoidMethod(mReportCallbackRef, onErrorMethod, attributePath, eventPath, exception); + env->CallVoidMethod(reportCallback, onErrorMethod, attributePath, eventPath, exception); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); } WriteAttributesCallback::WriteAttributesCallback(jobject wrapperCallback, jobject javaCallback) : mChunkedWriteCallback(this) { - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - - mWrapperCallbackRef = env->NewGlobalRef(wrapperCallback); - VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); - if (mWrapperCallbackRef == nullptr) - { - ChipLogError(Controller, "Could not create global reference for Wrapper WriteAttributesCallback"); - return; - } - mJavaCallbackRef = env->NewGlobalRef(javaCallback); - VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); - if (mJavaCallbackRef == nullptr) - { - ChipLogError(Controller, "Could not create global reference for Java WriteAttributesCallback"); - } + VerifyOrReturn(mWrapperCallbackRef.Init(wrapperCallback) == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not init mWrapperCallbackRef for WriteAttributesCallback")); + VerifyOrReturn(mJavaCallbackRef.Init(javaCallback) == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not init mJavaCallbackRef in %s", __func__)); } WriteAttributesCallback::~WriteAttributesCallback() { - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - if (mJavaCallbackRef != nullptr) - { - env->DeleteGlobalRef(mJavaCallbackRef); - mJavaCallbackRef = nullptr; - } - if (mWriteClient != nullptr) { Platform::Delete(mWriteClient); @@ -772,23 +664,26 @@ void WriteAttributesCallback::OnResponse(const app::WriteClient * apWriteClient, JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); JniLocalReferenceManager manager(env); - JniChipAttributePath attributePathObj(env, aPath); - VerifyOrReturn(attributePathObj.GetError() == CHIP_NO_ERROR, - ChipLogError(Controller, "Unable to create Java ChipAttributePath: %s", ErrorStr(err))); + + jobject attributePathObj = nullptr; + err = CreateChipAttributePath(env, aPath, attributePathObj); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to create Java ChipAttributePath: %s", ErrorStr(err))); if (aStatus.mStatus != Protocols::InteractionModel::Status::Success) { - ReportError(attributePathObj.GetData(), aStatus.mStatus); + ReportError(attributePathObj, aStatus.mStatus); return; } jmethodID onResponseMethod; - err = JniReferences::GetInstance().FindMethod(env, mJavaCallbackRef, "onResponse", - "(Lchip/devicecontroller/model/ChipAttributePath;)V", &onResponseMethod); + VerifyOrReturn(mJavaCallbackRef.HasValidObjectRef(), ChipLogError(Controller, "mJavaCallbackRef is not valid in %s", __func__)); + jobject javaCallback = mJavaCallbackRef.ObjectRef(); + err = JniReferences::GetInstance().FindMethod(env, javaCallback, "onResponse", + "(Lchip/devicecontroller/model/ChipAttributePath;)V", &onResponseMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to find onError method: %s", ErrorStr(err))); DeviceLayer::StackUnlock unlock; - env->CallVoidMethod(mJavaCallbackRef, onResponseMethod, attributePathObj.GetData()); + env->CallVoidMethod(javaCallback, onResponseMethod, attributePathObj); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); } @@ -802,18 +697,19 @@ void WriteAttributesCallback::OnDone(app::WriteClient *) CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); + JniLocalReferenceManager manager(env); + VerifyOrReturn(mWrapperCallbackRef.HasValidObjectRef(), + ChipLogError(Controller, "mWrapperCallbackRef is not valid in %s", __func__)); + JniGlobalReference globalRef(std::move(mWrapperCallbackRef)); jmethodID onDoneMethod; - err = JniReferences::GetInstance().FindMethod(env, mJavaCallbackRef, "onDone", "()V", &onDoneMethod); + VerifyOrReturn(mJavaCallbackRef.HasValidObjectRef(), ChipLogError(Controller, "mJavaCallbackRef is not valid in %s", __func__)); + jobject javaCallback = mJavaCallbackRef.ObjectRef(); + err = JniReferences::GetInstance().FindMethod(env, javaCallback, "onDone", "()V", &onDoneMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find onDone method")); DeviceLayer::StackUnlock unlock; - env->CallVoidMethod(mJavaCallbackRef, onDoneMethod); + env->CallVoidMethod(javaCallback, onDoneMethod); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); - if (mWrapperCallbackRef != nullptr) - { - env->DeleteGlobalRef(mWrapperCallbackRef); - mWrapperCallbackRef = nullptr; - } } void WriteAttributesCallback::ReportError(jobject attributePath, CHIP_ERROR err) @@ -839,48 +735,28 @@ void WriteAttributesCallback::ReportError(jobject attributePath, const char * me ChipLogError(Controller, "Unable to create AndroidControllerException on WriteAttributesCallback::ReportError: %s", ErrorStr(err))); - JniObject exceptionJniCls(env, static_cast(exception)); jmethodID onErrorMethod; - err = JniReferences::GetInstance().FindMethod(env, mJavaCallbackRef, "onError", - "(Lchip/devicecontroller/model/ChipAttributePath;Ljava/lang/Exception;)V", - &onErrorMethod); + VerifyOrReturn(mJavaCallbackRef.HasValidObjectRef(), ChipLogError(Controller, "mJavaCallbackRef is not valid in %s", __func__)); + jobject javaCallback = mJavaCallbackRef.ObjectRef(); + err = JniReferences::GetInstance().FindMethod( + env, javaCallback, "onError", "(Lchip/devicecontroller/model/ChipAttributePath;Ljava/lang/Exception;)V", &onErrorMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to find onError method: %s", ErrorStr(err))); DeviceLayer::StackUnlock unlock; - env->CallVoidMethod(mJavaCallbackRef, onErrorMethod, attributePath, exception); + env->CallVoidMethod(javaCallback, onErrorMethod, attributePath, exception); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); } InvokeCallback::InvokeCallback(jobject wrapperCallback, jobject javaCallback) { - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - - mWrapperCallbackRef = env->NewGlobalRef(wrapperCallback); - VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); - if (mWrapperCallbackRef == nullptr) - { - ChipLogError(Controller, "Could not create global reference for Wrapper InvokeCallback"); - return; - } - mJavaCallbackRef = env->NewGlobalRef(javaCallback); - VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); - if (mJavaCallbackRef == nullptr) - { - ChipLogError(Controller, "Could not create global reference for Java InvokeCallback"); - } + VerifyOrReturn(mWrapperCallbackRef.Init(wrapperCallback) == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not init mWrapperCallbackRef for InvokeCallback")); + VerifyOrReturn(mJavaCallbackRef.Init(javaCallback) == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not init mJavaCallbackRef in %s", __func__)); } InvokeCallback::~InvokeCallback() { - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - if (mJavaCallbackRef != nullptr) - { - env->DeleteGlobalRef(mJavaCallbackRef); - mJavaCallbackRef = nullptr; - } - if (mCommandSender != nullptr) { Platform::Delete(mCommandSender); @@ -898,20 +774,20 @@ void InvokeCallback::OnResponse(app::CommandSender * apCommandSender, const app: JniLocalReferenceManager manager(env); err = CreateInvokeElement(env, aPath, apData, invokeElementObj); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to create Java InvokeElement: %s", ErrorStr(err))); - JniObject jniInvokeElementObj(env, invokeElementObj); - err = JniReferences::GetInstance().FindMethod(env, mJavaCallbackRef, "onResponse", - "(Lchip/devicecontroller/model/InvokeElement;J)V", &onResponseMethod); + VerifyOrReturn(mJavaCallbackRef.HasValidObjectRef(), ChipLogError(Controller, "mJavaCallbackRef is not valid in %s", __func__)); + jobject javaCallback = mJavaCallbackRef.ObjectRef(); + err = JniReferences::GetInstance().FindMethod(env, javaCallback, "onResponse", + "(Lchip/devicecontroller/model/InvokeElement;J)V", &onResponseMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to find onResponse method: %s", ErrorStr(err))); DeviceLayer::StackUnlock unlock; if (aStatusIB.mClusterStatus.HasValue()) { - env->CallVoidMethod(mJavaCallbackRef, onResponseMethod, invokeElementObj, - static_cast(aStatusIB.mClusterStatus.Value())); + env->CallVoidMethod(javaCallback, onResponseMethod, invokeElementObj, static_cast(aStatusIB.mClusterStatus.Value())); } else { - env->CallVoidMethod(mJavaCallbackRef, onResponseMethod, invokeElementObj, + env->CallVoidMethod(javaCallback, onResponseMethod, invokeElementObj, static_cast(Protocols::InteractionModel::Status::Success)); } VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); @@ -928,18 +804,18 @@ void InvokeCallback::OnDone(app::CommandSender * apCommandSender) JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); JniLocalReferenceManager manager(env); + VerifyOrReturn(mWrapperCallbackRef.HasValidObjectRef(), + ChipLogError(Controller, "mWrapperCallbackRef is not valid in %s", __func__)); + JniGlobalReference globalRef(std::move(mWrapperCallbackRef)); jmethodID onDoneMethod; - err = JniReferences::GetInstance().FindMethod(env, mJavaCallbackRef, "onDone", "()V", &onDoneMethod); + VerifyOrReturn(mJavaCallbackRef.HasValidObjectRef(), ChipLogError(Controller, "mJavaCallbackRef is not valid in %s", __func__)); + jobject javaCallback = mJavaCallbackRef.ObjectRef(); + err = JniReferences::GetInstance().FindMethod(env, javaCallback, "onDone", "()V", &onDoneMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find onDone method")); DeviceLayer::StackUnlock unlock; - env->CallVoidMethod(mJavaCallbackRef, onDoneMethod); + env->CallVoidMethod(javaCallback, onDoneMethod); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); - if (mWrapperCallbackRef != nullptr) - { - env->DeleteGlobalRef(mWrapperCallbackRef); - mWrapperCallbackRef = nullptr; - } } void InvokeCallback::ReportError(CHIP_ERROR err) @@ -964,14 +840,15 @@ void InvokeCallback::ReportError(const char * message, ChipError::StorageType er VerifyOrReturn( err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to create AndroidControllerException: %s on InvokeCallback::ReportError", ErrorStr(err))); - JniObject exceptionJniCls(env, static_cast(exception)); jmethodID onErrorMethod; - err = JniReferences::GetInstance().FindMethod(env, mJavaCallbackRef, "onError", "(Ljava/lang/Exception;)V", &onErrorMethod); + VerifyOrReturn(mJavaCallbackRef.HasValidObjectRef(), ChipLogError(Controller, "mJavaCallbackRef is not valid in %s", __func__)); + jobject javaCallback = mJavaCallbackRef.ObjectRef(); + err = JniReferences::GetInstance().FindMethod(env, javaCallback, "onError", "(Ljava/lang/Exception;)V", &onErrorMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to find onError method: %s", ErrorStr(err))); DeviceLayer::StackUnlock unlock; - env->CallVoidMethod(mJavaCallbackRef, onErrorMethod, exception); + env->CallVoidMethod(javaCallback, onErrorMethod, exception); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); } diff --git a/src/controller/java/AndroidCallbacks.h b/src/controller/java/AndroidCallbacks.h index 8cccf5fe7881d6..b622fc3294832e 100644 --- a/src/controller/java/AndroidCallbacks.h +++ b/src/controller/java/AndroidCallbacks.h @@ -23,13 +23,14 @@ #include #include #include +#include #include #include namespace chip { namespace Controller { -CHIP_ERROR CreateChipAttributePath(const app::ConcreteDataAttributePath & aPath, jobject & outObj); +CHIP_ERROR CreateChipAttributePath(JNIEnv * env, const app::ConcreteDataAttributePath & aPath, jobject & outObj); // Callback for success and failure cases of GetConnectedDevice(). struct GetConnectedDeviceCallback @@ -42,8 +43,8 @@ struct GetConnectedDeviceCallback Callback::Callback mOnSuccess; Callback::Callback mOnFailure; - jobject mWrapperCallbackRef = nullptr; - jobject mJavaCallbackRef = nullptr; + JniGlobalReference mWrapperCallbackRef; + JniGlobalReference mJavaCallbackRef; }; struct ReportCallback : public app::ClusterStateCache::Callback @@ -76,19 +77,19 @@ struct ReportCallback : public app::ClusterStateCache::Callback void ReportError(jobject attributePath, jobject eventPath, Protocols::InteractionModel::Status status); void ReportError(jobject attributePath, jobject eventPath, const char * message, ChipError::StorageType errorCode); - CHIP_ERROR CreateChipEventPath(const app::ConcreteEventPath & aPath, jobject & outObj); + CHIP_ERROR CreateChipEventPath(JNIEnv * env, const app::ConcreteEventPath & aPath, jobject & outObj); void UpdateClusterDataVersion(); app::ReadClient * mReadClient = nullptr; app::ClusterStateCache mClusterCacheAdapter; - jobject mWrapperCallbackRef = nullptr; - jobject mSubscriptionEstablishedCallbackRef = nullptr; - jobject mResubscriptionAttemptCallbackRef = nullptr; - jobject mReportCallbackRef = nullptr; + JniGlobalReference mWrapperCallbackRef; + JniGlobalReference mSubscriptionEstablishedCallbackRef; + JniGlobalReference mResubscriptionAttemptCallbackRef; + JniGlobalReference mReportCallbackRef; // NodeState Java object that will be returned to the application. - jobject mNodeStateObj = nullptr; + JniGlobalReference mNodeStateObj; }; struct WriteAttributesCallback : public app::WriteClient::Callback @@ -110,8 +111,8 @@ struct WriteAttributesCallback : public app::WriteClient::Callback app::WriteClient * mWriteClient = nullptr; app::ChunkedWriteCallback mChunkedWriteCallback; - jobject mWrapperCallbackRef = nullptr; - jobject mJavaCallbackRef = nullptr; + JniGlobalReference mWrapperCallbackRef; + JniGlobalReference mJavaCallbackRef; }; struct InvokeCallback : public app::CommandSender::Callback @@ -132,8 +133,8 @@ struct InvokeCallback : public app::CommandSender::Callback void ReportError(const char * message, ChipError::StorageType errorCode); app::CommandSender * mCommandSender = nullptr; - jobject mWrapperCallbackRef = nullptr; - jobject mJavaCallbackRef = nullptr; + JniGlobalReference mWrapperCallbackRef; + JniGlobalReference mJavaCallbackRef; }; } // namespace Controller diff --git a/src/controller/java/AndroidControllerExceptions.cpp b/src/controller/java/AndroidControllerExceptions.cpp index 4f6932b2ad8640..0b900adc9009c4 100644 --- a/src/controller/java/AndroidControllerExceptions.cpp +++ b/src/controller/java/AndroidControllerExceptions.cpp @@ -28,18 +28,14 @@ CHIP_ERROR AndroidControllerExceptions::CreateAndroidControllerException(JNIEnv jthrowable & outEx) { jclass controllerExceptionCls; - CHIP_ERROR err = JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ChipDeviceControllerException", - controllerExceptionCls); + CHIP_ERROR err = JniReferences::GetInstance().GetLocalClassRef(env, "chip/devicecontroller/ChipDeviceControllerException", + controllerExceptionCls); VerifyOrReturnError(err == CHIP_NO_ERROR, CHIP_JNI_ERROR_TYPE_NOT_FOUND); - JniObject controllerExceptionJniCls(env, static_cast(controllerExceptionCls)); - jmethodID exceptionConstructor = env->GetMethodID(controllerExceptionCls, "", "(JLjava/lang/String;)V"); - jobject localRef = - env->NewObject(controllerExceptionCls, exceptionConstructor, static_cast(errorCode), env->NewStringUTF(message)); - VerifyOrReturnError(localRef != nullptr, CHIP_JNI_ERROR_NULL_OBJECT); - outEx = (jthrowable) (env->NewGlobalRef(localRef)); - VerifyOrReturnError(outEx != nullptr, CHIP_JNI_ERROR_NULL_OBJECT); + outEx = static_cast( + env->NewObject(controllerExceptionCls, exceptionConstructor, static_cast(errorCode), env->NewStringUTF(message))); + VerifyOrReturnError(outEx != nullptr, CHIP_JNI_ERROR_TYPE_NOT_FOUND); return CHIP_NO_ERROR; } diff --git a/src/controller/python/chip/tlv/__init__.py b/src/controller/python/chip/tlv/__init__.py index d24569618fb008..2417b78a750678 100644 --- a/src/controller/python/chip/tlv/__init__.py +++ b/src/controller/python/chip/tlv/__init__.py @@ -218,7 +218,7 @@ def put(self, tag, val): self.putBytes(tag, val) elif isinstance(val, Mapping): self.startStructure(tag) - if type(val) == dict: + if type(val) is dict: val = OrderedDict( sorted(val.items(), key=lambda item: tlvTagToSortKey(item[0])) diff --git a/src/lib/support/JniReferences.cpp b/src/lib/support/JniReferences.cpp index edf9b8544d2665..f07837ade467bd 100644 --- a/src/lib/support/JniReferences.cpp +++ b/src/lib/support/JniReferences.cpp @@ -77,8 +77,18 @@ JNIEnv * JniReferences::GetEnvForCurrentThread() CHIP_ERROR JniReferences::GetClassRef(JNIEnv * env, const char * clsType, jclass & outCls) { - CHIP_ERROR err = CHIP_NO_ERROR; jclass cls = nullptr; + CHIP_ERROR err = GetLocalClassRef(env, clsType, cls); + ReturnErrorOnFailure(err); + outCls = (jclass) env->NewGlobalRef((jobject) cls); + VerifyOrReturnError(outCls != nullptr, CHIP_JNI_ERROR_TYPE_NOT_FOUND); + + return err; +} + +CHIP_ERROR JniReferences::GetLocalClassRef(JNIEnv * env, const char * clsType, jclass & outCls) +{ + jclass cls = nullptr; // Try `j$/util/Optional` when enabling Java8. if (strcmp(clsType, "java/util/Optional") == 0) @@ -100,10 +110,8 @@ CHIP_ERROR JniReferences::GetClassRef(JNIEnv * env, const char * clsType, jclass VerifyOrReturnError(cls != nullptr && env->ExceptionCheck() != JNI_TRUE, CHIP_JNI_ERROR_TYPE_NOT_FOUND); } - outCls = (jclass) env->NewGlobalRef((jobject) cls); - VerifyOrReturnError(outCls != nullptr, CHIP_JNI_ERROR_TYPE_NOT_FOUND); - - return err; + outCls = cls; + return CHIP_NO_ERROR; } CHIP_ERROR JniReferences::N2J_ByteArray(JNIEnv * env, const uint8_t * inArray, jsize inArrayLen, jbyteArray & outArray) diff --git a/src/lib/support/JniReferences.h b/src/lib/support/JniReferences.h index 5886ae3f7b9b75..9a0fea52019040 100644 --- a/src/lib/support/JniReferences.h +++ b/src/lib/support/JniReferences.h @@ -58,7 +58,7 @@ class JniReferences /** * @brief - * Creates a jclass reference to the given class type. + * Creates a global jclass reference to the given class type. * * This must be called after SetJavaVm(). * @@ -67,6 +67,19 @@ class JniReferences * @param[out] outCls A Java reference to the class matching clsType. */ CHIP_ERROR GetClassRef(JNIEnv * env, const char * clsType, jclass & outCls); + + /** + * @brief + * Creates a local jclass reference to the given class type. + * + * This must be called after SetJavaVm(). + * + * @param[in] env The JNIEnv for finding a Java class and creating a new Java reference. + * @param[in] clsType The fully-qualified Java class name to find, e.g. java/lang/IllegalStateException. + * @param[out] outCls A Java reference to the class matching clsType. + */ + CHIP_ERROR GetLocalClassRef(JNIEnv * env, const char * clsType, jclass & outCls); + CHIP_ERROR FindMethod(JNIEnv * env, jobject object, const char * methodName, const char * methodSignature, jmethodID * methodId); void CallVoidInt(JNIEnv * env, jobject object, const char * methodName, jint argument); diff --git a/src/lib/support/JniTypeWrappers.h b/src/lib/support/JniTypeWrappers.h index 48d2648db268be..642e1b4358f79b 100644 --- a/src/lib/support/JniTypeWrappers.h +++ b/src/lib/support/JniTypeWrappers.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -203,22 +204,43 @@ class JniLocalReferenceManager bool mlocalFramePushed = false; }; -class JniObject +class JniGlobalReference { public: - JniObject(JNIEnv * aEnv, jobject aObjectRef) : mEnv(aEnv), mObjectRef(aObjectRef) {} - ~JniObject() + JniGlobalReference() {} + + CHIP_ERROR Init(jobject aObjectRef) + { + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT); + VerifyOrReturnError(aObjectRef != nullptr, CHIP_JNI_ERROR_NULL_OBJECT); + VerifyOrReturnError(mObjectRef == nullptr, CHIP_ERROR_INCORRECT_STATE); + mObjectRef = env->NewGlobalRef(aObjectRef); + VerifyOrReturnError(!env->ExceptionCheck(), CHIP_JNI_ERROR_EXCEPTION_THROWN); + VerifyOrReturnError(mObjectRef != nullptr, CHIP_JNI_ERROR_NULL_OBJECT); + return CHIP_NO_ERROR; + } + + JniGlobalReference(JniGlobalReference && aOther) { - if (mEnv != nullptr && mObjectRef != nullptr) + mObjectRef = aOther.mObjectRef; + aOther.mObjectRef = nullptr; + } + + ~JniGlobalReference() + { + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env != nullptr && mObjectRef != nullptr) { - mEnv->DeleteGlobalRef(mObjectRef); + env->DeleteGlobalRef(mObjectRef); } } - jobject objectRef() { return mObjectRef; } + jobject ObjectRef() { return mObjectRef; } + + bool HasValidObjectRef() { return mObjectRef != nullptr; } private: - JNIEnv * mEnv = nullptr; jobject mObjectRef = nullptr; }; diff --git a/src/lib/support/jsontlv/BUILD.gn b/src/lib/support/jsontlv/BUILD.gn index 377b9be19d0656..4af096aa5e6174 100644 --- a/src/lib/support/jsontlv/BUILD.gn +++ b/src/lib/support/jsontlv/BUILD.gn @@ -22,12 +22,14 @@ static_library("jsontlv") { sources = [ "ElementTypes.h", "JsonToTlv.cpp", + "TextFormat.cpp", "TlvJson.cpp", "TlvToJson.cpp", ] public = [ "JsonToTlv.h", + "TextFormat.h", "TlvJson.h", "TlvToJson.h", ] diff --git a/examples/platform/bouffalolab/common/iot_sdk/uart.h b/src/lib/support/jsontlv/TextFormat.cpp similarity index 57% rename from examples/platform/bouffalolab/common/iot_sdk/uart.h rename to src/lib/support/jsontlv/TextFormat.cpp index ff2a398a395dd7..c607df791be7cf 100644 --- a/examples/platform/bouffalolab/common/iot_sdk/uart.h +++ b/src/lib/support/jsontlv/TextFormat.cpp @@ -1,37 +1,32 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void uartInit(void); -int16_t uartWrite(const char * Buf, uint16_t BufLength); -int16_t uartRead(char * Buf, uint16_t NbBytesToRead); - -#ifdef CFG_USB_CDC_ENABLE -void aosUartRxCallback(int fd, void * param); -#endif - -#ifdef __cplusplus -} // extern "C" -#endif +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2013-2017 Nest Labs, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +namespace chip { +std::string PrettyPrintJsonString(const std::string & jsonString) +{ + Json::Reader reader; + Json::Value jsonObject; + reader.parse(jsonString, jsonObject); + Json::StyledWriter writer; + return writer.write(jsonObject); +} + +} // namespace chip diff --git a/src/lib/support/jsontlv/TextFormat.h b/src/lib/support/jsontlv/TextFormat.h new file mode 100644 index 00000000000000..7214a257d985bf --- /dev/null +++ b/src/lib/support/jsontlv/TextFormat.h @@ -0,0 +1,30 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2013-2017 Nest Labs, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +namespace chip { +/* + * Pretty-prints the input Json string using standard library pretty-printer. + * This pretty-printer generates a Json string in a human friendly format with 3 space indentation + * and nice representation of arrays and objects. + * The input can be any string, as long as it's valid Json. + */ +std::string PrettyPrintJsonString(const std::string & jsonString); + +} // namespace chip diff --git a/src/lib/support/jsontlv/TlvToJson.cpp b/src/lib/support/jsontlv/TlvToJson.cpp index d9884f60af43fa..9bafeccf431b2c 100644 --- a/src/lib/support/jsontlv/TlvToJson.cpp +++ b/src/lib/support/jsontlv/TlvToJson.cpp @@ -362,21 +362,4 @@ CHIP_ERROR TlvToJson(TLV::TLVReader & reader, std::string & jsonString) jsonString = writer.write(jsonObject); return CHIP_NO_ERROR; } - -std::string PrettyPrintJsonString(const std::string & jsonString) -{ - Json::Reader reader; - Json::Value jsonObject; - reader.parse(jsonString, jsonObject); - Json::StyledWriter writer; - return writer.write(jsonObject); -} - -std::string MakeJsonSingleLine(const std::string & jsonString) -{ - std::string str = PrettyPrintJsonString(jsonString); - str.erase(std::remove_if(str.begin(), str.end(), ::isspace), str.end()); - return str; -} - } // namespace chip diff --git a/src/lib/support/jsontlv/TlvToJson.h b/src/lib/support/jsontlv/TlvToJson.h index ea7589271e8d2e..d73b1859b5dad8 100644 --- a/src/lib/support/jsontlv/TlvToJson.h +++ b/src/lib/support/jsontlv/TlvToJson.h @@ -33,19 +33,4 @@ CHIP_ERROR TlvToJson(TLV::TLVReader & reader, std::string & jsonString); * Given a TLV encoded byte array, this function converts it into JSON object. */ CHIP_ERROR TlvToJson(const ByteSpan & tlv, std::string & jsonString); - -/* - * Pretty-prints the input Json string using standard library pretty-printer. - * This pretty-printer generates a Json string in a human friendly format with 3 space indentation - * and nice representation of arrays and objects. - * The input can be any string, as long as it's valid Json. - */ -std::string PrettyPrintJsonString(const std::string & jsonString); - -/* - * Reformats the input Json string as a single-line string with no spaces or newlines. - * The input can be any string, as long as it's valid Json. - */ -std::string MakeJsonSingleLine(const std::string & jsonString); - } // namespace chip diff --git a/src/lib/support/tests/TestJsonToTlv.cpp b/src/lib/support/tests/TestJsonToTlv.cpp index c08ba978360173..87f37ab4e052b1 100644 --- a/src/lib/support/tests/TestJsonToTlv.cpp +++ b/src/lib/support/tests/TestJsonToTlv.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/src/lib/support/tests/TestJsonToTlvToJson.cpp b/src/lib/support/tests/TestJsonToTlvToJson.cpp index 82edf02d3f6c3b..b14d84ceed4e03 100644 --- a/src/lib/support/tests/TestJsonToTlvToJson.cpp +++ b/src/lib/support/tests/TestJsonToTlvToJson.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/src/lib/support/tests/TestTlvToJson.cpp b/src/lib/support/tests/TestTlvToJson.cpp index 36231be5020c60..63dcf48c9fde16 100644 --- a/src/lib/support/tests/TestTlvToJson.cpp +++ b/src/lib/support/tests/TestTlvToJson.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/lwip/bl702/arch/cc.h b/src/lwip/bl702/arch/cc.h index 082afd87b53689..58ae1e521bba26 100644 --- a/src/lwip/bl702/arch/cc.h +++ b/src/lwip/bl702/arch/cc.h @@ -28,11 +28,7 @@ #include #include -#if CHIP_CONFIG_MEMORY_MGMT_MALLOC -#include -#endif - -#if __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -83,7 +79,7 @@ extern uint8_t __attribute__((section(".bss.lwip_IGMP_GROUP"))) memp_memory_IGMP extern uint8_t __attribute__((section(".bss.lwip_TCP_PCB"))) memp_memory_TCP_PCB_base[]; extern uint8_t __attribute__((section(".bss.lwip_SYS_TIMEOUT"))) memp_memory_SYS_TIMEOUT_base[]; -#if __cplusplus +#ifdef __cplusplus } #endif diff --git a/src/lwip/bl702/lwipopts.h b/src/lwip/bl702/lwipopts.h index 0ef3c210e77f05..a204f74ccdcb83 100644 --- a/src/lwip/bl702/lwipopts.h +++ b/src/lwip/bl702/lwipopts.h @@ -45,18 +45,12 @@ #define TCP_QUEUE_OOSEQ 0 #define ARP_QUEUEING (0) +#define LWIP_PBUF_CALLOUTS 0 #define LWIP_SOCKET 0 #define LWIP_RAW 1 -#define MEMP_NUM_RAW_PCB 5 -#if INET_CONFIG_ENABLE_TCP_ENDPOINT -#define LWIP_TCP 1 -#else -#define LWIP_TCP 0 -#define MEMP_NUM_TCP_PCB 0 -#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT - -// TODO: verify count +#define MEMP_NUM_RAW_PCB (5) + #define MEMP_NUM_UDP_PCB (7) #define LWIP_HAVE_LOOPIF (0) diff --git a/src/lwip/bl702l/arch/cc.h b/src/lwip/bl702l/arch/cc.h index 082afd87b53689..58ae1e521bba26 100644 --- a/src/lwip/bl702l/arch/cc.h +++ b/src/lwip/bl702l/arch/cc.h @@ -28,11 +28,7 @@ #include #include -#if CHIP_CONFIG_MEMORY_MGMT_MALLOC -#include -#endif - -#if __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -83,7 +79,7 @@ extern uint8_t __attribute__((section(".bss.lwip_IGMP_GROUP"))) memp_memory_IGMP extern uint8_t __attribute__((section(".bss.lwip_TCP_PCB"))) memp_memory_TCP_PCB_base[]; extern uint8_t __attribute__((section(".bss.lwip_SYS_TIMEOUT"))) memp_memory_SYS_TIMEOUT_base[]; -#if __cplusplus +#ifdef __cplusplus } #endif diff --git a/src/lwip/bl702l/lwipopts.h b/src/lwip/bl702l/lwipopts.h index 645ccf79b2b752..0a705566e14438 100644 --- a/src/lwip/bl702l/lwipopts.h +++ b/src/lwip/bl702l/lwipopts.h @@ -45,18 +45,12 @@ #define TCP_QUEUE_OOSEQ 0 #define ARP_QUEUEING (0) +#define LWIP_PBUF_CALLOUTS 0 #define LWIP_SOCKET 0 #define LWIP_RAW 1 -#define MEMP_NUM_RAW_PCB 5 -#if INET_CONFIG_ENABLE_TCP_ENDPOINT -#define LWIP_TCP 1 -#else -#define LWIP_TCP 0 -#define MEMP_NUM_TCP_PCB 0 -#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT - -// TODO: verify count +#define MEMP_NUM_RAW_PCB (5) + #define MEMP_NUM_UDP_PCB (7) #define LWIP_HAVE_LOOPIF (0) diff --git a/src/lwip/patches/README.md b/src/lwip/patches/README.md index cb56e7a22e5d0d..130724df048a9e 100644 --- a/src/lwip/patches/README.md +++ b/src/lwip/patches/README.md @@ -21,11 +21,13 @@ recent API change on upstream LwIP. The previous version of this function is ### ND6 LLADDR fix -This patch fixes a bug where the RA processing fails if the RA includes an -LLADDR option with a hw address that is not the max length. This happens for -thread devices. +In earlier version of lwIP, there is a bug where the RA processing fails if the +RA includes an LLADDR option with a hw address that is not the max length. This +happens for thread devices. Relevant patches from lwIP main that should be +applied back to any Matter device using an older version of lwIP: -- patch file: nd6_lladdr_fix.patch +https://git.savannah.nongnu.org/cgit/lwip.git/commit/?id=7807f706f357d2eea85d9927d970991dc4b1ef90 +https://git.savannah.nongnu.org/cgit/lwip.git/commit/?id=6f700a157d1049a06ab9c467057d71e98e7798de ## Important upstream patches diff --git a/src/lwip/patches/nd6_lladdr_fix.patch b/src/lwip/patches/nd6_lladdr_fix.patch deleted file mode 100644 index 8ce931e01d1712..00000000000000 --- a/src/lwip/patches/nd6_lladdr_fix.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c -index 55b5774f..8559d69b 100644 ---- a/src/core/ipv6/nd6.c -+++ b/src/core/ipv6/nd6.c -@@ -686,14 +686,15 @@ nd6_input(struct pbuf *p, struct netif *inp) - switch (option_type) { - case ND6_OPTION_TYPE_SOURCE_LLADDR: - { -- struct lladdr_option *lladdr_opt; -- if (option_len < (ND6_LLADDR_OPTION_MIN_LENGTH + inp->hwaddr_len)) { -+ const u8_t option_type_and_length_size = 1 + 1; -+ const u8_t *addr_cursor; -+ if (option_len < (option_type_and_length_size + inp->hwaddr_len)) { - goto lenerr_drop_free_return; - } -- lladdr_opt = (struct lladdr_option *)buffer; -+ addr_cursor = buffer + option_type_and_length_size; - if ((default_router_list[i].neighbor_entry != NULL) && - (default_router_list[i].neighbor_entry->state == ND6_INCOMPLETE)) { -- SMEMCPY(default_router_list[i].neighbor_entry->lladdr, lladdr_opt->addr, inp->hwaddr_len); -+ SMEMCPY(default_router_list[i].neighbor_entry->lladdr, addr_cursor, inp->hwaddr_len); - default_router_list[i].neighbor_entry->state = ND6_REACHABLE; - default_router_list[i].neighbor_entry->counter.reachable_time = reachable_time; - } diff --git a/src/platform/ASR/ASRUtils.cpp b/src/platform/ASR/ASRUtils.cpp index 5ab810d85c4fb9..f65c6ecb11617d 100644 --- a/src/platform/ASR/ASRUtils.cpp +++ b/src/platform/ASR/ASRUtils.cpp @@ -39,7 +39,10 @@ using namespace ::chip::DeviceLayer::Internal; using chip::DeviceLayer::Internal::DeviceNetworkInfo; namespace { +constexpr uint8_t kWiFiMaxNetworks = 15; +uint8_t NumAP = 0; lega_wlan_wifi_conf wifi_conf; +lega_wlan_scan_ap_record_t scan_result[kWiFiMaxNetworks]; } // namespace #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP CHIP_ERROR ASRUtils::IsAPEnabled(bool & apEnabled) @@ -300,3 +303,52 @@ CHIP_ERROR ASRUtils::asr_wifi_connect(void) return err; } + +void ASRUtils::lega_wifi_scan_ind(lega_wlan_scan_result_t * result) +{ + NumAP = 0; + for (int i = 0; i < result->ap_num; i++) + { + if (i < kWiFiMaxNetworks) + { + memcpy(&scan_result[i], &result->ap_list[i], sizeof(lega_wlan_scan_ap_record_t)); + NumAP++; + } + } + NetworkCommissioning::ASRWiFiDriver::GetInstance().OnScanWiFiNetworkDone(); +} + +CHIP_ERROR ASRUtils::StartScanWiFiNetworks(ByteSpan ssid) +{ + if (Internal::ASRUtils::EnableStationMode() != CHIP_NO_ERROR) + { + ChipLogProgress(DeviceLayer, "Start Scan WiFi Networks Failed"); + return CHIP_ERROR_INTERNAL; + } + + NumAP = 0; + memset(scan_result, 0, sizeof(scan_result)); + lega_wlan_scan_compeleted_cb_register(Internal::ASRUtils::lega_wifi_scan_ind); + + if (!ssid.empty()) // ssid is given, only scan this network + { + char cSsid[DeviceLayer::Internal::kMaxWiFiSSIDLength] = {}; + memcpy(cSsid, ssid.data(), ssid.size()); + lega_wlan_start_scan_active(cSsid, 0); + } + else // scan all networks + { + lega_wlan_start_scan(); + } + return CHIP_NO_ERROR; +} + +lega_wlan_scan_ap_record_t * ASRUtils::GetScanResults(void) +{ + return scan_result; +} + +uint8_t ASRUtils::GetScanApNum(void) +{ + return NumAP; +} diff --git a/src/platform/ASR/ASRUtils.h b/src/platform/ASR/ASRUtils.h index ab865321253c98..4b2839c3c097c6 100644 --- a/src/platform/ASR/ASRUtils.h +++ b/src/platform/ASR/ASRUtils.h @@ -30,18 +30,6 @@ extern "C" { } #endif -typedef struct -{ - char wifi_mode; /* refer to hal_wifi_type_t*/ - char security; /* security mode, refer to lega_wlan_security_e */ - char wifi_ssid[32]; /* in station mode, indicate SSID of the wlan needs to be connected. - in softap mode, indicate softap SSID*/ - char wifi_key[64]; /* in station mode, indicate Security key of the wlan needs to be connected, - in softap mode, indicate softap password.(ignored in an open system.) */ - uint32_t ssid_len; - uint32_t key_len; -} lega_wlan_wifi_conf; - namespace chip { namespace DeviceLayer { namespace Internal { @@ -77,6 +65,11 @@ class ASRUtils static CHIP_ERROR StoreWiFiSecurityCode(uint32_t security); static CHIP_ERROR wifi_get_mode(uint32_t & security); static CHIP_ERROR wifi_set_mode(uint32_t security); + + static void lega_wifi_scan_ind(lega_wlan_scan_result_t * result); + static CHIP_ERROR StartScanWiFiNetworks(ByteSpan ssid); + static lega_wlan_scan_ap_record_t * GetScanResults(void); + static uint8_t GetScanApNum(void); }; } // namespace Internal diff --git a/src/platform/ASR/ConnectivityManagerImpl.cpp b/src/platform/ASR/ConnectivityManagerImpl.cpp index b24e6ffe19567b..fb023b7b3c3a0b 100644 --- a/src/platform/ASR/ConnectivityManagerImpl.cpp +++ b/src/platform/ASR/ConnectivityManagerImpl.cpp @@ -572,11 +572,6 @@ void ConnectivityManagerImpl::lega_wifi_connect_state(lega_wifi_event_e stat) } } -void ConnectivityManagerImpl::lega_wifi_scan_ind(lega_wlan_scan_result_t * result) -{ - NetworkCommissioning::ASRWiFiDriver::GetInstance().OnScanWiFiNetworkDone(result); -} - void ConnectivityManagerImpl::lega_wifi_get_ip_ind(lega_wlan_ip_stat_t * pnet) { ChipLogProgress(DeviceLayer, "Got ip : %s, gw : %s, mask : %s, mac : %s", pnet->ip, pnet->gate, pnet->mask, pnet->macaddr); @@ -627,7 +622,6 @@ void ConnectivityManagerImpl::lega_wlan_err_stat_handler(lega_wlan_err_status_e CHIP_ERROR ConnectivityManagerImpl::WiFi_init(void) { - lega_wlan_scan_compeleted_cb_register(ConnectivityManagerImpl::lega_wifi_scan_ind); lega_wlan_stat_chg_cb_register(ConnectivityManagerImpl::lega_wifi_connect_state); lega_wlan_ip_got_cb_register(ConnectivityManagerImpl::lega_wifi_get_ip_ind); lega_wlan_ip6_got_cb_register(ConnectivityManagerImpl::lega_wifi_get_ip6_ind); diff --git a/src/platform/ASR/ConnectivityManagerImpl.h b/src/platform/ASR/ConnectivityManagerImpl.h index 8d4d5460e97b2f..546a31362c1cd2 100644 --- a/src/platform/ASR/ConnectivityManagerImpl.h +++ b/src/platform/ASR/ConnectivityManagerImpl.h @@ -132,7 +132,6 @@ class ConnectivityManagerImpl final : public ConnectivityManager, CHIP_ERROR ConfigureWiFiAP(void); void ChangeWiFiAPState(WiFiAPState newState); void UpdateInternetConnectivityState(void); - static void lega_wifi_scan_ind(lega_wlan_scan_result_t * result); static void lega_wifi_connect_state(lega_wifi_event_e stat); static void lega_wifi_get_ip_ind(lega_wlan_ip_stat_t * pnet); static void lega_wifi_get_ip6_ind(lega_wlan_ip_stat_t * pnet); diff --git a/src/platform/ASR/NetworkCommissioningDriver.h b/src/platform/ASR/NetworkCommissioningDriver.h index 5a028042d88d1a..6c57e5422de32f 100644 --- a/src/platform/ASR/NetworkCommissioningDriver.h +++ b/src/platform/ASR/NetworkCommissioningDriver.h @@ -36,13 +36,12 @@ namespace { inline constexpr uint8_t kMaxWiFiNetworks = 1; inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; -inline constexpr uint8_t kWiFiMaxNetworks = 15; } // namespace class ASRScanResponseIterator : public Iterator { public: - ASRScanResponseIterator(const size_t size, const lega_wlan_scan_result_t * scanResults) : + ASRScanResponseIterator(const size_t size, const lega_wlan_scan_ap_record_t * scanResults) : mSize(size), mpScanResults(scanResults) {} size_t Count() override { return mSize; } @@ -54,14 +53,14 @@ class ASRScanResponseIterator : public Iterator } // copy the available information into WiFiScanResponse struct, which will be copied to the result to be sent - item.security.SetRaw(mpScanResults->ap_list[mIternum].security); - item.ssidLen = static_cast(strnlen(reinterpret_cast(mpScanResults->ap_list[mIternum].ssid), - chip::DeviceLayer::Internal::kMaxWiFiSSIDLength)); - item.channel = mpScanResults->ap_list[mIternum].channel; + item.security.SetRaw(mpScanResults[mIternum].security); + item.ssidLen = static_cast( + strnlen(reinterpret_cast(mpScanResults[mIternum].ssid), chip::DeviceLayer::Internal::kMaxWiFiSSIDLength)); + item.channel = mpScanResults[mIternum].channel; item.wiFiBand = chip::DeviceLayer::NetworkCommissioning::WiFiBand::k2g4; - item.rssi = mpScanResults->ap_list[mIternum].ap_power; - memcpy(item.ssid, mpScanResults->ap_list[mIternum].ssid, item.ssidLen); - memcpy(item.bssid, mpScanResults->ap_list[mIternum].bssid, 6); + item.rssi = mpScanResults[mIternum].ap_power; + memcpy(item.ssid, mpScanResults[mIternum].ssid, item.ssidLen); + memcpy(item.bssid, mpScanResults[mIternum].bssid, 6); mIternum++; return true; @@ -69,9 +68,9 @@ class ASRScanResponseIterator : public Iterator void Release() override {} private: - const size_t mSize; // no of network scanned - const lega_wlan_scan_result_t * mpScanResults; // list of scanned network info of size mSize - size_t mIternum = 0; // to iterate through mpScanResults of size mSize + const size_t mSize; // no of network scanned + const lega_wlan_scan_ap_record_t * mpScanResults; // list of scanned network info of size mSize + size_t mIternum = 0; // to iterate through mpScanResults of size mSize }; class ASRWiFiDriver final : public WiFiDriver @@ -124,7 +123,7 @@ class ASRWiFiDriver final : public WiFiDriver CHIP_ERROR ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen, const char * key, uint8_t keyLen); void OnConnectWiFiNetwork(); - void OnScanWiFiNetworkDone(lega_wlan_scan_result_t * ScanResult); + void OnScanWiFiNetworkDone(); void OnNetworkStatusChange(); CHIP_ERROR SetLastDisconnectReason(int32_t reason); @@ -138,7 +137,6 @@ class ASRWiFiDriver final : public WiFiDriver private: bool NetworkMatch(const WiFiNetwork & network, ByteSpan networkId); - CHIP_ERROR StartScanWiFiNetworks(ByteSpan ssid); WiFiNetwork mSavedNetwork; WiFiNetwork mStagingNetwork; diff --git a/src/platform/ASR/NetworkCommissioningWiFiDriver.cpp b/src/platform/ASR/NetworkCommissioningWiFiDriver.cpp index b63cda26d5dc02..42b47b00f1b5de 100644 --- a/src/platform/ASR/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/ASR/NetworkCommissioningWiFiDriver.cpp @@ -185,30 +185,9 @@ void ASRWiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callbac } } -CHIP_ERROR ASRWiFiDriver::StartScanWiFiNetworks(ByteSpan ssid) +void ASRWiFiDriver::OnScanWiFiNetworkDone() { - if (ASRUtils::EnableStationMode() != CHIP_NO_ERROR) - { - ChipLogProgress(DeviceLayer, "Start Scan WiFi Networks Failed"); - return CHIP_ERROR_INTERNAL; - } - - if (!ssid.empty()) // ssid is given, only scan this network - { - char cSsid[DeviceLayer::Internal::kMaxWiFiSSIDLength] = {}; - memcpy(cSsid, ssid.data(), ssid.size()); - lega_wlan_start_scan_active(cSsid, 0); - } - else // scan all networks - { - lega_wlan_start_scan(); - } - return CHIP_NO_ERROR; -} - -void ASRWiFiDriver::OnScanWiFiNetworkDone(lega_wlan_scan_result_t * ScanResult) -{ - uint8_t ap_num = ScanResult->ap_num; + uint8_t ap_num = chip::DeviceLayer::Internal::ASRUtils::GetScanApNum(); if (!ap_num) { ChipLogProgress(DeviceLayer, "No AP found"); @@ -220,6 +199,8 @@ void ASRWiFiDriver::OnScanWiFiNetworkDone(lega_wlan_scan_result_t * ScanResult) return; } + lega_wlan_scan_ap_record_t * ScanResult = chip::DeviceLayer::Internal::ASRUtils::GetScanResults(); + if (ScanResult) { if (CHIP_NO_ERROR == DeviceLayer::SystemLayer().ScheduleLambda([ap_num, ScanResult]() { @@ -254,7 +235,7 @@ void ASRWiFiDriver::ScanNetworks(ByteSpan ssid, WiFiDriver::ScanCallback * callb if (callback != nullptr) { mpScanCallback = callback; - if (StartScanWiFiNetworks(ssid) != CHIP_NO_ERROR) + if (chip::DeviceLayer::Internal::ASRUtils::StartScanWiFiNetworks(ssid) != CHIP_NO_ERROR) { mpScanCallback = nullptr; callback->OnFinished(Status::kUnknownError, CharSpan(), nullptr); diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index deab037321dd27..4e4e853ccdc69f 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -42,7 +42,7 @@ #include #include -#include "bluez/Helper.h" +#include "bluez/BluezEndpoint.h" using namespace ::nl; using namespace ::chip::Ble; diff --git a/src/platform/Linux/BLEManagerImpl.h b/src/platform/Linux/BLEManagerImpl.h index 23e182f2281b31..2cc764b742cf13 100644 --- a/src/platform/Linux/BLEManagerImpl.h +++ b/src/platform/Linux/BLEManagerImpl.h @@ -23,9 +23,12 @@ #pragma once +#include + #include #include +#include "bluez/BluezEndpoint.h" #include "bluez/ChipDeviceScanner.h" #include "bluez/Types.h" diff --git a/src/platform/Linux/BUILD.gn b/src/platform/Linux/BUILD.gn index 2dca5182a8632b..a2cfa6b39cbaa8 100644 --- a/src/platform/Linux/BUILD.gn +++ b/src/platform/Linux/BUILD.gn @@ -91,10 +91,12 @@ static_library("Linux") { "BlePlatformConfig.h", "bluez/AdapterIterator.cpp", "bluez/AdapterIterator.h", + "bluez/BluezConnection.cpp", + "bluez/BluezConnection.h", + "bluez/BluezEndpoint.cpp", + "bluez/BluezEndpoint.h", "bluez/ChipDeviceScanner.cpp", "bluez/ChipDeviceScanner.h", - "bluez/Helper.cpp", - "bluez/Helper.h", "bluez/Types.h", ] } diff --git a/src/platform/Linux/bluez/AdapterIterator.h b/src/platform/Linux/bluez/AdapterIterator.h index 2908c7a28e51d3..85697b5d544c9a 100644 --- a/src/platform/Linux/bluez/AdapterIterator.h +++ b/src/platform/Linux/bluez/AdapterIterator.h @@ -21,7 +21,8 @@ #include -#include "lib/core/CHIPError.h" +#include +#include #include "Types.h" diff --git a/src/platform/Linux/bluez/BluezConnection.cpp b/src/platform/Linux/bluez/BluezConnection.cpp new file mode 100644 index 00000000000000..142df8f1317202 --- /dev/null +++ b/src/platform/Linux/bluez/BluezConnection.cpp @@ -0,0 +1,241 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "BluezConnection.h" + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "BluezEndpoint.h" +#include "Types.h" + +namespace chip { +namespace DeviceLayer { +namespace Internal { + +static CHIP_ERROR BluezC2Indicate(BluezConnection::ConnectionDataBundle * closure) +{ + BluezConnection * conn = nullptr; + GAutoPtr error; + GIOStatus status; + const char * buf; + size_t len, written; + + VerifyOrExit(closure != nullptr, ChipLogError(DeviceLayer, "ConnectionDataBundle is NULL in %s", __func__)); + + conn = closure->mpConn; + VerifyOrExit(conn != nullptr, ChipLogError(DeviceLayer, "BluezConnection is NULL in %s", __func__)); + VerifyOrExit(conn->mpC2 != nullptr, ChipLogError(DeviceLayer, "FAIL: C2 Indicate: %s", "NULL C2")); + + if (bluez_gatt_characteristic1_get_notify_acquired(conn->mpC2) == TRUE) + { + buf = (char *) g_variant_get_fixed_array(closure->mpVal, &len, sizeof(uint8_t)); + VerifyOrExit(len <= static_cast(std::numeric_limits::max()), + ChipLogError(DeviceLayer, "FAIL: buffer too large in %s", __func__)); + status = g_io_channel_write_chars(conn->mC2Channel.mpChannel, buf, static_cast(len), &written, + &MakeUniquePointerReceiver(error).Get()); + g_variant_unref(closure->mpVal); + closure->mpVal = nullptr; + + VerifyOrExit(status == G_IO_STATUS_NORMAL, ChipLogError(DeviceLayer, "FAIL: C2 Indicate: %s", error->message)); + } + else + { + bluez_gatt_characteristic1_set_value(conn->mpC2, closure->mpVal); + closure->mpVal = nullptr; + } + +exit: + if (closure != nullptr) + { + g_free(closure); + } + + return CHIP_NO_ERROR; +} + +static BluezConnection::ConnectionDataBundle * MakeConnectionDataBundle(BLE_CONNECTION_OBJECT apConn, + const chip::System::PacketBufferHandle & apBuf) +{ + auto * bundle = g_new(BluezConnection::ConnectionDataBundle, 1); + bundle->mpConn = static_cast(apConn); + bundle->mpVal = + g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, apBuf->Start(), apBuf->DataLength() * sizeof(uint8_t), sizeof(uint8_t)); + return bundle; +} + +CHIP_ERROR SendBluezIndication(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf) +{ + VerifyOrReturnError(!apBuf.IsNull(), CHIP_ERROR_INVALID_ARGUMENT, ChipLogError(DeviceLayer, "apBuf is NULL in %s", __func__)); + return PlatformMgrImpl().GLibMatterContextInvokeSync(BluezC2Indicate, MakeConnectionDataBundle(apConn, apBuf)); +} + +static CHIP_ERROR BluezDisconnect(BluezConnection * conn) +{ + GAutoPtr error; + gboolean success; + + VerifyOrExit(conn != nullptr, ChipLogError(DeviceLayer, "conn is NULL in %s", __func__)); + VerifyOrExit(conn->mpDevice != nullptr, ChipLogError(DeviceLayer, "FAIL: Disconnect: %s", "NULL Device")); + + ChipLogDetail(DeviceLayer, "%s peer=%s", __func__, bluez_device1_get_address(conn->mpDevice)); + + success = bluez_device1_call_disconnect_sync(conn->mpDevice, nullptr, &MakeUniquePointerReceiver(error).Get()); + VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: Disconnect: %s", error->message)); + +exit: + return CHIP_NO_ERROR; +} + +CHIP_ERROR CloseBluezConnection(BLE_CONNECTION_OBJECT apConn) +{ + return PlatformMgrImpl().GLibMatterContextInvokeSync(BluezDisconnect, static_cast(apConn)); +} + +// BluezSendWriteRequest callbacks + +static void SendWriteRequestDone(GObject * aObject, GAsyncResult * aResult, gpointer apConnection) +{ + BluezGattCharacteristic1 * c1 = BLUEZ_GATT_CHARACTERISTIC1(aObject); + GAutoPtr error; + gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c1, aResult, &MakeUniquePointerReceiver(error).Get()); + + VerifyOrReturn(success == TRUE, ChipLogError(DeviceLayer, "FAIL: BluezSendWriteRequest : %s", error->message)); + BLEManagerImpl::HandleWriteComplete(static_cast(apConnection)); +} + +static CHIP_ERROR SendWriteRequestImpl(BluezConnection::ConnectionDataBundle * data) +{ + GVariant * options = nullptr; + GVariantBuilder optionsBuilder; + + VerifyOrExit(data != nullptr, ChipLogError(DeviceLayer, "ConnectionDataBundle is NULL in %s", __func__)); + VerifyOrExit(data->mpConn != nullptr, ChipLogError(DeviceLayer, "BluezConnection is NULL in %s", __func__)); + VerifyOrExit(data->mpConn->mpC1 != nullptr, ChipLogError(DeviceLayer, "C1 is NULL in %s", __func__)); + + g_variant_builder_init(&optionsBuilder, G_VARIANT_TYPE_ARRAY); + g_variant_builder_add(&optionsBuilder, "{sv}", "type", g_variant_new_string("request")); + options = g_variant_builder_end(&optionsBuilder); + + bluez_gatt_characteristic1_call_write_value(data->mpConn->mpC1, data->mpVal, options, nullptr, SendWriteRequestDone, + data->mpConn); + +exit: + g_free(data); + return CHIP_NO_ERROR; +} + +CHIP_ERROR BluezSendWriteRequest(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf) +{ + VerifyOrReturnError(!apBuf.IsNull(), CHIP_ERROR_INVALID_ARGUMENT, ChipLogError(DeviceLayer, "apBuf is NULL in %s", __func__)); + return PlatformMgrImpl().GLibMatterContextInvokeSync(SendWriteRequestImpl, MakeConnectionDataBundle(apConn, apBuf)); +} + +// BluezSubscribeCharacteristic callbacks + +static void OnCharacteristicChanged(GDBusProxy * aInterface, GVariant * aChangedProperties, const gchar * const * aInvalidatedProps, + gpointer apConnection) +{ + BLE_CONNECTION_OBJECT connection = static_cast(apConnection); + GAutoPtr dataValue(g_variant_lookup_value(aChangedProperties, "Value", G_VARIANT_TYPE_BYTESTRING)); + VerifyOrReturn(dataValue != nullptr); + + size_t bufferLen; + auto buffer = g_variant_get_fixed_array(dataValue.get(), &bufferLen, sizeof(uint8_t)); + VerifyOrReturn(buffer != nullptr, ChipLogError(DeviceLayer, "Characteristic value has unexpected type")); + + BLEManagerImpl::HandleTXCharChanged(connection, static_cast(buffer), bufferLen); +} + +static void SubscribeCharacteristicDone(GObject * aObject, GAsyncResult * aResult, gpointer apConnection) +{ + BluezGattCharacteristic1 * c2 = BLUEZ_GATT_CHARACTERISTIC1(aObject); + GAutoPtr error; + gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c2, aResult, &MakeUniquePointerReceiver(error).Get()); + + VerifyOrReturn(success == TRUE, ChipLogError(DeviceLayer, "FAIL: BluezSubscribeCharacteristic : %s", error->message)); + + BLEManagerImpl::HandleSubscribeOpComplete(static_cast(apConnection), true); +} + +static CHIP_ERROR SubscribeCharacteristicImpl(BluezConnection * connection) +{ + BluezGattCharacteristic1 * c2 = nullptr; + VerifyOrExit(connection != nullptr, ChipLogError(DeviceLayer, "BluezConnection is NULL in %s", __func__)); + VerifyOrExit(connection->mpC2 != nullptr, ChipLogError(DeviceLayer, "C2 is NULL in %s", __func__)); + c2 = BLUEZ_GATT_CHARACTERISTIC1(connection->mpC2); + + // Get notifications on the TX characteristic change (e.g. indication is received) + g_signal_connect(c2, "g-properties-changed", G_CALLBACK(OnCharacteristicChanged), connection); + bluez_gatt_characteristic1_call_start_notify(connection->mpC2, nullptr, SubscribeCharacteristicDone, connection); + +exit: + return CHIP_NO_ERROR; +} + +CHIP_ERROR BluezSubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn) +{ + return PlatformMgrImpl().GLibMatterContextInvokeSync(SubscribeCharacteristicImpl, static_cast(apConn)); +} + +// BluezUnsubscribeCharacteristic callbacks + +static void UnsubscribeCharacteristicDone(GObject * aObject, GAsyncResult * aResult, gpointer apConnection) +{ + BluezGattCharacteristic1 * c2 = BLUEZ_GATT_CHARACTERISTIC1(aObject); + GAutoPtr error; + gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c2, aResult, &MakeUniquePointerReceiver(error).Get()); + + VerifyOrReturn(success == TRUE, ChipLogError(DeviceLayer, "FAIL: BluezUnsubscribeCharacteristic : %s", error->message)); + + // Stop listening to the TX characteristic changes + g_signal_handlers_disconnect_by_data(c2, apConnection); + BLEManagerImpl::HandleSubscribeOpComplete(static_cast(apConnection), false); +} + +static CHIP_ERROR UnsubscribeCharacteristicImpl(BluezConnection * connection) +{ + VerifyOrExit(connection != nullptr, ChipLogError(DeviceLayer, "BluezConnection is NULL in %s", __func__)); + VerifyOrExit(connection->mpC2 != nullptr, ChipLogError(DeviceLayer, "C2 is NULL in %s", __func__)); + + bluez_gatt_characteristic1_call_stop_notify(connection->mpC2, nullptr, UnsubscribeCharacteristicDone, connection); + +exit: + return CHIP_NO_ERROR; +} + +CHIP_ERROR BluezUnsubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn) +{ + return PlatformMgrImpl().GLibMatterContextInvokeSync(UnsubscribeCharacteristicImpl, static_cast(apConn)); +} + +} // namespace Internal +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/Linux/bluez/BluezConnection.h b/src/platform/Linux/bluez/BluezConnection.h new file mode 100644 index 00000000000000..7375fbe79d915d --- /dev/null +++ b/src/platform/Linux/bluez/BluezConnection.h @@ -0,0 +1,79 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#include +#include +#include + +#include +#include +#include +#include + +namespace chip { +namespace DeviceLayer { +namespace Internal { + +struct BluezEndpoint; + +struct BluezConnection +{ + + struct IOChannel + { + GIOChannel * mpChannel; + GSource * mWatchSource; + }; + + struct ConnectionDataBundle + { + BluezConnection * mpConn; + GVariant * mpVal; + }; + + char * mpPeerAddress; + BluezDevice1 * mpDevice; + BluezGattService1 * mpService; + BluezGattCharacteristic1 * mpC1; + BluezGattCharacteristic1 * mpC2; + // additional data characteristics + BluezGattCharacteristic1 * mpC3; + + bool mIsNotify; + uint16_t mMtu; + struct IOChannel mC1Channel; + struct IOChannel mC2Channel; + BluezEndpoint * mpEndpoint; +}; + +CHIP_ERROR SendBluezIndication(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf); +CHIP_ERROR CloseBluezConnection(BLE_CONNECTION_OBJECT apConn); + +/// Write to the CHIP RX characteristic on the remote peripheral device +CHIP_ERROR BluezSendWriteRequest(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf); +/// Subscribe to the CHIP TX characteristic on the remote peripheral device +CHIP_ERROR BluezSubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn); +/// Unsubscribe from the CHIP TX characteristic on the remote peripheral device +CHIP_ERROR BluezUnsubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn); + +} // namespace Internal +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/Linux/bluez/Helper.cpp b/src/platform/Linux/bluez/BluezEndpoint.cpp similarity index 86% rename from src/platform/Linux/bluez/Helper.cpp rename to src/platform/Linux/bluez/BluezEndpoint.cpp index 47bfb51452b123..d6f3196a6b877c 100644 --- a/src/platform/Linux/bluez/Helper.cpp +++ b/src/platform/Linux/bluez/BluezEndpoint.cpp @@ -43,43 +43,34 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/** - * @file - * Provides Bluez dbus implementation for BLE - */ +#include "BluezEndpoint.h" #include +#include #include -#include -#include -#include +#include +#include #include -#include #include #include +#include #include -#include -#include #include #include -#include #include -#include +#include +#include +#include #include #include -#include -#include +#include +#include #include -#include - -#include "BluezObjectIterator.h" -#include "Helper.h" +#include -using namespace ::nl; -using namespace chip::Protocols; -using chip::Platform::CopyString; +#include "BluezConnection.h" namespace chip { namespace DeviceLayer { @@ -1214,84 +1205,6 @@ static CHIP_ERROR StartupEndpointBindings(BluezEndpoint * endpoint) return CHIP_NO_ERROR; } -static CHIP_ERROR BluezC2Indicate(ConnectionDataBundle * closure) -{ - BluezConnection * conn = nullptr; - GAutoPtr error; - GIOStatus status; - const char * buf; - size_t len, written; - - VerifyOrExit(closure != nullptr, ChipLogError(DeviceLayer, "ConnectionDataBundle is NULL in %s", __func__)); - - conn = closure->mpConn; - VerifyOrExit(conn != nullptr, ChipLogError(DeviceLayer, "BluezConnection is NULL in %s", __func__)); - VerifyOrExit(conn->mpC2 != nullptr, ChipLogError(DeviceLayer, "FAIL: C2 Indicate: %s", "NULL C2")); - - if (bluez_gatt_characteristic1_get_notify_acquired(conn->mpC2) == TRUE) - { - buf = (char *) g_variant_get_fixed_array(closure->mpVal, &len, sizeof(uint8_t)); - VerifyOrExit(len <= static_cast(std::numeric_limits::max()), - ChipLogError(DeviceLayer, "FAIL: buffer too large in %s", __func__)); - status = g_io_channel_write_chars(conn->mC2Channel.mpChannel, buf, static_cast(len), &written, - &MakeUniquePointerReceiver(error).Get()); - g_variant_unref(closure->mpVal); - closure->mpVal = nullptr; - - VerifyOrExit(status == G_IO_STATUS_NORMAL, ChipLogError(DeviceLayer, "FAIL: C2 Indicate: %s", error->message)); - } - else - { - bluez_gatt_characteristic1_set_value(conn->mpC2, closure->mpVal); - closure->mpVal = nullptr; - } - -exit: - if (closure != nullptr) - { - g_free(closure); - } - - return CHIP_NO_ERROR; -} - -static ConnectionDataBundle * MakeConnectionDataBundle(BLE_CONNECTION_OBJECT apConn, const chip::System::PacketBufferHandle & apBuf) -{ - ConnectionDataBundle * bundle = g_new(ConnectionDataBundle, 1); - bundle->mpConn = static_cast(apConn); - bundle->mpVal = - g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, apBuf->Start(), apBuf->DataLength() * sizeof(uint8_t), sizeof(uint8_t)); - return bundle; -} - -CHIP_ERROR SendBluezIndication(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf) -{ - VerifyOrReturnError(!apBuf.IsNull(), CHIP_ERROR_INVALID_ARGUMENT, ChipLogError(DeviceLayer, "apBuf is NULL in %s", __func__)); - return PlatformMgrImpl().GLibMatterContextInvokeSync(BluezC2Indicate, MakeConnectionDataBundle(apConn, apBuf)); -} - -static CHIP_ERROR BluezDisconnect(BluezConnection * conn) -{ - GAutoPtr error; - gboolean success; - - VerifyOrExit(conn != nullptr, ChipLogError(DeviceLayer, "conn is NULL in %s", __func__)); - VerifyOrExit(conn->mpDevice != nullptr, ChipLogError(DeviceLayer, "FAIL: Disconnect: %s", "NULL Device")); - - ChipLogDetail(DeviceLayer, "%s peer=%s", __func__, bluez_device1_get_address(conn->mpDevice)); - - success = bluez_device1_call_disconnect_sync(conn->mpDevice, nullptr, &MakeUniquePointerReceiver(error).Get()); - VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: Disconnect: %s", error->message)); - -exit: - return CHIP_NO_ERROR; -} - -CHIP_ERROR CloseBluezConnection(BLE_CONNECTION_OBJECT apConn) -{ - return PlatformMgrImpl().GLibMatterContextInvokeSync(BluezDisconnect, static_cast(apConn)); -} - CHIP_ERROR StartBluezAdv(BluezEndpoint * apEndpoint) { CHIP_ERROR err = PlatformMgrImpl().GLibMatterContextInvokeSync(BluezAdvStart, apEndpoint); @@ -1402,123 +1315,6 @@ CHIP_ERROR ShutdownBluezBleLayer(BluezEndpoint * apEndpoint) return CHIP_NO_ERROR; } -// BluezSendWriteRequest callbacks - -static void SendWriteRequestDone(GObject * aObject, GAsyncResult * aResult, gpointer apConnection) -{ - BluezGattCharacteristic1 * c1 = BLUEZ_GATT_CHARACTERISTIC1(aObject); - GAutoPtr error; - gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c1, aResult, &MakeUniquePointerReceiver(error).Get()); - - VerifyOrReturn(success == TRUE, ChipLogError(DeviceLayer, "FAIL: BluezSendWriteRequest : %s", error->message)); - BLEManagerImpl::HandleWriteComplete(static_cast(apConnection)); -} - -static CHIP_ERROR SendWriteRequestImpl(ConnectionDataBundle * data) -{ - GVariant * options = nullptr; - GVariantBuilder optionsBuilder; - - VerifyOrExit(data != nullptr, ChipLogError(DeviceLayer, "ConnectionDataBundle is NULL in %s", __func__)); - VerifyOrExit(data->mpConn != nullptr, ChipLogError(DeviceLayer, "BluezConnection is NULL in %s", __func__)); - VerifyOrExit(data->mpConn->mpC1 != nullptr, ChipLogError(DeviceLayer, "C1 is NULL in %s", __func__)); - - g_variant_builder_init(&optionsBuilder, G_VARIANT_TYPE_ARRAY); - g_variant_builder_add(&optionsBuilder, "{sv}", "type", g_variant_new_string("request")); - options = g_variant_builder_end(&optionsBuilder); - - bluez_gatt_characteristic1_call_write_value(data->mpConn->mpC1, data->mpVal, options, nullptr, SendWriteRequestDone, - data->mpConn); - -exit: - g_free(data); - return CHIP_NO_ERROR; -} - -CHIP_ERROR BluezSendWriteRequest(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf) -{ - VerifyOrReturnError(!apBuf.IsNull(), CHIP_ERROR_INVALID_ARGUMENT, ChipLogError(DeviceLayer, "apBuf is NULL in %s", __func__)); - return PlatformMgrImpl().GLibMatterContextInvokeSync(SendWriteRequestImpl, MakeConnectionDataBundle(apConn, apBuf)); -} - -// BluezSubscribeCharacteristic callbacks - -static void OnCharacteristicChanged(GDBusProxy * aInterface, GVariant * aChangedProperties, const gchar * const * aInvalidatedProps, - gpointer apConnection) -{ - BLE_CONNECTION_OBJECT connection = static_cast(apConnection); - GAutoPtr dataValue(g_variant_lookup_value(aChangedProperties, "Value", G_VARIANT_TYPE_BYTESTRING)); - VerifyOrReturn(dataValue != nullptr); - - size_t bufferLen; - auto buffer = g_variant_get_fixed_array(dataValue.get(), &bufferLen, sizeof(uint8_t)); - VerifyOrReturn(buffer != nullptr, ChipLogError(DeviceLayer, "Characteristic value has unexpected type")); - - BLEManagerImpl::HandleTXCharChanged(connection, static_cast(buffer), bufferLen); -} - -static void SubscribeCharacteristicDone(GObject * aObject, GAsyncResult * aResult, gpointer apConnection) -{ - BluezGattCharacteristic1 * c2 = BLUEZ_GATT_CHARACTERISTIC1(aObject); - GAutoPtr error; - gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c2, aResult, &MakeUniquePointerReceiver(error).Get()); - - VerifyOrReturn(success == TRUE, ChipLogError(DeviceLayer, "FAIL: BluezSubscribeCharacteristic : %s", error->message)); - - BLEManagerImpl::HandleSubscribeOpComplete(static_cast(apConnection), true); -} - -static CHIP_ERROR SubscribeCharacteristicImpl(BluezConnection * connection) -{ - BluezGattCharacteristic1 * c2 = nullptr; - VerifyOrExit(connection != nullptr, ChipLogError(DeviceLayer, "BluezConnection is NULL in %s", __func__)); - VerifyOrExit(connection->mpC2 != nullptr, ChipLogError(DeviceLayer, "C2 is NULL in %s", __func__)); - c2 = BLUEZ_GATT_CHARACTERISTIC1(connection->mpC2); - - // Get notifications on the TX characteristic change (e.g. indication is received) - g_signal_connect(c2, "g-properties-changed", G_CALLBACK(OnCharacteristicChanged), connection); - bluez_gatt_characteristic1_call_start_notify(connection->mpC2, nullptr, SubscribeCharacteristicDone, connection); - -exit: - return CHIP_NO_ERROR; -} - -CHIP_ERROR BluezSubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn) -{ - return PlatformMgrImpl().GLibMatterContextInvokeSync(SubscribeCharacteristicImpl, static_cast(apConn)); -} - -// BluezUnsubscribeCharacteristic callbacks - -static void UnsubscribeCharacteristicDone(GObject * aObject, GAsyncResult * aResult, gpointer apConnection) -{ - BluezGattCharacteristic1 * c2 = BLUEZ_GATT_CHARACTERISTIC1(aObject); - GAutoPtr error; - gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c2, aResult, &MakeUniquePointerReceiver(error).Get()); - - VerifyOrReturn(success == TRUE, ChipLogError(DeviceLayer, "FAIL: BluezUnsubscribeCharacteristic : %s", error->message)); - - // Stop listening to the TX characteristic changes - g_signal_handlers_disconnect_by_data(c2, apConnection); - BLEManagerImpl::HandleSubscribeOpComplete(static_cast(apConnection), false); -} - -static CHIP_ERROR UnsubscribeCharacteristicImpl(BluezConnection * connection) -{ - VerifyOrExit(connection != nullptr, ChipLogError(DeviceLayer, "BluezConnection is NULL in %s", __func__)); - VerifyOrExit(connection->mpC2 != nullptr, ChipLogError(DeviceLayer, "C2 is NULL in %s", __func__)); - - bluez_gatt_characteristic1_call_stop_notify(connection->mpC2, nullptr, UnsubscribeCharacteristicDone, connection); - -exit: - return CHIP_NO_ERROR; -} - -CHIP_ERROR BluezUnsubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn) -{ - return PlatformMgrImpl().GLibMatterContextInvokeSync(UnsubscribeCharacteristicImpl, static_cast(apConn)); -} - // ConnectDevice callbacks struct ConnectParams diff --git a/src/platform/Linux/bluez/Helper.h b/src/platform/Linux/bluez/BluezEndpoint.h similarity index 69% rename from src/platform/Linux/bluez/Helper.h rename to src/platform/Linux/bluez/BluezEndpoint.h index 687e9a166c4b72..1500b55a370215 100644 --- a/src/platform/Linux/bluez/Helper.h +++ b/src/platform/Linux/bluez/BluezEndpoint.h @@ -43,39 +43,72 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/** - * @file - * Provides Bluez dbus implementation for BLE - */ - #pragma once +#include + +#include +#include + +#include #include -#include +#include "BluezConnection.h" #include "Types.h" namespace chip { namespace DeviceLayer { namespace Internal { +struct BLEAdvConfig; + +struct BluezEndpoint +{ + char * mpOwningName; // Bus owning name + + // Adapter properties + char * mpAdapterName; + char * mpAdapterAddr; + + // Paths for objects published by this service + char * mpRootPath; + char * mpAdvPath; + char * mpServicePath; + + // Objects (interfaces) subscibed to by this service + GDBusObjectManager * mpObjMgr = nullptr; + BluezAdapter1 * mpAdapter = nullptr; + BluezDevice1 * mpDevice = nullptr; + + // Objects (interfaces) published by this service + GDBusObjectManagerServer * mpRoot; + BluezGattService1 * mpService; + BluezGattCharacteristic1 * mpC1; + BluezGattCharacteristic1 * mpC2; + // additional data characteristics + BluezGattCharacteristic1 * mpC3; + + // map device path to the connection + GHashTable * mpConnMap; + uint32_t mAdapterId; + bool mIsCentral; + char * mpAdvertisingUUID; + chip::Ble::ChipBLEDeviceIdentificationInfo mDeviceIdInfo; + ChipAdvType mType; ///< Advertisement type. + uint16_t mDuration; ///< Advertisement interval (in ms). + bool mIsAdvertising; + char * mpPeerDevicePath; + GCancellable * mpConnectCancellable = nullptr; +}; + CHIP_ERROR InitBluezBleLayer(bool aIsCentral, const char * apBleAddr, const BLEAdvConfig & aBleAdvConfig, BluezEndpoint *& apEndpoint); CHIP_ERROR ShutdownBluezBleLayer(BluezEndpoint * apEndpoint); -CHIP_ERROR SendBluezIndication(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf); -CHIP_ERROR CloseBluezConnection(BLE_CONNECTION_OBJECT apConn); CHIP_ERROR StartBluezAdv(BluezEndpoint * apEndpoint); CHIP_ERROR StopBluezAdv(BluezEndpoint * apEndpoint); CHIP_ERROR BluezGattsAppRegister(BluezEndpoint * apEndpoint); CHIP_ERROR BluezAdvertisementSetup(BluezEndpoint * apEndpoint); -/// Write to the CHIP RX characteristic on the remote peripheral device -CHIP_ERROR BluezSendWriteRequest(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf); -/// Subscribe to the CHIP TX characteristic on the remote peripheral device -CHIP_ERROR BluezSubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn); -/// Unsubscribe from the CHIP TX characteristic on the remote peripheral device -CHIP_ERROR BluezUnsubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn); - CHIP_ERROR ConnectDevice(BluezDevice1 & aDevice, BluezEndpoint * apEndpoint); void CancelConnect(BluezEndpoint * apEndpoint); diff --git a/src/platform/Linux/bluez/Types.h b/src/platform/Linux/bluez/Types.h index df1485a5104989..d96d4b1524febb 100644 --- a/src/platform/Linux/bluez/Types.h +++ b/src/platform/Linux/bluez/Types.h @@ -49,13 +49,6 @@ #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include -#include -#include - -#include -#include - namespace chip { namespace DeviceLayer { namespace Internal { @@ -109,88 +102,6 @@ enum ChipAdvType #define BLUEZ_ADV_FLAGS_LE_EDR_CONTROLLER (1 << 3) #define BLUEZ_ADV_FLAGS_LE_EDR_HOST (1 << 4) -enum BluezAddressType -{ - BLUEZ_ADDRESS_TYPE_PUBLIC = 0, ///< Bluetooth public device address. - BLUEZ_ADDRESS_TYPE_RANDOM_STATIC = 1, ///< Bluetooth random static address. - BLUEZ_ADDRESS_TYPE_RANDOM_PRIVATE_RESOLVABLE = 2, ///< Bluetooth random private resolvable address. - BLUEZ_ADDRESS_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE = 3, ///< Bluetooth random private non-resolvable address. -}; - -struct BluezAddress -{ - BluezAddressType mType; ///< Bluetooth device address type. - uint8_t mAddress[BLUEZ_ADDRESS_SIZE]; ///< A 48-bit address of Bluetooth device in LSB format. -}; - -struct IOChannel -{ - GIOChannel * mpChannel; - GSource * mWatchSource; -}; - -struct BluezEndpoint -{ - char * mpOwningName; // Bus owning name - - // Adapter properties - char * mpAdapterName; - char * mpAdapterAddr; - - // Paths for objects published by this service - char * mpRootPath; - char * mpAdvPath; - char * mpServicePath; - - // Objects (interfaces) subscibed to by this service - GDBusObjectManager * mpObjMgr = nullptr; - BluezAdapter1 * mpAdapter = nullptr; - BluezDevice1 * mpDevice = nullptr; - - // Objects (interfaces) published by this service - GDBusObjectManagerServer * mpRoot; - BluezGattService1 * mpService; - BluezGattCharacteristic1 * mpC1; - BluezGattCharacteristic1 * mpC2; - // additional data characteristics - BluezGattCharacteristic1 * mpC3; - - // map device path to the connection - GHashTable * mpConnMap; - uint32_t mAdapterId; - bool mIsCentral; - char * mpAdvertisingUUID; - chip::Ble::ChipBLEDeviceIdentificationInfo mDeviceIdInfo; - ChipAdvType mType; ///< Advertisement type. - uint16_t mDuration; ///< Advertisement interval (in ms). - bool mIsAdvertising; - char * mpPeerDevicePath; - GCancellable * mpConnectCancellable = nullptr; -}; - -struct BluezConnection -{ - char * mpPeerAddress; - BluezDevice1 * mpDevice; - BluezGattService1 * mpService; - BluezGattCharacteristic1 * mpC1; - BluezGattCharacteristic1 * mpC2; - // additional data characteristics - BluezGattCharacteristic1 * mpC3; - - bool mIsNotify; - uint16_t mMtu; - struct IOChannel mC1Channel; - struct IOChannel mC2Channel; - BluezEndpoint * mpEndpoint; -}; - -struct ConnectionDataBundle -{ - BluezConnection * mpConn; - GVariant * mpVal; -}; - } // namespace Internal } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/bouffalolab/BL602/bl602-chip-mbedtls-config.h b/src/platform/bouffalolab/BL602/bl602-chip-mbedtls-config.h index f9cc993066a1e9..b75b719ea2449b 100644 --- a/src/platform/bouffalolab/BL602/bl602-chip-mbedtls-config.h +++ b/src/platform/bouffalolab/BL602/bl602-chip-mbedtls-config.h @@ -130,11 +130,7 @@ typedef void mbedtls_ecp_restart_ctx; #define MBEDTLS_ECP_FIXED_POINT_OPTIM 0 /**< Enable fixed-point speed-up */ #define MBEDTLS_ENTROPY_MAX_SOURCES 2 /**< Maximum number of sources supported */ -#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE -#define MBEDTLS_SSL_MAX_CONTENT_LEN 900 /**< Maxium fragment length in bytes */ -#else #define MBEDTLS_SSL_MAX_CONTENT_LEN 768 /**< Maxium fragment length in bytes */ -#endif #define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8 diff --git a/src/platform/bouffalolab/BL702/bl702-openthread-core-bl-config.h b/src/platform/bouffalolab/BL702/bl702-openthread-core-bl-config.h index 6bc32bebc35f3f..220a843b9e60b8 100644 --- a/src/platform/bouffalolab/BL702/bl702-openthread-core-bl-config.h +++ b/src/platform/bouffalolab/BL702/bl702-openthread-core-bl-config.h @@ -49,6 +49,8 @@ */ #define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0 +#define OPENTHREAD_RADIO 0 + #ifndef LMAC154_RADIO_RECEIVE_SENSITIVITY #define LMAC154_RADIO_RECEIVE_SENSITIVITY -103 #endif @@ -63,6 +65,9 @@ #define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 0 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE 0 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 1 + +#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 + #define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 1 #define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 @@ -71,13 +76,22 @@ #define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 #define OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE 1 -#define OPENTHREAD_ENABLE_VENDOR_EXTENSION 0 -// #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 #define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 0 // #define OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE 0 #define OPENTHREAD_CONFIG_TCP_ENABLE 0 +#define OPENTHREAD_CONFIG_TLS_ENABLE 0 #define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1 // #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG +#define OPENTHREAD_ENABLE_VENDOR_EXTENSION 0 +#define OPENTHREAD_EXAMPLES_SIMULATION 0 + +#ifndef OPENTHREAD_CONFIG_DIAG_ENABLE +#define OPENTHREAD_CONFIG_DIAG_ENABLE 0 +#endif + +#define ENABLE_OPENTHREAD_BORDER_ROUTER 0 + #endif // OPENTHREAD_CORE_BL702_CONFIG_H_ diff --git a/src/platform/bouffalolab/BL702L/bl702l-openthread-core-bl-config.h b/src/platform/bouffalolab/BL702L/bl702l-openthread-core-bl-config.h index 7836304f8a0401..220a843b9e60b8 100644 --- a/src/platform/bouffalolab/BL702L/bl702l-openthread-core-bl-config.h +++ b/src/platform/bouffalolab/BL702L/bl702l-openthread-core-bl-config.h @@ -49,6 +49,8 @@ */ #define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0 +#define OPENTHREAD_RADIO 0 + #ifndef LMAC154_RADIO_RECEIVE_SENSITIVITY #define LMAC154_RADIO_RECEIVE_SENSITIVITY -103 #endif @@ -63,6 +65,9 @@ #define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 0 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE 0 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 1 + +#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 + #define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 1 #define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 @@ -71,10 +76,22 @@ #define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 #define OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE 1 -#define OPENTHREAD_ENABLE_VENDOR_EXTENSION 0 -// #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 #define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 0 // #define OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE 0 #define OPENTHREAD_CONFIG_TCP_ENABLE 0 +#define OPENTHREAD_CONFIG_TLS_ENABLE 0 + +#define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1 +// #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG + +#define OPENTHREAD_ENABLE_VENDOR_EXTENSION 0 +#define OPENTHREAD_EXAMPLES_SIMULATION 0 + +#ifndef OPENTHREAD_CONFIG_DIAG_ENABLE +#define OPENTHREAD_CONFIG_DIAG_ENABLE 0 +#endif + +#define ENABLE_OPENTHREAD_BORDER_ROUTER 0 #endif // OPENTHREAD_CORE_BL702_CONFIG_H_ diff --git a/src/platform/bouffalolab/common/BLEManagerImpl.cpp b/src/platform/bouffalolab/common/BLEManagerImpl.cpp index 1cb6ce696f73e6..1612f080d03575 100644 --- a/src/platform/bouffalolab/common/BLEManagerImpl.cpp +++ b/src/platform/bouffalolab/common/BLEManagerImpl.cpp @@ -16,6 +16,7 @@ */ #define __ZEPHYR__ 1 +#define CONFIG_EVENTFD 0 #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE @@ -275,7 +276,7 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) if (!isAdvertisingRerun) { -#if CONFIG_BT_PRIVACY +#ifdef CONFIG_BT_PRIVACY static_assert(CHIP_DEVICE_CONFIG_DISCOVERY_TIMEOUT_SECS <= CONFIG_BT_RPA_TIMEOUT, "BLE advertising timeout is too long relative to RPA timeout"); // Generate new private BLE address diff --git a/src/platform/bouffalolab/common/CHIPDevicePlatformConfig.h b/src/platform/bouffalolab/common/CHIPDevicePlatformConfig.h index 77ccda53b57d16..bc34d9124b6d92 100644 --- a/src/platform/bouffalolab/common/CHIPDevicePlatformConfig.h +++ b/src/platform/bouffalolab/common/CHIPDevicePlatformConfig.h @@ -25,6 +25,10 @@ #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 #endif +#ifndef CHIP_DEVICE_CONFIG_ENABLE_ETHERNET +#define CHIP_DEVICE_CONFIG_ENABLE_ETHERNET 0 +#endif + #if CHIP_ENABLE_OPENTHREAD #define CHIP_DEVICE_CONFIG_ENABLE_THREAD 1 #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1 diff --git a/src/platform/bouffalolab/common/ConnectivityManagerImpl.cpp b/src/platform/bouffalolab/common/ConnectivityManagerImpl.cpp index 598d40a24b31e4..5679674bc973fb 100644 --- a/src/platform/bouffalolab/common/ConnectivityManagerImpl.cpp +++ b/src/platform/bouffalolab/common/ConnectivityManagerImpl.cpp @@ -39,9 +39,6 @@ #if CHIP_DEVICE_LAYER_TARGET_BL702 #include #endif -#if CHIP_DEVICE_LAYER_TARGET_BL616 -#include -#endif #endif #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/src/platform/bouffalolab/common/Logging.cpp b/src/platform/bouffalolab/common/Logging.cpp index b9ccf882c61165..93157e32d0ec21 100644 --- a/src/platform/bouffalolab/common/Logging.cpp +++ b/src/platform/bouffalolab/common/Logging.cpp @@ -16,13 +16,14 @@ */ #include +#include #include #include #include #include -#ifdef PW_RPC_ENABLED +#if PW_RPC_ENABLED #include "PigweedLogger.h" #endif @@ -39,7 +40,7 @@ namespace Platform { static char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; void LogV(const char * module, uint8_t category, const char * msg, va_list v) { -#ifndef PW_RPC_ENABLED +#if !PW_RPC_ENABLED int lmsg = 0; vsnprintf(formattedMsg, sizeof(formattedMsg), msg, v); diff --git a/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp b/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp index 85118f9559ac1c..a2544f879a8ff5 100644 --- a/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp +++ b/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp @@ -23,12 +23,9 @@ extern "C" { #include "btl_interface.h" #include "em_bus.h" // For CORE_CRITICAL_SECTION -#if (defined(EFR32MG24) && defined(SL_WIFI)) +#if SL_WIFI #include "spi_multiplex.h" -#ifdef WF200_WIFI // TODO: (MATTER-1905) clean up of MACROs -#include "sl_wfx_host_api.h" -#endif -#endif +#endif // SL_WIFI } #include @@ -170,23 +167,23 @@ void OTAImageProcessorImpl::HandleFinalize(intptr_t context) writeBuffer[writeBufOffset] = 0; writeBufOffset++; } -#if (defined(EFR32MG24) && defined(SL_WIFI)) +#if SL_BTLCTRL_MUX err = sl_wfx_host_pre_bootloader_spi_transfer(); if (err != SL_STATUS_OK) { ChipLogError(SoftwareUpdate, "sl_wfx_host_pre_bootloader_spi_transfer() error: %ld", err); return; } -#endif +#endif // SL_BTLCTRL_MUX CORE_CRITICAL_SECTION(err = bootloader_eraseWriteStorage(mSlotId, mWriteOffset, writeBuffer, kAlignmentBytes);) -#if (defined(EFR32MG24) && defined(SL_WIFI)) +#if SL_BTLCTRL_MUX err = sl_wfx_host_post_bootloader_spi_transfer(); if (err != SL_STATUS_OK) { ChipLogError(SoftwareUpdate, "sl_wfx_host_post_bootloader_spi_transfer() error: %ld", err); return; } -#endif +#endif // SL_BTLCTRL_MUX if (err) { ChipLogError(SoftwareUpdate, "bootloader_eraseWriteStorage() error: %ld", err); @@ -208,28 +205,28 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context) // Force KVS to store pending keys such as data from StoreCurrentUpdateInfo() chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().ForceKeyMapSave(); -#if (defined(EFR32MG24) && defined(SL_WIFI)) +#if SL_BTLCTRL_MUX err = sl_wfx_host_pre_bootloader_spi_transfer(); if (err != SL_STATUS_OK) { ChipLogError(SoftwareUpdate, "sl_wfx_host_pre_bootloader_spi_transfer() error: %ld", err); return; } -#endif +#endif // SL_BTLCTRL_MUX CORE_CRITICAL_SECTION(err = bootloader_verifyImage(mSlotId, NULL);) if (err != SL_BOOTLOADER_OK) { ChipLogError(SoftwareUpdate, "bootloader_verifyImage() error: %ld", err); // Call the OTARequestor API to reset the state GetRequestorInstance()->CancelImageUpdate(); -#if (defined(EFR32MG24) && defined(SL_WIFI)) +#if SL_BTLCTRL_MUX err = sl_wfx_host_post_bootloader_spi_transfer(); if (err != SL_STATUS_OK) { ChipLogError(SoftwareUpdate, "sl_wfx_host_post_bootloader_spi_transfer() error: %ld", err); return; } -#endif +#endif // SL_BTLCTRL_MUX return; } @@ -239,25 +236,25 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context) ChipLogError(SoftwareUpdate, "bootloader_setImageToBootload() error: %ld", err); // Call the OTARequestor API to reset the state GetRequestorInstance()->CancelImageUpdate(); -#if (defined(EFR32MG24) && defined(SL_WIFI)) +#if SL_BTLCTRL_MUX err = sl_wfx_host_post_bootloader_spi_transfer(); if (err != SL_STATUS_OK) { ChipLogError(SoftwareUpdate, "sl_wfx_host_post_bootloader_spi_transfer() error: %ld", err); return; } -#endif +#endif // SL_BTLCTRL_MUX return; } -#if (defined(EFR32MG24) && defined(SL_WIFI)) +#if SL_BTLCTRL_MUX err = sl_wfx_host_post_bootloader_spi_transfer(); if (err != SL_STATUS_OK) { ChipLogError(SoftwareUpdate, "sl_wfx_host_post_bootloader_spi_transfer() error: %ld", err); return; } -#endif +#endif // SL_BTLCTRL_MUX // This reboots the device CORE_CRITICAL_SECTION(bootloader_rebootAndInstall();) } @@ -310,23 +307,23 @@ void OTAImageProcessorImpl::HandleProcessBlock(intptr_t context) if (writeBufOffset == kAlignmentBytes) { writeBufOffset = 0; -#if (defined(EFR32MG24) && defined(SL_WIFI)) +#if SL_BTLCTRL_MUX err = sl_wfx_host_pre_bootloader_spi_transfer(); if (err != SL_STATUS_OK) { ChipLogError(SoftwareUpdate, "sl_wfx_host_pre_bootloader_spi_transfer() error: %ld", err); return; } -#endif +#endif // SL_BTLCTRL_MUX CORE_CRITICAL_SECTION(err = bootloader_eraseWriteStorage(mSlotId, mWriteOffset, writeBuffer, kAlignmentBytes);) -#if (defined(EFR32MG24) && defined(SL_WIFI)) +#if SL_BTLCTRL_MUX err = sl_wfx_host_post_bootloader_spi_transfer(); if (err != SL_STATUS_OK) { ChipLogError(SoftwareUpdate, "sl_wfx_host_post_bootloader_spi_transfer() error: %ld", err); return; } -#endif +#endif // SL_BTLCTRL_MUX if (err) { ChipLogError(SoftwareUpdate, "bootloader_eraseWriteStorage() error: %ld", err); diff --git a/src/test_driver/tizen/README.md b/src/test_driver/tizen/README.md index eb7ef0cb71683f..c81ab1bf56b353 100644 --- a/src/test_driver/tizen/README.md +++ b/src/test_driver/tizen/README.md @@ -12,7 +12,7 @@ image from hub.docker.com or build it locally using the provided Dockerfile in ```sh # Pull the image from hub.docker.com -docker pull ghcr.io/project-chip/chip-build-tizen-qemu:1 +docker pull ghcr.io/project-chip/chip-build-tizen-qemu:20 ``` ## Building and Running Tests on QEMU @@ -21,7 +21,7 @@ All steps described below should be done inside the docker container. ```sh docker run -it --rm --name chip-tizen-qemu \ - ghcr.io/project-chip/chip-build-tizen-qemu:1 /bin/bash + ghcr.io/project-chip/chip-build-tizen-qemu:20 /bin/bash ``` ### Clone the connectedhomeip repository diff --git a/third_party/asr/asr550x/asr_sdk b/third_party/asr/asr550x/asr_sdk index 17999312cecdf7..9a1bc5e475786a 160000 --- a/third_party/asr/asr550x/asr_sdk +++ b/third_party/asr/asr550x/asr_sdk @@ -1 +1 @@ -Subproject commit 17999312cecdf786ac86ea0554d760b258c8bc00 +Subproject commit 9a1bc5e475786ad4f857924afe2b4c0d09fce5c3 diff --git a/third_party/asr/asr582x/asr_sdk b/third_party/asr/asr582x/asr_sdk index d8cec59dc2a2ca..9c1bfdd37e4806 160000 --- a/third_party/asr/asr582x/asr_sdk +++ b/third_party/asr/asr582x/asr_sdk @@ -1 +1 @@ -Subproject commit d8cec59dc2a2ca04e44e575d8963ce31d542b2ba +Subproject commit 9c1bfdd37e4806350b44becdd54b6b332bb61265 diff --git a/third_party/asr/asr595x/asr_sdk b/third_party/asr/asr595x/asr_sdk index ff434155859d58..f85e10e4057fb7 160000 --- a/third_party/asr/asr595x/asr_sdk +++ b/third_party/asr/asr595x/asr_sdk @@ -1 +1 @@ -Subproject commit ff434155859d58b1a9d8294004f3bcfccf878416 +Subproject commit f85e10e4057fb7bdf0dbb1f4d21bd4905fc45791 diff --git a/third_party/bouffalolab/bl602/bl_iot_sdk.gni b/third_party/bouffalolab/bl602/bl_iot_sdk.gni index a66384086278ac..d8dd045698bda1 100644 --- a/third_party/bouffalolab/bl602/bl_iot_sdk.gni +++ b/third_party/bouffalolab/bl602/bl_iot_sdk.gni @@ -42,6 +42,7 @@ template("bl_iot_sdk") { "BL602_USE_HAL_DRIVER=1", "CFG_CHIP_BL602", + "CFG_COMPONENT_BLOG_ENABLE=0", ] include_dirs = [] @@ -53,6 +54,7 @@ template("bl_iot_sdk") { defines += invoker.defines } + cflags = [ "-Wundef" ] cflags_c = [ "-include", rebase_path("${invoker.freertos_config}", root_build_dir), @@ -64,7 +66,7 @@ template("bl_iot_sdk") { if (defined(invoker.enable_debug_frame_ptr) && invoker.enable_debug_frame_ptr) { - cflags = [ "-fno-omit-frame-pointer" ] + cflags += [ "-fno-omit-frame-pointer" ] } } @@ -208,7 +210,10 @@ template("bl_iot_sdk") { } source_set("${sdk_target_name}_hosal") { - defines = [ "CFG_BLE_ENABLE" ] + defines = [ + "CFG_BLE_ENABLE", + "CONF_BL602_USE_1M_FLASH=0", + ] sources = [ "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_adc.c", "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_boot2.c", @@ -353,6 +358,10 @@ template("bl_iot_sdk") { } source_set("${sdk_target_name}_stage") { + defines = [ + "EF_ENV_CACHE_TABLE_SIZE=64", + "RHINO_CONFIG_WORKQUEUE=0", + ] sources = [ "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt.c", "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_addresses.c", @@ -375,7 +384,6 @@ template("bl_iot_sdk") { "${bl_iot_sdk_root}/components/stage/yloop/src/yloop.c", ] - defines = [ "EF_ENV_CACHE_TABLE_SIZE=64" ] cflags_c = [ "-Wno-sign-compare" ] configs += [ ":${sdk_target_name}_config_BSP_Driver", @@ -468,6 +476,7 @@ template("bl_iot_sdk") { } source_set("${sdk_target_name}_mbedtls") { + defines = [ "MBEDTLS_ECP_ALT_KEEP_ORIGINAL=0" ] include_dirs = [ "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library" ] @@ -694,6 +703,8 @@ template("bl_iot_sdk") { "TD_DIAGNOSIS_STA", "OS_USING_FREERTOS", "CFG_VIRT_DEV_MAX=1", + "TDLS_ENABLE=0", + "CONFIG_NEWLIB_NANO_FORMAT=0", ] include_dirs = [ "${bl_iot_sdk_root}/components/os/bl_os_adapter/bl_os_adapter/include", @@ -716,6 +727,7 @@ template("bl_iot_sdk") { defines = [ "BL602_MATTER_SUPPORT", "LWIP_IPV6", + "CONFIG_WPA_WAPI_PSK=0", ] include_dirs = [ diff --git a/third_party/bouffalolab/bl702/bl_iot_sdk.gni b/third_party/bouffalolab/bl702/bl_iot_sdk.gni index 755179b3eb8e06..357b69e95d3c24 100644 --- a/third_party/bouffalolab/bl702/bl_iot_sdk.gni +++ b/third_party/bouffalolab/bl702/bl_iot_sdk.gni @@ -42,6 +42,7 @@ template("bl_iot_sdk") { "BL702=BL702", "BFLB_USE_ROM_DRIVER=1", "BFLB_USE_HAL_DRIVER=1", + "CFG_COMPONENT_BLOG_ENABLE=0", ] include_dirs = [] @@ -53,6 +54,7 @@ template("bl_iot_sdk") { defines += invoker.defines } + cflags = [ "-Wundef" ] cflags_c = [ "-include", rebase_path("${invoker.freertos_config}", root_build_dir), @@ -64,7 +66,7 @@ template("bl_iot_sdk") { if (defined(invoker.enable_debug_frame_ptr) && invoker.enable_debug_frame_ptr) { - cflags = [ "-fno-omit-frame-pointer" ] + cflags += [ "-fno-omit-frame-pointer" ] } } @@ -404,6 +406,10 @@ template("bl_iot_sdk") { } source_set("${sdk_target_name}_stage") { + defines = [ + "EF_ENV_CACHE_TABLE_SIZE=64", + "RHINO_CONFIG_WORKQUEUE=0", + ] sources = [ "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt.c", "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_addresses.c", @@ -425,7 +431,7 @@ template("bl_iot_sdk") { "${bl_iot_sdk_root}/components/stage/yloop/src/select.c", "${bl_iot_sdk_root}/components/stage/yloop/src/yloop.c", ] - defines = [ "EF_ENV_CACHE_TABLE_SIZE=64" ] + cflags_c = [ "-Wno-sign-compare" ] configs += [ ":${sdk_target_name}_config_BSP_Driver", @@ -518,6 +524,7 @@ template("bl_iot_sdk") { } source_set("${sdk_target_name}_mbedtls") { + defines = [ "MBEDTLS_ECP_ALT_KEEP_ORIGINAL=0" ] include_dirs = [ "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library" ] diff --git a/third_party/bouffalolab/bl702l/bl_iot_sdk.gni b/third_party/bouffalolab/bl702l/bl_iot_sdk.gni index f0742a0fb7c679..5928d22b18e05d 100644 --- a/third_party/bouffalolab/bl702l/bl_iot_sdk.gni +++ b/third_party/bouffalolab/bl702l/bl_iot_sdk.gni @@ -18,8 +18,6 @@ import("//build_overrides/mbedtls.gni") import("//build_overrides/openthread.gni") import("${chip_root}/src/lib/lib.gni") -import("${mbedtls_root}/mbedtls.gni") - declare_args() { bl_iot_sdk_root = "${chip_root}/third_party/bouffalolab/repo" @@ -44,6 +42,7 @@ template("bl_iot_sdk") { "BL702L=BL702L", "BFLB_USE_ROM_DRIVER=1", "BFLB_USE_HAL_DRIVER=1", + "CFG_COMPONENT_BLOG_ENABLE=0", ] include_dirs = [] @@ -55,6 +54,7 @@ template("bl_iot_sdk") { defines += invoker.defines } + cflags = [ "-Wundef" ] cflags_c = [ "-include", rebase_path("${invoker.freertos_config}", root_build_dir), @@ -66,7 +66,7 @@ template("bl_iot_sdk") { if (defined(invoker.enable_debug_frame_ptr) && invoker.enable_debug_frame_ptr) { - cflags = [ "-fno-omit-frame-pointer" ] + cflags += [ "-fno-omit-frame-pointer" ] } } @@ -189,9 +189,10 @@ template("bl_iot_sdk") { } source_set("${sdk_target_name}_hosal") { + defines = [ "CFG_FPGA=0" ] if (defined(invoker.chip_config_network_layer_ble) && invoker.chip_config_network_layer_ble) { - defines = [ "CFG_BLE_ENABLE" ] + defines += [ "CFG_BLE_ENABLE" ] } sources = [ @@ -252,9 +253,9 @@ template("bl_iot_sdk") { "-Wno-old-style-declaration", "-Wno-stringop-overflow", "-Wno-format-truncation", - "-Wno-shadow", ] + configs += [ ":${sdk_target_name}_config_soc", ":${sdk_target_name}_config_BSP_Driver", @@ -264,6 +265,7 @@ template("bl_iot_sdk") { ":${sdk_target_name}_config_fs", ":${sdk_target_name}_config_utils", ] + if (defined(invoker.chip_config_network_layer_ble) && invoker.chip_config_network_layer_ble) { configs += [ ":${sdk_target_name}_config_ble" ] @@ -314,8 +316,8 @@ template("bl_iot_sdk") { "${bl_iot_sdk_root}/components/libc/newlibc/stdatomic.c", "${bl_iot_sdk_root}/components/libc/newlibc/syscalls.c", ] - configs += [ ":${sdk_target_name}_config_bl702l_rom_a0" ] cflags_c = [ "-Wno-builtin-declaration-mismatch" ] + configs += [ ":${sdk_target_name}_config_bl702l_rom_a0" ] public_configs = [ ":${sdk_target_name}_config" ] } @@ -331,6 +333,10 @@ template("bl_iot_sdk") { } source_set("${sdk_target_name}_stage") { + defines = [ + "EF_ENV_CACHE_TABLE_SIZE=64", + "RHINO_CONFIG_WORKQUEUE=0", + ] sources = [ "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt.c", "${bl_iot_sdk_root}/components/stage/blfdt/src/fdt_addresses.c", @@ -353,7 +359,6 @@ template("bl_iot_sdk") { "${bl_iot_sdk_root}/components/stage/yloop/src/yloop.c", ] - defines = [ "EF_ENV_CACHE_TABLE_SIZE=64" ] cflags_c = [ "-Wno-sign-compare" ] configs += [ ":${sdk_target_name}_config_bl702l_rom_a0", @@ -433,6 +438,98 @@ template("bl_iot_sdk") { ] } + config("${sdk_target_name}_config_mbedtls") { + include_dirs = [ + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/include", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port", + "${chip_root}/src/platform/bouffalolab/BL702L", + ] + + defines = [ "MBEDTLS_CONFIG_FILE=\"bl702l-chip-mbedtls-config.h\"" ] + } + + source_set("${sdk_target_name}_mbedtls") { + defines = [ "MBEDTLS_ECP_ALT_KEEP_ORIGINAL=0" ] + include_dirs = + [ "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library" ] + + sources = [ + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/aes_alt.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/bignum_hw.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/ecp_alt.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/ecp_curves_alt.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/hw_common.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/hw_common.h", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/sha1_alt.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/sha256_alt.c", + ] + + sources += [ + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/bignum_ext.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_entropy_poll.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/mbedtls_port_mem.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/net_sockets.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/pkparse.c", + ] + + sources += [ + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/aes.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/asn1parse.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/asn1write.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/base64.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/bignum.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ccm.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/cipher.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/cipher_wrap.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/cmac.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/constant_time.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ctr_drbg.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecdh.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecdsa.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecjpake.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecp.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecp_curves.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/entropy.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/hkdf.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/hmac_drbg.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/md.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/oid.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pem.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pk.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pk_wrap.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pkcs5.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pkwrite.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/platform.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/platform_util.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/sha256.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/sha512.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_ciphersuites.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_cli.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_cookie.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_msg.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_srv.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_tls.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/x509.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/x509_create.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/x509_crt.c", + "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/x509write_csr.c", + ] + + cflags_c = [ + "-Wno-sign-compare", + "-Wno-implicit-function-declaration", + ] + configs += [ + ":${sdk_target_name}_config_BSP_Driver", + ":${sdk_target_name}_config_hosal", + ":${sdk_target_name}_config_bl702l_rom_a0", + ] + public_configs = [ + ":${sdk_target_name}_config", + ":${sdk_target_name}_config_mbedtls", + ] + } + config("${sdk_target_name}_config_ble") { include_dirs = [ "${bl_iot_sdk_root}/components/network/ble/btblecontroller/btble_inc", @@ -503,24 +600,8 @@ template("bl_iot_sdk") { "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/atomic_c.c", "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/buf.c", "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/dec.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/dummy.c", "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/log.c", "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/poll.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/aes_decrypt.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/aes_encrypt.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/cbc_mode.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ccm_mode.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/cmac_mode.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ctr_mode.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ctr_prng.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ecc.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ecc_dh.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ecc_dsa.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/ecc_platform_specific.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/hmac.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/hmac_prng.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/sha256.c", - "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/tinycrypt/source/utils.c", "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/utils.c", "${bl_iot_sdk_root}/components/network/ble/blestack/src/common/work_q.c", "${bl_iot_sdk_root}/components/network/ble/blestack/src/hci_onchip/hci_driver.c", @@ -616,96 +697,6 @@ template("bl_iot_sdk") { "${openthread_root}/src/core:libopenthread_core_headers", ] } - config("${sdk_target_name}_config_mbedtls") { - include_dirs = [ - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/include", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port", - "${chip_root}/src/platform/bouffalolab/BL702L", - ] - - defines = [ "MBEDTLS_CONFIG_FILE=\"bl702l-chip-mbedtls-config.h\"" ] - } - - source_set("${sdk_target_name}_mbedtls") { - include_dirs = - [ "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library" ] - - sources = [ - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/aes_alt.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/bignum_hw.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/ecp_alt.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/ecp_curves_alt.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/hw_common.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/hw_common.h", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/sha1_alt.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_acc/sha256_alt.c", - ] - - sources += [ - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/bignum_ext.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/hw_entropy_poll.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/mbedtls_port_mem.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/net_sockets.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/port/pkparse.c", - ] - - sources += [ - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/aes.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/asn1parse.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/asn1write.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/base64.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/bignum.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ccm.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/cipher.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/cipher_wrap.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/cmac.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/constant_time.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ctr_drbg.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecdh.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecdsa.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecjpake.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecp.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ecp_curves.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/entropy.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/hkdf.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/hmac_drbg.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/md.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/oid.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pem.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pk.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pk_wrap.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pkcs5.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/pkwrite.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/platform.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/platform_util.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/sha256.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/sha512.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_ciphersuites.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_cli.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_cookie.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_msg.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_srv.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/ssl_tls.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/x509.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/x509_create.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/x509_crt.c", - "${bl_iot_sdk_root}/components/security/mbedtls_lts/mbedtls/library/x509write_csr.c", - ] - - cflags_c = [ - "-Wno-sign-compare", - "-Wno-implicit-function-declaration", - ] - configs += [ - ":${sdk_target_name}_config_BSP_Driver", - ":${sdk_target_name}_config_hosal", - ":${sdk_target_name}_config_bl702l_rom_a0", - ] - public_configs = [ - ":${sdk_target_name}_config", - ":${sdk_target_name}_config_mbedtls", - ] - } config("${sdk_target_name}_config_factory_data") { include_dirs = [ "${bl_iot_sdk_root}/components/network/matter/matter_factory_data/include" ] diff --git a/third_party/bouffalolab/repo b/third_party/bouffalolab/repo index a3be70dc5341a4..690b348635806f 160000 --- a/third_party/bouffalolab/repo +++ b/third_party/bouffalolab/repo @@ -1 +1 @@ -Subproject commit a3be70dc5341a4f6c9696f071a38a5953f694ce4 +Subproject commit 690b348635806f312b61ddcc5b2c566daafe833e diff --git a/third_party/libwebsockets/repo b/third_party/libwebsockets/repo index 4144c1e61bfc69..18fdb0d6ecfd7e 160000 --- a/third_party/libwebsockets/repo +++ b/third_party/libwebsockets/repo @@ -1 +1 @@ -Subproject commit 4144c1e61bfc69b08f52e727f687430026ebb608 +Subproject commit 18fdb0d6ecfd7ec8090ed7164fd6e4895a89e12b diff --git a/third_party/openthread/repo b/third_party/openthread/repo index 786bd7f2e93b12..66eaeec41a7090 160000 --- a/third_party/openthread/repo +++ b/third_party/openthread/repo @@ -1 +1 @@ -Subproject commit 786bd7f2e93b12ed809df09e91fb02afca2dc48d +Subproject commit 66eaeec41a7090454a8825beff237844f5deca90 diff --git a/third_party/ot-br-posix/repo b/third_party/ot-br-posix/repo index 2dfff2a1c9756b..636e53dbbe091c 160000 --- a/third_party/ot-br-posix/repo +++ b/third_party/ot-br-posix/repo @@ -1 +1 @@ -Subproject commit 2dfff2a1c9756b67c910bf0b078e77ff2349a0b5 +Subproject commit 636e53dbbe091c2be38672924852182746cf5be6 diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 2f849e55632d4b..830fe37be6b173 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -2000,37 +2000,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) } // namespace FeatureMap -namespace ClusterRevision { - -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::Descriptor::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Descriptor::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -} // namespace ClusterRevision - } // namespace Attributes } // namespace Descriptor @@ -2136,37 +2105,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) } // namespace FeatureMap -namespace ClusterRevision { - -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::AccessControl::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::AccessControl::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -} // namespace ClusterRevision - } // namespace Attributes } // namespace AccessControl @@ -4809,37 +4747,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace SoftwareDiagnostics { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::SoftwareDiagnostics::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::SoftwareDiagnostics::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -6123,71 +6030,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) } // namespace OperationalCredentials namespace GroupKeyManagement { -namespace Attributes { - -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::GroupKeyManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::GroupKeyManagement::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - -namespace ClusterRevision { - -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::GroupKeyManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::GroupKeyManagement::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -} // namespace ClusterRevision - -} // namespace Attributes +namespace Attributes {} // namespace Attributes } // namespace GroupKeyManagement namespace FixedLabel { @@ -6989,37 +6832,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace LaundryWasherMode { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::LaundryWasherMode::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::LaundryWasherMode::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -7057,39 +6869,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace RefrigeratorAndTemperatureControlledCabinetMode { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = - emberAfReadAttribute(endpoint, Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id, Id, writable, - ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -7281,11 +7060,11 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace RvcRunMode { namespace Attributes { -namespace FeatureMap { +namespace ClusterRevision { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::RvcRunMode::Id, Id, readable, sizeof(temp)); @@ -7297,9 +7076,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -7307,10 +7086,16 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::RvcRunMode::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::RvcRunMode::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); } -} // namespace FeatureMap +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace RvcRunMode + +namespace RvcCleanMode { +namespace Attributes { namespace ClusterRevision { @@ -7319,7 +7104,7 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::RvcRunMode::Id, Id, readable, sizeof(temp)); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::RvcCleanMode::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { @@ -7338,25 +7123,25 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::RvcRunMode::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::RvcCleanMode::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); } } // namespace ClusterRevision } // namespace Attributes -} // namespace RvcRunMode +} // namespace RvcCleanMode -namespace RvcCleanMode { +namespace TemperatureControl { namespace Attributes { -namespace FeatureMap { +namespace TemperatureSetpoint { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::RvcCleanMode::Id, Id, readable, sizeof(temp)); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::TemperatureControl::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { @@ -7365,9 +7150,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -7375,78 +7160,10 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::RvcCleanMode::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::TemperatureControl::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE); } -} // namespace FeatureMap - -namespace ClusterRevision { - -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::RvcCleanMode::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::RvcCleanMode::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -} // namespace ClusterRevision - -} // namespace Attributes -} // namespace RvcCleanMode - -namespace TemperatureControl { -namespace Attributes { - -namespace TemperatureSetpoint { - -EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::TemperatureControl::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::TemperatureControl::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE); -} - -} // namespace TemperatureSetpoint +} // namespace TemperatureSetpoint namespace MinTemperature { @@ -7801,37 +7518,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace DishwasherMode { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DishwasherMode::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::DishwasherMode::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -7869,37 +7555,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace AirQuality { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::AirQuality::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::AirQuality::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -8736,37 +8391,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace HepaFilterMonitoring { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::HepaFilterMonitoring::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::HepaFilterMonitoring::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -8804,39 +8428,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace ActivatedCarbonFilterMonitoring { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = - emberAfReadAttribute(endpoint, Clusters::ActivatedCarbonFilterMonitoring::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ActivatedCarbonFilterMonitoring::Id, Id, writable, - ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -19613,39 +19204,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace CarbonMonoxideConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = - emberAfReadAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, writable, - ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -19685,39 +19243,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace CarbonDioxideConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = - emberAfReadAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, writable, - ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -19757,39 +19282,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace NitrogenDioxideConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = - emberAfReadAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, writable, - ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -19829,37 +19321,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace OzoneConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -19897,37 +19358,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace Pm25ConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::Pm25ConcentrationMeasurement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Pm25ConcentrationMeasurement::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -19965,39 +19395,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace FormaldehydeConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = - emberAfReadAttribute(endpoint, Clusters::FormaldehydeConcentrationMeasurement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::FormaldehydeConcentrationMeasurement::Id, Id, writable, - ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -20037,37 +19434,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace Pm1ConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::Pm1ConcentrationMeasurement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Pm1ConcentrationMeasurement::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -20105,37 +19471,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace Pm10ConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::Pm10ConcentrationMeasurement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Pm10ConcentrationMeasurement::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -20173,39 +19508,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace TotalVolatileOrganicCompoundsConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, Id, - readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, Id, writable, - ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -20245,37 +19547,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace RadonConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::RadonConcentrationMeasurement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::RadonConcentrationMeasurement::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 258b9435e75f74..a6a1ab0badbb75 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -384,11 +384,6 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); } // namespace FeatureMap -namespace ClusterRevision { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); -} // namespace ClusterRevision - } // namespace Attributes } // namespace Descriptor @@ -416,11 +411,6 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); } // namespace FeatureMap -namespace ClusterRevision { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); -} // namespace ClusterRevision - } // namespace Attributes } // namespace AccessControl @@ -910,11 +900,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace SoftwareDiagnostics { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -1163,19 +1148,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); } // namespace OperationalCredentials namespace GroupKeyManagement { -namespace Attributes { - -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - -namespace ClusterRevision { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); -} // namespace ClusterRevision - -} // namespace Attributes +namespace Attributes {} // namespace Attributes } // namespace GroupKeyManagement namespace FixedLabel { @@ -1345,11 +1318,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace LaundryWasherMode { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -1361,11 +1329,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace RefrigeratorAndTemperatureControlledCabinetMode { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -1406,11 +1369,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace RvcRunMode { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -1422,11 +1380,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace RvcCleanMode { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -1510,11 +1463,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace DishwasherMode { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -1526,11 +1474,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace AirQuality { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -1692,11 +1635,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace HepaFilterMonitoring { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -1708,11 +1646,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace ActivatedCarbonFilterMonitoring { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -3439,11 +3372,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace CarbonMonoxideConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -3455,11 +3383,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace CarbonDioxideConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -3471,11 +3394,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace NitrogenDioxideConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -3487,11 +3405,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace OzoneConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -3503,11 +3416,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace Pm25ConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -3519,11 +3427,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace FormaldehydeConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -3535,11 +3438,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace Pm1ConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -3551,11 +3449,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace Pm10ConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -3567,11 +3460,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace TotalVolatileOrganicCompoundsConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); @@ -3583,11 +3471,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace RadonConcentrationMeasurement { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value);