diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bde00893f349da..498af0787fde0c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -44,10 +44,10 @@ jobs: uses: actions/checkout@v2 with: submodules: true -# - name: Initialize CodeQL -# uses: github/codeql-action/init@v1 -# with: -# languages: "cpp, python" + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: "cpp" - name: Bootstrap run: scripts/build/gn_bootstrap.sh @@ -81,6 +81,6 @@ jobs: run: find out -type d -name "dbus" -exec rm -rf {} + # - name: Remove nrfxlib binaries for CodeQL Analysis # run: find . -type d -name "nrfxlib" -exec rm -rf {} + -# - name: Perform CodeQL Analysis -# if: ${{ github.event_name == 'push' }} -# uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + if: ${{ github.event_name == 'push' }} + uses: github/codeql-action/analyze@v1 diff --git a/config/nrfconnect/app/overlay-dfu_support.conf b/config/nrfconnect/app/overlay-dfu_support.conf index f12343fa847e5c..0760bd8717626c 100644 --- a/config/nrfconnect/app/overlay-dfu_support.conf +++ b/config/nrfconnect/app/overlay-dfu_support.conf @@ -33,6 +33,7 @@ CONFIG_MCUMGR_CMD_IMG_MGMT=y CONFIG_MCUMGR_CMD_OS_MGMT=y CONFIG_MCUMGR_SMP_BT=y CONFIG_MCUMGR_SMP_BT_AUTHEN=n +CONFIG_MCUMGR_BUF_COUNT=6 # Increase BT MTU and RX buffer for big size DFU messages CONFIG_BT_L2CAP_TX_MTU=252 diff --git a/config/nrfconnect/app/sample-defaults.conf b/config/nrfconnect/app/sample-defaults.conf index dfcb838596b12a..e59caceef4d598 100644 --- a/config/nrfconnect/app/sample-defaults.conf +++ b/config/nrfconnect/app/sample-defaults.conf @@ -52,6 +52,7 @@ CONFIG_BT_DEVICE_NAME_MAX=15 CONFIG_BT_MAX_CONN=1 CONFIG_BT_PHY_UPDATE=n CONFIG_BT_CTLR_PHY_2M=n +CONFIG_SDC_MAX_CONN_EVENT_LEN_DEFAULT=3000 # Enable NFC support CONFIG_CHIP_NFC_COMMISSIONING=y diff --git a/docs/guides/nrfconnect_examples_software_update.md b/docs/guides/nrfconnect_examples_software_update.md new file mode 100644 index 00000000000000..89cb756883a669 --- /dev/null +++ b/docs/guides/nrfconnect_examples_software_update.md @@ -0,0 +1,125 @@ +# Performing Device Firmware Upgrade in the nRF Connect SDK examples + +The following examples for the development kits from Nordic Semiconductor +support over-the-air Device Firmware Upgrade: + +- [CHIP nRF Connect Lock Example Application](../../examples/lock-app/nrfconnect/README.md) +- [CHIP nRF Connect Lighting Example Application](../../examples/lighting-app/nrfconnect/README.md) + +Currently, the Bluetooth LE is the only available transport for performing the +DFU operation and it uses +[Simple Management Protocol](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/device_mgmt/index.html#device-mgmt). +The upgrade can be done either using a smartphone application or a PC command +line tool. + +## Device Firmware Upgrade using smartphone + +To upgrade your device firmware over Bluetooth LE using smartphone, complete the +following steps: + +1. Install one of the following applications on your smartphone: + + - [nRF Connect for Mobile](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-mobile) + - [nRF Toolbox](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Toolbox) + +2. Push **Button 1** on the device to enable the software update functionality. +3. Push **Button 4** on the device to start the Bluetooth LE advertising. +4. Follow the instructions about downloading the new image to a device on the + [FOTA upgrades](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf52.html#fota-upgrades) + page in the nRF Connect documentation. + +## Device Firmware Upgrade using PC command line tool + +To upgrade your device firmware over Bluetooth LE, you can use the PC command +line tool provided by the [mcumgr](https://github.com/zephyrproject-rtos/mcumgr) +project. + +> **_WARNING:_** mcumgr tool using Bluetooth LE is available only for Linux and +> macOS systems. On Windows, there is no support for Device Firmware Upgrade +> over Bluetooth LE yet. + +Complete the following steps to perform DFU using mcumgr: + +1. Install the tool by following the + [mcumgr command line tool installation instructions](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/device_mgmt/index.html#command-line-tool). +2. Push **Button 1** on the device to enable software update functionality. +3. Push **Button 4** on the device to start the Bluetooth LE advertising. + +> **_NOTE:_** In all of the commands listed in the following steps, replace +> `ble-hci-number` with the Bluetooth hci integer value (for example, `0`) and +> `ble-device-name` with the CHIP device name advertised over Bluetooth LE (for +> example, `ChipLock`). + +4. Upload the firmware image to the device by running the following command in + your example directory: + + $ sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image upload build/zephyr/app_update.bin + + The operation can take few minutes. Wait until the progress bar reaches + 100%. + +5. Obtain the list of images present in the device memory by running following + command: + + $ sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image list + + The displayed output contains the old image in slot 0 that is currently + active and the new image in slot 1, which is not active yet (flags field + empty): + + Images: + image=0 slot=0 + version: 0.0.0 + bootable: true + flags: active confirmed + hash: 7bb0e909a846e833465cbb44c581cf045413a5446c6953a30a3dcc2c3ad51764 + image=0 slot=1 + version: 0.0.0 + bootable: true + flags: + hash: cbd58fc3821e749d3abfb00b3069f98c078824735f1b2a333e8a1579971e7de1 + Split status: N/A (0) + +6. Swap the firmware images by calling the following method with `image-hash` + replaced by the image present in the slot 1 hash (for example, + `cbd58fc3821e749d3abfb00b3069f98c078824735f1b2a333e8a1579971e7de1`): + + $ sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image test image-hash + + You can observe that the `flags:` field in the image for slot 1 changes + value to `pending`: + + Images: + image=0 slot=0 + version: 0.0.0 + bootable: true + flags: active confirmed + hash: 7bb0e909a846e833465cbb44c581cf045413a5446c6953a30a3dcc2c3ad51764 + image=0 slot=1 + version: 0.0.0 + bootable: true + flags: pending + hash: cbd58fc3821e749d3abfb00b3069f98c078824735f1b2a333e8a1579971e7de1 + Split status: N/A (0) + +7. Reset the device with the following command to let the bootloader swap + images: + + $ sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' reset + + The device is reset and the following notifications appear in its console: + + *** Booting Zephyr OS build zephyr-v2.5.0-1101-ga9d3aef65424 *** + I: Starting bootloader + I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1 + I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3 + I: Boot source: none + I: Swap type: test + + Swapping operation can take some time, and after it completes, the new + firmware is booted. + +Visit the +[mcumgr image management](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/device_mgmt/indexhtml#image-management) +section to get familiar with all image management commands supported by the +tool. 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 9f3de610c34da6..0a8b464413baf9 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 @@ -6488,6 +6488,103 @@ } ] }, + { + "name": "Binary Input (Basic)", + "code": 15, + "mfgCode": null, + "define": "BINARY_INPUT_BASIC_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Binary Input (Basic)", + "code": 15, + "mfgCode": null, + "define": "BINARY_INPUT_BASIC_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "out of service", + "code": 81, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "present value", + "code": 85, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "status flags", + "code": 111, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Descriptor", "code": 29, diff --git a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp index 8d8f4ab7b8daa7..c90ced38f44a64 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp @@ -34,6 +34,7 @@ EmberAfStatus emberAfApplicationLauncherClusterServerCommandParse(EmberAfCluster EmberAfStatus emberAfAudioOutputClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBarrierControlClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfBinaryInputBasicClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBindingClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBridgedDeviceBasicClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand * cmd); @@ -136,6 +137,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) case ZCL_BASIC_CLUSTER_ID: result = emberAfBasicClusterServerCommandParse(cmd); break; + case ZCL_BINARY_INPUT_BASIC_CLUSTER_ID: + // No commands are enabled for cluster Binary Input (Basic) + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_BINDING_CLUSTER_ID: result = emberAfBindingClusterServerCommandParse(cmd); break; diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp index f5bbc99d4912ac..bf605dd9a2b507 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp @@ -47,6 +47,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_BASIC_CLUSTER_ID: emberAfBasicClusterInitCallback(endpoint); break; + case ZCL_BINARY_INPUT_BASIC_CLUSTER_ID: + emberAfBinaryInputBasicClusterInitCallback(endpoint); + break; case ZCL_BINDING_CLUSTER_ID: emberAfBindingClusterInitCallback(endpoint); break; @@ -203,6 +206,11 @@ void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint) // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfBinaryInputBasicClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfBindingClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback.h b/examples/all-clusters-app/all-clusters-common/gen/callback.h index 9ea9b7aee14b1f..2181f2926f460b 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback.h +++ b/examples/all-clusters-app/all-clusters-common/gen/callback.h @@ -88,6 +88,14 @@ void emberAfBarrierControlClusterInitCallback(chip::EndpointId endpoint); */ void emberAfBasicClusterInitCallback(chip::EndpointId endpoint); +/** @brief Binary Input (Basic) Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfBinaryInputBasicClusterInitCallback(chip::EndpointId endpoint); + /** @brief Binding Cluster Init * * Cluster Init @@ -831,6 +839,77 @@ EmberAfStatus emberAfBasicClusterServerPreAttributeChangedCallback(chip::Endpoin */ void emberAfBasicClusterServerTickCallback(chip::EndpointId endpoint); +// +// Binary Input (Basic) Cluster server +// + +/** @brief Binary Input (Basic) Cluster Server Init + * + * Server Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfBinaryInputBasicClusterServerInitCallback(chip::EndpointId endpoint); + +/** @brief Binary Input (Basic) Cluster Server Attribute Changed + * + * Server Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfBinaryInputBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Binary Input (Basic) Cluster Server Manufacturer Specific Attribute Changed + * + * Server Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfBinaryInputBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Binary Input (Basic) Cluster Server Message Sent + * + * Server Message Sent + * + * @param type The type of message sent + * @param destination The destination to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfBinaryInputBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); + +/** @brief Binary Input (Basic) Cluster Server Pre Attribute Changed + * + * server Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfBinaryInputBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint16_t size, + uint8_t * value); + +/** @brief Binary Input (Basic) Cluster Server Tick + * + * server Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfBinaryInputBasicClusterServerTickCallback(chip::EndpointId endpoint); + // // Binding Cluster server // diff --git a/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h b/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h index 8d06b294e3a6e6..4ba77e2577c8ed 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h +++ b/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h @@ -1649,7 +1649,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 311 +#define GENERATED_ATTRIBUTE_COUNT 315 #define GENERATED_ATTRIBUTES \ { \ \ @@ -1829,6 +1829,12 @@ { 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current level */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ + /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ + { 0x0051, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* out of service */ \ + { 0x0055, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* present value */ \ + { 0x006F, ZAP_TYPE(BITMAP8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* status flags */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(3667) }, /* device list */ \ { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(3921) }, /* server list */ \ @@ -2125,7 +2131,7 @@ }; #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 50 +#define GENERATED_CLUSTER_COUNT 51 #define GENERATED_CLUSTERS \ { \ { \ @@ -2204,110 +2210,113 @@ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */ \ { \ - 0x001D, ZAP_ATTRIBUTE_INDEX(130), 5, 1018, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x000F, ZAP_ATTRIBUTE_INDEX(130), 4, 5, ZAP_CLUSTER_MASK(SERVER), NULL \ + }, /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ + { \ + 0x001D, ZAP_ATTRIBUTE_INDEX(134), 5, 1018, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Descriptor (server) */ \ { \ - 0x0029, ZAP_ATTRIBUTE_INDEX(135), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0029, ZAP_ATTRIBUTE_INDEX(139), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: OTA Software Update Server (server) */ \ { \ - 0x002A, ZAP_ATTRIBUTE_INDEX(136), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x002A, ZAP_ATTRIBUTE_INDEX(140), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: OTA Software Update Client (server) */ \ { \ - 0x0039, ZAP_ATTRIBUTE_INDEX(137), 15, 855, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0039, ZAP_ATTRIBUTE_INDEX(141), 15, 855, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Bridged Device Basic (server) */ \ { \ - 0x003B, ZAP_ATTRIBUTE_INDEX(152), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x003B, ZAP_ATTRIBUTE_INDEX(156), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Switch (server) */ \ { \ - 0x0040, ZAP_ATTRIBUTE_INDEX(155), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0040, ZAP_ATTRIBUTE_INDEX(159), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Fixed Label (server) */ \ { 0x0101, \ - ZAP_ATTRIBUTE_INDEX(157), \ + ZAP_ATTRIBUTE_INDEX(161), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */ \ { \ - 0x0102, ZAP_ATTRIBUTE_INDEX(161), 10, 17, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0102, ZAP_ATTRIBUTE_INDEX(165), 10, 17, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Window Covering (server) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(171), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(175), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (server) */ \ { \ - 0x0200, ZAP_ATTRIBUTE_INDEX(176), 8, 13, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0200, ZAP_ATTRIBUTE_INDEX(180), 8, 13, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Pump Configuration and Control (server) */ \ { \ - 0x0201, ZAP_ATTRIBUTE_INDEX(184), 6, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0201, ZAP_ATTRIBUTE_INDEX(188), 6, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Thermostat (server) */ \ { 0x0300, \ - ZAP_ATTRIBUTE_INDEX(190), \ + ZAP_ATTRIBUTE_INDEX(194), \ 51, \ 336, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayColorControlServer }, /* Endpoint: 1, Cluster: Color Control (server) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(241), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(245), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ { \ - 0x0405, ZAP_ATTRIBUTE_INDEX(245), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0405, ZAP_ATTRIBUTE_INDEX(249), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ { 0x0500, \ - ZAP_ATTRIBUTE_INDEX(249), \ + ZAP_ATTRIBUTE_INDEX(253), \ 6, \ 16, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION) | \ ZAP_CLUSTER_MASK(MESSAGE_SENT_FUNCTION), \ chipFuncArrayIasZoneServer }, /* Endpoint: 1, Cluster: IAS Zone (server) */ \ { \ - 0x0503, ZAP_ATTRIBUTE_INDEX(255), 2, 34, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0503, ZAP_ATTRIBUTE_INDEX(259), 2, 34, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Wake on LAN (server) */ \ { \ - 0x0504, ZAP_ATTRIBUTE_INDEX(257), 4, 320, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0504, ZAP_ATTRIBUTE_INDEX(261), 4, 320, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: TV Channel (server) */ \ { \ - 0x0505, ZAP_ATTRIBUTE_INDEX(261), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0505, ZAP_ATTRIBUTE_INDEX(265), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Target Navigator (server) */ \ { \ - 0x0506, ZAP_ATTRIBUTE_INDEX(263), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0506, ZAP_ATTRIBUTE_INDEX(267), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Media Playback (server) */ \ { \ - 0x0507, ZAP_ATTRIBUTE_INDEX(264), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0507, ZAP_ATTRIBUTE_INDEX(268), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Media Input (server) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(266), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(270), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Low Power (server) */ \ { \ - 0x0509, ZAP_ATTRIBUTE_INDEX(267), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0509, ZAP_ATTRIBUTE_INDEX(271), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Keypad Input (server) */ \ { \ - 0x050A, ZAP_ATTRIBUTE_INDEX(268), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050A, ZAP_ATTRIBUTE_INDEX(272), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Content Launch (server) */ \ { \ - 0x050B, ZAP_ATTRIBUTE_INDEX(271), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050B, ZAP_ATTRIBUTE_INDEX(275), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Audio Output (server) */ \ { \ - 0x050C, ZAP_ATTRIBUTE_INDEX(273), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050C, ZAP_ATTRIBUTE_INDEX(277), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Launcher (server) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(275), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(279), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (server) */ \ { \ - 0x050E, ZAP_ATTRIBUTE_INDEX(283), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050E, ZAP_ATTRIBUTE_INDEX(287), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Account Login (server) */ \ { \ - 0x050F, ZAP_ATTRIBUTE_INDEX(284), 20, 579, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(288), 20, 579, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (server) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(304), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(308), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binding (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(305), \ + ZAP_ATTRIBUTE_INDEX(309), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/off (server) */ \ { 0x0406, \ - ZAP_ATTRIBUTE_INDEX(307), \ + ZAP_ATTRIBUTE_INDEX(311), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2319,7 +2328,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 14, 3744 }, { ZAP_CLUSTER_INDEX(14), 34, 5160 }, { ZAP_CLUSTER_INDEX(48), 2, 8 }, \ + { ZAP_CLUSTER_INDEX(0), 14, 3744 }, { ZAP_CLUSTER_INDEX(14), 35, 5165 }, { ZAP_CLUSTER_INDEX(49), 2, 8 }, \ } // Largest attribute size is needed for various buffers @@ -2329,7 +2338,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (1730) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (8912) +#define ATTRIBUTE_MAX_SIZE (8917) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) @@ -2676,10 +2685,10 @@ #define ZAP_REPORT_DIRECTION(x) ZRD(x) // User options for plugin Reporting -#define EMBER_AF_PLUGIN_REPORTING_TABLE_SIZE (16) +#define EMBER_AF_PLUGIN_REPORTING_TABLE_SIZE (18) #define EMBER_AF_PLUGIN_REPORTING_ENABLE_GROUP_BOUND_REPORTS -#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (16) +#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (18) #define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS \ { \ \ @@ -2698,6 +2707,14 @@ ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0008, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ }, /* current level */ \ \ + /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ + { \ + ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x000F, 0x0055, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ + }, /* present value */ \ + { \ + ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x000F, 0x006F, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ + }, /* status flags */ \ + \ /* Endpoint: 1, Cluster: Switch (server) */ \ { \ ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x003B, 0x0001, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ diff --git a/examples/all-clusters-app/all-clusters-common/gen/gen_config.h b/examples/all-clusters-app/all-clusters-common/gen/gen_config.h index 5a0dd41e1db78c..2f0504a00b5cea 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/gen_config.h +++ b/examples/all-clusters-app/all-clusters-common/gen/gen_config.h @@ -35,6 +35,7 @@ #define EMBER_AF_AUDIO_OUTPUT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_BARRIER_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_BINARY_INPUT_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_BINDING_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_BRIDGED_DEVICE_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) @@ -108,6 +109,11 @@ #define EMBER_AF_PLUGIN_BASIC_SERVER #define EMBER_AF_PLUGIN_BASIC +// Use this macro to check if the server side of the Binary Input (Basic) cluster is included +#define ZCL_USING_BINARY_INPUT_BASIC_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_BINARY_INPUT_BASIC_SERVER +#define EMBER_AF_PLUGIN_BINARY_INPUT_BASIC + // Use this macro to check if the server side of the Binding cluster is included #define ZCL_USING_BINDING_CLUSTER_SERVER #define EMBER_AF_PLUGIN_BINDING_SERVER diff --git a/examples/all-clusters-app/esp32/Makefile b/examples/all-clusters-app/esp32/Makefile deleted file mode 100644 index 7d46e246b8bd6e..00000000000000 --- a/examples/all-clusters-app/esp32/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -# -# Copyright (c) 2020 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. - -# -# This is a project Makefile. It is assumed the directory this Makefile resides in is a -# project subdirectory. -# - -PROJECT_NAME := chip-all-clusters-app - -# The list of extra component dirs must be in sync with that in all-clusters-app/esp32/CMakeLists.txt -EXTRA_COMPONENT_DIRS += $(PROJECT_PATH)/third_party/connectedhomeip/config/esp32/components \ - $(PROJECT_PATH)/../../common/m5stack-tft/repo/components \ - $(PROJECT_PATH)/../../common/QRCode \ - $(PROJECT_PATH)/../../common/screen-framework \ - -CXXFLAGS += -std=c++14 -Os -DLWIP_IPV6_SCOPES=0 -CPPFLAGS += -Os -DLWIP_IPV6_SCOPES=0 -DCHIP_HAVE_CONFIG_H -CFLAGS += -Os -DLWIP_IPV6_SCOPES=0 - -top: all flashing_script - -include $(IDF_PATH)/make/project.mk - -FLASHING_SCRIPT=$(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py - -# Describes what files are required to be bundled in a package for self-contained -# flashing support -# -# NOTE: ESP32 still depends on $IDF_PATH being set -FLASHING_BUNDLE=$(BUILD_DIR_BASE)/$(PROJECT_NAME).flashbundle.txt - -$(FLASHING_SCRIPT): $(APP_BIN) $(BOOTLOADER_BIN) $(PARTITION_TABLE_BIN) $(PROJECT_PATH)/sdkconfig - @third_party/connectedhomeip/scripts/flashing/gen_flashing_script.py esp32 \ - --output $(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py \ - --port $(ESPPORT) --baud $(ESPBAUD) --before $(CONFIG_ESPTOOLPY_BEFORE) --after $(CONFIG_ESPTOOLPY_AFTER) \ - --application $(subst $(BUILD_DIR_BASE)/,,$(APP_BIN)) \ - --bootloader $(subst $(BUILD_DIR_BASE)/,,$(BOOTLOADER_BIN)) \ - --partition $(subst $(BUILD_DIR_BASE)/,,$(PARTITION_TABLE_BIN)) \ - --use-partition-file $(PARTITION_TABLE_BIN) \ - --use-parttool $(IDF_PATH)/components/partition_table/parttool.py \ - --use-sdkconfig $(PROJECT_PATH)/sdkconfig - -$(FLASHING_BUNDLE): - echo "$(subst $(BUILD_DIR_BASE)/,,$(FLASHING_SCRIPT))" >$@ - echo "esp32_firmware_utils.py" >> $@ - echo "firmware_utils.py" >>$@ - echo "$(subst $(BUILD_DIR_BASE)/,,$(APP_BIN))" >>$@ - echo "$(subst $(BUILD_DIR_BASE)/,,$(BOOTLOADER_BIN))" >>$@ - echo "$(subst $(BUILD_DIR_BASE)/,,$(PARTITION_TABLE_BIN))" >>$@ - -flashing_script: $(FLASHING_SCRIPT) $(BUILD_DIR_BASE)/esp32_firmware_utils.py $(BUILD_DIR_BASE)/firmware_utils.py $(FLASHING_BUNDLE) - @echo To flash $(subst $(CURDIR)/,,$(APP_BIN)), run $(subst $(CURDIR)/,,$(FLASHING_SCRIPT)) - -$(BUILD_DIR_BASE)/esp32_firmware_utils.py: third_party/connectedhomeip/scripts/flashing/esp32_firmware_utils.py - @cp $< $@ - -$(BUILD_DIR_BASE)/firmware_utils.py: third_party/connectedhomeip/scripts/flashing/firmware_utils.py - @cp $< $@ - -.PHONY: flashing_script diff --git a/examples/all-clusters-app/esp32/idf.sh b/examples/all-clusters-app/esp32/idf.sh deleted file mode 100755 index 6805596bf1fe53..00000000000000 --- a/examples/all-clusters-app/esp32/idf.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) 2020 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. - -# If this file is sourced, it exports a function called "idf" that initializes -# the espressif environment via the espressive export.sh script and runs -# a command presented as arguments -# -# This file can also be used as an executable - -error() { - echo "$me: *** ERROR: " "${*}" -} - -idf() { - [[ -d $IDF_PATH && -r $IDF_PATH/export.sh ]] || { - error "can't find IDF's export.sh, please set IDF_PATH" - return 1 - } - ( - # shellcheck source=/dev/null - . "$IDF_PATH/export.sh" - export IDF_PATH - "$@" - ) -} -if [[ ${0} == "${BASH_SOURCE[0]}" ]]; then - me=${0##*/} - idf "${@}" -else - me=idf - [[ $PS1 =~ \[idf\].* ]] || PS1="[idf]$PS1" -fi diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 847b61bf2be92e..b7a7c49b6227d4 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -43,6 +43,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/low-power-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/media-playback-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/binary-input-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-measurement-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/scenes" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic" diff --git a/examples/all-clusters-app/esp32/main/component.mk b/examples/all-clusters-app/esp32/main/component.mk deleted file mode 100644 index 2224513b02b4f7..00000000000000 --- a/examples/all-clusters-app/esp32/main/component.mk +++ /dev/null @@ -1,72 +0,0 @@ -# -# Copyright (c) 2020 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. -# -# Description: -# Component makefile for the ESP32 demo application. -# -# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) - -COMPONENT_DEPENDS := chip QRCode tft spidriver - -# The list of src and include dirs must be in sync with that in all-clusters-app/esp32/main/CMakeLists.txt -COMPONENT_SRCDIRS := \ - . \ - ../third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/gen \ - ../third_party/connectedhomeip/src/app/server \ - ../third_party/connectedhomeip/src/app/util \ - ../third_party/connectedhomeip/src/app/clusters/test-cluster-server \ - ../third_party/connectedhomeip/src/app/clusters/descriptor \ - ../third_party/connectedhomeip/src/app/clusters/on-off-server \ - ../third_party/connectedhomeip/src/app/clusters/level-control \ - ../third_party/connectedhomeip/src/app/clusters/identify \ - ../third_party/connectedhomeip/src/app/clusters/account-login-server \ - ../third_party/connectedhomeip/src/app/clusters/application-launcher-server \ - ../third_party/connectedhomeip/src/app/clusters/audio-output-server \ - ../third_party/connectedhomeip/src/app/clusters/barrier-control-server \ - ../third_party/connectedhomeip/src/app/clusters/general-commissioning-server \ - ../third_party/connectedhomeip/src/app/clusters/groups-server \ - ../third_party/connectedhomeip/src/app/clusters/color-control-server \ - ../third_party/connectedhomeip/src/app/clusters/content-launch-server \ - ../third_party/connectedhomeip/src/app/clusters/low-power-server \ - ../third_party/connectedhomeip/src/app/clusters/keypad-input-server \ - ../third_party/connectedhomeip/src/app/clusters/media-playback-server \ - ../third_party/connectedhomeip/src/app/clusters/operational-credentials-server \ - ../third_party/connectedhomeip/src/app/clusters/trusted-root-certificates-server \ - ../third_party/connectedhomeip/src/app/clusters/media-input-server \ - ../third_party/connectedhomeip/src/app/clusters/network-commissioning \ - ../third_party/connectedhomeip/src/app/clusters/ota-server \ - ../third_party/connectedhomeip/src/app/clusters/target-navigator-server \ - ../third_party/connectedhomeip/src/app/clusters/temperature-measurement-server \ - ../third_party/connectedhomeip/src/app/clusters/tv-channel-server \ - ../third_party/connectedhomeip/src/app/clusters/scenes \ - ../third_party/connectedhomeip/src/app/clusters/basic \ - ../third_party/connectedhomeip/src/app/clusters/bindings \ - ../third_party/connectedhomeip/src/app/reporting \ - ../third_party/connectedhomeip/src/app/clusters/door-lock-server \ - ../third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server \ - ../third_party/connectedhomeip/src/app/clusters/ias-zone-server \ - ../third_party/connectedhomeip/src/app/clusters/relative-humidity-measurement-server \ -# ../third_party/connectedhomeip/src/app/clusters/ias-zone-client \ - - -COMPONENT_EXTRA_INCLUDES := $(PROJECT_PATH)/third_party/connectedhomeip/src/app/util \ - $(PROJECT_PATH)/third_party/connectedhomeip/src/app/server \ - $(PROJECT_PATH)/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common \ - $(PROJECT_PATH)/third_party/connectedhomeip/third_party/nlio/repo/include \ - $(PROJECT_PATH)/third_party/connectedhomeip/src - -# So "gen/*" files are found by the src/app bits. -COMPONENT_PRIV_INCLUDEDIRS := . diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index b8dc4a87255e5d..1bbf68ab7cc61d 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -969,6 +969,7 @@ static void OnTestClusterListStructOctetStringListAttributeResponse(void * conte | AudioOutput | 0x050B | | BarrierControl | 0x0103 | | Basic | 0x0028 | +| BinaryInputBasic | 0x000F | | Binding | 0xF000 | | BridgedDeviceBasic | 0x0039 | | ColorControl | 0x0300 | @@ -1011,6 +1012,7 @@ constexpr chip::ClusterId kApplicationLauncherClusterId = 0x050C; constexpr chip::ClusterId kAudioOutputClusterId = 0x050B; constexpr chip::ClusterId kBarrierControlClusterId = 0x0103; constexpr chip::ClusterId kBasicClusterId = 0x0028; +constexpr chip::ClusterId kBinaryInputBasicClusterId = 0x000F; constexpr chip::ClusterId kBindingClusterId = 0xF000; constexpr chip::ClusterId kBridgedDeviceBasicClusterId = 0x0039; constexpr chip::ClusterId kColorControlClusterId = 0x0300; @@ -2923,6 +2925,342 @@ class ReadBasicClusterRevision : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); }; +/*----------------------------------------------------------------------------*\ +| Cluster BinaryInputBasic | 0x000F | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * OutOfService | 0x0051 | +| * PresentValue | 0x0055 | +| * StatusFlags | 0x006F | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/* + * Discover Attributes + */ +class DiscoverBinaryInputBasicAttributes : public ModelCommand +{ +public: + DiscoverBinaryInputBasicAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverBinaryInputBasicAttributes() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); + + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, endpointId); + return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute OutOfService + */ +class ReadBinaryInputBasicOutOfService : public ModelCommand +{ +public: + ReadBinaryInputBasicOutOfService() : ModelCommand("read") + { + AddArgument("attr-name", "out-of-service"); + ModelCommand::AddArguments(); + } + + ~ReadBinaryInputBasicOutOfService() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x000F) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeOutOfService(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnBooleanAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteBinaryInputBasicOutOfService : public ModelCommand +{ +public: + WriteBinaryInputBasicOutOfService() : ModelCommand("write") + { + AddArgument("attr-name", "out-of-service"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteBinaryInputBasicOutOfService() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x000F) command (0x01) on endpoint %" PRIu16, endpointId); + + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeOutOfService(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mValue; +}; + +/* + * Attribute PresentValue + */ +class ReadBinaryInputBasicPresentValue : public ModelCommand +{ +public: + ReadBinaryInputBasicPresentValue() : ModelCommand("read") + { + AddArgument("attr-name", "present-value"); + ModelCommand::AddArguments(); + } + + ~ReadBinaryInputBasicPresentValue() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x000F) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributePresentValue(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnBooleanAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteBinaryInputBasicPresentValue : public ModelCommand +{ +public: + WriteBinaryInputBasicPresentValue() : ModelCommand("write") + { + AddArgument("attr-name", "present-value"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteBinaryInputBasicPresentValue() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x000F) command (0x01) on endpoint %" PRIu16, endpointId); + + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributePresentValue(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mValue; +}; + +class ReportBinaryInputBasicPresentValue : public ModelCommand +{ +public: + ReportBinaryInputBasicPresentValue() : ModelCommand("report") + { + AddArgument("attr-name", "present-value"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + ModelCommand::AddArguments(); + } + + ~ReportBinaryInputBasicPresentValue() + { + delete onSuccessCallback; + delete onFailureCallback; + delete onReportCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x000F) command (0x06) on endpoint %" PRIu16, endpointId); + + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, endpointId); + + CHIP_ERROR err = cluster.ReportAttributePresentValue(onReportCallback->Cancel()); + if (err != CHIP_NO_ERROR) + { + return err; + } + + return cluster.ConfigureAttributePresentValue(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, + mMaxInterval); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::Callback::Callback * onReportCallback = + new chip::Callback::Callback(OnBooleanAttributeResponse, this); + uint16_t mMinInterval; + uint16_t mMaxInterval; +}; + +/* + * Attribute StatusFlags + */ +class ReadBinaryInputBasicStatusFlags : public ModelCommand +{ +public: + ReadBinaryInputBasicStatusFlags() : ModelCommand("read") + { + AddArgument("attr-name", "status-flags"); + ModelCommand::AddArguments(); + } + + ~ReadBinaryInputBasicStatusFlags() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x000F) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeStatusFlags(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class ReportBinaryInputBasicStatusFlags : public ModelCommand +{ +public: + ReportBinaryInputBasicStatusFlags() : ModelCommand("report") + { + AddArgument("attr-name", "status-flags"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + ModelCommand::AddArguments(); + } + + ~ReportBinaryInputBasicStatusFlags() + { + delete onSuccessCallback; + delete onFailureCallback; + delete onReportCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x000F) command (0x06) on endpoint %" PRIu16, endpointId); + + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, endpointId); + + CHIP_ERROR err = cluster.ReportAttributeStatusFlags(onReportCallback->Cancel()); + if (err != CHIP_NO_ERROR) + { + return err; + } + + return cluster.ConfigureAttributeStatusFlags(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, + mMaxInterval); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::Callback::Callback * onReportCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + uint16_t mMinInterval; + uint16_t mMaxInterval; +}; + +/* + * Attribute ClusterRevision + */ +class ReadBinaryInputBasicClusterRevision : public ModelCommand +{ +public: + ReadBinaryInputBasicClusterRevision() : ModelCommand("read") + { + AddArgument("attr-name", "cluster-revision"); + ModelCommand::AddArguments(); + } + + ~ReadBinaryInputBasicClusterRevision() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x000F) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + /*----------------------------------------------------------------------------*\ | Cluster Binding | 0xF000 | |------------------------------------------------------------------------------| @@ -17454,6 +17792,20 @@ void registerClusterBasic(Commands & commands) commands.Register(clusterName, clusterCommands); } +void registerClusterBinaryInputBasic(Commands & commands) +{ + const char * clusterName = "BinaryInputBasic"; + + commands_list clusterCommands = { + make_unique(), make_unique(), + make_unique(), make_unique(), + make_unique(), make_unique(), + make_unique(), make_unique(), + make_unique(), + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterBinding(Commands & commands) { const char * clusterName = "Binding"; @@ -18114,6 +18466,7 @@ void registerClusters(Commands & commands) registerClusterAudioOutput(commands); registerClusterBarrierControl(commands); registerClusterBasic(commands); + registerClusterBinaryInputBasic(commands); registerClusterBinding(commands); registerClusterBridgedDeviceBasic(commands); registerClusterColorControl(commands); diff --git a/examples/chip-tool/commands/reporting/Commands.h b/examples/chip-tool/commands/reporting/Commands.h index d6d83763c31551..ea7928d7d4221c 100644 --- a/examples/chip-tool/commands/reporting/Commands.h +++ b/examples/chip-tool/commands/reporting/Commands.h @@ -30,6 +30,8 @@ class Listen : public ReportingCommand ~Listen() { + delete onReportBinaryInputBasicPresentValueCallback; + delete onReportBinaryInputBasicStatusFlagsCallback; delete onReportColorControlCurrentHueCallback; delete onReportColorControlCurrentSaturationCallback; delete onReportColorControlCurrentXCallback; @@ -52,6 +54,10 @@ class Listen : public ReportingCommand void AddReportCallbacks(uint8_t endpointId) override { chip::app::CHIPDeviceCallbacksMgr & callbacksMgr = chip::app::CHIPDeviceCallbacksMgr::GetInstance(); + callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, 0x000F, 0x0055, + onReportBinaryInputBasicPresentValueCallback->Cancel()); + callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, 0x000F, 0x006F, + onReportBinaryInputBasicStatusFlagsCallback->Cancel()); callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, 0x0300, 0x0000, onReportColorControlCurrentHueCallback->Cancel()); callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, 0x0300, 0x0001, @@ -120,6 +126,10 @@ class Listen : public ReportingCommand } private: + chip::Callback::Callback * onReportBinaryInputBasicPresentValueCallback = + new chip::Callback::Callback(OnBooleanAttributeResponse, this); + chip::Callback::Callback * onReportBinaryInputBasicStatusFlagsCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); chip::Callback::Callback * onReportColorControlCurrentHueCallback = new chip::Callback::Callback(OnInt8uAttributeResponse, this); chip::Callback::Callback * onReportColorControlCurrentSaturationCallback = diff --git a/examples/lighting-app/nrfconnect/README.md b/examples/lighting-app/nrfconnect/README.md index e73c870cf2ea46..321a91899c4b75 100644 --- a/examples/lighting-app/nrfconnect/README.md +++ b/examples/lighting-app/nrfconnect/README.md @@ -462,20 +462,6 @@ CHIP-enabled Thread network. ### Testing Device Firmware Upgrade -> **_NOTE:_** Currently performing DFU over BLE is supported only using -> smartphone with dedicated Nordic application installed. - -To upgrade your device firmware over Bluetooth LE using smartphone, complete the -following tasks: - -1. Install on your smartphone - [nRF Connect for Mobile](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-mobile) - or - [nRF Toolbox](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Toolbox) - application. -2. Push **Button 4** on the device to start Bluetooth LE advertising. -3. Push **Button 1** on the device to enable software update functionality. -4. Follow the instructions in the section about downloading the new image to a - device on the - [FOTA upgrades](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf52.html#fota-upgrades) - page in the nRF Connect documentation. +Read the +[DFU tutorial](../../../docs/guides/nrfconnect_examples_software_update.md) to +see how to upgrade your device firmware. diff --git a/examples/lock-app/nrfconnect/README.md b/examples/lock-app/nrfconnect/README.md index 436212b9013d18..056b49a8d7fbc4 100644 --- a/examples/lock-app/nrfconnect/README.md +++ b/examples/lock-app/nrfconnect/README.md @@ -454,20 +454,6 @@ CHIP-enabled Thread network. ### Testing Device Firmware Upgrade -> **_NOTE:_** Currently performing DFU over BLE is supported only using -> smartphone with dedicated Nordic application installed. - -To upgrade your device firmware over Bluetooth LE using smartphone, complete the -following tasks: - -1. Install on your smartphone - [nRF Connect for Mobile](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-mobile) - or - [nRF Toolbox](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Toolbox) - application. -2. Push **Button 4** on the device to start Bluetooth LE advertising. -3. Push **Button 1** on the device to enable software update functionality. -4. Follow the instructions in the section about downloading the new image to a - device on the - [FOTA upgrades](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf52.html#fota-upgrades) - page in the nRF Connect documentation. +Read the +[DFU tutorial](../../../docs/guides/nrfconnect_examples_software_update.md) to +see how to upgrade your device firmware. diff --git a/examples/persistent-storage/esp32/Makefile b/examples/persistent-storage/esp32/Makefile deleted file mode 100644 index a6fad126da2e06..00000000000000 --- a/examples/persistent-storage/esp32/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -# -# 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. - -# -# This is a project Makefile. It is assumed the directory this Makefile resides in is a -# project subdirectory. -# - -PROJECT_NAME := persistent-storage - -EXTRA_COMPONENT_DIRS += $(PROJECT_PATH)/third_party/connectedhomeip/config/esp32/components \ - -CXXFLAGS += -std=gnu++17 -Os -DLWIP_IPV6_SCOPES=0 -CPPFLAGS += -Os -DLWIP_IPV6_SCOPES=0 -DCHIP_HAVE_CONFIG_H -CFLAGS += -Os -DLWIP_IPV6_SCOPES=0 - -top: all flashing_script - -include $(IDF_PATH)/make/project.mk - -FLASHING_SCRIPT=$(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py - -$(FLASHING_SCRIPT): $(APP_BIN) $(BOOTLOADER_BIN) $(PARTITION_TABLE_BIN) $(PROJECT_PATH)/sdkconfig - @third_party/connectedhomeip/scripts/flashing/gen_flashing_script.py esp32 \ - --output $(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py \ - --port $(ESPPORT) --baud $(ESPBAUD) --before $(CONFIG_ESPTOOLPY_BEFORE) --after $(CONFIG_ESPTOOLPY_AFTER) \ - --application $(subst $(BUILD_DIR_BASE)/,,$(APP_BIN)) \ - --bootloader $(subst $(BUILD_DIR_BASE)/,,$(BOOTLOADER_BIN)) \ - --partition $(subst $(BUILD_DIR_BASE)/,,$(PARTITION_TABLE_BIN)) \ - --use-partition-file $(PARTITION_TABLE_BIN) \ - --use-parttool $(IDF_PATH)/components/partition_table/parttool.py \ - --use-sdkconfig $(PROJECT_PATH)/sdkconfig - -flashing_script: $(FLASHING_SCRIPT) $(BUILD_DIR_BASE)/esp32_firmware_utils.py $(BUILD_DIR_BASE)/firmware_utils.py - @echo To flash $(subst $(CURDIR)/,,$(APP_BIN)), run $(subst $(CURDIR)/,,$(FLASHING_SCRIPT)) - -$(BUILD_DIR_BASE)/esp32_firmware_utils.py: third_party/connectedhomeip/scripts/flashing/esp32_firmware_utils.py - @cp $< $@ - -$(BUILD_DIR_BASE)/firmware_utils.py: third_party/connectedhomeip/scripts/flashing/firmware_utils.py - @cp $< $@ - -.PHONY: flashing_script diff --git a/examples/persistent-storage/esp32/idf.sh b/examples/persistent-storage/esp32/idf.sh deleted file mode 100755 index b65c8211d290a8..00000000000000 --- a/examples/persistent-storage/esp32/idf.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -# If this file is sourced, it exports a function called "idf" that initializes -# the espressif environment via the espressive export.sh script and runs -# a command presented as arguments -# -# This file can also be used as an executable - -error() { - echo "$me: *** ERROR: " "${*}" -} - -idf() { - [[ -d $IDF_PATH && -r $IDF_PATH/export.sh ]] || { - error "can't find IDF's export.sh, please set IDF_PATH" - return 1 - } - ( - # shellcheck source=/dev/null - . "$IDF_PATH/export.sh" - export IDF_PATH - "$@" - ) -} -if [[ ${0} == "${BASH_SOURCE[0]}" ]]; then - me=${0##*/} - idf "${@}" -else - me=idf - [[ $PS1 =~ \[idf\].* ]] || PS1="[idf]$PS1" -fi diff --git a/examples/persistent-storage/esp32/main/component.mk b/examples/persistent-storage/esp32/main/component.mk deleted file mode 100644 index 8bb2308432f4e1..00000000000000 --- a/examples/persistent-storage/esp32/main/component.mk +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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. -# -# Description: -# Component makefile for the ESP32 persistent-storage example. -# - -COMPONENT_DEPENDS := chip - -COMPONENT_SRCDIRS := \ - . \ - ../.. - -COMPONENT_PRIV_INCLUDEDIRS := \ - . \ - ../.. diff --git a/examples/pigweed-app/esp32/Makefile b/examples/pigweed-app/esp32/Makefile deleted file mode 100644 index 363bb153f6a778..00000000000000 --- a/examples/pigweed-app/esp32/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -# -# 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. - -# -# This is a project Makefile. It is assumed the directory this Makefile resides in is a -# project subdirectory. -# - -PROJECT_NAME := chip-pigweed-app - -EXTRA_COMPONENT_DIRS += $(PROJECT_PATH)/third_party/connectedhomeip/config/esp32/components \ - -CXXFLAGS += -std=gnu++17 -Os -DLWIP_IPV6_SCOPES=0 -CPPFLAGS += -Os -DLWIP_IPV6_SCOPES=0 -DCHIP_HAVE_CONFIG_H -CFLAGS += -Os -DLWIP_IPV6_SCOPES=0 - -top: all flashing_script - -include $(IDF_PATH)/make/project.mk - -FLASHING_SCRIPT=$(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py - -$(FLASHING_SCRIPT): $(APP_BIN) $(BOOTLOADER_BIN) $(PARTITION_TABLE_BIN) $(PROJECT_PATH)/sdkconfig - @third_party/connectedhomeip/scripts/flashing/gen_flashing_script.py esp32 \ - --output $(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py \ - --port $(ESPPORT) --baud $(ESPBAUD) --before $(CONFIG_ESPTOOLPY_BEFORE) --after $(CONFIG_ESPTOOLPY_AFTER) \ - --application $(subst $(BUILD_DIR_BASE)/,,$(APP_BIN)) \ - --bootloader $(subst $(BUILD_DIR_BASE)/,,$(BOOTLOADER_BIN)) \ - --partition $(subst $(BUILD_DIR_BASE)/,,$(PARTITION_TABLE_BIN)) \ - --use-partition-file $(PARTITION_TABLE_BIN) \ - --use-parttool $(IDF_PATH)/components/partition_table/parttool.py \ - --use-sdkconfig $(PROJECT_PATH)/sdkconfig - -flashing_script: $(FLASHING_SCRIPT) $(BUILD_DIR_BASE)/esp32_firmware_utils.py $(BUILD_DIR_BASE)/firmware_utils.py $(BUILD_DIR_BASE)/echo_test.py $(BUILD_DIR_BASE)/echo_test_config.yml - @echo To flash $(subst $(CURDIR)/,,$(APP_BIN)), run $(subst $(CURDIR)/,,$(FLASHING_SCRIPT)) - -$(BUILD_DIR_BASE)/esp32_firmware_utils.py: third_party/connectedhomeip/scripts/flashing/esp32_firmware_utils.py - echo "Copying esp32_firmware_utils.py" - @cp $< $@ - -$(BUILD_DIR_BASE)/firmware_utils.py: third_party/connectedhomeip/scripts/flashing/firmware_utils.py - echo "Copying firmware_utils.py" - @cp $< $@ - -$(BUILD_DIR_BASE)/echo_test.py: ../mobly_tests/echo_test.py - echo "Copying echo_test.py" - @cp $< $@ - -$(BUILD_DIR_BASE)/echo_test_config.yml: ./echo_test_config.yml - echo "Copying echo_test_config.yml" - @cp $< $@ - -.PHONY: flashing_script diff --git a/examples/pigweed-app/esp32/idf.sh b/examples/pigweed-app/esp32/idf.sh deleted file mode 100755 index b65c8211d290a8..00000000000000 --- a/examples/pigweed-app/esp32/idf.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -# If this file is sourced, it exports a function called "idf" that initializes -# the espressif environment via the espressive export.sh script and runs -# a command presented as arguments -# -# This file can also be used as an executable - -error() { - echo "$me: *** ERROR: " "${*}" -} - -idf() { - [[ -d $IDF_PATH && -r $IDF_PATH/export.sh ]] || { - error "can't find IDF's export.sh, please set IDF_PATH" - return 1 - } - ( - # shellcheck source=/dev/null - . "$IDF_PATH/export.sh" - export IDF_PATH - "$@" - ) -} -if [[ ${0} == "${BASH_SOURCE[0]}" ]]; then - me=${0##*/} - idf "${@}" -else - me=idf - [[ $PS1 =~ \[idf\].* ]] || PS1="[idf]$PS1" -fi diff --git a/examples/pigweed-app/esp32/main/component.mk b/examples/pigweed-app/esp32/main/component.mk deleted file mode 100644 index 55c610766ee5ac..00000000000000 --- a/examples/pigweed-app/esp32/main/component.mk +++ /dev/null @@ -1,74 +0,0 @@ -# -# 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. -# -# Description: -# Component makefile for the ESP32 demo application. -# -# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) - -COMPONENT_DEPENDS := chip - -COMPONENT_SRCDIRS := \ - . \ - ../../../common/pigweed \ - ../../../common/pigweed/esp32 \ - ../../../platform/esp32 \ - -COMPONENT_ADD_INCLUDEDIRS += ../third_party/connectedhomeip/third_party/pigweed/repo/pw_sys_io/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_assert/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_assert_log/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_assert_log/public_overrides \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_bytes/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_checksum/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_containers/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_hdlc/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_log/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_log_basic/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_log_basic/public_overrides \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_span/public_overrides \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_span/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_polyfill/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_polyfill/standard_library_public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_polyfill/public_overrides \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/nanopb/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/raw/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_protobuf/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_status/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_stream/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_result/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_varint/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_preprocessor/public \ - ../third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/system_server/public \ - ../third_party/connectedhomeip/third_party/nanopb/repo \ - ../../../platform/esp32/pw_sys_io/public \ - ../../../platform/esp32 \ - ../../../common/pigweed \ - ../../../common/pigweed/esp32 \ - ../build/chip/protocol_buffer/gen/third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/protos.proto_library/nanopb \ - ../build/chip/protocol_buffer/gen/third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/protos.proto_library/nanopb_rpc \ - ../build/chip/protocol_buffer/gen/third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/protos.proto_library/pwpb \ - ../../../../src/lib/support \ - -COMPONENT_EXTRA_INCLUDES := ${IDF_PATH}/components/freertos/include/freertos/ \ - -# So "gen/*" files are found by the src/app bits. -COMPONENT_PRIV_INCLUDEDIRS := . - -WRAP_FUNCTIONS = esp_log_write -WRAP_ARGUMENT := -Wl,--wrap= - -COMPONENT_ADD_LDFLAGS = -l$(COMPONENT_NAME) $(addprefix $(WRAP_ARGUMENT),$(WRAP_FUNCTIONS)) diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index 59ab87db15c1cf..d0e942746960e9 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -68,7 +68,11 @@ int ChipLinuxAppInit(int argc, char ** argv) SuccessOrExit(err); ConfigurationMgr().LogDeviceConfig(); +#ifdef CONFIG_RENDEZVOUS_MODE + PrintOnboardingCodes(static_cast(CONFIG_RENDEZVOUS_MODE)); +#else PrintOnboardingCodes(chip::RendezvousInformationFlag::kBLE); +#endif #if defined(PW_RPC_ENABLED) chip::rpc::Init(); diff --git a/examples/platform/linux/BUILD.gn b/examples/platform/linux/BUILD.gn index 89157f9f945ef6..719faa898d5382 100644 --- a/examples/platform/linux/BUILD.gn +++ b/examples/platform/linux/BUILD.gn @@ -14,12 +14,14 @@ import("//build_overrides/chip.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") +import("${chip_root}/src/app/common_flags.gni") config("app-main-config") { include_dirs = [ "." ] } source_set("app-main") { + defines = [] sources = [ "AppMain.cpp", "AppMain.h", @@ -32,6 +34,10 @@ source_set("app-main") { if (chip_enable_pw_rpc) { defines += [ "PW_RPC_ENABLED" ] } + if (chip_ip_commissioning) { + # BLE and on-network. Code defaults to BLE if this is not set. + defines += [ "CONFIG_RENDEZVOUS_MODE=6" ] + } public_deps = [ "${chip_root}/src/app/server", diff --git a/examples/pump-app/pump-common/gen/endpoint_config.h b/examples/pump-app/pump-common/gen/endpoint_config.h index 021f18a3fb5e99..dc505f8e4df6da 100644 --- a/examples/pump-app/pump-common/gen/endpoint_config.h +++ b/examples/pump-app/pump-common/gen/endpoint_config.h @@ -27,7 +27,7 @@ #define GENERATED_DEFAULTS \ { \ \ - /* Endpoint: 1, Cluster: Basic (server), big-endian */ \ + /* Endpoint: 0, Cluster: Basic (server), big-endian */ \ \ /* 0 - VendorName, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -59,7 +59,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: General Commissioning (server), big-endian */ \ + /* Endpoint: 0, Cluster: General Commissioning (server), big-endian */ \ \ /* 244 - FabricId, */ \ 1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -67,7 +67,7 @@ /* 252 - Breadcrumb, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: General Diagnostics (server), big-endian */ \ + /* Endpoint: 0, Cluster: General Diagnostics (server), big-endian */ \ \ /* 260 - NetworkInterfaces, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -85,12 +85,12 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Software Diagnostics (server), big-endian */ \ + /* Endpoint: 0, Cluster: Software Diagnostics (server), big-endian */ \ \ /* 514 - CurrentHeapHighWatermark, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Thread Network Diagnostics (server), big-endian */ \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server), big-endian */ \ \ /* 522 - NetworkName, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -244,12 +244,12 @@ /* 1219 - ActiveNetworkFaultsList, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: WiFi Network Diagnostics (server), big-endian */ \ + /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server), big-endian */ \ \ /* 1223 - bssid, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ /* 1229 - PacketRxCount, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -266,7 +266,7 @@ /* 1261 - OverrunCount, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Operational Credentials (server), big-endian */ \ + /* Endpoint: 0, Cluster: Operational Credentials (server), big-endian */ \ \ /* 1269 - fabrics list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -289,7 +289,7 @@ #define GENERATED_DEFAULTS \ { \ \ - /* Endpoint: 1, Cluster: Basic (server), little-endian */ \ + /* Endpoint: 0, Cluster: Basic (server), little-endian */ \ \ /* 0 - VendorName, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -321,7 +321,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: General Commissioning (server), little-endian */ \ + /* Endpoint: 0, Cluster: General Commissioning (server), little-endian */ \ \ /* 244 - FabricId, */ \ 1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -329,7 +329,7 @@ /* 252 - Breadcrumb, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: General Diagnostics (server), little-endian */ \ + /* Endpoint: 0, Cluster: General Diagnostics (server), little-endian */ \ \ /* 260 - NetworkInterfaces, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -347,12 +347,12 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Software Diagnostics (server), little-endian */ \ + /* Endpoint: 0, Cluster: Software Diagnostics (server), little-endian */ \ \ /* 514 - CurrentHeapHighWatermark, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Thread Network Diagnostics (server), little-endian */ \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server), little-endian */ \ \ /* 522 - NetworkName, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -506,12 +506,12 @@ /* 1219 - ActiveNetworkFaultsList, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: WiFi Network Diagnostics (server), little-endian */ \ + /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server), little-endian */ \ \ /* 1223 - bssid, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ /* 1229 - PacketRxCount, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -528,7 +528,7 @@ /* 1261 - OverrunCount, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Operational Credentials (server), little-endian */ \ + /* Endpoint: 0, Cluster: Operational Credentials (server), little-endian */ \ \ /* 1269 - fabrics list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -581,15 +581,15 @@ #define GENERATED_ATTRIBUTES \ { \ \ - /* Endpoint: 1, Cluster: On/off (server) */ \ + /* Endpoint: 0, Cluster: On/off (server) */ \ { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* on/off */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Level Control (server) */ \ + /* Endpoint: 0, Cluster: Level Control (server) */ \ { 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current level */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Basic (server) */ \ + /* Endpoint: 0, Cluster: Basic (server) */ \ { 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* InteractionModelVersion */ \ { 0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(0) }, /* VendorName */ \ { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* VendorID */ \ @@ -607,24 +607,24 @@ ZAP_LONG_DEFAULTS_INDEX(180) }, /* SoftwareVersionString */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: General Commissioning (server) */ \ + /* Endpoint: 0, Cluster: General Commissioning (server) */ \ { 0x0000, ZAP_TYPE(OCTET_STRING), 8, 0, ZAP_LONG_DEFAULTS_INDEX(244) }, /* FabricId */ \ { 0x0001, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(252) }, /* Breadcrumb */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Network Commissioning (server) */ \ + /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: General Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(260) }, /* NetworkInterfaces */ \ { 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RebootCount */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Software Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ { 0x0003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(514) }, /* CurrentHeapHighWatermark */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Thread Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ { 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* channel */ \ { 0x0001, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* RoutingRole */ \ { 0x0002, ZAP_TYPE(OCTET_STRING), 16, 0, ZAP_LONG_DEFAULTS_INDEX(522) }, /* NetworkName */ \ @@ -687,7 +687,7 @@ { 0x003E, ZAP_TYPE(ARRAY), 4, 0, ZAP_LONG_DEFAULTS_INDEX(1219) }, /* ActiveNetworkFaultsList */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ { 0x0000, ZAP_TYPE(OCTET_STRING), 6, 0, ZAP_LONG_DEFAULTS_INDEX(1223) }, /* bssid */ \ { 0x0001, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* SecurityType */ \ { 0x0002, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* WiFiVersion */ \ @@ -695,7 +695,7 @@ { 0x0004, ZAP_TYPE(INT8S), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Rssi */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Ethernet Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ { 0x0002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(1229) }, /* PacketRxCount */ \ { 0x0003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(1237) }, /* PacketTxCount */ \ { 0x0004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(1245) }, /* TxErrCount */ \ @@ -703,11 +703,11 @@ { 0x0006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(1261) }, /* OverrunCount */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Operational Credentials (server) */ \ + /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(1269) }, /* fabrics list */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Trusted Root Certificates (server) */ \ + /* Endpoint: 0, Cluster: Trusted Root Certificates (server) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Pump Configuration and Control (server) */ \ @@ -756,46 +756,46 @@ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer \ - }, /* Endpoint: 1, Cluster: On/off (server) */ \ + }, /* Endpoint: 0, Cluster: On/off (server) */ \ { 0x0008, \ ZAP_ATTRIBUTE_INDEX(2), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ - chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */ \ + chipFuncArrayLevelControlServer }, /* Endpoint: 0, Cluster: Level Control (server) */ \ { 0x0028, \ ZAP_ATTRIBUTE_INDEX(4), \ 12, \ 254, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ - chipFuncArrayBasicServer }, /* Endpoint: 1, Cluster: Basic (server) */ \ + chipFuncArrayBasicServer }, /* Endpoint: 0, Cluster: Basic (server) */ \ { \ 0x0030, ZAP_ATTRIBUTE_INDEX(16), 3, 18, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: General Commissioning (server) */ \ + }, /* Endpoint: 0, Cluster: General Commissioning (server) */ \ { \ 0x0031, ZAP_ATTRIBUTE_INDEX(19), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Network Commissioning (server) */ \ + }, /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ { \ 0x0033, ZAP_ATTRIBUTE_INDEX(20), 3, 258, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: General Diagnostics (server) */ \ + }, /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ { \ 0x0034, ZAP_ATTRIBUTE_INDEX(23), 2, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Software Diagnostics (server) */ \ + }, /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ { \ 0x0035, ZAP_ATTRIBUTE_INDEX(25), 61, 730, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Thread Network Diagnostics (server) */ \ + }, /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ { \ 0x0036, ZAP_ATTRIBUTE_INDEX(86), 6, 13, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: WiFi Network Diagnostics (server) */ \ + }, /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ { \ 0x0037, ZAP_ATTRIBUTE_INDEX(92), 6, 42, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Ethernet Network Diagnostics (server) */ \ + }, /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ { \ 0x003E, ZAP_ATTRIBUTE_INDEX(98), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Operational Credentials (server) */ \ + }, /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { \ 0x003F, ZAP_ATTRIBUTE_INDEX(100), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Trusted Root Certificates (server) */ \ + }, /* Endpoint: 0, Cluster: Trusted Root Certificates (server) */ \ { \ 0x0200, ZAP_ATTRIBUTE_INDEX(101), 8, 13, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Pump Configuration and Control (server) */ \ @@ -812,7 +812,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 15, 1614 }, \ + { ZAP_CLUSTER_INDEX(0), 12, 1591 }, { ZAP_CLUSTER_INDEX(12), 3, 23 }, \ } // Largest attribute size is needed for various buffers @@ -825,43 +825,43 @@ #define ATTRIBUTE_MAX_SIZE (1614) // Number of fixed endpoints -#define FIXED_ENDPOINT_COUNT (1) +#define FIXED_ENDPOINT_COUNT (2) // Array of endpoints that are supported, the data inside // the array is the endpoint number. #define FIXED_ENDPOINT_ARRAY \ { \ - 0x0001 \ + 0x0000, 0x0001 \ } // Array of profile ids #define FIXED_PROFILE_IDS \ { \ - 0x0999 \ + 0x0999, 0x0999 \ } // Array of device ids #define FIXED_DEVICE_IDS \ { \ - 0 \ + 0, 0 \ } // Array of device versions #define FIXED_DEVICE_VERSIONS \ { \ - 1 \ + 1, 1 \ } // Array of endpoint types supported on each endpoint #define FIXED_ENDPOINT_TYPES \ { \ - 0 \ + 0, 1 \ } // Array of networks supported on each endpoint #define FIXED_NETWORKS \ { \ - 0 \ + 0, 0 \ } // Array of EmberAfCommandMetadata structs. @@ -870,12 +870,12 @@ #define GENERATED_COMMANDS \ { \ \ - /* Endpoint: 1, Cluster: On/off (server) */ \ + /* Endpoint: 0, Cluster: On/off (server) */ \ { 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Off */ \ { 0x0006, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On */ \ { 0x0006, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Toggle */ \ \ - /* Endpoint: 1, Cluster: Level Control (server) */ \ + /* Endpoint: 0, Cluster: Level Control (server) */ \ { 0x0008, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToLevel */ \ { 0x0008, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Move */ \ { 0x0008, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Step */ \ @@ -885,13 +885,13 @@ { 0x0008, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepWithOnOff */ \ { 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StopWithOnOff */ \ \ - /* Endpoint: 1, Cluster: Basic (server) */ \ + /* Endpoint: 0, Cluster: Basic (server) */ \ { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* StartUp */ \ { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ShutDown */ \ { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Leave */ \ { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MfgSpecificPing */ \ \ - /* Endpoint: 1, Cluster: General Commissioning (server) */ \ + /* Endpoint: 0, Cluster: General Commissioning (server) */ \ { 0x0030, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ArmFailSafe */ \ { 0x0030, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ArmFailSafeResponse */ \ { 0x0030, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetRegulatoryConfig */ \ @@ -899,7 +899,7 @@ { 0x0030, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* CommissioningComplete */ \ { 0x0030, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* CommissioningCompleteResponse */ \ \ - /* Endpoint: 1, Cluster: Network Commissioning (server) */ \ + /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ { 0x0031, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ScanNetworks */ \ { 0x0031, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ScanNetworksResponse */ \ { 0x0031, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddWiFiNetwork */ \ @@ -918,16 +918,16 @@ { 0x0031, 0x0F, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* DisableNetworkResponse */ \ { 0x0031, 0x10, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* GetLastNetworkCommissioningResult */ \ \ - /* Endpoint: 1, Cluster: Software Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ { 0x0034, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ResetWatermarks */ \ \ - /* Endpoint: 1, Cluster: Thread Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ { 0x0035, 0x00, 0 }, /* ResetCounts */ \ \ - /* Endpoint: 1, Cluster: Ethernet Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ { 0x0037, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ResetCounts */ \ \ - /* Endpoint: 1, Cluster: Operational Credentials (server) */ \ + /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { 0x003E, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetFabric */ \ { 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* SetFabricResponse */ \ { 0x003E, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* OpCSRRequest */ \ @@ -938,7 +938,7 @@ { 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \ { 0x003E, 0x0B, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveAllFabrics */ \ \ - /* Endpoint: 1, Cluster: Trusted Root Certificates (server) */ \ + /* Endpoint: 0, Cluster: Trusted Root Certificates (server) */ \ { 0x003F, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddTrustedRootCertificate */ \ { 0x003F, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveTrustedRootCertificate */ \ } @@ -980,9 +980,9 @@ #define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS \ { \ \ - /* Endpoint: 1, Cluster: Level Control (server) */ \ + /* Endpoint: 0, Cluster: Level Control (server) */ \ { \ - ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0008, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ + ZAP_REPORT_DIRECTION(REPORTED), 0x0000, 0x0008, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ }, /* current level */ \ \ /* Endpoint: 1, Cluster: Pump Configuration and Control (server) */ \ diff --git a/examples/pump-app/pump-common/pump-app.zap b/examples/pump-app/pump-common/pump-app.zap index 19d192950ed6f3..68a8a82bbc0303 100644 --- a/examples/pump-app/pump-common/pump-app.zap +++ b/examples/pump-app/pump-common/pump-app.zap @@ -2926,6 +2926,1502 @@ } ] }, + { + "name": "Pump Configuration and Control", + "code": 512, + "mfgCode": null, + "define": "PUMP_CONFIG_CONTROL_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "max pressure", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max speed", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max flow", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "pump status", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "effective operation mode", + "code": 17, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "effective control mode", + "code": 18, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "capacity", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "operation mode", + "code": 32, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Temperature Measurement", + "code": 1026, + "mfgCode": null, + "define": "TEMP_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Temperature Measurement", + "code": 1026, + "mfgCode": null, + "define": "TEMP_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "measured value", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x8000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "min measured value", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x8000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max measured value", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x8000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "tolerance", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Pressure Measurement", + "code": 1027, + "mfgCode": null, + "define": "PRESSURE_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Pressure Measurement", + "code": 1027, + "mfgCode": null, + "define": "PRESSURE_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "measured value", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "min measured value", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max measured value", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "tolerance", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "scaled value", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "scaled tolerance", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Flow Measurement", + "code": 1028, + "mfgCode": null, + "define": "FLOW_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Flow Measurement", + "code": 1028, + "mfgCode": null, + "define": "FLOW_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "measured value", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "min measured value", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max measured value", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "tolerance", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + } + ] + }, + { + "name": "Anonymous Endpoint Type", + "deviceTypeName": "Pump", + "deviceTypeCode": 771, + "deviceTypeProfileId": 2457, + "clusters": [ + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "IdentifyQuery", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "IdentifyQueryResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "identify time", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "AddGroup", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ViewGroup", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetGroupMembership", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveGroup", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveAllGroups", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "AddGroupIfIdentifying", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "AddGroupResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ViewGroupResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetGroupMembershipResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveGroupResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "name support", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Scenes", + "code": 5, + "mfgCode": null, + "define": "SCENES_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "AddScene", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ViewScene", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveScene", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveAllScenes", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "StoreScene", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RecallScene", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetSceneMembership", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Scenes", + "code": 5, + "mfgCode": null, + "define": "SCENES_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "AddSceneResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ViewSceneResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveSceneResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveAllScenesResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "StoreSceneResponse", + "code": 4, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetSceneMembershipResponse", + "code": 6, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "scene count", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current scene", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current group", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "scene valid", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "name support", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "On/off", + "code": 6, + "mfgCode": null, + "define": "ON_OFF_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "Off", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "On", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "Toggle", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "On/off", + "code": 6, + "mfgCode": null, + "define": "ON_OFF_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "on/off", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Level Control", + "code": 8, + "mfgCode": null, + "define": "LEVEL_CONTROL_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "MoveToLevel", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "Move", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "Step", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "Stop", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "MoveToLevelWithOnOff", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "MoveWithOnOff", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "StepWithOnOff", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "StopWithOnOff", + "code": 7, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Level Control", + "code": 8, + "mfgCode": null, + "define": "LEVEL_CONTROL_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "current level", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Basic", + "code": 40, + "mfgCode": null, + "define": "BASIC_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "MfgSpecificPing", + "code": 0, + "mfgCode": 4098, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Basic", + "code": 40, + "mfgCode": null, + "define": "BASIC_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "StartUp", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ShutDown", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "Leave", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "InteractionModelVersion", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorName", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorID", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductName", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductID", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UserLabel", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Location", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersion", + "code": 7, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersionString", + "code": 8, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersion", + "code": 9, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersionString", + "code": 10, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Pump Configuration and Control", + "code": 512, + "mfgCode": null, + "define": "PUMP_CONFIG_CONTROL_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Pump Configuration and Control", "code": 512, @@ -3446,6 +4942,15 @@ "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 0, "profileId": 2457, + "endpointId": 0, + "networkId": 0, + "endpointVersion": 1, + "deviceIdentifier": null + }, + { + "endpointTypeName": "Anonymous Endpoint Type", + "endpointTypeIndex": 1, + "profileId": 2457, "endpointId": 1, "networkId": 0, "endpointVersion": 1, diff --git a/examples/pump-controller-app/pump-controller-common/gen/endpoint_config.h b/examples/pump-controller-app/pump-controller-common/gen/endpoint_config.h index f92839472c68d5..d6dbfb56abfe14 100644 --- a/examples/pump-controller-app/pump-controller-common/gen/endpoint_config.h +++ b/examples/pump-controller-app/pump-controller-common/gen/endpoint_config.h @@ -27,7 +27,7 @@ #define GENERATED_DEFAULTS \ { \ \ - /* Endpoint: 1, Cluster: Basic (server), big-endian */ \ + /* Endpoint: 0, Cluster: Basic (server), big-endian */ \ \ /* 0 - VendorName, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -59,7 +59,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: General Commissioning (server), big-endian */ \ + /* Endpoint: 0, Cluster: General Commissioning (server), big-endian */ \ \ /* 244 - FabricId, */ \ 1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -67,7 +67,7 @@ /* 252 - Breadcrumb, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: General Diagnostics (server), big-endian */ \ + /* Endpoint: 0, Cluster: General Diagnostics (server), big-endian */ \ \ /* 260 - NetworkInterfaces, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -85,12 +85,12 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Software Diagnostics (server), big-endian */ \ + /* Endpoint: 0, Cluster: Software Diagnostics (server), big-endian */ \ \ /* 514 - CurrentHeapHighWatermark, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Thread Network Diagnostics (server), big-endian */ \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server), big-endian */ \ \ /* 522 - NetworkName, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -244,12 +244,12 @@ /* 1219 - ActiveNetworkFaultsList, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: WiFi Network Diagnostics (server), big-endian */ \ + /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server), big-endian */ \ \ /* 1223 - bssid, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ /* 1229 - PacketRxCount, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -266,7 +266,7 @@ /* 1261 - OverrunCount, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Operational Credentials (server), big-endian */ \ + /* Endpoint: 0, Cluster: Operational Credentials (server), big-endian */ \ \ /* 1269 - fabrics list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -289,7 +289,7 @@ #define GENERATED_DEFAULTS \ { \ \ - /* Endpoint: 1, Cluster: Basic (server), little-endian */ \ + /* Endpoint: 0, Cluster: Basic (server), little-endian */ \ \ /* 0 - VendorName, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -321,7 +321,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: General Commissioning (server), little-endian */ \ + /* Endpoint: 0, Cluster: General Commissioning (server), little-endian */ \ \ /* 244 - FabricId, */ \ 1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -329,7 +329,7 @@ /* 252 - Breadcrumb, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: General Diagnostics (server), little-endian */ \ + /* Endpoint: 0, Cluster: General Diagnostics (server), little-endian */ \ \ /* 260 - NetworkInterfaces, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -347,12 +347,12 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Software Diagnostics (server), little-endian */ \ + /* Endpoint: 0, Cluster: Software Diagnostics (server), little-endian */ \ \ /* 514 - CurrentHeapHighWatermark, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Thread Network Diagnostics (server), little-endian */ \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server), little-endian */ \ \ /* 522 - NetworkName, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -506,12 +506,12 @@ /* 1219 - ActiveNetworkFaultsList, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: WiFi Network Diagnostics (server), little-endian */ \ + /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server), little-endian */ \ \ /* 1223 - bssid, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ /* 1229 - PacketRxCount, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -528,7 +528,7 @@ /* 1261 - OverrunCount, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 1, Cluster: Operational Credentials (server), little-endian */ \ + /* Endpoint: 0, Cluster: Operational Credentials (server), little-endian */ \ \ /* 1269 - fabrics list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -581,13 +581,13 @@ #define GENERATED_ATTRIBUTES \ { \ \ - /* Endpoint: 1, Cluster: On/off (client) */ \ + /* Endpoint: 0, Cluster: On/off (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Level Control (client) */ \ + /* Endpoint: 0, Cluster: Level Control (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Basic (server) */ \ + /* Endpoint: 0, Cluster: Basic (server) */ \ { 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* InteractionModelVersion */ \ { 0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(0) }, /* VendorName */ \ { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* VendorID */ \ @@ -605,24 +605,24 @@ ZAP_LONG_DEFAULTS_INDEX(180) }, /* SoftwareVersionString */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: General Commissioning (server) */ \ + /* Endpoint: 0, Cluster: General Commissioning (server) */ \ { 0x0000, ZAP_TYPE(OCTET_STRING), 8, 0, ZAP_LONG_DEFAULTS_INDEX(244) }, /* FabricId */ \ { 0x0001, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(252) }, /* Breadcrumb */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Network Commissioning (server) */ \ + /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: General Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(260) }, /* NetworkInterfaces */ \ { 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RebootCount */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Software Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ { 0x0003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(514) }, /* CurrentHeapHighWatermark */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Thread Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ { 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* channel */ \ { 0x0001, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* RoutingRole */ \ { 0x0002, ZAP_TYPE(OCTET_STRING), 16, 0, ZAP_LONG_DEFAULTS_INDEX(522) }, /* NetworkName */ \ @@ -685,7 +685,7 @@ { 0x003E, ZAP_TYPE(ARRAY), 4, 0, ZAP_LONG_DEFAULTS_INDEX(1219) }, /* ActiveNetworkFaultsList */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ { 0x0000, ZAP_TYPE(OCTET_STRING), 6, 0, ZAP_LONG_DEFAULTS_INDEX(1223) }, /* bssid */ \ { 0x0001, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* SecurityType */ \ { 0x0002, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* WiFiVersion */ \ @@ -693,7 +693,7 @@ { 0x0004, ZAP_TYPE(INT8S), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Rssi */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Ethernet Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ { 0x0002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(1229) }, /* PacketRxCount */ \ { 0x0003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(1237) }, /* PacketTxCount */ \ { 0x0004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(1245) }, /* TxErrCount */ \ @@ -701,11 +701,11 @@ { 0x0006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(1261) }, /* OverrunCount */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Operational Credentials (server) */ \ + /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(1269) }, /* fabrics list */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ - /* Endpoint: 1, Cluster: Trusted Root Certificates (server) */ \ + /* Endpoint: 0, Cluster: Trusted Root Certificates (server) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Pump Configuration and Control (client) */ \ @@ -734,43 +734,43 @@ #define GENERATED_CLUSTER_COUNT 15 #define GENERATED_CLUSTERS \ { \ - { 0x0006, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: On/off (client) */ \ + { 0x0006, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 0, Cluster: On/off (client) */ \ { \ 0x0008, ZAP_ATTRIBUTE_INDEX(1), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ - }, /* Endpoint: 1, Cluster: Level Control (client) */ \ + }, /* Endpoint: 0, Cluster: Level Control (client) */ \ { 0x0028, \ ZAP_ATTRIBUTE_INDEX(2), \ 12, \ 254, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ - chipFuncArrayBasicServer }, /* Endpoint: 1, Cluster: Basic (server) */ \ + chipFuncArrayBasicServer }, /* Endpoint: 0, Cluster: Basic (server) */ \ { \ 0x0030, ZAP_ATTRIBUTE_INDEX(14), 3, 18, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: General Commissioning (server) */ \ + }, /* Endpoint: 0, Cluster: General Commissioning (server) */ \ { \ 0x0031, ZAP_ATTRIBUTE_INDEX(17), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Network Commissioning (server) */ \ + }, /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ { \ 0x0033, ZAP_ATTRIBUTE_INDEX(18), 3, 258, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: General Diagnostics (server) */ \ + }, /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ { \ 0x0034, ZAP_ATTRIBUTE_INDEX(21), 2, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Software Diagnostics (server) */ \ + }, /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ { \ 0x0035, ZAP_ATTRIBUTE_INDEX(23), 61, 730, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Thread Network Diagnostics (server) */ \ + }, /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ { \ 0x0036, ZAP_ATTRIBUTE_INDEX(84), 6, 13, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: WiFi Network Diagnostics (server) */ \ + }, /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ { \ 0x0037, ZAP_ATTRIBUTE_INDEX(90), 6, 42, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Ethernet Network Diagnostics (server) */ \ + }, /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ { \ 0x003E, ZAP_ATTRIBUTE_INDEX(96), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Operational Credentials (server) */ \ + }, /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { \ 0x003F, ZAP_ATTRIBUTE_INDEX(98), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ - }, /* Endpoint: 1, Cluster: Trusted Root Certificates (server) */ \ + }, /* Endpoint: 0, Cluster: Trusted Root Certificates (server) */ \ { \ 0x0200, ZAP_ATTRIBUTE_INDEX(99), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Pump Configuration and Control (client) */ \ @@ -787,7 +787,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 15, 1601 }, \ + { ZAP_CLUSTER_INDEX(0), 12, 1589 }, { ZAP_CLUSTER_INDEX(12), 3, 12 }, \ } // Largest attribute size is needed for various buffers @@ -800,43 +800,43 @@ #define ATTRIBUTE_MAX_SIZE (1601) // Number of fixed endpoints -#define FIXED_ENDPOINT_COUNT (1) +#define FIXED_ENDPOINT_COUNT (2) // Array of endpoints that are supported, the data inside // the array is the endpoint number. #define FIXED_ENDPOINT_ARRAY \ { \ - 0x0001 \ + 0x0000, 0x0001 \ } // Array of profile ids #define FIXED_PROFILE_IDS \ { \ - 0x0999 \ + 0x0999, 0x0999 \ } // Array of device ids #define FIXED_DEVICE_IDS \ { \ - 0 \ + 0, 0 \ } // Array of device versions #define FIXED_DEVICE_VERSIONS \ { \ - 1 \ + 1, 1 \ } // Array of endpoint types supported on each endpoint #define FIXED_ENDPOINT_TYPES \ { \ - 0 \ + 0, 1 \ } // Array of networks supported on each endpoint #define FIXED_NETWORKS \ { \ - 0 \ + 0, 0 \ } // Array of EmberAfCommandMetadata structs. @@ -845,12 +845,12 @@ #define GENERATED_COMMANDS \ { \ \ - /* Endpoint: 1, Cluster: On/off (client) */ \ + /* Endpoint: 0, Cluster: On/off (client) */ \ { 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Off */ \ { 0x0006, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On */ \ { 0x0006, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Toggle */ \ \ - /* Endpoint: 1, Cluster: Level Control (client) */ \ + /* Endpoint: 0, Cluster: Level Control (client) */ \ { 0x0008, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToLevel */ \ { 0x0008, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Move */ \ { 0x0008, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Step */ \ @@ -860,13 +860,13 @@ { 0x0008, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepWithOnOff */ \ { 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StopWithOnOff */ \ \ - /* Endpoint: 1, Cluster: Basic (server) */ \ + /* Endpoint: 0, Cluster: Basic (server) */ \ { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* StartUp */ \ { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ShutDown */ \ { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Leave */ \ { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MfgSpecificPing */ \ \ - /* Endpoint: 1, Cluster: General Commissioning (server) */ \ + /* Endpoint: 0, Cluster: General Commissioning (server) */ \ { 0x0030, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ArmFailSafe */ \ { 0x0030, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ArmFailSafeResponse */ \ { 0x0030, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetRegulatoryConfig */ \ @@ -874,7 +874,7 @@ { 0x0030, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* CommissioningComplete */ \ { 0x0030, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* CommissioningCompleteResponse */ \ \ - /* Endpoint: 1, Cluster: Network Commissioning (server) */ \ + /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ { 0x0031, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ScanNetworks */ \ { 0x0031, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ScanNetworksResponse */ \ { 0x0031, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddWiFiNetwork */ \ @@ -893,16 +893,16 @@ { 0x0031, 0x0F, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* DisableNetworkResponse */ \ { 0x0031, 0x10, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* GetLastNetworkCommissioningResult */ \ \ - /* Endpoint: 1, Cluster: Software Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ { 0x0034, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ResetWatermarks */ \ \ - /* Endpoint: 1, Cluster: Thread Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ { 0x0035, 0x00, 0 }, /* ResetCounts */ \ \ - /* Endpoint: 1, Cluster: Ethernet Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ { 0x0037, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ResetCounts */ \ \ - /* Endpoint: 1, Cluster: Operational Credentials (server) */ \ + /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { 0x003E, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetFabric */ \ { 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* SetFabricResponse */ \ { 0x003E, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* OpCSRRequest */ \ @@ -913,7 +913,7 @@ { 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \ { 0x003E, 0x0B, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveAllFabrics */ \ \ - /* Endpoint: 1, Cluster: Trusted Root Certificates (server) */ \ + /* Endpoint: 0, Cluster: Trusted Root Certificates (server) */ \ { 0x003F, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddTrustedRootCertificate */ \ { 0x003F, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveTrustedRootCertificate */ \ } diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap b/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap index 616662103d88a3..463130f82dff5d 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap @@ -2900,6 +2900,1502 @@ } ] }, + { + "name": "Pump Configuration and Control", + "code": 512, + "mfgCode": null, + "define": "PUMP_CONFIG_CONTROL_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Pump Configuration and Control", + "code": 512, + "mfgCode": null, + "define": "PUMP_CONFIG_CONTROL_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "max pressure", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max speed", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max flow", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "pump status", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "effective operation mode", + "code": 17, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "effective control mode", + "code": 18, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "capacity", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "operation mode", + "code": 32, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Temperature Measurement", + "code": 1026, + "mfgCode": null, + "define": "TEMP_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Temperature Measurement", + "code": 1026, + "mfgCode": null, + "define": "TEMP_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "measured value", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x8000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "min measured value", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x8000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max measured value", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x8000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "tolerance", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Pressure Measurement", + "code": 1027, + "mfgCode": null, + "define": "PRESSURE_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Pressure Measurement", + "code": 1027, + "mfgCode": null, + "define": "PRESSURE_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "measured value", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "min measured value", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max measured value", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "tolerance", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "scaled value", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "scaled tolerance", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Flow Measurement", + "code": 1028, + "mfgCode": null, + "define": "FLOW_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Flow Measurement", + "code": 1028, + "mfgCode": null, + "define": "FLOW_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "measured value", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "min measured value", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max measured value", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "tolerance", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + } + ] + }, + { + "name": "Anonymous Endpoint Type", + "deviceTypeName": "Pump Controller", + "deviceTypeCode": 772, + "deviceTypeProfileId": 2457, + "clusters": [ + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "IdentifyQuery", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "IdentifyQueryResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "identify time", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "AddGroup", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ViewGroup", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetGroupMembership", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveGroup", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveAllGroups", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "AddGroupIfIdentifying", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "AddGroupResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ViewGroupResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetGroupMembershipResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveGroupResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "name support", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Scenes", + "code": 5, + "mfgCode": null, + "define": "SCENES_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "AddScene", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ViewScene", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveScene", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveAllScenes", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "StoreScene", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RecallScene", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetSceneMembership", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Scenes", + "code": 5, + "mfgCode": null, + "define": "SCENES_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "AddSceneResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ViewSceneResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveSceneResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveAllScenesResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "StoreSceneResponse", + "code": 4, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetSceneMembershipResponse", + "code": 6, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "scene count", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current scene", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current group", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "scene valid", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "name support", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "On/off", + "code": 6, + "mfgCode": null, + "define": "ON_OFF_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "Off", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "On", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "Toggle", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "On/off", + "code": 6, + "mfgCode": null, + "define": "ON_OFF_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "on/off", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Level Control", + "code": 8, + "mfgCode": null, + "define": "LEVEL_CONTROL_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "MoveToLevel", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "Move", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "Step", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "Stop", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "MoveToLevelWithOnOff", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "MoveWithOnOff", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "StepWithOnOff", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "StopWithOnOff", + "code": 7, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Level Control", + "code": 8, + "mfgCode": null, + "define": "LEVEL_CONTROL_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "current level", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Basic", + "code": 40, + "mfgCode": null, + "define": "BASIC_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "MfgSpecificPing", + "code": 0, + "mfgCode": 4098, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Basic", + "code": 40, + "mfgCode": null, + "define": "BASIC_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "StartUp", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ShutDown", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "Leave", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "InteractionModelVersion", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorName", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorID", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductName", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductID", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UserLabel", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Location", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersion", + "code": 7, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersionString", + "code": 8, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersion", + "code": 9, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersionString", + "code": 10, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Pump Configuration and Control", "code": 512, @@ -3446,6 +4942,15 @@ "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 0, "profileId": 2457, + "endpointId": 0, + "networkId": 0, + "endpointVersion": 1, + "deviceIdentifier": null + }, + { + "endpointTypeName": "Anonymous Endpoint Type", + "endpointTypeIndex": 1, + "profileId": 2457, "endpointId": 1, "networkId": 0, "endpointVersion": 1, diff --git a/examples/temperature-measurement-app/esp32/Makefile b/examples/temperature-measurement-app/esp32/Makefile deleted file mode 100644 index 17e13f40e3af9d..00000000000000 --- a/examples/temperature-measurement-app/esp32/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# -# Copyright (c) 2020 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. - -# -# This is a project Makefile. It is assumed the directory this Makefile resides in is a -# project subdirectory. -# - -PROJECT_NAME := chip-temperature-measurement-app - -EXTRA_COMPONENT_DIRS += $(PROJECT_PATH)/third_party/connectedhomeip/config/esp32/components \ - $(PROJECT_PATH)/../../common/m5stack-tft/repo/components \ - $(PROJECT_PATH)/../../common/QRCode \ - $(PROJECT_PATH)/../../common/screen-framework \ - -CXXFLAGS += -std=c++14 -Os -DLWIP_IPV6_SCOPES=0 -CPPFLAGS += -Os -DLWIP_IPV6_SCOPES=0 -DCHIP_HAVE_CONFIG_H -CFLAGS += -Os -DLWIP_IPV6_SCOPES=0 - -top: all flashing_script - -ifeq ($(is_debug),false) -export SDKCONFIG_DEFAULTS = sdkconfig.optimize.defaults -endif - -include $(IDF_PATH)/make/project.mk - -FLASHING_SCRIPT=$(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py - -$(FLASHING_SCRIPT): $(APP_BIN) $(BOOTLOADER_BIN) $(PARTITION_TABLE_BIN) $(PROJECT_PATH)/sdkconfig - @third_party/connectedhomeip/scripts/flashing/gen_flashing_script.py esp32 \ - --output $(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py \ - --port $(ESPPORT) --baud $(ESPBAUD) --before $(CONFIG_ESPTOOLPY_BEFORE) --after $(CONFIG_ESPTOOLPY_AFTER) \ - --application $(subst $(BUILD_DIR_BASE)/,,$(APP_BIN)) \ - --bootloader $(subst $(BUILD_DIR_BASE)/,,$(BOOTLOADER_BIN)) \ - --partition $(subst $(BUILD_DIR_BASE)/,,$(PARTITION_TABLE_BIN)) \ - --use-partition-file $(PARTITION_TABLE_BIN) \ - --use-parttool $(IDF_PATH)/components/partition_table/parttool.py \ - --use-sdkconfig $(PROJECT_PATH)/sdkconfig - -flashing_script: $(FLASHING_SCRIPT) $(BUILD_DIR_BASE)/esp32_firmware_utils.py $(BUILD_DIR_BASE)/firmware_utils.py - @echo To flash $(subst $(CURDIR)/,,$(APP_BIN)), run $(subst $(CURDIR)/,,$(FLASHING_SCRIPT)) - -$(BUILD_DIR_BASE)/esp32_firmware_utils.py: third_party/connectedhomeip/scripts/flashing/esp32_firmware_utils.py - @cp $< $@ - -$(BUILD_DIR_BASE)/firmware_utils.py: third_party/connectedhomeip/scripts/flashing/firmware_utils.py - @cp $< $@ - -.PHONY: flashing_script diff --git a/examples/temperature-measurement-app/esp32/idf.sh b/examples/temperature-measurement-app/esp32/idf.sh deleted file mode 100755 index 6805596bf1fe53..00000000000000 --- a/examples/temperature-measurement-app/esp32/idf.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) 2020 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. - -# If this file is sourced, it exports a function called "idf" that initializes -# the espressif environment via the espressive export.sh script and runs -# a command presented as arguments -# -# This file can also be used as an executable - -error() { - echo "$me: *** ERROR: " "${*}" -} - -idf() { - [[ -d $IDF_PATH && -r $IDF_PATH/export.sh ]] || { - error "can't find IDF's export.sh, please set IDF_PATH" - return 1 - } - ( - # shellcheck source=/dev/null - . "$IDF_PATH/export.sh" - export IDF_PATH - "$@" - ) -} -if [[ ${0} == "${BASH_SOURCE[0]}" ]]; then - me=${0##*/} - idf "${@}" -else - me=idf - [[ $PS1 =~ \[idf\].* ]] || PS1="[idf]$PS1" -fi diff --git a/examples/temperature-measurement-app/esp32/main/component.mk b/examples/temperature-measurement-app/esp32/main/component.mk deleted file mode 100644 index 98ac717d4e40fc..00000000000000 --- a/examples/temperature-measurement-app/esp32/main/component.mk +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (c) 2020 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. -# -# Description: -# Component makefile for the ESP32 demo application. -# -# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) - -COMPONENT_DEPENDS := chip QRCode tft spidriver - -COMPONENT_SRCDIRS := \ - . \ - gen \ - ../third_party/connectedhomeip/src/app/server \ - ../third_party/connectedhomeip/src/app/util \ - ../third_party/connectedhomeip/src/app/reporting \ - ../third_party/connectedhomeip/src/app/clusters/basic \ - ../third_party/connectedhomeip/src/app/clusters/bindings \ - ../third_party/connectedhomeip/src/app/clusters/general-commissioning-server \ - ../third_party/connectedhomeip/src/app/clusters/network-commissioning \ - ../third_party/connectedhomeip/src/app/clusters/operational-credentials-server \ - ../third_party/connectedhomeip/src/app/clusters/temperature-measurement-server \ - ../third_party/connectedhomeip/src/app/clusters/trusted-root-certificates-server \ - - -COMPONENT_EXTRA_INCLUDES := $(PROJECT_PATH)/third_party/connectedhomeip/src/app/util \ - $(PROJECT_PATH)/third_party/connectedhomeip/src/app/reporting \ - $(PROJECT_PATH)/third_party/connectedhomeip/src/app/server \ - $(PROJECT_PATH)/third_party/connectedhomeip/third_party/nlio/repo/include \ - $(PROJECT_PATH)/third_party/connectedhomeip/src - -# So "gen/*" files are found by the src/app bits. -COMPONENT_PRIV_INCLUDEDIRS := . diff --git a/scripts/examples/esp_example.sh b/scripts/examples/esp_example.sh index 606b686d77cc6b..ae021cb103e9c5 100755 --- a/scripts/examples/esp_example.sh +++ b/scripts/examples/esp_example.sh @@ -31,14 +31,20 @@ fi source "scripts/activate.sh" # shellcheck source=/dev/null -source "$root"/idf.sh +source "$IDF_PATH/export.sh" for sdkconfig in "$root"/sdkconfig*.defaults; do # remove root path to get sdkconfig*.defaults name sdkconfig_name=${sdkconfig#"$root"/} rm -f "$root"/sdkconfig - SDKCONFIG_DEFAULTS=$sdkconfig_name idf make -j8 -C "$root" defconfig "$@" - idf make -j8 -C "$root" "$@" || { + ( + cd "$root" + idf.py -D SDKCONFIG_DEFAULTS="$sdkconfig_name" build + ) + ( + cd "$root" + idf.py build "$@" + ) || { echo "build $sdkconfig_name failed" exit 1 } diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 1f2c119a98044d..709b11d92451a0 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -120,6 +120,15 @@ static_library("app") { assert(false, "Unknown IM critical section implementation.") } + if (chip_ip_commissioning) { + defines = [ + "CONFIG_USE_CLUSTERS_FOR_IP_COMMISSIONING=1", + "CONFIG_RENDEZVOUS_WAIT_FOR_COMMISSIONING_COMPLETE=1", + "CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY=1", + "CHIP_DEVICE_CONFIG_ENABLE_JUST_IN_TIME_PROVISIONING=1", + ] + } + public_deps = [ "${chip_root}/src/lib/support", "${chip_root}/src/messaging", diff --git a/src/app/clusters/binary-input-server/binary-input-server.cpp b/src/app/clusters/binary-input-server/binary-input-server.cpp new file mode 100644 index 00000000000000..48b909e62dd2d3 --- /dev/null +++ b/src/app/clusters/binary-input-server/binary-input-server.cpp @@ -0,0 +1,56 @@ +/* + * + * Copyright (c) 2021 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 "binary-input-server.h" + +#include + +#include +#include +#include +#include +#include + +#include + +#ifndef emberAfBinaryInputBasicClusterPrintln +#define emberAfBinaryInputBasicClusterPrintln(...) ChipLogProgress(Zcl, __VA_ARGS__); +#endif + +EmberAfStatus emberAfBinaryInputBasicClusterGetPresentValue(chip::EndpointId endpoint, bool * presentValue) +{ + return emberAfReadServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_PRESENT_VALUE_ATTRIBUTE_ID, + (uint8_t *) presentValue, sizeof(uint8_t)); +} + +EmberAfStatus emberAfBinaryInputBasicClusterGetOutOfService(chip::EndpointId endpoint, bool * isOutOfService) +{ + return emberAfReadServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_OUT_OF_SERVICE_ATTRIBUTE_ID, + (uint8_t *) isOutOfService, sizeof(uint8_t)); +} + +EmberAfStatus emberAfBinaryInputBasicClusterSetPresentValueCallback(chip::EndpointId endpoint, bool presentValue) +{ + return emberAfWriteServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_PRESENT_VALUE_ATTRIBUTE_ID, + (uint8_t *) &presentValue, ZCL_BOOLEAN_ATTRIBUTE_TYPE); +} + +EmberAfStatus emberAfBinaryInputBasicClusterSetOutOfServiceCallback(chip::EndpointId endpoint, bool isOutOfService) +{ + return emberAfWriteServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_OUT_OF_SERVICE_ATTRIBUTE_ID, + (uint8_t *) &isOutOfService, ZCL_BOOLEAN_ATTRIBUTE_TYPE); +} diff --git a/src/app/clusters/binary-input-server/binary-input-server.h b/src/app/clusters/binary-input-server/binary-input-server.h new file mode 100644 index 00000000000000..df5e4d16b9f8bc --- /dev/null +++ b/src/app/clusters/binary-input-server/binary-input-server.h @@ -0,0 +1,25 @@ +/* + * + * Copyright (c) 2021 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 + +EmberAfStatus emberAfBinaryInputBasicClusterSetPresentValueCallback(chip::EndpointId endpoint, bool presentValue); +EmberAfStatus emberAfBinaryInputBasicClusterGetPresentValue(chip::EndpointId endpoint, bool * presentValue); +EmberAfStatus emberAfBinaryInputBasicClusterSetOutOfServiceCallback(chip::EndpointId endpoint, bool isOutOfService); +EmberAfStatus emberAfBinaryInputBasicClusterGetOutOfService(chip::EndpointId endpoint, bool * isOutOfService); diff --git a/src/app/common_flags.gni b/src/app/common_flags.gni index 1d4309810d57e8..45e98373af3d0b 100644 --- a/src/app/common_flags.gni +++ b/src/app/common_flags.gni @@ -15,4 +15,5 @@ declare_args() { # Temporary flag for interaction model and echo protocols, set it to true to enable chip_app_use_echo = false + chip_ip_commissioning = false } diff --git a/src/app/server/RendezvousServer.cpp b/src/app/server/RendezvousServer.cpp index a1adb9f2a1f9a4..bedd9463b37fb7 100644 --- a/src/app/server/RendezvousServer.cpp +++ b/src/app/server/RendezvousServer.cpp @@ -111,7 +111,7 @@ CHIP_ERROR RendezvousServer::WaitForPairing(const RendezvousParameters & params, strlen(kSpake2pKeyExchangeSalt), mNextKeyId++, this)); } - ReturnErrorOnFailure(mPairingSession.MessageDispatch().Init(transportMgr)); + ReturnErrorOnFailure(mPairingSession.MessageDispatch().Init(mExchangeManager->GetReliableMessageMgr(), transportMgr)); mPairingSession.MessageDispatch().SetPeerAddress(params.GetPeerAddress()); return CHIP_NO_ERROR; diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js index 2cc69780681bf6..ffda2e310515a3 100644 --- a/src/app/zap-templates/templates/app/helper.js +++ b/src/app/zap-templates/templates/app/helper.js @@ -201,16 +201,6 @@ var endpointClusterWithAttributeChanged = [ 'Identify', 'Door Lock' ]; var endpointClusterWithPreAttribute = [ 'IAS Zone' ]; var endpointClusterWithMessageSent = [ 'IAS Zone' ]; -/** - * extract the cluster name from the enpoint cluster comment - * @param {*} comments - */ -function extract_cluster_name(comments) -{ - let secondPart = comments.split(": ").pop(); - return secondPart.split(" (")[0]; -} - /** * Populate the GENERATED_FUNCTIONS field */ @@ -219,7 +209,7 @@ function chip_endpoint_generated_functions() let alreadySetCluster = []; let ret = '\\\n'; this.clusterList.forEach((c) => { - let clusterName = extract_cluster_name(c.comment); + let clusterName = c.clusterName; let functionList = ''; if (alreadySetCluster.includes(clusterName)) { // Only one array of Generated functions per cluster across all endpoints @@ -275,7 +265,7 @@ function chip_endpoint_cluster_list() this.clusterList.forEach((c) => { let mask = ''; let functionArray = c.functions; - let clusterName = extract_cluster_name(c.comment); + let clusterName = c.clusterName; if (c.comment.includes('server')) { let hasFunctionArray = false; diff --git a/src/app/zap-templates/zcl/data-model/silabs/ha-thread.xml b/src/app/zap-templates/zcl/data-model/silabs/ha-thread.xml index 659c3fdd2b7931..f25bd294a8c0db 100644 --- a/src/app/zap-templates/zcl/data-model/silabs/ha-thread.xml +++ b/src/app/zap-templates/zcl/data-model/silabs/ha-thread.xml @@ -445,23 +445,6 @@ limitations under the License. scaled tolerance scale - - Flow Measurement - Measurement & Sensing - Attributes and commands for configuring the measurement of flow, and reporting flow rates. - 0x0404 - FLOW_MEASUREMENT_CLUSTER - true - true - measured value - - min measured value - - max measured value - - tolerance - - Relative Humidity Measurement Measurement & Sensing diff --git a/src/app/zap-templates/zcl/data-model/silabs/ha.xml b/src/app/zap-templates/zcl/data-model/silabs/ha.xml index afb79e189d6ff8..a48fa9f28940b3 100644 --- a/src/app/zap-templates/zcl/data-model/silabs/ha.xml +++ b/src/app/zap-templates/zcl/data-model/silabs/ha.xml @@ -474,24 +474,6 @@ limitations under the License. scaled tolerance scale - - Flow Measurement - Measurement & Sensing - Attributes and commands for configuring the measurement of flow, and reporting flow rates. - 0x0404 - FLOW_MEASUREMENT_CLUSTER - true - true - - measured value - - min measured value - - max measured value - - tolerance - - Relative Humidity Measurement Measurement & Sensing diff --git a/src/app/zap-templates/zcl/flow-measurement-cluster.xml b/src/app/zap-templates/zcl/flow-measurement-cluster.xml new file mode 100644 index 00000000000000..0844e9cd5998f6 --- /dev/null +++ b/src/app/zap-templates/zcl/flow-measurement-cluster.xml @@ -0,0 +1,33 @@ + + + + + + Flow Measurement + Measurement & Sensing + Attributes and commands for configuring the measurement of flow, and reporting flow measurements. + 0x0404 + FLOW_MEASUREMENT_CLUSTER + true + true + measured value + min measured value + max measured value + tolerance + + + diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 15f626dca29751..bcb8283b1e963a 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -23,6 +23,7 @@ "custom-types.xml", "chip-devices.xml", "descriptor-cluster.xml", + "flow-measurement-cluster.xml", "types.xml", "general.xml", "operational-credentials-cluster.xml", diff --git a/src/app/zap_cluster_list.py b/src/app/zap_cluster_list.py index dc2ce3a5439031..89ff0b8c198d84 100755 --- a/src/app/zap_cluster_list.py +++ b/src/app/zap_cluster_list.py @@ -16,6 +16,7 @@ 'AUDIO_OUTPUT_CLUSTER': [], 'BARRIER_CONTROL_CLUSTER': ['barrier-control-server'], 'BASIC_CLUSTER': ['basic'], + 'BINARY_INPUT_BASIC_CLUSTER': ['binary-input-server'], 'BINDING_CLUSTER': ['bindings'], 'BRIDGED_DEVICE_BASIC_CLUSTER': [], 'COLOR_CONTROL_CLUSTER': ['color-control-server'], @@ -72,6 +73,7 @@ 'APPLICATION_BASIC_CLUSTER': [], 'BARRIER_CONTROL_CLUSTER': [], 'BASIC_CLUSTER': [], + 'BINARY_INPUT_BASIC_CLUSTER': [], 'BINDING_CLUSTER': [], 'BRIDGED_DEVICE_BASIC_CLUSTER': [], 'COLOR_CONTROL_CLUSTER': [], diff --git a/src/controller/BUILD.gn b/src/controller/BUILD.gn index a2b775381fa061..31b83c06bc1d48 100644 --- a/src/controller/BUILD.gn +++ b/src/controller/BUILD.gn @@ -25,8 +25,6 @@ static_library("controller") { "CHIPDevice.h", "CHIPDeviceController.cpp", "CHIPDeviceController.h", - "CHIPOperationalCredentialsProvisioner.cpp", - "CHIPOperationalCredentialsProvisioner.h", "DeviceAddressUpdateDelegate.h", "EmptyDataModelHandler.cpp", "ExampleOperationalCredentialsIssuer.cpp", diff --git a/src/controller/CHIPDevice.cpp b/src/controller/CHIPDevice.cpp index 785024c82dd600..a010515c0139ac 100644 --- a/src/controller/CHIPDevice.cpp +++ b/src/controller/CHIPDevice.cpp @@ -485,7 +485,8 @@ CHIP_ERROR Device::EstablishCASESession() Messaging::ExchangeContext * exchange = mExchangeMgr->NewContext(SecureSessionHandle(), &mCASESession); VerifyOrReturnError(exchange != nullptr, CHIP_ERROR_INTERNAL); - ReturnErrorOnFailure(mCASESession.MessageDispatch().Init(mSessionManager->GetTransportManager())); + ReturnErrorOnFailure( + mCASESession.MessageDispatch().Init(mExchangeMgr->GetReliableMessageMgr(), mSessionManager->GetTransportManager())); mCASESession.MessageDispatch().SetPeerAddress(mDeviceAddress); ReturnErrorOnFailure(mCASESession.EstablishSession(mDeviceAddress, mCredentials, mDeviceId, 0, exchange, this)); diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index f23e186f6fb2a9..e051096ebea818 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -851,7 +851,7 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParam mIsIPRendezvous = (params.GetPeerAddress().GetTransportType() != Transport::Type::kBle); - err = mPairingSession.MessageDispatch().Init(mTransportMgr); + err = mPairingSession.MessageDispatch().Init(mExchangeMgr->GetReliableMessageMgr(), mTransportMgr); SuccessOrExit(err); mPairingSession.MessageDispatch().SetPeerAddress(params.GetPeerAddress()); @@ -1112,7 +1112,7 @@ CHIP_ERROR DeviceCommissioner::SendOperationalCertificateSigningRequestCommand(D { ChipLogDetail(Controller, "Sending OpCSR request to %p device", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - chip::Controller::OperationalCredentialsProvisioner cluster; + chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, 0); Callback::Cancelable * successCallback = mOpCSRResponseCallback.Cancel(); @@ -1212,7 +1212,7 @@ CHIP_ERROR DeviceCommissioner::ProcessOpCSR(const ByteSpan & CSR, const ByteSpan CHIP_ERROR DeviceCommissioner::SendOperationalCertificate(Device * device, const ByteSpan & opCertBuf, const ByteSpan & icaCertBuf) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - chip::Controller::OperationalCredentialsProvisioner cluster; + chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, 0); Callback::Cancelable * successCallback = mOpCertResponseCallback.Cancel(); @@ -1289,7 +1289,7 @@ CHIP_ERROR DeviceCommissioner::SendTrustedRootCertificate(Device * device) ChipLogProgress(Controller, "Sending root certificate to the device"); - chip::Controller::TrustedRootCertificatesProvisioner cluster; + chip::Controller::TrustedRootCertificatesCluster cluster; cluster.Associate(device, 0); Callback::Cancelable * successCallback = mRootCertResponseCallback.Cancel(); diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 7b638735d8b508..2a5d6208ca64c6 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -30,8 +30,8 @@ #include #include -#include #include +#include #include #include #include @@ -272,23 +272,23 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, bool mPairedDevicesInitialized; NodeId mLocalDeviceId; - DeviceTransportMgr * mTransportMgr; - SecureSessionMgr * mSessionMgr; - Messaging::ExchangeManager * mExchangeMgr; - secure_channel::MessageCounterManager * mMessageCounterManager; - PersistentStorageDelegate * mStorageDelegate; - DeviceControllerInteractionModelDelegate * mDefaultIMDelegate; + DeviceTransportMgr * mTransportMgr = nullptr; + SecureSessionMgr * mSessionMgr = nullptr; + Messaging::ExchangeManager * mExchangeMgr = nullptr; + secure_channel::MessageCounterManager * mMessageCounterManager = nullptr; + PersistentStorageDelegate * mStorageDelegate = nullptr; + DeviceControllerInteractionModelDelegate * mDefaultIMDelegate = nullptr; #if CHIP_DEVICE_CONFIG_ENABLE_MDNS DeviceAddressUpdateDelegate * mDeviceAddressUpdateDelegate = nullptr; // TODO(cecille): Make this configuarable. static constexpr int kMaxCommissionableNodes = 10; Mdns::CommissionableNodeData mCommissionableNodes[kMaxCommissionableNodes]; #endif - Inet::InetLayer * mInetLayer; + Inet::InetLayer * mInetLayer = nullptr; #if CONFIG_NETWORK_LAYER_BLE Ble::BleLayer * mBleLayer = nullptr; #endif - System::Layer * mSystemLayer; + System::Layer * mSystemLayer = nullptr; uint16_t mListenPort; uint16_t GetInactiveDeviceIndex(); diff --git a/src/controller/CHIPOperationalCredentialsProvisioner.cpp b/src/controller/CHIPOperationalCredentialsProvisioner.cpp deleted file mode 100644 index 9a714717586bf6..00000000000000 --- a/src/controller/CHIPOperationalCredentialsProvisioner.cpp +++ /dev/null @@ -1,374 +0,0 @@ -/* - * - * 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. - */ - -#include -#include - -namespace chip { -namespace Controller { - -CHIP_ERROR OperationalCredentialsProvisioner::AddOpCert(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, chip::ByteSpan noc, - chip::ByteSpan iCACertificate, chip::ByteSpan iPKValue, - chip::NodeId caseAdminNode, uint16_t adminVendorId) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - app::CommandSender * sender = nullptr; - TLV::TLVWriter * writer = nullptr; - uint8_t argSeqNumber = 0; - - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - - app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kAddOpCertCommandId, - (chip::app::CommandPathFlags::kEndpointIdValid) }; - - SuccessOrExit(err = chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); - - SuccessOrExit(err = sender->PrepareCommand(&cmdParams)); - - VerifyOrExit((writer = sender->GetCommandDataElementTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - // noc: octetString - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), noc)); - // iCACertificate: octetString - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), iCACertificate)); - // iPKValue: octetString - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), iPKValue)); - // caseAdminNode: nodeId - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), caseAdminNode)); - // adminVendorId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), adminVendorId)); - - SuccessOrExit(err = sender->FinishCommand()); - - // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. - mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); - - err = mDevice->SendCommands(sender); - -exit: - // On error, we are responsible to close the sender. - if (err != CHIP_NO_ERROR) - { - sender->Shutdown(); - } - return err; -} - -CHIP_ERROR OperationalCredentialsProvisioner::OpCSRRequest(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, chip::ByteSpan CSRNonce) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - app::CommandSender * sender = nullptr; - TLV::TLVWriter * writer = nullptr; - uint8_t argSeqNumber = 0; - - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - - app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kOpCSRRequestCommandId, - (chip::app::CommandPathFlags::kEndpointIdValid) }; - - SuccessOrExit(err = chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); - - SuccessOrExit(err = sender->PrepareCommand(&cmdParams)); - - VerifyOrExit((writer = sender->GetCommandDataElementTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - - // CSRNonce: octetString - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), CSRNonce)); - - SuccessOrExit(err = sender->FinishCommand()); - - // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. - mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); - - err = mDevice->SendCommands(sender); - -exit: - // On error, we are responsible to close the sender. - if (err != CHIP_NO_ERROR) - { - sender->Shutdown(); - } - return err; -} - -CHIP_ERROR OperationalCredentialsProvisioner::RemoveAllFabrics(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - app::CommandSender * sender = nullptr; - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - - app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRemoveAllFabricsCommandId, - (chip::app::CommandPathFlags::kEndpointIdValid) }; - - SuccessOrExit(err = chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); - - SuccessOrExit(err = sender->PrepareCommand(&cmdParams)); - - // Command takes no arguments. - - SuccessOrExit(err = sender->FinishCommand()); - - // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. - mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); - - err = mDevice->SendCommands(sender); - -exit: - // On error, we are responsible to close the sender. - if (err != CHIP_NO_ERROR) - { - sender->Shutdown(); - } - return err; -} - -CHIP_ERROR OperationalCredentialsProvisioner::RemoveFabric(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, chip::FabricId fabricId, - chip::NodeId nodeId, uint16_t vendorId) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - app::CommandSender * sender = nullptr; - TLV::TLVWriter * writer = nullptr; - uint8_t argSeqNumber = 0; - - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - - app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRemoveFabricCommandId, - (chip::app::CommandPathFlags::kEndpointIdValid) }; - - SuccessOrExit(err = chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); - - SuccessOrExit(err = sender->PrepareCommand(&cmdParams)); - - VerifyOrExit((writer = sender->GetCommandDataElementTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - // fabricId: fabricId - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), fabricId)); - // nodeId: nodeId - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), nodeId)); - // vendorId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), vendorId)); - - SuccessOrExit(err = sender->FinishCommand()); - - // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. - mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); - - err = mDevice->SendCommands(sender); - -exit: - // On error, we are responsible to close the sender. - if (err != CHIP_NO_ERROR) - { - sender->Shutdown(); - } - return err; -} - -CHIP_ERROR OperationalCredentialsProvisioner::SetFabric(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t vendorId) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - app::CommandSender * sender = nullptr; - TLV::TLVWriter * writer = nullptr; - uint8_t argSeqNumber = 0; - - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - - app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetFabricCommandId, - (chip::app::CommandPathFlags::kEndpointIdValid) }; - - SuccessOrExit(err = chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); - - SuccessOrExit(err = sender->PrepareCommand(&cmdParams)); - - VerifyOrExit((writer = sender->GetCommandDataElementTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - // vendorId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), vendorId)); - - SuccessOrExit(err = sender->FinishCommand()); - - // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. - mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); - - err = mDevice->SendCommands(sender); - -exit: - // On error, we are responsible to close the sender. - if (err != CHIP_NO_ERROR) - { - sender->Shutdown(); - } - return err; -} - -CHIP_ERROR OperationalCredentialsProvisioner::UpdateFabricLabel(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, chip::ByteSpan label) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - app::CommandSender * sender = nullptr; - TLV::TLVWriter * writer = nullptr; - uint8_t argSeqNumber = 0; - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - - app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kUpdateFabricLabelCommandId, - (chip::app::CommandPathFlags::kEndpointIdValid) }; - - SuccessOrExit(err = chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); - - SuccessOrExit(err = sender->PrepareCommand(&cmdParams)); - - VerifyOrExit((writer = sender->GetCommandDataElementTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - // label: charString - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), label)); - - SuccessOrExit(err = sender->FinishCommand()); - - // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. - mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); - - err = mDevice->SendCommands(sender); - -exit: - // On error, we are responsible to close the sender. - if (err != CHIP_NO_ERROR) - { - sender->Shutdown(); - } - return err; -} - -// OperationalCredentials Cluster Attributes -CHIP_ERROR OperationalCredentialsProvisioner::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) -{ - uint8_t seqNum = mDevice->GetNextSequenceNumber(); - System::PacketBufferHandle encodedCommand = encodeOperationalCredentialsClusterDiscoverAttributes(seqNum, mEndpoint); - return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); -} -CHIP_ERROR OperationalCredentialsProvisioner::ReadAttributeFabricsList(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) -{ - uint8_t seqNum = mDevice->GetNextSequenceNumber(); - System::PacketBufferHandle encodedCommand = encodeOperationalCredentialsClusterReadFabricsListAttribute(seqNum, mEndpoint); - return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); -} - -CHIP_ERROR OperationalCredentialsProvisioner::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) -{ - uint8_t seqNum = mDevice->GetNextSequenceNumber(); - System::PacketBufferHandle encodedCommand = encodeOperationalCredentialsClusterReadClusterRevisionAttribute(seqNum, mEndpoint); - return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); -} - -// TrustedRootCertificates Cluster Commands -CHIP_ERROR TrustedRootCertificatesProvisioner::AddTrustedRootCertificate(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - chip::ByteSpan rootCertificate) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - app::CommandSender * sender = nullptr; - TLV::TLVWriter * writer = nullptr; - uint8_t argSeqNumber = 0; - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - - app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kAddTrustedRootCertificateCommandId, - (chip::app::CommandPathFlags::kEndpointIdValid) }; - - SuccessOrExit(err = chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); - - SuccessOrExit(err = sender->PrepareCommand(&cmdParams)); - - VerifyOrExit((writer = sender->GetCommandDataElementTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - // rootCertificate: octetString - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), rootCertificate)); - - SuccessOrExit(err = sender->FinishCommand()); - - // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. - mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); - - err = mDevice->SendCommands(sender); - -exit: - // On error, we are responsible to close the sender. - if (err != CHIP_NO_ERROR) - { - sender->Shutdown(); - } - return err; -} - -CHIP_ERROR TrustedRootCertificatesProvisioner::RemoveTrustedRootCertificate(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - chip::ByteSpan trustedRootIdentifier) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - app::CommandSender * sender = nullptr; - TLV::TLVWriter * writer = nullptr; - uint8_t argSeqNumber = 0; - - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - - app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRemoveTrustedRootCertificateCommandId, - (chip::app::CommandPathFlags::kEndpointIdValid) }; - - SuccessOrExit(err = chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); - - SuccessOrExit(err = sender->PrepareCommand(&cmdParams)); - - VerifyOrExit((writer = sender->GetCommandDataElementTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - // trustedRootIdentifier: octetString - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), trustedRootIdentifier)); - - SuccessOrExit(err = sender->FinishCommand()); - - // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. - mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); - - err = mDevice->SendCommands(sender); - -exit: - // On error, we are responsible to close the sender. - if (err != CHIP_NO_ERROR) - { - sender->Shutdown(); - } - return err; -} - -// TrustedRootCertificates Cluster Attributes -CHIP_ERROR TrustedRootCertificatesProvisioner::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) -{ - uint8_t seqNum = mDevice->GetNextSequenceNumber(); - System::PacketBufferHandle encodedCommand = encodeTrustedRootCertificatesClusterDiscoverAttributes(seqNum, mEndpoint); - return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); -} -CHIP_ERROR TrustedRootCertificatesProvisioner::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) -{ - uint8_t seqNum = mDevice->GetNextSequenceNumber(); - System::PacketBufferHandle encodedCommand = encodeTrustedRootCertificatesClusterReadClusterRevisionAttribute(seqNum, mEndpoint); - return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); -} - -} // namespace Controller -} // namespace chip diff --git a/src/controller/CHIPOperationalCredentialsProvisioner.h b/src/controller/CHIPOperationalCredentialsProvisioner.h deleted file mode 100644 index 11405a688dbfc2..00000000000000 --- a/src/controller/CHIPOperationalCredentialsProvisioner.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * - * 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. - */ - -/** - * @file - * This file contains the definition for CHIP's Operational Credentials - * cluster class. - */ - -#pragma once - -#include -#include -#include - -namespace chip { -namespace Controller { - -typedef void (*OperationalCredentialsClusterOpCSRResponseCallback)(void * context, chip::ByteSpan CSR, chip::ByteSpan CSRNonce, - chip::ByteSpan VendorReserved1, chip::ByteSpan VendorReserved2, - chip::ByteSpan VendorReserved3, chip::ByteSpan Signature); -typedef void (*OperationalCredentialsClusterOpCertResponseCallback)(void * context, uint8_t StatusCode, uint64_t FabricIndex, - uint8_t * DebugText); - -typedef void (*DefaultSuccessCallback)(void * context); -typedef void (*DefaultFailureCallback)(void * context, uint8_t status); - -constexpr ClusterId kOperationalCredentialsClusterIdLocal = 0x003E; -constexpr ClusterId kTrustedRootCertificatesClusterIdLocal = 0x003F; - -class DLL_EXPORT OperationalCredentialsProvisioner : public ClusterBase -{ -public: - OperationalCredentialsProvisioner() : ClusterBase(kOperationalCredentialsClusterIdLocal) {} - ~OperationalCredentialsProvisioner() {} - - // Cluster Commands - CHIP_ERROR AddOpCert(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan noc, - chip::ByteSpan iCACertificate, chip::ByteSpan iPKValue, chip::NodeId caseAdminNode, - uint16_t adminVendorId); - CHIP_ERROR OpCSRRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - chip::ByteSpan cSRNonce); - CHIP_ERROR RemoveAllFabrics(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - CHIP_ERROR RemoveFabric(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - chip::FabricId fabricId, chip::NodeId nodeId, uint16_t vendorId); - CHIP_ERROR SetFabric(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t vendorId); - CHIP_ERROR UpdateFabricLabel(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - chip::ByteSpan label); - - // Cluster Attributes - CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - CHIP_ERROR ReadAttributeFabricsList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - -private: - static constexpr CommandId kAddOpCertCommandId = 0x06; - static constexpr CommandId kOpCSRRequestCommandId = 0x04; - static constexpr CommandId kRemoveAllFabricsCommandId = 0x0B; - static constexpr CommandId kRemoveFabricCommandId = 0x0A; - static constexpr CommandId kSetFabricCommandId = 0x00; - static constexpr CommandId kUpdateFabricLabelCommandId = 0x09; -}; - -// TODO - Remove TrustedRootCertificate cluster once it merges with OperationalCredentials cluster -// Keeping the code in this file for time being, as it'll eventually be removed. -class DLL_EXPORT TrustedRootCertificatesProvisioner : public ClusterBase -{ -public: - TrustedRootCertificatesProvisioner() : ClusterBase(kTrustedRootCertificatesClusterIdLocal) {} - ~TrustedRootCertificatesProvisioner() {} - - // Cluster Commands - CHIP_ERROR AddTrustedRootCertificate(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - chip::ByteSpan rootCertificate); - CHIP_ERROR RemoveTrustedRootCertificate(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - chip::ByteSpan trustedRootIdentifier); - - // Cluster Attributes - CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - -private: - static constexpr CommandId kAddTrustedRootCertificateCommandId = 0x00; - static constexpr CommandId kRemoveTrustedRootCertificateCommandId = 0x01; -}; - -} // namespace Controller -} // namespace chip diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 5fb4d5af9d2991..5be7a14a4d89e2 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -1,5 +1,5 @@ { - "featureLevel": 29, + "featureLevel": 35, "creator": "zap", "keyValuePairs": [ { @@ -735,6 +735,103 @@ } ] }, + { + "name": "Binary Input (Basic)", + "code": 15, + "mfgCode": null, + "define": "BINARY_INPUT_BASIC_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Binary Input (Basic)", + "code": 15, + "mfgCode": null, + "define": "BINARY_INPUT_BASIC_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "out of service", + "code": 81, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "present value", + "code": 85, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "status flags", + "code": 111, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Descriptor", "code": 29, diff --git a/src/controller/data_model/gen/CHIPClusters.cpp b/src/controller/data_model/gen/CHIPClusters.cpp index e98f78e4cbfc2f..819db69166cb08 100644 --- a/src/controller/data_model/gen/CHIPClusters.cpp +++ b/src/controller/data_model/gen/CHIPClusters.cpp @@ -720,6 +720,93 @@ CHIP_ERROR BasicCluster::ReadAttributeClusterRevision(Callback::Cancelable * onS return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// BinaryInputBasic Cluster Commands +// BinaryInputBasic Cluster Attributes +CHIP_ERROR BinaryInputBasicCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeBinaryInputBasicClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR BinaryInputBasicCluster::ReadAttributeOutOfService(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeBinaryInputBasicClusterReadOutOfServiceAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR BinaryInputBasicCluster::WriteAttributeOutOfService(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeBinaryInputBasicClusterWriteOutOfServiceAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR BinaryInputBasicCluster::ReadAttributePresentValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeBinaryInputBasicClusterReadPresentValueAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR BinaryInputBasicCluster::WriteAttributePresentValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeBinaryInputBasicClusterWritePresentValueAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR BinaryInputBasicCluster::ConfigureAttributePresentValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeBinaryInputBasicClusterConfigurePresentValueAttribute(seqNum, mEndpoint, minInterval, maxInterval); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR BinaryInputBasicCluster::ReportAttributePresentValue(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0055, onReportCallback); +} + +CHIP_ERROR BinaryInputBasicCluster::ReadAttributeStatusFlags(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeBinaryInputBasicClusterReadStatusFlagsAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR BinaryInputBasicCluster::ConfigureAttributeStatusFlags(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeBinaryInputBasicClusterConfigureStatusFlagsAttribute(seqNum, mEndpoint, minInterval, maxInterval); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR BinaryInputBasicCluster::ReportAttributeStatusFlags(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x006F, onReportCallback); +} + +CHIP_ERROR BinaryInputBasicCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeBinaryInputBasicClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // Binding Cluster Commands CHIP_ERROR BindingCluster::Bind(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::NodeId nodeId, chip::GroupId groupId, chip::EndpointId endpointId, chip::ClusterId clusterId) diff --git a/src/controller/data_model/gen/CHIPClusters.h b/src/controller/data_model/gen/CHIPClusters.h index 4e817983958556..ca3672fdc25636 100644 --- a/src/controller/data_model/gen/CHIPClusters.h +++ b/src/controller/data_model/gen/CHIPClusters.h @@ -33,6 +33,7 @@ constexpr ClusterId kApplicationLauncherClusterId = 0x050C; constexpr ClusterId kAudioOutputClusterId = 0x050B; constexpr ClusterId kBarrierControlClusterId = 0x0103; constexpr ClusterId kBasicClusterId = 0x0028; +constexpr ClusterId kBinaryInputBasicClusterId = 0x000F; constexpr ClusterId kBindingClusterId = 0xF000; constexpr ClusterId kBridgedDeviceBasicClusterId = 0x0039; constexpr ClusterId kColorControlClusterId = 0x0300; @@ -215,6 +216,30 @@ class DLL_EXPORT BasicCluster : public ClusterBase static constexpr CommandId kMfgSpecificPingCommandId = 0x00; }; +class DLL_EXPORT BinaryInputBasicCluster : public ClusterBase +{ +public: + BinaryInputBasicCluster() : ClusterBase(kBinaryInputBasicClusterId) {} + ~BinaryInputBasicCluster() {} + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeOutOfService(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributePresentValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeStatusFlags(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR WriteAttributeOutOfService(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributePresentValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR ConfigureAttributePresentValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval); + CHIP_ERROR ReportAttributePresentValue(Callback::Cancelable * onReportCallback); + CHIP_ERROR ConfigureAttributeStatusFlags(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval); + CHIP_ERROR ReportAttributeStatusFlags(Callback::Cancelable * onReportCallback); +}; + class DLL_EXPORT BindingCluster : public ClusterBase { public: diff --git a/src/controller/data_model/gen/call-command-handler.cpp b/src/controller/data_model/gen/call-command-handler.cpp index 2a18b911128bd3..359924805e7b23 100644 --- a/src/controller/data_model/gen/call-command-handler.cpp +++ b/src/controller/data_model/gen/call-command-handler.cpp @@ -34,6 +34,7 @@ EmberAfStatus emberAfApplicationLauncherClusterClientCommandParse(EmberAfCluster EmberAfStatus emberAfAudioOutputClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBarrierControlClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBasicClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfBinaryInputBasicClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBindingClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBridgedDeviceBasicClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfColorControlClusterClientCommandParse(EmberAfClusterCommand * cmd); @@ -120,6 +121,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Basic result = status(false, true, cmd->mfgSpecific); break; + case ZCL_BINARY_INPUT_BASIC_CLUSTER_ID: + // No commands are enabled for cluster Binary Input (Basic) + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_BINDING_CLUSTER_ID: // No commands are enabled for cluster Binding result = status(false, true, cmd->mfgSpecific); diff --git a/src/controller/data_model/gen/callback-stub.cpp b/src/controller/data_model/gen/callback-stub.cpp index 5380678e5dbe18..db722487ce6717 100644 --- a/src/controller/data_model/gen/callback-stub.cpp +++ b/src/controller/data_model/gen/callback-stub.cpp @@ -47,6 +47,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_BASIC_CLUSTER_ID: emberAfBasicClusterInitCallback(endpoint); break; + case ZCL_BINARY_INPUT_BASIC_CLUSTER_ID: + emberAfBinaryInputBasicClusterInitCallback(endpoint); + break; case ZCL_BINDING_CLUSTER_ID: emberAfBindingClusterInitCallback(endpoint); break; @@ -185,6 +188,11 @@ void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint) // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfBinaryInputBasicClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfBindingClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/src/controller/data_model/gen/callback.h b/src/controller/data_model/gen/callback.h index d5b955d625e531..d05196c0494c8e 100644 --- a/src/controller/data_model/gen/callback.h +++ b/src/controller/data_model/gen/callback.h @@ -88,6 +88,14 @@ void emberAfBarrierControlClusterInitCallback(chip::EndpointId endpoint); */ void emberAfBasicClusterInitCallback(chip::EndpointId endpoint); +/** @brief Binary Input (Basic) Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfBinaryInputBasicClusterInitCallback(chip::EndpointId endpoint); + /** @brief Binding Cluster Init * * Cluster Init @@ -783,6 +791,77 @@ EmberAfStatus emberAfBasicClusterClientPreAttributeChangedCallback(chip::Endpoin */ void emberAfBasicClusterClientTickCallback(chip::EndpointId endpoint); +// +// Binary Input (Basic) Cluster client +// + +/** @brief Binary Input (Basic) Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfBinaryInputBasicClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Binary Input (Basic) Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfBinaryInputBasicClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Binary Input (Basic) Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfBinaryInputBasicClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Binary Input (Basic) Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param destination The destination to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfBinaryInputBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); + +/** @brief Binary Input (Basic) Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfBinaryInputBasicClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint16_t size, + uint8_t * value); + +/** @brief Binary Input (Basic) Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfBinaryInputBasicClusterClientTickCallback(chip::EndpointId endpoint); + // // Binding Cluster client // diff --git a/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h b/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h index 9a598fbbe12543..767be3eecfd859 100644 --- a/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h +++ b/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h @@ -34,6 +34,7 @@ | AudioOutput | 0x050B | | BarrierControl | 0x0103 | | Basic | 0x0028 | +| BinaryInputBasic | 0x000F | | Binding | 0xF000 | | BridgedDeviceBasic | 0x0039 | | ColorControl | 0x0300 | @@ -466,6 +467,87 @@ chip::System::PacketBufferHandle encodeBasicClusterWriteLocalConfigDisabledAttri chip::System::PacketBufferHandle encodeBasicClusterReadClusterRevisionAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); +/*----------------------------------------------------------------------------*\ +| Cluster BinaryInputBasic | 0x000F | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * OutOfService | 0x0051 | +| * PresentValue | 0x0055 | +| * StatusFlags | 0x006F | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/** + * @brief + * Encode a Binary Input (Basic) server discover command into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeBinaryInputBasicClusterDiscoverAttributes(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Binary Input (Basic) server read command for the out of service attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeBinaryInputBasicClusterReadOutOfServiceAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Binary Input (Basic) server write command for the out of service attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle +encodeBinaryInputBasicClusterWriteOutOfServiceAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, uint8_t outOfService); + +/** + * @brief + * Encode a Binary Input (Basic) server read command for the present value attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeBinaryInputBasicClusterReadPresentValueAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Binary Input (Basic) server write command for the present value attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle +encodeBinaryInputBasicClusterWritePresentValueAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, uint8_t presentValue); + +/** + * @brief + * Encode a Binary Input (Basic) server configure report command for the present value attribute into buffer including the APS + * frame + */ +chip::System::PacketBufferHandle encodeBinaryInputBasicClusterConfigurePresentValueAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint, + uint16_t minInterval, + uint16_t maxInterval); + +/** + * @brief + * Encode a Binary Input (Basic) server read command for the status flags attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeBinaryInputBasicClusterReadStatusFlagsAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Binary Input (Basic) server configure report command for the status flags attribute into buffer including the APS + * frame + */ +chip::System::PacketBufferHandle encodeBinaryInputBasicClusterConfigureStatusFlagsAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint, + uint16_t minInterval, + uint16_t maxInterval); + +/** + * @brief + * Encode a Binary Input (Basic) server read command for the cluster revision attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeBinaryInputBasicClusterReadClusterRevisionAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + /*----------------------------------------------------------------------------*\ | Cluster Binding | 0xF000 | |------------------------------------------------------------------------------| diff --git a/src/controller/data_model/gen/encoder.cpp b/src/controller/data_model/gen/encoder.cpp index d10182363451d1..1efa6838c8775f 100644 --- a/src/controller/data_model/gen/encoder.cpp +++ b/src/controller/data_model/gen/encoder.cpp @@ -60,6 +60,7 @@ using namespace chip::Encoding::LittleEndian; | AudioOutput | 0x050B | | BarrierControl | 0x0103 | | Basic | 0x0028 | +| BinaryInputBasic | 0x000F | | Binding | 0xF000 | | BridgedDeviceBasic | 0x0039 | | ColorControl | 0x0300 | @@ -142,6 +143,8 @@ using namespace chip::Encoding::LittleEndian; #define BASIC_CLUSTER_ID 0x0028 #define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00) +#define BINARY_INPUT_BASIC_CLUSTER_ID 0x000F + #define BINDING_CLUSTER_ID 0xF000 #define ZCL_BIND_COMMAND_ID (0x00) #define ZCL_UNBIND_COMMAND_ID (0x01) @@ -896,6 +899,121 @@ PacketBufferHandle encodeBasicClusterReadClusterRevisionAttribute(uint8_t seqNum COMMAND_FOOTER(); } +/*----------------------------------------------------------------------------*\ +| Cluster BinaryInputBasic | 0x000F | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * OutOfService | 0x0051 | +| * PresentValue | 0x0055 | +| * StatusFlags | 0x006F | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +PacketBufferHandle encodeBinaryInputBasicClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("DiscoverBinaryInputBasicAttributes", BINARY_INPUT_BASIC_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF); + COMMAND_FOOTER(); +} + +/* + * Attribute OutOfService + */ +PacketBufferHandle encodeBinaryInputBasicClusterReadOutOfServiceAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadBinaryInputBasicOutOfService", BINARY_INPUT_BASIC_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0051); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeBinaryInputBasicClusterWriteOutOfServiceAttribute(uint8_t seqNum, EndpointId destinationEndpoint, + uint8_t outOfService) +{ + COMMAND_HEADER("WriteBinaryInputBasicOutOfService", BINARY_INPUT_BASIC_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0051) + .Put8(16) + .Put8(static_cast(outOfService)); + COMMAND_FOOTER(); +} + +/* + * Attribute PresentValue + */ +PacketBufferHandle encodeBinaryInputBasicClusterReadPresentValueAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadBinaryInputBasicPresentValue", BINARY_INPUT_BASIC_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0055); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeBinaryInputBasicClusterWritePresentValueAttribute(uint8_t seqNum, EndpointId destinationEndpoint, + uint8_t presentValue) +{ + COMMAND_HEADER("WriteBinaryInputBasicPresentValue", BINARY_INPUT_BASIC_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0055) + .Put8(16) + .Put8(static_cast(presentValue)); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeBinaryInputBasicClusterConfigurePresentValueAttribute(uint8_t seqNum, EndpointId destinationEndpoint, + uint16_t minInterval, uint16_t maxInterval) +{ + COMMAND_HEADER("ReportBinaryInputBasicPresentValue", BINARY_INPUT_BASIC_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID) + .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED) + .Put16(0x0055) + .Put8(16) + .Put16(minInterval) + .Put16(maxInterval); + COMMAND_FOOTER(); +} + +/* + * Attribute StatusFlags + */ +PacketBufferHandle encodeBinaryInputBasicClusterReadStatusFlagsAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadBinaryInputBasicStatusFlags", BINARY_INPUT_BASIC_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x006F); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeBinaryInputBasicClusterConfigureStatusFlagsAttribute(uint8_t seqNum, EndpointId destinationEndpoint, + uint16_t minInterval, uint16_t maxInterval) +{ + COMMAND_HEADER("ReportBinaryInputBasicStatusFlags", BINARY_INPUT_BASIC_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID) + .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED) + .Put16(0x006F) + .Put8(24) + .Put16(minInterval) + .Put16(maxInterval); + COMMAND_FOOTER(); +} + +/* + * Attribute ClusterRevision + */ +PacketBufferHandle encodeBinaryInputBasicClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadBinaryInputBasicClusterRevision", BINARY_INPUT_BASIC_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD); + COMMAND_FOOTER(); +} + /*----------------------------------------------------------------------------*\ | Cluster Binding | 0xF000 | |------------------------------------------------------------------------------| diff --git a/src/controller/data_model/gen/endpoint_config.h b/src/controller/data_model/gen/endpoint_config.h index 94fae2afea240b..faf9da2b254532 100644 --- a/src/controller/data_model/gen/endpoint_config.h +++ b/src/controller/data_model/gen/endpoint_config.h @@ -63,7 +63,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 40 +#define GENERATED_ATTRIBUTE_COUNT 41 #define GENERATED_ATTRIBUTES \ { \ \ @@ -82,6 +82,9 @@ /* Endpoint: 1, Cluster: Level Control (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ + /* Endpoint: 1, Cluster: Binary Input (Basic) (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ /* Endpoint: 1, Cluster: Descriptor (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ @@ -197,7 +200,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 40 +#define GENERATED_CLUSTER_COUNT 41 #define GENERATED_CLUSTERS \ { \ { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */ \ @@ -208,105 +211,108 @@ 0x0008, ZAP_ATTRIBUTE_INDEX(4), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Level Control (client) */ \ { \ - 0x001D, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x000F, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Binary Input (Basic) (client) */ \ + { \ + 0x001D, ZAP_ATTRIBUTE_INDEX(6), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Descriptor (client) */ \ - { 0x0028, ZAP_ATTRIBUTE_INDEX(6), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */ \ + { 0x0028, ZAP_ATTRIBUTE_INDEX(7), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */ \ { \ - 0x0030, ZAP_ATTRIBUTE_INDEX(7), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0030, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: General Commissioning (client) */ \ { \ - 0x0031, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0031, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Network Commissioning (client) */ \ { \ - 0x0033, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0033, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: General Diagnostics (client) */ \ { \ - 0x0034, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0034, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Software Diagnostics (client) */ \ { \ - 0x0037, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0037, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Ethernet Network Diagnostics (client) */ \ { \ - 0x0039, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0039, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Bridged Device Basic (client) */ \ - { 0x003B, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Switch (client) */ \ + { 0x003B, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Switch (client) */ \ { \ - 0x003E, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x003E, ZAP_ATTRIBUTE_INDEX(15), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Operational Credentials (client) */ \ { \ - 0x003F, ZAP_ATTRIBUTE_INDEX(15), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x003F, ZAP_ATTRIBUTE_INDEX(16), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Trusted Root Certificates (client) */ \ { \ - 0x0040, ZAP_ATTRIBUTE_INDEX(16), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0040, ZAP_ATTRIBUTE_INDEX(17), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Fixed Label (client) */ \ { \ - 0x0101, ZAP_ATTRIBUTE_INDEX(17), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0101, ZAP_ATTRIBUTE_INDEX(18), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Door Lock (client) */ \ { \ - 0x0102, ZAP_ATTRIBUTE_INDEX(18), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0102, ZAP_ATTRIBUTE_INDEX(19), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Window Covering (client) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(19), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(20), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (client) */ \ { \ - 0x0200, ZAP_ATTRIBUTE_INDEX(20), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0200, ZAP_ATTRIBUTE_INDEX(21), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Pump Configuration and Control (client) */ \ { \ - 0x0201, ZAP_ATTRIBUTE_INDEX(21), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0201, ZAP_ATTRIBUTE_INDEX(22), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Thermostat (client) */ \ { \ - 0x0300, ZAP_ATTRIBUTE_INDEX(22), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0300, ZAP_ATTRIBUTE_INDEX(23), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Color Control (client) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(23), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(24), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (client) */ \ { \ - 0x0405, ZAP_ATTRIBUTE_INDEX(24), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0405, ZAP_ATTRIBUTE_INDEX(25), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Relative Humidity Measurement (client) */ \ { \ - 0x0503, ZAP_ATTRIBUTE_INDEX(25), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0503, ZAP_ATTRIBUTE_INDEX(26), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Wake on LAN (client) */ \ { \ - 0x0504, ZAP_ATTRIBUTE_INDEX(26), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0504, ZAP_ATTRIBUTE_INDEX(27), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: TV Channel (client) */ \ { \ - 0x0505, ZAP_ATTRIBUTE_INDEX(27), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0505, ZAP_ATTRIBUTE_INDEX(28), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Target Navigator (client) */ \ { \ - 0x0506, ZAP_ATTRIBUTE_INDEX(28), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0506, ZAP_ATTRIBUTE_INDEX(29), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Media Playback (client) */ \ { \ - 0x0507, ZAP_ATTRIBUTE_INDEX(29), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0507, ZAP_ATTRIBUTE_INDEX(30), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Media Input (client) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(30), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(31), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Low Power (client) */ \ { \ - 0x0509, ZAP_ATTRIBUTE_INDEX(31), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0509, ZAP_ATTRIBUTE_INDEX(32), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Keypad Input (client) */ \ { \ - 0x050A, ZAP_ATTRIBUTE_INDEX(32), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050A, ZAP_ATTRIBUTE_INDEX(33), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Content Launch (client) */ \ { \ - 0x050B, ZAP_ATTRIBUTE_INDEX(33), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050B, ZAP_ATTRIBUTE_INDEX(34), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Audio Output (client) */ \ { \ - 0x050C, ZAP_ATTRIBUTE_INDEX(34), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050C, ZAP_ATTRIBUTE_INDEX(35), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Launcher (client) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(35), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(36), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (client) */ \ { \ - 0x050E, ZAP_ATTRIBUTE_INDEX(36), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050E, ZAP_ATTRIBUTE_INDEX(37), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Account Login (client) */ \ { \ - 0x050F, ZAP_ATTRIBUTE_INDEX(37), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(38), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (client) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(38), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(39), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Binding (client) */ \ { \ - 0xF004, ZAP_ATTRIBUTE_INDEX(39), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF004, ZAP_ATTRIBUTE_INDEX(40), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Group Key Management (client) */ \ } @@ -315,7 +321,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 40, 80 }, \ + { ZAP_CLUSTER_INDEX(0), 41, 82 }, \ } // Largest attribute size is needed for various buffers @@ -325,7 +331,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (4) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (80) +#define ATTRIBUTE_MAX_SIZE (82) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) diff --git a/src/controller/data_model/gen/gen_config.h b/src/controller/data_model/gen/gen_config.h index 73309031c43ff2..3609aa8bbb7d8d 100644 --- a/src/controller/data_model/gen/gen_config.h +++ b/src/controller/data_model/gen/gen_config.h @@ -35,6 +35,7 @@ #define EMBER_AF_AUDIO_OUTPUT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_BARRIER_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_BASIC_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_BINARY_INPUT_BASIC_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_BINDING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_BRIDGED_DEVICE_BASIC_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_COLOR_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) @@ -96,6 +97,10 @@ #define ZCL_USING_BASIC_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_BASIC_CLIENT +// Use this macro to check if the client side of the Binary Input (Basic) cluster is included +#define ZCL_USING_BINARY_INPUT_BASIC_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_BINARY_INPUT_BASIC_CLIENT + // Use this macro to check if the client side of the Binding cluster is included #define ZCL_USING_BINDING_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_BINDING_CLIENT diff --git a/src/controller/python/chip-device-ctrl.py b/src/controller/python/chip-device-ctrl.py index f85732a1628a29..5b0b58d9131460 100755 --- a/src/controller/python/chip-device-ctrl.py +++ b/src/controller/python/chip-device-ctrl.py @@ -39,6 +39,7 @@ import time import string import re +import traceback from cmd import Cmd from chip.ChipBleUtility import FAKE_CONN_OBJ_VALUE from chip.setup_payload import SetupPayload @@ -151,8 +152,13 @@ def __init__(self, rendezvousAddr=None, controllerNodeId=0, bluetoothAdapter=Non # If we are on Linux and user selects non-default bluetooth adapter. if sys.platform.startswith("linux") and (bluetoothAdapter is not None): - self.bleMgr = BleManager(self.devCtrl) - self.bleMgr.ble_adapter_select("hci{}".format(bluetoothAdapter)) + try: + self.bleMgr = BleManager(self.devCtrl) + self.bleMgr.ble_adapter_select("hci{}".format(bluetoothAdapter)) + except Exception as ex: + traceback.print_exc() + print("Failed to initialize BLE, if you don't have BLE, run chip-device-ctrl with --no-ble") + raise ex self.historyFileName = os.path.expanduser( "~/.chip-device-ctrl-history") @@ -743,9 +749,15 @@ def main(): dest="bluetoothAdapter", default="hci0", type="str", - help="Controller bluetooth adapter ID", + help="Controller bluetooth adapter ID, use --no-ble to disable bluetooth functions.", metavar="", ) + optParser.add_option( + "--no-ble", + action="store_true", + dest="disableBluetooth", + help="Disable bluetooth, calling BLE related feature with this flag results in undefined behavior.", + ) (options, remainingArgs) = optParser.parse_args(sys.argv[1:]) if len(remainingArgs) != 0: @@ -754,7 +766,9 @@ def main(): adapterId = None if sys.platform.startswith("linux"): - if not options.bluetoothAdapter.startswith("hci"): + if options.disableBluetooth: + adapterId = None + elif not options.bluetoothAdapter.startswith("hci"): print( "Invalid bluetooth adapter: {}, adapter name looks like hci0, hci1 etc.") sys.exit(-1) @@ -766,8 +780,14 @@ def main(): "Invalid bluetooth adapter: {}, adapter name looks like hci0, hci1 etc.") sys.exit(-1) - devMgrCmd = DeviceMgrCmd(rendezvousAddr=options.rendezvousAddr, - controllerNodeId=options.controllerNodeId, bluetoothAdapter=adapterId) + try: + devMgrCmd = DeviceMgrCmd(rendezvousAddr=options.rendezvousAddr, + controllerNodeId=options.controllerNodeId, bluetoothAdapter=adapterId) + except Exception as ex: + print(ex) + print("Failed to bringup CHIPDeviceController CLI") + sys.exit(1) + print("Chip Device Controller Shell") if options.rendezvousAddr: print("Rendezvous address set to %s" % options.rendezvousAddr) diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 0b2e85ad54e9a2..6914fd07e6b0c9 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -490,6 +490,65 @@ CHIP_ERROR chip_ime_ReadAttribute_Basic_ClusterRevision(chip::Controller::Device } // End of Cluster Basic +// Cluster BinaryInputBasic + +CHIP_ERROR chip_ime_ReadAttribute_BinaryInputBasic_OutOfService(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOutOfService(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_BinaryInputBasic_PresentValue(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePresentValue(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_BinaryInputBasic_PresentValue(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, uint16_t minInterval, + uint16_t maxInterval) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributePresentValue(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval); +} +CHIP_ERROR chip_ime_ReadAttribute_BinaryInputBasic_StatusFlags(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeStatusFlags(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_BinaryInputBasic_StatusFlags(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, uint16_t minInterval, + uint16_t maxInterval) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeStatusFlags(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval); +} +CHIP_ERROR chip_ime_ReadAttribute_BinaryInputBasic_ClusterRevision(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BinaryInputBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster BinaryInputBasic // Cluster Binding CHIP_ERROR chip_ime_AppendCommand_Binding_Bind(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 011ebdd1f53d22..a003377fc92b8d 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -76,6 +76,8 @@ def ListClusterCommands(self): "MfgSpecificPing": { }, }, + "BinaryInputBasic": { + }, "Binding": { "Bind": { "nodeId": "int", @@ -687,6 +689,12 @@ def ListClusterAttributes(self): "LocalConfigDisabled", "ClusterRevision", ], + "BinaryInputBasic": [ + "OutOfService", + "PresentValue", + "StatusFlags", + "ClusterRevision", + ], "Binding": [ "ClusterRevision", ], @@ -1572,6 +1580,18 @@ def ClusterBasic_ReadAttributeLocalConfigDisabled(self, device: ctypes.c_void_p, return self._chipLib.chip_ime_ReadAttribute_Basic_LocalConfigDisabled(device, ZCLendpoint, ZCLgroupid) def ClusterBasic_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_Basic_ClusterRevision(device, ZCLendpoint, ZCLgroupid) + def ClusterBinaryInputBasic_ReadAttributeOutOfService(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_OutOfService(device, ZCLendpoint, ZCLgroupid) + def ClusterBinaryInputBasic_ReadAttributePresentValue(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_PresentValue(device, ZCLendpoint, ZCLgroupid) + def ClusterBinaryInputBasic_ConfigureAttributePresentValue(self, device: ctypes.c_void_p, ZCLendpoint: int, minInterval: int, maxInterval: int, change: int): + return self._chipLib.chip_ime_ConfigureAttribute_BinaryInputBasic_PresentValue(device, ZCLendpoint, minInterval, maxInterval, change) + def ClusterBinaryInputBasic_ReadAttributeStatusFlags(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_StatusFlags(device, ZCLendpoint, ZCLgroupid) + def ClusterBinaryInputBasic_ConfigureAttributeStatusFlags(self, device: ctypes.c_void_p, ZCLendpoint: int, minInterval: int, maxInterval: int, change: int): + return self._chipLib.chip_ime_ConfigureAttribute_BinaryInputBasic_StatusFlags(device, ZCLendpoint, minInterval, maxInterval, change) + def ClusterBinaryInputBasic_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterBinding_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_Binding_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterBridgedDeviceBasic_ReadAttributeVendorName(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): @@ -2082,6 +2102,25 @@ def InitLib(self, chipLib): # Cluster Basic ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_Basic_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_Basic_ClusterRevision.restype = ctypes.c_uint32 + # Cluster BinaryInputBasic + # Cluster BinaryInputBasic ReadAttribute OutOfService + self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_OutOfService.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_OutOfService.restype = ctypes.c_uint32 + # Cluster BinaryInputBasic ReadAttribute PresentValue + self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_PresentValue.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_PresentValue.restype = ctypes.c_uint32 + # Cluster BinaryInputBasic ConfigureAttribute PresentValue + self._chipLib.chip_ime_ConfigureAttribute_BinaryInputBasic_PresentValue.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16] + self._chipLib.chip_ime_ConfigureAttribute_BinaryInputBasic_PresentValue.restype = ctypes.c_uint32 + # Cluster BinaryInputBasic ReadAttribute StatusFlags + self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_StatusFlags.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_StatusFlags.restype = ctypes.c_uint32 + # Cluster BinaryInputBasic ConfigureAttribute StatusFlags + self._chipLib.chip_ime_ConfigureAttribute_BinaryInputBasic_StatusFlags.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16] + self._chipLib.chip_ime_ConfigureAttribute_BinaryInputBasic_StatusFlags.restype = ctypes.c_uint32 + # Cluster BinaryInputBasic ReadAttribute ClusterRevision + self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_BinaryInputBasic_ClusterRevision.restype = ctypes.c_uint32 # Cluster Binding # Cluster Binding Command Bind self._chipLib.chip_ime_AppendCommand_Binding_Bind.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint64, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint16] diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h index 7c2c2a1776fa0d..eb1be7abc986fe 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h @@ -151,6 +151,29 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Binary Input (Basic) + * + */ +@interface CHIPBinaryInputBasic : CHIPCluster + +- (void)readAttributeOutOfServiceWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeOutOfServiceWithValue:(uint8_t)value responseHandler:(ResponseHandler)responseHandler; +- (void)readAttributePresentValueWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributePresentValueWithValue:(uint8_t)value responseHandler:(ResponseHandler)responseHandler; +- (void)configureAttributePresentValueWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler; +- (void)reportAttributePresentValueWithResponseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeStatusFlagsWithResponseHandler:(ResponseHandler)responseHandler; +- (void)configureAttributeStatusFlagsWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler; +- (void)reportAttributeStatusFlagsWithResponseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler; + +@end + /** * Cluster Binding * diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm index 664040caa7d0db..e0e2df748ef1ed 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm @@ -4724,6 +4724,278 @@ - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)respons @end +@interface CHIPBinaryInputBasic () +@property (readonly) Controller::BinaryInputBasicCluster cppCluster; +@end + +@implementation CHIPBinaryInputBasic + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeOutOfServiceWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPBooleanAttributeCallbackBridge * onSuccess = new CHIPBooleanAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeOutOfService(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeOutOfServiceWithValue:(uint8_t)value responseHandler:(ResponseHandler)responseHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeOutOfService(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributePresentValueWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPBooleanAttributeCallbackBridge * onSuccess = new CHIPBooleanAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributePresentValue(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributePresentValueWithValue:(uint8_t)value responseHandler:(ResponseHandler)responseHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributePresentValue(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributePresentValueWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ConfigureAttributePresentValue(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributePresentValueWithResponseHandler:(ResponseHandler)reportHandler +{ + CHIPBooleanAttributeCallbackBridge * onReport + = new CHIPBooleanAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReportAttributePresentValue(onReport->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeStatusFlagsWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeStatusFlags(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeStatusFlagsWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ConfigureAttributeStatusFlags(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeStatusFlagsWithResponseHandler:(ResponseHandler)reportHandler +{ + CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReportAttributeStatusFlags(onReport->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPBinding () @property (readonly) Controller::BindingCluster cppCluster; @end diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index dcba4914bd5689..3f77de3e1581d7 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -933,6 +933,120 @@ - (void)testSendClusterBasicReadAttributeClusterRevisionWithResponseHandler [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterBinaryInputBasicReadAttributeOutOfServiceWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"BinaryInputBasicReadAttributeOutOfServiceWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPBinaryInputBasic * cluster = [[CHIPBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOutOfServiceWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"BinaryInputBasic OutOfService Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterBinaryInputBasicWriteAttributeOutOfServiceWithValue +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"BinaryInputBasicWriteAttributeOutOfServiceWithValue"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPBinaryInputBasic * cluster = [[CHIPBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t value = 0x00; + [cluster writeAttributeOutOfServiceWithValue:value + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"BinaryInputBasic OutOfService Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterBinaryInputBasicReadAttributePresentValueWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"BinaryInputBasicReadAttributePresentValueWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPBinaryInputBasic * cluster = [[CHIPBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributePresentValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"BinaryInputBasic PresentValue Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterBinaryInputBasicWriteAttributePresentValueWithValue +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"BinaryInputBasicWriteAttributePresentValueWithValue"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPBinaryInputBasic * cluster = [[CHIPBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t value = 0; + [cluster writeAttributePresentValueWithValue:value + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"BinaryInputBasic PresentValue Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterBinaryInputBasicReadAttributeStatusFlagsWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"BinaryInputBasicReadAttributeStatusFlagsWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPBinaryInputBasic * cluster = [[CHIPBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeStatusFlagsWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"BinaryInputBasic StatusFlags Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterBinaryInputBasicReadAttributeClusterRevisionWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"BinaryInputBasicReadAttributeClusterRevisionWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPBinaryInputBasic * cluster = [[CHIPBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"BinaryInputBasic ClusterRevision Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterBindingReadAttributeClusterRevisionWithResponseHandler { XCTestExpectation * expectation = [self expectationWithDescription:@"BindingReadAttributeClusterRevisionWithResponseHandler"]; diff --git a/src/lib/mdns/minimal/core/Constants.h b/src/lib/mdns/minimal/core/Constants.h index 68f831fc8ec75d..e081edf5e62b79 100644 --- a/src/lib/mdns/minimal/core/Constants.h +++ b/src/lib/mdns/minimal/core/Constants.h @@ -45,6 +45,9 @@ enum class QType : uint16_t /// Flag encoded in QCLASS requesting unicast answers constexpr uint16_t kQClassUnicastAnswerFlag = 0x8000; +// Flag used to indicate receiver should flush cache rather than appending. Used for Response RR's. +// See https://datatracker.ietf.org/doc/html/rfc6762#section-10.2. +constexpr uint16_t kQClassResponseFlushBit = 0x8000; enum class QClass : uint16_t { @@ -53,6 +56,7 @@ enum class QClass : uint16_t // Unicast version for the class IN_UNICAST = IN | kQClassUnicastAnswerFlag, + IN_FLUSH = IN | kQClassResponseFlushBit, }; enum class ResourceType diff --git a/src/lib/mdns/minimal/records/ResourceRecord.h b/src/lib/mdns/minimal/records/ResourceRecord.h index 1a1558e2fd5ee8..68008b8b8088f8 100644 --- a/src/lib/mdns/minimal/records/ResourceRecord.h +++ b/src/lib/mdns/minimal/records/ResourceRecord.h @@ -38,7 +38,7 @@ class ResourceRecord ResourceRecord & operator=(const ResourceRecord & other) = default; const FullQName & GetName() const { return mQName; } - QClass GetClass() const { return QClass::IN; } + QClass GetClass() const { return mCacheFlush ? QClass::IN_FLUSH : QClass::IN; } QType GetType() const { return mType; } uint32_t GetTtl() const { return mTtl; } @@ -48,6 +48,13 @@ class ResourceRecord return *this; } + ResourceRecord & SetCacheFlush(bool set) + { + mCacheFlush = set; + return *this; + } + bool GetCacheFlush() const { return mCacheFlush; } + /// Append the given record to the underlying output. /// Updates header item count on success, does NOT update header on failure. bool Append(HeaderRef & hdr, ResourceType asType, chip::Encoding::BigEndian::BufferWriter & out) const; @@ -62,6 +69,7 @@ class ResourceRecord QType mType; uint32_t mTtl = kDefaultTtl; FullQName mQName; + bool mCacheFlush = false; }; } // namespace Minimal diff --git a/src/lib/mdns/minimal/records/tests/TestResourceRecord.cpp b/src/lib/mdns/minimal/records/tests/TestResourceRecord.cpp index bc571cb75caa99..fbb5861462b366 100644 --- a/src/lib/mdns/minimal/records/tests/TestResourceRecord.cpp +++ b/src/lib/mdns/minimal/records/tests/TestResourceRecord.cpp @@ -245,6 +245,23 @@ void RecordCount(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == i + 1); } } +void CacheFlushBit(nlTestSuite * inSuite, void * inContext) +{ + FakeResourceRecord record("somedata"); + // No cache flush bit by default. + NL_TEST_ASSERT(inSuite, record.GetClass() == QClass::IN); + NL_TEST_ASSERT(inSuite, record.GetCacheFlush() == false); + + // Check we can set flush bit and the class marker reflects that. + record.SetCacheFlush(true); + NL_TEST_ASSERT(inSuite, record.GetClass() == QClass::IN_FLUSH); + NL_TEST_ASSERT(inSuite, record.GetCacheFlush() == true); + + // Check we can unset. + record.SetCacheFlush(false); + NL_TEST_ASSERT(inSuite, record.GetClass() == QClass::IN); + NL_TEST_ASSERT(inSuite, record.GetCacheFlush() == false); +} const nlTest sTests[] = { NL_TEST_DEF("CanWriteSimpleRecord", CanWriteSimpleRecord), // @@ -252,6 +269,7 @@ const nlTest sTests[] = { NL_TEST_DEF("RecordOrderIsEnforced", RecordOrderIsEnforced), // NL_TEST_DEF("ErrorsOutOnSmallBuffers", ErrorsOutOnSmallBuffers), // NL_TEST_DEF("RecordCount", RecordCount), // + NL_TEST_DEF("CacheFlushBit", CacheFlushBit), // NL_TEST_SENTINEL() // }; diff --git a/src/messaging/ExchangeMessageDispatch.h b/src/messaging/ExchangeMessageDispatch.h index 57179710d84017..d5cc4111d1d338 100644 --- a/src/messaging/ExchangeMessageDispatch.h +++ b/src/messaging/ExchangeMessageDispatch.h @@ -48,6 +48,11 @@ class ExchangeMessageDispatch : public ReferenceCounted ReliableMessageContext * reliableMessageContext, bool isReliableTransmission, Protocols::Id protocol, uint8_t type, System::PacketBufferHandle && message); + /** + * The 'message' and 'retainedMessage' arguments may point to the same + * handle. Therefore, callees _must_ ensure that any moving out of + * 'message' happens before writing to *retainedMessage. + */ virtual CHIP_ERROR ResendMessage(SecureSessionHandle session, EncryptedPacketBufferHandle && message, EncryptedPacketBufferHandle * retainedMessage) const { diff --git a/src/messaging/ReliableMessageMgr.cpp b/src/messaging/ReliableMessageMgr.cpp index e5a8c2025839a1..ab84a91cb1031a 100644 --- a/src/messaging/ReliableMessageMgr.cpp +++ b/src/messaging/ReliableMessageMgr.cpp @@ -296,7 +296,8 @@ CHIP_ERROR ReliableMessageMgr::AddToRetransTable(ReliableMessageContext * rc, Re void ReliableMessageMgr::StartRetransmision(RetransTableEntry * entry) { - VerifyOrDie(entry != nullptr && entry->rc != nullptr); + VerifyOrReturn(entry != nullptr && entry->rc != nullptr, + ChipLogError(ExchangeManager, "StartRetransmission was called for invalid entry")); entry->nextRetransTimeTick = static_cast(entry->rc->GetInitialRetransmitTimeoutTick() + GetTickCounterFromTimeDelta(System::Timer::GetCurrentEpoch())); diff --git a/src/messaging/tests/TestReliableMessageProtocol.cpp b/src/messaging/tests/TestReliableMessageProtocol.cpp index 32d1b855a28ead..5d0179743cdff9 100644 --- a/src/messaging/tests/TestReliableMessageProtocol.cpp +++ b/src/messaging/tests/TestReliableMessageProtocol.cpp @@ -128,6 +128,22 @@ class MockSessionEstablishmentExchangeDispatch : public Messaging::ExchangeMessa return gTransportMgr.SendMessage(Transport::PeerAddress(), std::move(message)); } + CHIP_ERROR ResendMessage(SecureSessionHandle session, EncryptedPacketBufferHandle && message, + EncryptedPacketBufferHandle * retainedMessage) const override + { + // Our send path needs a (writable) PacketBuffer, so get that from the + // EncryptedPacketBufferHandle. Note that we have to do this before we + // set *retainedMessage, because 'message' and '*retainedMessage' might + // be the same memory location and we have to guarantee that we move out + // of 'message' before we write to *retainedMessage. + System::PacketBufferHandle writableBuf(std::move(message).CastToWritable()); + if (retainedMessage != nullptr && mRetainMessageOnSend) + { + *retainedMessage = EncryptedPacketBufferHandle::MarkEncrypted(writableBuf.Retain()); + } + return gTransportMgr.SendMessage(Transport::PeerAddress(), std::move(writableBuf)); + } + bool MessagePermitted(uint16_t protocol, uint8_t type) override { return true; } bool mRetainMessageOnSend = true; @@ -140,6 +156,12 @@ class MockSessionEstablishmentDelegate : public ExchangeDelegate System::PacketBufferHandle && buffer) override { IsOnMessageReceivedCalled = true; + ec->Close(); + if (mTestSuite != nullptr) + { + NL_TEST_ASSERT(mTestSuite, buffer->TotalLength() == sizeof(PAYLOAD)); + NL_TEST_ASSERT(mTestSuite, memcmp(buffer->Start(), PAYLOAD, buffer->TotalLength()) == 0); + } } void OnResponseTimeout(ExchangeContext * ec) override {} @@ -151,6 +173,7 @@ class MockSessionEstablishmentDelegate : public ExchangeDelegate bool IsOnMessageReceivedCalled = false; MockSessionEstablishmentExchangeDispatch mMessageDispatch; + nlTestSuite * mTestSuite = nullptr; }; void test_os_sleep_ms(uint64_t millisecs) @@ -464,6 +487,94 @@ void CheckResendApplicationMessageWithPeerExchange(nlTestSuite * inSuite, void * rm->ClearRetransTable(rc); } +void CheckResendSessionEstablishmentMessageWithPeerExchange(nlTestSuite * inSuite, void * inContext) +{ + // Making this static to reduce stack usage, as some platforms have limits on stack size. + static TestContext ctx; + + CHIP_ERROR err = ctx.Init(inSuite, &gTransportMgr); + NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + + ctx.SetSourceNodeId(kAnyNodeId); + ctx.SetDestinationNodeId(kAnyNodeId); + ctx.SetLocalKeyId(0); + ctx.SetPeerKeyId(0); + ctx.SetAdminId(kUndefinedAdminId); + + ctx.GetInetLayer().SystemLayer()->Init(nullptr); + + chip::System::PacketBufferHandle buffer = chip::MessagePacketBuffer::NewWithData(PAYLOAD, sizeof(PAYLOAD)); + NL_TEST_ASSERT(inSuite, !buffer.IsNull()); + + MockSessionEstablishmentDelegate mockReceiver; + err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Echo::MsgType::EchoRequest, &mockReceiver); + NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + + mockReceiver.mTestSuite = inSuite; + + MockSessionEstablishmentDelegate mockSender; + ExchangeContext * exchange = ctx.NewExchangeToPeer(&mockSender); + NL_TEST_ASSERT(inSuite, exchange != nullptr); + + ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); + ReliableMessageContext * rc = exchange->GetReliableMessageContext(); + NL_TEST_ASSERT(inSuite, rm != nullptr); + NL_TEST_ASSERT(inSuite, rc != nullptr); + + rc->SetConfig({ + 1, // CHIP_CONFIG_RMP_DEFAULT_INITIAL_RETRY_INTERVAL + 1, // CHIP_CONFIG_RMP_DEFAULT_ACTIVE_RETRY_INTERVAL + }); + + err = mockSender.mMessageDispatch.Init(rm); + NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + + // Let's drop the initial message + gLoopback.mSendMessageCount = 0; + gLoopback.mNumMessagesToDrop = 1; + gLoopback.mDroppedMessageCount = 0; + + // Ensure the retransmit table is empty right now + NL_TEST_ASSERT(inSuite, rm->TestGetCountRetransTable() == 0); + + err = exchange->SendMessage(Echo::MsgType::EchoRequest, std::move(buffer)); + NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + exchange->Close(); + + // Ensure the message was dropped, and was added to retransmit table + NL_TEST_ASSERT(inSuite, gLoopback.mNumMessagesToDrop == 0); + NL_TEST_ASSERT(inSuite, gLoopback.mDroppedMessageCount == 1); + NL_TEST_ASSERT(inSuite, rm->TestGetCountRetransTable() == 1); + NL_TEST_ASSERT(inSuite, !mockReceiver.IsOnMessageReceivedCalled); + + // 1 tick is 64 ms, sleep 65 ms to trigger first re-transmit + test_os_sleep_ms(65); + ReliableMessageMgr::Timeout(&ctx.GetSystemLayer(), rm, CHIP_SYSTEM_NO_ERROR); + + // Ensure the retransmit message was not dropped, and is no longer in the retransmit table + NL_TEST_ASSERT(inSuite, gLoopback.mSendMessageCount >= 2); + NL_TEST_ASSERT(inSuite, gLoopback.mDroppedMessageCount == 1); + NL_TEST_ASSERT(inSuite, rm->TestGetCountRetransTable() == 0); + NL_TEST_ASSERT(inSuite, mockReceiver.IsOnMessageReceivedCalled); + + mockReceiver.mTestSuite = nullptr; + + err = ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(Echo::MsgType::EchoRequest); + NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + + rm->ClearRetransTable(rc); + ctx.Shutdown(); + + // This test didn't use the global test context because the session establishment messages + // do not carry encryption key IDs (as the messages are not encrypted), or node IDs (as these + // are not assigned yet). A temporary context is created with default values for these + // parameters. + // Let's reset the state of transport manager so that other tests are not impacted + // as those could be using the global test context. + TestContext & inctx = *static_cast(inContext); + gTransportMgr.SetSecureSessionMgr(&inctx.GetSecureSessionManager()); +} + void CheckSendStandaloneAckMessage(nlTestSuite * inSuite, void * inContext) { TestContext & ctx = *reinterpret_cast(inContext); @@ -498,6 +609,7 @@ const nlTest sTests[] = NL_TEST_DEF("Test ReliableMessageMgr::CheckCloseExchangeAndResendApplicationMessage", CheckCloseExchangeAndResendApplicationMessage), NL_TEST_DEF("Test ReliableMessageMgr::CheckFailedMessageRetainOnSend", CheckFailedMessageRetainOnSend), NL_TEST_DEF("Test ReliableMessageMgr::CheckResendApplicationMessageWithPeerExchange", CheckResendApplicationMessageWithPeerExchange), + NL_TEST_DEF("Test ReliableMessageMgr::CheckResendSessionEstablishmentMessageWithPeerExchange", CheckResendSessionEstablishmentMessageWithPeerExchange), NL_TEST_DEF("Test ReliableMessageMgr::CheckSendStandaloneAckMessage", CheckSendStandaloneAckMessage), NL_TEST_SENTINEL() diff --git a/src/platform/Zephyr/BLEManagerImpl.cpp b/src/platform/Zephyr/BLEManagerImpl.cpp index 2541cc1d9be314..14b2d921e487b2 100644 --- a/src/platform/Zephyr/BLEManagerImpl.cpp +++ b/src/platform/Zephyr/BLEManagerImpl.cpp @@ -249,13 +249,6 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) VerifyOrExit(err == CHIP_NO_ERROR, err = MapErrorZephyr(err)); err = bt_le_adv_start(&advParams, ad, ARRAY_SIZE(ad), nullptr, 0u); - if (err == -ENOMEM) - { - // No free connection objects for connectable advertiser. Advertise as non-connectable instead. - advParams.options &= ~BT_LE_ADV_OPT_CONNECTABLE; - err = bt_le_adv_start(&advParams, ad, ARRAY_SIZE(ad), nullptr, 0u); - } - VerifyOrExit(err == CHIP_NO_ERROR, err = MapErrorZephyr(err)); // Transition to the Advertising state... diff --git a/src/protocols/secure_channel/CASEServer.cpp b/src/protocols/secure_channel/CASEServer.cpp index 25adca9cbf1794..0176bb250727e6 100644 --- a/src/protocols/secure_channel/CASEServer.cpp +++ b/src/protocols/secure_channel/CASEServer.cpp @@ -41,7 +41,7 @@ CHIP_ERROR CASEServer::ListenForSessionEstablishment(Messaging::ExchangeManager mAdmins = admins; mExchangeManager = exchangeManager; - ReturnErrorOnFailure(mPairingSession.MessageDispatch().Init(transportMgr)); + ReturnErrorOnFailure(mPairingSession.MessageDispatch().Init(mExchangeManager->GetReliableMessageMgr(), transportMgr)); ExchangeDelegate * delegate = this; ReturnErrorOnFailure( diff --git a/src/protocols/secure_channel/CASESession.cpp b/src/protocols/secure_channel/CASESession.cpp index fa0ff9b0333364..61e9cb88f7ace4 100644 --- a/src/protocols/secure_channel/CASESession.cpp +++ b/src/protocols/secure_channel/CASESession.cpp @@ -103,6 +103,11 @@ void CASESession::Clear() mTrustedRootId.mId = nullptr; } + CloseExchange(); +} + +void CASESession::CloseExchange() +{ if (mExchangeCtxt != nullptr) { mExchangeCtxt->Close(); @@ -220,7 +225,7 @@ CASESession::ListenForSessionEstablishment(OperationalCredentialSet * operationa mNextExpectedMsg = Protocols::SecureChannel::MsgType::CASE_SigmaR1; mPairingComplete = false; - ChipLogDetail(Inet, "Waiting for SigmaR1 msg"); + ChipLogDetail(SecureChannel, "Waiting for SigmaR1 msg"); return CHIP_NO_ERROR; } @@ -231,6 +236,7 @@ CHIP_ERROR CASESession::EstablishSession(const Transport::PeerAddress peerAddres { CHIP_ERROR err = CHIP_NO_ERROR; + // Return early on error here, as we have not initalized any state yet ReturnErrorCodeIf(exchangeCtxt == nullptr, CHIP_ERROR_INVALID_ARGUMENT); err = Init(operationalCredentialSet, myKeyId, delegate); @@ -238,6 +244,9 @@ CHIP_ERROR CASESession::EstablishSession(const Transport::PeerAddress peerAddres // We are setting the exchange context specifically before checking for error. // This is to make sure the exchange will get closed if Init() returned an error. mExchangeCtxt = exchangeCtxt; + + // From here onwards, let's go to exit on error, as some state might have already + // been initialized SuccessOrExit(err); mExchangeCtxt->SetResponseTimeout(kSigma_Response_Timeout); @@ -257,9 +266,9 @@ CHIP_ERROR CASESession::EstablishSession(const Transport::PeerAddress peerAddres void CASESession::OnResponseTimeout(ExchangeContext * ec) { - VerifyOrReturn(ec != nullptr, ChipLogError(Inet, "CASESession::OnResponseTimeout was called by null exchange")); - VerifyOrReturn(mExchangeCtxt == ec, ChipLogError(Inet, "CASESession::OnResponseTimeout exchange doesn't match")); - ChipLogError(Inet, "CASESession timed out while waiting for a response from the peer. Expected message type was %d", + VerifyOrReturn(ec != nullptr, ChipLogError(SecureChannel, "CASESession::OnResponseTimeout was called by null exchange")); + VerifyOrReturn(mExchangeCtxt == ec, ChipLogError(SecureChannel, "CASESession::OnResponseTimeout exchange doesn't match")); + ChipLogError(SecureChannel, "CASESession timed out while waiting for a response from the peer. Expected message type was %d", mNextExpectedMsg); mDelegate->OnSessionEstablishmentError(CHIP_ERROR_TIMEOUT); Clear(); @@ -347,7 +356,7 @@ CHIP_ERROR CASESession::SendSigmaR1() ReturnErrorOnFailure(mExchangeCtxt->SendMessage(Protocols::SecureChannel::MsgType::CASE_SigmaR1, std::move(msg_R1), SendFlags(SendMessageFlags::kExpectResponse))); - ChipLogDetail(Inet, "Sent SigmaR1 msg"); + ChipLogDetail(SecureChannel, "Sent SigmaR1 msg"); return CHIP_NO_ERROR; } @@ -377,7 +386,7 @@ CHIP_ERROR CASESession::HandleSigmaR1(const System::PacketBufferHandle & msg) VerifyOrExit(buf != nullptr, err = CHIP_ERROR_MESSAGE_INCOMPLETE); VerifyOrExit(buflen >= fixed_buflen, err = CHIP_ERROR_INVALID_MESSAGE_LENGTH); - ChipLogDetail(Inet, "Received SigmaR1 msg"); + ChipLogDetail(SecureChannel, "Received SigmaR1 msg"); err = mCommissioningHash.AddData(msg->Start(), msg->DataLength()); SuccessOrExit(err); @@ -394,7 +403,7 @@ CHIP_ERROR CASESession::HandleSigmaR1(const System::PacketBufferHandle & msg) bbuf.Put(buf, kP256_PublicKey_Length); VerifyOrExit(bbuf.Fit(), err = CHIP_ERROR_NO_MEMORY); - ChipLogDetail(Inet, "Peer assigned session key ID %d", encryptionKeyId); + ChipLogDetail(SecureChannel, "Peer assigned session key ID %d", encryptionKeyId); mConnectionState.SetPeerKeyID(encryptionKeyId); exit: @@ -553,7 +562,7 @@ CHIP_ERROR CASESession::SendSigmaR2() SendFlags(SendMessageFlags::kExpectResponse)); SuccessOrExit(err); - ChipLogDetail(Inet, "Sent SigmaR2 msg"); + ChipLogDetail(SecureChannel, "Sent SigmaR2 msg"); exit: @@ -605,7 +614,7 @@ CHIP_ERROR CASESession::HandleSigmaR2(const System::PacketBufferHandle & msg) VerifyOrExit(buf != nullptr, err = CHIP_ERROR_MESSAGE_INCOMPLETE); - ChipLogDetail(Inet, "Received SigmaR2 msg"); + ChipLogDetail(SecureChannel, "Received SigmaR2 msg"); // Step 1 // skip random part @@ -613,7 +622,7 @@ CHIP_ERROR CASESession::HandleSigmaR2(const System::PacketBufferHandle & msg) encryptionKeyId = chip::Encoding::LittleEndian::Read16(buf); - ChipLogDetail(Inet, "Peer assigned session key ID %d", encryptionKeyId); + ChipLogDetail(SecureChannel, "Peer assigned session key ID %d", encryptionKeyId); mConnectionState.SetPeerKeyID(encryptionKeyId); err = FindValidTrustedRoot(&buf, 1); @@ -725,7 +734,7 @@ CHIP_ERROR CASESession::SendSigmaR3() // Step 1 saltlen = kIPKSize + kSHA256_Hash_Length; - ChipLogDetail(Inet, "Sending SigmaR3"); + ChipLogDetail(SecureChannel, "Sending SigmaR3"); msg_salt = System::PacketBufferHandle::New(saltlen); VerifyOrExit(!msg_salt.IsNull(), err = CHIP_SYSTEM_ERROR_NO_MEMORY); msg_salt->SetDataLength(saltlen); @@ -809,13 +818,16 @@ CHIP_ERROR CASESession::SendSigmaR3() err = mExchangeCtxt->SendMessage(Protocols::SecureChannel::MsgType::CASE_SigmaR3, std::move(msg_R3)); SuccessOrExit(err); - ChipLogDetail(Inet, "Sent SigmaR3 msg"); + ChipLogDetail(SecureChannel, "Sent SigmaR3 msg"); err = mCommissioningHash.Finish(mMessageDigest); SuccessOrExit(err); mPairingComplete = true; + // Close the exchange, as no additional messages are expected from the peer + CloseExchange(); + // Call delegate to indicate pairing completion mDelegate->OnSessionEstablished(); @@ -854,7 +866,7 @@ CHIP_ERROR CASESession::HandleSigmaR3(const System::PacketBufferHandle & msg) HKDF_sha_crypto mHKDF; - ChipLogDetail(Inet, "Received SigmaR3 msg"); + ChipLogDetail(SecureChannel, "Received SigmaR3 msg"); mNextExpectedMsg = Protocols::SecureChannel::MsgType::CASE_SigmaErr; @@ -908,6 +920,9 @@ CHIP_ERROR CASESession::HandleSigmaR3(const System::PacketBufferHandle & msg) mPairingComplete = true; + // Close the exchange, as no additional messages are expected from the peer + CloseExchange(); + // Call delegate to indicate pairing completion mDelegate->OnSessionEstablished(); @@ -925,25 +940,20 @@ CHIP_ERROR CASESession::HandleSigmaR3(const System::PacketBufferHandle & msg) void CASESession::SendErrorMsg(SigmaErrorType errorCode) { - CHIP_ERROR err = CHIP_NO_ERROR; - System::PacketBufferHandle msg; uint16_t msglen = sizeof(SigmaErrorMsg); SigmaErrorMsg * pMsg = nullptr; msg = System::PacketBufferHandle::New(msglen); - VerifyOrExit(!msg.IsNull(), err = CHIP_SYSTEM_ERROR_NO_MEMORY); + VerifyOrReturn(!msg.IsNull(), ChipLogError(SecureChannel, "Failed to allocate error message")); pMsg = reinterpret_cast(msg->Start()); pMsg->error = errorCode; msg->SetDataLength(msglen); - err = mExchangeCtxt->SendMessage(Protocols::SecureChannel::MsgType::CASE_SigmaErr, std::move(msg)); - SuccessOrExit(err); - -exit: - Clear(); + VerifyOrReturn(mExchangeCtxt->SendMessage(Protocols::SecureChannel::MsgType::CASE_SigmaErr, std::move(msg)) != CHIP_NO_ERROR, + ChipLogError(SecureChannel, "Failed to send error message")); } CHIP_ERROR CASESession::FindValidTrustedRoot(const uint8_t ** msgIterator, uint32_t nTrustedRoots) @@ -1090,23 +1100,39 @@ CHIP_ERROR CASESession::SetEffectiveTime(void) return ASN1ToChipEpochTime(effectiveTime, mValidContext.mEffectiveTime); } -void CASESession::HandleErrorMsg(const System::PacketBufferHandle & msg) +CHIP_ERROR CASESession::HandleErrorMsg(const System::PacketBufferHandle & msg) { - // Error message processing - const uint8_t * buf = msg->Start(); - size_t buflen = msg->DataLength(); - SigmaErrorMsg * pMsg = nullptr; + ReturnErrorCodeIf(msg->Start() == nullptr || msg->DataLength() != sizeof(SigmaErrorMsg), CHIP_ERROR_MESSAGE_INCOMPLETE); - VerifyOrExit(buf != nullptr, ChipLogError(Inet, "Null error msg received during pairing")); static_assert(sizeof(SigmaErrorMsg) == sizeof(uint8_t), "Assuming size of SigmaErrorMsg message is 1 octet, so that endian-ness conversion is not needed"); - VerifyOrExit(buflen == sizeof(SigmaErrorMsg), ChipLogError(Inet, "Error msg with incorrect length received during pairing")); - pMsg = reinterpret_cast(msg->Start()); - ChipLogError(Inet, "Received error (%d) during CASE pairing process", pMsg->error); + SigmaErrorMsg * pMsg = reinterpret_cast(msg->Start()); + ChipLogError(SecureChannel, "Received error (%d) during CASE pairing process", pMsg->error); -exit: - Clear(); + CHIP_ERROR err = CHIP_NO_ERROR; + switch (pMsg->error) + { + case SigmaErrorType::kNoSharedTrustRoots: + err = CHIP_ERROR_CERT_NOT_TRUSTED; + break; + + case SigmaErrorType::kUnsupportedVersion: + err = CHIP_ERROR_UNSUPPORTED_CASE_CONFIGURATION; + break; + + case SigmaErrorType::kInvalidSignature: + case SigmaErrorType::kInvalidResumptionTag: + case SigmaErrorType::kUnexpected: + err = CHIP_ERROR_INVALID_CASE_PARAMETER; + break; + + default: + err = CHIP_ERROR_INTERNAL; + break; + }; + + return err; } CHIP_ERROR CASESession::ValidateReceivedMessage(ExchangeContext * ec, const PacketHeader & packetHeader, @@ -1157,12 +1183,7 @@ void CASESession::OnMessageReceived(ExchangeContext * ec, const PacketHeader & p System::PacketBufferHandle && msg) { CHIP_ERROR err = ValidateReceivedMessage(ec, packetHeader, payloadHeader, msg); - - if (err != CHIP_NO_ERROR) - { - Clear(); - SuccessOrExit(err); - } + SuccessOrExit(err); mConnectionState.SetPeerAddress(mMessageDispatch.GetPeerAddress()); @@ -1181,7 +1202,7 @@ void CASESession::OnMessageReceived(ExchangeContext * ec, const PacketHeader & p break; case Protocols::SecureChannel::MsgType::CASE_SigmaErr: - HandleErrorMsg(msg); + err = HandleErrorMsg(msg); break; default: @@ -1195,6 +1216,7 @@ void CASESession::OnMessageReceived(ExchangeContext * ec, const PacketHeader & p // Call delegate to indicate session establishment failure. if (err != CHIP_NO_ERROR) { + Clear(); mDelegate->OnSessionEstablishmentError(err); } } diff --git a/src/protocols/secure_channel/CASESession.h b/src/protocols/secure_channel/CASESession.h index e6818a56cf2679..41b38e6d9ab190 100644 --- a/src/protocols/secure_channel/CASESession.h +++ b/src/protocols/secure_channel/CASESession.h @@ -224,7 +224,13 @@ class DLL_EXPORT CASESession : public Messaging::ExchangeDelegate, public Pairin CHIP_ERROR ComputeIPK(const uint16_t sessionID, uint8_t * ipk, size_t ipkLen); void SendErrorMsg(SigmaErrorType errorCode); - void HandleErrorMsg(const System::PacketBufferHandle & msg); + + // This function always returns an error. The error value corresponds to the error in the received message. + // The returned error value helps top level message receiver/dispatcher to close the exchange context + // in a more seamless manner. + CHIP_ERROR HandleErrorMsg(const System::PacketBufferHandle & msg); + + void CloseExchange(); // TODO: Remove this and replace with system method to retrieve current time CHIP_ERROR SetEffectiveTime(void); diff --git a/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.cpp b/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.cpp index e0b38323325c2b..a84defaeadee7f 100644 --- a/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.cpp +++ b/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.cpp @@ -32,17 +32,36 @@ CHIP_ERROR SessionEstablishmentExchangeDispatch::SendMessageImpl(SecureSessionHa System::PacketBufferHandle && message, EncryptedPacketBufferHandle * retainedMessage) { + ReturnErrorCodeIf(mTransportMgr == nullptr, CHIP_ERROR_INCORRECT_STATE); PacketHeader packetHeader; ReturnErrorOnFailure(payloadHeader.EncodeBeforeData(message)); ReturnErrorOnFailure(packetHeader.EncodeBeforeData(message)); - if (mTransportMgr != nullptr) + if (retainedMessage != nullptr) { - return mTransportMgr->SendMessage(mPeerAddress, std::move(message)); + *retainedMessage = EncryptedPacketBufferHandle::MarkEncrypted(message.Retain()); + ChipLogError(Inet, "RETAINED IN SESS: %p %d", retainedMessage, (*retainedMessage).IsNull()); } + return mTransportMgr->SendMessage(mPeerAddress, std::move(message)); +} + +CHIP_ERROR SessionEstablishmentExchangeDispatch::ResendMessage(SecureSessionHandle session, EncryptedPacketBufferHandle && message, + EncryptedPacketBufferHandle * retainedMessage) const +{ + ReturnErrorCodeIf(mTransportMgr == nullptr, CHIP_ERROR_INCORRECT_STATE); - return CHIP_ERROR_INCORRECT_STATE; + // Our send path needs a (writable) PacketBuffer, so get that from the + // EncryptedPacketBufferHandle. Note that we have to do this before we set + // *retainedMessage, because 'message' and '*retainedMessage' might be the + // same memory location and we have to guarantee that we move out of + // 'message' before we write to *retainedMessage. + System::PacketBufferHandle writableBuf(std::move(message).CastToWritable()); + if (retainedMessage != nullptr) + { + *retainedMessage = EncryptedPacketBufferHandle::MarkEncrypted(writableBuf.Retain()); + } + return mTransportMgr->SendMessage(mPeerAddress, std::move(writableBuf)); } CHIP_ERROR SessionEstablishmentExchangeDispatch::OnMessageReceived(const PayloadHeader & payloadHeader, uint32_t messageId, @@ -60,6 +79,7 @@ bool SessionEstablishmentExchangeDispatch::MessagePermitted(uint16_t protocol, u case Protocols::SecureChannel::Id.GetProtocolId(): switch (type) { + case static_cast(Protocols::SecureChannel::MsgType::StandaloneAck): case static_cast(Protocols::SecureChannel::MsgType::PBKDFParamRequest): case static_cast(Protocols::SecureChannel::MsgType::PBKDFParamResponse): case static_cast(Protocols::SecureChannel::MsgType::PASE_Spake2p1): diff --git a/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.h b/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.h index b222d7b318ab7b..a6e9a669727fb1 100644 --- a/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.h +++ b/src/protocols/secure_channel/SessionEstablishmentExchangeDispatch.h @@ -36,13 +36,16 @@ class SessionEstablishmentExchangeDispatch : public Messaging::ExchangeMessageDi virtual ~SessionEstablishmentExchangeDispatch() {} - CHIP_ERROR Init(TransportMgrBase * transportMgr) + CHIP_ERROR Init(Messaging::ReliableMessageMgr * reliableMessageMgr, TransportMgrBase * transportMgr) { ReturnErrorCodeIf(transportMgr == nullptr, CHIP_ERROR_INVALID_ARGUMENT); mTransportMgr = transportMgr; - return CHIP_NO_ERROR; + return ExchangeMessageDispatch::Init(reliableMessageMgr); } + CHIP_ERROR ResendMessage(SecureSessionHandle session, EncryptedPacketBufferHandle && message, + EncryptedPacketBufferHandle * retainedMessage) const override; + CHIP_ERROR OnMessageReceived(const PayloadHeader & payloadHeader, uint32_t messageId, const Transport::PeerAddress & peerAddress, Messaging::ReliableMessageContext * reliableMessageContext) override; diff --git a/src/protocols/secure_channel/tests/TestCASESession.cpp b/src/protocols/secure_channel/tests/TestCASESession.cpp index 57d5b6f41a4b48..642e8e81537dd9 100644 --- a/src/protocols/secure_channel/tests/TestCASESession.cpp +++ b/src/protocols/secure_channel/tests/TestCASESession.cpp @@ -120,7 +120,8 @@ void CASE_SecurePairingStartTest(nlTestSuite * inSuite, void * inContext) TestCASESecurePairingDelegate delegate; CASESession pairing; - NL_TEST_ASSERT(inSuite, pairing.MessageDispatch().Init(&gTransportMgr) == CHIP_NO_ERROR); + NL_TEST_ASSERT( + inSuite, pairing.MessageDispatch().Init(ctx.GetExchangeManager().GetReliableMessageMgr(), &gTransportMgr) == CHIP_NO_ERROR); ExchangeContext * context = ctx.NewExchangeToLocal(&pairing); NL_TEST_ASSERT(inSuite, @@ -135,7 +136,9 @@ void CASE_SecurePairingStartTest(nlTestSuite * inSuite, void * inContext) gLoopback.mMessageSendError = CHIP_ERROR_BAD_REQUEST; CASESession pairing1; - NL_TEST_ASSERT(inSuite, pairing1.MessageDispatch().Init(&gTransportMgr) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + pairing1.MessageDispatch().Init(ctx.GetExchangeManager().GetReliableMessageMgr(), &gTransportMgr) == + CHIP_NO_ERROR); gLoopback.mSentMessageCount = 0; gLoopback.mMessageSendError = CHIP_ERROR_BAD_REQUEST; @@ -159,8 +162,12 @@ void CASE_SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inConte CASESessionSerializable serializableAccessory; gLoopback.mSentMessageCount = 0; - NL_TEST_ASSERT(inSuite, pairingCommissioner.MessageDispatch().Init(&gTransportMgr) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, pairingAccessory.MessageDispatch().Init(&gTransportMgr) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + pairingCommissioner.MessageDispatch().Init(ctx.GetExchangeManager().GetReliableMessageMgr(), &gTransportMgr) == + CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + pairingAccessory.MessageDispatch().Init(ctx.GetExchangeManager().GetReliableMessageMgr(), &gTransportMgr) == + CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType( diff --git a/src/protocols/secure_channel/tests/TestPASESession.cpp b/src/protocols/secure_channel/tests/TestPASESession.cpp index e58b57ad24a958..a7512f2d543110 100644 --- a/src/protocols/secure_channel/tests/TestPASESession.cpp +++ b/src/protocols/secure_channel/tests/TestPASESession.cpp @@ -41,26 +41,70 @@ using namespace chip::Protocols; using TestContext = chip::Test::MessagingContext; -class LoopbackTransport : public Transport::Base +static void test_os_sleep_ms(uint64_t millisecs) +{ + struct timespec sleep_time; + uint64_t s = millisecs / 1000; + + millisecs -= s * 1000; + sleep_time.tv_sec = static_cast(s); + sleep_time.tv_nsec = static_cast(millisecs * 1000000); + + nanosleep(&sleep_time, nullptr); +} + +class PASETestLoopbackTransport : public Transport::Base { public: CHIP_ERROR SendMessage(const PeerAddress & address, System::PacketBufferHandle && msgBuf) override { ReturnErrorOnFailure(mMessageSendError); mSentMessageCount++; - HandleMessageReceived(address, std::move(msgBuf)); + + if (mNumMessagesToDrop == 0) + { + // The msgBuf is also being used for retransmission. So we cannot hand over the same buffer + // to the receive handler. The receive handler modifies the buffer for extracting headers etc. + // So the buffer passed to receive handler cannot be used for retransmission afterwards. + // Let's clone the message, and provide cloned message to the receive handler. + System::PacketBufferHandle receivedMessage = msgBuf.CloneData(); + HandleMessageReceived(address, std::move(receivedMessage)); + } + else + { + mNumMessagesToDrop--; + mDroppedMessageCount++; + if (mContext != nullptr) + { + test_os_sleep_ms(65); + ReliableMessageMgr * rm = mContext->GetExchangeManager().GetReliableMessageMgr(); + ReliableMessageMgr::Timeout(&mContext->GetSystemLayer(), rm, CHIP_SYSTEM_NO_ERROR); + } + } return CHIP_NO_ERROR; } bool CanSendToPeer(const PeerAddress & address) override { return true; } - uint32_t mSentMessageCount = 0; - CHIP_ERROR mMessageSendError = CHIP_NO_ERROR; + void Reset() + { + mNumMessagesToDrop = 0; + mDroppedMessageCount = 0; + mSentMessageCount = 0; + mMessageSendError = CHIP_NO_ERROR; + mContext = nullptr; + } + + uint32_t mNumMessagesToDrop = 0; + uint32_t mDroppedMessageCount = 0; + uint32_t mSentMessageCount = 0; + CHIP_ERROR mMessageSendError = CHIP_NO_ERROR; + TestContext * mContext = nullptr; }; TransportMgrBase gTransportMgr; -LoopbackTransport gLoopback; +PASETestLoopbackTransport gLoopback; class TestSecurePairingDelegate : public SessionEstablishmentDelegate { @@ -91,6 +135,8 @@ void SecurePairingWaitTest(nlTestSuite * inSuite, void * inContext) TestSecurePairingDelegate delegate; PASESession pairing; + gLoopback.Reset(); + NL_TEST_ASSERT(inSuite, pairing.WaitForPairing(1234, 500, nullptr, 0, 0, &delegate) == CHIP_ERROR_INVALID_ARGUMENT); NL_TEST_ASSERT(inSuite, pairing.WaitForPairing(1234, 500, (const uint8_t *) "saltSalt", 8, 0, nullptr) == CHIP_ERROR_INVALID_ARGUMENT); @@ -106,21 +152,29 @@ void SecurePairingStartTest(nlTestSuite * inSuite, void * inContext) PASESession pairing; - NL_TEST_ASSERT(inSuite, pairing.MessageDispatch().Init(&gTransportMgr) == CHIP_NO_ERROR); + gLoopback.Reset(); + + NL_TEST_ASSERT( + inSuite, pairing.MessageDispatch().Init(ctx.GetExchangeManager().GetReliableMessageMgr(), &gTransportMgr) == CHIP_NO_ERROR); ExchangeContext * context = ctx.NewExchangeToLocal(&pairing); NL_TEST_ASSERT(inSuite, pairing.Pair(Transport::PeerAddress(Transport::Type::kBle), 1234, 0, nullptr, nullptr) != CHIP_NO_ERROR); + + gLoopback.Reset(); NL_TEST_ASSERT(inSuite, pairing.Pair(Transport::PeerAddress(Transport::Type::kBle), 1234, 0, context, &delegate) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, gLoopback.mSentMessageCount == 1); + gLoopback.Reset(); gLoopback.mSentMessageCount = 0; gLoopback.mMessageSendError = CHIP_ERROR_BAD_REQUEST; PASESession pairing1; - NL_TEST_ASSERT(inSuite, pairing1.MessageDispatch().Init(&gTransportMgr) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + pairing1.MessageDispatch().Init(ctx.GetExchangeManager().GetReliableMessageMgr(), &gTransportMgr) == + CHIP_NO_ERROR); ExchangeContext * context1 = ctx.NewExchangeToLocal(&pairing1); NL_TEST_ASSERT(inSuite, pairing1.Pair(Transport::PeerAddress(Transport::Type::kBle), 1234, 0, context1, &delegate) == @@ -138,15 +192,36 @@ void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, P gLoopback.mSentMessageCount = 0; - NL_TEST_ASSERT(inSuite, pairingCommissioner.MessageDispatch().Init(&gTransportMgr) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, pairingAccessory.MessageDispatch().Init(&gTransportMgr) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + pairingCommissioner.MessageDispatch().Init(ctx.GetExchangeManager().GetReliableMessageMgr(), &gTransportMgr) == + CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + pairingAccessory.MessageDispatch().Init(ctx.GetExchangeManager().GetReliableMessageMgr(), &gTransportMgr) == + CHIP_NO_ERROR); + + ExchangeContext * contextCommissioner = ctx.NewExchangeToLocal(&pairingCommissioner); + + if (gLoopback.mNumMessagesToDrop != 0) + { + pairingCommissioner.MessageDispatch().SetPeerAddress(PeerAddress(Type::kUdp)); + pairingAccessory.MessageDispatch().SetPeerAddress(PeerAddress(Type::kUdp)); + + ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); + ReliableMessageContext * rc = contextCommissioner->GetReliableMessageContext(); + NL_TEST_ASSERT(inSuite, rm != nullptr); + NL_TEST_ASSERT(inSuite, rc != nullptr); + + rc->SetConfig({ + 1, // CHIP_CONFIG_RMP_DEFAULT_INITIAL_RETRY_INTERVAL + 1, // CHIP_CONFIG_RMP_DEFAULT_ACTIVE_RETRY_INTERVAL + }); + gLoopback.mContext = &ctx; + } NL_TEST_ASSERT(inSuite, ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType( Protocols::SecureChannel::MsgType::PBKDFParamRequest, &pairingAccessory) == CHIP_NO_ERROR); - ExchangeContext * contextCommissioner = ctx.NewExchangeToLocal(&pairingCommissioner); - NL_TEST_ASSERT(inSuite, pairingAccessory.WaitForPairing(1234, 500, (const uint8_t *) "saltSALT", 8, 0, &delegateAccessory) == CHIP_NO_ERROR); @@ -154,22 +229,40 @@ void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, P pairingCommissioner.Pair(Transport::PeerAddress(Transport::Type::kBle), 1234, 0, contextCommissioner, &delegateCommissioner) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gLoopback.mSentMessageCount == 5); + // Standalone acks also increment the mSentMessageCount. But some messages could be acked + // via piggybacked acks. So we cannot check for a specific value of mSentMessageCount. + // Let's make sure atleast number is >= than the minimum messages required to complete the + // handshake. + NL_TEST_ASSERT(inSuite, gLoopback.mSentMessageCount >= 5); NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 1); NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1); + gLoopback.mContext = nullptr; } void SecurePairingHandshakeTest(nlTestSuite * inSuite, void * inContext) { TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; + gLoopback.Reset(); + SecurePairingHandshakeTestCommon(inSuite, inContext, pairingCommissioner, delegateCommissioner); +} + +void SecurePairingHandshakeWithPacketLossTest(nlTestSuite * inSuite, void * inContext) +{ + TestSecurePairingDelegate delegateCommissioner; + PASESession pairingCommissioner; + gLoopback.Reset(); + gLoopback.mNumMessagesToDrop = 2; SecurePairingHandshakeTestCommon(inSuite, inContext, pairingCommissioner, delegateCommissioner); + NL_TEST_ASSERT(inSuite, gLoopback.mDroppedMessageCount == 2); + NL_TEST_ASSERT(inSuite, gLoopback.mNumMessagesToDrop == 0); } void SecurePairingDeserialize(nlTestSuite * inSuite, void * inContext, PASESession & pairingCommissioner, PASESession & deserialized) { PASESessionSerialized serialized; + gLoopback.Reset(); NL_TEST_ASSERT(inSuite, pairingCommissioner.Serialize(serialized) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, deserialized.Deserialize(serialized) == CHIP_NO_ERROR); @@ -189,6 +282,8 @@ void SecurePairingSerializeTest(nlTestSuite * inSuite, void * inContext) auto * testPairingSession1 = chip::Platform::New(); auto * testPairingSession2 = chip::Platform::New(); + gLoopback.Reset(); + SecurePairingHandshakeTestCommon(inSuite, inContext, *testPairingSession1, delegateCommissioner); SecurePairingDeserialize(inSuite, inContext, *testPairingSession1, *testPairingSession2); @@ -234,6 +329,7 @@ static const nlTest sTests[] = NL_TEST_DEF("WaitInit", SecurePairingWaitTest), NL_TEST_DEF("Start", SecurePairingStartTest), NL_TEST_DEF("Handshake", SecurePairingHandshakeTest), + NL_TEST_DEF("Handshake with packet loss", SecurePairingHandshakeWithPacketLossTest), NL_TEST_DEF("Serialize", SecurePairingSerializeTest), NL_TEST_SENTINEL() diff --git a/src/transport/SecureSessionMgr.cpp b/src/transport/SecureSessionMgr.cpp index cda9a7bc0e6562..d15a1b40fcc4d2 100644 --- a/src/transport/SecureSessionMgr.cpp +++ b/src/transport/SecureSessionMgr.cpp @@ -134,14 +134,18 @@ CHIP_ERROR SecureSessionMgr::SendEncryptedMessage(SecureSessionHandle session, E EncryptedPacketBufferHandle * bufferRetainSlot) { VerifyOrReturnError(!msgBuf.IsNull(), CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(!msgBuf->HasChainedBuffer(), CHIP_ERROR_INVALID_MESSAGE_LENGTH); + VerifyOrReturnError(!msgBuf.HasChainedBuffer(), CHIP_ERROR_INVALID_MESSAGE_LENGTH); + + // Our send path needs a (writable) PacketBuffer (e.g. so it can encode a + // PacketHeader into it), so get that from the EncryptedPacketBufferHandle. + System::PacketBufferHandle mutableBuf(std::move(msgBuf).CastToWritable()); // Advancing the start to encrypted header, since SendMessage will attach the packet header on top of it. PacketHeader packetHeader; - ReturnErrorOnFailure(packetHeader.DecodeAndConsume(msgBuf)); + ReturnErrorOnFailure(packetHeader.DecodeAndConsume(mutableBuf)); PayloadHeader payloadHeader; - return SendMessage(session, payloadHeader, packetHeader, std::move(msgBuf), bufferRetainSlot, + return SendMessage(session, payloadHeader, packetHeader, std::move(mutableBuf), bufferRetainSlot, EncryptionState::kPayloadIsEncrypted); } diff --git a/src/transport/SecureSessionMgr.h b/src/transport/SecureSessionMgr.h index f1a4ae78abaffd..576834fdfa93f9 100644 --- a/src/transport/SecureSessionMgr.h +++ b/src/transport/SecureSessionMgr.h @@ -53,7 +53,7 @@ namespace chip { * EncryptedPacketBufferHandle is a kind of PacketBufferHandle class and used to hold a packet buffer * object whose payload has already been encrypted. */ -class EncryptedPacketBufferHandle final : public System::PacketBufferHandle +class EncryptedPacketBufferHandle final : private System::PacketBufferHandle { public: EncryptedPacketBufferHandle() {} @@ -61,6 +61,11 @@ class EncryptedPacketBufferHandle final : public System::PacketBufferHandle void operator=(EncryptedPacketBufferHandle && aBuffer) { PacketBufferHandle::operator=(std::move(aBuffer)); } + using System::PacketBufferHandle::IsNull; + // Pass-through to HasChainedBuffer on our underlying buffer without + // exposing operator-> + bool HasChainedBuffer() const { return (*this)->HasChainedBuffer(); } + uint32_t GetMsgId() const; /** @@ -97,6 +102,16 @@ class EncryptedPacketBufferHandle final : public System::PacketBufferHandle return EncryptedPacketBufferHandle(std::move(aBuffer)); } + /** + * Get a handle to the data that allows mutating the bytes. This should + * only be used if absolutely necessary, because EncryptedPacketBufferHandle + * represents a buffer that we want to resend as-is. + * + * We only allow doing this with an rvalue reference, so the fact that we + * are moving out of the EncryptedPacketBufferHandle is clear. + */ + PacketBufferHandle CastToWritable() && { return PacketBufferHandle(std::move(*this)); } + private: EncryptedPacketBufferHandle(PacketBufferHandle && aBuffer) : PacketBufferHandle(std::move(aBuffer)) {} };