From 1aa419a94318469c7b791ea0d57237b004715874 Mon Sep 17 00:00:00 2001 From: Dimitri Mizenko Date: Thu, 20 May 2021 15:43:38 +0200 Subject: [PATCH 1/8] format endpointClusterWithInit for easier pull requests --- src/app/zap-templates/templates/app/helper.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js index 2cc69780681bf6..8459ae1e20e0b6 100644 --- a/src/app/zap-templates/templates/app/helper.js +++ b/src/app/zap-templates/templates/app/helper.js @@ -195,8 +195,15 @@ function asChipUnderlyingType(label, type) // These helpers only works within the endpoint_config iterator // List of all cluster with generated functions -var endpointClusterWithInit = - [ 'Basic', 'Identify', 'Groups', 'Scenes', 'Occupancy Sensing', 'On/off', 'Level Control', 'Color Control', 'IAS Zone' ]; +var endpointClusterWithInit = [ 'Basic', + 'Identify', + 'Groups', + 'Scenes', + 'Occupancy Sensing', + 'On/off', + 'Level Control', + 'Color Control', + 'IAS Zone' ]; var endpointClusterWithAttributeChanged = [ 'Identify', 'Door Lock' ]; var endpointClusterWithPreAttribute = [ 'IAS Zone' ]; var endpointClusterWithMessageSent = [ 'IAS Zone' ]; From a673075f33336b561fc8251ad27f50bb0678f99a Mon Sep 17 00:00:00 2001 From: Dimitri Mizenko Date: Wed, 19 May 2021 11:51:06 +0200 Subject: [PATCH 2/8] add air pressure measurement clsuter definition to zap tool --- .../zcl/air-pressure-measurement.xml | 19 +++++++++++++++++++ src/app/zap-templates/zcl/zcl.json | 1 + 2 files changed, 20 insertions(+) create mode 100644 src/app/zap-templates/zcl/air-pressure-measurement.xml diff --git a/src/app/zap-templates/zcl/air-pressure-measurement.xml b/src/app/zap-templates/zcl/air-pressure-measurement.xml new file mode 100644 index 00000000000000..84ee79aaaa9260 --- /dev/null +++ b/src/app/zap-templates/zcl/air-pressure-measurement.xml @@ -0,0 +1,19 @@ + + + + + Measurement & Sensing + Air Pressure Measurement + 0x0407 + AIR_PRESSURE_MEASUREMENT_CLUSTER + true + true + Air pressure measurement cluster in hPA with 1 digit fixed point resolution + measured value + altitude + + set altitud for air pressure measurements + + + + diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index c261b533294e52..a0b7bbfb62dad9 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -3,6 +3,7 @@ "xmlRoot": [".", "./data-model/silabs/"], "xmlFile": [ "test-cluster.xml", + "air-pressure-measurement.xml", "account-login-cluster.xml", "application-launcher-cluster.xml", "audio-output-cluster.xml", From fd234a16cf5e234af984d5bc42e86c6fba60f51f Mon Sep 17 00:00:00 2001 From: Dimitri Mizenko Date: Thu, 20 May 2021 16:00:02 +0200 Subject: [PATCH 3/8] add support for emberAfAirPressureMeasurementClusterServerInitCallback --- src/app/zap-templates/templates/app/helper.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js index 8459ae1e20e0b6..b07d6e44afdf12 100644 --- a/src/app/zap-templates/templates/app/helper.js +++ b/src/app/zap-templates/templates/app/helper.js @@ -196,6 +196,7 @@ function asChipUnderlyingType(label, type) // List of all cluster with generated functions var endpointClusterWithInit = [ 'Basic', + 'Air Pressure Measurement', 'Identify', 'Groups', 'Scenes', From e42f3dd6e43f3ac72ea42c28aef0b69975afe617 Mon Sep 17 00:00:00 2001 From: Dimitri Mizenko Date: Thu, 20 May 2021 17:30:58 +0200 Subject: [PATCH 4/8] add air pressure measurement cluster to controller-clusters.zap --- .../data_model/controller-clusters.zap | 95 ++++++++++++++++++- 1 file changed, 93 insertions(+), 2 deletions(-) diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 8442d255528672..a168eee011804d 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -4680,6 +4680,97 @@ } ] }, + { + "name": "Air Pressure Measurement", + "code": 1031, + "mfgCode": null, + "define": "AIR_PRESSURE_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "altitude", + "code": 0, + "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": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Air Pressure Measurement", + "code": 1031, + "mfgCode": null, + "define": "AIR_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": "10132", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "altitude", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "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": "IAS Zone", "code": 1280, @@ -5647,7 +5738,7 @@ ], "attributes": [ { - "name": "acceptsHeaderList", + "name": "accepts header list", "code": 0, "mfgCode": null, "side": "server", @@ -6634,4 +6725,4 @@ } ], "log": [] -} +} \ No newline at end of file From 23afbd88e575e0bf4a6203dbd0db0692d3dc1120 Mon Sep 17 00:00:00 2001 From: Dimitri Mizenko Date: Wed, 19 May 2021 14:38:13 +0200 Subject: [PATCH 5/8] add impl. for air pressure measurement cluster on the server side --- .../air-pressure-measurement-server.cpp | 99 +++++++++++++++++++ .../air-pressure-measurement-server.h | 24 +++++ 2 files changed, 123 insertions(+) create mode 100644 src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.cpp create mode 100644 src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.h diff --git a/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.cpp b/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.cpp new file mode 100644 index 00000000000000..442e2d97675b31 --- /dev/null +++ b/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.cpp @@ -0,0 +1,99 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "air-pressure-measurement-server.h" + +#include + +#include "gen/att-storage.h" +#include "gen/attribute-id.h" +#include "gen/attribute-type.h" +#include "gen/cluster-id.h" +#include "gen/command-id.h" + +EmberAfStatus emberAfAirPressureMeasurementClusterGetMeasuredValue(chip::EndpointId endpoint, uint16_t* measuredValue) +{ + return emberAfReadAttribute(endpoint, + ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, + ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID, + CLUSTER_MASK_SERVER, + (uint8_t*)measuredValue, + sizeof(*measuredValue), + NULL); +} + +static EmberAfStatus emberAfAirPressureMeasurementClusterSetAltitudeCallback(chip::EndpointId endpoint, int16_t altitude) +{ + EmberAfStatus status = emberAfWriteAttribute(endpoint, + ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, + ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID, + CLUSTER_MASK_SERVER, + (uint8_t *)&altitude, + ZCL_INT16S_ATTRIBUTE_TYPE); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + // emberAfAirPressureMeasurementClusterPrintln("ERR: writing present value %x", status); + } + + return status; +} + +void emberAfAirPressureMeasurementClusterServerInitCallback(chip::EndpointId endpoint) +{ + uint16_t measuredValue = 0; + EmberAfStatus status = emberAfAirPressureMeasurementClusterGetMeasuredValue(endpoint, &measuredValue); + + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + (void)emberAfAirPressureMeasurementClusterSetMeasuredValueCallback(endpoint, 10132); + } + + int16_t altitude = 0; + status = emberAfAirPressureMeasurementClusterGetAltitudeValue(endpoint, &altitude); + + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + (void)emberAfAirPressureMeasurementClusterSetAltitudeCallback(endpoint, 0); + } +} + +EmberAfStatus emberAfAirPressureMeasurementClusterSetMeasuredValueCallback(chip::EndpointId endpoint, uint16_t measuredValue) +{ + EmberAfStatus status = emberAfWriteAttribute(endpoint, + ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, + ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID, + CLUSTER_MASK_SERVER, + (uint8_t *)&measuredValue, + ZCL_INT16U_ATTRIBUTE_TYPE); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + // emberAfAirPressureMeasurementClusterPrintln("ERR: writing present value %x", status); + } + + return status; +} + +EmberAfStatus emberAfAirPressureMeasurementClusterGetAltitudeValue(chip::EndpointId endpoint, int16_t* altitude) +{ + return emberAfReadAttribute(endpoint, + ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, + ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID, + CLUSTER_MASK_SERVER, + (uint8_t*)altitude, + sizeof(*altitude), + NULL); +} diff --git a/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.h b/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.h new file mode 100644 index 00000000000000..81274389d7d5fe --- /dev/null +++ b/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.h @@ -0,0 +1,24 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +EmberAfStatus emberAfAirPressureMeasurementClusterSetMeasuredValueCallback(chip::EndpointId endpoint, uint16_t measuredValue); +EmberAfStatus emberAfAirPressureMeasurementClusterGetMeasuredValue(chip::EndpointId endpoint, uint16_t* measuredValue); +EmberAfStatus emberAfAirPressureMeasurementClusterGetAltitudeValue(chip::EndpointId endpoint, int16_t* altitude); From 99492f26fe674249bc03610a109187ed04841da7 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Thu, 20 May 2021 11:53:09 +0200 Subject: [PATCH 6/8] Add new clusters to zap_cluster_list.py --- src/app/zap_cluster_list.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/zap_cluster_list.py b/src/app/zap_cluster_list.py index 57fe013cc90123..2e1b183a57ec02 100755 --- a/src/app/zap_cluster_list.py +++ b/src/app/zap_cluster_list.py @@ -9,6 +9,7 @@ # List of directories in src/app/clusters to build for server clusters. SERVER_CLUSTERS: typing.Dict[str, typing.List[str]] = { + 'AIR_PRESSURE_MEASUREMENT_CLUSTER': ['air-pressure-measurement-server'], 'ALARM_CLUSTER': [], 'APPLICATION_BASIC_CLUSTER': [], 'ACCOUNT_LOGIN_CLUSTER': [], @@ -16,6 +17,7 @@ 'AUDIO_OUTPUT_CLUSTER': [], 'BARRIER_CONTROL_CLUSTER': ['barrier-control-server'], 'BASIC_CLUSTER': ['basic'], + 'BINARY_INPUT_BASIC_CLUSTER': ['binary-input-server'], 'BINDING_CLUSTER': ['bindings'], 'COLOR_CONTROL_CLUSTER': ['color-control-server'], 'COMMISSIONING_CLUSTER': [], @@ -44,6 +46,7 @@ 'OTA_CLIENT_CLUSTER': [], 'POWER_CONFIG_CLUSTER': [], 'PUMP_CONFIG_CONTROL_CLUSTER': [], + 'RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER': ['relative-humidity-measurement-server'], 'SCENES_CLUSTER': ['scenes'], 'SWITCH_CLUSTER': [], 'TARGET_NAVIGATOR_CLUSTER': ['target-navigator-server'], @@ -61,6 +64,7 @@ # List of directories in src/app/clusters to build for client clusters. CLIENT_CLUSTERS: typing.Dict[str, typing.List[str]] = { + 'AIR_PRESSURE_MEASUREMENT_CLUSTER': [], 'ALARM_CLUSTER': [], 'ACCOUNT_LOGIN_CLUSTER': [], 'APPLICATION_LAUNCHER_CLUSTER': [], @@ -68,6 +72,7 @@ 'APPLICATION_BASIC_CLUSTER': [], 'BARRIER_CONTROL_CLUSTER': [], 'BASIC_CLUSTER': [], + 'BINARY_INPUT_BASIC_CLUSTER': [], 'BINDING_CLUSTER': [], 'COLOR_CONTROL_CLUSTER': [], 'COMMISSIONING_CLUSTER': [], @@ -96,6 +101,7 @@ 'OTA_CLIENT_CLUSTER': [], 'POWER_CONFIG_CLUSTER': [], 'PUMP_CONFIG_CONTROL_CLUSTER': [], + 'RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER': [], 'SCENES_CLUSTER': [], 'SWITCH_CLUSTER': [], 'TARGET_NAVIGATOR_CLUSTER': [], From d78e12cf1331e8a9d214be8f0450bd4072252591 Mon Sep 17 00:00:00 2001 From: Dimitri Mizenko Date: Thu, 20 May 2021 17:56:43 +0200 Subject: [PATCH 7/8] regenearte code related to controller-clusters.zap --- .../all-clusters-common/gen/attribute-id.h | 8 + .../gen/client-command-macro.h | 10 + .../all-clusters-common/gen/cluster-id.h | 3 + .../all-clusters-common/gen/command-id.h | 3 + .../all-clusters-common/gen/print-cluster.h | 8 + .../bridge-common/gen/attribute-id.h | 8 + .../bridge-common/gen/client-command-macro.h | 10 + .../bridge-app/bridge-common/gen/cluster-id.h | 3 + .../bridge-app/bridge-common/gen/command-id.h | 3 + .../bridge-common/gen/print-cluster.h | 8 + .../chip-tool/commands/clusters/Commands.h | 226 ++++++++++++++++++ .../lighting-common/gen/attribute-id.h | 8 + .../gen/client-command-macro.h | 10 + .../lighting-common/gen/cluster-id.h | 3 + .../lighting-common/gen/command-id.h | 3 + .../lighting-common/gen/print-cluster.h | 8 + .../lock-app/lock-common/gen/attribute-id.h | 8 + .../lock-common/gen/client-command-macro.h | 10 + .../lock-app/lock-common/gen/cluster-id.h | 3 + .../lock-app/lock-common/gen/command-id.h | 3 + .../lock-app/lock-common/gen/print-cluster.h | 8 + .../pump-app/pump-common/gen/attribute-id.h | 8 + .../pump-common/gen/client-command-macro.h | 10 + .../pump-app/pump-common/gen/cluster-id.h | 3 + .../pump-app/pump-common/gen/command-id.h | 3 + .../pump-app/pump-common/gen/print-cluster.h | 8 + .../pump-controller-common/gen/attribute-id.h | 8 + .../gen/client-command-macro.h | 10 + .../pump-controller-common/gen/cluster-id.h | 3 + .../pump-controller-common/gen/command-id.h | 3 + .../gen/print-cluster.h | 8 + .../esp32/main/gen/attribute-id.h | 8 + .../esp32/main/gen/client-command-macro.h | 10 + .../esp32/main/gen/cluster-id.h | 3 + .../esp32/main/gen/command-id.h | 3 + .../esp32/main/gen/print-cluster.h | 8 + examples/tv-app/tv-common/gen/attribute-id.h | 8 + .../tv-common/gen/client-command-macro.h | 10 + examples/tv-app/tv-common/gen/cluster-id.h | 3 + examples/tv-app/tv-common/gen/command-id.h | 3 + examples/tv-app/tv-common/gen/print-cluster.h | 8 + examples/window-app/common/gen/attribute-id.h | 8 + .../common/gen/client-command-macro.h | 10 + examples/window-app/common/gen/cluster-id.h | 3 + examples/window-app/common/gen/command-id.h | 3 + .../window-app/common/gen/print-cluster.h | 8 + .../data_model/gen/CHIPClusters.cpp | 68 ++++++ src/controller/data_model/gen/CHIPClusters.h | 22 ++ src/controller/data_model/gen/attribute-id.h | 8 + .../data_model/gen/call-command-handler.cpp | 5 + .../data_model/gen/callback-stub.cpp | 8 + src/controller/data_model/gen/callback.h | 80 +++++++ .../data_model/gen/chip-zcl-zpro-codec-api.h | 48 ++++ .../data_model/gen/client-command-macro.h | 10 + src/controller/data_model/gen/cluster-id.h | 3 + src/controller/data_model/gen/command-id.h | 3 + src/controller/data_model/gen/encoder.cpp | 66 +++++ .../data_model/gen/endpoint_config.h | 49 ++-- src/controller/data_model/gen/gen_config.h | 5 + src/controller/data_model/gen/print-cluster.h | 8 + .../python/chip/clusters/CHIPClusters.cpp | 42 ++++ .../python/chip/clusters/CHIPClusters.py | 33 +++ .../Framework/CHIP/gen/CHIPClustersObjc.h | 15 ++ .../Framework/CHIP/gen/CHIPClustersObjc.mm | 148 ++++++++++++ .../Framework/CHIPTests/CHIPClustersTests.m | 76 ++++++ 65 files changed, 1191 insertions(+), 20 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h b/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h index 8a27c16bd5cbdd..0b5ffac7d0f54d 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h +++ b/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h @@ -935,6 +935,14 @@ #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID (0x0031) #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID (0x0032) +// Attribute ids for cluster: Air Pressure Measurement + +// Client attributes + +// Server attributes +#define ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID (0x0000) +#define ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID (0x0001) + // Attribute ids for cluster: Carbon Monoxide Concentration Measurement // Client attributes diff --git a/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h b/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h index 3d1da11c6ca33b..7961f1c20a3a32 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h +++ b/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h @@ -3190,6 +3190,16 @@ ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID, "uuuuuuu", stepMode, stepSize, transitionTime, \ colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); +/** @brief Command description for altitude + * + * Command: altitude + * @param altitude INT16S + */ +#define emberAfFillCommandAir \ + Pressure MeasurementClusteraltitude(altitude) emberAfFillExternalBuffer(mask, \ + \ + ZCL_ALTITUDE_COMMAND_ID, "u", altitude); + /** @brief Command description for ZoneEnrollResponse * * Command: ZoneEnrollResponse diff --git a/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h b/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h index c51dafee576190..dcc20f4f24fa52 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h +++ b/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h @@ -173,6 +173,9 @@ // Definitions for cluster: Occupancy Sensing #define ZCL_OCCUPANCY_SENSING_CLUSTER_ID (0x0406) +// Definitions for cluster: Air Pressure Measurement +#define ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID (0x0407) + // Definitions for cluster: Carbon Monoxide Concentration Measurement #define ZCL_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID (0x040C) diff --git a/examples/all-clusters-app/all-clusters-common/gen/command-id.h b/examples/all-clusters-app/all-clusters-common/gen/command-id.h index 44115fd56ba082..bf5937895d6e10 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/command-id.h +++ b/examples/all-clusters-app/all-clusters-common/gen/command-id.h @@ -388,6 +388,9 @@ #define ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID (0x4B) #define ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID (0x4C) +// Commands for cluster: Air Pressure Measurement +#define ZCL_ALTITUDE_COMMAND_ID (0x00) + // Commands for cluster: IAS Zone #define ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID (0x00) #define ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID (0x00) diff --git a/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h b/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h index bda8e8970ee88e..8417c73bdf5883 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h +++ b/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h @@ -337,6 +337,13 @@ #define CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER #endif +#if defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_SERVER) || defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ + { ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, 1031, "Air Pressure Measurement" }, +#else +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER +#endif + #if defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER) || \ defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ @@ -965,6 +972,7 @@ CHIP_PRINTCLUSTER_FLOW_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER \ + CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER \ diff --git a/examples/bridge-app/bridge-common/gen/attribute-id.h b/examples/bridge-app/bridge-common/gen/attribute-id.h index 8a27c16bd5cbdd..0b5ffac7d0f54d 100644 --- a/examples/bridge-app/bridge-common/gen/attribute-id.h +++ b/examples/bridge-app/bridge-common/gen/attribute-id.h @@ -935,6 +935,14 @@ #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID (0x0031) #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID (0x0032) +// Attribute ids for cluster: Air Pressure Measurement + +// Client attributes + +// Server attributes +#define ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID (0x0000) +#define ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID (0x0001) + // Attribute ids for cluster: Carbon Monoxide Concentration Measurement // Client attributes diff --git a/examples/bridge-app/bridge-common/gen/client-command-macro.h b/examples/bridge-app/bridge-common/gen/client-command-macro.h index 3d1da11c6ca33b..7961f1c20a3a32 100644 --- a/examples/bridge-app/bridge-common/gen/client-command-macro.h +++ b/examples/bridge-app/bridge-common/gen/client-command-macro.h @@ -3190,6 +3190,16 @@ ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID, "uuuuuuu", stepMode, stepSize, transitionTime, \ colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); +/** @brief Command description for altitude + * + * Command: altitude + * @param altitude INT16S + */ +#define emberAfFillCommandAir \ + Pressure MeasurementClusteraltitude(altitude) emberAfFillExternalBuffer(mask, \ + \ + ZCL_ALTITUDE_COMMAND_ID, "u", altitude); + /** @brief Command description for ZoneEnrollResponse * * Command: ZoneEnrollResponse diff --git a/examples/bridge-app/bridge-common/gen/cluster-id.h b/examples/bridge-app/bridge-common/gen/cluster-id.h index c51dafee576190..dcc20f4f24fa52 100644 --- a/examples/bridge-app/bridge-common/gen/cluster-id.h +++ b/examples/bridge-app/bridge-common/gen/cluster-id.h @@ -173,6 +173,9 @@ // Definitions for cluster: Occupancy Sensing #define ZCL_OCCUPANCY_SENSING_CLUSTER_ID (0x0406) +// Definitions for cluster: Air Pressure Measurement +#define ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID (0x0407) + // Definitions for cluster: Carbon Monoxide Concentration Measurement #define ZCL_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID (0x040C) diff --git a/examples/bridge-app/bridge-common/gen/command-id.h b/examples/bridge-app/bridge-common/gen/command-id.h index 44115fd56ba082..bf5937895d6e10 100644 --- a/examples/bridge-app/bridge-common/gen/command-id.h +++ b/examples/bridge-app/bridge-common/gen/command-id.h @@ -388,6 +388,9 @@ #define ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID (0x4B) #define ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID (0x4C) +// Commands for cluster: Air Pressure Measurement +#define ZCL_ALTITUDE_COMMAND_ID (0x00) + // Commands for cluster: IAS Zone #define ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID (0x00) #define ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID (0x00) diff --git a/examples/bridge-app/bridge-common/gen/print-cluster.h b/examples/bridge-app/bridge-common/gen/print-cluster.h index bda8e8970ee88e..8417c73bdf5883 100644 --- a/examples/bridge-app/bridge-common/gen/print-cluster.h +++ b/examples/bridge-app/bridge-common/gen/print-cluster.h @@ -337,6 +337,13 @@ #define CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER #endif +#if defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_SERVER) || defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ + { ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, 1031, "Air Pressure Measurement" }, +#else +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER +#endif + #if defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER) || \ defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ @@ -965,6 +972,7 @@ CHIP_PRINTCLUSTER_FLOW_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER \ + CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER \ diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index 29fced207de943..b68968fcaccbff 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -949,6 +949,7 @@ static void OnTestClusterListStructOctetStringListAttributeResponse(void * conte | Cluster Name | ID | |---------------------------------------------------------------------+--------| | AccountLogin | 0x050E | +| AirPressureMeasurement | 0x0407 | | ApplicationBasic | 0x050D | | ApplicationLauncher | 0x050C | | AudioOutput | 0x050B | @@ -987,6 +988,7 @@ static void OnTestClusterListStructOctetStringListAttributeResponse(void * conte \*----------------------------------------------------------------------------*/ constexpr chip::ClusterId kAccountLoginClusterId = 0x050E; +constexpr chip::ClusterId kAirPressureMeasurementClusterId = 0x0407; constexpr chip::ClusterId kApplicationBasicClusterId = 0x050D; constexpr chip::ClusterId kApplicationLauncherClusterId = 0x050C; constexpr chip::ClusterId kAudioOutputClusterId = 0x050B; @@ -1172,6 +1174,217 @@ class ReadAccountLoginClusterRevision : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); }; +/*----------------------------------------------------------------------------*\ +| Cluster AirPressureMeasurement | 0x0407 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Altitude | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasuredValue | 0x0000 | +| * Altitude | 0x0001 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/* + * Command Altitude + */ +class AirPressureMeasurementAltitude : public ModelCommand +{ +public: + AirPressureMeasurementAltitude() : ModelCommand("altitude") + { + AddArgument("altitude", INT16_MIN, INT16_MAX, &mAltitude); + ModelCommand::AddArguments(); + } + ~AirPressureMeasurementAltitude() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0407) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::AirPressureMeasurementCluster cluster; + cluster.Associate(device, endpointId); + return cluster.Altitude(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mAltitude); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + int16_t mAltitude; +}; + +/* + * Discover Attributes + */ +class DiscoverAirPressureMeasurementAttributes : public ModelCommand +{ +public: + DiscoverAirPressureMeasurementAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverAirPressureMeasurementAttributes() + { + 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::AirPressureMeasurementCluster 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 MeasuredValue + */ +class ReadAirPressureMeasurementMeasuredValue : public ModelCommand +{ +public: + ReadAirPressureMeasurementMeasuredValue() : ModelCommand("read") + { + AddArgument("attr-name", "measured-value"); + ModelCommand::AddArguments(); + } + + ~ReadAirPressureMeasurementMeasuredValue() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0407) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::AirPressureMeasurementCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeMeasuredValue(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); +}; + +/* + * Attribute Altitude + */ +class ReadAirPressureMeasurementAltitude : public ModelCommand +{ +public: + ReadAirPressureMeasurementAltitude() : ModelCommand("read") + { + AddArgument("attr-name", "altitude"); + ModelCommand::AddArguments(); + } + + ~ReadAirPressureMeasurementAltitude() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0407) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::AirPressureMeasurementCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeAltitude(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteAirPressureMeasurementAltitude : public ModelCommand +{ +public: + WriteAirPressureMeasurementAltitude() : ModelCommand("write") + { + AddArgument("attr-name", "altitude"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteAirPressureMeasurementAltitude() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0407) command (0x01) on endpoint %" PRIu16, endpointId); + + chip::Controller::AirPressureMeasurementCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeAltitude(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); + int16_t mValue; +}; + +/* + * Attribute ClusterRevision + */ +class ReadAirPressureMeasurementClusterRevision : public ModelCommand +{ +public: + ReadAirPressureMeasurementClusterRevision() : ModelCommand("read") + { + AddArgument("attr-name", "cluster-revision"); + ModelCommand::AddArguments(); + } + + ~ReadAirPressureMeasurementClusterRevision() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0407) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::AirPressureMeasurementCluster 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 ApplicationBasic | 0x050D | |------------------------------------------------------------------------------| @@ -16278,6 +16491,18 @@ void registerClusterAccountLogin(Commands & commands) commands.Register(clusterName, clusterCommands); } +void registerClusterAirPressureMeasurement(Commands & commands) +{ + const char * clusterName = "AirPressureMeasurement"; + + commands_list clusterCommands = { + make_unique(), make_unique(), + make_unique(), make_unique(), + make_unique(), make_unique(), + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterApplicationBasic(Commands & commands) { const char * clusterName = "ApplicationBasic"; @@ -16959,6 +17184,7 @@ void registerClusterWindowCovering(Commands & commands) void registerClusters(Commands & commands) { registerClusterAccountLogin(commands); + registerClusterAirPressureMeasurement(commands); registerClusterApplicationBasic(commands); registerClusterApplicationLauncher(commands); registerClusterAudioOutput(commands); diff --git a/examples/lighting-app/lighting-common/gen/attribute-id.h b/examples/lighting-app/lighting-common/gen/attribute-id.h index 8a27c16bd5cbdd..0b5ffac7d0f54d 100644 --- a/examples/lighting-app/lighting-common/gen/attribute-id.h +++ b/examples/lighting-app/lighting-common/gen/attribute-id.h @@ -935,6 +935,14 @@ #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID (0x0031) #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID (0x0032) +// Attribute ids for cluster: Air Pressure Measurement + +// Client attributes + +// Server attributes +#define ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID (0x0000) +#define ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID (0x0001) + // Attribute ids for cluster: Carbon Monoxide Concentration Measurement // Client attributes diff --git a/examples/lighting-app/lighting-common/gen/client-command-macro.h b/examples/lighting-app/lighting-common/gen/client-command-macro.h index 3d1da11c6ca33b..7961f1c20a3a32 100644 --- a/examples/lighting-app/lighting-common/gen/client-command-macro.h +++ b/examples/lighting-app/lighting-common/gen/client-command-macro.h @@ -3190,6 +3190,16 @@ ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID, "uuuuuuu", stepMode, stepSize, transitionTime, \ colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); +/** @brief Command description for altitude + * + * Command: altitude + * @param altitude INT16S + */ +#define emberAfFillCommandAir \ + Pressure MeasurementClusteraltitude(altitude) emberAfFillExternalBuffer(mask, \ + \ + ZCL_ALTITUDE_COMMAND_ID, "u", altitude); + /** @brief Command description for ZoneEnrollResponse * * Command: ZoneEnrollResponse diff --git a/examples/lighting-app/lighting-common/gen/cluster-id.h b/examples/lighting-app/lighting-common/gen/cluster-id.h index c51dafee576190..dcc20f4f24fa52 100644 --- a/examples/lighting-app/lighting-common/gen/cluster-id.h +++ b/examples/lighting-app/lighting-common/gen/cluster-id.h @@ -173,6 +173,9 @@ // Definitions for cluster: Occupancy Sensing #define ZCL_OCCUPANCY_SENSING_CLUSTER_ID (0x0406) +// Definitions for cluster: Air Pressure Measurement +#define ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID (0x0407) + // Definitions for cluster: Carbon Monoxide Concentration Measurement #define ZCL_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID (0x040C) diff --git a/examples/lighting-app/lighting-common/gen/command-id.h b/examples/lighting-app/lighting-common/gen/command-id.h index 44115fd56ba082..bf5937895d6e10 100644 --- a/examples/lighting-app/lighting-common/gen/command-id.h +++ b/examples/lighting-app/lighting-common/gen/command-id.h @@ -388,6 +388,9 @@ #define ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID (0x4B) #define ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID (0x4C) +// Commands for cluster: Air Pressure Measurement +#define ZCL_ALTITUDE_COMMAND_ID (0x00) + // Commands for cluster: IAS Zone #define ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID (0x00) #define ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID (0x00) diff --git a/examples/lighting-app/lighting-common/gen/print-cluster.h b/examples/lighting-app/lighting-common/gen/print-cluster.h index bda8e8970ee88e..8417c73bdf5883 100644 --- a/examples/lighting-app/lighting-common/gen/print-cluster.h +++ b/examples/lighting-app/lighting-common/gen/print-cluster.h @@ -337,6 +337,13 @@ #define CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER #endif +#if defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_SERVER) || defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ + { ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, 1031, "Air Pressure Measurement" }, +#else +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER +#endif + #if defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER) || \ defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ @@ -965,6 +972,7 @@ CHIP_PRINTCLUSTER_FLOW_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER \ + CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER \ diff --git a/examples/lock-app/lock-common/gen/attribute-id.h b/examples/lock-app/lock-common/gen/attribute-id.h index 8a27c16bd5cbdd..0b5ffac7d0f54d 100644 --- a/examples/lock-app/lock-common/gen/attribute-id.h +++ b/examples/lock-app/lock-common/gen/attribute-id.h @@ -935,6 +935,14 @@ #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID (0x0031) #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID (0x0032) +// Attribute ids for cluster: Air Pressure Measurement + +// Client attributes + +// Server attributes +#define ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID (0x0000) +#define ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID (0x0001) + // Attribute ids for cluster: Carbon Monoxide Concentration Measurement // Client attributes diff --git a/examples/lock-app/lock-common/gen/client-command-macro.h b/examples/lock-app/lock-common/gen/client-command-macro.h index 3d1da11c6ca33b..7961f1c20a3a32 100644 --- a/examples/lock-app/lock-common/gen/client-command-macro.h +++ b/examples/lock-app/lock-common/gen/client-command-macro.h @@ -3190,6 +3190,16 @@ ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID, "uuuuuuu", stepMode, stepSize, transitionTime, \ colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); +/** @brief Command description for altitude + * + * Command: altitude + * @param altitude INT16S + */ +#define emberAfFillCommandAir \ + Pressure MeasurementClusteraltitude(altitude) emberAfFillExternalBuffer(mask, \ + \ + ZCL_ALTITUDE_COMMAND_ID, "u", altitude); + /** @brief Command description for ZoneEnrollResponse * * Command: ZoneEnrollResponse diff --git a/examples/lock-app/lock-common/gen/cluster-id.h b/examples/lock-app/lock-common/gen/cluster-id.h index c51dafee576190..dcc20f4f24fa52 100644 --- a/examples/lock-app/lock-common/gen/cluster-id.h +++ b/examples/lock-app/lock-common/gen/cluster-id.h @@ -173,6 +173,9 @@ // Definitions for cluster: Occupancy Sensing #define ZCL_OCCUPANCY_SENSING_CLUSTER_ID (0x0406) +// Definitions for cluster: Air Pressure Measurement +#define ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID (0x0407) + // Definitions for cluster: Carbon Monoxide Concentration Measurement #define ZCL_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID (0x040C) diff --git a/examples/lock-app/lock-common/gen/command-id.h b/examples/lock-app/lock-common/gen/command-id.h index 44115fd56ba082..bf5937895d6e10 100644 --- a/examples/lock-app/lock-common/gen/command-id.h +++ b/examples/lock-app/lock-common/gen/command-id.h @@ -388,6 +388,9 @@ #define ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID (0x4B) #define ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID (0x4C) +// Commands for cluster: Air Pressure Measurement +#define ZCL_ALTITUDE_COMMAND_ID (0x00) + // Commands for cluster: IAS Zone #define ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID (0x00) #define ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID (0x00) diff --git a/examples/lock-app/lock-common/gen/print-cluster.h b/examples/lock-app/lock-common/gen/print-cluster.h index bda8e8970ee88e..8417c73bdf5883 100644 --- a/examples/lock-app/lock-common/gen/print-cluster.h +++ b/examples/lock-app/lock-common/gen/print-cluster.h @@ -337,6 +337,13 @@ #define CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER #endif +#if defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_SERVER) || defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ + { ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, 1031, "Air Pressure Measurement" }, +#else +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER +#endif + #if defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER) || \ defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ @@ -965,6 +972,7 @@ CHIP_PRINTCLUSTER_FLOW_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER \ + CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER \ diff --git a/examples/pump-app/pump-common/gen/attribute-id.h b/examples/pump-app/pump-common/gen/attribute-id.h index 8a27c16bd5cbdd..0b5ffac7d0f54d 100644 --- a/examples/pump-app/pump-common/gen/attribute-id.h +++ b/examples/pump-app/pump-common/gen/attribute-id.h @@ -935,6 +935,14 @@ #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID (0x0031) #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID (0x0032) +// Attribute ids for cluster: Air Pressure Measurement + +// Client attributes + +// Server attributes +#define ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID (0x0000) +#define ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID (0x0001) + // Attribute ids for cluster: Carbon Monoxide Concentration Measurement // Client attributes diff --git a/examples/pump-app/pump-common/gen/client-command-macro.h b/examples/pump-app/pump-common/gen/client-command-macro.h index 3d1da11c6ca33b..7961f1c20a3a32 100644 --- a/examples/pump-app/pump-common/gen/client-command-macro.h +++ b/examples/pump-app/pump-common/gen/client-command-macro.h @@ -3190,6 +3190,16 @@ ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID, "uuuuuuu", stepMode, stepSize, transitionTime, \ colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); +/** @brief Command description for altitude + * + * Command: altitude + * @param altitude INT16S + */ +#define emberAfFillCommandAir \ + Pressure MeasurementClusteraltitude(altitude) emberAfFillExternalBuffer(mask, \ + \ + ZCL_ALTITUDE_COMMAND_ID, "u", altitude); + /** @brief Command description for ZoneEnrollResponse * * Command: ZoneEnrollResponse diff --git a/examples/pump-app/pump-common/gen/cluster-id.h b/examples/pump-app/pump-common/gen/cluster-id.h index c51dafee576190..dcc20f4f24fa52 100644 --- a/examples/pump-app/pump-common/gen/cluster-id.h +++ b/examples/pump-app/pump-common/gen/cluster-id.h @@ -173,6 +173,9 @@ // Definitions for cluster: Occupancy Sensing #define ZCL_OCCUPANCY_SENSING_CLUSTER_ID (0x0406) +// Definitions for cluster: Air Pressure Measurement +#define ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID (0x0407) + // Definitions for cluster: Carbon Monoxide Concentration Measurement #define ZCL_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID (0x040C) diff --git a/examples/pump-app/pump-common/gen/command-id.h b/examples/pump-app/pump-common/gen/command-id.h index 44115fd56ba082..bf5937895d6e10 100644 --- a/examples/pump-app/pump-common/gen/command-id.h +++ b/examples/pump-app/pump-common/gen/command-id.h @@ -388,6 +388,9 @@ #define ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID (0x4B) #define ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID (0x4C) +// Commands for cluster: Air Pressure Measurement +#define ZCL_ALTITUDE_COMMAND_ID (0x00) + // Commands for cluster: IAS Zone #define ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID (0x00) #define ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID (0x00) diff --git a/examples/pump-app/pump-common/gen/print-cluster.h b/examples/pump-app/pump-common/gen/print-cluster.h index bda8e8970ee88e..8417c73bdf5883 100644 --- a/examples/pump-app/pump-common/gen/print-cluster.h +++ b/examples/pump-app/pump-common/gen/print-cluster.h @@ -337,6 +337,13 @@ #define CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER #endif +#if defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_SERVER) || defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ + { ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, 1031, "Air Pressure Measurement" }, +#else +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER +#endif + #if defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER) || \ defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ @@ -965,6 +972,7 @@ CHIP_PRINTCLUSTER_FLOW_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER \ + CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER \ diff --git a/examples/pump-controller-app/pump-controller-common/gen/attribute-id.h b/examples/pump-controller-app/pump-controller-common/gen/attribute-id.h index 8a27c16bd5cbdd..0b5ffac7d0f54d 100644 --- a/examples/pump-controller-app/pump-controller-common/gen/attribute-id.h +++ b/examples/pump-controller-app/pump-controller-common/gen/attribute-id.h @@ -935,6 +935,14 @@ #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID (0x0031) #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID (0x0032) +// Attribute ids for cluster: Air Pressure Measurement + +// Client attributes + +// Server attributes +#define ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID (0x0000) +#define ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID (0x0001) + // Attribute ids for cluster: Carbon Monoxide Concentration Measurement // Client attributes diff --git a/examples/pump-controller-app/pump-controller-common/gen/client-command-macro.h b/examples/pump-controller-app/pump-controller-common/gen/client-command-macro.h index 3d1da11c6ca33b..7961f1c20a3a32 100644 --- a/examples/pump-controller-app/pump-controller-common/gen/client-command-macro.h +++ b/examples/pump-controller-app/pump-controller-common/gen/client-command-macro.h @@ -3190,6 +3190,16 @@ ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID, "uuuuuuu", stepMode, stepSize, transitionTime, \ colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); +/** @brief Command description for altitude + * + * Command: altitude + * @param altitude INT16S + */ +#define emberAfFillCommandAir \ + Pressure MeasurementClusteraltitude(altitude) emberAfFillExternalBuffer(mask, \ + \ + ZCL_ALTITUDE_COMMAND_ID, "u", altitude); + /** @brief Command description for ZoneEnrollResponse * * Command: ZoneEnrollResponse diff --git a/examples/pump-controller-app/pump-controller-common/gen/cluster-id.h b/examples/pump-controller-app/pump-controller-common/gen/cluster-id.h index c51dafee576190..dcc20f4f24fa52 100644 --- a/examples/pump-controller-app/pump-controller-common/gen/cluster-id.h +++ b/examples/pump-controller-app/pump-controller-common/gen/cluster-id.h @@ -173,6 +173,9 @@ // Definitions for cluster: Occupancy Sensing #define ZCL_OCCUPANCY_SENSING_CLUSTER_ID (0x0406) +// Definitions for cluster: Air Pressure Measurement +#define ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID (0x0407) + // Definitions for cluster: Carbon Monoxide Concentration Measurement #define ZCL_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID (0x040C) diff --git a/examples/pump-controller-app/pump-controller-common/gen/command-id.h b/examples/pump-controller-app/pump-controller-common/gen/command-id.h index 44115fd56ba082..bf5937895d6e10 100644 --- a/examples/pump-controller-app/pump-controller-common/gen/command-id.h +++ b/examples/pump-controller-app/pump-controller-common/gen/command-id.h @@ -388,6 +388,9 @@ #define ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID (0x4B) #define ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID (0x4C) +// Commands for cluster: Air Pressure Measurement +#define ZCL_ALTITUDE_COMMAND_ID (0x00) + // Commands for cluster: IAS Zone #define ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID (0x00) #define ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID (0x00) diff --git a/examples/pump-controller-app/pump-controller-common/gen/print-cluster.h b/examples/pump-controller-app/pump-controller-common/gen/print-cluster.h index bda8e8970ee88e..8417c73bdf5883 100644 --- a/examples/pump-controller-app/pump-controller-common/gen/print-cluster.h +++ b/examples/pump-controller-app/pump-controller-common/gen/print-cluster.h @@ -337,6 +337,13 @@ #define CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER #endif +#if defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_SERVER) || defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ + { ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, 1031, "Air Pressure Measurement" }, +#else +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER +#endif + #if defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER) || \ defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ @@ -965,6 +972,7 @@ CHIP_PRINTCLUSTER_FLOW_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER \ + CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER \ diff --git a/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h b/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h index 8a27c16bd5cbdd..0b5ffac7d0f54d 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h +++ b/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h @@ -935,6 +935,14 @@ #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID (0x0031) #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID (0x0032) +// Attribute ids for cluster: Air Pressure Measurement + +// Client attributes + +// Server attributes +#define ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID (0x0000) +#define ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID (0x0001) + // Attribute ids for cluster: Carbon Monoxide Concentration Measurement // Client attributes diff --git a/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h b/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h index 3d1da11c6ca33b..7961f1c20a3a32 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h +++ b/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h @@ -3190,6 +3190,16 @@ ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID, "uuuuuuu", stepMode, stepSize, transitionTime, \ colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); +/** @brief Command description for altitude + * + * Command: altitude + * @param altitude INT16S + */ +#define emberAfFillCommandAir \ + Pressure MeasurementClusteraltitude(altitude) emberAfFillExternalBuffer(mask, \ + \ + ZCL_ALTITUDE_COMMAND_ID, "u", altitude); + /** @brief Command description for ZoneEnrollResponse * * Command: ZoneEnrollResponse diff --git a/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h b/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h index c51dafee576190..dcc20f4f24fa52 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h +++ b/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h @@ -173,6 +173,9 @@ // Definitions for cluster: Occupancy Sensing #define ZCL_OCCUPANCY_SENSING_CLUSTER_ID (0x0406) +// Definitions for cluster: Air Pressure Measurement +#define ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID (0x0407) + // Definitions for cluster: Carbon Monoxide Concentration Measurement #define ZCL_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID (0x040C) diff --git a/examples/temperature-measurement-app/esp32/main/gen/command-id.h b/examples/temperature-measurement-app/esp32/main/gen/command-id.h index 44115fd56ba082..bf5937895d6e10 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/command-id.h +++ b/examples/temperature-measurement-app/esp32/main/gen/command-id.h @@ -388,6 +388,9 @@ #define ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID (0x4B) #define ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID (0x4C) +// Commands for cluster: Air Pressure Measurement +#define ZCL_ALTITUDE_COMMAND_ID (0x00) + // Commands for cluster: IAS Zone #define ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID (0x00) #define ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID (0x00) diff --git a/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h b/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h index bda8e8970ee88e..8417c73bdf5883 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h +++ b/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h @@ -337,6 +337,13 @@ #define CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER #endif +#if defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_SERVER) || defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ + { ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, 1031, "Air Pressure Measurement" }, +#else +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER +#endif + #if defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER) || \ defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ @@ -965,6 +972,7 @@ CHIP_PRINTCLUSTER_FLOW_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER \ + CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER \ diff --git a/examples/tv-app/tv-common/gen/attribute-id.h b/examples/tv-app/tv-common/gen/attribute-id.h index 8a27c16bd5cbdd..0b5ffac7d0f54d 100644 --- a/examples/tv-app/tv-common/gen/attribute-id.h +++ b/examples/tv-app/tv-common/gen/attribute-id.h @@ -935,6 +935,14 @@ #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID (0x0031) #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID (0x0032) +// Attribute ids for cluster: Air Pressure Measurement + +// Client attributes + +// Server attributes +#define ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID (0x0000) +#define ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID (0x0001) + // Attribute ids for cluster: Carbon Monoxide Concentration Measurement // Client attributes diff --git a/examples/tv-app/tv-common/gen/client-command-macro.h b/examples/tv-app/tv-common/gen/client-command-macro.h index 3d1da11c6ca33b..7961f1c20a3a32 100644 --- a/examples/tv-app/tv-common/gen/client-command-macro.h +++ b/examples/tv-app/tv-common/gen/client-command-macro.h @@ -3190,6 +3190,16 @@ ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID, "uuuuuuu", stepMode, stepSize, transitionTime, \ colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); +/** @brief Command description for altitude + * + * Command: altitude + * @param altitude INT16S + */ +#define emberAfFillCommandAir \ + Pressure MeasurementClusteraltitude(altitude) emberAfFillExternalBuffer(mask, \ + \ + ZCL_ALTITUDE_COMMAND_ID, "u", altitude); + /** @brief Command description for ZoneEnrollResponse * * Command: ZoneEnrollResponse diff --git a/examples/tv-app/tv-common/gen/cluster-id.h b/examples/tv-app/tv-common/gen/cluster-id.h index c51dafee576190..dcc20f4f24fa52 100644 --- a/examples/tv-app/tv-common/gen/cluster-id.h +++ b/examples/tv-app/tv-common/gen/cluster-id.h @@ -173,6 +173,9 @@ // Definitions for cluster: Occupancy Sensing #define ZCL_OCCUPANCY_SENSING_CLUSTER_ID (0x0406) +// Definitions for cluster: Air Pressure Measurement +#define ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID (0x0407) + // Definitions for cluster: Carbon Monoxide Concentration Measurement #define ZCL_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID (0x040C) diff --git a/examples/tv-app/tv-common/gen/command-id.h b/examples/tv-app/tv-common/gen/command-id.h index 44115fd56ba082..bf5937895d6e10 100644 --- a/examples/tv-app/tv-common/gen/command-id.h +++ b/examples/tv-app/tv-common/gen/command-id.h @@ -388,6 +388,9 @@ #define ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID (0x4B) #define ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID (0x4C) +// Commands for cluster: Air Pressure Measurement +#define ZCL_ALTITUDE_COMMAND_ID (0x00) + // Commands for cluster: IAS Zone #define ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID (0x00) #define ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID (0x00) diff --git a/examples/tv-app/tv-common/gen/print-cluster.h b/examples/tv-app/tv-common/gen/print-cluster.h index bda8e8970ee88e..8417c73bdf5883 100644 --- a/examples/tv-app/tv-common/gen/print-cluster.h +++ b/examples/tv-app/tv-common/gen/print-cluster.h @@ -337,6 +337,13 @@ #define CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER #endif +#if defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_SERVER) || defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ + { ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, 1031, "Air Pressure Measurement" }, +#else +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER +#endif + #if defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER) || \ defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ @@ -965,6 +972,7 @@ CHIP_PRINTCLUSTER_FLOW_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER \ + CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER \ diff --git a/examples/window-app/common/gen/attribute-id.h b/examples/window-app/common/gen/attribute-id.h index 8a27c16bd5cbdd..0b5ffac7d0f54d 100644 --- a/examples/window-app/common/gen/attribute-id.h +++ b/examples/window-app/common/gen/attribute-id.h @@ -935,6 +935,14 @@ #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID (0x0031) #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID (0x0032) +// Attribute ids for cluster: Air Pressure Measurement + +// Client attributes + +// Server attributes +#define ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID (0x0000) +#define ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID (0x0001) + // Attribute ids for cluster: Carbon Monoxide Concentration Measurement // Client attributes diff --git a/examples/window-app/common/gen/client-command-macro.h b/examples/window-app/common/gen/client-command-macro.h index 3d1da11c6ca33b..7961f1c20a3a32 100644 --- a/examples/window-app/common/gen/client-command-macro.h +++ b/examples/window-app/common/gen/client-command-macro.h @@ -3190,6 +3190,16 @@ ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID, "uuuuuuu", stepMode, stepSize, transitionTime, \ colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); +/** @brief Command description for altitude + * + * Command: altitude + * @param altitude INT16S + */ +#define emberAfFillCommandAir \ + Pressure MeasurementClusteraltitude(altitude) emberAfFillExternalBuffer(mask, \ + \ + ZCL_ALTITUDE_COMMAND_ID, "u", altitude); + /** @brief Command description for ZoneEnrollResponse * * Command: ZoneEnrollResponse diff --git a/examples/window-app/common/gen/cluster-id.h b/examples/window-app/common/gen/cluster-id.h index c51dafee576190..dcc20f4f24fa52 100644 --- a/examples/window-app/common/gen/cluster-id.h +++ b/examples/window-app/common/gen/cluster-id.h @@ -173,6 +173,9 @@ // Definitions for cluster: Occupancy Sensing #define ZCL_OCCUPANCY_SENSING_CLUSTER_ID (0x0406) +// Definitions for cluster: Air Pressure Measurement +#define ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID (0x0407) + // Definitions for cluster: Carbon Monoxide Concentration Measurement #define ZCL_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID (0x040C) diff --git a/examples/window-app/common/gen/command-id.h b/examples/window-app/common/gen/command-id.h index 44115fd56ba082..bf5937895d6e10 100644 --- a/examples/window-app/common/gen/command-id.h +++ b/examples/window-app/common/gen/command-id.h @@ -388,6 +388,9 @@ #define ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID (0x4B) #define ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID (0x4C) +// Commands for cluster: Air Pressure Measurement +#define ZCL_ALTITUDE_COMMAND_ID (0x00) + // Commands for cluster: IAS Zone #define ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID (0x00) #define ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID (0x00) diff --git a/examples/window-app/common/gen/print-cluster.h b/examples/window-app/common/gen/print-cluster.h index bda8e8970ee88e..8417c73bdf5883 100644 --- a/examples/window-app/common/gen/print-cluster.h +++ b/examples/window-app/common/gen/print-cluster.h @@ -337,6 +337,13 @@ #define CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER #endif +#if defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_SERVER) || defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ + { ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, 1031, "Air Pressure Measurement" }, +#else +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER +#endif + #if defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER) || \ defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ @@ -965,6 +972,7 @@ CHIP_PRINTCLUSTER_FLOW_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER \ + CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER \ diff --git a/src/controller/data_model/gen/CHIPClusters.cpp b/src/controller/data_model/gen/CHIPClusters.cpp index c966a646c8e80a..85cffeb0b4d21e 100644 --- a/src/controller/data_model/gen/CHIPClusters.cpp +++ b/src/controller/data_model/gen/CHIPClusters.cpp @@ -103,6 +103,74 @@ CHIP_ERROR AccountLoginCluster::ReadAttributeClusterRevision(Callback::Cancelabl return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// AirPressureMeasurement Cluster Commands +CHIP_ERROR AirPressureMeasurementCluster::Altitude(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t altitude) +{ + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + if (mpCommandSender == nullptr) + { + ReturnErrorOnFailure(chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&mpCommandSender)); + } + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kAltitudeCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + ReturnErrorOnFailure(mpCommandSender->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = mpCommandSender->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // altitude: int16s + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), altitude)); + + ReturnErrorOnFailure(mpCommandSender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(mpCommandSender, onSuccessCallback, onFailureCallback); + + return mDevice->SendCommands(mpCommandSender); +} + +// AirPressureMeasurement Cluster Attributes +CHIP_ERROR AirPressureMeasurementCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeAirPressureMeasurementClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR AirPressureMeasurementCluster::ReadAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeAirPressureMeasurementClusterReadMeasuredValueAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR AirPressureMeasurementCluster::ReadAttributeAltitude(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeAirPressureMeasurementClusterReadAltitudeAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR AirPressureMeasurementCluster::WriteAttributeAltitude(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeAirPressureMeasurementClusterWriteAltitudeAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR AirPressureMeasurementCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeAirPressureMeasurementClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // ApplicationBasic Cluster Commands // ApplicationBasic Cluster Attributes CHIP_ERROR ApplicationBasicCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, diff --git a/src/controller/data_model/gen/CHIPClusters.h b/src/controller/data_model/gen/CHIPClusters.h index 422174d829a1d5..43f9116fd328ee 100644 --- a/src/controller/data_model/gen/CHIPClusters.h +++ b/src/controller/data_model/gen/CHIPClusters.h @@ -28,6 +28,7 @@ namespace chip { namespace Controller { constexpr ClusterId kAccountLoginClusterId = 0x050E; +constexpr ClusterId kAirPressureMeasurementClusterId = 0x0407; constexpr ClusterId kApplicationBasicClusterId = 0x050D; constexpr ClusterId kApplicationLauncherClusterId = 0x050C; constexpr ClusterId kAudioOutputClusterId = 0x050B; @@ -85,6 +86,27 @@ class DLL_EXPORT AccountLoginCluster : public ClusterBase static constexpr CommandId kLoginCommandId = 0x01; }; +class DLL_EXPORT AirPressureMeasurementCluster : public ClusterBase +{ +public: + AirPressureMeasurementCluster() : ClusterBase(kAirPressureMeasurementClusterId) {} + ~AirPressureMeasurementCluster() {} + + // Cluster Commands + CHIP_ERROR Altitude(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, int16_t altitude); + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeAltitude(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR WriteAttributeAltitude(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int16_t value); + +private: + static constexpr CommandId kAltitudeCommandId = 0x00; +}; + class DLL_EXPORT ApplicationBasicCluster : public ClusterBase { public: diff --git a/src/controller/data_model/gen/attribute-id.h b/src/controller/data_model/gen/attribute-id.h index 8a27c16bd5cbdd..0b5ffac7d0f54d 100644 --- a/src/controller/data_model/gen/attribute-id.h +++ b/src/controller/data_model/gen/attribute-id.h @@ -935,6 +935,14 @@ #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID (0x0031) #define ZCL_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID (0x0032) +// Attribute ids for cluster: Air Pressure Measurement + +// Client attributes + +// Server attributes +#define ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID (0x0000) +#define ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID (0x0001) + // Attribute ids for cluster: Carbon Monoxide Concentration Measurement // Client attributes diff --git a/src/controller/data_model/gen/call-command-handler.cpp b/src/controller/data_model/gen/call-command-handler.cpp index 225e3f75c10d73..0a5baa57938c7d 100644 --- a/src/controller/data_model/gen/call-command-handler.cpp +++ b/src/controller/data_model/gen/call-command-handler.cpp @@ -29,6 +29,7 @@ using namespace chip; EmberAfStatus emberAfAccountLoginClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfAirPressureMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfApplicationBasicClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfApplicationLauncherClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfAudioOutputClusterClientCommandParse(EmberAfClusterCommand * cmd); @@ -97,6 +98,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) case ZCL_ACCOUNT_LOGIN_CLUSTER_ID: result = emberAfAccountLoginClusterClientCommandParse(cmd); break; + case ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID: + // No commands are enabled for cluster Air Pressure Measurement + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_APPLICATION_BASIC_CLUSTER_ID: // No commands are enabled for cluster Application Basic 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 f962c7b85ffbfe..8d378871fbb768 100644 --- a/src/controller/data_model/gen/callback-stub.cpp +++ b/src/controller/data_model/gen/callback-stub.cpp @@ -32,6 +32,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_ACCOUNT_LOGIN_CLUSTER_ID: emberAfAccountLoginClusterInitCallback(endpoint); break; + case ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID: + emberAfAirPressureMeasurementClusterInitCallback(endpoint); + break; case ZCL_APPLICATION_BASIC_CLUSTER_ID: emberAfApplicationBasicClusterInitCallback(endpoint); break; @@ -148,6 +151,11 @@ void __attribute__((weak)) emberAfAccountLoginClusterInitCallback(EndpointId end // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfAirPressureMeasurementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfApplicationBasicClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/src/controller/data_model/gen/callback.h b/src/controller/data_model/gen/callback.h index 55bf50f2dd6ecd..e9f384943da888 100644 --- a/src/controller/data_model/gen/callback.h +++ b/src/controller/data_model/gen/callback.h @@ -48,6 +48,14 @@ void emberAfClusterInitCallback(chip::EndpointId endpoint, chip::ClusterId clust */ void emberAfAccountLoginClusterInitCallback(chip::EndpointId endpoint); +/** @brief Air Pressure Measurement Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfAirPressureMeasurementClusterInitCallback(chip::EndpointId endpoint); + /** @brief Application Basic Cluster Init * * Cluster Init @@ -400,6 +408,78 @@ EmberAfStatus emberAfAccountLoginClusterClientPreAttributeChangedCallback(chip:: */ void emberAfAccountLoginClusterClientTickCallback(chip::EndpointId endpoint); +// +// Air Pressure Measurement Cluster client +// + +/** @brief Air Pressure Measurement Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfAirPressureMeasurementClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Air Pressure Measurement Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfAirPressureMeasurementClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Air Pressure Measurement 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 emberAfAirPressureMeasurementClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Air Pressure Measurement 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 emberAfAirPressureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Air Pressure Measurement 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 emberAfAirPressureMeasurementClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, + uint16_t size, uint8_t * value); + +/** @brief Air Pressure Measurement Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfAirPressureMeasurementClusterClientTickCallback(chip::EndpointId endpoint); + // // Application Basic 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 4e1a6a4cb8fc22..f86b3cb0f4324d 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 @@ -29,6 +29,7 @@ | Cluster Name | ID | |---------------------------------------------------------------------+--------| | AccountLogin | 0x050E | +| AirPressureMeasurement | 0x0407 | | ApplicationBasic | 0x050D | | ApplicationLauncher | 0x050C | | AudioOutput | 0x050B | @@ -90,6 +91,53 @@ chip::System::PacketBufferHandle encodeAccountLoginClusterDiscoverAttributes(uin chip::System::PacketBufferHandle encodeAccountLoginClusterReadClusterRevisionAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); +/*----------------------------------------------------------------------------*\ +| Cluster AirPressureMeasurement | 0x0407 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Altitude | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasuredValue | 0x0000 | +| * Altitude | 0x0001 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/** + * @brief + * Encode a Air Pressure Measurement server discover command into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeAirPressureMeasurementClusterDiscoverAttributes(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Air Pressure Measurement server read command for the measured value attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle +encodeAirPressureMeasurementClusterReadMeasuredValueAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Air Pressure Measurement server read command for the altitude attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeAirPressureMeasurementClusterReadAltitudeAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Air Pressure Measurement server write command for the altitude attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle +encodeAirPressureMeasurementClusterWriteAltitudeAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, int16_t altitude); + +/** + * @brief + * Encode a Air Pressure Measurement server read command for the cluster revision attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle +encodeAirPressureMeasurementClusterReadClusterRevisionAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + /*----------------------------------------------------------------------------*\ | Cluster ApplicationBasic | 0x050D | |------------------------------------------------------------------------------| diff --git a/src/controller/data_model/gen/client-command-macro.h b/src/controller/data_model/gen/client-command-macro.h index 3d1da11c6ca33b..7961f1c20a3a32 100644 --- a/src/controller/data_model/gen/client-command-macro.h +++ b/src/controller/data_model/gen/client-command-macro.h @@ -3190,6 +3190,16 @@ ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID, "uuuuuuu", stepMode, stepSize, transitionTime, \ colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); +/** @brief Command description for altitude + * + * Command: altitude + * @param altitude INT16S + */ +#define emberAfFillCommandAir \ + Pressure MeasurementClusteraltitude(altitude) emberAfFillExternalBuffer(mask, \ + \ + ZCL_ALTITUDE_COMMAND_ID, "u", altitude); + /** @brief Command description for ZoneEnrollResponse * * Command: ZoneEnrollResponse diff --git a/src/controller/data_model/gen/cluster-id.h b/src/controller/data_model/gen/cluster-id.h index c51dafee576190..dcc20f4f24fa52 100644 --- a/src/controller/data_model/gen/cluster-id.h +++ b/src/controller/data_model/gen/cluster-id.h @@ -173,6 +173,9 @@ // Definitions for cluster: Occupancy Sensing #define ZCL_OCCUPANCY_SENSING_CLUSTER_ID (0x0406) +// Definitions for cluster: Air Pressure Measurement +#define ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID (0x0407) + // Definitions for cluster: Carbon Monoxide Concentration Measurement #define ZCL_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID (0x040C) diff --git a/src/controller/data_model/gen/command-id.h b/src/controller/data_model/gen/command-id.h index 44115fd56ba082..bf5937895d6e10 100644 --- a/src/controller/data_model/gen/command-id.h +++ b/src/controller/data_model/gen/command-id.h @@ -388,6 +388,9 @@ #define ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID (0x4B) #define ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID (0x4C) +// Commands for cluster: Air Pressure Measurement +#define ZCL_ALTITUDE_COMMAND_ID (0x00) + // Commands for cluster: IAS Zone #define ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID (0x00) #define ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID (0x00) diff --git a/src/controller/data_model/gen/encoder.cpp b/src/controller/data_model/gen/encoder.cpp index dd1d6bed222158..9b8ff8c58f28ec 100644 --- a/src/controller/data_model/gen/encoder.cpp +++ b/src/controller/data_model/gen/encoder.cpp @@ -55,6 +55,7 @@ using namespace chip::Encoding::LittleEndian; | Cluster Name | ID | |---------------------------------------------------------------------+--------| | AccountLogin | 0x050E | +| AirPressureMeasurement | 0x0407 | | ApplicationBasic | 0x050D | | ApplicationLauncher | 0x050C | | AudioOutput | 0x050B | @@ -122,6 +123,9 @@ using namespace chip::Encoding::LittleEndian; #define ZCL_GET_SETUP_PIN_COMMAND_ID (0x00) #define ZCL_LOGIN_COMMAND_ID (0x01) +#define AIR_PRESSURE_MEASUREMENT_CLUSTER_ID 0x0407 +#define ZCL_ALTITUDE_COMMAND_ID (0x00) + #define APPLICATION_BASIC_CLUSTER_ID 0x050D #define APPLICATION_LAUNCHER_CLUSTER_ID 0x050C @@ -362,6 +366,68 @@ PacketBufferHandle encodeAccountLoginClusterReadClusterRevisionAttribute(uint8_t COMMAND_FOOTER(); } +/*----------------------------------------------------------------------------*\ +| Cluster AirPressureMeasurement | 0x0407 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Altitude | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasuredValue | 0x0000 | +| * Altitude | 0x0001 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +PacketBufferHandle encodeAirPressureMeasurementClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("DiscoverAirPressureMeasurementAttributes", AIR_PRESSURE_MEASUREMENT_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF); + COMMAND_FOOTER(); +} + +/* + * Attribute MeasuredValue + */ +PacketBufferHandle encodeAirPressureMeasurementClusterReadMeasuredValueAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadAirPressureMeasurementMeasuredValue", AIR_PRESSURE_MEASUREMENT_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000); + COMMAND_FOOTER(); +} + +/* + * Attribute Altitude + */ +PacketBufferHandle encodeAirPressureMeasurementClusterReadAltitudeAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadAirPressureMeasurementAltitude", AIR_PRESSURE_MEASUREMENT_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeAirPressureMeasurementClusterWriteAltitudeAttribute(uint8_t seqNum, EndpointId destinationEndpoint, + int16_t altitude) +{ + COMMAND_HEADER("WriteAirPressureMeasurementAltitude", AIR_PRESSURE_MEASUREMENT_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0001) + .Put8(41) + .Put16(static_cast(altitude)); + COMMAND_FOOTER(); +} + +/* + * Attribute ClusterRevision + */ +PacketBufferHandle encodeAirPressureMeasurementClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadAirPressureMeasurementClusterRevision", AIR_PRESSURE_MEASUREMENT_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD); + COMMAND_FOOTER(); +} + /*----------------------------------------------------------------------------*\ | Cluster ApplicationBasic | 0x050D | |------------------------------------------------------------------------------| diff --git a/src/controller/data_model/gen/endpoint_config.h b/src/controller/data_model/gen/endpoint_config.h index 5cbee9f06c19ae..93998acab50a34 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 36 +#define GENERATED_ATTRIBUTE_COUNT 37 #define GENERATED_ATTRIBUTES \ { \ \ @@ -131,6 +131,9 @@ /* Endpoint: 1, Cluster: Temperature Measurement (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ + /* Endpoint: 1, Cluster: Air Pressure Measurement (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ /* Endpoint: 1, Cluster: Wake on LAN (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ @@ -184,7 +187,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 36 +#define GENERATED_CLUSTER_COUNT 37 #define GENERATED_CLUSTERS \ { \ { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */ \ @@ -239,49 +242,52 @@ 0x0402, ZAP_ATTRIBUTE_INDEX(20), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (client) */ \ { \ - 0x0503, ZAP_ATTRIBUTE_INDEX(21), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0407, ZAP_ATTRIBUTE_INDEX(21), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Air Pressure Measurement (client) */ \ + { \ + 0x0503, ZAP_ATTRIBUTE_INDEX(22), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Wake on LAN (client) */ \ { \ - 0x0504, ZAP_ATTRIBUTE_INDEX(22), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0504, ZAP_ATTRIBUTE_INDEX(23), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: TV Channel (client) */ \ { \ - 0x0505, ZAP_ATTRIBUTE_INDEX(23), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0505, ZAP_ATTRIBUTE_INDEX(24), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Target Navigator (client) */ \ { \ - 0x0506, ZAP_ATTRIBUTE_INDEX(24), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0506, ZAP_ATTRIBUTE_INDEX(25), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Media Playback (client) */ \ { \ - 0x0507, ZAP_ATTRIBUTE_INDEX(25), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0507, ZAP_ATTRIBUTE_INDEX(26), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Media Input (client) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(26), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(27), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Low Power (client) */ \ { \ - 0x0509, ZAP_ATTRIBUTE_INDEX(27), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0509, ZAP_ATTRIBUTE_INDEX(28), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Keypad Input (client) */ \ { \ - 0x050A, ZAP_ATTRIBUTE_INDEX(28), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050A, ZAP_ATTRIBUTE_INDEX(29), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Content Launch (client) */ \ { \ - 0x050B, ZAP_ATTRIBUTE_INDEX(29), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050B, ZAP_ATTRIBUTE_INDEX(30), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Audio Output (client) */ \ { \ - 0x050C, ZAP_ATTRIBUTE_INDEX(30), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050C, ZAP_ATTRIBUTE_INDEX(31), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Launcher (client) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(31), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(32), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (client) */ \ { \ - 0x050E, ZAP_ATTRIBUTE_INDEX(32), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050E, ZAP_ATTRIBUTE_INDEX(33), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Account Login (client) */ \ { \ - 0x050F, ZAP_ATTRIBUTE_INDEX(33), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(34), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (client) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(34), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(35), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Binding (client) */ \ { \ - 0xF004, ZAP_ATTRIBUTE_INDEX(35), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF004, ZAP_ATTRIBUTE_INDEX(36), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Group Key Management (client) */ \ } @@ -290,7 +296,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 36, 72 }, \ + { ZAP_CLUSTER_INDEX(0), 37, 74 }, \ } // Largest attribute size is needed for various buffers @@ -300,7 +306,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (2) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (72) +#define ATTRIBUTE_MAX_SIZE (74) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) @@ -344,7 +350,7 @@ // Array of EmberAfCommandMetadata structs. #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask -#define EMBER_AF_GENERATED_COMMAND_COUNT (206) +#define EMBER_AF_GENERATED_COMMAND_COUNT (207) #define GENERATED_COMMANDS \ { \ \ @@ -545,6 +551,9 @@ { 0x0300, 0x4B, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* MoveColorTemperature */ \ { 0x0300, 0x4C, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* StepColorTemperature */ \ \ + /* Endpoint: 1, Cluster: Air Pressure Measurement (client) */ \ + { 0x0407, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* altitude */ \ + \ /* Endpoint: 1, Cluster: TV Channel (client) */ \ { 0x0504, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ChangeChannel */ \ { 0x0504, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ChangeChannelResponse */ \ diff --git a/src/controller/data_model/gen/gen_config.h b/src/controller/data_model/gen/gen_config.h index a988d93b5d22cd..4e1ca34195036b 100644 --- a/src/controller/data_model/gen/gen_config.h +++ b/src/controller/data_model/gen/gen_config.h @@ -30,6 +30,7 @@ /**** Cluster endpoint counts ****/ #define EMBER_AF_ACCOUNT_LOGIN_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_APPLICATION_BASIC_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_APPLICATION_LAUNCHER_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_AUDIO_OUTPUT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) @@ -72,6 +73,10 @@ #define ZCL_USING_ACCOUNT_LOGIN_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_ACCOUNT_LOGIN_CLIENT +// Use this macro to check if the client side of the Air Pressure Measurement cluster is included +#define ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_AIR_PRESSURE_MEASUREMENT_CLIENT + // Use this macro to check if the client side of the Application Basic cluster is included #define ZCL_USING_APPLICATION_BASIC_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_APPLICATION_BASIC_CLIENT diff --git a/src/controller/data_model/gen/print-cluster.h b/src/controller/data_model/gen/print-cluster.h index bda8e8970ee88e..8417c73bdf5883 100644 --- a/src/controller/data_model/gen/print-cluster.h +++ b/src/controller/data_model/gen/print-cluster.h @@ -337,6 +337,13 @@ #define CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER #endif +#if defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_SERVER) || defined(ZCL_USING_AIR_PRESSURE_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ + { ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, 1031, "Air Pressure Measurement" }, +#else +#define CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER +#endif + #if defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER) || \ defined(ZCL_USING_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ @@ -965,6 +972,7 @@ CHIP_PRINTCLUSTER_FLOW_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_OCCUPANCY_SENSING_CLUSTER \ + CHIP_PRINTCLUSTER_AIR_PRESSURE_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER \ diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index a375bb3c07d844..956a497e430f08 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -124,6 +124,48 @@ CHIP_ERROR chip_ime_ReadAttribute_AccountLogin_ClusterRevision(chip::Controller: } // End of Cluster AccountLogin +// Cluster AirPressureMeasurement + +CHIP_ERROR chip_ime_AppendCommand_AirPressureMeasurement_Altitude(chip::Controller::Device * device, uint64_t command, + chip::EndpointId ZCLendpointId, chip::GroupId, int16_t altitude) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::app::CommandSender * commandSenderObj = reinterpret_cast(command); + chip::Controller::AirPressureMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId, commandSenderObj); + return cluster.Altitude(nullptr, nullptr, altitude); +} + +CHIP_ERROR chip_ime_ReadAttribute_AirPressureMeasurement_MeasuredValue(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::AirPressureMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_AirPressureMeasurement_Altitude(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::AirPressureMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeAltitude(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_AirPressureMeasurement_ClusterRevision(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::AirPressureMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster AirPressureMeasurement // Cluster ApplicationBasic CHIP_ERROR chip_ime_ReadAttribute_ApplicationBasic_VendorName(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 7ec74ffeaea7a3..0639154217eb0b 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -47,6 +47,11 @@ def ListClusterCommands(self): "setupPIN": "str", }, }, + "AirPressureMeasurement": { + "Altitude": { + "altitude": "int", + }, + }, "ApplicationBasic": { }, "ApplicationLauncher": { @@ -634,6 +639,11 @@ def ListClusterAttributes(self): "AccountLogin": [ "ClusterRevision", ], + "AirPressureMeasurement": [ + "MeasuredValue", + "Altitude", + "ClusterRevision", + ], "ApplicationBasic": [ "VendorName", "VendorId", @@ -918,6 +928,10 @@ def ClusterAccountLogin_CommandLogin(self, device: ctypes.c_void_p, commandSende return self._chipLib.chip_ime_AppendCommand_AccountLogin_Login( device, commandSenderHandle, ZCLendpoint, ZCLgroupid, tempAccountIdentifier, len(tempAccountIdentifier), setupPIN, len(setupPIN) ) + def ClusterAirPressureMeasurement_CommandAltitude(self, device: ctypes.c_void_p, commandSenderHandle: int, ZCLendpoint: int, ZCLgroupid: int, altitude: int): + return self._chipLib.chip_ime_AppendCommand_AirPressureMeasurement_Altitude( + device, commandSenderHandle, ZCLendpoint, ZCLgroupid, altitude + ) def ClusterApplicationLauncher_CommandLaunchApp(self, device: ctypes.c_void_p, commandSenderHandle: int, ZCLendpoint: int, ZCLgroupid: int, data: bytes, catalogVendorId: int, applicationId: bytes): data = data.encode("utf-8") + b'\x00' applicationId = applicationId.encode("utf-8") + b'\x00' @@ -1462,6 +1476,12 @@ def ClusterWindowCovering_CommandWindowCoveringUpOpen(self, device: ctypes.c_voi def ClusterAccountLogin_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_AccountLogin_ClusterRevision(device, ZCLendpoint, ZCLgroupid) + def ClusterAirPressureMeasurement_ReadAttributeMeasuredValue(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_AirPressureMeasurement_MeasuredValue(device, ZCLendpoint, ZCLgroupid) + def ClusterAirPressureMeasurement_ReadAttributeAltitude(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_AirPressureMeasurement_Altitude(device, ZCLendpoint, ZCLgroupid) + def ClusterAirPressureMeasurement_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_AirPressureMeasurement_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterApplicationBasic_ReadAttributeVendorName(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_ApplicationBasic_VendorName(device, ZCLendpoint, ZCLgroupid) def ClusterApplicationBasic_ReadAttributeVendorId(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): @@ -1870,6 +1890,19 @@ def InitLib(self, chipLib): # Cluster AccountLogin ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_AccountLogin_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_AccountLogin_ClusterRevision.restype = ctypes.c_uint32 + # Cluster AirPressureMeasurement + # Cluster AirPressureMeasurement Command Altitude + self._chipLib.chip_ime_AppendCommand_AirPressureMeasurement_Altitude.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_int16] + self._chipLib.chip_ime_AppendCommand_AirPressureMeasurement_Altitude.restype = ctypes.c_uint32 + # Cluster AirPressureMeasurement ReadAttribute MeasuredValue + self._chipLib.chip_ime_ReadAttribute_AirPressureMeasurement_MeasuredValue.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_AirPressureMeasurement_MeasuredValue.restype = ctypes.c_uint32 + # Cluster AirPressureMeasurement ReadAttribute Altitude + self._chipLib.chip_ime_ReadAttribute_AirPressureMeasurement_Altitude.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_AirPressureMeasurement_Altitude.restype = ctypes.c_uint32 + # Cluster AirPressureMeasurement ReadAttribute ClusterRevision + self._chipLib.chip_ime_ReadAttribute_AirPressureMeasurement_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_AirPressureMeasurement_ClusterRevision.restype = ctypes.c_uint32 # Cluster ApplicationBasic # Cluster ApplicationBasic ReadAttribute VendorName self._chipLib.chip_ime_ReadAttribute_ApplicationBasic_VendorName.argtypes = [ctypes.c_void_p, 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 7cf7fcf04f421f..588fcb78262e46 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h @@ -55,6 +55,21 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Air Pressure Measurement + * + */ +@interface CHIPAirPressureMeasurement : CHIPCluster + +- (void)altitude:(int16_t)altitude responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeMeasuredValueWithResponseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeAltitudeWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeAltitudeWithValue:(int16_t)value responseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler; + +@end + /** * Cluster Application Basic * diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm index 2cc1a187a1686c..1da985146fed0a 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm @@ -3405,6 +3405,154 @@ - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)respons @end +@interface CHIPAirPressureMeasurement () +@property (readonly) Controller::AirPressureMeasurementCluster cppCluster; +@end + +@implementation CHIPAirPressureMeasurement + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)altitude:(int16_t)altitude 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.Altitude(onSuccess->Cancel(), onFailure->Cancel(), altitude); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeMeasuredValueWithResponseHandler:(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.ReadAttributeMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeAltitudeWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(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.ReadAttributeAltitude(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeAltitudeWithValue:(int16_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.WriteAttributeAltitude(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([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 CHIPApplicationBasic () @property (readonly) Controller::ApplicationBasicCluster cppCluster; @end diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 6a84bdcb5bc100..856bca2daff160 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -197,6 +197,82 @@ - (void)testSendClusterAccountLoginReadAttributeClusterRevisionWithResponseHandl [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterAirPressureMeasurementReadAttributeMeasuredValueWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"AirPressureMeasurementReadAttributeMeasuredValueWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPAirPressureMeasurement * cluster = [[CHIPAirPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"AirPressureMeasurement MeasuredValue Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterAirPressureMeasurementReadAttributeAltitudeWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"AirPressureMeasurementReadAttributeAltitudeWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPAirPressureMeasurement * cluster = [[CHIPAirPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeAltitudeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"AirPressureMeasurement Altitude Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterAirPressureMeasurementWriteAttributeAltitudeWithValue +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"AirPressureMeasurementWriteAttributeAltitudeWithValue"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPAirPressureMeasurement * cluster = [[CHIPAirPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + int16_t value = -32768; + [cluster writeAttributeAltitudeWithValue:value + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"AirPressureMeasurement Altitude Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterAirPressureMeasurementReadAttributeClusterRevisionWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"AirPressureMeasurementReadAttributeClusterRevisionWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPAirPressureMeasurement * cluster = [[CHIPAirPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"AirPressureMeasurement ClusterRevision Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterApplicationBasicReadAttributeVendorNameWithResponseHandler { XCTestExpectation * expectation = From 68dec82259834f34c85eba0d60726515c305d536 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 21 May 2021 08:29:34 +0000 Subject: [PATCH 8/8] Restyled by clang-format --- .../air-pressure-measurement-server.cpp | 50 +++++++------------ .../air-pressure-measurement-server.h | 4 +- src/app/zap-templates/templates/app/helper.js | 14 ++---- 3 files changed, 24 insertions(+), 44 deletions(-) diff --git a/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.cpp b/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.cpp index 442e2d97675b31..c4a788978a51a6 100644 --- a/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.cpp +++ b/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.cpp @@ -25,25 +25,18 @@ #include "gen/cluster-id.h" #include "gen/command-id.h" -EmberAfStatus emberAfAirPressureMeasurementClusterGetMeasuredValue(chip::EndpointId endpoint, uint16_t* measuredValue) +EmberAfStatus emberAfAirPressureMeasurementClusterGetMeasuredValue(chip::EndpointId endpoint, uint16_t * measuredValue) { - return emberAfReadAttribute(endpoint, - ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, - ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID, - CLUSTER_MASK_SERVER, - (uint8_t*)measuredValue, - sizeof(*measuredValue), - NULL); + return emberAfReadAttribute(endpoint, ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, + ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, + (uint8_t *) measuredValue, sizeof(*measuredValue), NULL); } static EmberAfStatus emberAfAirPressureMeasurementClusterSetAltitudeCallback(chip::EndpointId endpoint, int16_t altitude) { - EmberAfStatus status = emberAfWriteAttribute(endpoint, - ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, - ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID, - CLUSTER_MASK_SERVER, - (uint8_t *)&altitude, - ZCL_INT16S_ATTRIBUTE_TYPE); + EmberAfStatus status = + emberAfWriteAttribute(endpoint, ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID, + CLUSTER_MASK_SERVER, (uint8_t *) &altitude, ZCL_INT16S_ATTRIBUTE_TYPE); if (EMBER_ZCL_STATUS_SUCCESS != status) { // emberAfAirPressureMeasurementClusterPrintln("ERR: writing present value %x", status); @@ -55,30 +48,27 @@ static EmberAfStatus emberAfAirPressureMeasurementClusterSetAltitudeCallback(chi void emberAfAirPressureMeasurementClusterServerInitCallback(chip::EndpointId endpoint) { uint16_t measuredValue = 0; - EmberAfStatus status = emberAfAirPressureMeasurementClusterGetMeasuredValue(endpoint, &measuredValue); + EmberAfStatus status = emberAfAirPressureMeasurementClusterGetMeasuredValue(endpoint, &measuredValue); if (EMBER_ZCL_STATUS_SUCCESS != status) { - (void)emberAfAirPressureMeasurementClusterSetMeasuredValueCallback(endpoint, 10132); + (void) emberAfAirPressureMeasurementClusterSetMeasuredValueCallback(endpoint, 10132); } int16_t altitude = 0; - status = emberAfAirPressureMeasurementClusterGetAltitudeValue(endpoint, &altitude); + status = emberAfAirPressureMeasurementClusterGetAltitudeValue(endpoint, &altitude); if (EMBER_ZCL_STATUS_SUCCESS != status) { - (void)emberAfAirPressureMeasurementClusterSetAltitudeCallback(endpoint, 0); + (void) emberAfAirPressureMeasurementClusterSetAltitudeCallback(endpoint, 0); } } EmberAfStatus emberAfAirPressureMeasurementClusterSetMeasuredValueCallback(chip::EndpointId endpoint, uint16_t measuredValue) { - EmberAfStatus status = emberAfWriteAttribute(endpoint, - ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, - ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID, - CLUSTER_MASK_SERVER, - (uint8_t *)&measuredValue, - ZCL_INT16U_ATTRIBUTE_TYPE); + EmberAfStatus status = emberAfWriteAttribute(endpoint, ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, + ZCL_AIR_PRESSURE_MEASUREMENT_MEASURED_VALUE_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, + (uint8_t *) &measuredValue, ZCL_INT16U_ATTRIBUTE_TYPE); if (EMBER_ZCL_STATUS_SUCCESS != status) { // emberAfAirPressureMeasurementClusterPrintln("ERR: writing present value %x", status); @@ -87,13 +77,9 @@ EmberAfStatus emberAfAirPressureMeasurementClusterSetMeasuredValueCallback(chip: return status; } -EmberAfStatus emberAfAirPressureMeasurementClusterGetAltitudeValue(chip::EndpointId endpoint, int16_t* altitude) +EmberAfStatus emberAfAirPressureMeasurementClusterGetAltitudeValue(chip::EndpointId endpoint, int16_t * altitude) { - return emberAfReadAttribute(endpoint, - ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, - ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID, - CLUSTER_MASK_SERVER, - (uint8_t*)altitude, - sizeof(*altitude), - NULL); + return emberAfReadAttribute(endpoint, ZCL_AIR_PRESSURE_MEASUREMENT_CLUSTER_ID, + ZCL_AIR_PRESSURE_MEASUREMENT_ALTITUDE_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, (uint8_t *) altitude, + sizeof(*altitude), NULL); } diff --git a/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.h b/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.h index 81274389d7d5fe..200945cab45d5d 100644 --- a/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.h +++ b/src/app/clusters/air-pressure-measurement-server/air-pressure-measurement-server.h @@ -20,5 +20,5 @@ #include EmberAfStatus emberAfAirPressureMeasurementClusterSetMeasuredValueCallback(chip::EndpointId endpoint, uint16_t measuredValue); -EmberAfStatus emberAfAirPressureMeasurementClusterGetMeasuredValue(chip::EndpointId endpoint, uint16_t* measuredValue); -EmberAfStatus emberAfAirPressureMeasurementClusterGetAltitudeValue(chip::EndpointId endpoint, int16_t* altitude); +EmberAfStatus emberAfAirPressureMeasurementClusterGetMeasuredValue(chip::EndpointId endpoint, uint16_t * measuredValue); +EmberAfStatus emberAfAirPressureMeasurementClusterGetAltitudeValue(chip::EndpointId endpoint, int16_t * altitude); diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js index b07d6e44afdf12..e2baf2d3cd8946 100644 --- a/src/app/zap-templates/templates/app/helper.js +++ b/src/app/zap-templates/templates/app/helper.js @@ -195,16 +195,10 @@ function asChipUnderlyingType(label, type) // These helpers only works within the endpoint_config iterator // List of all cluster with generated functions -var endpointClusterWithInit = [ 'Basic', - 'Air Pressure Measurement', - 'Identify', - 'Groups', - 'Scenes', - 'Occupancy Sensing', - 'On/off', - 'Level Control', - 'Color Control', - 'IAS Zone' ]; +var endpointClusterWithInit = [ + 'Basic', 'Air Pressure Measurement', 'Identify', 'Groups', 'Scenes', 'Occupancy Sensing', 'On/off', 'Level Control', + 'Color Control', 'IAS Zone' +]; var endpointClusterWithAttributeChanged = [ 'Identify', 'Door Lock' ]; var endpointClusterWithPreAttribute = [ 'IAS Zone' ]; var endpointClusterWithMessageSent = [ 'IAS Zone' ];