From 68c3683c800d4078a5c16fcc7a125277cc5a646f Mon Sep 17 00:00:00 2001 From: Sean McClain Date: Mon, 9 Mar 2026 09:27:43 -0500 Subject: [PATCH 1/3] Initial Proximity Ranging cluster definition generated by Alchemy --- .github/workflows/tests.yaml | 1 + .../chip/proximity-ranging-cluster.xml | 215 ++++++++++++++++++ .../zcl/zcl-with-test-extensions.json | 1 + src/app/zap-templates/zcl/zcl.json | 1 + src/app/zap_cluster_list.json | 2 + 5 files changed, 220 insertions(+) create mode 100644 src/app/zap-templates/zcl/data-model/chip/proximity-ranging-cluster.xml diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d098d9c534fab6..63ac6284b6ba14 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -134,6 +134,7 @@ jobs: src/app/zap-templates/zcl/data-model/chip/groupcast-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/meter-identification-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/proximity-ranging-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/push-av-stream-transport-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/semantic-tag-namespace-enums.xml \ src/app/zap-templates/zcl/data-model/chip/access-control-definitions.xml \ diff --git a/src/app/zap-templates/zcl/data-model/chip/proximity-ranging-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/proximity-ranging-cluster.xml new file mode 100644 index 00000000000000..90de838da1a891 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/proximity-ranging-cluster.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Measurement & Sensing + Proximity Ranging + 0x0433 + PROXIMITY_RANGING_CLUSTER + This cluster enables the configuration of proximity ranging sessions and reporting of proximity ranging data. + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This command allows the client to request the start of a ranging session. + + + + + + + + + + + + + Upon receipt of a StartRangingRequest command, the server SHALL send a StartRangingResponse command indicating whether the request has been accepted or rejected. + + + + + + Upon receipt of a StopRangingRequest command that contains a SessionID that matches an active ranging session, the server SHALL terminate the corresponding ranging session. + + + + + The RangingResult command is used by the initiator to report ranging measurement data. + + + + + + diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 9d11a8763e8868..bcea2b08af5c4b 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -89,6 +89,7 @@ "mode-base-cluster.xml", "mode-select-cluster.xml", "mode-select-extensions.xml", + "proximity-ranging-cluster.xml", "push-av-stream-transport-cluster.xml", "semantic-tag-namespace-enums.xml", "network-commissioning-cluster.xml", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 4072affe9c95bf..20cca960be7543 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -87,6 +87,7 @@ "messages-cluster.xml", "mode-base-cluster.xml", "mode-select-cluster.xml", + "proximity-ranging-cluster.xml", "push-av-stream-transport-cluster.xml", "semantic-tag-namespace-enums.xml", "network-commissioning-cluster.xml", diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 050e676e67962e..7675cb737345fc 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -80,6 +80,7 @@ "MESSAGES_CLUSTER": [], "MODE_SELECT_CLUSTER": [], "NETWORK_COMMISSIONING_CLUSTER": [], + "PROXIMITY_RANGING_CLUSTER": [], "PUSH_AV_STREAM_TRANSPORT_CLUSTER": [], "SAMPLE_MEI_CLUSTER": [], "NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER": [], @@ -266,6 +267,7 @@ "NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER": [ "concentration-measurement-server" ], + "PROXIMITY_RANGING_CLUSTER": [], "PUSH_AV_STREAM_TRANSPORT_CLUSTER": ["push-av-stream-transport-server"], "SAMPLE_MEI_CLUSTER": ["sample-mei-server"], "OCCUPANCY_SENSING_CLUSTER": ["occupancy-sensor-server"], From 6c6ed883806191df4b0161730535e76305e466e2 Mon Sep 17 00:00:00 2001 From: Sean McClain Date: Mon, 9 Mar 2026 09:49:14 -0500 Subject: [PATCH 2/3] Update ZAP generated files with new proximity ranging cluster based on Alchemy XML --- docs/ids_and_codes/zap_clusters.md | 1 + .../app-templates/gen_config.h | 2 + .../lighting-app/app-templates/gen_config.h | 2 + .../data_model/controller-clusters.matter | 161 +++ .../chip/devicecontroller/ChipClusters.java | 398 ++++++ .../chip/devicecontroller/ChipStructs.java | 713 ++++++++++ .../devicecontroller/ClusterIDMapping.java | 143 ++ .../devicecontroller/ClusterInfoMapping.java | 211 +++ .../devicecontroller/ClusterReadMapping.java | 115 ++ .../devicecontroller/ClusterWriteMapping.java | 2 + .../chip/devicecontroller/cluster/files.gni | 8 + ...ClusterBLERangingDeviceRoleConfigStruct.kt | 62 + ...LTChannelSoundingDeviceRoleConfigStruct.kt | 80 ++ .../ProximityRangingClusterRDRStruct.kt | 80 ++ ...RangingClusterRangingCapabilitiesStruct.kt | 72 + ...gingClusterRangingMeasurementDataStruct.kt | 202 +++ ...ingClusterRangingTriggerConditionStruct.kt | 88 ++ ...yRangingClusterReportingConditionStruct.kt | 96 ++ ...lusterWiFiRangingDeviceRoleConfigStruct.kt | 76 ++ .../clusters/ProximityRangingCluster.kt | 1171 ++++++++++++++++ .../java/matter/controller/cluster/files.gni | 9 + ...ClusterBLERangingDeviceRoleConfigStruct.kt | 62 + ...LTChannelSoundingDeviceRoleConfigStruct.kt | 80 ++ .../ProximityRangingClusterRDRStruct.kt | 80 ++ ...RangingClusterRangingCapabilitiesStruct.kt | 72 + ...gingClusterRangingMeasurementDataStruct.kt | 202 +++ ...ingClusterRangingTriggerConditionStruct.kt | 88 ++ ...yRangingClusterReportingConditionStruct.kt | 96 ++ ...lusterWiFiRangingDeviceRoleConfigStruct.kt | 76 ++ .../CHIPAttributeTLVValueDecoder.cpp | 263 ++++ .../CHIPEventTLVValueDecoder.cpp | 10 + .../python/matter/clusters/CHIPClusters.py | 92 ++ .../python/matter/clusters/Objects.py | 488 +++++++ .../MTRAttributeSpecifiedCheck.mm | 43 + .../MTRAttributeTLVValueDecoder.mm | 108 ++ .../CHIP/zap-generated/MTRBaseClusters.h | 157 +++ .../CHIP/zap-generated/MTRBaseClusters.mm | 413 ++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 19 + .../CHIP/zap-generated/MTRClusterNames.mm | 101 ++ .../CHIP/zap-generated/MTRClusters.h | 47 + .../CHIP/zap-generated/MTRClusters.mm | 108 ++ .../zap-generated/MTRCommandPayloadsObjc.h | 118 ++ .../zap-generated/MTRCommandPayloadsObjc.mm | 506 +++++++ .../MTRCommandPayloads_Internal.h | 26 + .../zap-generated/MTRCommandTimedCheck.mm | 12 + .../zap-generated/MTREventTLVValueDecoder.mm | 16 + .../CHIP/zap-generated/MTRStructsObjc.h | 63 + .../CHIP/zap-generated/MTRStructsObjc.mm | 285 ++++ .../zap-generated/attributes/Accessors.cpp | 241 ++++ .../zap-generated/attributes/Accessors.h | 36 + .../app-common/zap-generated/callback.h | 61 + .../zap-generated/cluster-enums-check.h | 1 + .../app-common/zap-generated/cluster-enums.h | 1 + .../zap-generated/cluster-objects.cpp | 11 + .../zap-generated/cluster-objects.h | 4 + .../app-common/zap-generated/ids/Attributes.h | 1 + .../app-common/zap-generated/ids/Clusters.h | 1 + .../app-common/zap-generated/ids/Commands.h | 1 + .../app-common/zap-generated/ids/Events.h | 1 + zzz_generated/app-common/clusters/BUILD.gn | 1 + .../app-common/clusters/MetadataQuery.h | 7 + .../clusters/ProximityRanging/AttributeIds.h | 63 + .../clusters/ProximityRanging/Attributes.h | 165 +++ .../clusters/ProximityRanging/Attributes.ipp | 63 + .../clusters/ProximityRanging/BUILD.gn | 93 ++ .../clusters/ProximityRanging/ClusterId.h | 19 + .../clusters/ProximityRanging/CommandIds.h | 41 + .../clusters/ProximityRanging/Commands.h | 241 ++++ .../clusters/ProximityRanging/Commands.ipp | 198 +++ .../clusters/ProximityRanging/Enums.h | 126 ++ .../clusters/ProximityRanging/EnumsCheck.h | 87 ++ .../clusters/ProximityRanging/EventIds.h | 17 + .../clusters/ProximityRanging/Events.h | 49 + .../clusters/ProximityRanging/Events.ipp | 36 + .../clusters/ProximityRanging/Ids.h | 10 + .../clusters/ProximityRanging/Metadata.h | 72 + .../ProximityRanging/MetadataProvider.h | 63 + .../clusters/ProximityRanging/Structs.h | 258 ++++ .../clusters/ProximityRanging/Structs.ipp | 382 ++++++ .../zap-generated/cluster/Commands.h | 192 +++ .../cluster/ComplexArgumentParser.cpp | 383 ++++++ .../cluster/ComplexArgumentParser.h | 47 + .../cluster/logging/DataModelLogger.cpp | 419 ++++++ .../cluster/logging/DataModelLogger.h | 33 + .../cluster/logging/EntryToText.cpp | 51 + .../zap-generated/cluster/Commands.h | 1176 +++++++++++++++++ 86 files changed, 11974 insertions(+) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLERangingDeviceRoleConfigStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRDRStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingCapabilitiesStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingTriggerConditionStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/clusters/ProximityRangingCluster.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLERangingDeviceRoleConfigStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRDRStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingCapabilitiesStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingTriggerConditionStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct.kt create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/AttributeIds.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/Attributes.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/Attributes.ipp create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/BUILD.gn create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/ClusterId.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/CommandIds.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/Commands.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/Commands.ipp create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/Enums.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/EnumsCheck.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/EventIds.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/Events.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/Events.ipp create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/Ids.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/Metadata.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/MetadataProvider.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/Structs.h create mode 100644 zzz_generated/app-common/clusters/ProximityRanging/Structs.ipp diff --git a/docs/ids_and_codes/zap_clusters.md b/docs/ids_and_codes/zap_clusters.md index 8b2aa749d8a301..21f501499b8eb9 100644 --- a/docs/ids_and_codes/zap_clusters.md +++ b/docs/ids_and_codes/zap_clusters.md @@ -119,6 +119,7 @@ Generally regenerate using one of: | 1071 | 0x42F | RadonConcentrationMeasurement | | 1072 | 0x430 | SoilMeasurement | | 1073 | 0x431 | AmbientContextSensing | +| 1075 | 0x433 | ProximityRanging | | 1105 | 0x451 | WiFiNetworkManagement | | 1106 | 0x452 | ThreadBorderRouterManagement | | 1107 | 0x453 | ThreadNetworkDirectory | diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h index 82332c9b22095c..724b3320aff10a 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h @@ -128,6 +128,7 @@ #define MATTER_DM_RADON_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define MATTER_DM_SOIL_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_AMBIENT_CONTEXT_SENSING_CLUSTER_SERVER_ENDPOINT_COUNT (0) +#define MATTER_DM_PROXIMITY_RANGING_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_WIFI_NETWORK_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_THREAD_NETWORK_DIRECTORY_CLUSTER_SERVER_ENDPOINT_COUNT (0) @@ -272,6 +273,7 @@ #define MATTER_DM_RADON_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_SOIL_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_AMBIENT_CONTEXT_SENSING_CLUSTER_CLIENT_ENDPOINT_COUNT (0) +#define MATTER_DM_PROXIMITY_RANGING_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_WIFI_NETWORK_MANAGEMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_THREAD_NETWORK_DIRECTORY_CLUSTER_CLIENT_ENDPOINT_COUNT (0) diff --git a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h index 57fa1635060efb..109d7b03333fb6 100644 --- a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h +++ b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h @@ -128,6 +128,7 @@ #define MATTER_DM_RADON_CONCENTRATION_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_SOIL_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_AMBIENT_CONTEXT_SENSING_CLUSTER_SERVER_ENDPOINT_COUNT (0) +#define MATTER_DM_PROXIMITY_RANGING_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_WIFI_NETWORK_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_THREAD_NETWORK_DIRECTORY_CLUSTER_SERVER_ENDPOINT_COUNT (0) @@ -272,6 +273,7 @@ #define MATTER_DM_RADON_CONCENTRATION_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_SOIL_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_AMBIENT_CONTEXT_SENSING_CLUSTER_CLIENT_ENDPOINT_COUNT (0) +#define MATTER_DM_PROXIMITY_RANGING_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_WIFI_NETWORK_MANAGEMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_THREAD_NETWORK_DIRECTORY_CLUSTER_CLIENT_ENDPOINT_COUNT (0) diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 9def8f5249c25d..7094ebf9a66292 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -8838,6 +8838,167 @@ provisional cluster AmbientContextSensing = 1073 { readonly attribute int16u clusterRevision = 65533; } +/** This cluster enables the configuration of proximity ranging sessions and reporting of proximity ranging data. */ +provisional cluster ProximityRanging = 1075 { + revision 1; + + enum RangingRoleEnum : enum8 { + kWiFiSubscriberRole = 0; + kWiFiPublisherRole = 1; + kBLEScanningRole = 2; + kBLEBeaconRole = 3; + kBLTInitiatorRole = 4; + kBLTReflectorRole = 5; + } + + enum RangingSecurityEnum : enum8 { + kSecureRanging = 0; + kOpenRanging = 1; + } + + enum RangingTechEnum : enum8 { + kBluetoothChannelSounding = 0; + kWiFiRoundTripTimeRanging = 1; + kWiFiNextGenerationRanging = 2; + kBLEBeaconRSSIRanging = 3; + } + + enum ResultCodeEnum : enum8 { + kAccepted = 0; + kRejectedInfeasibleRanging = 1; + kRejectedInfeasibleRangingTriggers = 2; + kBusySessionCapacityReached = 3; + kBusyTryAgainLater = 4; + } + + bitmap Feature : bitmap32 { + kWiFiUSDProximityDetection = 0x1 [spec_name = "Wi-Fi USD Proximity Detection"]; + kBluetoothChannelSounding = 0x2; + kBLEBeaconRSSI = 0x4 [spec_name = "BLE Beacon RSSI"]; + kUWBRanging = 0x8 [spec_name = "UWB Ranging"]; + } + + bitmap RadioBandBitmap : bitmap16 { + k2G4 = 0x1 [spec_name = "2G4"]; + k3G65 = 0x2 [spec_name = "3G65"]; + k5G = 0x4 [spec_name = "5G"]; + k6G = 0x8 [spec_name = "6G"]; + k60G = 0x10 [spec_name = "60G"]; + k1G = 0x20 [spec_name = "1G"]; + k45G = 0x40 [spec_name = "45G"]; + } + + bitmap RangingBandwidthBitmap : bitmap32 { + k1MHz = 0x1; + k2MHz = 0x2; + k4MHz = 0x4; + k8MHz = 0x8; + k16MHz = 0x10; + k20MHz = 0x20; + k40MHz = 0x40; + k80MHz = 0x80; + k160MHz = 0x100; + k320MHz = 0x200; + } + + struct RDRStruct { + int16u azimuth = 0; + int16s elevation = 1; + int8u azimuthAccuracy = 2; + int8u elevationAccuracy = 3; + int8u reference = 4; + } + + struct RangingMeasurementDataStruct { + optional octet_string<16> wiFiDevIK = 0; + optional int64u BLEDeviceId = 1; + optional octet_string BLTDevIK = 2; + optional epoch_s timeOfMeasurement = 3; + nullable int16u distance = 4; + optional int16s accuracy = 5; + optional RDRStruct rdr = 6; + optional nullable int8s rssi = 7; + optional nullable int8s txPower = 8; + } + + struct BLERangingDeviceRoleConfigStruct { + RangingRoleEnum role = 0; + int64u peerBLEDeviceID = 1; + } + + struct BLTChannelSoundingDeviceRoleConfigStruct { + RangingRoleEnum role = 0; + octet_string<16> peerBLTDevIK = 1; + optional octet_string<16> ltk = 2; + } + + struct RangingCapabilitiesStruct { + RangingTechEnum technology = 0; + RadioBandBitmap frequencyBand = 1; + boolean periodicRangingSupport = 2; + } + + struct RangingTriggerConditionStruct { + elapsed_s startTime = 0; + optional elapsed_s endTime = 1; + optional elapsed_s rangingInstanceInterval = 2; + } + + struct ReportingConditionStruct { + optional int16u minDistanceCondition = 0; + optional int16u maxDistanceCondition = 1; + optional int16u accuracyCondition = 2; + } + + struct WiFiRangingDeviceRoleConfigStruct { + RangingRoleEnum role = 0; + octet_string<16> peerWiFiDevIK = 1; + optional octet_string<32> pmk = 2; + } + + readonly attribute RangingCapabilitiesStruct rangingCapabilities[] = 0; + readonly attribute optional octet_string<16> wiFiDevIK = 1; + readonly attribute optional int64u BLEDeviceId = 2; + readonly attribute optional octet_string<16> BLTDevIK = 3; + readonly attribute nullable int8u sessionIDs[] = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct StartRangingRequestRequest { + RangingTechEnum technology = 0; + optional WiFiRangingDeviceRoleConfigStruct wiFiRangingDeviceRoleConfig = 1; + optional BLERangingDeviceRoleConfigStruct BLERangingDeviceRoleConfig = 2; + optional BLTChannelSoundingDeviceRoleConfigStruct BLTChannelSoundingDeviceRoleConfig = 3; + optional RadioBandBitmap frequencyBand = 4; + optional RangingBandwidthBitmap bandwidth = 5; + RangingSecurityEnum securityMode = 6; + RangingTriggerConditionStruct trigger = 7; + optional ReportingConditionStruct reportingCondition = 8; + } + + response struct StartRangingResponse = 1 { + ResultCodeEnum resultCode = 0; + nullable int8u sessionID = 1; + } + + request struct StopRangingRequestRequest { + int8u sessionID = 0; + } + + response struct RangingResult = 3 { + int8u sessionID = 0; + RangingMeasurementDataStruct rangingResultData = 1; + } + + /** This command allows the client to request the start of a ranging session. */ + command StartRangingRequest(StartRangingRequestRequest): StartRangingResponse = 0; + /** Upon receipt of a StopRangingRequest command that contains a SessionID that matches an active ranging session, the server SHALL terminate the corresponding ranging session. */ + command StopRangingRequest(StopRangingRequestRequest): DefaultSuccess = 2; +} + /** Functionality to retrieve operational information about a managed Wi-Fi network. */ cluster WiFiNetworkManagement = 1105 { revision 1; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 1465d68a0e03e4..72e05a94b5a82f 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -52678,6 +52678,404 @@ public void onSuccess(byte[] tlv) { } } + public static class ProximityRangingCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1075L; + + private static final long RANGING_CAPABILITIES_ATTRIBUTE_ID = 0L; + private static final long WI_FI_DEV_IK_ATTRIBUTE_ID = 1L; + private static final long BLE_DEVICE_ID_ATTRIBUTE_ID = 2L; + private static final long BLT_DEV_IK_ATTRIBUTE_ID = 3L; + private static final long SESSION_I_DS_ATTRIBUTE_ID = 4L; + private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; + private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; + private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L; + private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; + private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; + + public ProximityRangingCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId, CLUSTER_ID); + } + + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; + } + + public void startRangingRequest(StartRangingResponseCallback callback, Integer technology, Optional wiFiRangingDeviceRoleConfig, Optional BLERangingDeviceRoleConfig, Optional BLTChannelSoundingDeviceRoleConfig, Optional frequencyBand, Optional bandwidth, Integer securityMode, ChipStructs.ProximityRangingClusterRangingTriggerConditionStruct trigger, Optional reportingCondition) { + startRangingRequest(callback, technology, wiFiRangingDeviceRoleConfig, BLERangingDeviceRoleConfig, BLTChannelSoundingDeviceRoleConfig, frequencyBand, bandwidth, securityMode, trigger, reportingCondition, 0); + } + + public void startRangingRequest(StartRangingResponseCallback callback, Integer technology, Optional wiFiRangingDeviceRoleConfig, Optional BLERangingDeviceRoleConfig, Optional BLTChannelSoundingDeviceRoleConfig, Optional frequencyBand, Optional bandwidth, Integer securityMode, ChipStructs.ProximityRangingClusterRangingTriggerConditionStruct trigger, Optional reportingCondition, int timedInvokeTimeoutMs) { + final long commandId = 0L; + + ArrayList elements = new ArrayList<>(); + final long technologyFieldID = 0L; + BaseTLVType technologytlvValue = new UIntType(technology); + elements.add(new StructElement(technologyFieldID, technologytlvValue)); + + final long wiFiRangingDeviceRoleConfigFieldID = 1L; + BaseTLVType wiFiRangingDeviceRoleConfigtlvValue = wiFiRangingDeviceRoleConfig.map((nonOptionalwiFiRangingDeviceRoleConfig) -> nonOptionalwiFiRangingDeviceRoleConfig.encodeTlv()).orElse(new EmptyType()); + elements.add(new StructElement(wiFiRangingDeviceRoleConfigFieldID, wiFiRangingDeviceRoleConfigtlvValue)); + + final long BLERangingDeviceRoleConfigFieldID = 2L; + BaseTLVType BLERangingDeviceRoleConfigtlvValue = BLERangingDeviceRoleConfig.map((nonOptionalBLERangingDeviceRoleConfig) -> nonOptionalBLERangingDeviceRoleConfig.encodeTlv()).orElse(new EmptyType()); + elements.add(new StructElement(BLERangingDeviceRoleConfigFieldID, BLERangingDeviceRoleConfigtlvValue)); + + final long BLTChannelSoundingDeviceRoleConfigFieldID = 3L; + BaseTLVType BLTChannelSoundingDeviceRoleConfigtlvValue = BLTChannelSoundingDeviceRoleConfig.map((nonOptionalBLTChannelSoundingDeviceRoleConfig) -> nonOptionalBLTChannelSoundingDeviceRoleConfig.encodeTlv()).orElse(new EmptyType()); + elements.add(new StructElement(BLTChannelSoundingDeviceRoleConfigFieldID, BLTChannelSoundingDeviceRoleConfigtlvValue)); + + final long frequencyBandFieldID = 4L; + BaseTLVType frequencyBandtlvValue = frequencyBand.map((nonOptionalfrequencyBand) -> new UIntType(nonOptionalfrequencyBand)).orElse(new EmptyType()); + elements.add(new StructElement(frequencyBandFieldID, frequencyBandtlvValue)); + + final long bandwidthFieldID = 5L; + BaseTLVType bandwidthtlvValue = bandwidth.map((nonOptionalbandwidth) -> new UIntType(nonOptionalbandwidth)).orElse(new EmptyType()); + elements.add(new StructElement(bandwidthFieldID, bandwidthtlvValue)); + + final long securityModeFieldID = 6L; + BaseTLVType securityModetlvValue = new UIntType(securityMode); + elements.add(new StructElement(securityModeFieldID, securityModetlvValue)); + + final long triggerFieldID = 7L; + BaseTLVType triggertlvValue = trigger.encodeTlv(); + elements.add(new StructElement(triggerFieldID, triggertlvValue)); + + final long reportingConditionFieldID = 8L; + BaseTLVType reportingConditiontlvValue = reportingCondition.map((nonOptionalreportingCondition) -> nonOptionalreportingCondition.encodeTlv()).orElse(new EmptyType()); + elements.add(new StructElement(reportingConditionFieldID, reportingConditiontlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + final long resultCodeFieldID = 0L; + Integer resultCode = null; + final long sessionIDFieldID = 1L; + @Nullable Integer sessionID = null; + for (StructElement element: invokeStructValue.value()) { + if (element.contextTagNum() == resultCodeFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + resultCode = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == sessionIDFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + sessionID = castingValue.value(Integer.class); + } + } + } + callback.onSuccess(resultCode, sessionID); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void stopRangingRequest(DefaultClusterCallback callback, Integer sessionID) { + stopRangingRequest(callback, sessionID, 0); + } + + public void stopRangingRequest(DefaultClusterCallback callback, Integer sessionID, int timedInvokeTimeoutMs) { + final long commandId = 2L; + + ArrayList elements = new ArrayList<>(); + final long sessionIDFieldID = 0L; + BaseTLVType sessionIDtlvValue = new UIntType(sessionID); + elements.add(new StructElement(sessionIDFieldID, sessionIDtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public interface StartRangingResponseCallback extends BaseClusterCallback { + void onSuccess(Integer resultCode, @Nullable Integer sessionID); + } + + public interface RangingCapabilitiesAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface SessionIDsAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable List value); + } + + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AttributeListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public void readRangingCapabilitiesAttribute( + RangingCapabilitiesAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RANGING_CAPABILITIES_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, RANGING_CAPABILITIES_ATTRIBUTE_ID, true); + } + + public void subscribeRangingCapabilitiesAttribute( + RangingCapabilitiesAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RANGING_CAPABILITIES_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, RANGING_CAPABILITIES_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readWiFiDevIKAttribute( + OctetStringAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, WI_FI_DEV_IK_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, WI_FI_DEV_IK_ATTRIBUTE_ID, true); + } + + public void subscribeWiFiDevIKAttribute( + OctetStringAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, WI_FI_DEV_IK_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, WI_FI_DEV_IK_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readBLEDeviceIdAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BLE_DEVICE_ID_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, BLE_DEVICE_ID_ATTRIBUTE_ID, true); + } + + public void subscribeBLEDeviceIdAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BLE_DEVICE_ID_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, BLE_DEVICE_ID_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readBLTDevIKAttribute( + OctetStringAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BLT_DEV_IK_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, BLT_DEV_IK_ATTRIBUTE_ID, true); + } + + public void subscribeBLTDevIKAttribute( + OctetStringAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BLT_DEV_IK_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, BLT_DEV_IK_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readSessionIDsAttribute( + SessionIDsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_I_DS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, SESSION_I_DS_ATTRIBUTE_ID, true); + } + + public void subscribeSessionIDsAttribute( + SessionIDsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_I_DS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, SESSION_I_DS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAttributeListAttribute( + AttributeListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readFeatureMapAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, true); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readClusterRevisionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, true); + } + + public void subscribeClusterRevisionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); + } + } + public static class WiFiNetworkManagementCluster extends BaseChipCluster { public static final long CLUSTER_ID = 1105L; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 3378fd8f7d25b2..2d9dfb4c02c313 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -12128,6 +12128,719 @@ public String toString() { return output.toString(); } } +public static class ProximityRangingClusterRDRStruct { + public Integer azimuth; + public Integer elevation; + public Integer azimuthAccuracy; + public Integer elevationAccuracy; + public Integer reference; + private static final long AZIMUTH_ID = 0L; + private static final long ELEVATION_ID = 1L; + private static final long AZIMUTH_ACCURACY_ID = 2L; + private static final long ELEVATION_ACCURACY_ID = 3L; + private static final long REFERENCE_ID = 4L; + + public ProximityRangingClusterRDRStruct( + Integer azimuth, + Integer elevation, + Integer azimuthAccuracy, + Integer elevationAccuracy, + Integer reference + ) { + this.azimuth = azimuth; + this.elevation = elevation; + this.azimuthAccuracy = azimuthAccuracy; + this.elevationAccuracy = elevationAccuracy; + this.reference = reference; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(AZIMUTH_ID, new UIntType(azimuth))); + values.add(new StructElement(ELEVATION_ID, new IntType(elevation))); + values.add(new StructElement(AZIMUTH_ACCURACY_ID, new UIntType(azimuthAccuracy))); + values.add(new StructElement(ELEVATION_ACCURACY_ID, new UIntType(elevationAccuracy))); + values.add(new StructElement(REFERENCE_ID, new UIntType(reference))); + + return new StructType(values); + } + + public static ProximityRangingClusterRDRStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer azimuth = null; + Integer elevation = null; + Integer azimuthAccuracy = null; + Integer elevationAccuracy = null; + Integer reference = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == AZIMUTH_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + azimuth = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == ELEVATION_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + elevation = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == AZIMUTH_ACCURACY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + azimuthAccuracy = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == ELEVATION_ACCURACY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + elevationAccuracy = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == REFERENCE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + reference = castingValue.value(Integer.class); + } + } + } + return new ProximityRangingClusterRDRStruct( + azimuth, + elevation, + azimuthAccuracy, + elevationAccuracy, + reference + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ProximityRangingClusterRDRStruct {\n"); + output.append("\tazimuth: "); + output.append(azimuth); + output.append("\n"); + output.append("\televation: "); + output.append(elevation); + output.append("\n"); + output.append("\tazimuthAccuracy: "); + output.append(azimuthAccuracy); + output.append("\n"); + output.append("\televationAccuracy: "); + output.append(elevationAccuracy); + output.append("\n"); + output.append("\treference: "); + output.append(reference); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ProximityRangingClusterRangingMeasurementDataStruct { + public Optional wiFiDevIK; + public Optional BLEDeviceId; + public Optional BLTDevIK; + public Optional timeOfMeasurement; + public @Nullable Integer distance; + public Optional accuracy; + public Optional rdr; + public @Nullable Optional rssi; + public @Nullable Optional txPower; + private static final long WI_FI_DEV_IK_ID = 0L; + private static final long BLE_DEVICE_ID_ID = 1L; + private static final long BLT_DEV_IK_ID = 2L; + private static final long TIME_OF_MEASUREMENT_ID = 3L; + private static final long DISTANCE_ID = 4L; + private static final long ACCURACY_ID = 5L; + private static final long RDR_ID = 6L; + private static final long RSSI_ID = 7L; + private static final long TX_POWER_ID = 8L; + + public ProximityRangingClusterRangingMeasurementDataStruct( + Optional wiFiDevIK, + Optional BLEDeviceId, + Optional BLTDevIK, + Optional timeOfMeasurement, + @Nullable Integer distance, + Optional accuracy, + Optional rdr, + @Nullable Optional rssi, + @Nullable Optional txPower + ) { + this.wiFiDevIK = wiFiDevIK; + this.BLEDeviceId = BLEDeviceId; + this.BLTDevIK = BLTDevIK; + this.timeOfMeasurement = timeOfMeasurement; + this.distance = distance; + this.accuracy = accuracy; + this.rdr = rdr; + this.rssi = rssi; + this.txPower = txPower; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(WI_FI_DEV_IK_ID, wiFiDevIK.map((nonOptionalwiFiDevIK) -> new ByteArrayType(nonOptionalwiFiDevIK)).orElse(new EmptyType()))); + values.add(new StructElement(BLE_DEVICE_ID_ID, BLEDeviceId.map((nonOptionalBLEDeviceId) -> new UIntType(nonOptionalBLEDeviceId)).orElse(new EmptyType()))); + values.add(new StructElement(BLT_DEV_IK_ID, BLTDevIK.map((nonOptionalBLTDevIK) -> new ByteArrayType(nonOptionalBLTDevIK)).orElse(new EmptyType()))); + values.add(new StructElement(TIME_OF_MEASUREMENT_ID, timeOfMeasurement.map((nonOptionaltimeOfMeasurement) -> new UIntType(nonOptionaltimeOfMeasurement)).orElse(new EmptyType()))); + values.add(new StructElement(DISTANCE_ID, distance != null ? new UIntType(distance) : new NullType())); + values.add(new StructElement(ACCURACY_ID, accuracy.map((nonOptionalaccuracy) -> new IntType(nonOptionalaccuracy)).orElse(new EmptyType()))); + values.add(new StructElement(RDR_ID, rdr.map((nonOptionalrdr) -> nonOptionalrdr.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(RSSI_ID, rssi != null ? rssi.map((nonOptionalrssi) -> new IntType(nonOptionalrssi)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(TX_POWER_ID, txPower != null ? txPower.map((nonOptionaltxPower) -> new IntType(nonOptionaltxPower)).orElse(new EmptyType()) : new NullType())); + + return new StructType(values); + } + + public static ProximityRangingClusterRangingMeasurementDataStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Optional wiFiDevIK = Optional.empty(); + Optional BLEDeviceId = Optional.empty(); + Optional BLTDevIK = Optional.empty(); + Optional timeOfMeasurement = Optional.empty(); + @Nullable Integer distance = null; + Optional accuracy = Optional.empty(); + Optional rdr = Optional.empty(); + @Nullable Optional rssi = null; + @Nullable Optional txPower = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == WI_FI_DEV_IK_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + wiFiDevIK = Optional.of(castingValue.value(byte[].class)); + } + } else if (element.contextTagNum() == BLE_DEVICE_ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + BLEDeviceId = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == BLT_DEV_IK_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + BLTDevIK = Optional.of(castingValue.value(byte[].class)); + } + } else if (element.contextTagNum() == TIME_OF_MEASUREMENT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + timeOfMeasurement = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == DISTANCE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + distance = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == ACCURACY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + accuracy = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == RDR_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + rdr = Optional.of(ChipStructs.ProximityRangingClusterRDRStruct.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == RSSI_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + rssi = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == TX_POWER_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + txPower = Optional.of(castingValue.value(Integer.class)); + } + } + } + return new ProximityRangingClusterRangingMeasurementDataStruct( + wiFiDevIK, + BLEDeviceId, + BLTDevIK, + timeOfMeasurement, + distance, + accuracy, + rdr, + rssi, + txPower + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ProximityRangingClusterRangingMeasurementDataStruct {\n"); + output.append("\twiFiDevIK: "); + output.append(wiFiDevIK.isPresent() ? Arrays.toString(wiFiDevIK.get()) : ""); + output.append("\n"); + output.append("\tBLEDeviceId: "); + output.append(BLEDeviceId); + output.append("\n"); + output.append("\tBLTDevIK: "); + output.append(BLTDevIK.isPresent() ? Arrays.toString(BLTDevIK.get()) : ""); + output.append("\n"); + output.append("\ttimeOfMeasurement: "); + output.append(timeOfMeasurement); + output.append("\n"); + output.append("\tdistance: "); + output.append(distance); + output.append("\n"); + output.append("\taccuracy: "); + output.append(accuracy); + output.append("\n"); + output.append("\trdr: "); + output.append(rdr); + output.append("\n"); + output.append("\trssi: "); + output.append(rssi); + output.append("\n"); + output.append("\ttxPower: "); + output.append(txPower); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ProximityRangingClusterBLERangingDeviceRoleConfigStruct { + public Integer role; + public Long peerBLEDeviceID; + private static final long ROLE_ID = 0L; + private static final long PEER_BLE_DEVICE_ID_ID = 1L; + + public ProximityRangingClusterBLERangingDeviceRoleConfigStruct( + Integer role, + Long peerBLEDeviceID + ) { + this.role = role; + this.peerBLEDeviceID = peerBLEDeviceID; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ROLE_ID, new UIntType(role))); + values.add(new StructElement(PEER_BLE_DEVICE_ID_ID, new UIntType(peerBLEDeviceID))); + + return new StructType(values); + } + + public static ProximityRangingClusterBLERangingDeviceRoleConfigStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer role = null; + Long peerBLEDeviceID = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ROLE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + role = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == PEER_BLE_DEVICE_ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + peerBLEDeviceID = castingValue.value(Long.class); + } + } + } + return new ProximityRangingClusterBLERangingDeviceRoleConfigStruct( + role, + peerBLEDeviceID + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ProximityRangingClusterBLERangingDeviceRoleConfigStruct {\n"); + output.append("\trole: "); + output.append(role); + output.append("\n"); + output.append("\tpeerBLEDeviceID: "); + output.append(peerBLEDeviceID); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct { + public Integer role; + public byte[] peerBLTDevIK; + public Optional ltk; + private static final long ROLE_ID = 0L; + private static final long PEER_BLT_DEV_IK_ID = 1L; + private static final long LTK_ID = 2L; + + public ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( + Integer role, + byte[] peerBLTDevIK, + Optional ltk + ) { + this.role = role; + this.peerBLTDevIK = peerBLTDevIK; + this.ltk = ltk; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ROLE_ID, new UIntType(role))); + values.add(new StructElement(PEER_BLT_DEV_IK_ID, new ByteArrayType(peerBLTDevIK))); + values.add(new StructElement(LTK_ID, ltk.map((nonOptionalltk) -> new ByteArrayType(nonOptionalltk)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer role = null; + byte[] peerBLTDevIK = null; + Optional ltk = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ROLE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + role = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == PEER_BLT_DEV_IK_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + peerBLTDevIK = castingValue.value(byte[].class); + } + } else if (element.contextTagNum() == LTK_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + ltk = Optional.of(castingValue.value(byte[].class)); + } + } + } + return new ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( + role, + peerBLTDevIK, + ltk + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct {\n"); + output.append("\trole: "); + output.append(role); + output.append("\n"); + output.append("\tpeerBLTDevIK: "); + output.append(Arrays.toString(peerBLTDevIK)); + output.append("\n"); + output.append("\tltk: "); + output.append(ltk.isPresent() ? Arrays.toString(ltk.get()) : ""); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ProximityRangingClusterRangingCapabilitiesStruct { + public Integer technology; + public Integer frequencyBand; + public Boolean periodicRangingSupport; + private static final long TECHNOLOGY_ID = 0L; + private static final long FREQUENCY_BAND_ID = 1L; + private static final long PERIODIC_RANGING_SUPPORT_ID = 2L; + + public ProximityRangingClusterRangingCapabilitiesStruct( + Integer technology, + Integer frequencyBand, + Boolean periodicRangingSupport + ) { + this.technology = technology; + this.frequencyBand = frequencyBand; + this.periodicRangingSupport = periodicRangingSupport; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(TECHNOLOGY_ID, new UIntType(technology))); + values.add(new StructElement(FREQUENCY_BAND_ID, new UIntType(frequencyBand))); + values.add(new StructElement(PERIODIC_RANGING_SUPPORT_ID, new BooleanType(periodicRangingSupport))); + + return new StructType(values); + } + + public static ProximityRangingClusterRangingCapabilitiesStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer technology = null; + Integer frequencyBand = null; + Boolean periodicRangingSupport = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == TECHNOLOGY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + technology = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == FREQUENCY_BAND_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + frequencyBand = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == PERIODIC_RANGING_SUPPORT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Boolean) { + BooleanType castingValue = element.value(BooleanType.class); + periodicRangingSupport = castingValue.value(Boolean.class); + } + } + } + return new ProximityRangingClusterRangingCapabilitiesStruct( + technology, + frequencyBand, + periodicRangingSupport + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ProximityRangingClusterRangingCapabilitiesStruct {\n"); + output.append("\ttechnology: "); + output.append(technology); + output.append("\n"); + output.append("\tfrequencyBand: "); + output.append(frequencyBand); + output.append("\n"); + output.append("\tperiodicRangingSupport: "); + output.append(periodicRangingSupport); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ProximityRangingClusterRangingTriggerConditionStruct { + public Long startTime; + public Optional endTime; + public Optional rangingInstanceInterval; + private static final long START_TIME_ID = 0L; + private static final long END_TIME_ID = 1L; + private static final long RANGING_INSTANCE_INTERVAL_ID = 2L; + + public ProximityRangingClusterRangingTriggerConditionStruct( + Long startTime, + Optional endTime, + Optional rangingInstanceInterval + ) { + this.startTime = startTime; + this.endTime = endTime; + this.rangingInstanceInterval = rangingInstanceInterval; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(START_TIME_ID, new UIntType(startTime))); + values.add(new StructElement(END_TIME_ID, endTime.map((nonOptionalendTime) -> new UIntType(nonOptionalendTime)).orElse(new EmptyType()))); + values.add(new StructElement(RANGING_INSTANCE_INTERVAL_ID, rangingInstanceInterval.map((nonOptionalrangingInstanceInterval) -> new UIntType(nonOptionalrangingInstanceInterval)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static ProximityRangingClusterRangingTriggerConditionStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long startTime = null; + Optional endTime = Optional.empty(); + Optional rangingInstanceInterval = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == START_TIME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + startTime = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == END_TIME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + endTime = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == RANGING_INSTANCE_INTERVAL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + rangingInstanceInterval = Optional.of(castingValue.value(Long.class)); + } + } + } + return new ProximityRangingClusterRangingTriggerConditionStruct( + startTime, + endTime, + rangingInstanceInterval + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ProximityRangingClusterRangingTriggerConditionStruct {\n"); + output.append("\tstartTime: "); + output.append(startTime); + output.append("\n"); + output.append("\tendTime: "); + output.append(endTime); + output.append("\n"); + output.append("\trangingInstanceInterval: "); + output.append(rangingInstanceInterval); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ProximityRangingClusterReportingConditionStruct { + public Optional minDistanceCondition; + public Optional maxDistanceCondition; + public Optional accuracyCondition; + private static final long MIN_DISTANCE_CONDITION_ID = 0L; + private static final long MAX_DISTANCE_CONDITION_ID = 1L; + private static final long ACCURACY_CONDITION_ID = 2L; + + public ProximityRangingClusterReportingConditionStruct( + Optional minDistanceCondition, + Optional maxDistanceCondition, + Optional accuracyCondition + ) { + this.minDistanceCondition = minDistanceCondition; + this.maxDistanceCondition = maxDistanceCondition; + this.accuracyCondition = accuracyCondition; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(MIN_DISTANCE_CONDITION_ID, minDistanceCondition.map((nonOptionalminDistanceCondition) -> new UIntType(nonOptionalminDistanceCondition)).orElse(new EmptyType()))); + values.add(new StructElement(MAX_DISTANCE_CONDITION_ID, maxDistanceCondition.map((nonOptionalmaxDistanceCondition) -> new UIntType(nonOptionalmaxDistanceCondition)).orElse(new EmptyType()))); + values.add(new StructElement(ACCURACY_CONDITION_ID, accuracyCondition.map((nonOptionalaccuracyCondition) -> new UIntType(nonOptionalaccuracyCondition)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static ProximityRangingClusterReportingConditionStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Optional minDistanceCondition = Optional.empty(); + Optional maxDistanceCondition = Optional.empty(); + Optional accuracyCondition = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == MIN_DISTANCE_CONDITION_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + minDistanceCondition = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == MAX_DISTANCE_CONDITION_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + maxDistanceCondition = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == ACCURACY_CONDITION_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + accuracyCondition = Optional.of(castingValue.value(Integer.class)); + } + } + } + return new ProximityRangingClusterReportingConditionStruct( + minDistanceCondition, + maxDistanceCondition, + accuracyCondition + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ProximityRangingClusterReportingConditionStruct {\n"); + output.append("\tminDistanceCondition: "); + output.append(minDistanceCondition); + output.append("\n"); + output.append("\tmaxDistanceCondition: "); + output.append(maxDistanceCondition); + output.append("\n"); + output.append("\taccuracyCondition: "); + output.append(accuracyCondition); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct { + public Integer role; + public byte[] peerWiFiDevIK; + public Optional pmk; + private static final long ROLE_ID = 0L; + private static final long PEER_WI_FI_DEV_IK_ID = 1L; + private static final long PMK_ID = 2L; + + public ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct( + Integer role, + byte[] peerWiFiDevIK, + Optional pmk + ) { + this.role = role; + this.peerWiFiDevIK = peerWiFiDevIK; + this.pmk = pmk; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ROLE_ID, new UIntType(role))); + values.add(new StructElement(PEER_WI_FI_DEV_IK_ID, new ByteArrayType(peerWiFiDevIK))); + values.add(new StructElement(PMK_ID, pmk.map((nonOptionalpmk) -> new ByteArrayType(nonOptionalpmk)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer role = null; + byte[] peerWiFiDevIK = null; + Optional pmk = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ROLE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + role = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == PEER_WI_FI_DEV_IK_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + peerWiFiDevIK = castingValue.value(byte[].class); + } + } else if (element.contextTagNum() == PMK_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + pmk = Optional.of(castingValue.value(byte[].class)); + } + } + } + return new ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct( + role, + peerWiFiDevIK, + pmk + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct {\n"); + output.append("\trole: "); + output.append(role); + output.append("\n"); + output.append("\tpeerWiFiDevIK: "); + output.append(Arrays.toString(peerWiFiDevIK)); + output.append("\n"); + output.append("\tpmk: "); + output.append(pmk.isPresent() ? Arrays.toString(pmk.get()) : ""); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class ThreadNetworkDirectoryClusterThreadNetworkStruct { public byte[] extendedPanID; public String networkName; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 0fa3c7fc5497f8..3d8b40edcc8ae1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -349,6 +349,9 @@ public static BaseCluster getCluster(long clusterId) { if (clusterId == AmbientContextSensing.ID) { return new AmbientContextSensing(); } + if (clusterId == ProximityRanging.ID) { + return new ProximityRanging(); + } if (clusterId == WiFiNetworkManagement.ID) { return new WiFiNetworkManagement(); } @@ -15321,6 +15324,146 @@ public long getCommandID(String name) throws IllegalArgumentException { return Command.valueOf(name).getID(); } } + public static class ProximityRanging implements BaseCluster { + public static final long ID = 1075L; + public long getID() { + return ID; + } + + public enum Attribute { + RangingCapabilities(0L), + WiFiDevIK(1L), + BLEDeviceId(2L), + BLTDevIK(3L), + SessionIDs(4L), + GeneratedCommandList(65528L), + AcceptedCommandList(65529L), + AttributeList(65531L), + FeatureMap(65532L), + ClusterRevision(65533L),; + private final long id; + Attribute(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Attribute value(long id) throws NoSuchFieldError { + for (Attribute attribute : Attribute.values()) { + if (attribute.getID() == id) { + return attribute; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Event {; + private final long id; + Event(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Event value(long id) throws NoSuchFieldError { + for (Event event : Event.values()) { + if (event.getID() == id) { + return event; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Command { + StartRangingRequest(0L), + StopRangingRequest(2L),; + private final long id; + Command(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Command value(long id) throws NoSuchFieldError { + for (Command command : Command.values()) { + if (command.getID() == id) { + return command; + } + } + throw new NoSuchFieldError(); + } + }public enum StartRangingRequestCommandField {Technology(0),WiFiRangingDeviceRoleConfig(1),BLERangingDeviceRoleConfig(2),BLTChannelSoundingDeviceRoleConfig(3),FrequencyBand(4),Bandwidth(5),SecurityMode(6),Trigger(7),ReportingCondition(8),; + private final int id; + StartRangingRequestCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static StartRangingRequestCommandField value(int id) throws NoSuchFieldError { + for (StartRangingRequestCommandField field : StartRangingRequestCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }public enum StopRangingRequestCommandField {SessionID(0),; + private final int id; + StopRangingRequestCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static StopRangingRequestCommandField value(int id) throws NoSuchFieldError { + for (StopRangingRequestCommandField field : StopRangingRequestCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }@Override + public String getAttributeName(long id) throws NoSuchFieldError { + return Attribute.value(id).toString(); + } + + @Override + public String getEventName(long id) throws NoSuchFieldError { + return Event.value(id).toString(); + } + + @Override + public String getCommandName(long id) throws NoSuchFieldError { + return Command.value(id).toString(); + } + + @Override + public long getAttributeID(String name) throws IllegalArgumentException { + return Attribute.valueOf(name).getID(); + } + + @Override + public long getEventID(String name) throws IllegalArgumentException { + return Event.valueOf(name).getID(); + } + + @Override + public long getCommandID(String name) throws IllegalArgumentException { + return Command.valueOf(name).getID(); + } + } public static class WiFiNetworkManagement implements BaseCluster { public static final long ID = 1105L; public long getID() { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 015a7ea8f6bb67..3aabc17d0df683 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -16576,6 +16576,135 @@ public void onError(Exception ex) { } + public static class DelegatedProximityRangingClusterStartRangingResponseCallback implements ChipClusters.ProximityRangingCluster.StartRangingResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer resultCode, @Nullable Integer sessionID) { + Map responseValues = new LinkedHashMap<>(); + + CommandResponseInfo resultCodeResponseValue = new CommandResponseInfo("resultCode", "Integer"); + responseValues.put(resultCodeResponseValue, resultCode); + CommandResponseInfo sessionIDResponseValue = new CommandResponseInfo("sessionID", "Integer"); + responseValues.put(sessionIDResponseValue, sessionID); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedProximityRangingClusterRangingCapabilitiesAttributeCallback implements ChipClusters.ProximityRangingCluster.RangingCapabilitiesAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedProximityRangingClusterSessionIDsAttributeCallback implements ChipClusters.ProximityRangingCluster.SessionIDsAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedProximityRangingClusterGeneratedCommandListAttributeCallback implements ChipClusters.ProximityRangingCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedProximityRangingClusterAcceptedCommandListAttributeCallback implements ChipClusters.ProximityRangingCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedProximityRangingClusterAttributeListAttributeCallback implements ChipClusters.ProximityRangingCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedWiFiNetworkManagementClusterNetworkPassphraseResponseCallback implements ChipClusters.WiFiNetworkManagementCluster.NetworkPassphraseResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -23548,6 +23677,10 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.AmbientContextSensingCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("ambientContextSensing", ambientContextSensingClusterInfo); + ClusterInfo proximityRangingClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.ProximityRangingCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("proximityRanging", proximityRangingClusterInfo); + ClusterInfo wiFiNetworkManagementClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.WiFiNetworkManagementCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("wiFiNetworkManagement", wiFiNetworkManagementClusterInfo); @@ -23803,6 +23936,7 @@ public void combineCommand(Map destination, Map> getCommandMap() { commandMap.put("ambientContextSensing", ambientContextSensingClusterInteractionInfoMap); + Map proximityRangingClusterInteractionInfoMap = new LinkedHashMap<>(); + + Map proximityRangingstartRangingRequestCommandParams = new LinkedHashMap(); + + CommandParameterInfo proximityRangingstartRangingRequesttechnologyCommandParameterInfo = new CommandParameterInfo("technology", Integer.class, Integer.class); + proximityRangingstartRangingRequestCommandParams.put("technology",proximityRangingstartRangingRequesttechnologyCommandParameterInfo); + + + + + CommandParameterInfo proximityRangingstartRangingRequestfrequencyBandCommandParameterInfo = new CommandParameterInfo("frequencyBand", Optional.class, Integer.class); + proximityRangingstartRangingRequestCommandParams.put("frequencyBand",proximityRangingstartRangingRequestfrequencyBandCommandParameterInfo); + + CommandParameterInfo proximityRangingstartRangingRequestbandwidthCommandParameterInfo = new CommandParameterInfo("bandwidth", Optional.class, Long.class); + proximityRangingstartRangingRequestCommandParams.put("bandwidth",proximityRangingstartRangingRequestbandwidthCommandParameterInfo); + + CommandParameterInfo proximityRangingstartRangingRequestsecurityModeCommandParameterInfo = new CommandParameterInfo("securityMode", Integer.class, Integer.class); + proximityRangingstartRangingRequestCommandParams.put("securityMode",proximityRangingstartRangingRequestsecurityModeCommandParameterInfo); + + + InteractionInfo proximityRangingstartRangingRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster) + .startRangingRequest((ChipClusters.ProximityRangingCluster.StartRangingResponseCallback) callback + , (Integer) + commandArguments.get("technology") + + , (Optional) + commandArguments.get("wiFiRangingDeviceRoleConfig") + + , (Optional) + commandArguments.get("BLERangingDeviceRoleConfig") + + , (Optional) + commandArguments.get("BLTChannelSoundingDeviceRoleConfig") + + , (Optional) + commandArguments.get("frequencyBand") + + , (Optional) + commandArguments.get("bandwidth") + + , (Integer) + commandArguments.get("securityMode") + + , (ChipStructs.ProximityRangingClusterRangingTriggerConditionStruct) + commandArguments.get("trigger") + + , (Optional) + commandArguments.get("reportingCondition") + + ); + }, + () -> new DelegatedProximityRangingClusterStartRangingResponseCallback(), + proximityRangingstartRangingRequestCommandParams + ); + proximityRangingClusterInteractionInfoMap.put("startRangingRequest", proximityRangingstartRangingRequestInteractionInfo); + + Map proximityRangingstopRangingRequestCommandParams = new LinkedHashMap(); + + CommandParameterInfo proximityRangingstopRangingRequestsessionIDCommandParameterInfo = new CommandParameterInfo("sessionID", Integer.class, Integer.class); + proximityRangingstopRangingRequestCommandParams.put("sessionID",proximityRangingstopRangingRequestsessionIDCommandParameterInfo); + InteractionInfo proximityRangingstopRangingRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster) + .stopRangingRequest((DefaultClusterCallback) callback + , (Integer) + commandArguments.get("sessionID") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + proximityRangingstopRangingRequestCommandParams + ); + proximityRangingClusterInteractionInfoMap.put("stopRangingRequest", proximityRangingstopRangingRequestInteractionInfo); + + commandMap.put("proximityRanging", proximityRangingClusterInteractionInfoMap); + Map wiFiNetworkManagementClusterInteractionInfoMap = new LinkedHashMap<>(); Map wiFiNetworkManagementnetworkPassphraseRequestCommandParams = new LinkedHashMap(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 79c015fde83d12..c6fb6e82ce459d 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -16216,6 +16216,120 @@ private static Map readAmbientContextSensingInteraction return result; } + private static Map readProximityRangingInteractionInfo() { + Map result = new LinkedHashMap<>();Map readProximityRangingRangingCapabilitiesCommandParams = new LinkedHashMap(); + InteractionInfo readProximityRangingRangingCapabilitiesAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster).readRangingCapabilitiesAttribute( + (ChipClusters.ProximityRangingCluster.RangingCapabilitiesAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedProximityRangingClusterRangingCapabilitiesAttributeCallback(), + readProximityRangingRangingCapabilitiesCommandParams + ); + result.put("readRangingCapabilitiesAttribute", readProximityRangingRangingCapabilitiesAttributeInteractionInfo); + Map readProximityRangingWiFiDevIKCommandParams = new LinkedHashMap(); + InteractionInfo readProximityRangingWiFiDevIKAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster).readWiFiDevIKAttribute( + (ChipClusters.OctetStringAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedOctetStringAttributeCallback(), + readProximityRangingWiFiDevIKCommandParams + ); + result.put("readWiFiDevIKAttribute", readProximityRangingWiFiDevIKAttributeInteractionInfo); + Map readProximityRangingBLEDeviceIdCommandParams = new LinkedHashMap(); + InteractionInfo readProximityRangingBLEDeviceIdAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster).readBLEDeviceIdAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readProximityRangingBLEDeviceIdCommandParams + ); + result.put("readBLEDeviceIdAttribute", readProximityRangingBLEDeviceIdAttributeInteractionInfo); + Map readProximityRangingBLTDevIKCommandParams = new LinkedHashMap(); + InteractionInfo readProximityRangingBLTDevIKAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster).readBLTDevIKAttribute( + (ChipClusters.OctetStringAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedOctetStringAttributeCallback(), + readProximityRangingBLTDevIKCommandParams + ); + result.put("readBLTDevIKAttribute", readProximityRangingBLTDevIKAttributeInteractionInfo); + Map readProximityRangingSessionIDsCommandParams = new LinkedHashMap(); + InteractionInfo readProximityRangingSessionIDsAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster).readSessionIDsAttribute( + (ChipClusters.ProximityRangingCluster.SessionIDsAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedProximityRangingClusterSessionIDsAttributeCallback(), + readProximityRangingSessionIDsCommandParams + ); + result.put("readSessionIDsAttribute", readProximityRangingSessionIDsAttributeInteractionInfo); + Map readProximityRangingGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readProximityRangingGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.ProximityRangingCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedProximityRangingClusterGeneratedCommandListAttributeCallback(), + readProximityRangingGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readProximityRangingGeneratedCommandListAttributeInteractionInfo); + Map readProximityRangingAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readProximityRangingAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.ProximityRangingCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedProximityRangingClusterAcceptedCommandListAttributeCallback(), + readProximityRangingAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readProximityRangingAcceptedCommandListAttributeInteractionInfo); + Map readProximityRangingAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readProximityRangingAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster).readAttributeListAttribute( + (ChipClusters.ProximityRangingCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedProximityRangingClusterAttributeListAttributeCallback(), + readProximityRangingAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readProximityRangingAttributeListAttributeInteractionInfo); + Map readProximityRangingFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readProximityRangingFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readProximityRangingFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readProximityRangingFeatureMapAttributeInteractionInfo); + Map readProximityRangingClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readProximityRangingClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ProximityRangingCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readProximityRangingClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readProximityRangingClusterRevisionAttributeInteractionInfo); + + return result; + } private static Map readWiFiNetworkManagementInteractionInfo() { Map result = new LinkedHashMap<>();Map readWiFiNetworkManagementSsidCommandParams = new LinkedHashMap(); InteractionInfo readWiFiNetworkManagementSsidAttributeInteractionInfo = new InteractionInfo( @@ -21080,6 +21194,7 @@ public Map> getReadAttributeMap() { put("radonConcentrationMeasurement", readRadonConcentrationMeasurementInteractionInfo()); put("soilMeasurement", readSoilMeasurementInteractionInfo()); put("ambientContextSensing", readAmbientContextSensingInteractionInfo()); + put("proximityRanging", readProximityRangingInteractionInfo()); put("wiFiNetworkManagement", readWiFiNetworkManagementInteractionInfo()); put("threadBorderRouterManagement", readThreadBorderRouterManagementInteractionInfo()); put("threadNetworkDirectory", readThreadNetworkDirectoryInteractionInfo()); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index 52a8fcf5301e3b..46fe52ac822d8f 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -2924,6 +2924,8 @@ public Map> getWriteAttributeMap() { ); writeAmbientContextSensingInteractionInfo.put("writeHoldTimeAttribute", writeAmbientContextSensingHoldTimeAttributeInteractionInfo); writeAttributeMap.put("ambientContextSensing", writeAmbientContextSensingInteractionInfo); + Map writeProximityRangingInteractionInfo = new LinkedHashMap<>(); + writeAttributeMap.put("proximityRanging", writeProximityRangingInteractionInfo); Map writeWiFiNetworkManagementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("wiFiNetworkManagement", writeWiFiNetworkManagementInteractionInfo); Map writeThreadBorderRouterManagementInteractionInfo = new LinkedHashMap<>(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index 261dde0bb5e7ec..f17fdfcaab705b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -170,6 +170,14 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterBatFaultChangeType.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterWiredFaultChangeType.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerTopologyClusterCircuitNodeStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLERangingDeviceRoleConfigStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingCapabilitiesStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingTriggerConditionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRDRStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PushAvStreamTransportClusterAudioStreamStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PushAvStreamTransportClusterCMAFContainerOptionsStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PushAvStreamTransportClusterContainerOptionsStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLERangingDeviceRoleConfigStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLERangingDeviceRoleConfigStruct.kt new file mode 100644 index 00000000000000..9f5cbb82231df5 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLERangingDeviceRoleConfigStruct.kt @@ -0,0 +1,62 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterBLERangingDeviceRoleConfigStruct( + val role: UInt, + val peerBLEDeviceID: ULong, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterBLERangingDeviceRoleConfigStruct {\n") + append("\trole : $role\n") + append("\tpeerBLEDeviceID : $peerBLEDeviceID\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ROLE), role) + put(ContextSpecificTag(TAG_PEER_BLE_DEVICE_ID), peerBLEDeviceID) + endStructure() + } + } + + companion object { + private const val TAG_ROLE = 0 + private const val TAG_PEER_BLE_DEVICE_ID = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterBLERangingDeviceRoleConfigStruct { + tlvReader.enterStructure(tlvTag) + val role = tlvReader.getUInt(ContextSpecificTag(TAG_ROLE)) + val peerBLEDeviceID = tlvReader.getULong(ContextSpecificTag(TAG_PEER_BLE_DEVICE_ID)) + + tlvReader.exitContainer() + + return ProximityRangingClusterBLERangingDeviceRoleConfigStruct(role, peerBLEDeviceID) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt new file mode 100644 index 00000000000000..1342e0f502a088 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt @@ -0,0 +1,80 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( + val role: UInt, + val peerBLTDevIK: ByteArray, + val ltk: Optional, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct {\n") + append("\trole : $role\n") + append("\tpeerBLTDevIK : $peerBLTDevIK\n") + append("\tltk : $ltk\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ROLE), role) + put(ContextSpecificTag(TAG_PEER_BLT_DEV_IK), peerBLTDevIK) + if (ltk.isPresent) { + val optltk = ltk.get() + put(ContextSpecificTag(TAG_LTK), optltk) + } + endStructure() + } + } + + companion object { + private const val TAG_ROLE = 0 + private const val TAG_PEER_BLT_DEV_IK = 1 + private const val TAG_LTK = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct { + tlvReader.enterStructure(tlvTag) + val role = tlvReader.getUInt(ContextSpecificTag(TAG_ROLE)) + val peerBLTDevIK = tlvReader.getByteArray(ContextSpecificTag(TAG_PEER_BLT_DEV_IK)) + val ltk = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_LTK))) { + Optional.of(tlvReader.getByteArray(ContextSpecificTag(TAG_LTK))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( + role, + peerBLTDevIK, + ltk, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRDRStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRDRStruct.kt new file mode 100644 index 00000000000000..4c45e6151f3565 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRDRStruct.kt @@ -0,0 +1,80 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRDRStruct( + val azimuth: UInt, + val elevation: Int, + val azimuthAccuracy: UInt, + val elevationAccuracy: UInt, + val reference: UInt, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRDRStruct {\n") + append("\tazimuth : $azimuth\n") + append("\televation : $elevation\n") + append("\tazimuthAccuracy : $azimuthAccuracy\n") + append("\televationAccuracy : $elevationAccuracy\n") + append("\treference : $reference\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_AZIMUTH), azimuth) + put(ContextSpecificTag(TAG_ELEVATION), elevation) + put(ContextSpecificTag(TAG_AZIMUTH_ACCURACY), azimuthAccuracy) + put(ContextSpecificTag(TAG_ELEVATION_ACCURACY), elevationAccuracy) + put(ContextSpecificTag(TAG_REFERENCE), reference) + endStructure() + } + } + + companion object { + private const val TAG_AZIMUTH = 0 + private const val TAG_ELEVATION = 1 + private const val TAG_AZIMUTH_ACCURACY = 2 + private const val TAG_ELEVATION_ACCURACY = 3 + private const val TAG_REFERENCE = 4 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ProximityRangingClusterRDRStruct { + tlvReader.enterStructure(tlvTag) + val azimuth = tlvReader.getUInt(ContextSpecificTag(TAG_AZIMUTH)) + val elevation = tlvReader.getInt(ContextSpecificTag(TAG_ELEVATION)) + val azimuthAccuracy = tlvReader.getUInt(ContextSpecificTag(TAG_AZIMUTH_ACCURACY)) + val elevationAccuracy = tlvReader.getUInt(ContextSpecificTag(TAG_ELEVATION_ACCURACY)) + val reference = tlvReader.getUInt(ContextSpecificTag(TAG_REFERENCE)) + + tlvReader.exitContainer() + + return ProximityRangingClusterRDRStruct( + azimuth, + elevation, + azimuthAccuracy, + elevationAccuracy, + reference, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingCapabilitiesStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingCapabilitiesStruct.kt new file mode 100644 index 00000000000000..93a9e96fbe0ceb --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingCapabilitiesStruct.kt @@ -0,0 +1,72 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRangingCapabilitiesStruct( + val technology: UInt, + val frequencyBand: UInt, + val periodicRangingSupport: Boolean, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRangingCapabilitiesStruct {\n") + append("\ttechnology : $technology\n") + append("\tfrequencyBand : $frequencyBand\n") + append("\tperiodicRangingSupport : $periodicRangingSupport\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_TECHNOLOGY), technology) + put(ContextSpecificTag(TAG_FREQUENCY_BAND), frequencyBand) + put(ContextSpecificTag(TAG_PERIODIC_RANGING_SUPPORT), periodicRangingSupport) + endStructure() + } + } + + companion object { + private const val TAG_TECHNOLOGY = 0 + private const val TAG_FREQUENCY_BAND = 1 + private const val TAG_PERIODIC_RANGING_SUPPORT = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterRangingCapabilitiesStruct { + tlvReader.enterStructure(tlvTag) + val technology = tlvReader.getUInt(ContextSpecificTag(TAG_TECHNOLOGY)) + val frequencyBand = tlvReader.getUInt(ContextSpecificTag(TAG_FREQUENCY_BAND)) + val periodicRangingSupport = + tlvReader.getBoolean(ContextSpecificTag(TAG_PERIODIC_RANGING_SUPPORT)) + + tlvReader.exitContainer() + + return ProximityRangingClusterRangingCapabilitiesStruct( + technology, + frequencyBand, + periodicRangingSupport, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt new file mode 100644 index 00000000000000..7727fe9d89d661 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt @@ -0,0 +1,202 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRangingMeasurementDataStruct( + val wiFiDevIK: Optional, + val BLEDeviceId: Optional, + val BLTDevIK: Optional, + val timeOfMeasurement: Optional, + val distance: UInt?, + val accuracy: Optional, + val rdr: Optional, + val rssi: Optional?, + val txPower: Optional?, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRangingMeasurementDataStruct {\n") + append("\twiFiDevIK : $wiFiDevIK\n") + append("\tBLEDeviceId : $BLEDeviceId\n") + append("\tBLTDevIK : $BLTDevIK\n") + append("\ttimeOfMeasurement : $timeOfMeasurement\n") + append("\tdistance : $distance\n") + append("\taccuracy : $accuracy\n") + append("\trdr : $rdr\n") + append("\trssi : $rssi\n") + append("\ttxPower : $txPower\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (wiFiDevIK.isPresent) { + val optwiFiDevIK = wiFiDevIK.get() + put(ContextSpecificTag(TAG_WI_FI_DEV_IK), optwiFiDevIK) + } + if (BLEDeviceId.isPresent) { + val optBLEDeviceId = BLEDeviceId.get() + put(ContextSpecificTag(TAG_BLE_DEVICE_ID), optBLEDeviceId) + } + if (BLTDevIK.isPresent) { + val optBLTDevIK = BLTDevIK.get() + put(ContextSpecificTag(TAG_BLT_DEV_IK), optBLTDevIK) + } + if (timeOfMeasurement.isPresent) { + val opttimeOfMeasurement = timeOfMeasurement.get() + put(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT), opttimeOfMeasurement) + } + if (distance != null) { + put(ContextSpecificTag(TAG_DISTANCE), distance) + } else { + putNull(ContextSpecificTag(TAG_DISTANCE)) + } + if (accuracy.isPresent) { + val optaccuracy = accuracy.get() + put(ContextSpecificTag(TAG_ACCURACY), optaccuracy) + } + if (rdr.isPresent) { + val optrdr = rdr.get() + optrdr.toTlv(ContextSpecificTag(TAG_RDR), this) + } + if (rssi != null) { + if (rssi.isPresent) { + val optrssi = rssi.get() + put(ContextSpecificTag(TAG_RSSI), optrssi) + } + } else { + putNull(ContextSpecificTag(TAG_RSSI)) + } + if (txPower != null) { + if (txPower.isPresent) { + val opttxPower = txPower.get() + put(ContextSpecificTag(TAG_TX_POWER), opttxPower) + } + } else { + putNull(ContextSpecificTag(TAG_TX_POWER)) + } + endStructure() + } + } + + companion object { + private const val TAG_WI_FI_DEV_IK = 0 + private const val TAG_BLE_DEVICE_ID = 1 + private const val TAG_BLT_DEV_IK = 2 + private const val TAG_TIME_OF_MEASUREMENT = 3 + private const val TAG_DISTANCE = 4 + private const val TAG_ACCURACY = 5 + private const val TAG_RDR = 6 + private const val TAG_RSSI = 7 + private const val TAG_TX_POWER = 8 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterRangingMeasurementDataStruct { + tlvReader.enterStructure(tlvTag) + val wiFiDevIK = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_WI_FI_DEV_IK))) { + Optional.of(tlvReader.getByteArray(ContextSpecificTag(TAG_WI_FI_DEV_IK))) + } else { + Optional.empty() + } + val BLEDeviceId = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_BLE_DEVICE_ID))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_BLE_DEVICE_ID))) + } else { + Optional.empty() + } + val BLTDevIK = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_BLT_DEV_IK))) { + Optional.of(tlvReader.getByteArray(ContextSpecificTag(TAG_BLT_DEV_IK))) + } else { + Optional.empty() + } + val timeOfMeasurement = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT))) + } else { + Optional.empty() + } + val distance = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_DISTANCE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_DISTANCE)) + null + } + val accuracy = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ACCURACY))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_ACCURACY))) + } else { + Optional.empty() + } + val rdr = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_RDR))) { + Optional.of( + ProximityRangingClusterRDRStruct.fromTlv(ContextSpecificTag(TAG_RDR), tlvReader) + ) + } else { + Optional.empty() + } + val rssi = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_RSSI))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_RSSI))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_RSSI)) + null + } + val txPower = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TX_POWER))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_TX_POWER))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_TX_POWER)) + null + } + + tlvReader.exitContainer() + + return ProximityRangingClusterRangingMeasurementDataStruct( + wiFiDevIK, + BLEDeviceId, + BLTDevIK, + timeOfMeasurement, + distance, + accuracy, + rdr, + rssi, + txPower, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingTriggerConditionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingTriggerConditionStruct.kt new file mode 100644 index 00000000000000..055fe5303cf222 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingTriggerConditionStruct.kt @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRangingTriggerConditionStruct( + val startTime: ULong, + val endTime: Optional, + val rangingInstanceInterval: Optional, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRangingTriggerConditionStruct {\n") + append("\tstartTime : $startTime\n") + append("\tendTime : $endTime\n") + append("\trangingInstanceInterval : $rangingInstanceInterval\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_START_TIME), startTime) + if (endTime.isPresent) { + val optendTime = endTime.get() + put(ContextSpecificTag(TAG_END_TIME), optendTime) + } + if (rangingInstanceInterval.isPresent) { + val optrangingInstanceInterval = rangingInstanceInterval.get() + put(ContextSpecificTag(TAG_RANGING_INSTANCE_INTERVAL), optrangingInstanceInterval) + } + endStructure() + } + } + + companion object { + private const val TAG_START_TIME = 0 + private const val TAG_END_TIME = 1 + private const val TAG_RANGING_INSTANCE_INTERVAL = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterRangingTriggerConditionStruct { + tlvReader.enterStructure(tlvTag) + val startTime = tlvReader.getULong(ContextSpecificTag(TAG_START_TIME)) + val endTime = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_END_TIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_END_TIME))) + } else { + Optional.empty() + } + val rangingInstanceInterval = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_RANGING_INSTANCE_INTERVAL))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_RANGING_INSTANCE_INTERVAL))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ProximityRangingClusterRangingTriggerConditionStruct( + startTime, + endTime, + rangingInstanceInterval, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt new file mode 100644 index 00000000000000..4de5960d1deb15 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt @@ -0,0 +1,96 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterReportingConditionStruct( + val minDistanceCondition: Optional, + val maxDistanceCondition: Optional, + val accuracyCondition: Optional, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterReportingConditionStruct {\n") + append("\tminDistanceCondition : $minDistanceCondition\n") + append("\tmaxDistanceCondition : $maxDistanceCondition\n") + append("\taccuracyCondition : $accuracyCondition\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (minDistanceCondition.isPresent) { + val optminDistanceCondition = minDistanceCondition.get() + put(ContextSpecificTag(TAG_MIN_DISTANCE_CONDITION), optminDistanceCondition) + } + if (maxDistanceCondition.isPresent) { + val optmaxDistanceCondition = maxDistanceCondition.get() + put(ContextSpecificTag(TAG_MAX_DISTANCE_CONDITION), optmaxDistanceCondition) + } + if (accuracyCondition.isPresent) { + val optaccuracyCondition = accuracyCondition.get() + put(ContextSpecificTag(TAG_ACCURACY_CONDITION), optaccuracyCondition) + } + endStructure() + } + } + + companion object { + private const val TAG_MIN_DISTANCE_CONDITION = 0 + private const val TAG_MAX_DISTANCE_CONDITION = 1 + private const val TAG_ACCURACY_CONDITION = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterReportingConditionStruct { + tlvReader.enterStructure(tlvTag) + val minDistanceCondition = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MIN_DISTANCE_CONDITION))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MIN_DISTANCE_CONDITION))) + } else { + Optional.empty() + } + val maxDistanceCondition = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MAX_DISTANCE_CONDITION))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MAX_DISTANCE_CONDITION))) + } else { + Optional.empty() + } + val accuracyCondition = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ACCURACY_CONDITION))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_ACCURACY_CONDITION))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ProximityRangingClusterReportingConditionStruct( + minDistanceCondition, + maxDistanceCondition, + accuracyCondition, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct.kt new file mode 100644 index 00000000000000..1fb17a1527e04d --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct.kt @@ -0,0 +1,76 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct( + val role: UInt, + val peerWiFiDevIK: ByteArray, + val pmk: Optional, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct {\n") + append("\trole : $role\n") + append("\tpeerWiFiDevIK : $peerWiFiDevIK\n") + append("\tpmk : $pmk\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ROLE), role) + put(ContextSpecificTag(TAG_PEER_WI_FI_DEV_IK), peerWiFiDevIK) + if (pmk.isPresent) { + val optpmk = pmk.get() + put(ContextSpecificTag(TAG_PMK), optpmk) + } + endStructure() + } + } + + companion object { + private const val TAG_ROLE = 0 + private const val TAG_PEER_WI_FI_DEV_IK = 1 + private const val TAG_PMK = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct { + tlvReader.enterStructure(tlvTag) + val role = tlvReader.getUInt(ContextSpecificTag(TAG_ROLE)) + val peerWiFiDevIK = tlvReader.getByteArray(ContextSpecificTag(TAG_PEER_WI_FI_DEV_IK)) + val pmk = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PMK))) { + Optional.of(tlvReader.getByteArray(ContextSpecificTag(TAG_PMK))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct(role, peerWiFiDevIK, pmk) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ProximityRangingCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ProximityRangingCluster.kt new file mode 100644 index 00000000000000..242369ed562805 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ProximityRangingCluster.kt @@ -0,0 +1,1171 @@ +/* + * + * Copyright (c) 2023 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. + */ + +package matter.controller.cluster.clusters + +import java.time.Duration +import java.util.logging.Level +import java.util.logging.Logger +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.transform +import matter.controller.ByteArraySubscriptionState +import matter.controller.InvokeRequest +import matter.controller.InvokeResponse +import matter.controller.MatterController +import matter.controller.ReadData +import matter.controller.ReadRequest +import matter.controller.SubscribeRequest +import matter.controller.SubscriptionState +import matter.controller.UIntSubscriptionState +import matter.controller.ULongSubscriptionState +import matter.controller.UShortSubscriptionState +import matter.controller.cluster.structs.* +import matter.controller.model.AttributePath +import matter.controller.model.CommandPath +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingCluster( + private val controller: MatterController, + private val endpointId: UShort, +) { + class StartRangingResponse(val resultCode: UByte, val sessionID: UByte?) + + class RangingCapabilitiesAttribute( + val value: List + ) + + sealed class RangingCapabilitiesAttributeSubscriptionState { + data class Success(val value: List) : + RangingCapabilitiesAttributeSubscriptionState() + + data class Error(val exception: Exception) : RangingCapabilitiesAttributeSubscriptionState() + + object SubscriptionEstablished : RangingCapabilitiesAttributeSubscriptionState() + } + + class SessionIDsAttribute(val value: List?) + + sealed class SessionIDsAttributeSubscriptionState { + data class Success(val value: List?) : SessionIDsAttributeSubscriptionState() + + data class Error(val exception: Exception) : SessionIDsAttributeSubscriptionState() + + object SubscriptionEstablished : SessionIDsAttributeSubscriptionState() + } + + class GeneratedCommandListAttribute(val value: List) + + sealed class GeneratedCommandListAttributeSubscriptionState { + data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState() + } + + class AcceptedCommandListAttribute(val value: List) + + sealed class AcceptedCommandListAttributeSubscriptionState { + data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState() + } + + class AttributeListAttribute(val value: List) + + sealed class AttributeListAttributeSubscriptionState { + data class Success(val value: List) : AttributeListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState() + + object SubscriptionEstablished : AttributeListAttributeSubscriptionState() + } + + suspend fun startRangingRequest( + technology: UByte, + wiFiRangingDeviceRoleConfig: ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct?, + BLERangingDeviceRoleConfig: ProximityRangingClusterBLERangingDeviceRoleConfigStruct?, + BLTChannelSoundingDeviceRoleConfig: + ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct?, + frequencyBand: UShort?, + bandwidth: UInt?, + securityMode: UByte, + trigger: ProximityRangingClusterRangingTriggerConditionStruct, + reportingCondition: ProximityRangingClusterReportingConditionStruct?, + timedInvokeTimeout: Duration? = null, + ): StartRangingResponse { + val commandId: UInt = 0u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_TECHNOLOGY_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_TECHNOLOGY_REQ), technology) + + val TAG_WI_FI_RANGING_DEVICE_ROLE_CONFIG_REQ: Int = 1 + wiFiRangingDeviceRoleConfig?.let { + wiFiRangingDeviceRoleConfig.toTlv( + ContextSpecificTag(TAG_WI_FI_RANGING_DEVICE_ROLE_CONFIG_REQ), + tlvWriter, + ) + } + + val TAG_BLE_RANGING_DEVICE_ROLE_CONFIG_REQ: Int = 2 + BLERangingDeviceRoleConfig?.let { + BLERangingDeviceRoleConfig.toTlv( + ContextSpecificTag(TAG_BLE_RANGING_DEVICE_ROLE_CONFIG_REQ), + tlvWriter, + ) + } + + val TAG_BLT_CHANNEL_SOUNDING_DEVICE_ROLE_CONFIG_REQ: Int = 3 + BLTChannelSoundingDeviceRoleConfig?.let { + BLTChannelSoundingDeviceRoleConfig.toTlv( + ContextSpecificTag(TAG_BLT_CHANNEL_SOUNDING_DEVICE_ROLE_CONFIG_REQ), + tlvWriter, + ) + } + + val TAG_FREQUENCY_BAND_REQ: Int = 4 + frequencyBand?.let { tlvWriter.put(ContextSpecificTag(TAG_FREQUENCY_BAND_REQ), frequencyBand) } + + val TAG_BANDWIDTH_REQ: Int = 5 + bandwidth?.let { tlvWriter.put(ContextSpecificTag(TAG_BANDWIDTH_REQ), bandwidth) } + + val TAG_SECURITY_MODE_REQ: Int = 6 + tlvWriter.put(ContextSpecificTag(TAG_SECURITY_MODE_REQ), securityMode) + + val TAG_TRIGGER_REQ: Int = 7 + trigger.toTlv(ContextSpecificTag(TAG_TRIGGER_REQ), tlvWriter) + + val TAG_REPORTING_CONDITION_REQ: Int = 8 + reportingCondition?.let { + reportingCondition.toTlv(ContextSpecificTag(TAG_REPORTING_CONDITION_REQ), tlvWriter) + } + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + + val tlvReader = TlvReader(response.payload) + tlvReader.enterStructure(AnonymousTag) + val TAG_RESULT_CODE: Int = 0 + var resultCode_decoded: UByte? = null + + val TAG_SESSION_ID: Int = 1 + var sessionID_decoded: UByte? = null + + while (!tlvReader.isEndOfContainer()) { + val tag = tlvReader.peekElement().tag + + if (tag == ContextSpecificTag(TAG_RESULT_CODE)) { + resultCode_decoded = tlvReader.getUByte(tag) + } else if (tag == ContextSpecificTag(TAG_SESSION_ID)) { + sessionID_decoded = + if (tlvReader.isNull()) { + tlvReader.getNull(tag) + null + } else { + if (!tlvReader.isNull()) { + tlvReader.getUByte(tag) + } else { + tlvReader.getNull(tag) + null + } + } + } else { + tlvReader.skipElement() + } + } + + if (resultCode_decoded == null) { + throw IllegalStateException("resultCode not found in TLV") + } + + tlvReader.exitContainer() + + return StartRangingResponse(resultCode_decoded, sessionID_decoded) + } + + suspend fun stopRangingRequest(sessionID: UByte, timedInvokeTimeout: Duration? = null) { + val commandId: UInt = 2u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_SESSION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_SESSION_ID_REQ), sessionID) + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun readRangingCapabilitiesAttribute(): RangingCapabilitiesAttribute { + val ATTRIBUTE_ID: UInt = 0u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Rangingcapabilities attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(ProximityRangingClusterRangingCapabilitiesStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + return RangingCapabilitiesAttribute(decodedValue) + } + + suspend fun subscribeRangingCapabilitiesAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 0u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + RangingCapabilitiesAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Rangingcapabilities attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + ProximityRangingClusterRangingCapabilitiesStruct.fromTlv(AnonymousTag, tlvReader) + ) + } + tlvReader.exitContainer() + } + + emit(RangingCapabilitiesAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(RangingCapabilitiesAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readWiFiDevIKAttribute(): ByteArray? { + val ATTRIBUTE_ID: UInt = 1u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Wifidevik attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ByteArray? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getByteArray(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeWiFiDevIKAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 1u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + ByteArraySubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Wifidevik attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ByteArray? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getByteArray(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(ByteArraySubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(ByteArraySubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readBLEDeviceIdAttribute(): ULong? { + val ATTRIBUTE_ID: UInt = 2u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Bledeviceid attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ULong? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getULong(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeBLEDeviceIdAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 2u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + ULongSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Bledeviceid attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ULong? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getULong(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(ULongSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(ULongSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readBLTDevIKAttribute(): ByteArray? { + val ATTRIBUTE_ID: UInt = 3u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Bltdevik attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ByteArray? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getByteArray(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeBLTDevIKAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 3u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + ByteArraySubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Bltdevik attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ByteArray? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getByteArray(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(ByteArraySubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(ByteArraySubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readSessionIDsAttribute(): SessionIDsAttribute { + val ATTRIBUTE_ID: UInt = 4u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Sessionids attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUByte(AnonymousTag)) + } + tlvReader.exitContainer() + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return SessionIDsAttribute(decodedValue) + } + + suspend fun subscribeSessionIDsAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 4u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + SessionIDsAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Sessionids attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUByte(AnonymousTag)) + } + tlvReader.exitContainer() + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(SessionIDsAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(SessionIDsAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65528u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Generatedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return GeneratedCommandListAttribute(decodedValue) + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65528u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + GeneratedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Generatedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(GeneratedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(GeneratedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65529u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Acceptedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AcceptedCommandListAttribute(decodedValue) + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65529u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AcceptedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Acceptedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AcceptedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AcceptedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + val ATTRIBUTE_ID: UInt = 65531u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Attributelist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AttributeListAttribute(decodedValue) + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65531u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AttributeListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Attributelist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AttributeListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AttributeListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readFeatureMapAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 65532u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Featuremap attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeFeatureMapAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65532u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UIntSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Featuremap attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readClusterRevisionAttribute(): UShort { + val ATTRIBUTE_ID: UInt = 65533u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Clusterrevision attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeClusterRevisionAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65533u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UShortSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Clusterrevision attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + emit(UShortSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + companion object { + private val logger = Logger.getLogger(ProximityRangingCluster::class.java.name) + const val CLUSTER_ID: UInt = 1075u + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index a3778d84ced068..5b4894cd549c7c 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -170,6 +170,14 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/PowerSourceClusterBatFaultChangeType.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/PowerSourceClusterWiredFaultChangeType.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/PowerTopologyClusterCircuitNodeStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLERangingDeviceRoleConfigStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingCapabilitiesStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingTriggerConditionStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRDRStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/PushAvStreamTransportClusterAudioStreamStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/PushAvStreamTransportClusterCMAFContainerOptionsStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/PushAvStreamTransportClusterContainerOptionsStruct.kt", @@ -451,6 +459,7 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/PowerSourceConfigurationCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/PowerTopologyCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/PressureMeasurementCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ProximityRangingCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ProxyConfigurationCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ProxyDiscoveryCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ProxyValidCluster.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLERangingDeviceRoleConfigStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLERangingDeviceRoleConfigStruct.kt new file mode 100644 index 00000000000000..5e689c649bc8f7 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLERangingDeviceRoleConfigStruct.kt @@ -0,0 +1,62 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterBLERangingDeviceRoleConfigStruct( + val role: UByte, + val peerBLEDeviceID: ULong, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterBLERangingDeviceRoleConfigStruct {\n") + append("\trole : $role\n") + append("\tpeerBLEDeviceID : $peerBLEDeviceID\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ROLE), role) + put(ContextSpecificTag(TAG_PEER_BLE_DEVICE_ID), peerBLEDeviceID) + endStructure() + } + } + + companion object { + private const val TAG_ROLE = 0 + private const val TAG_PEER_BLE_DEVICE_ID = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterBLERangingDeviceRoleConfigStruct { + tlvReader.enterStructure(tlvTag) + val role = tlvReader.getUByte(ContextSpecificTag(TAG_ROLE)) + val peerBLEDeviceID = tlvReader.getULong(ContextSpecificTag(TAG_PEER_BLE_DEVICE_ID)) + + tlvReader.exitContainer() + + return ProximityRangingClusterBLERangingDeviceRoleConfigStruct(role, peerBLEDeviceID) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt new file mode 100644 index 00000000000000..d5681279a80b00 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt @@ -0,0 +1,80 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( + val role: UByte, + val peerBLTDevIK: ByteArray, + val ltk: Optional, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct {\n") + append("\trole : $role\n") + append("\tpeerBLTDevIK : $peerBLTDevIK\n") + append("\tltk : $ltk\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ROLE), role) + put(ContextSpecificTag(TAG_PEER_BLT_DEV_IK), peerBLTDevIK) + if (ltk.isPresent) { + val optltk = ltk.get() + put(ContextSpecificTag(TAG_LTK), optltk) + } + endStructure() + } + } + + companion object { + private const val TAG_ROLE = 0 + private const val TAG_PEER_BLT_DEV_IK = 1 + private const val TAG_LTK = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct { + tlvReader.enterStructure(tlvTag) + val role = tlvReader.getUByte(ContextSpecificTag(TAG_ROLE)) + val peerBLTDevIK = tlvReader.getByteArray(ContextSpecificTag(TAG_PEER_BLT_DEV_IK)) + val ltk = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_LTK))) { + Optional.of(tlvReader.getByteArray(ContextSpecificTag(TAG_LTK))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( + role, + peerBLTDevIK, + ltk, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRDRStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRDRStruct.kt new file mode 100644 index 00000000000000..ce07a2c5a2145a --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRDRStruct.kt @@ -0,0 +1,80 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRDRStruct( + val azimuth: UShort, + val elevation: Short, + val azimuthAccuracy: UByte, + val elevationAccuracy: UByte, + val reference: UByte, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRDRStruct {\n") + append("\tazimuth : $azimuth\n") + append("\televation : $elevation\n") + append("\tazimuthAccuracy : $azimuthAccuracy\n") + append("\televationAccuracy : $elevationAccuracy\n") + append("\treference : $reference\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_AZIMUTH), azimuth) + put(ContextSpecificTag(TAG_ELEVATION), elevation) + put(ContextSpecificTag(TAG_AZIMUTH_ACCURACY), azimuthAccuracy) + put(ContextSpecificTag(TAG_ELEVATION_ACCURACY), elevationAccuracy) + put(ContextSpecificTag(TAG_REFERENCE), reference) + endStructure() + } + } + + companion object { + private const val TAG_AZIMUTH = 0 + private const val TAG_ELEVATION = 1 + private const val TAG_AZIMUTH_ACCURACY = 2 + private const val TAG_ELEVATION_ACCURACY = 3 + private const val TAG_REFERENCE = 4 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ProximityRangingClusterRDRStruct { + tlvReader.enterStructure(tlvTag) + val azimuth = tlvReader.getUShort(ContextSpecificTag(TAG_AZIMUTH)) + val elevation = tlvReader.getShort(ContextSpecificTag(TAG_ELEVATION)) + val azimuthAccuracy = tlvReader.getUByte(ContextSpecificTag(TAG_AZIMUTH_ACCURACY)) + val elevationAccuracy = tlvReader.getUByte(ContextSpecificTag(TAG_ELEVATION_ACCURACY)) + val reference = tlvReader.getUByte(ContextSpecificTag(TAG_REFERENCE)) + + tlvReader.exitContainer() + + return ProximityRangingClusterRDRStruct( + azimuth, + elevation, + azimuthAccuracy, + elevationAccuracy, + reference, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingCapabilitiesStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingCapabilitiesStruct.kt new file mode 100644 index 00000000000000..80b18081fd8b44 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingCapabilitiesStruct.kt @@ -0,0 +1,72 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRangingCapabilitiesStruct( + val technology: UByte, + val frequencyBand: UShort, + val periodicRangingSupport: Boolean, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRangingCapabilitiesStruct {\n") + append("\ttechnology : $technology\n") + append("\tfrequencyBand : $frequencyBand\n") + append("\tperiodicRangingSupport : $periodicRangingSupport\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_TECHNOLOGY), technology) + put(ContextSpecificTag(TAG_FREQUENCY_BAND), frequencyBand) + put(ContextSpecificTag(TAG_PERIODIC_RANGING_SUPPORT), periodicRangingSupport) + endStructure() + } + } + + companion object { + private const val TAG_TECHNOLOGY = 0 + private const val TAG_FREQUENCY_BAND = 1 + private const val TAG_PERIODIC_RANGING_SUPPORT = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterRangingCapabilitiesStruct { + tlvReader.enterStructure(tlvTag) + val technology = tlvReader.getUByte(ContextSpecificTag(TAG_TECHNOLOGY)) + val frequencyBand = tlvReader.getUShort(ContextSpecificTag(TAG_FREQUENCY_BAND)) + val periodicRangingSupport = + tlvReader.getBoolean(ContextSpecificTag(TAG_PERIODIC_RANGING_SUPPORT)) + + tlvReader.exitContainer() + + return ProximityRangingClusterRangingCapabilitiesStruct( + technology, + frequencyBand, + periodicRangingSupport, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt new file mode 100644 index 00000000000000..ddd21365f2bb18 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt @@ -0,0 +1,202 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRangingMeasurementDataStruct( + val wiFiDevIK: Optional, + val BLEDeviceId: Optional, + val BLTDevIK: Optional, + val timeOfMeasurement: Optional, + val distance: UShort?, + val accuracy: Optional, + val rdr: Optional, + val rssi: Optional?, + val txPower: Optional?, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRangingMeasurementDataStruct {\n") + append("\twiFiDevIK : $wiFiDevIK\n") + append("\tBLEDeviceId : $BLEDeviceId\n") + append("\tBLTDevIK : $BLTDevIK\n") + append("\ttimeOfMeasurement : $timeOfMeasurement\n") + append("\tdistance : $distance\n") + append("\taccuracy : $accuracy\n") + append("\trdr : $rdr\n") + append("\trssi : $rssi\n") + append("\ttxPower : $txPower\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (wiFiDevIK.isPresent) { + val optwiFiDevIK = wiFiDevIK.get() + put(ContextSpecificTag(TAG_WI_FI_DEV_IK), optwiFiDevIK) + } + if (BLEDeviceId.isPresent) { + val optBLEDeviceId = BLEDeviceId.get() + put(ContextSpecificTag(TAG_BLE_DEVICE_ID), optBLEDeviceId) + } + if (BLTDevIK.isPresent) { + val optBLTDevIK = BLTDevIK.get() + put(ContextSpecificTag(TAG_BLT_DEV_IK), optBLTDevIK) + } + if (timeOfMeasurement.isPresent) { + val opttimeOfMeasurement = timeOfMeasurement.get() + put(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT), opttimeOfMeasurement) + } + if (distance != null) { + put(ContextSpecificTag(TAG_DISTANCE), distance) + } else { + putNull(ContextSpecificTag(TAG_DISTANCE)) + } + if (accuracy.isPresent) { + val optaccuracy = accuracy.get() + put(ContextSpecificTag(TAG_ACCURACY), optaccuracy) + } + if (rdr.isPresent) { + val optrdr = rdr.get() + optrdr.toTlv(ContextSpecificTag(TAG_RDR), this) + } + if (rssi != null) { + if (rssi.isPresent) { + val optrssi = rssi.get() + put(ContextSpecificTag(TAG_RSSI), optrssi) + } + } else { + putNull(ContextSpecificTag(TAG_RSSI)) + } + if (txPower != null) { + if (txPower.isPresent) { + val opttxPower = txPower.get() + put(ContextSpecificTag(TAG_TX_POWER), opttxPower) + } + } else { + putNull(ContextSpecificTag(TAG_TX_POWER)) + } + endStructure() + } + } + + companion object { + private const val TAG_WI_FI_DEV_IK = 0 + private const val TAG_BLE_DEVICE_ID = 1 + private const val TAG_BLT_DEV_IK = 2 + private const val TAG_TIME_OF_MEASUREMENT = 3 + private const val TAG_DISTANCE = 4 + private const val TAG_ACCURACY = 5 + private const val TAG_RDR = 6 + private const val TAG_RSSI = 7 + private const val TAG_TX_POWER = 8 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterRangingMeasurementDataStruct { + tlvReader.enterStructure(tlvTag) + val wiFiDevIK = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_WI_FI_DEV_IK))) { + Optional.of(tlvReader.getByteArray(ContextSpecificTag(TAG_WI_FI_DEV_IK))) + } else { + Optional.empty() + } + val BLEDeviceId = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_BLE_DEVICE_ID))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_BLE_DEVICE_ID))) + } else { + Optional.empty() + } + val BLTDevIK = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_BLT_DEV_IK))) { + Optional.of(tlvReader.getByteArray(ContextSpecificTag(TAG_BLT_DEV_IK))) + } else { + Optional.empty() + } + val timeOfMeasurement = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT))) + } else { + Optional.empty() + } + val distance = + if (!tlvReader.isNull()) { + tlvReader.getUShort(ContextSpecificTag(TAG_DISTANCE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_DISTANCE)) + null + } + val accuracy = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ACCURACY))) { + Optional.of(tlvReader.getShort(ContextSpecificTag(TAG_ACCURACY))) + } else { + Optional.empty() + } + val rdr = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_RDR))) { + Optional.of( + ProximityRangingClusterRDRStruct.fromTlv(ContextSpecificTag(TAG_RDR), tlvReader) + ) + } else { + Optional.empty() + } + val rssi = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_RSSI))) { + Optional.of(tlvReader.getByte(ContextSpecificTag(TAG_RSSI))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_RSSI)) + null + } + val txPower = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TX_POWER))) { + Optional.of(tlvReader.getByte(ContextSpecificTag(TAG_TX_POWER))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_TX_POWER)) + null + } + + tlvReader.exitContainer() + + return ProximityRangingClusterRangingMeasurementDataStruct( + wiFiDevIK, + BLEDeviceId, + BLTDevIK, + timeOfMeasurement, + distance, + accuracy, + rdr, + rssi, + txPower, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingTriggerConditionStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingTriggerConditionStruct.kt new file mode 100644 index 00000000000000..1caf86144e450f --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingTriggerConditionStruct.kt @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRangingTriggerConditionStruct( + val startTime: UInt, + val endTime: Optional, + val rangingInstanceInterval: Optional, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRangingTriggerConditionStruct {\n") + append("\tstartTime : $startTime\n") + append("\tendTime : $endTime\n") + append("\trangingInstanceInterval : $rangingInstanceInterval\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_START_TIME), startTime) + if (endTime.isPresent) { + val optendTime = endTime.get() + put(ContextSpecificTag(TAG_END_TIME), optendTime) + } + if (rangingInstanceInterval.isPresent) { + val optrangingInstanceInterval = rangingInstanceInterval.get() + put(ContextSpecificTag(TAG_RANGING_INSTANCE_INTERVAL), optrangingInstanceInterval) + } + endStructure() + } + } + + companion object { + private const val TAG_START_TIME = 0 + private const val TAG_END_TIME = 1 + private const val TAG_RANGING_INSTANCE_INTERVAL = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterRangingTriggerConditionStruct { + tlvReader.enterStructure(tlvTag) + val startTime = tlvReader.getUInt(ContextSpecificTag(TAG_START_TIME)) + val endTime = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_END_TIME))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_END_TIME))) + } else { + Optional.empty() + } + val rangingInstanceInterval = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_RANGING_INSTANCE_INTERVAL))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_RANGING_INSTANCE_INTERVAL))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ProximityRangingClusterRangingTriggerConditionStruct( + startTime, + endTime, + rangingInstanceInterval, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt new file mode 100644 index 00000000000000..8db54450cd1e88 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt @@ -0,0 +1,96 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterReportingConditionStruct( + val minDistanceCondition: Optional, + val maxDistanceCondition: Optional, + val accuracyCondition: Optional, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterReportingConditionStruct {\n") + append("\tminDistanceCondition : $minDistanceCondition\n") + append("\tmaxDistanceCondition : $maxDistanceCondition\n") + append("\taccuracyCondition : $accuracyCondition\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (minDistanceCondition.isPresent) { + val optminDistanceCondition = minDistanceCondition.get() + put(ContextSpecificTag(TAG_MIN_DISTANCE_CONDITION), optminDistanceCondition) + } + if (maxDistanceCondition.isPresent) { + val optmaxDistanceCondition = maxDistanceCondition.get() + put(ContextSpecificTag(TAG_MAX_DISTANCE_CONDITION), optmaxDistanceCondition) + } + if (accuracyCondition.isPresent) { + val optaccuracyCondition = accuracyCondition.get() + put(ContextSpecificTag(TAG_ACCURACY_CONDITION), optaccuracyCondition) + } + endStructure() + } + } + + companion object { + private const val TAG_MIN_DISTANCE_CONDITION = 0 + private const val TAG_MAX_DISTANCE_CONDITION = 1 + private const val TAG_ACCURACY_CONDITION = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterReportingConditionStruct { + tlvReader.enterStructure(tlvTag) + val minDistanceCondition = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MIN_DISTANCE_CONDITION))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_MIN_DISTANCE_CONDITION))) + } else { + Optional.empty() + } + val maxDistanceCondition = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MAX_DISTANCE_CONDITION))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_MAX_DISTANCE_CONDITION))) + } else { + Optional.empty() + } + val accuracyCondition = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ACCURACY_CONDITION))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_ACCURACY_CONDITION))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ProximityRangingClusterReportingConditionStruct( + minDistanceCondition, + maxDistanceCondition, + accuracyCondition, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct.kt new file mode 100644 index 00000000000000..9f26edc9a3272d --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct.kt @@ -0,0 +1,76 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct( + val role: UByte, + val peerWiFiDevIK: ByteArray, + val pmk: Optional, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct {\n") + append("\trole : $role\n") + append("\tpeerWiFiDevIK : $peerWiFiDevIK\n") + append("\tpmk : $pmk\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ROLE), role) + put(ContextSpecificTag(TAG_PEER_WI_FI_DEV_IK), peerWiFiDevIK) + if (pmk.isPresent) { + val optpmk = pmk.get() + put(ContextSpecificTag(TAG_PMK), optpmk) + } + endStructure() + } + } + + companion object { + private const val TAG_ROLE = 0 + private const val TAG_PEER_WI_FI_DEV_IK = 1 + private const val TAG_PMK = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct { + tlvReader.enterStructure(tlvTag) + val role = tlvReader.getUByte(ContextSpecificTag(TAG_ROLE)) + val peerWiFiDevIK = tlvReader.getByteArray(ContextSpecificTag(TAG_PEER_WI_FI_DEV_IK)) + val pmk = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PMK))) { + Optional.of(tlvReader.getByteArray(ContextSpecificTag(TAG_PMK))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ProximityRangingClusterWiFiRangingDeviceRoleConfigStruct(role, peerWiFiDevIK, pmk) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 13aa916c0fb5cc..a10effdf459eb2 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -39063,6 +39063,269 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::ProximityRanging::Id: { + using namespace app::Clusters::ProximityRanging; + switch (aPath.mAttributeId) + { + case Attributes::RangingCapabilities::Id: { + using TypeInfo = Attributes::RangingCapabilities::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_technology; + std::string newElement_0_technologyClassName = "java/lang/Integer"; + std::string newElement_0_technologyCtorSignature = "(I)V"; + jint jninewElement_0_technology = static_cast(entry_0.technology); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_technologyClassName.c_str(), newElement_0_technologyCtorSignature.c_str(), + jninewElement_0_technology, newElement_0_technology); + jobject newElement_0_frequencyBand; + std::string newElement_0_frequencyBandClassName = "java/lang/Integer"; + std::string newElement_0_frequencyBandCtorSignature = "(I)V"; + jint jninewElement_0_frequencyBand = static_cast(entry_0.frequencyBand.Raw()); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_frequencyBandClassName.c_str(), newElement_0_frequencyBandCtorSignature.c_str(), + jninewElement_0_frequencyBand, newElement_0_frequencyBand); + jobject newElement_0_periodicRangingSupport; + std::string newElement_0_periodicRangingSupportClassName = "java/lang/Boolean"; + std::string newElement_0_periodicRangingSupportCtorSignature = "(Z)V"; + jboolean jninewElement_0_periodicRangingSupport = static_cast(entry_0.periodicRangingSupport); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_periodicRangingSupportClassName.c_str(), newElement_0_periodicRangingSupportCtorSignature.c_str(), + jninewElement_0_periodicRangingSupport, newElement_0_periodicRangingSupport); + + { + jclass rangingCapabilitiesStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$ProximityRangingClusterRangingCapabilitiesStruct", + rangingCapabilitiesStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ProximityRangingClusterRangingCapabilitiesStruct"); + return nullptr; + } + + jmethodID rangingCapabilitiesStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, rangingCapabilitiesStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;)V", &rangingCapabilitiesStructStructCtor_1); + if (err != CHIP_NO_ERROR || rangingCapabilitiesStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$ProximityRangingClusterRangingCapabilitiesStruct constructor"); + return nullptr; + } + + newElement_0 = + env->NewObject(rangingCapabilitiesStructStructClass_1, rangingCapabilitiesStructStructCtor_1, + newElement_0_technology, newElement_0_frequencyBand, newElement_0_periodicRangingSupport); + } + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::WiFiDevIK::Id: { + using TypeInfo = Attributes::WiFiDevIK::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + jbyteArray valueByteArray = env->NewByteArray(static_cast(cppValue.size())); + env->SetByteArrayRegion(valueByteArray, 0, static_cast(cppValue.size()), + reinterpret_cast(cppValue.data())); + value = valueByteArray; + return value; + } + case Attributes::BLEDeviceId::Id: { + using TypeInfo = Attributes::BLEDeviceId::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, value); + return value; + } + case Attributes::BLTDevIK::Id: { + using TypeInfo = Attributes::BLTDevIK::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + jbyteArray valueByteArray = env->NewByteArray(static_cast(cppValue.size())); + env->SetByteArrayRegion(valueByteArray, 0, static_cast(cppValue.size()), + reinterpret_cast(cppValue.data())); + value = valueByteArray; + return value; + } + case Attributes::SessionIDs::Id: { + using TypeInfo = Attributes::SessionIDs::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_1 = cppValue.Value().begin(); + while (iter_value_1.Next()) + { + auto & entry_1 = iter_value_1.GetValue(); + jobject newElement_1; + std::string newElement_1ClassName = "java/lang/Integer"; + std::string newElement_1CtorSignature = "(I)V"; + jint jninewElement_1 = static_cast(entry_1); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1ClassName.c_str(), newElement_1CtorSignature.c_str(), jninewElement_1, newElement_1); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().AddToList(value, newElement_1); + } + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, value); + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } case app::Clusters::WiFiNetworkManagement::Id: { using namespace app::Clusters::WiFiNetworkManagement; switch (aPath.mAttributeId) diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index e84c4d028b98b3..b382c4670d5a77 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -9197,6 +9197,16 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::ProximityRanging::Id: { + using namespace app::Clusters::ProximityRanging; + switch (aPath.mEventId) + { + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::WiFiNetworkManagement::Id: { using namespace app::Clusters::WiFiNetworkManagement; switch (aPath.mEventId) diff --git a/src/controller/python/matter/clusters/CHIPClusters.py b/src/controller/python/matter/clusters/CHIPClusters.py index 12430dfd632d23..4a6a059bef6ae4 100644 --- a/src/controller/python/matter/clusters/CHIPClusters.py +++ b/src/controller/python/matter/clusters/CHIPClusters.py @@ -11591,6 +11591,96 @@ class ChipClusters: }, }, } + _PROXIMITY_RANGING_CLUSTER_INFO = { + "clusterName": "ProximityRanging", + "clusterId": 0x00000433, + "commands": { + 0x00000000: { + "commandId": 0x00000000, + "commandName": "StartRangingRequest", + "args": { + "technology": "int", + "wiFiRangingDeviceRoleConfig": "WiFiRangingDeviceRoleConfigStruct", + "BLERangingDeviceRoleConfig": "BLERangingDeviceRoleConfigStruct", + "BLTChannelSoundingDeviceRoleConfig": "BLTChannelSoundingDeviceRoleConfigStruct", + "frequencyBand": "int", + "bandwidth": "int", + "securityMode": "int", + "trigger": "RangingTriggerConditionStruct", + "reportingCondition": "ReportingConditionStruct", + }, + }, + 0x00000002: { + "commandId": 0x00000002, + "commandName": "StopRangingRequest", + "args": { + "sessionID": "int", + }, + }, + }, + "attributes": { + 0x00000000: { + "attributeName": "RangingCapabilities", + "attributeId": 0x00000000, + "type": "", + "reportable": True, + }, + 0x00000001: { + "attributeName": "WiFiDevIK", + "attributeId": 0x00000001, + "type": "bytes", + "reportable": True, + }, + 0x00000002: { + "attributeName": "BLEDeviceId", + "attributeId": 0x00000002, + "type": "int", + "reportable": True, + }, + 0x00000003: { + "attributeName": "BLTDevIK", + "attributeId": 0x00000003, + "type": "bytes", + "reportable": True, + }, + 0x00000004: { + "attributeName": "SessionIDs", + "attributeId": 0x00000004, + "type": "int", + "reportable": True, + }, + 0x0000FFF8: { + "attributeName": "GeneratedCommandList", + "attributeId": 0x0000FFF8, + "type": "int", + "reportable": True, + }, + 0x0000FFF9: { + "attributeName": "AcceptedCommandList", + "attributeId": 0x0000FFF9, + "type": "int", + "reportable": True, + }, + 0x0000FFFB: { + "attributeName": "AttributeList", + "attributeId": 0x0000FFFB, + "type": "int", + "reportable": True, + }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, + 0x0000FFFD: { + "attributeName": "ClusterRevision", + "attributeId": 0x0000FFFD, + "type": "int", + "reportable": True, + }, + }, + } _WI_FI_NETWORK_MANAGEMENT_CLUSTER_INFO = { "clusterName": "WiFiNetworkManagement", "clusterId": 0x00000451, @@ -16132,6 +16222,7 @@ class ChipClusters: 0x0000042F: _RADON_CONCENTRATION_MEASUREMENT_CLUSTER_INFO, 0x00000430: _SOIL_MEASUREMENT_CLUSTER_INFO, 0x00000431: _AMBIENT_CONTEXT_SENSING_CLUSTER_INFO, + 0x00000433: _PROXIMITY_RANGING_CLUSTER_INFO, 0x00000451: _WI_FI_NETWORK_MANAGEMENT_CLUSTER_INFO, 0x00000452: _THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER_INFO, 0x00000453: _THREAD_NETWORK_DIRECTORY_CLUSTER_INFO, @@ -16278,6 +16369,7 @@ class ChipClusters: "RadonConcentrationMeasurement": _RADON_CONCENTRATION_MEASUREMENT_CLUSTER_INFO, "SoilMeasurement": _SOIL_MEASUREMENT_CLUSTER_INFO, "AmbientContextSensing": _AMBIENT_CONTEXT_SENSING_CLUSTER_INFO, + "ProximityRanging": _PROXIMITY_RANGING_CLUSTER_INFO, "WiFiNetworkManagement": _WI_FI_NETWORK_MANAGEMENT_CLUSTER_INFO, "ThreadBorderRouterManagement": _THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER_INFO, "ThreadNetworkDirectory": _THREAD_NETWORK_DIRECTORY_CLUSTER_INFO, diff --git a/src/controller/python/matter/clusters/Objects.py b/src/controller/python/matter/clusters/Objects.py index f8f15f767535c2..a74d6bf767636d 100644 --- a/src/controller/python/matter/clusters/Objects.py +++ b/src/controller/python/matter/clusters/Objects.py @@ -145,6 +145,7 @@ "RadonConcentrationMeasurement", "SoilMeasurement", "AmbientContextSensing", + "ProximityRanging", "WiFiNetworkManagement", "ThreadBorderRouterManagement", "ThreadNetworkDirectory", @@ -42563,6 +42564,493 @@ def descriptor(cls) -> ClusterObjectDescriptor: eventStartTime: uint = 0 +@dataclass +class ProximityRanging(Cluster): + id: typing.ClassVar[int] = 0x00000433 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="rangingCapabilities", Tag=0x00000000, Type=typing.List[ProximityRanging.Structs.RangingCapabilitiesStruct]), + ClusterObjectFieldDescriptor(Label="wiFiDevIK", Tag=0x00000001, Type=typing.Optional[bytes]), + ClusterObjectFieldDescriptor(Label="BLEDeviceId", Tag=0x00000002, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="BLTDevIK", Tag=0x00000003, Type=typing.Optional[bytes]), + ClusterObjectFieldDescriptor(Label="sessionIDs", Tag=0x00000004, Type=typing.Union[Nullable, typing.List[uint]]), + ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=uint), + ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), + ]) + + rangingCapabilities: typing.List[ProximityRanging.Structs.RangingCapabilitiesStruct] = field(default_factory=lambda: []) + wiFiDevIK: typing.Optional[bytes] = None + BLEDeviceId: typing.Optional[uint] = None + BLTDevIK: typing.Optional[bytes] = None + sessionIDs: typing.Union[Nullable, typing.List[uint]] = NullValue + generatedCommandList: typing.List[uint] = field(default_factory=lambda: []) + acceptedCommandList: typing.List[uint] = field(default_factory=lambda: []) + attributeList: typing.List[uint] = field(default_factory=lambda: []) + featureMap: uint = 0 + clusterRevision: uint = 0 + + class Enums: + class RangingRoleEnum(MatterIntEnum): + kWiFiSubscriberRole = 0x00 + kWiFiPublisherRole = 0x01 + kBLEScanningRole = 0x02 + kBLEBeaconRole = 0x03 + kBLTInitiatorRole = 0x04 + kBLTReflectorRole = 0x05 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 6 + + class RangingSecurityEnum(MatterIntEnum): + kSecureRanging = 0x00 + kOpenRanging = 0x01 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 2 + + class RangingTechEnum(MatterIntEnum): + kBluetoothChannelSounding = 0x00 + kWiFiRoundTripTimeRanging = 0x01 + kWiFiNextGenerationRanging = 0x02 + kBLEBeaconRSSIRanging = 0x03 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 4 + + class ResultCodeEnum(MatterIntEnum): + kAccepted = 0x00 + kRejectedInfeasibleRanging = 0x01 + kRejectedInfeasibleRangingTriggers = 0x02 + kBusySessionCapacityReached = 0x03 + kBusyTryAgainLater = 0x04 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 5 + + class Bitmaps: + class Feature(IntFlag): + kWiFiUsdProximityDetection = 0x1 + kBluetoothChannelSounding = 0x2 + kBleBeaconRssi = 0x4 + kUwbRanging = 0x8 + + class RadioBandBitmap(IntFlag): + k2g4 = 0x1 + k3g65 = 0x2 + k5g = 0x4 + k6g = 0x8 + k60g = 0x10 + k1g = 0x20 + k45g = 0x40 + + class RangingBandwidthBitmap(IntFlag): + k1MHz = 0x1 + k2MHz = 0x2 + k4MHz = 0x4 + k8MHz = 0x8 + k16MHz = 0x10 + k20MHz = 0x20 + k40MHz = 0x40 + k80MHz = 0x80 + k160MHz = 0x100 + k320MHz = 0x200 + + class Structs: + @dataclass + class RDRStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="azimuth", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="elevation", Tag=1, Type=int), + ClusterObjectFieldDescriptor(Label="azimuthAccuracy", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="elevationAccuracy", Tag=3, Type=uint), + ClusterObjectFieldDescriptor(Label="reference", Tag=4, Type=uint), + ]) + + azimuth: 'uint' = 0 + elevation: 'int' = 0 + azimuthAccuracy: 'uint' = 0 + elevationAccuracy: 'uint' = 0 + reference: 'uint' = 0 + + @dataclass + class RangingMeasurementDataStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="wiFiDevIK", Tag=0, Type=typing.Optional[bytes]), + ClusterObjectFieldDescriptor(Label="BLEDeviceId", Tag=1, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="BLTDevIK", Tag=2, Type=typing.Optional[bytes]), + ClusterObjectFieldDescriptor(Label="timeOfMeasurement", Tag=3, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="distance", Tag=4, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="accuracy", Tag=5, Type=typing.Optional[int]), + ClusterObjectFieldDescriptor(Label="rdr", Tag=6, Type=typing.Optional[ProximityRanging.Structs.RDRStruct]), + ClusterObjectFieldDescriptor(Label="rssi", Tag=7, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="txPower", Tag=8, Type=typing.Union[None, Nullable, int]), + ]) + + wiFiDevIK: 'typing.Optional[bytes]' = None + BLEDeviceId: 'typing.Optional[uint]' = None + BLTDevIK: 'typing.Optional[bytes]' = None + timeOfMeasurement: 'typing.Optional[uint]' = None + distance: 'typing.Union[Nullable, uint]' = NullValue + accuracy: 'typing.Optional[int]' = None + rdr: 'typing.Optional[ProximityRanging.Structs.RDRStruct]' = None + rssi: 'typing.Union[None, Nullable, int]' = None + txPower: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class BLERangingDeviceRoleConfigStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="role", Tag=0, Type=ProximityRanging.Enums.RangingRoleEnum), + ClusterObjectFieldDescriptor(Label="peerBLEDeviceID", Tag=1, Type=uint), + ]) + + role: 'ProximityRanging.Enums.RangingRoleEnum' = 0 + peerBLEDeviceID: 'uint' = 0 + + @dataclass + class BLTChannelSoundingDeviceRoleConfigStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="role", Tag=0, Type=ProximityRanging.Enums.RangingRoleEnum), + ClusterObjectFieldDescriptor(Label="peerBLTDevIK", Tag=1, Type=bytes), + ClusterObjectFieldDescriptor(Label="ltk", Tag=2, Type=typing.Optional[bytes]), + ]) + + role: 'ProximityRanging.Enums.RangingRoleEnum' = 0 + peerBLTDevIK: 'bytes' = b"" + ltk: 'typing.Optional[bytes]' = None + + @dataclass + class RangingCapabilitiesStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="technology", Tag=0, Type=ProximityRanging.Enums.RangingTechEnum), + ClusterObjectFieldDescriptor(Label="frequencyBand", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="periodicRangingSupport", Tag=2, Type=bool), + ]) + + technology: 'ProximityRanging.Enums.RangingTechEnum' = 0 + frequencyBand: 'uint' = 0 + periodicRangingSupport: 'bool' = False + + @dataclass + class RangingTriggerConditionStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="startTime", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="endTime", Tag=1, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="rangingInstanceInterval", Tag=2, Type=typing.Optional[uint]), + ]) + + startTime: 'uint' = 0 + endTime: 'typing.Optional[uint]' = None + rangingInstanceInterval: 'typing.Optional[uint]' = None + + @dataclass + class ReportingConditionStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="minDistanceCondition", Tag=0, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="maxDistanceCondition", Tag=1, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="accuracyCondition", Tag=2, Type=typing.Optional[uint]), + ]) + + minDistanceCondition: 'typing.Optional[uint]' = None + maxDistanceCondition: 'typing.Optional[uint]' = None + accuracyCondition: 'typing.Optional[uint]' = None + + @dataclass + class WiFiRangingDeviceRoleConfigStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="role", Tag=0, Type=ProximityRanging.Enums.RangingRoleEnum), + ClusterObjectFieldDescriptor(Label="peerWiFiDevIK", Tag=1, Type=bytes), + ClusterObjectFieldDescriptor(Label="pmk", Tag=2, Type=typing.Optional[bytes]), + ]) + + role: 'ProximityRanging.Enums.RangingRoleEnum' = 0 + peerWiFiDevIK: 'bytes' = b"" + pmk: 'typing.Optional[bytes]' = None + + class Commands: + @dataclass + class StartRangingRequest(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000433 + command_id: typing.ClassVar[int] = 0x00000000 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = 'StartRangingResponse' + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="technology", Tag=0, Type=ProximityRanging.Enums.RangingTechEnum), + ClusterObjectFieldDescriptor(Label="wiFiRangingDeviceRoleConfig", Tag=1, Type=typing.Optional[ProximityRanging.Structs.WiFiRangingDeviceRoleConfigStruct]), + ClusterObjectFieldDescriptor(Label="BLERangingDeviceRoleConfig", Tag=2, Type=typing.Optional[ProximityRanging.Structs.BLERangingDeviceRoleConfigStruct]), + ClusterObjectFieldDescriptor(Label="BLTChannelSoundingDeviceRoleConfig", Tag=3, Type=typing.Optional[ProximityRanging.Structs.BLTChannelSoundingDeviceRoleConfigStruct]), + ClusterObjectFieldDescriptor(Label="frequencyBand", Tag=4, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="bandwidth", Tag=5, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="securityMode", Tag=6, Type=ProximityRanging.Enums.RangingSecurityEnum), + ClusterObjectFieldDescriptor(Label="trigger", Tag=7, Type=ProximityRanging.Structs.RangingTriggerConditionStruct), + ClusterObjectFieldDescriptor(Label="reportingCondition", Tag=8, Type=typing.Optional[ProximityRanging.Structs.ReportingConditionStruct]), + ]) + + technology: ProximityRanging.Enums.RangingTechEnum = 0 + wiFiRangingDeviceRoleConfig: typing.Optional[ProximityRanging.Structs.WiFiRangingDeviceRoleConfigStruct] = None + BLERangingDeviceRoleConfig: typing.Optional[ProximityRanging.Structs.BLERangingDeviceRoleConfigStruct] = None + BLTChannelSoundingDeviceRoleConfig: typing.Optional[ProximityRanging.Structs.BLTChannelSoundingDeviceRoleConfigStruct] = None + frequencyBand: typing.Optional[uint] = None + bandwidth: typing.Optional[uint] = None + securityMode: ProximityRanging.Enums.RangingSecurityEnum = 0 + trigger: ProximityRanging.Structs.RangingTriggerConditionStruct = field(default_factory=lambda: ProximityRanging.Structs.RangingTriggerConditionStruct()) + reportingCondition: typing.Optional[ProximityRanging.Structs.ReportingConditionStruct] = None + + @dataclass + class StartRangingResponse(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000433 + command_id: typing.ClassVar[int] = 0x00000001 + is_client: typing.ClassVar[bool] = False + response_type: typing.ClassVar[typing.Optional[str]] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="resultCode", Tag=0, Type=ProximityRanging.Enums.ResultCodeEnum), + ClusterObjectFieldDescriptor(Label="sessionID", Tag=1, Type=typing.Union[Nullable, uint]), + ]) + + resultCode: ProximityRanging.Enums.ResultCodeEnum = 0 + sessionID: typing.Union[Nullable, uint] = NullValue + + @dataclass + class StopRangingRequest(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000433 + command_id: typing.ClassVar[int] = 0x00000002 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[typing.Optional[str]] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="sessionID", Tag=0, Type=uint), + ]) + + sessionID: uint = 0 + + @dataclass + class RangingResult(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000433 + command_id: typing.ClassVar[int] = 0x00000003 + is_client: typing.ClassVar[bool] = False + response_type: typing.ClassVar[typing.Optional[str]] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="sessionID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="rangingResultData", Tag=1, Type=ProximityRanging.Structs.RangingMeasurementDataStruct), + ]) + + sessionID: uint = 0 + rangingResultData: ProximityRanging.Structs.RangingMeasurementDataStruct = field(default_factory=lambda: ProximityRanging.Structs.RangingMeasurementDataStruct()) + + class Attributes: + @dataclass + class RangingCapabilities(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[ProximityRanging.Structs.RangingCapabilitiesStruct]) + + value: typing.List[ProximityRanging.Structs.RangingCapabilitiesStruct] = field(default_factory=lambda: []) + + @dataclass + class WiFiDevIK(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[bytes]) + + value: typing.Optional[bytes] = None + + @dataclass + class BLEDeviceId(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: typing.Optional[uint] = None + + @dataclass + class BLTDevIK(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[bytes]) + + value: typing.Optional[bytes] = None + + @dataclass + class SessionIDs(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000004 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, typing.List[uint]]) + + value: typing.Union[Nullable, typing.List[uint]] = NullValue + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF8 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: typing.List[uint] = field(default_factory=lambda: []) + + @dataclass + class AcceptedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF9 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: typing.List[uint] = field(default_factory=lambda: []) + + @dataclass + class AttributeList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFB + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: typing.List[uint] = field(default_factory=lambda: []) + + @dataclass + class FeatureMap(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFC + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: uint = 0 + + @dataclass + class ClusterRevision(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: uint = 0 + + @dataclass class WiFiNetworkManagement(Cluster): id: typing.ClassVar[int] = 0x00000451 diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 75c53e5ae12bb2..d8a2b39df67d50 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -5422,6 +5422,46 @@ static BOOL AttributeIsSpecifiedInAmbientContextSensingCluster(AttributeId aAttr } } } +static BOOL AttributeIsSpecifiedInProximityRangingCluster(AttributeId aAttributeId) +{ + using namespace Clusters::ProximityRanging; + switch (aAttributeId) { + case Attributes::RangingCapabilities::Id: { + return YES; + } + case Attributes::WiFiDevIK::Id: { + return YES; + } + case Attributes::BLEDeviceId::Id: { + return YES; + } + case Attributes::BLTDevIK::Id: { + return YES; + } + case Attributes::SessionIDs::Id: { + return YES; + } + case Attributes::GeneratedCommandList::Id: { + return YES; + } + case Attributes::AcceptedCommandList::Id: { + return YES; + } + case Attributes::AttributeList::Id: { + return YES; + } + case Attributes::FeatureMap::Id: { + return YES; + } + case Attributes::ClusterRevision::Id: { + return YES; + } + default: { + // Not a known ProximityRanging attribute. + return NO; + } + } +} static BOOL AttributeIsSpecifiedInWiFiNetworkManagementCluster(AttributeId aAttributeId) { using namespace Clusters::WiFiNetworkManagement; @@ -7405,6 +7445,9 @@ BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) case Clusters::AmbientContextSensing::Id: { return AttributeIsSpecifiedInAmbientContextSensingCluster(aAttributeId); } + case Clusters::ProximityRanging::Id: { + return AttributeIsSpecifiedInProximityRangingCluster(aAttributeId); + } case Clusters::WiFiNetworkManagement::Id: { return AttributeIsSpecifiedInWiFiNetworkManagementCluster(aAttributeId); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 64c77dd503d656..6f0a323c0680d7 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -16834,6 +16834,111 @@ static id _Nullable DecodeAttributeValueForAmbientContextSensingCluster(Attribut *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } +static id _Nullable DecodeAttributeValueForProximityRangingCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ProximityRanging; + switch (aAttributeId) { + case Attributes::RangingCapabilities::Id: { + using TypeInfo = Attributes::RangingCapabilities::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRProximityRangingClusterRangingCapabilitiesStruct * newElement_0; + newElement_0 = [MTRProximityRangingClusterRangingCapabilitiesStruct new]; + newElement_0.technology = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.technology)]; + newElement_0.frequencyBand = [NSNumber numberWithUnsignedShort:entry_0.frequencyBand.Raw()]; + newElement_0.periodicRangingSupport = [NSNumber numberWithBool:entry_0.periodicRangingSupport]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::WiFiDevIK::Id: { + using TypeInfo = Attributes::WiFiDevIK::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSData * _Nonnull value; + value = AsData(cppValue); + return value; + } + case Attributes::BLEDeviceId::Id: { + using TypeInfo = Attributes::BLEDeviceId::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::BLTDevIK::Id: { + using TypeInfo = Attributes::BLTDevIK::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSData * _Nonnull value; + value = AsData(cppValue); + return value; + } + case Attributes::SessionIDs::Id: { + using TypeInfo = Attributes::SessionIDs::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + { // Scope for our temporary variables + auto * array_1 = [NSMutableArray new]; + auto iter_1 = cppValue.Value().begin(); + while (iter_1.Next()) { + auto & entry_1 = iter_1.GetValue(); + NSNumber * newElement_1; + newElement_1 = [NSNumber numberWithUnsignedChar:entry_1]; + [array_1 addObject:newElement_1]; + } + CHIP_ERROR err = iter_1.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_1; + } + } + return value; + } + default: { + // Not a known ProximityRanging attribute. + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} static id _Nullable DecodeAttributeValueForWiFiNetworkManagementCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::WiFiNetworkManagement; @@ -23956,6 +24061,9 @@ id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::T case Clusters::AmbientContextSensing::Id: { return DecodeAttributeValueForAmbientContextSensingCluster(aPath.mAttributeId, aReader, aError); } + case Clusters::ProximityRanging::Id: { + return DecodeAttributeValueForProximityRangingCluster(aPath.mAttributeId, aReader, aError); + } case Clusters::WiFiNetworkManagement::Id: { return DecodeAttributeValueForWiFiNetworkManagementCluster(aPath.mAttributeId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index ddf8d5ce28a747..33f2c1dc71c0f7 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -13113,6 +13113,104 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Proximity Ranging + * + * This cluster enables the configuration of proximity ranging sessions and reporting of proximity ranging data. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterProximityRanging : MTRGenericBaseCluster + +/** + * Command StartRangingRequest + * + * This command allows the client to request the start of a ranging session. + */ +- (void)startRangingRequestWithParams:(MTRProximityRangingClusterStartRangingRequestParams *)params completion:(void (^)(MTRProximityRangingClusterStartRangingResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command StopRangingRequest + * + * Upon receipt of a StopRangingRequest command that contains a SessionID that matches an active ranging session, the server SHALL terminate the corresponding ranging session. + */ +- (void)stopRangingRequestWithParams:(MTRProximityRangingClusterStopRangingRequestParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeRangingCapabilitiesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeRangingCapabilitiesWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeRangingCapabilitiesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeWiFiDevIKWithCompletion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeWiFiDevIKWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSData * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeWiFiDevIKWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeBLEDeviceIdWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeBLEDeviceIdWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeBLEDeviceIdWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeBLTDevIKWithCompletion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeBLTDevIKWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSData * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeBLTDevIKWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeSessionIDsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeSessionIDsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeSessionIDsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRBaseClusterProximityRanging (Availability) + +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Wi-Fi Network Management * @@ -21867,6 +21965,65 @@ typedef NS_OPTIONS(uint32_t, MTRAmbientContextSensingFeature) { MTRAmbientContextSensingFeaturePredictedActivity MTR_PROVISIONALLY_AVAILABLE = 0x10, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint8_t, MTRProximityRangingRangingRole) { + MTRProximityRangingRangingRoleWiFiSubscriberRole MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRProximityRangingRangingRoleWiFiPublisherRole MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRProximityRangingRangingRoleBLEScanningRole MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRProximityRangingRangingRoleBLEBeaconRole MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRProximityRangingRangingRoleBLTInitiatorRole MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTRProximityRangingRangingRoleBLTReflectorRole MTR_PROVISIONALLY_AVAILABLE = 0x05, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRProximityRangingRangingSecurity) { + MTRProximityRangingRangingSecuritySecureRanging MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRProximityRangingRangingSecurityOpenRanging MTR_PROVISIONALLY_AVAILABLE = 0x01, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRProximityRangingRangingTech) { + MTRProximityRangingRangingTechBluetoothChannelSounding MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRProximityRangingRangingTechWiFiRoundTripTimeRanging MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRProximityRangingRangingTechWiFiNextGenerationRanging MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRProximityRangingRangingTechBLEBeaconRSSIRanging MTR_PROVISIONALLY_AVAILABLE = 0x03, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRProximityRangingResultCode) { + MTRProximityRangingResultCodeAccepted MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRProximityRangingResultCodeRejectedInfeasibleRanging MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRProximityRangingResultCodeRejectedInfeasibleRangingTriggers MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRProximityRangingResultCodeBusySessionCapacityReached MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRProximityRangingResultCodeBusyTryAgainLater MTR_PROVISIONALLY_AVAILABLE = 0x04, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint32_t, MTRProximityRangingFeature) { + MTRProximityRangingFeatureWiFiUSDProximityDetection MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRProximityRangingFeatureBluetoothChannelSounding MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRProximityRangingFeatureBLEBeaconRSSI MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRProximityRangingFeatureUWBRanging MTR_PROVISIONALLY_AVAILABLE = 0x8, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint16_t, MTRProximityRangingRadioBandBitmap) { + MTRProximityRangingRadioBandBitmap2G4 MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRProximityRangingRadioBandBitmap3G65 MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRProximityRangingRadioBandBitmap5G MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRProximityRangingRadioBandBitmap6G MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTRProximityRangingRadioBandBitmap60G MTR_PROVISIONALLY_AVAILABLE = 0x10, + MTRProximityRangingRadioBandBitmap1G MTR_PROVISIONALLY_AVAILABLE = 0x20, + MTRProximityRangingRadioBandBitmap45G MTR_PROVISIONALLY_AVAILABLE = 0x40, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint32_t, MTRProximityRangingRangingBandwidthBitmap) { + MTRProximityRangingRangingBandwidthBitmap1MHz MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRProximityRangingRangingBandwidthBitmap2MHz MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRProximityRangingRangingBandwidthBitmap4MHz MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRProximityRangingRangingBandwidthBitmap8MHz MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTRProximityRangingRangingBandwidthBitmap16MHz MTR_PROVISIONALLY_AVAILABLE = 0x10, + MTRProximityRangingRangingBandwidthBitmap20MHz MTR_PROVISIONALLY_AVAILABLE = 0x20, + MTRProximityRangingRangingBandwidthBitmap40MHz MTR_PROVISIONALLY_AVAILABLE = 0x40, + MTRProximityRangingRangingBandwidthBitmap80MHz MTR_PROVISIONALLY_AVAILABLE = 0x80, + MTRProximityRangingRangingBandwidthBitmap160MHz MTR_PROVISIONALLY_AVAILABLE = 0x100, + MTRProximityRangingRangingBandwidthBitmap320MHz MTR_PROVISIONALLY_AVAILABLE = 0x200, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_OPTIONS(uint32_t, MTRThreadBorderRouterManagementFeature) { MTRThreadBorderRouterManagementFeaturePANChange MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x1, } MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 2a55d47e5c617e..8deaa2246e84fe 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -90603,6 +90603,419 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end +@implementation MTRBaseClusterProximityRanging + +- (void)startRangingRequestWithParams:(MTRProximityRangingClusterStartRangingRequestParams *)params completion:(void (^)(MTRProximityRangingClusterStartRangingResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRProximityRangingClusterStartRangingRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ProximityRanging::Commands::StartRangingRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRProximityRangingClusterStartRangingResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)stopRangingRequestWithParams:(MTRProximityRangingClusterStopRangingRequestParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRProximityRangingClusterStopRangingRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ProximityRanging::Commands::StopRangingRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)readAttributeRangingCapabilitiesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::RangingCapabilities::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeRangingCapabilitiesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ProximityRanging::Attributes::RangingCapabilities::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeRangingCapabilitiesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::RangingCapabilities::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeWiFiDevIKWithCompletion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::WiFiDevIK::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeWiFiDevIKWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSData * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ProximityRanging::Attributes::WiFiDevIK::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeWiFiDevIKWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::WiFiDevIK::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeBLEDeviceIdWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::BLEDeviceId::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeBLEDeviceIdWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ProximityRanging::Attributes::BLEDeviceId::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeBLEDeviceIdWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::BLEDeviceId::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeBLTDevIKWithCompletion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::BLTDevIK::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeBLTDevIKWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSData * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ProximityRanging::Attributes::BLTDevIK::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeBLTDevIKWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::BLTDevIK::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeSessionIDsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::SessionIDs::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeSessionIDsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ProximityRanging::Attributes::SessionIDs::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeSessionIDsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::SessionIDs::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::GeneratedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ProximityRanging::Attributes::GeneratedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::GeneratedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::AcceptedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ProximityRanging::Attributes::AcceptedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::AcceptedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ProximityRanging::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::AttributeList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::FeatureMap::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ProximityRanging::Attributes::FeatureMap::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::FeatureMap::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::ClusterRevision::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ProximityRanging::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ProximityRanging::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +@end + @implementation MTRBaseClusterWiFiNetworkManagement - (void)networkPassphraseRequestWithCompletion:(void (^)(MTRWiFiNetworkManagementClusterNetworkPassphraseResponseParams * _Nullable data, NSError * _Nullable error))completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 59d9502b86d12d..fe9599fecb43e6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -187,6 +187,7 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterIDTypeRadonConcentrationMeasurementID MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x0000042F, MTRClusterIDTypeSoilMeasurementID MTR_PROVISIONALLY_AVAILABLE = 0x00000430, MTRClusterIDTypeAmbientContextSensingID MTR_PROVISIONALLY_AVAILABLE = 0x00000431, + MTRClusterIDTypeProximityRangingID MTR_PROVISIONALLY_AVAILABLE = 0x00000433, MTRClusterIDTypeWiFiNetworkManagementID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000451, MTRClusterIDTypeThreadBorderRouterManagementID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000452, MTRClusterIDTypeThreadNetworkDirectoryID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000453, @@ -3528,6 +3529,18 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterAmbientContextSensingAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, MTRAttributeIDTypeClusterAmbientContextSensingAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster ProximityRanging attributes + MTRAttributeIDTypeClusterProximityRangingAttributeRangingCapabilitiesID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterProximityRangingAttributeWiFiDevIKID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterProximityRangingAttributeBLEDeviceIdID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterProximityRangingAttributeBLTDevIKID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRAttributeIDTypeClusterProximityRangingAttributeSessionIDsID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, + MTRAttributeIDTypeClusterProximityRangingAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterProximityRangingAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterProximityRangingAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterProximityRangingAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterProximityRangingAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster WiFiNetworkManagement attributes MTRAttributeIDTypeClusterWiFiNetworkManagementAttributeSSIDID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000000, MTRAttributeIDTypeClusterWiFiNetworkManagementAttributePassphraseSurrogateID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000001, @@ -6010,6 +6023,12 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterColorControlCommandMoveColorTemperatureID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x0000004B, MTRCommandIDTypeClusterColorControlCommandStepColorTemperatureID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x0000004C, + // Cluster ProximityRanging commands + MTRCommandIDTypeClusterProximityRangingCommandStartRangingRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRCommandIDTypeClusterProximityRangingCommandStartRangingResponseID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRCommandIDTypeClusterProximityRangingCommandStopRangingRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRCommandIDTypeClusterProximityRangingCommandRangingResultID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + // Cluster WiFiNetworkManagement commands MTRCommandIDTypeClusterWiFiNetworkManagementCommandNetworkPassphraseRequestID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000000, MTRCommandIDTypeClusterWiFiNetworkManagementCommandNetworkPassphraseResponseID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000001, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index 3b211181f4bdd1..d7761d7ec6de47 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -339,6 +339,9 @@ case MTRClusterIDTypeAmbientContextSensingID: result = @"AmbientContextSensing"; break; + case MTRClusterIDTypeProximityRangingID: + result = @"ProximityRanging"; + break; case MTRClusterIDTypeWiFiNetworkManagementID: result = @"WiFiNetworkManagement"; break; @@ -7521,6 +7524,58 @@ } break; + case MTRClusterIDTypeProximityRangingID: + + switch (attributeID) { + + // Cluster ProximityRanging attributes + case MTRAttributeIDTypeClusterProximityRangingAttributeRangingCapabilitiesID: + result = @"RangingCapabilities"; + break; + + case MTRAttributeIDTypeClusterProximityRangingAttributeWiFiDevIKID: + result = @"WiFiDevIK"; + break; + + case MTRAttributeIDTypeClusterProximityRangingAttributeBLEDeviceIdID: + result = @"BLEDeviceId"; + break; + + case MTRAttributeIDTypeClusterProximityRangingAttributeBLTDevIKID: + result = @"BLTDevIK"; + break; + + case MTRAttributeIDTypeClusterProximityRangingAttributeSessionIDsID: + result = @"SessionIDs"; + break; + + case MTRAttributeIDTypeClusterProximityRangingAttributeGeneratedCommandListID: + result = @"GeneratedCommandList"; + break; + + case MTRAttributeIDTypeClusterProximityRangingAttributeAcceptedCommandListID: + result = @"AcceptedCommandList"; + break; + + case MTRAttributeIDTypeClusterProximityRangingAttributeAttributeListID: + result = @"AttributeList"; + break; + + case MTRAttributeIDTypeClusterProximityRangingAttributeFeatureMapID: + result = @"FeatureMap"; + break; + + case MTRAttributeIDTypeClusterProximityRangingAttributeClusterRevisionID: + result = @"ClusterRevision"; + break; + + default: + // Not a known ProximityRanging attribute. + result = [NSString stringWithFormat:@"", attributeID]; + break; + } + break; + case MTRClusterIDTypeWiFiNetworkManagementID: switch (attributeID) { @@ -11629,6 +11684,24 @@ } break; + case MTRClusterIDTypeProximityRangingID: + + switch (commandID) { + + case MTRCommandIDTypeClusterProximityRangingCommandStartRangingRequestID: + result = @"StartRangingRequest"; + break; + + case MTRCommandIDTypeClusterProximityRangingCommandStopRangingRequestID: + result = @"StopRangingRequest"; + break; + + default: + result = [NSString stringWithFormat:@"", commandID]; + break; + } + break; + case MTRClusterIDTypeWiFiNetworkManagementID: switch (commandID) { @@ -13969,6 +14042,24 @@ } break; + case MTRClusterIDTypeProximityRangingID: + + switch (commandID) { + + case MTRCommandIDTypeClusterProximityRangingCommandStartRangingResponseID: + result = @"StartRangingResponse"; + break; + + case MTRCommandIDTypeClusterProximityRangingCommandRangingResultID: + result = @"RangingResult"; + break; + + default: + result = [NSString stringWithFormat:@"", commandID]; + break; + } + break; + case MTRClusterIDTypeWiFiNetworkManagementID: switch (commandID) { @@ -16123,6 +16214,16 @@ } break; + case MTRClusterIDTypeProximityRangingID: + + switch (eventID) { + + default: + result = [NSString stringWithFormat:@"", eventID]; + break; + } + break; + case MTRClusterIDTypeWiFiNetworkManagementID: switch (eventID) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index e738b894dd6395..f6f8c60aa576b6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -6103,6 +6103,53 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Proximity Ranging + * This cluster enables the configuration of proximity ranging sessions and reporting of proximity ranging data. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterProximityRanging : MTRGenericCluster + +- (void)startRangingRequestWithParams:(MTRProximityRangingClusterStartRangingRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRProximityRangingClusterStartRangingResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)stopRangingRequestWithParams:(MTRProximityRangingClusterStopRangingRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeRangingCapabilitiesWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeWiFiDevIKWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeBLEDeviceIdWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeBLTDevIKWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeSessionIDsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRClusterProximityRanging (Availability) + +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Wi-Fi Network Management * Functionality to retrieve operational information about a managed Wi-Fi network. diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index d0d630f4884d90..4c665ff10720c9 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -16728,6 +16728,114 @@ - (void)writeAttributeHoldTimeWithValue:(NSDictionary *)dataValu @end +@implementation MTRClusterProximityRanging + +- (void)startRangingRequestWithParams:(MTRProximityRangingClusterStartRangingRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRProximityRangingClusterStartRangingResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRProximityRangingClusterStartRangingRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ProximityRanging::Commands::StartRangingRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRProximityRangingClusterStartRangingResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)stopRangingRequestWithParams:(MTRProximityRangingClusterStopRangingRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRProximityRangingClusterStopRangingRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ProximityRanging::Commands::StopRangingRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (NSDictionary * _Nullable)readAttributeRangingCapabilitiesWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeProximityRangingID) attributeID:@(MTRAttributeIDTypeClusterProximityRangingAttributeRangingCapabilitiesID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeWiFiDevIKWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeProximityRangingID) attributeID:@(MTRAttributeIDTypeClusterProximityRangingAttributeWiFiDevIKID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeBLEDeviceIdWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeProximityRangingID) attributeID:@(MTRAttributeIDTypeClusterProximityRangingAttributeBLEDeviceIdID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeBLTDevIKWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeProximityRangingID) attributeID:@(MTRAttributeIDTypeClusterProximityRangingAttributeBLTDevIKID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeSessionIDsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeProximityRangingID) attributeID:@(MTRAttributeIDTypeClusterProximityRangingAttributeSessionIDsID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeProximityRangingID) attributeID:@(MTRAttributeIDTypeClusterProximityRangingAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeProximityRangingID) attributeID:@(MTRAttributeIDTypeClusterProximityRangingAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeProximityRangingID) attributeID:@(MTRAttributeIDTypeClusterProximityRangingAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeProximityRangingID) attributeID:@(MTRAttributeIDTypeClusterProximityRangingAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeProximityRangingID) attributeID:@(MTRAttributeIDTypeClusterProximityRangingAttributeClusterRevisionID) params:params]; +} + +@end + @implementation MTRClusterWiFiNetworkManagement - (void)networkPassphraseRequestWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTRWiFiNetworkManagementClusterNetworkPassphraseResponseParams * _Nullable data, NSError * _Nullable error))completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 0bc17e0e129d13..61854ff74cba1a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -9155,6 +9155,124 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterStartRangingRequestParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull technology MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) MTRProximityRangingClusterWiFiRangingDeviceRoleConfigStruct * _Nullable wiFiRangingDeviceRoleConfig MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) MTRProximityRangingClusterBLERangingDeviceRoleConfigStruct * _Nullable bleRangingDeviceRoleConfig MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) MTRProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct * _Nullable bltChannelSoundingDeviceRoleConfig MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable frequencyBand MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable bandwidth MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nonnull securityMode MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) MTRProximityRangingClusterRangingTriggerConditionStruct * _Nonnull trigger MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) MTRProximityRangingClusterReportingConditionStruct * _Nullable reportingCondition MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the server to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterStartRangingResponseParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull resultCode MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable sessionID MTR_PROVISIONALLY_AVAILABLE; + +/** + * Initialize an MTRProximityRangingClusterStartRangingResponseParams with a response-value dictionary + * of the sort that MTRDeviceResponseHandler would receive. + * + * Will return nil and hand out an error if the response-value dictionary is not + * a command data response or is not the right command response. + * + * Will return nil and hand out an error if the data response does not match the known + * schema for this command. + */ +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterStopRangingRequestParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull sessionID MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the server to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterRangingResultParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull sessionID MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) MTRProximityRangingClusterRangingMeasurementDataStruct * _Nonnull rangingResultData MTR_PROVISIONALLY_AVAILABLE; + +/** + * Initialize an MTRProximityRangingClusterRangingResultParams with a response-value dictionary + * of the sort that MTRDeviceResponseHandler would receive. + * + * Will return nil and hand out an error if the response-value dictionary is not + * a command data response or is not the right command response. + * + * Will return nil and hand out an error if the data response does not match the known + * schema for this command. + */ +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) @interface MTRWiFiNetworkManagementClusterNetworkPassphraseRequestParams : NSObject /** diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 0d21609749bef4..39c8a11903c7a5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -27027,6 +27027,512 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end +@implementation MTRProximityRangingClusterStartRangingRequestParams +- (instancetype)init +{ + if (self = [super init]) { + + _technology = @(0); + + _wiFiRangingDeviceRoleConfig = nil; + + _bleRangingDeviceRoleConfig = nil; + + _bltChannelSoundingDeviceRoleConfig = nil; + + _frequencyBand = nil; + + _bandwidth = nil; + + _securityMode = @(0); + + _trigger = [MTRProximityRangingClusterRangingTriggerConditionStruct new]; + + _reportingCondition = nil; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRProximityRangingClusterStartRangingRequestParams alloc] init]; + + other.technology = self.technology; + other.wiFiRangingDeviceRoleConfig = self.wiFiRangingDeviceRoleConfig; + other.bleRangingDeviceRoleConfig = self.bleRangingDeviceRoleConfig; + other.bltChannelSoundingDeviceRoleConfig = self.bltChannelSoundingDeviceRoleConfig; + other.frequencyBand = self.frequencyBand; + other.bandwidth = self.bandwidth; + other.securityMode = self.securityMode; + other.trigger = self.trigger; + other.reportingCondition = self.reportingCondition; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: technology:%@; wiFiRangingDeviceRoleConfig:%@; bleRangingDeviceRoleConfig:%@; bltChannelSoundingDeviceRoleConfig:%@; frequencyBand:%@; bandwidth:%@; securityMode:%@; trigger:%@; reportingCondition:%@; >", NSStringFromClass([self class]), _technology, _wiFiRangingDeviceRoleConfig, _bleRangingDeviceRoleConfig, _bltChannelSoundingDeviceRoleConfig, _frequencyBand, _bandwidth, _securityMode, _trigger, _reportingCondition]; + return descriptionString; +} + +@end + +@implementation MTRProximityRangingClusterStartRangingRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ProximityRanging::Commands::StartRangingRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.technology = static_cast>(self.technology.unsignedCharValue); + } + { + if (self.wiFiRangingDeviceRoleConfig != nil) { + auto & definedValue_0 = encodableStruct.wiFiRangingDeviceRoleConfig.Emplace(); + definedValue_0.role = static_cast>(self.wiFiRangingDeviceRoleConfig.role.unsignedCharValue); + definedValue_0.peerWiFiDevIK = AsByteSpan(self.wiFiRangingDeviceRoleConfig.peerWiFiDevIK); + if (self.wiFiRangingDeviceRoleConfig.pmk != nil) { + auto & definedValue_2 = definedValue_0.pmk.Emplace(); + definedValue_2 = AsByteSpan(self.wiFiRangingDeviceRoleConfig.pmk); + } + } + } + { + if (self.bleRangingDeviceRoleConfig != nil) { + auto & definedValue_0 = encodableStruct.BLERangingDeviceRoleConfig.Emplace(); + definedValue_0.role = static_cast>(self.bleRangingDeviceRoleConfig.role.unsignedCharValue); + definedValue_0.peerBLEDeviceID = self.bleRangingDeviceRoleConfig.peerBLEDeviceID.unsignedLongLongValue; + } + } + { + if (self.bltChannelSoundingDeviceRoleConfig != nil) { + auto & definedValue_0 = encodableStruct.BLTChannelSoundingDeviceRoleConfig.Emplace(); + definedValue_0.role = static_cast>(self.bltChannelSoundingDeviceRoleConfig.role.unsignedCharValue); + definedValue_0.peerBLTDevIK = AsByteSpan(self.bltChannelSoundingDeviceRoleConfig.peerBLTDevIK); + if (self.bltChannelSoundingDeviceRoleConfig.ltk != nil) { + auto & definedValue_2 = definedValue_0.ltk.Emplace(); + definedValue_2 = AsByteSpan(self.bltChannelSoundingDeviceRoleConfig.ltk); + } + } + } + { + if (self.frequencyBand != nil) { + auto & definedValue_0 = encodableStruct.frequencyBand.Emplace(); + definedValue_0 = static_cast>(self.frequencyBand.unsignedShortValue); + } + } + { + if (self.bandwidth != nil) { + auto & definedValue_0 = encodableStruct.bandwidth.Emplace(); + definedValue_0 = static_cast>(self.bandwidth.unsignedIntValue); + } + } + { + encodableStruct.securityMode = static_cast>(self.securityMode.unsignedCharValue); + } + { + encodableStruct.trigger.startTime = self.trigger.startTime.unsignedIntValue; + if (self.trigger.endTime != nil) { + auto & definedValue_1 = encodableStruct.trigger.endTime.Emplace(); + definedValue_1 = self.trigger.endTime.unsignedIntValue; + } + if (self.trigger.rangingInstanceInterval != nil) { + auto & definedValue_1 = encodableStruct.trigger.rangingInstanceInterval.Emplace(); + definedValue_1 = self.trigger.rangingInstanceInterval.unsignedIntValue; + } + } + { + if (self.reportingCondition != nil) { + auto & definedValue_0 = encodableStruct.reportingCondition.Emplace(); + if (self.reportingCondition.minDistanceCondition != nil) { + auto & definedValue_2 = definedValue_0.minDistanceCondition.Emplace(); + definedValue_2 = self.reportingCondition.minDistanceCondition.unsignedShortValue; + } + if (self.reportingCondition.maxDistanceCondition != nil) { + auto & definedValue_2 = definedValue_0.maxDistanceCondition.Emplace(); + definedValue_2 = self.reportingCondition.maxDistanceCondition.unsignedShortValue; + } + if (self.reportingCondition.accuracyCondition != nil) { + auto & definedValue_2 = definedValue_0.accuracyCondition.Emplace(); + definedValue_2 = self.reportingCondition.accuracyCondition.unsignedShortValue; + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRProximityRangingClusterStartRangingResponseParams +- (instancetype)init +{ + if (self = [super init]) { + + _resultCode = @(0); + + _sessionID = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRProximityRangingClusterStartRangingResponseParams alloc] init]; + + other.resultCode = self.resultCode; + other.sessionID = self.sessionID; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: resultCode:%@; sessionID:%@; >", NSStringFromClass([self class]), _resultCode, _sessionID]; + return descriptionString; +} + +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error +{ + if (!(self = [super init])) { + return nil; + } + + using DecodableType = chip::app::Clusters::ProximityRanging::Commands::StartRangingResponse::DecodableType; + chip::System::PacketBufferHandle buffer = [MTRBaseDevice _responseDataForCommand:responseValue + clusterID:DecodableType::GetClusterId() + commandID:DecodableType::GetCommandId() + error:error]; + if (buffer.IsNull()) { + return nil; + } + + chip::TLV::TLVReader reader; + reader.Init(buffer->Start(), buffer->DataLength()); + + CHIP_ERROR err = reader.Next(chip::TLV::AnonymousTag()); + if (err == CHIP_NO_ERROR) { + DecodableType decodedStruct; + err = chip::app::DataModel::Decode(reader, decodedStruct); + if (err == CHIP_NO_ERROR) { + err = [self _setFieldsFromDecodableStruct:decodedStruct]; + if (err == CHIP_NO_ERROR) { + return self; + } + } + } + + LogAndConvertDecodingError(err, error); + return nil; +} + +@end + +@implementation MTRProximityRangingClusterStartRangingResponseParams (InternalMethods) + +- (nullable instancetype)initWithDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::StartRangingResponse::DecodableType &)decodableStruct +{ + if (!(self = [super init])) { + return nil; + } + + CHIP_ERROR err = [self _setFieldsFromDecodableStruct:decodableStruct]; + if (err == CHIP_NO_ERROR) { + return self; + } + + LogAndConvertDecodingError(err, nil); + return nil; +} + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::StartRangingResponse::DecodableType &)decodableStruct +{ + { + self.resultCode = [NSNumber numberWithUnsignedChar:chip::to_underlying(decodableStruct.resultCode)]; + } + { + if (decodableStruct.sessionID.IsNull()) { + self.sessionID = nil; + } else { + self.sessionID = [NSNumber numberWithUnsignedChar:decodableStruct.sessionID.Value()]; + } + } + return CHIP_NO_ERROR; +} + +@end + +@implementation MTRProximityRangingClusterStopRangingRequestParams +- (instancetype)init +{ + if (self = [super init]) { + + _sessionID = @(0); + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRProximityRangingClusterStopRangingRequestParams alloc] init]; + + other.sessionID = self.sessionID; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: sessionID:%@; >", NSStringFromClass([self class]), _sessionID]; + return descriptionString; +} + +@end + +@implementation MTRProximityRangingClusterStopRangingRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ProximityRanging::Commands::StopRangingRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.sessionID = self.sessionID.unsignedCharValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRProximityRangingClusterRangingResultParams +- (instancetype)init +{ + if (self = [super init]) { + + _sessionID = @(0); + + _rangingResultData = [MTRProximityRangingClusterRangingMeasurementDataStruct new]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRProximityRangingClusterRangingResultParams alloc] init]; + + other.sessionID = self.sessionID; + other.rangingResultData = self.rangingResultData; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: sessionID:%@; rangingResultData:%@; >", NSStringFromClass([self class]), _sessionID, _rangingResultData]; + return descriptionString; +} + +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error +{ + if (!(self = [super init])) { + return nil; + } + + using DecodableType = chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType; + chip::System::PacketBufferHandle buffer = [MTRBaseDevice _responseDataForCommand:responseValue + clusterID:DecodableType::GetClusterId() + commandID:DecodableType::GetCommandId() + error:error]; + if (buffer.IsNull()) { + return nil; + } + + chip::TLV::TLVReader reader; + reader.Init(buffer->Start(), buffer->DataLength()); + + CHIP_ERROR err = reader.Next(chip::TLV::AnonymousTag()); + if (err == CHIP_NO_ERROR) { + DecodableType decodedStruct; + err = chip::app::DataModel::Decode(reader, decodedStruct); + if (err == CHIP_NO_ERROR) { + err = [self _setFieldsFromDecodableStruct:decodedStruct]; + if (err == CHIP_NO_ERROR) { + return self; + } + } + } + + LogAndConvertDecodingError(err, error); + return nil; +} + +@end + +@implementation MTRProximityRangingClusterRangingResultParams (InternalMethods) + +- (nullable instancetype)initWithDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType &)decodableStruct +{ + if (!(self = [super init])) { + return nil; + } + + CHIP_ERROR err = [self _setFieldsFromDecodableStruct:decodableStruct]; + if (err == CHIP_NO_ERROR) { + return self; + } + + LogAndConvertDecodingError(err, nil); + return nil; +} + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType &)decodableStruct +{ + { + self.sessionID = [NSNumber numberWithUnsignedChar:decodableStruct.sessionID]; + } + { + self.rangingResultData = [MTRProximityRangingClusterRangingMeasurementDataStruct new]; + if (decodableStruct.rangingResultData.wiFiDevIK.HasValue()) { + self.rangingResultData.wiFiDevIK = AsData(decodableStruct.rangingResultData.wiFiDevIK.Value()); + } else { + self.rangingResultData.wiFiDevIK = nil; + } + if (decodableStruct.rangingResultData.BLEDeviceId.HasValue()) { + self.rangingResultData.bleDeviceId = [NSNumber numberWithUnsignedLongLong:decodableStruct.rangingResultData.BLEDeviceId.Value()]; + } else { + self.rangingResultData.bleDeviceId = nil; + } + if (decodableStruct.rangingResultData.BLTDevIK.HasValue()) { + self.rangingResultData.bltDevIK = AsData(decodableStruct.rangingResultData.BLTDevIK.Value()); + } else { + self.rangingResultData.bltDevIK = nil; + } + if (decodableStruct.rangingResultData.timeOfMeasurement.HasValue()) { + self.rangingResultData.timeOfMeasurement = [NSNumber numberWithUnsignedInt:decodableStruct.rangingResultData.timeOfMeasurement.Value()]; + } else { + self.rangingResultData.timeOfMeasurement = nil; + } + if (decodableStruct.rangingResultData.distance.IsNull()) { + self.rangingResultData.distance = nil; + } else { + self.rangingResultData.distance = [NSNumber numberWithUnsignedShort:decodableStruct.rangingResultData.distance.Value()]; + } + if (decodableStruct.rangingResultData.accuracy.HasValue()) { + self.rangingResultData.accuracy = [NSNumber numberWithShort:decodableStruct.rangingResultData.accuracy.Value()]; + } else { + self.rangingResultData.accuracy = nil; + } + if (decodableStruct.rangingResultData.rdr.HasValue()) { + self.rangingResultData.rdr = [MTRProximityRangingClusterRDRStruct new]; + self.rangingResultData.rdr.azimuth = [NSNumber numberWithUnsignedShort:decodableStruct.rangingResultData.rdr.Value().azimuth]; + self.rangingResultData.rdr.elevation = [NSNumber numberWithShort:decodableStruct.rangingResultData.rdr.Value().elevation]; + self.rangingResultData.rdr.azimuthAccuracy = [NSNumber numberWithUnsignedChar:decodableStruct.rangingResultData.rdr.Value().azimuthAccuracy]; + self.rangingResultData.rdr.elevationAccuracy = [NSNumber numberWithUnsignedChar:decodableStruct.rangingResultData.rdr.Value().elevationAccuracy]; + self.rangingResultData.rdr.reference = [NSNumber numberWithUnsignedChar:decodableStruct.rangingResultData.rdr.Value().reference]; + } else { + self.rangingResultData.rdr = nil; + } + if (decodableStruct.rangingResultData.rssi.HasValue()) { + if (decodableStruct.rangingResultData.rssi.Value().IsNull()) { + self.rangingResultData.rssi = nil; + } else { + self.rangingResultData.rssi = [NSNumber numberWithChar:decodableStruct.rangingResultData.rssi.Value().Value()]; + } + } else { + self.rangingResultData.rssi = nil; + } + if (decodableStruct.rangingResultData.txPower.HasValue()) { + if (decodableStruct.rangingResultData.txPower.Value().IsNull()) { + self.rangingResultData.txPower = nil; + } else { + self.rangingResultData.txPower = [NSNumber numberWithChar:decodableStruct.rangingResultData.txPower.Value().Value()]; + } + } else { + self.rangingResultData.txPower = nil; + } + } + return CHIP_NO_ERROR; +} + +@end + @implementation MTRWiFiNetworkManagementClusterNetworkPassphraseRequestParams - (instancetype)init { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h index be2a32eb229223..1122351a5e381a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -1770,6 +1770,32 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRProximityRangingClusterStartRangingRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRProximityRangingClusterStartRangingResponseParams (InternalMethods) + +- (nullable instancetype)initWithDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::StartRangingResponse::DecodableType &)decodableStruct; +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::StartRangingResponse::DecodableType &)decodableStruct; + +@end + +@interface MTRProximityRangingClusterStopRangingRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRProximityRangingClusterRangingResultParams (InternalMethods) + +- (nullable instancetype)initWithDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType &)decodableStruct; +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType &)decodableStruct; + +@end + @interface MTRWiFiNetworkManagementClusterNetworkPassphraseRequestParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm index 03bb701cc9f03d..0dc7378e9bc8d6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm @@ -1031,6 +1031,15 @@ static BOOL CommandNeedsTimedInvokeInAmbientContextSensingCluster(AttributeId aA } } } +static BOOL CommandNeedsTimedInvokeInProximityRangingCluster(AttributeId aAttributeId) +{ + using namespace Clusters::ProximityRanging; + switch (aAttributeId) { + default: { + return NO; + } + } +} static BOOL CommandNeedsTimedInvokeInWiFiNetworkManagementCluster(AttributeId aAttributeId) { using namespace Clusters::WiFiNetworkManagement; @@ -1704,6 +1713,9 @@ BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonn case Clusters::AmbientContextSensing::Id: { return CommandNeedsTimedInvokeInAmbientContextSensingCluster(commandID); } + case Clusters::ProximityRanging::Id: { + return CommandNeedsTimedInvokeInProximityRangingCluster(commandID); + } case Clusters::WiFiNetworkManagement::Id: { return CommandNeedsTimedInvokeInWiFiNetworkManagementCluster(commandID); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index e5aa3d689d80ea..7cb85f1caaa449 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -4912,6 +4912,19 @@ static id _Nullable DecodeEventPayloadForAmbientContextSensingCluster(EventId aE *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } +static id _Nullable DecodeEventPayloadForProximityRangingCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ProximityRanging; + switch (aEventId) { + default: { + // Not a known ProximityRanging event. + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} static id _Nullable DecodeEventPayloadForWiFiNetworkManagementCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::WiFiNetworkManagement; @@ -6180,6 +6193,9 @@ id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVRead case Clusters::AmbientContextSensing::Id: { return DecodeEventPayloadForAmbientContextSensingCluster(aPath.mEventId, aReader, aError); } + case Clusters::ProximityRanging::Id: { + return DecodeEventPayloadForProximityRangingCluster(aPath.mEventId, aReader, aError); + } case Clusters::WiFiNetworkManagement::Id: { return DecodeEventPayloadForWiFiNetworkManagementCluster(aPath.mEventId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index e1762aebf8cfd7..1d6587349548b6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -2046,6 +2046,69 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nonnull eventStartTime MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterRDRStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull azimuth MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull elevation MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull azimuthAccuracy MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull elevationAccuracy MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull reference MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterRangingMeasurementDataStruct : NSObject +@property (nonatomic, copy) NSData * _Nullable wiFiDevIK MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable bleDeviceId MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSData * _Nullable bltDevIK MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable timeOfMeasurement MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable distance MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable accuracy MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRProximityRangingClusterRDRStruct * _Nullable rdr MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable rssi MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable txPower MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterBLERangingDeviceRoleConfigStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull role MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull peerBLEDeviceID MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull role MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSData * _Nonnull peerBLTDevIK MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSData * _Nullable ltk MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterRangingCapabilitiesStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull technology MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull frequencyBand MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull periodicRangingSupport MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterRangingTriggerConditionStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull startTime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable endTime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable rangingInstanceInterval MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterReportingConditionStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nullable minDistanceCondition MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable maxDistanceCondition MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable accuracyCondition MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterWiFiRangingDeviceRoleConfigStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull role MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSData * _Nonnull peerWiFiDevIK MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSData * _Nullable pmk MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) @interface MTRThreadNetworkDirectoryClusterThreadNetworkStruct : NSObject @property (nonatomic, copy) NSData * _Nonnull extendedPanID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 32395f6c918631..95f94737690ed6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -8793,6 +8793,291 @@ - (NSString *)description @end +@implementation MTRProximityRangingClusterRDRStruct +- (instancetype)init +{ + if (self = [super init]) { + + _azimuth = @(0); + + _elevation = @(0); + + _azimuthAccuracy = @(0); + + _elevationAccuracy = @(0); + + _reference = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRProximityRangingClusterRDRStruct alloc] init]; + + other.azimuth = self.azimuth; + other.elevation = self.elevation; + other.azimuthAccuracy = self.azimuthAccuracy; + other.elevationAccuracy = self.elevationAccuracy; + other.reference = self.reference; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: azimuth:%@; elevation:%@; azimuthAccuracy:%@; elevationAccuracy:%@; reference:%@; >", NSStringFromClass([self class]), _azimuth, _elevation, _azimuthAccuracy, _elevationAccuracy, _reference]; + return descriptionString; +} + +@end + +@implementation MTRProximityRangingClusterRangingMeasurementDataStruct +- (instancetype)init +{ + if (self = [super init]) { + + _wiFiDevIK = nil; + + _bleDeviceId = nil; + + _bltDevIK = nil; + + _timeOfMeasurement = nil; + + _distance = nil; + + _accuracy = nil; + + _rdr = nil; + + _rssi = nil; + + _txPower = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRProximityRangingClusterRangingMeasurementDataStruct alloc] init]; + + other.wiFiDevIK = self.wiFiDevIK; + other.bleDeviceId = self.bleDeviceId; + other.bltDevIK = self.bltDevIK; + other.timeOfMeasurement = self.timeOfMeasurement; + other.distance = self.distance; + other.accuracy = self.accuracy; + other.rdr = self.rdr; + other.rssi = self.rssi; + other.txPower = self.txPower; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: wiFiDevIK:%@; bleDeviceId:%@; bltDevIK:%@; timeOfMeasurement:%@; distance:%@; accuracy:%@; rdr:%@; rssi:%@; txPower:%@; >", NSStringFromClass([self class]), [_wiFiDevIK base64EncodedStringWithOptions:0], _bleDeviceId, [_bltDevIK base64EncodedStringWithOptions:0], _timeOfMeasurement, _distance, _accuracy, _rdr, _rssi, _txPower]; + return descriptionString; +} + +@end + +@implementation MTRProximityRangingClusterBLERangingDeviceRoleConfigStruct +- (instancetype)init +{ + if (self = [super init]) { + + _role = @(0); + + _peerBLEDeviceID = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRProximityRangingClusterBLERangingDeviceRoleConfigStruct alloc] init]; + + other.role = self.role; + other.peerBLEDeviceID = self.peerBLEDeviceID; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: role:%@; peerBLEDeviceID:%@; >", NSStringFromClass([self class]), _role, _peerBLEDeviceID]; + return descriptionString; +} + +@end + +@implementation MTRProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct +- (instancetype)init +{ + if (self = [super init]) { + + _role = @(0); + + _peerBLTDevIK = [NSData data]; + + _ltk = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct alloc] init]; + + other.role = self.role; + other.peerBLTDevIK = self.peerBLTDevIK; + other.ltk = self.ltk; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: role:%@; peerBLTDevIK:%@; ltk:%@; >", NSStringFromClass([self class]), _role, [_peerBLTDevIK base64EncodedStringWithOptions:0], [_ltk base64EncodedStringWithOptions:0]]; + return descriptionString; +} + +@end + +@implementation MTRProximityRangingClusterRangingCapabilitiesStruct +- (instancetype)init +{ + if (self = [super init]) { + + _technology = @(0); + + _frequencyBand = @(0); + + _periodicRangingSupport = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRProximityRangingClusterRangingCapabilitiesStruct alloc] init]; + + other.technology = self.technology; + other.frequencyBand = self.frequencyBand; + other.periodicRangingSupport = self.periodicRangingSupport; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: technology:%@; frequencyBand:%@; periodicRangingSupport:%@; >", NSStringFromClass([self class]), _technology, _frequencyBand, _periodicRangingSupport]; + return descriptionString; +} + +@end + +@implementation MTRProximityRangingClusterRangingTriggerConditionStruct +- (instancetype)init +{ + if (self = [super init]) { + + _startTime = @(0); + + _endTime = nil; + + _rangingInstanceInterval = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRProximityRangingClusterRangingTriggerConditionStruct alloc] init]; + + other.startTime = self.startTime; + other.endTime = self.endTime; + other.rangingInstanceInterval = self.rangingInstanceInterval; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: startTime:%@; endTime:%@; rangingInstanceInterval:%@; >", NSStringFromClass([self class]), _startTime, _endTime, _rangingInstanceInterval]; + return descriptionString; +} + +@end + +@implementation MTRProximityRangingClusterReportingConditionStruct +- (instancetype)init +{ + if (self = [super init]) { + + _minDistanceCondition = nil; + + _maxDistanceCondition = nil; + + _accuracyCondition = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRProximityRangingClusterReportingConditionStruct alloc] init]; + + other.minDistanceCondition = self.minDistanceCondition; + other.maxDistanceCondition = self.maxDistanceCondition; + other.accuracyCondition = self.accuracyCondition; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: minDistanceCondition:%@; maxDistanceCondition:%@; accuracyCondition:%@; >", NSStringFromClass([self class]), _minDistanceCondition, _maxDistanceCondition, _accuracyCondition]; + return descriptionString; +} + +@end + +@implementation MTRProximityRangingClusterWiFiRangingDeviceRoleConfigStruct +- (instancetype)init +{ + if (self = [super init]) { + + _role = @(0); + + _peerWiFiDevIK = [NSData data]; + + _pmk = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRProximityRangingClusterWiFiRangingDeviceRoleConfigStruct alloc] init]; + + other.role = self.role; + other.peerWiFiDevIK = self.peerWiFiDevIK; + other.pmk = self.pmk; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: role:%@; peerWiFiDevIK:%@; pmk:%@; >", NSStringFromClass([self class]), _role, [_peerWiFiDevIK base64EncodedStringWithOptions:0], [_pmk base64EncodedStringWithOptions:0]]; + return descriptionString; +} + +@end + @implementation MTRThreadNetworkDirectoryClusterThreadNetworkStruct - (instancetype)init { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 12b5633b02ef30..2d53cabae5abaa 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -27685,6 +27685,247 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) } // namespace Attributes } // namespace AmbientContextSensing +namespace ProximityRanging { +namespace Attributes { + +namespace WiFiDevIK { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, chip::MutableByteSpan & value) +{ + uint8_t zclString[16 + 1]; + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ProximityRanging::Id, Id, zclString, sizeof(zclString)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + + VerifyOrReturnError(value.size() == 16, Protocols::InteractionModel::Status::InvalidDataType); + memcpy(value.data(), &zclString[1], 16); + value.reduce_size(length); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::ByteSpan value, MarkAttributeDirty markDirty) +{ + + static_assert(16 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 16, Protocols::InteractionModel::Status::ConstraintError); + uint8_t zclString[16 + 1]; + auto length = static_cast(value.size()); + Encoding::Put8(zclString, length); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ProximityRanging::Id, Id), + EmberAfWriteDataInput(zclString, ZCL_OCTET_STRING_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::ByteSpan value) +{ + + static_assert(16 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 16, Protocols::InteractionModel::Status::ConstraintError); + uint8_t zclString[16 + 1]; + auto length = static_cast(value.size()); + Encoding::Put8(zclString, length); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteAttribute(endpoint, Clusters::ProximityRanging::Id, Id, zclString, ZCL_OCTET_STRING_ATTRIBUTE_TYPE); +} + +} // namespace WiFiDevIK + +namespace BLEDeviceId { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint64_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ProximityRanging::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint64_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ProximityRanging::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT64U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint64_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ProximityRanging::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE); +} + +} // namespace BLEDeviceId + +namespace BLTDevIK { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, chip::MutableByteSpan & value) +{ + uint8_t zclString[16 + 1]; + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ProximityRanging::Id, Id, zclString, sizeof(zclString)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + + VerifyOrReturnError(value.size() == 16, Protocols::InteractionModel::Status::InvalidDataType); + memcpy(value.data(), &zclString[1], 16); + value.reduce_size(length); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::ByteSpan value, MarkAttributeDirty markDirty) +{ + + static_assert(16 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 16, Protocols::InteractionModel::Status::ConstraintError); + uint8_t zclString[16 + 1]; + auto length = static_cast(value.size()); + Encoding::Put8(zclString, length); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ProximityRanging::Id, Id), + EmberAfWriteDataInput(zclString, ZCL_OCTET_STRING_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::ByteSpan value) +{ + + static_assert(16 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 16, Protocols::InteractionModel::Status::ConstraintError); + uint8_t zclString[16 + 1]; + auto length = static_cast(value.size()); + Encoding::Put8(zclString, length); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteAttribute(endpoint, Clusters::ProximityRanging::Id, Id, zclString, ZCL_OCTET_STRING_ATTRIBUTE_TYPE); +} + +} // namespace BLTDevIK + +namespace FeatureMap { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ProximityRanging::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ProximityRanging::Id, Id), + EmberAfWriteDataInput(writable, ZCL_BITMAP32_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ProximityRanging::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +} // namespace FeatureMap + +namespace ClusterRevision { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ProximityRanging::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ProximityRanging::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT16U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ProximityRanging::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ProximityRanging + namespace WiFiNetworkManagement { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index f5e61e7ceb473a..aacbb11e10a028 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -4402,6 +4402,42 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, Mar } // namespace Attributes } // namespace AmbientContextSensing +namespace ProximityRanging { +namespace Attributes { + +namespace WiFiDevIK { +Protocols::InteractionModel::Status Get(EndpointId endpoint, chip::MutableByteSpan & value); // octet_string +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::ByteSpan value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::ByteSpan value, MarkAttributeDirty markDirty); +} // namespace WiFiDevIK + +namespace BLEDeviceId { +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint64_t * value); // int64u +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint64_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint64_t value, MarkAttributeDirty markDirty); +} // namespace BLEDeviceId + +namespace BLTDevIK { +Protocols::InteractionModel::Status Get(EndpointId endpoint, chip::MutableByteSpan & value); // octet_string +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::ByteSpan value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::ByteSpan value, MarkAttributeDirty markDirty); +} // namespace BLTDevIK + +namespace FeatureMap { +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value); // bitmap32 +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +} // namespace FeatureMap + +namespace ClusterRevision { +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ProximityRanging + namespace WiFiNetworkManagement { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index 3644a1d0cd78a2..f61d9ab0c77a1d 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -1104,6 +1104,16 @@ void emberAfAmbientContextSensingClusterInitCallback(chip::EndpointId endpoint); */ void emberAfAmbientContextSensingClusterShutdownCallback(chip::EndpointId endpoint); +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfProximityRangingClusterInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being shutdown + */ +void emberAfProximityRangingClusterShutdownCallback(chip::EndpointId endpoint); + /** * @param endpoint Endpoint that is being initialized */ @@ -5600,6 +5610,45 @@ chip::Protocols::InteractionModel::Status MatterAmbientContextSensingClusterServ */ void emberAfAmbientContextSensingClusterServerTickCallback(chip::EndpointId endpoint); +// +// Proximity Ranging Cluster +// + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfProximityRangingClusterServerInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being shutdown + */ +void MatterProximityRangingClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfProximityRangingClusterClientInitCallback(chip::EndpointId endpoint); + +/** + * @param attributePath Concrete attribute path that changed + */ +void MatterProximityRangingClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status +MatterProximityRangingClusterServerPreAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath, + EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** + * @param endpoint Endpoint that is being served + */ +void emberAfProximityRangingClusterServerTickCallback(chip::EndpointId endpoint); + // // Wi-Fi Network Management Cluster // @@ -7496,6 +7545,18 @@ bool emberAfColorControlClusterMoveColorTemperatureCallback( bool emberAfColorControlClusterStepColorTemperatureCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::ColorControl::Commands::StepColorTemperature::DecodableType & commandData); +/** + * @brief Proximity Ranging Cluster StartRangingRequest Command callback (from client) + */ +bool emberAfProximityRangingClusterStartRangingRequestCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ProximityRanging::Commands::StartRangingRequest::DecodableType & commandData); +/** + * @brief Proximity Ranging Cluster StopRangingRequest Command callback (from client) + */ +bool emberAfProximityRangingClusterStopRangingRequestCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ProximityRanging::Commands::StopRangingRequest::DecodableType & commandData); /** * @brief Channel Cluster ChangeChannel Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index 47cc7228f1b113..26d93a21738fd8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -117,6 +117,7 @@ #include #include #include +#include #include #include #include diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index f40659244aa47c..aa63fe75036bf3 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -117,6 +117,7 @@ #include #include #include +#include #include #include #include diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 8a0e79b43a22ef..9fd3a1c71b4044 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -403,6 +403,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -1231,6 +1235,13 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::ProximityRanging::Id: { + switch (aCommand) + { + default: + return false; + } + } case Clusters::WiFiNetworkManagement::Id: { switch (aCommand) { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index c4a36dad5be199..0f15aec3ce7ee1 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -403,6 +403,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 33d2e948e07ecf..30e6a96c092533 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -115,6 +115,7 @@ #include #include #include +#include #include #include #include diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h index 7e458e25b5a6bc..f9f5d227ffbdcf 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h @@ -115,6 +115,7 @@ #include #include #include +#include #include #include #include diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index 0175ac4b84b10a..33ce7f51cc5c7b 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -115,6 +115,7 @@ #include #include #include +#include #include #include #include diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h index bb7369ebf7fb49..156d696bf5d9cd 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h @@ -115,6 +115,7 @@ #include #include #include +#include #include #include #include diff --git a/zzz_generated/app-common/clusters/BUILD.gn b/zzz_generated/app-common/clusters/BUILD.gn index 58870f64bdc857..7d53706922d996 100644 --- a/zzz_generated/app-common/clusters/BUILD.gn +++ b/zzz_generated/app-common/clusters/BUILD.gn @@ -105,6 +105,7 @@ template("declare_all_items_target") { "${chip_root}/zzz_generated/app-common/clusters/PowerSourceConfiguration" + invoker.target, "${chip_root}/zzz_generated/app-common/clusters/PowerTopology" + invoker.target, "${chip_root}/zzz_generated/app-common/clusters/PressureMeasurement" + invoker.target, + "${chip_root}/zzz_generated/app-common/clusters/ProximityRanging" + invoker.target, "${chip_root}/zzz_generated/app-common/clusters/ProxyConfiguration" + invoker.target, "${chip_root}/zzz_generated/app-common/clusters/ProxyDiscovery" + invoker.target, "${chip_root}/zzz_generated/app-common/clusters/ProxyValid" + invoker.target, diff --git a/zzz_generated/app-common/clusters/MetadataQuery.h b/zzz_generated/app-common/clusters/MetadataQuery.h index 5d92e1ef4ae7dd..728b03257b83da 100644 --- a/zzz_generated/app-common/clusters/MetadataQuery.h +++ b/zzz_generated/app-common/clusters/MetadataQuery.h @@ -200,6 +200,8 @@ #include #include #include +#include +#include #include #include #include @@ -791,6 +793,11 @@ std::optional AcceptedCommandEntryFor(ClusterId if (id == PressureMeasurement::Id) return ClusterMetadataProvider::EntryFor(command); } + if constexpr (sizeof...(TClusterIds) == 0 || ((TClusterIds == ProximityRanging::Id) || ...)) + { + if (id == ProximityRanging::Id) + return ClusterMetadataProvider::EntryFor(command); + } if constexpr (sizeof...(TClusterIds) == 0 || ((TClusterIds == ProxyConfiguration::Id) || ...)) { if (id == ProxyConfiguration::Id) diff --git a/zzz_generated/app-common/clusters/ProximityRanging/AttributeIds.h b/zzz_generated/app-common/clusters/ProximityRanging/AttributeIds.h new file mode 100644 index 00000000000000..542518be6e15dc --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/AttributeIds.h @@ -0,0 +1,63 @@ +// DO NOT EDIT MANUALLY - Generated file +// +// Identifier constant values for cluster ProximityRanging (cluster code: 1075/0x433) +// based on src/controller/data_model/controller-clusters.matter +#pragma once + +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { +namespace Attributes { + +// Total number of attributes supported by the cluster, including global attributes +inline constexpr uint32_t kAttributesCount = 10; + +namespace RangingCapabilities { +inline constexpr AttributeId Id = 0x00000000; +} // namespace RangingCapabilities + +namespace WiFiDevIK { +inline constexpr AttributeId Id = 0x00000001; +} // namespace WiFiDevIK + +namespace BLEDeviceId { +inline constexpr AttributeId Id = 0x00000002; +} // namespace BLEDeviceId + +namespace BLTDevIK { +inline constexpr AttributeId Id = 0x00000003; +} // namespace BLTDevIK + +namespace SessionIDs { +inline constexpr AttributeId Id = 0x00000004; +} // namespace SessionIDs + +namespace GeneratedCommandList { +inline constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; +} // namespace GeneratedCommandList + +namespace AcceptedCommandList { +inline constexpr AttributeId Id = Globals::Attributes::AcceptedCommandList::Id; +} // namespace AcceptedCommandList + +namespace AttributeList { +inline constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; +} // namespace AttributeList + +namespace FeatureMap { +inline constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap + +namespace ClusterRevision { +inline constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Attributes.h b/zzz_generated/app-common/clusters/ProximityRanging/Attributes.h new file mode 100644 index 00000000000000..36cc412f1ae06d --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/Attributes.h @@ -0,0 +1,165 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP +// This file is generated from clusters-Attributes.h.zapt + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { +namespace Attributes { + +namespace RangingCapabilities { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::ProximityRanging::Structs::RangingCapabilitiesStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::ProximityRanging::Structs::RangingCapabilitiesStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::RangingCapabilities::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace RangingCapabilities +namespace WiFiDevIK { +struct TypeInfo +{ + using Type = chip::ByteSpan; + using DecodableType = chip::ByteSpan; + using DecodableArgType = chip::ByteSpan; + + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::WiFiDevIK::Id; } + static constexpr bool MustUseTimedWrite() { return false; } + static constexpr size_t MaxLength() { return 16; } +}; +} // namespace WiFiDevIK +namespace BLEDeviceId { +struct TypeInfo +{ + using Type = uint64_t; + using DecodableType = uint64_t; + using DecodableArgType = uint64_t; + + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::BLEDeviceId::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace BLEDeviceId +namespace BLTDevIK { +struct TypeInfo +{ + using Type = chip::ByteSpan; + using DecodableType = chip::ByteSpan; + using DecodableArgType = chip::ByteSpan; + + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::BLTDevIK::Id; } + static constexpr bool MustUseTimedWrite() { return false; } + static constexpr size_t MaxLength() { return 16; } +}; +} // namespace BLTDevIK +namespace SessionIDs { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable>; + using DecodableType = chip::app::DataModel::Nullable>; + using DecodableArgType = const chip::app::DataModel::Nullable> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::SessionIDs::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace SessionIDs +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } +}; +} // namespace AcceptedCommandList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::RangingCapabilities::TypeInfo::DecodableType rangingCapabilities; + Attributes::WiFiDevIK::TypeInfo::DecodableType wiFiDevIK; + Attributes::BLEDeviceId::TypeInfo::DecodableType BLEDeviceId = static_cast(0); + Attributes::BLTDevIK::TypeInfo::DecodableType BLTDevIK; + Attributes::SessionIDs::TypeInfo::DecodableType sessionIDs; + Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; + Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; + Attributes::AttributeList::TypeInfo::DecodableType attributeList; + Attributes::FeatureMap::TypeInfo::DecodableType featureMap = static_cast(0); + Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision = static_cast(0); + }; +}; +} // namespace Attributes +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Attributes.ipp b/zzz_generated/app-common/clusters/ProximityRanging/Attributes.ipp new file mode 100644 index 00000000000000..fc77c58a6587ad --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/Attributes.ipp @@ -0,0 +1,63 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP +// This file is generated from clusters-Attributes.ipp.zapt + +#include + +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::RangingCapabilities::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, rangingCapabilities); + case Attributes::WiFiDevIK::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, wiFiDevIK); + case Attributes::BLEDeviceId::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, BLEDeviceId); + case Attributes::BLTDevIK::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, BLTDevIK); + case Attributes::SessionIDs::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, sessionIDs); + case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, generatedCommandList); + case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, acceptedCommandList); + case Attributes::AttributeList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, attributeList); + case Attributes::FeatureMap::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, featureMap); + case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, clusterRevision); + default: + return CHIP_NO_ERROR; + } +} +} // namespace Attributes +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/BUILD.gn b/zzz_generated/app-common/clusters/ProximityRanging/BUILD.gn new file mode 100644 index 00000000000000..931362a26d88b8 --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/BUILD.gn @@ -0,0 +1,93 @@ +# DO NOT EDIT MANUALLY - Generated file +# +# Cluster generated code for constants and metadata based on src/controller/data_model/controller-clusters.matter +import("//build_overrides/chip.gni") + +source_set("ids") { + sources = [ + "AttributeIds.h", + "ClusterId.h", + "CommandIds.h", + "EventIds.h", + "Ids.h", + ] + public_deps = [ + "${chip_root}/src/app/common:global-ids", + "${chip_root}/src/lib/core:types", + ] +} + +source_set("enums") { + sources = [ + "Enums.h", + "EnumsCheck.h", + ] + public_deps = [ + "${chip_root}/zzz_generated/app-common/clusters/shared:enums", + ] +} + +source_set("headers") { + sources = [ + "Attributes.h", + "Commands.h", + "Events.h", + "Structs.h", + ] + public_deps = [ + ":enums", + ":ids", + ":metadata", + "${chip_root}/src/app:events", + "${chip_root}/src/app/common:global-ids", + "${chip_root}/zzz_generated/app-common/clusters/shared:headers", + ] + + + public_configs = [ "${chip_root}/src/app/common:includes" ] + + # Headers is a workaround for build size optmizations: what we would want is + # ":elements" to contain both headers and cpp files. However compiler seems + # to be able to optimize shared code if we place all structs in one huge + # CPP file, so "cluster-objects" contains that CPP file. + visibility = [ + ":elements", + "${chip_root}/zzz_generated/app-common/clusters:all-headers", + ] +} + +source_set("elements") { + public_deps = [ + ":headers", + ":ids", + + # NOTE: awkward dependency because cluster-objects contains ALL the cluster + # .cpp files as one compile unit to optimize for flash size during + # compilation. + # Dependency tree is as: + # - :headers (mostly private as a target) contains *.h + # - src/app/common:cluster-objects contains "*.ipp" for attrs/commands/events/structs + # - :elements makes the headers available and depends on the cluster-objects impl. + "${chip_root}/src/app/common:cluster-objects", + "${chip_root}/src/app/common:global-ids", + "${chip_root}/zzz_generated/app-common/clusters/shared:elements", + ] +} + +source_set("metadata") { + sources = [ "Metadata.h", "MetadataProvider.h"] + public_deps = [ + ":ids", + "${chip_root}/src/app/data-model-provider:metadata", + "${chip_root}/src/lib/core:types", + ] +} + +source_set("ProximityRanging") { + public_deps = [ + ":ids", + ":metadata", + ":enums", + ":elements", + ] +} diff --git a/zzz_generated/app-common/clusters/ProximityRanging/ClusterId.h b/zzz_generated/app-common/clusters/ProximityRanging/ClusterId.h new file mode 100644 index 00000000000000..d953cb1bacff4b --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/ClusterId.h @@ -0,0 +1,19 @@ +// DO NOT EDIT MANUALLY - Generated file +// +// Identifier constant values for cluster ProximityRanging (cluster code: 1075/0x433) +// based on src/controller/data_model/controller-clusters.matter +#pragma once + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { + +inline constexpr ClusterId Id = 0x00000433; + +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/CommandIds.h b/zzz_generated/app-common/clusters/ProximityRanging/CommandIds.h new file mode 100644 index 00000000000000..6bbccca6aa3893 --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/CommandIds.h @@ -0,0 +1,41 @@ +// DO NOT EDIT MANUALLY - Generated file +// +// Identifier constant values for cluster ProximityRanging (cluster code: 1075/0x433) +// based on src/controller/data_model/controller-clusters.matter +#pragma once + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { +namespace Commands { + +// Total number of client to server commands supported by the cluster +inline constexpr uint32_t kAcceptedCommandsCount = 2; + +// Total number of server to client commands supported by the cluster (response commands) +inline constexpr uint32_t kGeneratedCommandsCount = 2; + +namespace StartRangingRequest { +inline constexpr CommandId Id = 0x00000000; +} // namespace StartRangingRequest + +namespace StopRangingRequest { +inline constexpr CommandId Id = 0x00000002; +} // namespace StopRangingRequest + +namespace StartRangingResponse { +inline constexpr CommandId Id = 0x00000001; +} // namespace StartRangingResponse + +namespace RangingResult { +inline constexpr CommandId Id = 0x00000003; +} // namespace RangingResult + +} // namespace Commands +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Commands.h b/zzz_generated/app-common/clusters/ProximityRanging/Commands.h new file mode 100644 index 00000000000000..2f438f0efccf3b --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/Commands.h @@ -0,0 +1,241 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP +// This file is generated from clusters-Commands.h.zapt + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace StartRangingRequest { +struct Type; +struct DecodableType; +} // namespace StartRangingRequest + +namespace StartRangingResponse { +struct Type; +struct DecodableType; +} // namespace StartRangingResponse + +namespace StopRangingRequest { +struct Type; +struct DecodableType; +} // namespace StopRangingRequest + +namespace RangingResult { +struct Type; +struct DecodableType; +} // namespace RangingResult + +} // namespace Commands + +namespace Commands { +namespace StartRangingRequest { +enum class Fields : uint8_t +{ + kTechnology = 0, + kWiFiRangingDeviceRoleConfig = 1, + kBLERangingDeviceRoleConfig = 2, + kBLTChannelSoundingDeviceRoleConfig = 3, + kFrequencyBand = 4, + kBandwidth = 5, + kSecurityMode = 6, + kTrigger = 7, + kReportingCondition = 8, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::StartRangingRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + + RangingTechEnum technology = static_cast(0); + Optional wiFiRangingDeviceRoleConfig; + Optional BLERangingDeviceRoleConfig; + Optional BLTChannelSoundingDeviceRoleConfig; + Optional> frequencyBand; + Optional> bandwidth; + RangingSecurityEnum securityMode = static_cast(0); + Structs::RangingTriggerConditionStruct::Type trigger; + Optional reportingCondition; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = Clusters::ProximityRanging::Commands::StartRangingResponse::DecodableType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::StartRangingRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + static constexpr bool kIsFabricScoped = false; + + RangingTechEnum technology = static_cast(0); + Optional wiFiRangingDeviceRoleConfig; + Optional BLERangingDeviceRoleConfig; + Optional BLTChannelSoundingDeviceRoleConfig; + Optional> frequencyBand; + Optional> bandwidth; + RangingSecurityEnum securityMode = static_cast(0); + Structs::RangingTriggerConditionStruct::DecodableType trigger; + Optional reportingCondition; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace StartRangingRequest +namespace StartRangingResponse { +enum class Fields : uint8_t +{ + kResultCode = 0, + kSessionID = 1, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::StartRangingResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + + ResultCodeEnum resultCode = static_cast(0); + DataModel::Nullable sessionID; + + CHIP_ERROR Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::StartRangingResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + + ResultCodeEnum resultCode = static_cast(0); + DataModel::Nullable sessionID; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace StartRangingResponse +namespace StopRangingRequest { +enum class Fields : uint8_t +{ + kSessionID = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::StopRangingRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + + uint8_t sessionID = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::StopRangingRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + static constexpr bool kIsFabricScoped = false; + + uint8_t sessionID = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace StopRangingRequest +namespace RangingResult { +enum class Fields : uint8_t +{ + kSessionID = 0, + kRangingResultData = 1, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::RangingResult::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + + uint8_t sessionID = static_cast(0); + Structs::RangingMeasurementDataStruct::Type rangingResultData; + + CHIP_ERROR Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::RangingResult::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + + uint8_t sessionID = static_cast(0); + Structs::RangingMeasurementDataStruct::DecodableType rangingResultData; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace RangingResult +} // namespace Commands +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Commands.ipp b/zzz_generated/app-common/clusters/ProximityRanging/Commands.ipp new file mode 100644 index 00000000000000..95a248b5fd9ac7 --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/Commands.ipp @@ -0,0 +1,198 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP +// This file is generated from clusters-Commands.ipp.zapt + +#include + +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { +namespace Commands { +namespace StartRangingRequest { + +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kTechnology), technology); + encoder.Encode(to_underlying(Fields::kWiFiRangingDeviceRoleConfig), wiFiRangingDeviceRoleConfig); + encoder.Encode(to_underlying(Fields::kBLERangingDeviceRoleConfig), BLERangingDeviceRoleConfig); + encoder.Encode(to_underlying(Fields::kBLTChannelSoundingDeviceRoleConfig), BLTChannelSoundingDeviceRoleConfig); + encoder.Encode(to_underlying(Fields::kFrequencyBand), frequencyBand); + encoder.Encode(to_underlying(Fields::kBandwidth), bandwidth); + encoder.Encode(to_underlying(Fields::kSecurityMode), securityMode); + encoder.Encode(to_underlying(Fields::kTrigger), trigger); + encoder.Encode(to_underlying(Fields::kReportingCondition), reportingCondition); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kTechnology)) + { + err = DataModel::Decode(reader, technology); + } + else if (__context_tag == to_underlying(Fields::kWiFiRangingDeviceRoleConfig)) + { + err = DataModel::Decode(reader, wiFiRangingDeviceRoleConfig); + } + else if (__context_tag == to_underlying(Fields::kBLERangingDeviceRoleConfig)) + { + err = DataModel::Decode(reader, BLERangingDeviceRoleConfig); + } + else if (__context_tag == to_underlying(Fields::kBLTChannelSoundingDeviceRoleConfig)) + { + err = DataModel::Decode(reader, BLTChannelSoundingDeviceRoleConfig); + } + else if (__context_tag == to_underlying(Fields::kFrequencyBand)) + { + err = DataModel::Decode(reader, frequencyBand); + } + else if (__context_tag == to_underlying(Fields::kBandwidth)) + { + err = DataModel::Decode(reader, bandwidth); + } + else if (__context_tag == to_underlying(Fields::kSecurityMode)) + { + err = DataModel::Decode(reader, securityMode); + } + else if (__context_tag == to_underlying(Fields::kTrigger)) + { + err = DataModel::Decode(reader, trigger); + } + else if (__context_tag == to_underlying(Fields::kReportingCondition)) + { + err = DataModel::Decode(reader, reportingCondition); + } + + ReturnErrorOnFailure(err); + } +} +} // namespace StartRangingRequest. +namespace StartRangingResponse { + +CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kResultCode), resultCode); + encoder.Encode(to_underlying(Fields::kSessionID), sessionID); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kResultCode)) + { + err = DataModel::Decode(reader, resultCode); + } + else if (__context_tag == to_underlying(Fields::kSessionID)) + { + err = DataModel::Decode(reader, sessionID); + } + + ReturnErrorOnFailure(err); + } +} +} // namespace StartRangingResponse. +namespace StopRangingRequest { + +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kSessionID), sessionID); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kSessionID)) + { + err = DataModel::Decode(reader, sessionID); + } + + ReturnErrorOnFailure(err); + } +} +} // namespace StopRangingRequest. +namespace RangingResult { + +CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kSessionID), sessionID); + encoder.Encode(to_underlying(Fields::kRangingResultData), rangingResultData); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kSessionID)) + { + err = DataModel::Decode(reader, sessionID); + } + else if (__context_tag == to_underlying(Fields::kRangingResultData)) + { + err = DataModel::Decode(reader, rangingResultData); + } + + ReturnErrorOnFailure(err); + } +} +} // namespace RangingResult. +} // namespace Commands +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Enums.h b/zzz_generated/app-common/clusters/ProximityRanging/Enums.h new file mode 100644 index 00000000000000..c9121ee00a50f8 --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/Enums.h @@ -0,0 +1,126 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP +// This file is generated from clusters-Enums.h.zapt + +#pragma once + +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { + +// Enum for RangingRoleEnum +enum class RangingRoleEnum : uint8_t +{ + kWiFiSubscriberRole = 0x00, + kWiFiPublisherRole = 0x01, + kBLEScanningRole = 0x02, + kBLEBeaconRole = 0x03, + kBLTInitiatorRole = 0x04, + kBLTReflectorRole = 0x05, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 6, +}; + +// Enum for RangingSecurityEnum +enum class RangingSecurityEnum : uint8_t +{ + kSecureRanging = 0x00, + kOpenRanging = 0x01, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 2, +}; + +// Enum for RangingTechEnum +enum class RangingTechEnum : uint8_t +{ + kBluetoothChannelSounding = 0x00, + kWiFiRoundTripTimeRanging = 0x01, + kWiFiNextGenerationRanging = 0x02, + kBLEBeaconRSSIRanging = 0x03, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 4, +}; + +// Enum for ResultCodeEnum +enum class ResultCodeEnum : uint8_t +{ + kAccepted = 0x00, + kRejectedInfeasibleRanging = 0x01, + kRejectedInfeasibleRangingTriggers = 0x02, + kBusySessionCapacityReached = 0x03, + kBusyTryAgainLater = 0x04, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 5, +}; + +// Bitmap for Feature +enum class Feature : uint32_t +{ + kWiFiUsdProximityDetection = 0x1, + kBluetoothChannelSounding = 0x2, + kBleBeaconRssi = 0x4, + kUwbRanging = 0x8, +}; + +// Bitmap for RadioBandBitmap +enum class RadioBandBitmap : uint16_t +{ + k2g4 = 0x1, + k3g65 = 0x2, + k5g = 0x4, + k6g = 0x8, + k60g = 0x10, + k1g = 0x20, + k45g = 0x40, +}; + +// Bitmap for RangingBandwidthBitmap +enum class RangingBandwidthBitmap : uint32_t +{ + k1MHz = 0x1, + k2MHz = 0x2, + k4MHz = 0x4, + k8MHz = 0x8, + k16MHz = 0x10, + k20MHz = 0x20, + k40MHz = 0x40, + k80MHz = 0x80, + k160MHz = 0x100, + k320MHz = 0x200, +}; +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/EnumsCheck.h b/zzz_generated/app-common/clusters/ProximityRanging/EnumsCheck.h new file mode 100644 index 00000000000000..a2950aa9b60f16 --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/EnumsCheck.h @@ -0,0 +1,87 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP +// This file is generated from clusters-Enums-Check.h.zapt + +#pragma once + +#include + +namespace chip { +namespace app { +namespace Clusters { +static auto __attribute__((unused)) EnsureKnownEnumValue(ProximityRanging::RangingRoleEnum val) +{ + using EnumType = ProximityRanging::RangingRoleEnum; + switch (val) + { + case EnumType::kWiFiSubscriberRole: + case EnumType::kWiFiPublisherRole: + case EnumType::kBLEScanningRole: + case EnumType::kBLEBeaconRole: + case EnumType::kBLTInitiatorRole: + case EnumType::kBLTReflectorRole: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ProximityRanging::RangingSecurityEnum val) +{ + using EnumType = ProximityRanging::RangingSecurityEnum; + switch (val) + { + case EnumType::kSecureRanging: + case EnumType::kOpenRanging: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ProximityRanging::RangingTechEnum val) +{ + using EnumType = ProximityRanging::RangingTechEnum; + switch (val) + { + case EnumType::kBluetoothChannelSounding: + case EnumType::kWiFiRoundTripTimeRanging: + case EnumType::kWiFiNextGenerationRanging: + case EnumType::kBLEBeaconRSSIRanging: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ProximityRanging::ResultCodeEnum val) +{ + using EnumType = ProximityRanging::ResultCodeEnum; + switch (val) + { + case EnumType::kAccepted: + case EnumType::kRejectedInfeasibleRanging: + case EnumType::kRejectedInfeasibleRangingTriggers: + case EnumType::kBusySessionCapacityReached: + case EnumType::kBusyTryAgainLater: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/EventIds.h b/zzz_generated/app-common/clusters/ProximityRanging/EventIds.h new file mode 100644 index 00000000000000..7025c0dccaf453 --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/EventIds.h @@ -0,0 +1,17 @@ +// DO NOT EDIT MANUALLY - Generated file +// +// Identifier constant values for cluster ProximityRanging (cluster code: 1075/0x433) +// based on src/controller/data_model/controller-clusters.matter +#pragma once + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { +namespace Events {} // namespace Events +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Events.h b/zzz_generated/app-common/clusters/ProximityRanging/Events.h new file mode 100644 index 00000000000000..46949e5573b1d2 --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/Events.h @@ -0,0 +1,49 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP +// This file is generated from clusters-Events.h.zapt + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { +namespace Events {} // namespace Events +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Events.ipp b/zzz_generated/app-common/clusters/ProximityRanging/Events.ipp new file mode 100644 index 00000000000000..aa11afde95a191 --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/Events.ipp @@ -0,0 +1,36 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP +// This file is generated from clusters-Events.ipp.zapt + +#include + +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { +namespace Events {} // namespace Events +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Ids.h b/zzz_generated/app-common/clusters/ProximityRanging/Ids.h new file mode 100644 index 00000000000000..dafe5acf60d540 --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/Ids.h @@ -0,0 +1,10 @@ +// DO NOT EDIT MANUALLY - Generated file +// +// Identifier constant values for cluster ProximityRanging (cluster code: 1075/0x0433) +// based on src/controller/data_model/controller-clusters.matter +#pragma once + +#include +#include +#include +#include diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Metadata.h b/zzz_generated/app-common/clusters/ProximityRanging/Metadata.h new file mode 100644 index 00000000000000..ca9ad0dbb719a2 --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/Metadata.h @@ -0,0 +1,72 @@ +// DO NOT EDIT MANUALLY - Generated file +// +// Cluster metadata information for cluster ProximityRanging (cluster code: 1075/0x433) +// based on src/controller/data_model/controller-clusters.matter +#pragma once + +#include +#include +#include + +#include + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { + +inline constexpr uint32_t kRevision = 1; + +namespace Attributes { + +namespace RangingCapabilities { +inline constexpr DataModel::AttributeEntry + kMetadataEntry(RangingCapabilities::Id, + BitFlags(DataModel::AttributeQualityFlags::kListAttribute), + Access::Privilege::kView, std::nullopt); +} // namespace RangingCapabilities +namespace WiFiDevIK { +inline constexpr DataModel::AttributeEntry kMetadataEntry(WiFiDevIK::Id, BitFlags(), + Access::Privilege::kView, std::nullopt); +} // namespace WiFiDevIK +namespace BLEDeviceId { +inline constexpr DataModel::AttributeEntry kMetadataEntry(BLEDeviceId::Id, BitFlags(), + Access::Privilege::kView, std::nullopt); +} // namespace BLEDeviceId +namespace BLTDevIK { +inline constexpr DataModel::AttributeEntry kMetadataEntry(BLTDevIK::Id, BitFlags(), + Access::Privilege::kView, std::nullopt); +} // namespace BLTDevIK +namespace SessionIDs { +inline constexpr DataModel::AttributeEntry + kMetadataEntry(SessionIDs::Id, BitFlags(DataModel::AttributeQualityFlags::kListAttribute), + Access::Privilege::kView, std::nullopt); +} // namespace SessionIDs +constexpr std::array kMandatoryMetadata = { + RangingCapabilities::kMetadataEntry, + SessionIDs::kMetadataEntry, + +}; + +} // namespace Attributes + +namespace Commands { + +namespace StartRangingRequest { +inline constexpr DataModel::AcceptedCommandEntry kMetadataEntry(StartRangingRequest::Id, BitFlags(), + Access::Privilege::kOperate); +} // namespace StartRangingRequest +namespace StopRangingRequest { +inline constexpr DataModel::AcceptedCommandEntry kMetadataEntry(StopRangingRequest::Id, BitFlags(), + Access::Privilege::kOperate); +} // namespace StopRangingRequest + +} // namespace Commands + +namespace Events {} // namespace Events +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/MetadataProvider.h b/zzz_generated/app-common/clusters/ProximityRanging/MetadataProvider.h new file mode 100644 index 00000000000000..59ac909124104f --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/MetadataProvider.h @@ -0,0 +1,63 @@ +// DO NOT EDIT MANUALLY - Generated file +// +// Cluster metadata information for cluster ProximityRanging (cluster code: 1075/0x433) +// based on src/controller/data_model/controller-clusters.matter +#pragma once + +#include + +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace DataModel { + +template <> +struct ClusterMetadataProvider +{ + static constexpr std::optional EntryFor(AttributeId attributeId) + { + using namespace Clusters::ProximityRanging::Attributes; + switch (attributeId) + { + case RangingCapabilities::Id: + return RangingCapabilities::kMetadataEntry; + case WiFiDevIK::Id: + return WiFiDevIK::kMetadataEntry; + case BLEDeviceId::Id: + return BLEDeviceId::kMetadataEntry; + case BLTDevIK::Id: + return BLTDevIK::kMetadataEntry; + case SessionIDs::Id: + return SessionIDs::kMetadataEntry; + default: + return std::nullopt; + } + } +}; + +template <> +struct ClusterMetadataProvider +{ + static constexpr std::optional EntryFor(CommandId commandId) + { + using namespace Clusters::ProximityRanging::Commands; + switch (commandId) + { + case StartRangingRequest::Id: + return StartRangingRequest::kMetadataEntry; + case StopRangingRequest::Id: + return StopRangingRequest::kMetadataEntry; + + default: + return std::nullopt; + } + } +}; + +} // namespace DataModel +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Structs.h b/zzz_generated/app-common/clusters/ProximityRanging/Structs.h new file mode 100644 index 00000000000000..2e2611f1525a5c --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/Structs.h @@ -0,0 +1,258 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP +// This file is generated from clusters-Structs.h.zapt + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { +namespace Structs { +namespace RDRStruct { +enum class Fields : uint8_t +{ + kAzimuth = 0, + kElevation = 1, + kAzimuthAccuracy = 2, + kElevationAccuracy = 3, + kReference = 4, +}; + +struct Type +{ +public: + uint16_t azimuth = static_cast(0); + int16_t elevation = static_cast(0); + uint8_t azimuthAccuracy = static_cast(0); + uint8_t elevationAccuracy = static_cast(0); + uint8_t reference = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace RDRStruct +namespace RangingMeasurementDataStruct { +enum class Fields : uint8_t +{ + kWiFiDevIK = 0, + kBLEDeviceId = 1, + kBLTDevIK = 2, + kTimeOfMeasurement = 3, + kDistance = 4, + kAccuracy = 5, + kRdr = 6, + kRssi = 7, + kTxPower = 8, +}; + +struct Type +{ +public: + Optional wiFiDevIK; + Optional BLEDeviceId; + Optional BLTDevIK; + Optional timeOfMeasurement; + DataModel::Nullable distance; + Optional accuracy; + Optional rdr; + Optional> rssi; + Optional> txPower; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace RangingMeasurementDataStruct +namespace BLERangingDeviceRoleConfigStruct { +enum class Fields : uint8_t +{ + kRole = 0, + kPeerBLEDeviceID = 1, +}; + +struct Type +{ +public: + RangingRoleEnum role = static_cast(0); + uint64_t peerBLEDeviceID = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace BLERangingDeviceRoleConfigStruct +namespace BLTChannelSoundingDeviceRoleConfigStruct { +enum class Fields : uint8_t +{ + kRole = 0, + kPeerBLTDevIK = 1, + kLtk = 2, +}; + +struct Type +{ +public: + RangingRoleEnum role = static_cast(0); + chip::ByteSpan peerBLTDevIK; + Optional ltk; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace BLTChannelSoundingDeviceRoleConfigStruct +namespace RangingCapabilitiesStruct { +enum class Fields : uint8_t +{ + kTechnology = 0, + kFrequencyBand = 1, + kPeriodicRangingSupport = 2, +}; + +struct Type +{ +public: + RangingTechEnum technology = static_cast(0); + chip::BitMask frequencyBand = static_cast>(0); + bool periodicRangingSupport = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace RangingCapabilitiesStruct +namespace RangingTriggerConditionStruct { +enum class Fields : uint8_t +{ + kStartTime = 0, + kEndTime = 1, + kRangingInstanceInterval = 2, +}; + +struct Type +{ +public: + uint32_t startTime = static_cast(0); + Optional endTime; + Optional rangingInstanceInterval; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace RangingTriggerConditionStruct +namespace ReportingConditionStruct { +enum class Fields : uint8_t +{ + kMinDistanceCondition = 0, + kMaxDistanceCondition = 1, + kAccuracyCondition = 2, +}; + +struct Type +{ +public: + Optional minDistanceCondition; + Optional maxDistanceCondition; + Optional accuracyCondition; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace ReportingConditionStruct +namespace WiFiRangingDeviceRoleConfigStruct { +enum class Fields : uint8_t +{ + kRole = 0, + kPeerWiFiDevIK = 1, + kPmk = 2, +}; + +struct Type +{ +public: + RangingRoleEnum role = static_cast(0); + chip::ByteSpan peerWiFiDevIK; + Optional pmk; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace WiFiRangingDeviceRoleConfigStruct +} // namespace Structs +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Structs.ipp b/zzz_generated/app-common/clusters/ProximityRanging/Structs.ipp new file mode 100644 index 00000000000000..ce4435a7590b56 --- /dev/null +++ b/zzz_generated/app-common/clusters/ProximityRanging/Structs.ipp @@ -0,0 +1,382 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP +// This file is generated from clusters-Structs.ipp.zapt + +#include + +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ProximityRanging { +namespace Structs { + +namespace RDRStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kAzimuth), azimuth); + encoder.Encode(to_underlying(Fields::kElevation), elevation); + encoder.Encode(to_underlying(Fields::kAzimuthAccuracy), azimuthAccuracy); + encoder.Encode(to_underlying(Fields::kElevationAccuracy), elevationAccuracy); + encoder.Encode(to_underlying(Fields::kReference), reference); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kAzimuth)) + { + err = DataModel::Decode(reader, azimuth); + } + else if (__context_tag == to_underlying(Fields::kElevation)) + { + err = DataModel::Decode(reader, elevation); + } + else if (__context_tag == to_underlying(Fields::kAzimuthAccuracy)) + { + err = DataModel::Decode(reader, azimuthAccuracy); + } + else if (__context_tag == to_underlying(Fields::kElevationAccuracy)) + { + err = DataModel::Decode(reader, elevationAccuracy); + } + else if (__context_tag == to_underlying(Fields::kReference)) + { + err = DataModel::Decode(reader, reference); + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace RDRStruct + +namespace RangingMeasurementDataStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kWiFiDevIK), wiFiDevIK); + encoder.Encode(to_underlying(Fields::kBLEDeviceId), BLEDeviceId); + encoder.Encode(to_underlying(Fields::kBLTDevIK), BLTDevIK); + encoder.Encode(to_underlying(Fields::kTimeOfMeasurement), timeOfMeasurement); + encoder.Encode(to_underlying(Fields::kDistance), distance); + encoder.Encode(to_underlying(Fields::kAccuracy), accuracy); + encoder.Encode(to_underlying(Fields::kRdr), rdr); + encoder.Encode(to_underlying(Fields::kRssi), rssi); + encoder.Encode(to_underlying(Fields::kTxPower), txPower); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kWiFiDevIK)) + { + err = DataModel::Decode(reader, wiFiDevIK); + } + else if (__context_tag == to_underlying(Fields::kBLEDeviceId)) + { + err = DataModel::Decode(reader, BLEDeviceId); + } + else if (__context_tag == to_underlying(Fields::kBLTDevIK)) + { + err = DataModel::Decode(reader, BLTDevIK); + } + else if (__context_tag == to_underlying(Fields::kTimeOfMeasurement)) + { + err = DataModel::Decode(reader, timeOfMeasurement); + } + else if (__context_tag == to_underlying(Fields::kDistance)) + { + err = DataModel::Decode(reader, distance); + } + else if (__context_tag == to_underlying(Fields::kAccuracy)) + { + err = DataModel::Decode(reader, accuracy); + } + else if (__context_tag == to_underlying(Fields::kRdr)) + { + err = DataModel::Decode(reader, rdr); + } + else if (__context_tag == to_underlying(Fields::kRssi)) + { + err = DataModel::Decode(reader, rssi); + } + else if (__context_tag == to_underlying(Fields::kTxPower)) + { + err = DataModel::Decode(reader, txPower); + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace RangingMeasurementDataStruct + +namespace BLERangingDeviceRoleConfigStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kRole), role); + encoder.Encode(to_underlying(Fields::kPeerBLEDeviceID), peerBLEDeviceID); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kRole)) + { + err = DataModel::Decode(reader, role); + } + else if (__context_tag == to_underlying(Fields::kPeerBLEDeviceID)) + { + err = DataModel::Decode(reader, peerBLEDeviceID); + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace BLERangingDeviceRoleConfigStruct + +namespace BLTChannelSoundingDeviceRoleConfigStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kRole), role); + encoder.Encode(to_underlying(Fields::kPeerBLTDevIK), peerBLTDevIK); + encoder.Encode(to_underlying(Fields::kLtk), ltk); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kRole)) + { + err = DataModel::Decode(reader, role); + } + else if (__context_tag == to_underlying(Fields::kPeerBLTDevIK)) + { + err = DataModel::Decode(reader, peerBLTDevIK); + } + else if (__context_tag == to_underlying(Fields::kLtk)) + { + err = DataModel::Decode(reader, ltk); + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace BLTChannelSoundingDeviceRoleConfigStruct + +namespace RangingCapabilitiesStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kTechnology), technology); + encoder.Encode(to_underlying(Fields::kFrequencyBand), frequencyBand); + encoder.Encode(to_underlying(Fields::kPeriodicRangingSupport), periodicRangingSupport); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kTechnology)) + { + err = DataModel::Decode(reader, technology); + } + else if (__context_tag == to_underlying(Fields::kFrequencyBand)) + { + err = DataModel::Decode(reader, frequencyBand); + } + else if (__context_tag == to_underlying(Fields::kPeriodicRangingSupport)) + { + err = DataModel::Decode(reader, periodicRangingSupport); + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace RangingCapabilitiesStruct + +namespace RangingTriggerConditionStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kStartTime), startTime); + encoder.Encode(to_underlying(Fields::kEndTime), endTime); + encoder.Encode(to_underlying(Fields::kRangingInstanceInterval), rangingInstanceInterval); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kStartTime)) + { + err = DataModel::Decode(reader, startTime); + } + else if (__context_tag == to_underlying(Fields::kEndTime)) + { + err = DataModel::Decode(reader, endTime); + } + else if (__context_tag == to_underlying(Fields::kRangingInstanceInterval)) + { + err = DataModel::Decode(reader, rangingInstanceInterval); + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace RangingTriggerConditionStruct + +namespace ReportingConditionStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kMinDistanceCondition), minDistanceCondition); + encoder.Encode(to_underlying(Fields::kMaxDistanceCondition), maxDistanceCondition); + encoder.Encode(to_underlying(Fields::kAccuracyCondition), accuracyCondition); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kMinDistanceCondition)) + { + err = DataModel::Decode(reader, minDistanceCondition); + } + else if (__context_tag == to_underlying(Fields::kMaxDistanceCondition)) + { + err = DataModel::Decode(reader, maxDistanceCondition); + } + else if (__context_tag == to_underlying(Fields::kAccuracyCondition)) + { + err = DataModel::Decode(reader, accuracyCondition); + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace ReportingConditionStruct + +namespace WiFiRangingDeviceRoleConfigStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kRole), role); + encoder.Encode(to_underlying(Fields::kPeerWiFiDevIK), peerWiFiDevIK); + encoder.Encode(to_underlying(Fields::kPmk), pmk); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kRole)) + { + err = DataModel::Decode(reader, role); + } + else if (__context_tag == to_underlying(Fields::kPeerWiFiDevIK)) + { + err = DataModel::Decode(reader, peerWiFiDevIK); + } + else if (__context_tag == to_underlying(Fields::kPmk)) + { + err = DataModel::Decode(reader, pmk); + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace WiFiRangingDeviceRoleConfigStruct +} // namespace Structs +} // namespace ProximityRanging +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 0f4b490e3d8a93..9cf81213850c55 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -142,6 +142,7 @@ | RadonConcentrationMeasurement | 0x042F | | SoilMeasurement | 0x0430 | | AmbientContextSensing | 0x0431 | +| ProximityRanging | 0x0433 | | WiFiNetworkManagement | 0x0451 | | ThreadBorderRouterManagement | 0x0452 | | ThreadNetworkDirectory | 0x0453 | @@ -11606,6 +11607,126 @@ class ColorControlStepColorTemperature : public ClusterCommand | * AmbientContextDetectEnded | 0x0001 | \*----------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------*\ +| Cluster ProximityRanging | 0x0433 | +|------------------------------------------------------------------------------| +| Commands: | | +| * StartRangingRequest | 0x00 | +| * StopRangingRequest | 0x02 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * RangingCapabilities | 0x0000 | +| * WiFiDevIK | 0x0001 | +| * BLEDeviceId | 0x0002 | +| * BLTDevIK | 0x0003 | +| * SessionIDs | 0x0004 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +/* + * Command StartRangingRequest + */ +class ProximityRangingStartRangingRequest : public ClusterCommand +{ +public: + ProximityRangingStartRangingRequest(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("start-ranging-request", credsIssuerConfig), + mComplex_WiFiRangingDeviceRoleConfig(&mRequest.wiFiRangingDeviceRoleConfig), + mComplex_BLERangingDeviceRoleConfig(&mRequest.BLERangingDeviceRoleConfig), + mComplex_BLTChannelSoundingDeviceRoleConfig(&mRequest.BLTChannelSoundingDeviceRoleConfig), + mComplex_Trigger(&mRequest.trigger), mComplex_ReportingCondition(&mRequest.reportingCondition) + { + AddArgument("Technology", 0, UINT8_MAX, &mRequest.technology); + AddArgument("WiFiRangingDeviceRoleConfig", &mComplex_WiFiRangingDeviceRoleConfig, "", Argument::kOptional); + AddArgument("BLERangingDeviceRoleConfig", &mComplex_BLERangingDeviceRoleConfig, "", Argument::kOptional); + AddArgument("BLTChannelSoundingDeviceRoleConfig", &mComplex_BLTChannelSoundingDeviceRoleConfig, "", Argument::kOptional); + AddArgument("FrequencyBand", 0, UINT16_MAX, &mRequest.frequencyBand); + AddArgument("Bandwidth", 0, UINT32_MAX, &mRequest.bandwidth); + AddArgument("SecurityMode", 0, UINT8_MAX, &mRequest.securityMode); + AddArgument("Trigger", &mComplex_Trigger); + AddArgument("ReportingCondition", &mComplex_ReportingCondition, "", Argument::kOptional); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ProximityRanging::Commands::StartRangingRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ProximityRanging::Commands::StartRangingRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::ProximityRanging::Commands::StartRangingRequest::Type mRequest; + TypedComplexArgument> + mComplex_WiFiRangingDeviceRoleConfig; + TypedComplexArgument> + mComplex_BLERangingDeviceRoleConfig; + TypedComplexArgument< + chip::Optional> + mComplex_BLTChannelSoundingDeviceRoleConfig; + TypedComplexArgument mComplex_Trigger; + TypedComplexArgument> + mComplex_ReportingCondition; +}; + +/* + * Command StopRangingRequest + */ +class ProximityRangingStopRangingRequest : public ClusterCommand +{ +public: + ProximityRangingStopRangingRequest(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("stop-ranging-request", credsIssuerConfig) + { + AddArgument("SessionID", 0, UINT8_MAX, &mRequest.sessionID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ProximityRanging::Commands::StopRangingRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ProximityRanging::Commands::StopRangingRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::ProximityRanging::Commands::StopRangingRequest::Type mRequest; +}; + /*----------------------------------------------------------------------------*\ | Cluster WiFiNetworkManagement | 0x0451 | |------------------------------------------------------------------------------| @@ -29517,6 +29638,76 @@ void registerClusterAmbientContextSensing(Commands & commands, CredentialIssuerC commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterProximityRanging(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::ProximityRanging; + + const char * clusterName = "ProximityRanging"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "ranging-capabilities", Attributes::RangingCapabilities::Id, credsIssuerConfig), // + make_unique(Id, "wi-fi-dev-ik", Attributes::WiFiDevIK::Id, credsIssuerConfig), // + make_unique(Id, "bledevice-id", Attributes::BLEDeviceId::Id, credsIssuerConfig), // + make_unique(Id, "bltdev-ik", Attributes::BLTDevIK::Id, credsIssuerConfig), // + make_unique(Id, "session-ids", Attributes::SessionIDs::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique>>( + Id, "ranging-capabilities", Attributes::RangingCapabilities::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "wi-fi-dev-ik", Attributes::WiFiDevIK::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>(Id, "bledevice-id", 0, UINT64_MAX, Attributes::BLEDeviceId::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "bltdev-ik", Attributes::BLTDevIK::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>>( + Id, "session-ids", Attributes::SessionIDs::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "attribute-list", Attributes::AttributeList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "feature-map", 0, UINT32_MAX, Attributes::FeatureMap::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "cluster-revision", 0, UINT16_MAX, Attributes::ClusterRevision::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "ranging-capabilities", Attributes::RangingCapabilities::Id, credsIssuerConfig), // + make_unique(Id, "wi-fi-dev-ik", Attributes::WiFiDevIK::Id, credsIssuerConfig), // + make_unique(Id, "bledevice-id", Attributes::BLEDeviceId::Id, credsIssuerConfig), // + make_unique(Id, "bltdev-ik", Attributes::BLTDevIK::Id, credsIssuerConfig), // + make_unique(Id, "session-ids", Attributes::SessionIDs::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + // + // Events + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} void registerClusterWiFiNetworkManagement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { using namespace chip::app::Clusters::WiFiNetworkManagement; @@ -32795,6 +32986,7 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterRadonConcentrationMeasurement(commands, credsIssuerConfig); registerClusterSoilMeasurement(commands, credsIssuerConfig); registerClusterAmbientContextSensing(commands, credsIssuerConfig); + registerClusterProximityRanging(commands, credsIssuerConfig); registerClusterWiFiNetworkManagement(commands, credsIssuerConfig); registerClusterThreadBorderRouterManagement(commands, credsIssuerConfig); registerClusterThreadNetworkDirectory(commands, credsIssuerConfig); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 19541f5318d88c..ffdb5acb4996af 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -5569,6 +5569,389 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::AmbientContextSensing: ComplexArgumentParser::Finalize(request.confidence); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::RDRStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RDRStruct.azimuth", "azimuth", value.isMember("azimuth"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RDRStruct.elevation", "elevation", value.isMember("elevation"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RDRStruct.azimuthAccuracy", "azimuthAccuracy", + value.isMember("azimuthAccuracy"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RDRStruct.elevationAccuracy", "elevationAccuracy", + value.isMember("elevationAccuracy"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RDRStruct.reference", "reference", value.isMember("reference"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "azimuth"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.azimuth, value["azimuth"])); + valueCopy.removeMember("azimuth"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "elevation"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.elevation, value["elevation"])); + valueCopy.removeMember("elevation"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "azimuthAccuracy"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.azimuthAccuracy, value["azimuthAccuracy"])); + valueCopy.removeMember("azimuthAccuracy"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "elevationAccuracy"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.elevationAccuracy, value["elevationAccuracy"])); + valueCopy.removeMember("elevationAccuracy"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "reference"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.reference, value["reference"])); + valueCopy.removeMember("reference"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ProximityRanging::Structs::RDRStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.azimuth); + ComplexArgumentParser::Finalize(request.elevation); + ComplexArgumentParser::Finalize(request.azimuthAccuracy); + ComplexArgumentParser::Finalize(request.elevationAccuracy); + ComplexArgumentParser::Finalize(request.reference); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::RangingMeasurementDataStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("RangingMeasurementDataStruct.distance", "distance", value.isMember("distance"))); + + char labelWithMember[kMaxLabelLength]; + if (value.isMember("wiFiDevIK")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "wiFiDevIK"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.wiFiDevIK, value["wiFiDevIK"])); + } + valueCopy.removeMember("wiFiDevIK"); + + if (value.isMember("BLEDeviceId")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "BLEDeviceId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.BLEDeviceId, value["BLEDeviceId"])); + } + valueCopy.removeMember("BLEDeviceId"); + + if (value.isMember("BLTDevIK")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "BLTDevIK"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.BLTDevIK, value["BLTDevIK"])); + } + valueCopy.removeMember("BLTDevIK"); + + if (value.isMember("timeOfMeasurement")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "timeOfMeasurement"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.timeOfMeasurement, value["timeOfMeasurement"])); + } + valueCopy.removeMember("timeOfMeasurement"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "distance"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.distance, value["distance"])); + valueCopy.removeMember("distance"); + + if (value.isMember("accuracy")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "accuracy"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.accuracy, value["accuracy"])); + } + valueCopy.removeMember("accuracy"); + + if (value.isMember("rdr")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rdr"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rdr, value["rdr"])); + } + valueCopy.removeMember("rdr"); + + if (value.isMember("rssi")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rssi"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rssi, value["rssi"])); + } + valueCopy.removeMember("rssi"); + + if (value.isMember("txPower")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "txPower"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.txPower, value["txPower"])); + } + valueCopy.removeMember("txPower"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ProximityRanging::Structs::RangingMeasurementDataStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.wiFiDevIK); + ComplexArgumentParser::Finalize(request.BLEDeviceId); + ComplexArgumentParser::Finalize(request.BLTDevIK); + ComplexArgumentParser::Finalize(request.timeOfMeasurement); + ComplexArgumentParser::Finalize(request.distance); + ComplexArgumentParser::Finalize(request.accuracy); + ComplexArgumentParser::Finalize(request.rdr); + ComplexArgumentParser::Finalize(request.rssi); + ComplexArgumentParser::Finalize(request.txPower); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::BLERangingDeviceRoleConfigStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("BLERangingDeviceRoleConfigStruct.role", "role", value.isMember("role"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("BLERangingDeviceRoleConfigStruct.peerBLEDeviceID", + "peerBLEDeviceID", value.isMember("peerBLEDeviceID"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "role"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.role, value["role"])); + valueCopy.removeMember("role"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "peerBLEDeviceID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.peerBLEDeviceID, value["peerBLEDeviceID"])); + valueCopy.removeMember("peerBLEDeviceID"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::ProximityRanging::Structs::BLERangingDeviceRoleConfigStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.role); + ComplexArgumentParser::Finalize(request.peerBLEDeviceID); +} + +CHIP_ERROR ComplexArgumentParser::Setup( + const char * label, chip::app::Clusters::ProximityRanging::Structs::BLTChannelSoundingDeviceRoleConfigStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("BLTChannelSoundingDeviceRoleConfigStruct.role", "role", value.isMember("role"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("BLTChannelSoundingDeviceRoleConfigStruct.peerBLTDevIK", + "peerBLTDevIK", value.isMember("peerBLTDevIK"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "role"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.role, value["role"])); + valueCopy.removeMember("role"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "peerBLTDevIK"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.peerBLTDevIK, value["peerBLTDevIK"])); + valueCopy.removeMember("peerBLTDevIK"); + + if (value.isMember("ltk")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "ltk"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.ltk, value["ltk"])); + } + valueCopy.removeMember("ltk"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::ProximityRanging::Structs::BLTChannelSoundingDeviceRoleConfigStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.role); + ComplexArgumentParser::Finalize(request.peerBLTDevIK); + ComplexArgumentParser::Finalize(request.ltk); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::RangingCapabilitiesStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RangingCapabilitiesStruct.technology", "technology", + value.isMember("technology"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RangingCapabilitiesStruct.frequencyBand", "frequencyBand", + value.isMember("frequencyBand"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist( + "RangingCapabilitiesStruct.periodicRangingSupport", "periodicRangingSupport", value.isMember("periodicRangingSupport"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "technology"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.technology, value["technology"])); + valueCopy.removeMember("technology"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "frequencyBand"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.frequencyBand, value["frequencyBand"])); + valueCopy.removeMember("frequencyBand"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "periodicRangingSupport"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.periodicRangingSupport, value["periodicRangingSupport"])); + valueCopy.removeMember("periodicRangingSupport"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ProximityRanging::Structs::RangingCapabilitiesStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.technology); + ComplexArgumentParser::Finalize(request.frequencyBand); + ComplexArgumentParser::Finalize(request.periodicRangingSupport); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::RangingTriggerConditionStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RangingTriggerConditionStruct.startTime", "startTime", + value.isMember("startTime"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "startTime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.startTime, value["startTime"])); + valueCopy.removeMember("startTime"); + + if (value.isMember("endTime")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endTime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endTime, value["endTime"])); + } + valueCopy.removeMember("endTime"); + + if (value.isMember("rangingInstanceInterval")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rangingInstanceInterval"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.rangingInstanceInterval, value["rangingInstanceInterval"])); + } + valueCopy.removeMember("rangingInstanceInterval"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ProximityRanging::Structs::RangingTriggerConditionStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.startTime); + ComplexArgumentParser::Finalize(request.endTime); + ComplexArgumentParser::Finalize(request.rangingInstanceInterval); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::ReportingConditionStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + char labelWithMember[kMaxLabelLength]; + if (value.isMember("minDistanceCondition")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "minDistanceCondition"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.minDistanceCondition, value["minDistanceCondition"])); + } + valueCopy.removeMember("minDistanceCondition"); + + if (value.isMember("maxDistanceCondition")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "maxDistanceCondition"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.maxDistanceCondition, value["maxDistanceCondition"])); + } + valueCopy.removeMember("maxDistanceCondition"); + + if (value.isMember("accuracyCondition")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "accuracyCondition"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.accuracyCondition, value["accuracyCondition"])); + } + valueCopy.removeMember("accuracyCondition"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ProximityRanging::Structs::ReportingConditionStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.minDistanceCondition); + ComplexArgumentParser::Finalize(request.maxDistanceCondition); + ComplexArgumentParser::Finalize(request.accuracyCondition); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::WiFiRangingDeviceRoleConfigStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("WiFiRangingDeviceRoleConfigStruct.role", "role", value.isMember("role"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("WiFiRangingDeviceRoleConfigStruct.peerWiFiDevIK", + "peerWiFiDevIK", value.isMember("peerWiFiDevIK"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "role"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.role, value["role"])); + valueCopy.removeMember("role"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "peerWiFiDevIK"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.peerWiFiDevIK, value["peerWiFiDevIK"])); + valueCopy.removeMember("peerWiFiDevIK"); + + if (value.isMember("pmk")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "pmk"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.pmk, value["pmk"])); + } + valueCopy.removeMember("pmk"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::ProximityRanging::Structs::WiFiRangingDeviceRoleConfigStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.role); + ComplexArgumentParser::Finalize(request.peerWiFiDevIK); + ComplexArgumentParser::Finalize(request.pmk); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::Type & request, Json::Value & value) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index e92d2ddf6a7640..80d550e6bcfd76 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -622,6 +622,53 @@ static CHIP_ERROR Setup(const char * label, static void Finalize(chip::app::Clusters::AmbientContextSensing::Structs::PredictedActivityStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ProximityRanging::Structs::RDRStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ProximityRanging::Structs::RDRStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::RangingMeasurementDataStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ProximityRanging::Structs::RangingMeasurementDataStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::BLERangingDeviceRoleConfigStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ProximityRanging::Structs::BLERangingDeviceRoleConfigStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::BLTChannelSoundingDeviceRoleConfigStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ProximityRanging::Structs::BLTChannelSoundingDeviceRoleConfigStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::RangingCapabilitiesStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ProximityRanging::Structs::RangingCapabilitiesStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::RangingTriggerConditionStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ProximityRanging::Structs::RangingTriggerConditionStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::ReportingConditionStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ProximityRanging::Structs::ReportingConditionStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ProximityRanging::Structs::WiFiRangingDeviceRoleConfigStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ProximityRanging::Structs::WiFiRangingDeviceRoleConfigStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 86a12457f4c9e1..1db58e9e784d7e 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -4943,6 +4943,333 @@ DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::RDRStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Azimuth", indent + 1, value.azimuth); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Azimuth'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Elevation", indent + 1, value.elevation); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Elevation'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("AzimuthAccuracy", indent + 1, value.azimuthAccuracy); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AzimuthAccuracy'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ElevationAccuracy", indent + 1, value.elevationAccuracy); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ElevationAccuracy'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Reference", indent + 1, value.reference); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Reference'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::RangingMeasurementDataStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("WiFiDevIK", indent + 1, value.wiFiDevIK); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'WiFiDevIK'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("BLEDeviceId", indent + 1, value.BLEDeviceId); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'BLEDeviceId'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("BLTDevIK", indent + 1, value.BLTDevIK); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'BLTDevIK'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("TimeOfMeasurement", indent + 1, value.timeOfMeasurement); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TimeOfMeasurement'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Distance", indent + 1, value.distance); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Distance'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Accuracy", indent + 1, value.accuracy); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Accuracy'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Rdr", indent + 1, value.rdr); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Rdr'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Rssi", indent + 1, value.rssi); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Rssi'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("TxPower", indent + 1, value.txPower); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TxPower'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::BLERangingDeviceRoleConfigStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Role", indent + 1, value.role); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Role'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("PeerBLEDeviceID", indent + 1, value.peerBLEDeviceID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PeerBLEDeviceID'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::BLTChannelSoundingDeviceRoleConfigStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Role", indent + 1, value.role); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Role'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("PeerBLTDevIK", indent + 1, value.peerBLTDevIK); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PeerBLTDevIK'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Ltk", indent + 1, value.ltk); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Ltk'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::RangingCapabilitiesStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Technology", indent + 1, value.technology); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Technology'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("FrequencyBand", indent + 1, value.frequencyBand); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FrequencyBand'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("PeriodicRangingSupport", indent + 1, value.periodicRangingSupport); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PeriodicRangingSupport'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::RangingTriggerConditionStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("StartTime", indent + 1, value.startTime); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'StartTime'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("EndTime", indent + 1, value.endTime); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'EndTime'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("RangingInstanceInterval", indent + 1, value.rangingInstanceInterval); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'RangingInstanceInterval'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::ReportingConditionStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("MinDistanceCondition", indent + 1, value.minDistanceCondition); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MinDistanceCondition'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("MaxDistanceCondition", indent + 1, value.maxDistanceCondition); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MaxDistanceCondition'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("AccuracyCondition", indent + 1, value.accuracyCondition); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AccuracyCondition'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::WiFiRangingDeviceRoleConfigStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Role", indent + 1, value.role); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Role'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("PeerWiFiDevIK", indent + 1, value.peerWiFiDevIK); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PeerWiFiDevIK'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Pmk", indent + 1, value.pmk); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Pmk'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::DecodableType & value) @@ -12655,6 +12982,24 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const ProximityRanging::Commands::StartRangingResponse::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + ReturnErrorOnFailure(DataModelLogger::LogValue("resultCode", indent + 1, value.resultCode)); + ReturnErrorOnFailure(DataModelLogger::LogValue("sessionID", indent + 1, value.sessionID)); + DataModelLogger::LogString(indent, "}"); + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const ProximityRanging::Commands::RangingResult::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + ReturnErrorOnFailure(DataModelLogger::LogValue("sessionID", indent + 1, value.sessionID)); + ReturnErrorOnFailure(DataModelLogger::LogValue("rangingResultData", indent + 1, value.rangingResultData)); + DataModelLogger::LogString(indent, "}"); + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const WiFiNetworkManagement::Commands::NetworkPassphraseResponse::DecodableType & value) { @@ -21253,6 +21598,64 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case ProximityRanging::Id: { + switch (path.mAttributeId) + { + case ProximityRanging::Attributes::RangingCapabilities::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::ProximityRanging::Structs::RangingCapabilitiesStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("RangingCapabilities", 1, value); + } + case ProximityRanging::Attributes::WiFiDevIK::Id: { + chip::ByteSpan value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("WiFiDevIK", 1, value); + } + case ProximityRanging::Attributes::BLEDeviceId::Id: { + uint64_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("BLEDeviceId", 1, value); + } + case ProximityRanging::Attributes::BLTDevIK::Id: { + chip::ByteSpan value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("BLTDevIK", 1, value); + } + case ProximityRanging::Attributes::SessionIDs::Id: { + chip::app::DataModel::Nullable> value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("SessionIDs", 1, value); + } + case ProximityRanging::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ProximityRanging::Id); + } + case ProximityRanging::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ProximityRanging::Id); + } + case ProximityRanging::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ProximityRanging::Id); + } + case ProximityRanging::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case ProximityRanging::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case WiFiNetworkManagement::Id: { switch (path.mAttributeId) { @@ -24277,6 +24680,22 @@ CHIP_ERROR DataModelLogger::LogCommand(const chip::app::ConcreteCommandPath & pa } break; } + case ProximityRanging::Id: { + switch (path.mCommandId) + { + case ProximityRanging::Commands::StartRangingResponse::Id: { + ProximityRanging::Commands::StartRangingResponse::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("StartRangingResponse", 1, value); + } + case ProximityRanging::Commands::RangingResult::Id: { + ProximityRanging::Commands::RangingResult::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("RangingResult", 1, value); + } + } + break; + } case WiFiNetworkManagement::Id: { switch (path.mCommandId) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 8d6a0059087996..035f30771ad3c0 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -381,6 +381,35 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::AmbientContextSensing::Structs::PredictedActivityStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::RDRStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::RangingMeasurementDataStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::BLERangingDeviceRoleConfigStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::BLTChannelSoundingDeviceRoleConfigStruct::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::RangingCapabilitiesStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::RangingTriggerConditionStruct::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::ReportingConditionStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Structs::WiFiRangingDeviceRoleConfigStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::DecodableType & value); @@ -1143,6 +1172,10 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Commands::AddThermostatSuggestionResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Commands::AtomicResponse::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Commands::StartRangingResponse::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::WiFiNetworkManagement::Commands::NetworkPassphraseResponse::DecodableType & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp index 604eef743ce311..ef6164ece2302d 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp @@ -239,6 +239,8 @@ char const * ClusterIdToText(chip::ClusterId id) return "SoilMeasurement"; case chip::app::Clusters::AmbientContextSensing::Id: return "AmbientContextSensing"; + case chip::app::Clusters::ProximityRanging::Id: + return "ProximityRanging"; case chip::app::Clusters::WiFiNetworkManagement::Id: return "WiFiNetworkManagement"; case chip::app::Clusters::ThreadBorderRouterManagement::Id: @@ -4005,6 +4007,33 @@ char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id) return "Unknown"; } } + case chip::app::Clusters::ProximityRanging::Id: { + switch (id) + { + case chip::app::Clusters::ProximityRanging::Attributes::RangingCapabilities::Id: + return "RangingCapabilities"; + case chip::app::Clusters::ProximityRanging::Attributes::WiFiDevIK::Id: + return "WiFiDevIK"; + case chip::app::Clusters::ProximityRanging::Attributes::BLEDeviceId::Id: + return "BLEDeviceId"; + case chip::app::Clusters::ProximityRanging::Attributes::BLTDevIK::Id: + return "BLTDevIK"; + case chip::app::Clusters::ProximityRanging::Attributes::SessionIDs::Id: + return "SessionIDs"; + case chip::app::Clusters::ProximityRanging::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ProximityRanging::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ProximityRanging::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ProximityRanging::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ProximityRanging::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } case chip::app::Clusters::WiFiNetworkManagement::Id: { switch (id) { @@ -6021,6 +6050,17 @@ char const * AcceptedCommandIdToText(chip::ClusterId cluster, chip::CommandId id return "Unknown"; } } + case chip::app::Clusters::ProximityRanging::Id: { + switch (id) + { + case chip::app::Clusters::ProximityRanging::Commands::StartRangingRequest::Id: + return "StartRangingRequest"; + case chip::app::Clusters::ProximityRanging::Commands::StopRangingRequest::Id: + return "StopRangingRequest"; + default: + return "Unknown"; + } + } case chip::app::Clusters::WiFiNetworkManagement::Id: { switch (id) { @@ -6929,6 +6969,17 @@ char const * GeneratedCommandIdToText(chip::ClusterId cluster, chip::CommandId i return "Unknown"; } } + case chip::app::Clusters::ProximityRanging::Id: { + switch (id) + { + case chip::app::Clusters::ProximityRanging::Commands::StartRangingResponse::Id: + return "StartRangingResponse"; + case chip::app::Clusters::ProximityRanging::Commands::RangingResult::Id: + return "RangingResult"; + default: + return "Unknown"; + } + } case chip::app::Clusters::WiFiNetworkManagement::Id: { switch (id) { diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index b2a3e2e93ab7e6..2c3ec141042c56 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -144,6 +144,7 @@ | RadonConcentrationMeasurement | 0x042F | | SoilMeasurement | 0x0430 | | AmbientContextSensing | 0x0431 | +| ProximityRanging | 0x0433 | | WiFiNetworkManagement | 0x0451 | | ThreadBorderRouterManagement | 0x0452 | | ThreadNetworkDirectory | 0x0453 | @@ -140965,6 +140966,1117 @@ class SubscribeAttributeAmbientContextSensingClusterRevision : public SubscribeA } }; +#endif // MTR_ENABLE_PROVISIONAL +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster ProximityRanging | 0x0433 | +|------------------------------------------------------------------------------| +| Commands: | | +| * StartRangingRequest | 0x00 | +| * StopRangingRequest | 0x02 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * RangingCapabilities | 0x0000 | +| * WiFiDevIK | 0x0001 | +| * BLEDeviceId | 0x0002 | +| * BLTDevIK | 0x0003 | +| * SessionIDs | 0x0004 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL +/* + * Command StartRangingRequest + */ +class ProximityRangingStartRangingRequest : public ClusterCommand { +public: + ProximityRangingStartRangingRequest() + : ClusterCommand("start-ranging-request") + , mComplex_WiFiRangingDeviceRoleConfig(&mRequest.wiFiRangingDeviceRoleConfig) + , mComplex_BLERangingDeviceRoleConfig(&mRequest.BLERangingDeviceRoleConfig) + , mComplex_BLTChannelSoundingDeviceRoleConfig(&mRequest.BLTChannelSoundingDeviceRoleConfig) + , mComplex_Trigger(&mRequest.trigger) + , mComplex_ReportingCondition(&mRequest.reportingCondition) + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("Technology", 0, UINT8_MAX, &mRequest.technology); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("WiFiRangingDeviceRoleConfig", &mComplex_WiFiRangingDeviceRoleConfig); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("BLERangingDeviceRoleConfig", &mComplex_BLERangingDeviceRoleConfig); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("BLTChannelSoundingDeviceRoleConfig", &mComplex_BLTChannelSoundingDeviceRoleConfig); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("FrequencyBand", 0, UINT16_MAX, &mRequest.frequencyBand); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("Bandwidth", 0, UINT32_MAX, &mRequest.bandwidth); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("SecurityMode", 0, UINT8_MAX, &mRequest.securityMode); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("Trigger", &mComplex_Trigger); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("ReportingCondition", &mComplex_ReportingCondition); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ProximityRanging::Commands::StartRangingRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRProximityRangingClusterStartRangingRequestParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.technology = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.technology)]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.wiFiRangingDeviceRoleConfig.HasValue()) { + params.wiFiRangingDeviceRoleConfig = [MTRProximityRangingClusterWiFiRangingDeviceRoleConfigStruct new]; + params.wiFiRangingDeviceRoleConfig.role = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.wiFiRangingDeviceRoleConfig.Value().role)]; + params.wiFiRangingDeviceRoleConfig.peerWiFiDevIK = [NSData dataWithBytes:mRequest.wiFiRangingDeviceRoleConfig.Value().peerWiFiDevIK.data() length:mRequest.wiFiRangingDeviceRoleConfig.Value().peerWiFiDevIK.size()]; + if (mRequest.wiFiRangingDeviceRoleConfig.Value().pmk.HasValue()) { + params.wiFiRangingDeviceRoleConfig.pmk = [NSData dataWithBytes:mRequest.wiFiRangingDeviceRoleConfig.Value().pmk.Value().data() length:mRequest.wiFiRangingDeviceRoleConfig.Value().pmk.Value().size()]; + } else { + params.wiFiRangingDeviceRoleConfig.pmk = nil; + } + } else { + params.wiFiRangingDeviceRoleConfig = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.BLERangingDeviceRoleConfig.HasValue()) { + params.bleRangingDeviceRoleConfig = [MTRProximityRangingClusterBLERangingDeviceRoleConfigStruct new]; + params.bleRangingDeviceRoleConfig.role = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.BLERangingDeviceRoleConfig.Value().role)]; + params.bleRangingDeviceRoleConfig.peerBLEDeviceID = [NSNumber numberWithUnsignedLongLong:mRequest.BLERangingDeviceRoleConfig.Value().peerBLEDeviceID]; + } else { + params.bleRangingDeviceRoleConfig = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.BLTChannelSoundingDeviceRoleConfig.HasValue()) { + params.bltChannelSoundingDeviceRoleConfig = [MTRProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct new]; + params.bltChannelSoundingDeviceRoleConfig.role = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.BLTChannelSoundingDeviceRoleConfig.Value().role)]; + params.bltChannelSoundingDeviceRoleConfig.peerBLTDevIK = [NSData dataWithBytes:mRequest.BLTChannelSoundingDeviceRoleConfig.Value().peerBLTDevIK.data() length:mRequest.BLTChannelSoundingDeviceRoleConfig.Value().peerBLTDevIK.size()]; + if (mRequest.BLTChannelSoundingDeviceRoleConfig.Value().ltk.HasValue()) { + params.bltChannelSoundingDeviceRoleConfig.ltk = [NSData dataWithBytes:mRequest.BLTChannelSoundingDeviceRoleConfig.Value().ltk.Value().data() length:mRequest.BLTChannelSoundingDeviceRoleConfig.Value().ltk.Value().size()]; + } else { + params.bltChannelSoundingDeviceRoleConfig.ltk = nil; + } + } else { + params.bltChannelSoundingDeviceRoleConfig = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.frequencyBand.HasValue()) { + params.frequencyBand = [NSNumber numberWithUnsignedShort:mRequest.frequencyBand.Value().Raw()]; + } else { + params.frequencyBand = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.bandwidth.HasValue()) { + params.bandwidth = [NSNumber numberWithUnsignedInt:mRequest.bandwidth.Value().Raw()]; + } else { + params.bandwidth = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + params.securityMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.securityMode)]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + params.trigger = [MTRProximityRangingClusterRangingTriggerConditionStruct new]; + params.trigger.startTime = [NSNumber numberWithUnsignedInt:mRequest.trigger.startTime]; + if (mRequest.trigger.endTime.HasValue()) { + params.trigger.endTime = [NSNumber numberWithUnsignedInt:mRequest.trigger.endTime.Value()]; + } else { + params.trigger.endTime = nil; + } + if (mRequest.trigger.rangingInstanceInterval.HasValue()) { + params.trigger.rangingInstanceInterval = [NSNumber numberWithUnsignedInt:mRequest.trigger.rangingInstanceInterval.Value()]; + } else { + params.trigger.rangingInstanceInterval = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.reportingCondition.HasValue()) { + params.reportingCondition = [MTRProximityRangingClusterReportingConditionStruct new]; + if (mRequest.reportingCondition.Value().minDistanceCondition.HasValue()) { + params.reportingCondition.minDistanceCondition = [NSNumber numberWithUnsignedShort:mRequest.reportingCondition.Value().minDistanceCondition.Value()]; + } else { + params.reportingCondition.minDistanceCondition = nil; + } + if (mRequest.reportingCondition.Value().maxDistanceCondition.HasValue()) { + params.reportingCondition.maxDistanceCondition = [NSNumber numberWithUnsignedShort:mRequest.reportingCondition.Value().maxDistanceCondition.Value()]; + } else { + params.reportingCondition.maxDistanceCondition = nil; + } + if (mRequest.reportingCondition.Value().accuracyCondition.HasValue()) { + params.reportingCondition.accuracyCondition = [NSNumber numberWithUnsignedShort:mRequest.reportingCondition.Value().accuracyCondition.Value()]; + } else { + params.reportingCondition.accuracyCondition = nil; + } + } else { + params.reportingCondition = nil; + } +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster startRangingRequestWithParams:params completion: + ^(MTRProximityRangingClusterStartRangingResponseParams * _Nullable values, NSError * _Nullable error) { + NSLog(@"Values: %@", values); + if (error == nil) { + constexpr chip::CommandId responseId = chip::app::Clusters::ProximityRanging::Commands::StartRangingResponse::Id; + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); + } + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + constexpr chip::CommandId responseId = chip::app::Clusters::ProximityRanging::Commands::StartRangingResponse::Id; + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::ProximityRanging::Commands::StartRangingRequest::Type mRequest; + TypedComplexArgument> mComplex_WiFiRangingDeviceRoleConfig; + TypedComplexArgument> mComplex_BLERangingDeviceRoleConfig; + TypedComplexArgument> mComplex_BLTChannelSoundingDeviceRoleConfig; + TypedComplexArgument mComplex_Trigger; + TypedComplexArgument> mComplex_ReportingCondition; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command StopRangingRequest + */ +class ProximityRangingStopRangingRequest : public ClusterCommand { +public: + ProximityRangingStopRangingRequest() + : ClusterCommand("stop-ranging-request") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("SessionID", 0, UINT8_MAX, &mRequest.sessionID); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ProximityRanging::Commands::StopRangingRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRProximityRangingClusterStopRangingRequestParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.sessionID = [NSNumber numberWithUnsignedChar:mRequest.sessionID]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stopRangingRequestWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::ProximityRanging::Commands::StopRangingRequest::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute RangingCapabilities + */ +class ReadProximityRangingRangingCapabilities : public ReadAttribute { +public: + ReadProximityRangingRangingCapabilities() + : ReadAttribute("ranging-capabilities") + { + } + + ~ReadProximityRangingRangingCapabilities() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ProximityRanging::Attributes::RangingCapabilities::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeRangingCapabilitiesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.RangingCapabilities response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ProximityRanging RangingCapabilities read Error", error); + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeProximityRangingRangingCapabilities : public SubscribeAttribute { +public: + SubscribeAttributeProximityRangingRangingCapabilities() + : SubscribeAttribute("ranging-capabilities") + { + } + + ~SubscribeAttributeProximityRangingRangingCapabilities() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ProximityRanging::Attributes::RangingCapabilities::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeRangingCapabilitiesWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.RangingCapabilities response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute WiFiDevIK + */ +class ReadProximityRangingWiFiDevIK : public ReadAttribute { +public: + ReadProximityRangingWiFiDevIK() + : ReadAttribute("wi-fi-dev-ik") + { + } + + ~ReadProximityRangingWiFiDevIK() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ProximityRanging::Attributes::WiFiDevIK::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeWiFiDevIKWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.WiFiDevIK response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ProximityRanging WiFiDevIK read Error", error); + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeProximityRangingWiFiDevIK : public SubscribeAttribute { +public: + SubscribeAttributeProximityRangingWiFiDevIK() + : SubscribeAttribute("wi-fi-dev-ik") + { + } + + ~SubscribeAttributeProximityRangingWiFiDevIK() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ProximityRanging::Attributes::WiFiDevIK::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWiFiDevIKWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.WiFiDevIK response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute BLEDeviceId + */ +class ReadProximityRangingBLEDeviceId : public ReadAttribute { +public: + ReadProximityRangingBLEDeviceId() + : ReadAttribute("bledevice-id") + { + } + + ~ReadProximityRangingBLEDeviceId() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ProximityRanging::Attributes::BLEDeviceId::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeBLEDeviceIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.BLEDeviceId response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ProximityRanging BLEDeviceId read Error", error); + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeProximityRangingBLEDeviceId : public SubscribeAttribute { +public: + SubscribeAttributeProximityRangingBLEDeviceId() + : SubscribeAttribute("bledevice-id") + { + } + + ~SubscribeAttributeProximityRangingBLEDeviceId() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ProximityRanging::Attributes::BLEDeviceId::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBLEDeviceIdWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.BLEDeviceId response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute BLTDevIK + */ +class ReadProximityRangingBLTDevIK : public ReadAttribute { +public: + ReadProximityRangingBLTDevIK() + : ReadAttribute("bltdev-ik") + { + } + + ~ReadProximityRangingBLTDevIK() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ProximityRanging::Attributes::BLTDevIK::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeBLTDevIKWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.BLTDevIK response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ProximityRanging BLTDevIK read Error", error); + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeProximityRangingBLTDevIK : public SubscribeAttribute { +public: + SubscribeAttributeProximityRangingBLTDevIK() + : SubscribeAttribute("bltdev-ik") + { + } + + ~SubscribeAttributeProximityRangingBLTDevIK() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ProximityRanging::Attributes::BLTDevIK::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeBLTDevIKWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.BLTDevIK response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute SessionIDs + */ +class ReadProximityRangingSessionIDs : public ReadAttribute { +public: + ReadProximityRangingSessionIDs() + : ReadAttribute("session-ids") + { + } + + ~ReadProximityRangingSessionIDs() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ProximityRanging::Attributes::SessionIDs::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeSessionIDsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.SessionIDs response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ProximityRanging SessionIDs read Error", error); + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeProximityRangingSessionIDs : public SubscribeAttribute { +public: + SubscribeAttributeProximityRangingSessionIDs() + : SubscribeAttribute("session-ids") + { + } + + ~SubscribeAttributeProximityRangingSessionIDs() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ProximityRanging::Attributes::SessionIDs::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSessionIDsWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.SessionIDs response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute GeneratedCommandList + */ +class ReadProximityRangingGeneratedCommandList : public ReadAttribute { +public: + ReadProximityRangingGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadProximityRangingGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ProximityRanging::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.GeneratedCommandList response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ProximityRanging GeneratedCommandList read Error", error); + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeProximityRangingGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeProximityRangingGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeProximityRangingGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ProximityRanging::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.GeneratedCommandList response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AcceptedCommandList + */ +class ReadProximityRangingAcceptedCommandList : public ReadAttribute { +public: + ReadProximityRangingAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadProximityRangingAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ProximityRanging::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.AcceptedCommandList response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ProximityRanging AcceptedCommandList read Error", error); + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeProximityRangingAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeProximityRangingAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeProximityRangingAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ProximityRanging::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.AcceptedCommandList response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AttributeList + */ +class ReadProximityRangingAttributeList : public ReadAttribute { +public: + ReadProximityRangingAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadProximityRangingAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ProximityRanging::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.AttributeList response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ProximityRanging AttributeList read Error", error); + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeProximityRangingAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeProximityRangingAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeProximityRangingAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ProximityRanging::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.AttributeList response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute FeatureMap + */ +class ReadProximityRangingFeatureMap : public ReadAttribute { +public: + ReadProximityRangingFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadProximityRangingFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ProximityRanging::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.FeatureMap response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ProximityRanging FeatureMap read Error", error); + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeProximityRangingFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeProximityRangingFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeProximityRangingFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ProximityRanging::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.FeatureMap response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute ClusterRevision + */ +class ReadProximityRangingClusterRevision : public ReadAttribute { +public: + ReadProximityRangingClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadProximityRangingClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ProximityRanging::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.ClusterRevision response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ProximityRanging ClusterRevision read Error", error); + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeProximityRangingClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeProximityRangingClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeProximityRangingClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ProximityRanging::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ProximityRanging::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterProximityRanging alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ProximityRanging.ClusterRevision response %@", [value description]); + if (error == nil) { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + TEMPORARY_RETURN_IGNORED RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ @@ -200897,6 +202009,69 @@ void registerClusterAmbientContextSensing(Commands & commands) commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } +void registerClusterProximityRanging(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::ProximityRanging; + + const char * clusterName = "ProximityRanging"; + + commands_list clusterCommands = { + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + make_unique(Id), // + make_unique(Id), // + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + }; + + commands.RegisterCluster(clusterName, clusterCommands); +#endif // MTR_ENABLE_PROVISIONAL +} void registerClusterWiFiNetworkManagement(Commands & commands) { using namespace chip::app::Clusters::WiFiNetworkManagement; @@ -203418,6 +204593,7 @@ void registerClusters(Commands & commands) registerClusterRadonConcentrationMeasurement(commands); registerClusterSoilMeasurement(commands); registerClusterAmbientContextSensing(commands); + registerClusterProximityRanging(commands); registerClusterWiFiNetworkManagement(commands); registerClusterThreadBorderRouterManagement(commands); registerClusterThreadNetworkDirectory(commands); From 9b8ea580f7fcadcba7decf183a3c884a5945efdc Mon Sep 17 00:00:00 2001 From: Sean McClain Date: Tue, 17 Mar 2026 14:52:16 -0500 Subject: [PATCH 3/3] Updated Proximity Ranging cluster definition based on latest spec --- .../chip/proximity-ranging-cluster.xml | 81 +++- .../data_model/controller-clusters.matter | 66 ++- .../devicecontroller/ChipEventStructs.java | 122 ++++++ .../chip/devicecontroller/ChipStructs.java | 99 +++-- .../devicecontroller/ClusterIDMapping.java | 4 +- ...oximityRangingClusterRangingResultEvent.kt | 62 +++ ...RangingClusterRangingSessionStatusEvent.kt | 59 +++ .../chip/devicecontroller/cluster/files.gni | 2 + ...LTChannelSoundingDeviceRoleConfigStruct.kt | 16 +- ...gingClusterRangingMeasurementDataStruct.kt | 56 ++- ...yRangingClusterReportingConditionStruct.kt | 20 +- ...oximityRangingClusterRangingResultEvent.kt | 62 +++ ...RangingClusterRangingSessionStatusEvent.kt | 59 +++ .../java/matter/controller/cluster/files.gni | 2 + ...LTChannelSoundingDeviceRoleConfigStruct.kt | 16 +- ...gingClusterRangingMeasurementDataStruct.kt | 56 ++- ...yRangingClusterReportingConditionStruct.kt | 20 +- .../CHIPEventTLVValueDecoder.cpp | 412 ++++++++++++++++++ .../python/matter/clusters/Objects.py | 137 ++++-- .../CHIP/zap-generated/MTRBaseClusters.h | 32 +- .../CHIP/zap-generated/MTRClusterConstants.h | 5 +- .../CHIP/zap-generated/MTRClusterNames.mm | 13 +- .../zap-generated/MTRCommandPayloadsObjc.h | 21 - .../zap-generated/MTRCommandPayloadsObjc.mm | 163 +------ .../MTRCommandPayloads_Internal.h | 7 - .../zap-generated/MTREventTLVValueDecoder.mm | 112 +++++ .../CHIP/zap-generated/MTRStructsObjc.h | 19 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 83 +++- .../clusters/ProximityRanging/CommandIds.h | 6 +- .../clusters/ProximityRanging/Commands.h | 41 -- .../clusters/ProximityRanging/Commands.ipp | 33 -- .../clusters/ProximityRanging/Enums.h | 60 ++- .../clusters/ProximityRanging/EnumsCheck.h | 58 +++ .../clusters/ProximityRanging/EventIds.h | 11 +- .../clusters/ProximityRanging/Events.h | 75 +++- .../clusters/ProximityRanging/Events.ipp | 75 +++- .../clusters/ProximityRanging/Metadata.h | 10 +- .../clusters/ProximityRanging/Structs.h | 46 +- .../clusters/ProximityRanging/Structs.ipp | 27 +- .../zap-generated/cluster/Commands.h | 10 +- .../cluster/ComplexArgumentParser.cpp | 48 +- .../cluster/logging/DataModelLogger.cpp | 110 ++++- .../cluster/logging/DataModelLogger.h | 6 +- .../cluster/logging/EntryToText.cpp | 2 - .../zap-generated/cluster/Commands.h | 15 +- 45 files changed, 1952 insertions(+), 487 deletions(-) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ProximityRangingClusterRangingResultEvent.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ProximityRangingClusterRangingSessionStatusEvent.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/eventstructs/ProximityRangingClusterRangingResultEvent.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/eventstructs/ProximityRangingClusterRangingSessionStatusEvent.kt diff --git a/src/app/zap-templates/zcl/data-model/chip/proximity-ranging-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/proximity-ranging-cluster.xml index 90de838da1a891..4273aab67d5000 100644 --- a/src/app/zap-templates/zcl/data-model/chip/proximity-ranging-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/proximity-ranging-cluster.xml @@ -18,7 +18,7 @@ limitations under the License. XML generated by Alchemy; DO NOT EDIT. Source: src/app_clusters/ProximityRanging.adoc Parameters: zap /Users/seanmccs/git/connectedhomeip-spec/src/app_clusters/ProximityRanging.adoc verbose spec-root=/Users/seanmccs/git/connectedhomeip-spec attribute=in-progress sdk-root=/Users/seanmccs/git/connectedhomeip_fork -Git: 0.9-summer2026-108-ge59a2fe81-dirty +Git: 0.9-summer2026-297-gfdd916b22 Alchemy: v1.6.10 --> @@ -30,7 +30,7 @@ Alchemy: v1.6.10 - + @@ -48,6 +48,32 @@ Alchemy: v1.6.10 + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -64,6 +90,14 @@ Alchemy: v1.6.10 + + + + + + + + @@ -91,7 +125,8 @@ Alchemy: v1.6.10 - + + @@ -100,7 +135,7 @@ Alchemy: v1.6.10 - + @@ -116,11 +151,13 @@ Alchemy: v1.6.10 - - - - - + + + + + + + @@ -134,7 +171,7 @@ Alchemy: v1.6.10 - + @@ -170,15 +207,15 @@ Alchemy: v1.6.10 - + - + - + - + @@ -205,11 +242,17 @@ Alchemy: v1.6.10 - - The RangingResult command is used by the initiator to report ranging measurement data. - - - + + + + The RangingResult event is used by the initiator to report ranging measurement data. + + + + + + The RangingSessionStatus event reports the current status of the proximity ranging session identified by the associated SessionID. + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 7094ebf9a66292..70341fc8a8ffb6 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -8842,6 +8842,29 @@ provisional cluster AmbientContextSensing = 1073 { provisional cluster ProximityRanging = 1075 { revision 1; + enum BLTCSSecurityLevelEnum : enum8 { + kCSSECURITYLEVELUNKNOWN = 0 [spec_name = "CS_SECURITY_LEVEL_UNKNOWN"]; + kCSSECURITYLEVELONE = 1 [spec_name = "CS_SECURITY_LEVEL_ONE"]; + kCSSECURITYLEVELTWO = 2 [spec_name = "CS_SECURITY_LEVEL_TWO"]; + kCSSECURITYLEVELTHREE = 3 [spec_name = "CS_SECURITY_LEVEL_THREE"]; + } + + enum NADMEnum : enum8 { + kAttackExtremelyUnlikely = 0; + kAttackVeryUnlikely = 1; + kAttackUnlikely = 2; + kAttackIsPossible = 3; + kAttackIsLikely = 4; + kAttackVeryLikely = 5; + kAttackExtremelyLikely = 6; + kUnknown = 255; + } + + enum RDRReferenceEnum : enum8 { + kDeviceCoordinates = 0; + kEarthCoordinates = 1; + } + enum RangingRoleEnum : enum8 { kWiFiSubscriberRole = 0; kWiFiPublisherRole = 1; @@ -8856,6 +8879,13 @@ provisional cluster ProximityRanging = 1075 { kOpenRanging = 1; } + enum RangingSessionStatusEnum : enum8 { + kSessionEndTimeReached = 0; + kPeerNotFound = 1; + kHardwareError = 2; + kStopRequested = 3; + } + enum RangingTechEnum : enum8 { kBluetoothChannelSounding = 0; kWiFiRoundTripTimeRanging = 1; @@ -8884,7 +8914,7 @@ provisional cluster ProximityRanging = 1075 { k5G = 0x4 [spec_name = "5G"]; k6G = 0x8 [spec_name = "6G"]; k60G = 0x10 [spec_name = "60G"]; - k1G = 0x20 [spec_name = "1G"]; + kS1G = 0x20 [spec_name = "S1G"]; k45G = 0x40 [spec_name = "45G"]; } @@ -8906,7 +8936,7 @@ provisional cluster ProximityRanging = 1075 { int16s elevation = 1; int8u azimuthAccuracy = 2; int8u elevationAccuracy = 3; - int8u reference = 4; + RDRReferenceEnum reference = 4; } struct RangingMeasurementDataStruct { @@ -8914,11 +8944,13 @@ provisional cluster ProximityRanging = 1075 { optional int64u BLEDeviceId = 1; optional octet_string BLTDevIK = 2; optional epoch_s timeOfMeasurement = 3; - nullable int16u distance = 4; - optional int16s accuracy = 5; - optional RDRStruct rdr = 6; - optional nullable int8s rssi = 7; - optional nullable int8s txPower = 8; + optional elapsed_s timeOfMeasurementOffset = 4; + nullable int16u distance = 5; + optional int16s errorMargin = 6; + optional RDRStruct rdr = 7; + optional NADMEnum detectedAttackLevel = 8; + optional nullable int8s rssi = 9; + optional nullable int8s txPower = 10; } struct BLERangingDeviceRoleConfigStruct { @@ -8929,7 +8961,8 @@ provisional cluster ProximityRanging = 1075 { struct BLTChannelSoundingDeviceRoleConfigStruct { RangingRoleEnum role = 0; octet_string<16> peerBLTDevIK = 1; - optional octet_string<16> ltk = 2; + optional BLTCSSecurityLevelEnum BLTCSSecurityLevel = 2; + optional octet_string<16> ltk = 3; } struct RangingCapabilitiesStruct { @@ -8947,7 +8980,7 @@ provisional cluster ProximityRanging = 1075 { struct ReportingConditionStruct { optional int16u minDistanceCondition = 0; optional int16u maxDistanceCondition = 1; - optional int16u accuracyCondition = 2; + optional int16u errorMarginCondition = 2; } struct WiFiRangingDeviceRoleConfigStruct { @@ -8956,6 +8989,16 @@ provisional cluster ProximityRanging = 1075 { optional octet_string<32> pmk = 2; } + info event RangingResult = 0 { + int8u sessionID = 0; + RangingMeasurementDataStruct rangingResultData = 1; + } + + info event RangingSessionStatus = 1 { + int8u sessionID = 0; + RangingSessionStatusEnum status = 1; + } + readonly attribute RangingCapabilitiesStruct rangingCapabilities[] = 0; readonly attribute optional octet_string<16> wiFiDevIK = 1; readonly attribute optional int64u BLEDeviceId = 2; @@ -8988,11 +9031,6 @@ provisional cluster ProximityRanging = 1075 { int8u sessionID = 0; } - response struct RangingResult = 3 { - int8u sessionID = 0; - RangingMeasurementDataStruct rangingResultData = 1; - } - /** This command allows the client to request the start of a ranging session. */ command StartRangingRequest(StartRangingRequestRequest): StartRangingResponse = 0; /** Upon receipt of a StopRangingRequest command that contains a SessionID that matches an active ranging session, the server SHALL terminate the corresponding ranging session. */ diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java index 991d80e1b0617a..54443a5c7b9805 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java @@ -6800,6 +6800,128 @@ public String toString() { return output.toString(); } } +public static class ProximityRangingClusterRangingResultEvent { + public Integer sessionID; + public ChipStructs.ProximityRangingClusterRangingMeasurementDataStruct rangingResultData; + private static final long SESSION_ID_ID = 0L; + private static final long RANGING_RESULT_DATA_ID = 1L; + + public ProximityRangingClusterRangingResultEvent( + Integer sessionID, + ChipStructs.ProximityRangingClusterRangingMeasurementDataStruct rangingResultData + ) { + this.sessionID = sessionID; + this.rangingResultData = rangingResultData; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(SESSION_ID_ID, new UIntType(sessionID))); + values.add(new StructElement(RANGING_RESULT_DATA_ID, rangingResultData.encodeTlv())); + + return new StructType(values); + } + + public static ProximityRangingClusterRangingResultEvent decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer sessionID = null; + ChipStructs.ProximityRangingClusterRangingMeasurementDataStruct rangingResultData = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == SESSION_ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + sessionID = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == RANGING_RESULT_DATA_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + rangingResultData = ChipStructs.ProximityRangingClusterRangingMeasurementDataStruct.decodeTlv(castingValue); + } + } + } + return new ProximityRangingClusterRangingResultEvent( + sessionID, + rangingResultData + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ProximityRangingClusterRangingResultEvent {\n"); + output.append("\tsessionID: "); + output.append(sessionID); + output.append("\n"); + output.append("\trangingResultData: "); + output.append(rangingResultData); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ProximityRangingClusterRangingSessionStatusEvent { + public Integer sessionID; + public Integer status; + private static final long SESSION_ID_ID = 0L; + private static final long STATUS_ID = 1L; + + public ProximityRangingClusterRangingSessionStatusEvent( + Integer sessionID, + Integer status + ) { + this.sessionID = sessionID; + this.status = status; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(SESSION_ID_ID, new UIntType(sessionID))); + values.add(new StructElement(STATUS_ID, new UIntType(status))); + + return new StructType(values); + } + + public static ProximityRangingClusterRangingSessionStatusEvent decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer sessionID = null; + Integer status = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == SESSION_ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + sessionID = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == STATUS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + status = castingValue.value(Integer.class); + } + } + } + return new ProximityRangingClusterRangingSessionStatusEvent( + sessionID, + status + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ProximityRangingClusterRangingSessionStatusEvent {\n"); + output.append("\tsessionID: "); + output.append(sessionID); + output.append("\n"); + output.append("\tstatus: "); + output.append(status); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class TargetNavigatorClusterTargetUpdatedEvent { public ArrayList targetList; public Integer currentTarget; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 2d9dfb4c02c313..ea3cb95eeb0299 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -12239,29 +12239,35 @@ public static class ProximityRangingClusterRangingMeasurementDataStruct { public Optional BLEDeviceId; public Optional BLTDevIK; public Optional timeOfMeasurement; + public Optional timeOfMeasurementOffset; public @Nullable Integer distance; - public Optional accuracy; + public Optional errorMargin; public Optional rdr; + public Optional detectedAttackLevel; public @Nullable Optional rssi; public @Nullable Optional txPower; private static final long WI_FI_DEV_IK_ID = 0L; private static final long BLE_DEVICE_ID_ID = 1L; private static final long BLT_DEV_IK_ID = 2L; private static final long TIME_OF_MEASUREMENT_ID = 3L; - private static final long DISTANCE_ID = 4L; - private static final long ACCURACY_ID = 5L; - private static final long RDR_ID = 6L; - private static final long RSSI_ID = 7L; - private static final long TX_POWER_ID = 8L; + private static final long TIME_OF_MEASUREMENT_OFFSET_ID = 4L; + private static final long DISTANCE_ID = 5L; + private static final long ERROR_MARGIN_ID = 6L; + private static final long RDR_ID = 7L; + private static final long DETECTED_ATTACK_LEVEL_ID = 8L; + private static final long RSSI_ID = 9L; + private static final long TX_POWER_ID = 10L; public ProximityRangingClusterRangingMeasurementDataStruct( Optional wiFiDevIK, Optional BLEDeviceId, Optional BLTDevIK, Optional timeOfMeasurement, + Optional timeOfMeasurementOffset, @Nullable Integer distance, - Optional accuracy, + Optional errorMargin, Optional rdr, + Optional detectedAttackLevel, @Nullable Optional rssi, @Nullable Optional txPower ) { @@ -12269,9 +12275,11 @@ public ProximityRangingClusterRangingMeasurementDataStruct( this.BLEDeviceId = BLEDeviceId; this.BLTDevIK = BLTDevIK; this.timeOfMeasurement = timeOfMeasurement; + this.timeOfMeasurementOffset = timeOfMeasurementOffset; this.distance = distance; - this.accuracy = accuracy; + this.errorMargin = errorMargin; this.rdr = rdr; + this.detectedAttackLevel = detectedAttackLevel; this.rssi = rssi; this.txPower = txPower; } @@ -12282,9 +12290,11 @@ public StructType encodeTlv() { values.add(new StructElement(BLE_DEVICE_ID_ID, BLEDeviceId.map((nonOptionalBLEDeviceId) -> new UIntType(nonOptionalBLEDeviceId)).orElse(new EmptyType()))); values.add(new StructElement(BLT_DEV_IK_ID, BLTDevIK.map((nonOptionalBLTDevIK) -> new ByteArrayType(nonOptionalBLTDevIK)).orElse(new EmptyType()))); values.add(new StructElement(TIME_OF_MEASUREMENT_ID, timeOfMeasurement.map((nonOptionaltimeOfMeasurement) -> new UIntType(nonOptionaltimeOfMeasurement)).orElse(new EmptyType()))); + values.add(new StructElement(TIME_OF_MEASUREMENT_OFFSET_ID, timeOfMeasurementOffset.map((nonOptionaltimeOfMeasurementOffset) -> new UIntType(nonOptionaltimeOfMeasurementOffset)).orElse(new EmptyType()))); values.add(new StructElement(DISTANCE_ID, distance != null ? new UIntType(distance) : new NullType())); - values.add(new StructElement(ACCURACY_ID, accuracy.map((nonOptionalaccuracy) -> new IntType(nonOptionalaccuracy)).orElse(new EmptyType()))); + values.add(new StructElement(ERROR_MARGIN_ID, errorMargin.map((nonOptionalerrorMargin) -> new IntType(nonOptionalerrorMargin)).orElse(new EmptyType()))); values.add(new StructElement(RDR_ID, rdr.map((nonOptionalrdr) -> nonOptionalrdr.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(DETECTED_ATTACK_LEVEL_ID, detectedAttackLevel.map((nonOptionaldetectedAttackLevel) -> new UIntType(nonOptionaldetectedAttackLevel)).orElse(new EmptyType()))); values.add(new StructElement(RSSI_ID, rssi != null ? rssi.map((nonOptionalrssi) -> new IntType(nonOptionalrssi)).orElse(new EmptyType()) : new NullType())); values.add(new StructElement(TX_POWER_ID, txPower != null ? txPower.map((nonOptionaltxPower) -> new IntType(nonOptionaltxPower)).orElse(new EmptyType()) : new NullType())); @@ -12299,9 +12309,11 @@ public static ProximityRangingClusterRangingMeasurementDataStruct decodeTlv(Base Optional BLEDeviceId = Optional.empty(); Optional BLTDevIK = Optional.empty(); Optional timeOfMeasurement = Optional.empty(); + Optional timeOfMeasurementOffset = Optional.empty(); @Nullable Integer distance = null; - Optional accuracy = Optional.empty(); + Optional errorMargin = Optional.empty(); Optional rdr = Optional.empty(); + Optional detectedAttackLevel = Optional.empty(); @Nullable Optional rssi = null; @Nullable Optional txPower = null; for (StructElement element: ((StructType)tlvValue).value()) { @@ -12325,21 +12337,31 @@ public static ProximityRangingClusterRangingMeasurementDataStruct decodeTlv(Base UIntType castingValue = element.value(UIntType.class); timeOfMeasurement = Optional.of(castingValue.value(Long.class)); } + } else if (element.contextTagNum() == TIME_OF_MEASUREMENT_OFFSET_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + timeOfMeasurementOffset = Optional.of(castingValue.value(Long.class)); + } } else if (element.contextTagNum() == DISTANCE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); distance = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == ACCURACY_ID) { + } else if (element.contextTagNum() == ERROR_MARGIN_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Int) { IntType castingValue = element.value(IntType.class); - accuracy = Optional.of(castingValue.value(Integer.class)); + errorMargin = Optional.of(castingValue.value(Integer.class)); } } else if (element.contextTagNum() == RDR_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Struct) { StructType castingValue = element.value(StructType.class); rdr = Optional.of(ChipStructs.ProximityRangingClusterRDRStruct.decodeTlv(castingValue)); } + } else if (element.contextTagNum() == DETECTED_ATTACK_LEVEL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + detectedAttackLevel = Optional.of(castingValue.value(Integer.class)); + } } else if (element.contextTagNum() == RSSI_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Int) { IntType castingValue = element.value(IntType.class); @@ -12357,9 +12379,11 @@ public static ProximityRangingClusterRangingMeasurementDataStruct decodeTlv(Base BLEDeviceId, BLTDevIK, timeOfMeasurement, + timeOfMeasurementOffset, distance, - accuracy, + errorMargin, rdr, + detectedAttackLevel, rssi, txPower ); @@ -12381,15 +12405,21 @@ public String toString() { output.append("\ttimeOfMeasurement: "); output.append(timeOfMeasurement); output.append("\n"); + output.append("\ttimeOfMeasurementOffset: "); + output.append(timeOfMeasurementOffset); + output.append("\n"); output.append("\tdistance: "); output.append(distance); output.append("\n"); - output.append("\taccuracy: "); - output.append(accuracy); + output.append("\terrorMargin: "); + output.append(errorMargin); output.append("\n"); output.append("\trdr: "); output.append(rdr); output.append("\n"); + output.append("\tdetectedAttackLevel: "); + output.append(detectedAttackLevel); + output.append("\n"); output.append("\trssi: "); output.append(rssi); output.append("\n"); @@ -12464,18 +12494,22 @@ public String toString() { public static class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct { public Integer role; public byte[] peerBLTDevIK; + public Optional BLTCSSecurityLevel; public Optional ltk; private static final long ROLE_ID = 0L; private static final long PEER_BLT_DEV_IK_ID = 1L; - private static final long LTK_ID = 2L; + private static final long BLTCS_SECURITY_LEVEL_ID = 2L; + private static final long LTK_ID = 3L; public ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( Integer role, byte[] peerBLTDevIK, + Optional BLTCSSecurityLevel, Optional ltk ) { this.role = role; this.peerBLTDevIK = peerBLTDevIK; + this.BLTCSSecurityLevel = BLTCSSecurityLevel; this.ltk = ltk; } @@ -12483,6 +12517,7 @@ public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(ROLE_ID, new UIntType(role))); values.add(new StructElement(PEER_BLT_DEV_IK_ID, new ByteArrayType(peerBLTDevIK))); + values.add(new StructElement(BLTCS_SECURITY_LEVEL_ID, BLTCSSecurityLevel.map((nonOptionalBLTCSSecurityLevel) -> new UIntType(nonOptionalBLTCSSecurityLevel)).orElse(new EmptyType()))); values.add(new StructElement(LTK_ID, ltk.map((nonOptionalltk) -> new ByteArrayType(nonOptionalltk)).orElse(new EmptyType()))); return new StructType(values); @@ -12494,6 +12529,7 @@ public static ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct de } Integer role = null; byte[] peerBLTDevIK = null; + Optional BLTCSSecurityLevel = Optional.empty(); Optional ltk = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == ROLE_ID) { @@ -12506,6 +12542,11 @@ public static ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct de ByteArrayType castingValue = element.value(ByteArrayType.class); peerBLTDevIK = castingValue.value(byte[].class); } + } else if (element.contextTagNum() == BLTCS_SECURITY_LEVEL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + BLTCSSecurityLevel = Optional.of(castingValue.value(Integer.class)); + } } else if (element.contextTagNum() == LTK_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { ByteArrayType castingValue = element.value(ByteArrayType.class); @@ -12516,6 +12557,7 @@ public static ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct de return new ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( role, peerBLTDevIK, + BLTCSSecurityLevel, ltk ); } @@ -12530,6 +12572,9 @@ public String toString() { output.append("\tpeerBLTDevIK: "); output.append(Arrays.toString(peerBLTDevIK)); output.append("\n"); + output.append("\tBLTCSSecurityLevel: "); + output.append(BLTCSSecurityLevel); + output.append("\n"); output.append("\tltk: "); output.append(ltk.isPresent() ? Arrays.toString(ltk.get()) : ""); output.append("\n"); @@ -12692,26 +12737,26 @@ public String toString() { public static class ProximityRangingClusterReportingConditionStruct { public Optional minDistanceCondition; public Optional maxDistanceCondition; - public Optional accuracyCondition; + public Optional errorMarginCondition; private static final long MIN_DISTANCE_CONDITION_ID = 0L; private static final long MAX_DISTANCE_CONDITION_ID = 1L; - private static final long ACCURACY_CONDITION_ID = 2L; + private static final long ERROR_MARGIN_CONDITION_ID = 2L; public ProximityRangingClusterReportingConditionStruct( Optional minDistanceCondition, Optional maxDistanceCondition, - Optional accuracyCondition + Optional errorMarginCondition ) { this.minDistanceCondition = minDistanceCondition; this.maxDistanceCondition = maxDistanceCondition; - this.accuracyCondition = accuracyCondition; + this.errorMarginCondition = errorMarginCondition; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(MIN_DISTANCE_CONDITION_ID, minDistanceCondition.map((nonOptionalminDistanceCondition) -> new UIntType(nonOptionalminDistanceCondition)).orElse(new EmptyType()))); values.add(new StructElement(MAX_DISTANCE_CONDITION_ID, maxDistanceCondition.map((nonOptionalmaxDistanceCondition) -> new UIntType(nonOptionalmaxDistanceCondition)).orElse(new EmptyType()))); - values.add(new StructElement(ACCURACY_CONDITION_ID, accuracyCondition.map((nonOptionalaccuracyCondition) -> new UIntType(nonOptionalaccuracyCondition)).orElse(new EmptyType()))); + values.add(new StructElement(ERROR_MARGIN_CONDITION_ID, errorMarginCondition.map((nonOptionalerrorMarginCondition) -> new UIntType(nonOptionalerrorMarginCondition)).orElse(new EmptyType()))); return new StructType(values); } @@ -12722,7 +12767,7 @@ public static ProximityRangingClusterReportingConditionStruct decodeTlv(BaseTLVT } Optional minDistanceCondition = Optional.empty(); Optional maxDistanceCondition = Optional.empty(); - Optional accuracyCondition = Optional.empty(); + Optional errorMarginCondition = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == MIN_DISTANCE_CONDITION_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -12734,17 +12779,17 @@ public static ProximityRangingClusterReportingConditionStruct decodeTlv(BaseTLVT UIntType castingValue = element.value(UIntType.class); maxDistanceCondition = Optional.of(castingValue.value(Integer.class)); } - } else if (element.contextTagNum() == ACCURACY_CONDITION_ID) { + } else if (element.contextTagNum() == ERROR_MARGIN_CONDITION_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - accuracyCondition = Optional.of(castingValue.value(Integer.class)); + errorMarginCondition = Optional.of(castingValue.value(Integer.class)); } } } return new ProximityRangingClusterReportingConditionStruct( minDistanceCondition, maxDistanceCondition, - accuracyCondition + errorMarginCondition ); } @@ -12758,8 +12803,8 @@ public String toString() { output.append("\tmaxDistanceCondition: "); output.append(maxDistanceCondition); output.append("\n"); - output.append("\taccuracyCondition: "); - output.append(accuracyCondition); + output.append("\terrorMarginCondition: "); + output.append(errorMarginCondition); output.append("\n"); output.append("}\n"); return output.toString(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 3d8b40edcc8ae1..e950973af5ecd8 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -15360,7 +15360,9 @@ public static Attribute value(long id) throws NoSuchFieldError { } } - public enum Event {; + public enum Event { + RangingResult(0L), + RangingSessionStatus(1L),; private final long id; Event(long id) { this.id = id; diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ProximityRangingClusterRangingResultEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ProximityRangingClusterRangingResultEvent.kt new file mode 100644 index 00000000000000..8d84035c2458ea --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ProximityRangingClusterRangingResultEvent.kt @@ -0,0 +1,62 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.eventstructs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRangingResultEvent( + val sessionID: UInt, + val rangingResultData: + chip.devicecontroller.cluster.structs.ProximityRangingClusterRangingMeasurementDataStruct, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRangingResultEvent {\n") + append("\tsessionID : $sessionID\n") + append("\trangingResultData : $rangingResultData\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) + rangingResultData.toTlv(ContextSpecificTag(TAG_RANGING_RESULT_DATA), this) + endStructure() + } + } + + companion object { + private const val TAG_SESSION_ID = 0 + private const val TAG_RANGING_RESULT_DATA = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ProximityRangingClusterRangingResultEvent { + tlvReader.enterStructure(tlvTag) + val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_ID)) + val rangingResultData = + chip.devicecontroller.cluster.structs.ProximityRangingClusterRangingMeasurementDataStruct + .fromTlv(ContextSpecificTag(TAG_RANGING_RESULT_DATA), tlvReader) + + tlvReader.exitContainer() + + return ProximityRangingClusterRangingResultEvent(sessionID, rangingResultData) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ProximityRangingClusterRangingSessionStatusEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ProximityRangingClusterRangingSessionStatusEvent.kt new file mode 100644 index 00000000000000..88bc69f96105af --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ProximityRangingClusterRangingSessionStatusEvent.kt @@ -0,0 +1,59 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.eventstructs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRangingSessionStatusEvent(val sessionID: UInt, val status: UInt) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRangingSessionStatusEvent {\n") + append("\tsessionID : $sessionID\n") + append("\tstatus : $status\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) + put(ContextSpecificTag(TAG_STATUS), status) + endStructure() + } + } + + companion object { + private const val TAG_SESSION_ID = 0 + private const val TAG_STATUS = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterRangingSessionStatusEvent { + tlvReader.enterStructure(tlvTag) + val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_ID)) + val status = tlvReader.getUInt(ContextSpecificTag(TAG_STATUS)) + + tlvReader.exitContainer() + + return ProximityRangingClusterRangingSessionStatusEvent(sessionID, status) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index f17fdfcaab705b..cc8faee80530aa 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -318,6 +318,8 @@ eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterBatChargeFaultChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterBatFaultChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterWiredFaultChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ProximityRangingClusterRangingResultEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ProximityRangingClusterRangingSessionStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PushAvStreamTransportClusterPushTransportBeginEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PushAvStreamTransportClusterPushTransportEndEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RefrigeratorAlarmClusterNotifyEvent.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt index 1342e0f502a088..c13bc4ffdd1386 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt @@ -26,12 +26,14 @@ import matter.tlv.TlvWriter class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( val role: UInt, val peerBLTDevIK: ByteArray, + val BLTCSSecurityLevel: Optional, val ltk: Optional, ) { override fun toString(): String = buildString { append("ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct {\n") append("\trole : $role\n") append("\tpeerBLTDevIK : $peerBLTDevIK\n") + append("\tBLTCSSecurityLevel : $BLTCSSecurityLevel\n") append("\tltk : $ltk\n") append("}\n") } @@ -41,6 +43,10 @@ class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( startStructure(tlvTag) put(ContextSpecificTag(TAG_ROLE), role) put(ContextSpecificTag(TAG_PEER_BLT_DEV_IK), peerBLTDevIK) + if (BLTCSSecurityLevel.isPresent) { + val optBLTCSSecurityLevel = BLTCSSecurityLevel.get() + put(ContextSpecificTag(TAG_BLTCS_SECURITY_LEVEL), optBLTCSSecurityLevel) + } if (ltk.isPresent) { val optltk = ltk.get() put(ContextSpecificTag(TAG_LTK), optltk) @@ -52,7 +58,8 @@ class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( companion object { private const val TAG_ROLE = 0 private const val TAG_PEER_BLT_DEV_IK = 1 - private const val TAG_LTK = 2 + private const val TAG_BLTCS_SECURITY_LEVEL = 2 + private const val TAG_LTK = 3 fun fromTlv( tlvTag: Tag, @@ -61,6 +68,12 @@ class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( tlvReader.enterStructure(tlvTag) val role = tlvReader.getUInt(ContextSpecificTag(TAG_ROLE)) val peerBLTDevIK = tlvReader.getByteArray(ContextSpecificTag(TAG_PEER_BLT_DEV_IK)) + val BLTCSSecurityLevel = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_BLTCS_SECURITY_LEVEL))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_BLTCS_SECURITY_LEVEL))) + } else { + Optional.empty() + } val ltk = if (tlvReader.isNextTag(ContextSpecificTag(TAG_LTK))) { Optional.of(tlvReader.getByteArray(ContextSpecificTag(TAG_LTK))) @@ -73,6 +86,7 @@ class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( return ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( role, peerBLTDevIK, + BLTCSSecurityLevel, ltk, ) } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt index 7727fe9d89d661..1edf4a322065c0 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt @@ -28,9 +28,11 @@ class ProximityRangingClusterRangingMeasurementDataStruct( val BLEDeviceId: Optional, val BLTDevIK: Optional, val timeOfMeasurement: Optional, + val timeOfMeasurementOffset: Optional, val distance: UInt?, - val accuracy: Optional, + val errorMargin: Optional, val rdr: Optional, + val detectedAttackLevel: Optional, val rssi: Optional?, val txPower: Optional?, ) { @@ -40,9 +42,11 @@ class ProximityRangingClusterRangingMeasurementDataStruct( append("\tBLEDeviceId : $BLEDeviceId\n") append("\tBLTDevIK : $BLTDevIK\n") append("\ttimeOfMeasurement : $timeOfMeasurement\n") + append("\ttimeOfMeasurementOffset : $timeOfMeasurementOffset\n") append("\tdistance : $distance\n") - append("\taccuracy : $accuracy\n") + append("\terrorMargin : $errorMargin\n") append("\trdr : $rdr\n") + append("\tdetectedAttackLevel : $detectedAttackLevel\n") append("\trssi : $rssi\n") append("\ttxPower : $txPower\n") append("}\n") @@ -67,19 +71,27 @@ class ProximityRangingClusterRangingMeasurementDataStruct( val opttimeOfMeasurement = timeOfMeasurement.get() put(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT), opttimeOfMeasurement) } + if (timeOfMeasurementOffset.isPresent) { + val opttimeOfMeasurementOffset = timeOfMeasurementOffset.get() + put(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT_OFFSET), opttimeOfMeasurementOffset) + } if (distance != null) { put(ContextSpecificTag(TAG_DISTANCE), distance) } else { putNull(ContextSpecificTag(TAG_DISTANCE)) } - if (accuracy.isPresent) { - val optaccuracy = accuracy.get() - put(ContextSpecificTag(TAG_ACCURACY), optaccuracy) + if (errorMargin.isPresent) { + val opterrorMargin = errorMargin.get() + put(ContextSpecificTag(TAG_ERROR_MARGIN), opterrorMargin) } if (rdr.isPresent) { val optrdr = rdr.get() optrdr.toTlv(ContextSpecificTag(TAG_RDR), this) } + if (detectedAttackLevel.isPresent) { + val optdetectedAttackLevel = detectedAttackLevel.get() + put(ContextSpecificTag(TAG_DETECTED_ATTACK_LEVEL), optdetectedAttackLevel) + } if (rssi != null) { if (rssi.isPresent) { val optrssi = rssi.get() @@ -105,11 +117,13 @@ class ProximityRangingClusterRangingMeasurementDataStruct( private const val TAG_BLE_DEVICE_ID = 1 private const val TAG_BLT_DEV_IK = 2 private const val TAG_TIME_OF_MEASUREMENT = 3 - private const val TAG_DISTANCE = 4 - private const val TAG_ACCURACY = 5 - private const val TAG_RDR = 6 - private const val TAG_RSSI = 7 - private const val TAG_TX_POWER = 8 + private const val TAG_TIME_OF_MEASUREMENT_OFFSET = 4 + private const val TAG_DISTANCE = 5 + private const val TAG_ERROR_MARGIN = 6 + private const val TAG_RDR = 7 + private const val TAG_DETECTED_ATTACK_LEVEL = 8 + private const val TAG_RSSI = 9 + private const val TAG_TX_POWER = 10 fun fromTlv( tlvTag: Tag, @@ -140,6 +154,12 @@ class ProximityRangingClusterRangingMeasurementDataStruct( } else { Optional.empty() } + val timeOfMeasurementOffset = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT_OFFSET))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT_OFFSET))) + } else { + Optional.empty() + } val distance = if (!tlvReader.isNull()) { tlvReader.getUInt(ContextSpecificTag(TAG_DISTANCE)) @@ -147,9 +167,9 @@ class ProximityRangingClusterRangingMeasurementDataStruct( tlvReader.getNull(ContextSpecificTag(TAG_DISTANCE)) null } - val accuracy = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_ACCURACY))) { - Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_ACCURACY))) + val errorMargin = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_MARGIN))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_ERROR_MARGIN))) } else { Optional.empty() } @@ -161,6 +181,12 @@ class ProximityRangingClusterRangingMeasurementDataStruct( } else { Optional.empty() } + val detectedAttackLevel = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DETECTED_ATTACK_LEVEL))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DETECTED_ATTACK_LEVEL))) + } else { + Optional.empty() + } val rssi = if (!tlvReader.isNull()) { if (tlvReader.isNextTag(ContextSpecificTag(TAG_RSSI))) { @@ -191,9 +217,11 @@ class ProximityRangingClusterRangingMeasurementDataStruct( BLEDeviceId, BLTDevIK, timeOfMeasurement, + timeOfMeasurementOffset, distance, - accuracy, + errorMargin, rdr, + detectedAttackLevel, rssi, txPower, ) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt index 4de5960d1deb15..97327b9976968b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt @@ -26,13 +26,13 @@ import matter.tlv.TlvWriter class ProximityRangingClusterReportingConditionStruct( val minDistanceCondition: Optional, val maxDistanceCondition: Optional, - val accuracyCondition: Optional, + val errorMarginCondition: Optional, ) { override fun toString(): String = buildString { append("ProximityRangingClusterReportingConditionStruct {\n") append("\tminDistanceCondition : $minDistanceCondition\n") append("\tmaxDistanceCondition : $maxDistanceCondition\n") - append("\taccuracyCondition : $accuracyCondition\n") + append("\terrorMarginCondition : $errorMarginCondition\n") append("}\n") } @@ -47,9 +47,9 @@ class ProximityRangingClusterReportingConditionStruct( val optmaxDistanceCondition = maxDistanceCondition.get() put(ContextSpecificTag(TAG_MAX_DISTANCE_CONDITION), optmaxDistanceCondition) } - if (accuracyCondition.isPresent) { - val optaccuracyCondition = accuracyCondition.get() - put(ContextSpecificTag(TAG_ACCURACY_CONDITION), optaccuracyCondition) + if (errorMarginCondition.isPresent) { + val opterrorMarginCondition = errorMarginCondition.get() + put(ContextSpecificTag(TAG_ERROR_MARGIN_CONDITION), opterrorMarginCondition) } endStructure() } @@ -58,7 +58,7 @@ class ProximityRangingClusterReportingConditionStruct( companion object { private const val TAG_MIN_DISTANCE_CONDITION = 0 private const val TAG_MAX_DISTANCE_CONDITION = 1 - private const val TAG_ACCURACY_CONDITION = 2 + private const val TAG_ERROR_MARGIN_CONDITION = 2 fun fromTlv( tlvTag: Tag, @@ -77,9 +77,9 @@ class ProximityRangingClusterReportingConditionStruct( } else { Optional.empty() } - val accuracyCondition = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_ACCURACY_CONDITION))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_ACCURACY_CONDITION))) + val errorMarginCondition = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_MARGIN_CONDITION))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_ERROR_MARGIN_CONDITION))) } else { Optional.empty() } @@ -89,7 +89,7 @@ class ProximityRangingClusterReportingConditionStruct( return ProximityRangingClusterReportingConditionStruct( minDistanceCondition, maxDistanceCondition, - accuracyCondition, + errorMarginCondition, ) } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ProximityRangingClusterRangingResultEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ProximityRangingClusterRangingResultEvent.kt new file mode 100644 index 00000000000000..ee63b0e50a63e5 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ProximityRangingClusterRangingResultEvent.kt @@ -0,0 +1,62 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.eventstructs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRangingResultEvent( + val sessionID: UByte, + val rangingResultData: + matter.controller.cluster.structs.ProximityRangingClusterRangingMeasurementDataStruct, +) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRangingResultEvent {\n") + append("\tsessionID : $sessionID\n") + append("\trangingResultData : $rangingResultData\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) + rangingResultData.toTlv(ContextSpecificTag(TAG_RANGING_RESULT_DATA), this) + endStructure() + } + } + + companion object { + private const val TAG_SESSION_ID = 0 + private const val TAG_RANGING_RESULT_DATA = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ProximityRangingClusterRangingResultEvent { + tlvReader.enterStructure(tlvTag) + val sessionID = tlvReader.getUByte(ContextSpecificTag(TAG_SESSION_ID)) + val rangingResultData = + matter.controller.cluster.structs.ProximityRangingClusterRangingMeasurementDataStruct + .fromTlv(ContextSpecificTag(TAG_RANGING_RESULT_DATA), tlvReader) + + tlvReader.exitContainer() + + return ProximityRangingClusterRangingResultEvent(sessionID, rangingResultData) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ProximityRangingClusterRangingSessionStatusEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ProximityRangingClusterRangingSessionStatusEvent.kt new file mode 100644 index 00000000000000..50d11cd166da65 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ProximityRangingClusterRangingSessionStatusEvent.kt @@ -0,0 +1,59 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.eventstructs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ProximityRangingClusterRangingSessionStatusEvent(val sessionID: UByte, val status: UByte) { + override fun toString(): String = buildString { + append("ProximityRangingClusterRangingSessionStatusEvent {\n") + append("\tsessionID : $sessionID\n") + append("\tstatus : $status\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) + put(ContextSpecificTag(TAG_STATUS), status) + endStructure() + } + } + + companion object { + private const val TAG_SESSION_ID = 0 + private const val TAG_STATUS = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ProximityRangingClusterRangingSessionStatusEvent { + tlvReader.enterStructure(tlvTag) + val sessionID = tlvReader.getUByte(ContextSpecificTag(TAG_SESSION_ID)) + val status = tlvReader.getUByte(ContextSpecificTag(TAG_STATUS)) + + tlvReader.exitContainer() + + return ProximityRangingClusterRangingSessionStatusEvent(sessionID, status) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index 5b4894cd549c7c..65a3917cb0d273 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -318,6 +318,8 @@ matter_eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/PowerSourceClusterBatChargeFaultChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/PowerSourceClusterBatFaultChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/PowerSourceClusterWiredFaultChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ProximityRangingClusterRangingResultEvent.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ProximityRangingClusterRangingSessionStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/PushAvStreamTransportClusterPushTransportBeginEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/PushAvStreamTransportClusterPushTransportEndEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/RefrigeratorAlarmClusterNotifyEvent.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt index d5681279a80b00..1f6d72e60e350a 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct.kt @@ -26,12 +26,14 @@ import matter.tlv.TlvWriter class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( val role: UByte, val peerBLTDevIK: ByteArray, + val BLTCSSecurityLevel: Optional, val ltk: Optional, ) { override fun toString(): String = buildString { append("ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct {\n") append("\trole : $role\n") append("\tpeerBLTDevIK : $peerBLTDevIK\n") + append("\tBLTCSSecurityLevel : $BLTCSSecurityLevel\n") append("\tltk : $ltk\n") append("}\n") } @@ -41,6 +43,10 @@ class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( startStructure(tlvTag) put(ContextSpecificTag(TAG_ROLE), role) put(ContextSpecificTag(TAG_PEER_BLT_DEV_IK), peerBLTDevIK) + if (BLTCSSecurityLevel.isPresent) { + val optBLTCSSecurityLevel = BLTCSSecurityLevel.get() + put(ContextSpecificTag(TAG_BLTCS_SECURITY_LEVEL), optBLTCSSecurityLevel) + } if (ltk.isPresent) { val optltk = ltk.get() put(ContextSpecificTag(TAG_LTK), optltk) @@ -52,7 +58,8 @@ class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( companion object { private const val TAG_ROLE = 0 private const val TAG_PEER_BLT_DEV_IK = 1 - private const val TAG_LTK = 2 + private const val TAG_BLTCS_SECURITY_LEVEL = 2 + private const val TAG_LTK = 3 fun fromTlv( tlvTag: Tag, @@ -61,6 +68,12 @@ class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( tlvReader.enterStructure(tlvTag) val role = tlvReader.getUByte(ContextSpecificTag(TAG_ROLE)) val peerBLTDevIK = tlvReader.getByteArray(ContextSpecificTag(TAG_PEER_BLT_DEV_IK)) + val BLTCSSecurityLevel = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_BLTCS_SECURITY_LEVEL))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_BLTCS_SECURITY_LEVEL))) + } else { + Optional.empty() + } val ltk = if (tlvReader.isNextTag(ContextSpecificTag(TAG_LTK))) { Optional.of(tlvReader.getByteArray(ContextSpecificTag(TAG_LTK))) @@ -73,6 +86,7 @@ class ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( return ProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct( role, peerBLTDevIK, + BLTCSSecurityLevel, ltk, ) } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt index ddd21365f2bb18..759939b7bd5f2f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterRangingMeasurementDataStruct.kt @@ -28,9 +28,11 @@ class ProximityRangingClusterRangingMeasurementDataStruct( val BLEDeviceId: Optional, val BLTDevIK: Optional, val timeOfMeasurement: Optional, + val timeOfMeasurementOffset: Optional, val distance: UShort?, - val accuracy: Optional, + val errorMargin: Optional, val rdr: Optional, + val detectedAttackLevel: Optional, val rssi: Optional?, val txPower: Optional?, ) { @@ -40,9 +42,11 @@ class ProximityRangingClusterRangingMeasurementDataStruct( append("\tBLEDeviceId : $BLEDeviceId\n") append("\tBLTDevIK : $BLTDevIK\n") append("\ttimeOfMeasurement : $timeOfMeasurement\n") + append("\ttimeOfMeasurementOffset : $timeOfMeasurementOffset\n") append("\tdistance : $distance\n") - append("\taccuracy : $accuracy\n") + append("\terrorMargin : $errorMargin\n") append("\trdr : $rdr\n") + append("\tdetectedAttackLevel : $detectedAttackLevel\n") append("\trssi : $rssi\n") append("\ttxPower : $txPower\n") append("}\n") @@ -67,19 +71,27 @@ class ProximityRangingClusterRangingMeasurementDataStruct( val opttimeOfMeasurement = timeOfMeasurement.get() put(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT), opttimeOfMeasurement) } + if (timeOfMeasurementOffset.isPresent) { + val opttimeOfMeasurementOffset = timeOfMeasurementOffset.get() + put(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT_OFFSET), opttimeOfMeasurementOffset) + } if (distance != null) { put(ContextSpecificTag(TAG_DISTANCE), distance) } else { putNull(ContextSpecificTag(TAG_DISTANCE)) } - if (accuracy.isPresent) { - val optaccuracy = accuracy.get() - put(ContextSpecificTag(TAG_ACCURACY), optaccuracy) + if (errorMargin.isPresent) { + val opterrorMargin = errorMargin.get() + put(ContextSpecificTag(TAG_ERROR_MARGIN), opterrorMargin) } if (rdr.isPresent) { val optrdr = rdr.get() optrdr.toTlv(ContextSpecificTag(TAG_RDR), this) } + if (detectedAttackLevel.isPresent) { + val optdetectedAttackLevel = detectedAttackLevel.get() + put(ContextSpecificTag(TAG_DETECTED_ATTACK_LEVEL), optdetectedAttackLevel) + } if (rssi != null) { if (rssi.isPresent) { val optrssi = rssi.get() @@ -105,11 +117,13 @@ class ProximityRangingClusterRangingMeasurementDataStruct( private const val TAG_BLE_DEVICE_ID = 1 private const val TAG_BLT_DEV_IK = 2 private const val TAG_TIME_OF_MEASUREMENT = 3 - private const val TAG_DISTANCE = 4 - private const val TAG_ACCURACY = 5 - private const val TAG_RDR = 6 - private const val TAG_RSSI = 7 - private const val TAG_TX_POWER = 8 + private const val TAG_TIME_OF_MEASUREMENT_OFFSET = 4 + private const val TAG_DISTANCE = 5 + private const val TAG_ERROR_MARGIN = 6 + private const val TAG_RDR = 7 + private const val TAG_DETECTED_ATTACK_LEVEL = 8 + private const val TAG_RSSI = 9 + private const val TAG_TX_POWER = 10 fun fromTlv( tlvTag: Tag, @@ -140,6 +154,12 @@ class ProximityRangingClusterRangingMeasurementDataStruct( } else { Optional.empty() } + val timeOfMeasurementOffset = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT_OFFSET))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_TIME_OF_MEASUREMENT_OFFSET))) + } else { + Optional.empty() + } val distance = if (!tlvReader.isNull()) { tlvReader.getUShort(ContextSpecificTag(TAG_DISTANCE)) @@ -147,9 +167,9 @@ class ProximityRangingClusterRangingMeasurementDataStruct( tlvReader.getNull(ContextSpecificTag(TAG_DISTANCE)) null } - val accuracy = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_ACCURACY))) { - Optional.of(tlvReader.getShort(ContextSpecificTag(TAG_ACCURACY))) + val errorMargin = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_MARGIN))) { + Optional.of(tlvReader.getShort(ContextSpecificTag(TAG_ERROR_MARGIN))) } else { Optional.empty() } @@ -161,6 +181,12 @@ class ProximityRangingClusterRangingMeasurementDataStruct( } else { Optional.empty() } + val detectedAttackLevel = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DETECTED_ATTACK_LEVEL))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DETECTED_ATTACK_LEVEL))) + } else { + Optional.empty() + } val rssi = if (!tlvReader.isNull()) { if (tlvReader.isNextTag(ContextSpecificTag(TAG_RSSI))) { @@ -191,9 +217,11 @@ class ProximityRangingClusterRangingMeasurementDataStruct( BLEDeviceId, BLTDevIK, timeOfMeasurement, + timeOfMeasurementOffset, distance, - accuracy, + errorMargin, rdr, + detectedAttackLevel, rssi, txPower, ) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt index 8db54450cd1e88..5e05444217ead8 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ProximityRangingClusterReportingConditionStruct.kt @@ -26,13 +26,13 @@ import matter.tlv.TlvWriter class ProximityRangingClusterReportingConditionStruct( val minDistanceCondition: Optional, val maxDistanceCondition: Optional, - val accuracyCondition: Optional, + val errorMarginCondition: Optional, ) { override fun toString(): String = buildString { append("ProximityRangingClusterReportingConditionStruct {\n") append("\tminDistanceCondition : $minDistanceCondition\n") append("\tmaxDistanceCondition : $maxDistanceCondition\n") - append("\taccuracyCondition : $accuracyCondition\n") + append("\terrorMarginCondition : $errorMarginCondition\n") append("}\n") } @@ -47,9 +47,9 @@ class ProximityRangingClusterReportingConditionStruct( val optmaxDistanceCondition = maxDistanceCondition.get() put(ContextSpecificTag(TAG_MAX_DISTANCE_CONDITION), optmaxDistanceCondition) } - if (accuracyCondition.isPresent) { - val optaccuracyCondition = accuracyCondition.get() - put(ContextSpecificTag(TAG_ACCURACY_CONDITION), optaccuracyCondition) + if (errorMarginCondition.isPresent) { + val opterrorMarginCondition = errorMarginCondition.get() + put(ContextSpecificTag(TAG_ERROR_MARGIN_CONDITION), opterrorMarginCondition) } endStructure() } @@ -58,7 +58,7 @@ class ProximityRangingClusterReportingConditionStruct( companion object { private const val TAG_MIN_DISTANCE_CONDITION = 0 private const val TAG_MAX_DISTANCE_CONDITION = 1 - private const val TAG_ACCURACY_CONDITION = 2 + private const val TAG_ERROR_MARGIN_CONDITION = 2 fun fromTlv( tlvTag: Tag, @@ -77,9 +77,9 @@ class ProximityRangingClusterReportingConditionStruct( } else { Optional.empty() } - val accuracyCondition = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_ACCURACY_CONDITION))) { - Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_ACCURACY_CONDITION))) + val errorMarginCondition = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_MARGIN_CONDITION))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_ERROR_MARGIN_CONDITION))) } else { Optional.empty() } @@ -89,7 +89,7 @@ class ProximityRangingClusterReportingConditionStruct( return ProximityRangingClusterReportingConditionStruct( minDistanceCondition, maxDistanceCondition, - accuracyCondition, + errorMarginCondition, ) } } diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index b382c4670d5a77..25df4cd10977eb 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -9201,6 +9201,418 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & using namespace app::Clusters::ProximityRanging; switch (aPath.mEventId) { + case Events::RangingResult::Id: { + Events::RangingResult::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value_sessionID; + std::string value_sessionIDClassName = "java/lang/Integer"; + std::string value_sessionIDCtorSignature = "(I)V"; + jint jnivalue_sessionID = static_cast(cppValue.sessionID); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_sessionIDClassName.c_str(), value_sessionIDCtorSignature.c_str(), jnivalue_sessionID, value_sessionID); + + jobject value_rangingResultData; + jobject value_rangingResultData_wiFiDevIK; + if (!cppValue.rangingResultData.wiFiDevIK.HasValue()) + { + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional(nullptr, + value_rangingResultData_wiFiDevIK); + } + else + { + jobject value_rangingResultData_wiFiDevIKInsideOptional; + jbyteArray value_rangingResultData_wiFiDevIKInsideOptionalByteArray = + env->NewByteArray(static_cast(cppValue.rangingResultData.wiFiDevIK.Value().size())); + env->SetByteArrayRegion(value_rangingResultData_wiFiDevIKInsideOptionalByteArray, 0, + static_cast(cppValue.rangingResultData.wiFiDevIK.Value().size()), + reinterpret_cast(cppValue.rangingResultData.wiFiDevIK.Value().data())); + value_rangingResultData_wiFiDevIKInsideOptional = value_rangingResultData_wiFiDevIKInsideOptionalByteArray; + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + value_rangingResultData_wiFiDevIKInsideOptional, value_rangingResultData_wiFiDevIK); + } + jobject value_rangingResultData_BLEDeviceId; + if (!cppValue.rangingResultData.BLEDeviceId.HasValue()) + { + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional(nullptr, + value_rangingResultData_BLEDeviceId); + } + else + { + jobject value_rangingResultData_BLEDeviceIdInsideOptional; + std::string value_rangingResultData_BLEDeviceIdInsideOptionalClassName = "java/lang/Long"; + std::string value_rangingResultData_BLEDeviceIdInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_rangingResultData_BLEDeviceIdInsideOptional = + static_cast(cppValue.rangingResultData.BLEDeviceId.Value()); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_BLEDeviceIdInsideOptionalClassName.c_str(), + value_rangingResultData_BLEDeviceIdInsideOptionalCtorSignature.c_str(), + jnivalue_rangingResultData_BLEDeviceIdInsideOptional, value_rangingResultData_BLEDeviceIdInsideOptional); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + value_rangingResultData_BLEDeviceIdInsideOptional, value_rangingResultData_BLEDeviceId); + } + jobject value_rangingResultData_BLTDevIK; + if (!cppValue.rangingResultData.BLTDevIK.HasValue()) + { + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional(nullptr, + value_rangingResultData_BLTDevIK); + } + else + { + jobject value_rangingResultData_BLTDevIKInsideOptional; + jbyteArray value_rangingResultData_BLTDevIKInsideOptionalByteArray = + env->NewByteArray(static_cast(cppValue.rangingResultData.BLTDevIK.Value().size())); + env->SetByteArrayRegion(value_rangingResultData_BLTDevIKInsideOptionalByteArray, 0, + static_cast(cppValue.rangingResultData.BLTDevIK.Value().size()), + reinterpret_cast(cppValue.rangingResultData.BLTDevIK.Value().data())); + value_rangingResultData_BLTDevIKInsideOptional = value_rangingResultData_BLTDevIKInsideOptionalByteArray; + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + value_rangingResultData_BLTDevIKInsideOptional, value_rangingResultData_BLTDevIK); + } + jobject value_rangingResultData_timeOfMeasurement; + if (!cppValue.rangingResultData.timeOfMeasurement.HasValue()) + { + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + nullptr, value_rangingResultData_timeOfMeasurement); + } + else + { + jobject value_rangingResultData_timeOfMeasurementInsideOptional; + std::string value_rangingResultData_timeOfMeasurementInsideOptionalClassName = "java/lang/Long"; + std::string value_rangingResultData_timeOfMeasurementInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_rangingResultData_timeOfMeasurementInsideOptional = + static_cast(cppValue.rangingResultData.timeOfMeasurement.Value()); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_timeOfMeasurementInsideOptionalClassName.c_str(), + value_rangingResultData_timeOfMeasurementInsideOptionalCtorSignature.c_str(), + jnivalue_rangingResultData_timeOfMeasurementInsideOptional, + value_rangingResultData_timeOfMeasurementInsideOptional); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + value_rangingResultData_timeOfMeasurementInsideOptional, value_rangingResultData_timeOfMeasurement); + } + jobject value_rangingResultData_timeOfMeasurementOffset; + if (!cppValue.rangingResultData.timeOfMeasurementOffset.HasValue()) + { + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + nullptr, value_rangingResultData_timeOfMeasurementOffset); + } + else + { + jobject value_rangingResultData_timeOfMeasurementOffsetInsideOptional; + std::string value_rangingResultData_timeOfMeasurementOffsetInsideOptionalClassName = "java/lang/Long"; + std::string value_rangingResultData_timeOfMeasurementOffsetInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_rangingResultData_timeOfMeasurementOffsetInsideOptional = + static_cast(cppValue.rangingResultData.timeOfMeasurementOffset.Value()); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_timeOfMeasurementOffsetInsideOptionalClassName.c_str(), + value_rangingResultData_timeOfMeasurementOffsetInsideOptionalCtorSignature.c_str(), + jnivalue_rangingResultData_timeOfMeasurementOffsetInsideOptional, + value_rangingResultData_timeOfMeasurementOffsetInsideOptional); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + value_rangingResultData_timeOfMeasurementOffsetInsideOptional, value_rangingResultData_timeOfMeasurementOffset); + } + jobject value_rangingResultData_distance; + if (cppValue.rangingResultData.distance.IsNull()) + { + value_rangingResultData_distance = nullptr; + } + else + { + std::string value_rangingResultData_distanceClassName = "java/lang/Integer"; + std::string value_rangingResultData_distanceCtorSignature = "(I)V"; + jint jnivalue_rangingResultData_distance = static_cast(cppValue.rangingResultData.distance.Value()); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_distanceClassName.c_str(), value_rangingResultData_distanceCtorSignature.c_str(), + jnivalue_rangingResultData_distance, value_rangingResultData_distance); + } + jobject value_rangingResultData_errorMargin; + if (!cppValue.rangingResultData.errorMargin.HasValue()) + { + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional(nullptr, + value_rangingResultData_errorMargin); + } + else + { + jobject value_rangingResultData_errorMarginInsideOptional; + std::string value_rangingResultData_errorMarginInsideOptionalClassName = "java/lang/Integer"; + std::string value_rangingResultData_errorMarginInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_rangingResultData_errorMarginInsideOptional = + static_cast(cppValue.rangingResultData.errorMargin.Value()); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_errorMarginInsideOptionalClassName.c_str(), + value_rangingResultData_errorMarginInsideOptionalCtorSignature.c_str(), + jnivalue_rangingResultData_errorMarginInsideOptional, value_rangingResultData_errorMarginInsideOptional); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + value_rangingResultData_errorMarginInsideOptional, value_rangingResultData_errorMargin); + } + jobject value_rangingResultData_rdr; + if (!cppValue.rangingResultData.rdr.HasValue()) + { + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional(nullptr, value_rangingResultData_rdr); + } + else + { + jobject value_rangingResultData_rdrInsideOptional; + jobject value_rangingResultData_rdrInsideOptional_azimuth; + std::string value_rangingResultData_rdrInsideOptional_azimuthClassName = "java/lang/Integer"; + std::string value_rangingResultData_rdrInsideOptional_azimuthCtorSignature = "(I)V"; + jint jnivalue_rangingResultData_rdrInsideOptional_azimuth = + static_cast(cppValue.rangingResultData.rdr.Value().azimuth); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_rdrInsideOptional_azimuthClassName.c_str(), + value_rangingResultData_rdrInsideOptional_azimuthCtorSignature.c_str(), + jnivalue_rangingResultData_rdrInsideOptional_azimuth, value_rangingResultData_rdrInsideOptional_azimuth); + jobject value_rangingResultData_rdrInsideOptional_elevation; + std::string value_rangingResultData_rdrInsideOptional_elevationClassName = "java/lang/Integer"; + std::string value_rangingResultData_rdrInsideOptional_elevationCtorSignature = "(I)V"; + jint jnivalue_rangingResultData_rdrInsideOptional_elevation = + static_cast(cppValue.rangingResultData.rdr.Value().elevation); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_rdrInsideOptional_elevationClassName.c_str(), + value_rangingResultData_rdrInsideOptional_elevationCtorSignature.c_str(), + jnivalue_rangingResultData_rdrInsideOptional_elevation, value_rangingResultData_rdrInsideOptional_elevation); + jobject value_rangingResultData_rdrInsideOptional_azimuthAccuracy; + std::string value_rangingResultData_rdrInsideOptional_azimuthAccuracyClassName = "java/lang/Integer"; + std::string value_rangingResultData_rdrInsideOptional_azimuthAccuracyCtorSignature = "(I)V"; + jint jnivalue_rangingResultData_rdrInsideOptional_azimuthAccuracy = + static_cast(cppValue.rangingResultData.rdr.Value().azimuthAccuracy); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_rdrInsideOptional_azimuthAccuracyClassName.c_str(), + value_rangingResultData_rdrInsideOptional_azimuthAccuracyCtorSignature.c_str(), + jnivalue_rangingResultData_rdrInsideOptional_azimuthAccuracy, + value_rangingResultData_rdrInsideOptional_azimuthAccuracy); + jobject value_rangingResultData_rdrInsideOptional_elevationAccuracy; + std::string value_rangingResultData_rdrInsideOptional_elevationAccuracyClassName = "java/lang/Integer"; + std::string value_rangingResultData_rdrInsideOptional_elevationAccuracyCtorSignature = "(I)V"; + jint jnivalue_rangingResultData_rdrInsideOptional_elevationAccuracy = + static_cast(cppValue.rangingResultData.rdr.Value().elevationAccuracy); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_rdrInsideOptional_elevationAccuracyClassName.c_str(), + value_rangingResultData_rdrInsideOptional_elevationAccuracyCtorSignature.c_str(), + jnivalue_rangingResultData_rdrInsideOptional_elevationAccuracy, + value_rangingResultData_rdrInsideOptional_elevationAccuracy); + jobject value_rangingResultData_rdrInsideOptional_reference; + std::string value_rangingResultData_rdrInsideOptional_referenceClassName = "java/lang/Integer"; + std::string value_rangingResultData_rdrInsideOptional_referenceCtorSignature = "(I)V"; + jint jnivalue_rangingResultData_rdrInsideOptional_reference = + static_cast(cppValue.rangingResultData.rdr.Value().reference); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_rdrInsideOptional_referenceClassName.c_str(), + value_rangingResultData_rdrInsideOptional_referenceCtorSignature.c_str(), + jnivalue_rangingResultData_rdrInsideOptional_reference, value_rangingResultData_rdrInsideOptional_reference); + + { + jclass RDRStructStructClass_2; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$ProximityRangingClusterRDRStruct", RDRStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ProximityRangingClusterRDRStruct"); + return nullptr; + } + + jmethodID RDRStructStructCtor_2; + err = chip::JniReferences::GetInstance().FindMethod( + env, RDRStructStructClass_2, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", + &RDRStructStructCtor_2); + if (err != CHIP_NO_ERROR || RDRStructStructCtor_2 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ProximityRangingClusterRDRStruct constructor"); + return nullptr; + } + + value_rangingResultData_rdrInsideOptional = env->NewObject( + RDRStructStructClass_2, RDRStructStructCtor_2, value_rangingResultData_rdrInsideOptional_azimuth, + value_rangingResultData_rdrInsideOptional_elevation, + value_rangingResultData_rdrInsideOptional_azimuthAccuracy, + value_rangingResultData_rdrInsideOptional_elevationAccuracy, + value_rangingResultData_rdrInsideOptional_reference); + } + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + value_rangingResultData_rdrInsideOptional, value_rangingResultData_rdr); + } + jobject value_rangingResultData_detectedAttackLevel; + if (!cppValue.rangingResultData.detectedAttackLevel.HasValue()) + { + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + nullptr, value_rangingResultData_detectedAttackLevel); + } + else + { + jobject value_rangingResultData_detectedAttackLevelInsideOptional; + std::string value_rangingResultData_detectedAttackLevelInsideOptionalClassName = "java/lang/Integer"; + std::string value_rangingResultData_detectedAttackLevelInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_rangingResultData_detectedAttackLevelInsideOptional = + static_cast(cppValue.rangingResultData.detectedAttackLevel.Value()); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_detectedAttackLevelInsideOptionalClassName.c_str(), + value_rangingResultData_detectedAttackLevelInsideOptionalCtorSignature.c_str(), + jnivalue_rangingResultData_detectedAttackLevelInsideOptional, + value_rangingResultData_detectedAttackLevelInsideOptional); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + value_rangingResultData_detectedAttackLevelInsideOptional, value_rangingResultData_detectedAttackLevel); + } + jobject value_rangingResultData_rssi; + if (!cppValue.rangingResultData.rssi.HasValue()) + { + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional(nullptr, value_rangingResultData_rssi); + } + else + { + jobject value_rangingResultData_rssiInsideOptional; + if (cppValue.rangingResultData.rssi.Value().IsNull()) + { + value_rangingResultData_rssiInsideOptional = nullptr; + } + else + { + std::string value_rangingResultData_rssiInsideOptionalClassName = "java/lang/Integer"; + std::string value_rangingResultData_rssiInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_rangingResultData_rssiInsideOptional = + static_cast(cppValue.rangingResultData.rssi.Value().Value()); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_rssiInsideOptionalClassName.c_str(), + value_rangingResultData_rssiInsideOptionalCtorSignature.c_str(), + jnivalue_rangingResultData_rssiInsideOptional, value_rangingResultData_rssiInsideOptional); + } + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + value_rangingResultData_rssiInsideOptional, value_rangingResultData_rssi); + } + jobject value_rangingResultData_txPower; + if (!cppValue.rangingResultData.txPower.HasValue()) + { + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional(nullptr, + value_rangingResultData_txPower); + } + else + { + jobject value_rangingResultData_txPowerInsideOptional; + if (cppValue.rangingResultData.txPower.Value().IsNull()) + { + value_rangingResultData_txPowerInsideOptional = nullptr; + } + else + { + std::string value_rangingResultData_txPowerInsideOptionalClassName = "java/lang/Integer"; + std::string value_rangingResultData_txPowerInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_rangingResultData_txPowerInsideOptional = + static_cast(cppValue.rangingResultData.txPower.Value().Value()); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_rangingResultData_txPowerInsideOptionalClassName.c_str(), + value_rangingResultData_txPowerInsideOptionalCtorSignature.c_str(), + jnivalue_rangingResultData_txPowerInsideOptional, value_rangingResultData_txPowerInsideOptional); + } + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateOptional( + value_rangingResultData_txPowerInsideOptional, value_rangingResultData_txPower); + } + + { + jclass rangingMeasurementDataStructStructClass_0; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$ProximityRangingClusterRangingMeasurementDataStruct", + rangingMeasurementDataStructStructClass_0); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ProximityRangingClusterRangingMeasurementDataStruct"); + return nullptr; + } + + jmethodID rangingMeasurementDataStructStructCtor_0; + err = chip::JniReferences::GetInstance().FindMethod( + env, rangingMeasurementDataStructStructClass_0, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/" + "lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/" + "Optional;)V", + &rangingMeasurementDataStructStructCtor_0); + if (err != CHIP_NO_ERROR || rangingMeasurementDataStructStructCtor_0 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ProximityRangingClusterRangingMeasurementDataStruct constructor"); + return nullptr; + } + + value_rangingResultData = env->NewObject( + rangingMeasurementDataStructStructClass_0, rangingMeasurementDataStructStructCtor_0, + value_rangingResultData_wiFiDevIK, value_rangingResultData_BLEDeviceId, value_rangingResultData_BLTDevIK, + value_rangingResultData_timeOfMeasurement, value_rangingResultData_timeOfMeasurementOffset, + value_rangingResultData_distance, value_rangingResultData_errorMargin, value_rangingResultData_rdr, + value_rangingResultData_detectedAttackLevel, value_rangingResultData_rssi, value_rangingResultData_txPower); + } + + jclass rangingResultStructClass; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipEventStructs$ProximityRangingClusterRangingResultEvent", rangingResultStructClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipEventStructs$ProximityRangingClusterRangingResultEvent"); + return nullptr; + } + + jmethodID rangingResultStructCtor; + err = chip::JniReferences::GetInstance().FindMethod( + env, rangingResultStructClass, "", + "(Ljava/lang/Integer;Lchip/devicecontroller/ChipStructs$ProximityRangingClusterRangingMeasurementDataStruct;)V", + &rangingResultStructCtor); + if (err != CHIP_NO_ERROR || rangingResultStructCtor == nullptr) + { + ChipLogError(Zcl, "Could not find ChipEventStructs$ProximityRangingClusterRangingResultEvent constructor"); + return nullptr; + } + + jobject value = + env->NewObject(rangingResultStructClass, rangingResultStructCtor, value_sessionID, value_rangingResultData); + + return value; + } + case Events::RangingSessionStatus::Id: { + Events::RangingSessionStatus::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value_sessionID; + std::string value_sessionIDClassName = "java/lang/Integer"; + std::string value_sessionIDCtorSignature = "(I)V"; + jint jnivalue_sessionID = static_cast(cppValue.sessionID); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_sessionIDClassName.c_str(), value_sessionIDCtorSignature.c_str(), jnivalue_sessionID, value_sessionID); + + jobject value_status; + std::string value_statusClassName = "java/lang/Integer"; + std::string value_statusCtorSignature = "(I)V"; + jint jnivalue_status = static_cast(cppValue.status); + TEMPORARY_RETURN_IGNORED chip::JniReferences::GetInstance().CreateBoxedObject( + value_statusClassName.c_str(), value_statusCtorSignature.c_str(), jnivalue_status, value_status); + + jclass rangingSessionStatusStructClass; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipEventStructs$ProximityRangingClusterRangingSessionStatusEvent", + rangingSessionStatusStructClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipEventStructs$ProximityRangingClusterRangingSessionStatusEvent"); + return nullptr; + } + + jmethodID rangingSessionStatusStructCtor; + err = chip::JniReferences::GetInstance().FindMethod(env, rangingSessionStatusStructClass, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;)V", + &rangingSessionStatusStructCtor); + if (err != CHIP_NO_ERROR || rangingSessionStatusStructCtor == nullptr) + { + ChipLogError(Zcl, "Could not find ChipEventStructs$ProximityRangingClusterRangingSessionStatusEvent constructor"); + return nullptr; + } + + jobject value = + env->NewObject(rangingSessionStatusStructClass, rangingSessionStatusStructCtor, value_sessionID, value_status); + + return value; + } default: *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; break; diff --git a/src/controller/python/matter/clusters/Objects.py b/src/controller/python/matter/clusters/Objects.py index a74d6bf767636d..ea992efe1a8566 100644 --- a/src/controller/python/matter/clusters/Objects.py +++ b/src/controller/python/matter/clusters/Objects.py @@ -42596,6 +42596,41 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: uint = 0 class Enums: + class BLTCSSecurityLevelEnum(MatterIntEnum): + kCsSecurityLevelUnknown = 0x00 + kCsSecurityLevelOne = 0x01 + kCsSecurityLevelTwo = 0x02 + kCsSecurityLevelThree = 0x03 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 4 + + class NADMEnum(MatterIntEnum): + kAttackExtremelyUnlikely = 0x00 + kAttackVeryUnlikely = 0x01 + kAttackUnlikely = 0x02 + kAttackIsPossible = 0x03 + kAttackIsLikely = 0x04 + kAttackVeryLikely = 0x05 + kAttackExtremelyLikely = 0x06 + kUnknown = 0xFF + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 7 + + class RDRReferenceEnum(MatterIntEnum): + kDeviceCoordinates = 0x00 + kEarthCoordinates = 0x01 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 2 + class RangingRoleEnum(MatterIntEnum): kWiFiSubscriberRole = 0x00 kWiFiPublisherRole = 0x01 @@ -42618,6 +42653,17 @@ class RangingSecurityEnum(MatterIntEnum): # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2 + class RangingSessionStatusEnum(MatterIntEnum): + kSessionEndTimeReached = 0x00 + kPeerNotFound = 0x01 + kHardwareError = 0x02 + kStopRequested = 0x03 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 4 + class RangingTechEnum(MatterIntEnum): kBluetoothChannelSounding = 0x00 kWiFiRoundTripTimeRanging = 0x01 @@ -42654,7 +42700,7 @@ class RadioBandBitmap(IntFlag): k5g = 0x4 k6g = 0x8 k60g = 0x10 - k1g = 0x20 + kS1g = 0x20 k45g = 0x40 class RangingBandwidthBitmap(IntFlag): @@ -42680,14 +42726,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="elevation", Tag=1, Type=int), ClusterObjectFieldDescriptor(Label="azimuthAccuracy", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="elevationAccuracy", Tag=3, Type=uint), - ClusterObjectFieldDescriptor(Label="reference", Tag=4, Type=uint), + ClusterObjectFieldDescriptor(Label="reference", Tag=4, Type=ProximityRanging.Enums.RDRReferenceEnum), ]) azimuth: 'uint' = 0 elevation: 'int' = 0 azimuthAccuracy: 'uint' = 0 elevationAccuracy: 'uint' = 0 - reference: 'uint' = 0 + reference: 'ProximityRanging.Enums.RDRReferenceEnum' = 0 @dataclass class RangingMeasurementDataStruct(ClusterObject): @@ -42699,20 +42745,24 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="BLEDeviceId", Tag=1, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="BLTDevIK", Tag=2, Type=typing.Optional[bytes]), ClusterObjectFieldDescriptor(Label="timeOfMeasurement", Tag=3, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="distance", Tag=4, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="accuracy", Tag=5, Type=typing.Optional[int]), - ClusterObjectFieldDescriptor(Label="rdr", Tag=6, Type=typing.Optional[ProximityRanging.Structs.RDRStruct]), - ClusterObjectFieldDescriptor(Label="rssi", Tag=7, Type=typing.Union[None, Nullable, int]), - ClusterObjectFieldDescriptor(Label="txPower", Tag=8, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="timeOfMeasurementOffset", Tag=4, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="distance", Tag=5, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="errorMargin", Tag=6, Type=typing.Optional[int]), + ClusterObjectFieldDescriptor(Label="rdr", Tag=7, Type=typing.Optional[ProximityRanging.Structs.RDRStruct]), + ClusterObjectFieldDescriptor(Label="detectedAttackLevel", Tag=8, Type=typing.Optional[ProximityRanging.Enums.NADMEnum]), + ClusterObjectFieldDescriptor(Label="rssi", Tag=9, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="txPower", Tag=10, Type=typing.Union[None, Nullable, int]), ]) wiFiDevIK: 'typing.Optional[bytes]' = None BLEDeviceId: 'typing.Optional[uint]' = None BLTDevIK: 'typing.Optional[bytes]' = None timeOfMeasurement: 'typing.Optional[uint]' = None + timeOfMeasurementOffset: 'typing.Optional[uint]' = None distance: 'typing.Union[Nullable, uint]' = NullValue - accuracy: 'typing.Optional[int]' = None + errorMargin: 'typing.Optional[int]' = None rdr: 'typing.Optional[ProximityRanging.Structs.RDRStruct]' = None + detectedAttackLevel: 'typing.Optional[ProximityRanging.Enums.NADMEnum]' = None rssi: 'typing.Union[None, Nullable, int]' = None txPower: 'typing.Union[None, Nullable, int]' = None @@ -42737,11 +42787,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields=[ ClusterObjectFieldDescriptor(Label="role", Tag=0, Type=ProximityRanging.Enums.RangingRoleEnum), ClusterObjectFieldDescriptor(Label="peerBLTDevIK", Tag=1, Type=bytes), - ClusterObjectFieldDescriptor(Label="ltk", Tag=2, Type=typing.Optional[bytes]), + ClusterObjectFieldDescriptor(Label="BLTCSSecurityLevel", Tag=2, Type=typing.Optional[ProximityRanging.Enums.BLTCSSecurityLevelEnum]), + ClusterObjectFieldDescriptor(Label="ltk", Tag=3, Type=typing.Optional[bytes]), ]) role: 'ProximityRanging.Enums.RangingRoleEnum' = 0 peerBLTDevIK: 'bytes' = b"" + BLTCSSecurityLevel: 'typing.Optional[ProximityRanging.Enums.BLTCSSecurityLevelEnum]' = None ltk: 'typing.Optional[bytes]' = None @dataclass @@ -42782,12 +42834,12 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields=[ ClusterObjectFieldDescriptor(Label="minDistanceCondition", Tag=0, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="maxDistanceCondition", Tag=1, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="accuracyCondition", Tag=2, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="errorMarginCondition", Tag=2, Type=typing.Optional[uint]), ]) minDistanceCondition: 'typing.Optional[uint]' = None maxDistanceCondition: 'typing.Optional[uint]' = None - accuracyCondition: 'typing.Optional[uint]' = None + errorMarginCondition: 'typing.Optional[uint]' = None @dataclass class WiFiRangingDeviceRoleConfigStruct(ClusterObject): @@ -42871,24 +42923,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: sessionID: uint = 0 - @dataclass - class RangingResult(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x00000433 - command_id: typing.ClassVar[int] = 0x00000003 - is_client: typing.ClassVar[bool] = False - response_type: typing.ClassVar[typing.Optional[str]] = None - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="sessionID", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="rangingResultData", Tag=1, Type=ProximityRanging.Structs.RangingMeasurementDataStruct), - ]) - - sessionID: uint = 0 - rangingResultData: ProximityRanging.Structs.RangingMeasurementDataStruct = field(default_factory=lambda: ProximityRanging.Structs.RangingMeasurementDataStruct()) - class Attributes: @dataclass class RangingCapabilities(ClusterAttributeDescriptor): @@ -43050,6 +43084,49 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: uint = 0 + class Events: + @dataclass + class RangingResult(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="sessionID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="rangingResultData", Tag=1, Type=ProximityRanging.Structs.RangingMeasurementDataStruct), + ]) + + sessionID: uint = 0 + rangingResultData: ProximityRanging.Structs.RangingMeasurementDataStruct = field(default_factory=lambda: ProximityRanging.Structs.RangingMeasurementDataStruct()) + + @dataclass + class RangingSessionStatus(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000433 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="sessionID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="status", Tag=1, Type=ProximityRanging.Enums.RangingSessionStatusEnum), + ]) + + sessionID: uint = 0 + status: ProximityRanging.Enums.RangingSessionStatusEnum = 0 + @dataclass class WiFiNetworkManagement(Cluster): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 33f2c1dc71c0f7..f55a3e64dfec41 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -21965,6 +21965,29 @@ typedef NS_OPTIONS(uint32_t, MTRAmbientContextSensingFeature) { MTRAmbientContextSensingFeaturePredictedActivity MTR_PROVISIONALLY_AVAILABLE = 0x10, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint8_t, MTRProximityRangingBLTCSSecurityLevel) { + MTRProximityRangingBLTCSSecurityLevelCSSECURITYLEVELUNKNOWN MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRProximityRangingBLTCSSecurityLevelCSSECURITYLEVELONE MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRProximityRangingBLTCSSecurityLevelCSSECURITYLEVELTWO MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRProximityRangingBLTCSSecurityLevelCSSECURITYLEVELTHREE MTR_PROVISIONALLY_AVAILABLE = 0x03, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRProximityRangingNADM) { + MTRProximityRangingNADMAttackExtremelyUnlikely MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRProximityRangingNADMAttackVeryUnlikely MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRProximityRangingNADMAttackUnlikely MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRProximityRangingNADMAttackIsPossible MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRProximityRangingNADMAttackIsLikely MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTRProximityRangingNADMAttackVeryLikely MTR_PROVISIONALLY_AVAILABLE = 0x05, + MTRProximityRangingNADMAttackExtremelyLikely MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTRProximityRangingNADMUnknown MTR_PROVISIONALLY_AVAILABLE = 0xFF, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRProximityRangingRDRReference) { + MTRProximityRangingRDRReferenceDeviceCoordinates MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRProximityRangingRDRReferenceEarthCoordinates MTR_PROVISIONALLY_AVAILABLE = 0x01, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRProximityRangingRangingRole) { MTRProximityRangingRangingRoleWiFiSubscriberRole MTR_PROVISIONALLY_AVAILABLE = 0x00, MTRProximityRangingRangingRoleWiFiPublisherRole MTR_PROVISIONALLY_AVAILABLE = 0x01, @@ -21979,6 +22002,13 @@ typedef NS_ENUM(uint8_t, MTRProximityRangingRangingSecurity) { MTRProximityRangingRangingSecurityOpenRanging MTR_PROVISIONALLY_AVAILABLE = 0x01, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint8_t, MTRProximityRangingRangingSessionStatus) { + MTRProximityRangingRangingSessionStatusSessionEndTimeReached MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRProximityRangingRangingSessionStatusPeerNotFound MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRProximityRangingRangingSessionStatusHardwareError MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRProximityRangingRangingSessionStatusStopRequested MTR_PROVISIONALLY_AVAILABLE = 0x03, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRProximityRangingRangingTech) { MTRProximityRangingRangingTechBluetoothChannelSounding MTR_PROVISIONALLY_AVAILABLE = 0x00, MTRProximityRangingRangingTechWiFiRoundTripTimeRanging MTR_PROVISIONALLY_AVAILABLE = 0x01, @@ -22007,7 +22037,7 @@ typedef NS_OPTIONS(uint16_t, MTRProximityRangingRadioBandBitmap) { MTRProximityRangingRadioBandBitmap5G MTR_PROVISIONALLY_AVAILABLE = 0x4, MTRProximityRangingRadioBandBitmap6G MTR_PROVISIONALLY_AVAILABLE = 0x8, MTRProximityRangingRadioBandBitmap60G MTR_PROVISIONALLY_AVAILABLE = 0x10, - MTRProximityRangingRadioBandBitmap1G MTR_PROVISIONALLY_AVAILABLE = 0x20, + MTRProximityRangingRadioBandBitmapS1G MTR_PROVISIONALLY_AVAILABLE = 0x20, MTRProximityRangingRadioBandBitmap45G MTR_PROVISIONALLY_AVAILABLE = 0x40, } MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index fe9599fecb43e6..3fe32e835bd970 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -6027,7 +6027,6 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterProximityRangingCommandStartRangingRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRCommandIDTypeClusterProximityRangingCommandStartRangingResponseID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, MTRCommandIDTypeClusterProximityRangingCommandStopRangingRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, - MTRCommandIDTypeClusterProximityRangingCommandRangingResultID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, // Cluster WiFiNetworkManagement commands MTRCommandIDTypeClusterWiFiNetworkManagementCommandNetworkPassphraseRequestID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000000, @@ -6985,6 +6984,10 @@ typedef NS_ENUM(uint32_t, MTREventIDType) { MTREventIDTypeClusterAmbientContextSensingEventAmbientContextDetectStartedID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTREventIDTypeClusterAmbientContextSensingEventAmbientContextDetectEndedID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster ProximityRanging events + MTREventIDTypeClusterProximityRangingEventRangingResultID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTREventIDTypeClusterProximityRangingEventRangingSessionStatusID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster TargetNavigator deprecated event names // Cluster TargetNavigator events diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index d7761d7ec6de47..024c7b3546b27f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -14050,10 +14050,6 @@ result = @"StartRangingResponse"; break; - case MTRCommandIDTypeClusterProximityRangingCommandRangingResultID: - result = @"RangingResult"; - break; - default: result = [NSString stringWithFormat:@"", commandID]; break; @@ -16218,6 +16214,15 @@ switch (eventID) { + // Cluster ProximityRanging events + case MTREventIDTypeClusterProximityRangingEventRangingResultID: + result = @"RangingResult"; + break; + + case MTREventIDTypeClusterProximityRangingEventRangingSessionStatusID: + result = @"RangingSessionStatus"; + break; + default: result = [NSString stringWithFormat:@"", eventID]; break; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 61854ff74cba1a..183e73a1ed12b7 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -9252,27 +9252,6 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end -MTR_PROVISIONALLY_AVAILABLE -@interface MTRProximityRangingClusterRangingResultParams : NSObject - -@property (nonatomic, copy) NSNumber * _Nonnull sessionID MTR_PROVISIONALLY_AVAILABLE; - -@property (nonatomic, copy) MTRProximityRangingClusterRangingMeasurementDataStruct * _Nonnull rangingResultData MTR_PROVISIONALLY_AVAILABLE; - -/** - * Initialize an MTRProximityRangingClusterRangingResultParams with a response-value dictionary - * of the sort that MTRDeviceResponseHandler would receive. - * - * Will return nil and hand out an error if the response-value dictionary is not - * a command data response or is not the right command response. - * - * Will return nil and hand out an error if the data response does not match the known - * schema for this command. - */ -- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue - error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; -@end - MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) @interface MTRWiFiNetworkManagementClusterNetworkPassphraseRequestParams : NSObject /** diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 39c8a11903c7a5..af377657b39249 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -27114,6 +27114,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader auto & definedValue_0 = encodableStruct.BLTChannelSoundingDeviceRoleConfig.Emplace(); definedValue_0.role = static_cast>(self.bltChannelSoundingDeviceRoleConfig.role.unsignedCharValue); definedValue_0.peerBLTDevIK = AsByteSpan(self.bltChannelSoundingDeviceRoleConfig.peerBLTDevIK); + if (self.bltChannelSoundingDeviceRoleConfig.bltcsSecurityLevel != nil) { + auto & definedValue_2 = definedValue_0.BLTCSSecurityLevel.Emplace(); + definedValue_2 = static_cast>(self.bltChannelSoundingDeviceRoleConfig.bltcsSecurityLevel.unsignedCharValue); + } if (self.bltChannelSoundingDeviceRoleConfig.ltk != nil) { auto & definedValue_2 = definedValue_0.ltk.Emplace(); definedValue_2 = AsByteSpan(self.bltChannelSoundingDeviceRoleConfig.ltk); @@ -27157,9 +27161,9 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader auto & definedValue_2 = definedValue_0.maxDistanceCondition.Emplace(); definedValue_2 = self.reportingCondition.maxDistanceCondition.unsignedShortValue; } - if (self.reportingCondition.accuracyCondition != nil) { - auto & definedValue_2 = definedValue_0.accuracyCondition.Emplace(); - definedValue_2 = self.reportingCondition.accuracyCondition.unsignedShortValue; + if (self.reportingCondition.errorMarginCondition != nil) { + auto & definedValue_2 = definedValue_0.errorMarginCondition.Emplace(); + definedValue_2 = self.reportingCondition.errorMarginCondition.unsignedShortValue; } } } @@ -27380,159 +27384,6 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end -@implementation MTRProximityRangingClusterRangingResultParams -- (instancetype)init -{ - if (self = [super init]) { - - _sessionID = @(0); - - _rangingResultData = [MTRProximityRangingClusterRangingMeasurementDataStruct new]; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRProximityRangingClusterRangingResultParams alloc] init]; - - other.sessionID = self.sessionID; - other.rangingResultData = self.rangingResultData; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: sessionID:%@; rangingResultData:%@; >", NSStringFromClass([self class]), _sessionID, _rangingResultData]; - return descriptionString; -} - -- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue - error:(NSError * __autoreleasing *)error -{ - if (!(self = [super init])) { - return nil; - } - - using DecodableType = chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType; - chip::System::PacketBufferHandle buffer = [MTRBaseDevice _responseDataForCommand:responseValue - clusterID:DecodableType::GetClusterId() - commandID:DecodableType::GetCommandId() - error:error]; - if (buffer.IsNull()) { - return nil; - } - - chip::TLV::TLVReader reader; - reader.Init(buffer->Start(), buffer->DataLength()); - - CHIP_ERROR err = reader.Next(chip::TLV::AnonymousTag()); - if (err == CHIP_NO_ERROR) { - DecodableType decodedStruct; - err = chip::app::DataModel::Decode(reader, decodedStruct); - if (err == CHIP_NO_ERROR) { - err = [self _setFieldsFromDecodableStruct:decodedStruct]; - if (err == CHIP_NO_ERROR) { - return self; - } - } - } - - LogAndConvertDecodingError(err, error); - return nil; -} - -@end - -@implementation MTRProximityRangingClusterRangingResultParams (InternalMethods) - -- (nullable instancetype)initWithDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType &)decodableStruct -{ - if (!(self = [super init])) { - return nil; - } - - CHIP_ERROR err = [self _setFieldsFromDecodableStruct:decodableStruct]; - if (err == CHIP_NO_ERROR) { - return self; - } - - LogAndConvertDecodingError(err, nil); - return nil; -} - -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType &)decodableStruct -{ - { - self.sessionID = [NSNumber numberWithUnsignedChar:decodableStruct.sessionID]; - } - { - self.rangingResultData = [MTRProximityRangingClusterRangingMeasurementDataStruct new]; - if (decodableStruct.rangingResultData.wiFiDevIK.HasValue()) { - self.rangingResultData.wiFiDevIK = AsData(decodableStruct.rangingResultData.wiFiDevIK.Value()); - } else { - self.rangingResultData.wiFiDevIK = nil; - } - if (decodableStruct.rangingResultData.BLEDeviceId.HasValue()) { - self.rangingResultData.bleDeviceId = [NSNumber numberWithUnsignedLongLong:decodableStruct.rangingResultData.BLEDeviceId.Value()]; - } else { - self.rangingResultData.bleDeviceId = nil; - } - if (decodableStruct.rangingResultData.BLTDevIK.HasValue()) { - self.rangingResultData.bltDevIK = AsData(decodableStruct.rangingResultData.BLTDevIK.Value()); - } else { - self.rangingResultData.bltDevIK = nil; - } - if (decodableStruct.rangingResultData.timeOfMeasurement.HasValue()) { - self.rangingResultData.timeOfMeasurement = [NSNumber numberWithUnsignedInt:decodableStruct.rangingResultData.timeOfMeasurement.Value()]; - } else { - self.rangingResultData.timeOfMeasurement = nil; - } - if (decodableStruct.rangingResultData.distance.IsNull()) { - self.rangingResultData.distance = nil; - } else { - self.rangingResultData.distance = [NSNumber numberWithUnsignedShort:decodableStruct.rangingResultData.distance.Value()]; - } - if (decodableStruct.rangingResultData.accuracy.HasValue()) { - self.rangingResultData.accuracy = [NSNumber numberWithShort:decodableStruct.rangingResultData.accuracy.Value()]; - } else { - self.rangingResultData.accuracy = nil; - } - if (decodableStruct.rangingResultData.rdr.HasValue()) { - self.rangingResultData.rdr = [MTRProximityRangingClusterRDRStruct new]; - self.rangingResultData.rdr.azimuth = [NSNumber numberWithUnsignedShort:decodableStruct.rangingResultData.rdr.Value().azimuth]; - self.rangingResultData.rdr.elevation = [NSNumber numberWithShort:decodableStruct.rangingResultData.rdr.Value().elevation]; - self.rangingResultData.rdr.azimuthAccuracy = [NSNumber numberWithUnsignedChar:decodableStruct.rangingResultData.rdr.Value().azimuthAccuracy]; - self.rangingResultData.rdr.elevationAccuracy = [NSNumber numberWithUnsignedChar:decodableStruct.rangingResultData.rdr.Value().elevationAccuracy]; - self.rangingResultData.rdr.reference = [NSNumber numberWithUnsignedChar:decodableStruct.rangingResultData.rdr.Value().reference]; - } else { - self.rangingResultData.rdr = nil; - } - if (decodableStruct.rangingResultData.rssi.HasValue()) { - if (decodableStruct.rangingResultData.rssi.Value().IsNull()) { - self.rangingResultData.rssi = nil; - } else { - self.rangingResultData.rssi = [NSNumber numberWithChar:decodableStruct.rangingResultData.rssi.Value().Value()]; - } - } else { - self.rangingResultData.rssi = nil; - } - if (decodableStruct.rangingResultData.txPower.HasValue()) { - if (decodableStruct.rangingResultData.txPower.Value().IsNull()) { - self.rangingResultData.txPower = nil; - } else { - self.rangingResultData.txPower = [NSNumber numberWithChar:decodableStruct.rangingResultData.txPower.Value().Value()]; - } - } else { - self.rangingResultData.txPower = nil; - } - } - return CHIP_NO_ERROR; -} - -@end - @implementation MTRWiFiNetworkManagementClusterNetworkPassphraseRequestParams - (instancetype)init { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h index 1122351a5e381a..8e335e0206ac89 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -1789,13 +1789,6 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface MTRProximityRangingClusterRangingResultParams (InternalMethods) - -- (nullable instancetype)initWithDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType &)decodableStruct; -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType &)decodableStruct; - -@end - @interface MTRWiFiNetworkManagementClusterNetworkPassphraseRequestParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index 7cb85f1caaa449..33f6819d85174d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -4916,6 +4916,118 @@ static id _Nullable DecodeEventPayloadForProximityRangingCluster(EventId aEventI { using namespace Clusters::ProximityRanging; switch (aEventId) { + case Events::RangingResult::Id: { + Events::RangingResult::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRProximityRangingClusterRangingResultEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.sessionID]; + value.sessionID = memberValue; + } while (0); + do { + MTRProximityRangingClusterRangingMeasurementDataStruct * _Nonnull memberValue; + memberValue = [MTRProximityRangingClusterRangingMeasurementDataStruct new]; + if (cppValue.rangingResultData.wiFiDevIK.HasValue()) { + memberValue.wiFiDevIK = AsData(cppValue.rangingResultData.wiFiDevIK.Value()); + } else { + memberValue.wiFiDevIK = nil; + } + if (cppValue.rangingResultData.BLEDeviceId.HasValue()) { + memberValue.bleDeviceId = [NSNumber numberWithUnsignedLongLong:cppValue.rangingResultData.BLEDeviceId.Value()]; + } else { + memberValue.bleDeviceId = nil; + } + if (cppValue.rangingResultData.BLTDevIK.HasValue()) { + memberValue.bltDevIK = AsData(cppValue.rangingResultData.BLTDevIK.Value()); + } else { + memberValue.bltDevIK = nil; + } + if (cppValue.rangingResultData.timeOfMeasurement.HasValue()) { + memberValue.timeOfMeasurement = [NSNumber numberWithUnsignedInt:cppValue.rangingResultData.timeOfMeasurement.Value()]; + } else { + memberValue.timeOfMeasurement = nil; + } + if (cppValue.rangingResultData.timeOfMeasurementOffset.HasValue()) { + memberValue.timeOfMeasurementOffset = [NSNumber numberWithUnsignedInt:cppValue.rangingResultData.timeOfMeasurementOffset.Value()]; + } else { + memberValue.timeOfMeasurementOffset = nil; + } + if (cppValue.rangingResultData.distance.IsNull()) { + memberValue.distance = nil; + } else { + memberValue.distance = [NSNumber numberWithUnsignedShort:cppValue.rangingResultData.distance.Value()]; + } + if (cppValue.rangingResultData.errorMargin.HasValue()) { + memberValue.errorMargin = [NSNumber numberWithShort:cppValue.rangingResultData.errorMargin.Value()]; + } else { + memberValue.errorMargin = nil; + } + if (cppValue.rangingResultData.rdr.HasValue()) { + memberValue.rdr = [MTRProximityRangingClusterRDRStruct new]; + memberValue.rdr.azimuth = [NSNumber numberWithUnsignedShort:cppValue.rangingResultData.rdr.Value().azimuth]; + memberValue.rdr.elevation = [NSNumber numberWithShort:cppValue.rangingResultData.rdr.Value().elevation]; + memberValue.rdr.azimuthAccuracy = [NSNumber numberWithUnsignedChar:cppValue.rangingResultData.rdr.Value().azimuthAccuracy]; + memberValue.rdr.elevationAccuracy = [NSNumber numberWithUnsignedChar:cppValue.rangingResultData.rdr.Value().elevationAccuracy]; + memberValue.rdr.reference = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.rangingResultData.rdr.Value().reference)]; + } else { + memberValue.rdr = nil; + } + if (cppValue.rangingResultData.detectedAttackLevel.HasValue()) { + memberValue.detectedAttackLevel = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.rangingResultData.detectedAttackLevel.Value())]; + } else { + memberValue.detectedAttackLevel = nil; + } + if (cppValue.rangingResultData.rssi.HasValue()) { + if (cppValue.rangingResultData.rssi.Value().IsNull()) { + memberValue.rssi = nil; + } else { + memberValue.rssi = [NSNumber numberWithChar:cppValue.rangingResultData.rssi.Value().Value()]; + } + } else { + memberValue.rssi = nil; + } + if (cppValue.rangingResultData.txPower.HasValue()) { + if (cppValue.rangingResultData.txPower.Value().IsNull()) { + memberValue.txPower = nil; + } else { + memberValue.txPower = [NSNumber numberWithChar:cppValue.rangingResultData.txPower.Value().Value()]; + } + } else { + memberValue.txPower = nil; + } + value.rangingResultData = memberValue; + } while (0); + + return value; + } + case Events::RangingSessionStatus::Id: { + Events::RangingSessionStatus::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRProximityRangingClusterRangingSessionStatusEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.sessionID]; + value.sessionID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.status)]; + value.status = memberValue; + } while (0); + + return value; + } default: { // Not a known ProximityRanging event. break; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 1d6587349548b6..df2dcf057730df 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -2061,9 +2061,11 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nullable bleDeviceId MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSData * _Nullable bltDevIK MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable timeOfMeasurement MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable timeOfMeasurementOffset MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable distance MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable accuracy MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable errorMargin MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) MTRProximityRangingClusterRDRStruct * _Nullable rdr MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable detectedAttackLevel MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable rssi MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable txPower MTR_PROVISIONALLY_AVAILABLE; @end @@ -2078,6 +2080,7 @@ MTR_PROVISIONALLY_AVAILABLE @interface MTRProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull role MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSData * _Nonnull peerBLTDevIK MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable bltcsSecurityLevel MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSData * _Nullable ltk MTR_PROVISIONALLY_AVAILABLE; @end @@ -2099,7 +2102,7 @@ MTR_PROVISIONALLY_AVAILABLE @interface MTRProximityRangingClusterReportingConditionStruct : NSObject @property (nonatomic, copy) NSNumber * _Nullable minDistanceCondition MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable maxDistanceCondition MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable accuracyCondition MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable errorMarginCondition MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE @@ -2109,6 +2112,18 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSData * _Nullable pmk MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterRangingResultEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull sessionID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRProximityRangingClusterRangingMeasurementDataStruct * _Nonnull rangingResultData MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRProximityRangingClusterRangingSessionStatusEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull sessionID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull status MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) @interface MTRThreadNetworkDirectoryClusterThreadNetworkStruct : NSObject @property (nonatomic, copy) NSData * _Nonnull extendedPanID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 95f94737690ed6..ce40a74522a818 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -8845,12 +8845,16 @@ - (instancetype)init _timeOfMeasurement = nil; + _timeOfMeasurementOffset = nil; + _distance = nil; - _accuracy = nil; + _errorMargin = nil; _rdr = nil; + _detectedAttackLevel = nil; + _rssi = nil; _txPower = nil; @@ -8866,9 +8870,11 @@ - (id)copyWithZone:(NSZone * _Nullable)zone other.bleDeviceId = self.bleDeviceId; other.bltDevIK = self.bltDevIK; other.timeOfMeasurement = self.timeOfMeasurement; + other.timeOfMeasurementOffset = self.timeOfMeasurementOffset; other.distance = self.distance; - other.accuracy = self.accuracy; + other.errorMargin = self.errorMargin; other.rdr = self.rdr; + other.detectedAttackLevel = self.detectedAttackLevel; other.rssi = self.rssi; other.txPower = self.txPower; @@ -8877,7 +8883,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: wiFiDevIK:%@; bleDeviceId:%@; bltDevIK:%@; timeOfMeasurement:%@; distance:%@; accuracy:%@; rdr:%@; rssi:%@; txPower:%@; >", NSStringFromClass([self class]), [_wiFiDevIK base64EncodedStringWithOptions:0], _bleDeviceId, [_bltDevIK base64EncodedStringWithOptions:0], _timeOfMeasurement, _distance, _accuracy, _rdr, _rssi, _txPower]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: wiFiDevIK:%@; bleDeviceId:%@; bltDevIK:%@; timeOfMeasurement:%@; timeOfMeasurementOffset:%@; distance:%@; errorMargin:%@; rdr:%@; detectedAttackLevel:%@; rssi:%@; txPower:%@; >", NSStringFromClass([self class]), [_wiFiDevIK base64EncodedStringWithOptions:0], _bleDeviceId, [_bltDevIK base64EncodedStringWithOptions:0], _timeOfMeasurement, _timeOfMeasurementOffset, _distance, _errorMargin, _rdr, _detectedAttackLevel, _rssi, _txPower]; return descriptionString; } @@ -8922,6 +8928,8 @@ - (instancetype)init _peerBLTDevIK = [NSData data]; + _bltcsSecurityLevel = nil; + _ltk = nil; } return self; @@ -8933,6 +8941,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone other.role = self.role; other.peerBLTDevIK = self.peerBLTDevIK; + other.bltcsSecurityLevel = self.bltcsSecurityLevel; other.ltk = self.ltk; return other; @@ -8940,7 +8949,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: role:%@; peerBLTDevIK:%@; ltk:%@; >", NSStringFromClass([self class]), _role, [_peerBLTDevIK base64EncodedStringWithOptions:0], [_ltk base64EncodedStringWithOptions:0]]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: role:%@; peerBLTDevIK:%@; bltcsSecurityLevel:%@; ltk:%@; >", NSStringFromClass([self class]), _role, [_peerBLTDevIK base64EncodedStringWithOptions:0], _bltcsSecurityLevel, [_ltk base64EncodedStringWithOptions:0]]; return descriptionString; } @@ -9021,7 +9030,7 @@ - (instancetype)init _maxDistanceCondition = nil; - _accuracyCondition = nil; + _errorMarginCondition = nil; } return self; } @@ -9032,14 +9041,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone other.minDistanceCondition = self.minDistanceCondition; other.maxDistanceCondition = self.maxDistanceCondition; - other.accuracyCondition = self.accuracyCondition; + other.errorMarginCondition = self.errorMarginCondition; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: minDistanceCondition:%@; maxDistanceCondition:%@; accuracyCondition:%@; >", NSStringFromClass([self class]), _minDistanceCondition, _maxDistanceCondition, _accuracyCondition]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: minDistanceCondition:%@; maxDistanceCondition:%@; errorMarginCondition:%@; >", NSStringFromClass([self class]), _minDistanceCondition, _maxDistanceCondition, _errorMarginCondition]; return descriptionString; } @@ -9078,6 +9087,66 @@ - (NSString *)description @end +@implementation MTRProximityRangingClusterRangingResultEvent +- (instancetype)init +{ + if (self = [super init]) { + + _sessionID = @(0); + + _rangingResultData = [MTRProximityRangingClusterRangingMeasurementDataStruct new]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRProximityRangingClusterRangingResultEvent alloc] init]; + + other.sessionID = self.sessionID; + other.rangingResultData = self.rangingResultData; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: sessionID:%@; rangingResultData:%@; >", NSStringFromClass([self class]), _sessionID, _rangingResultData]; + return descriptionString; +} + +@end + +@implementation MTRProximityRangingClusterRangingSessionStatusEvent +- (instancetype)init +{ + if (self = [super init]) { + + _sessionID = @(0); + + _status = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRProximityRangingClusterRangingSessionStatusEvent alloc] init]; + + other.sessionID = self.sessionID; + other.status = self.status; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: sessionID:%@; status:%@; >", NSStringFromClass([self class]), _sessionID, _status]; + return descriptionString; +} + +@end + @implementation MTRThreadNetworkDirectoryClusterThreadNetworkStruct - (instancetype)init { diff --git a/zzz_generated/app-common/clusters/ProximityRanging/CommandIds.h b/zzz_generated/app-common/clusters/ProximityRanging/CommandIds.h index 6bbccca6aa3893..44ede08da7c47d 100644 --- a/zzz_generated/app-common/clusters/ProximityRanging/CommandIds.h +++ b/zzz_generated/app-common/clusters/ProximityRanging/CommandIds.h @@ -16,7 +16,7 @@ namespace Commands { inline constexpr uint32_t kAcceptedCommandsCount = 2; // Total number of server to client commands supported by the cluster (response commands) -inline constexpr uint32_t kGeneratedCommandsCount = 2; +inline constexpr uint32_t kGeneratedCommandsCount = 1; namespace StartRangingRequest { inline constexpr CommandId Id = 0x00000000; @@ -30,10 +30,6 @@ namespace StartRangingResponse { inline constexpr CommandId Id = 0x00000001; } // namespace StartRangingResponse -namespace RangingResult { -inline constexpr CommandId Id = 0x00000003; -} // namespace RangingResult - } // namespace Commands } // namespace ProximityRanging } // namespace Clusters diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Commands.h b/zzz_generated/app-common/clusters/ProximityRanging/Commands.h index 2f438f0efccf3b..c7374ea98788e2 100644 --- a/zzz_generated/app-common/clusters/ProximityRanging/Commands.h +++ b/zzz_generated/app-common/clusters/ProximityRanging/Commands.h @@ -62,11 +62,6 @@ struct Type; struct DecodableType; } // namespace StopRangingRequest -namespace RangingResult { -struct Type; -struct DecodableType; -} // namespace RangingResult - } // namespace Commands namespace Commands { @@ -198,42 +193,6 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace StopRangingRequest -namespace RangingResult { -enum class Fields : uint8_t -{ - kSessionID = 0, - kRangingResultData = 1, -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::RangingResult::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } - - uint8_t sessionID = static_cast(0); - Structs::RangingMeasurementDataStruct::Type rangingResultData; - - CHIP_ERROR Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const; - - using ResponseType = DataModel::NullObjectType; - - static constexpr bool MustUseTimedInvoke() { return false; } -}; - -struct DecodableType -{ -public: - static constexpr CommandId GetCommandId() { return Commands::RangingResult::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } - - uint8_t sessionID = static_cast(0); - Structs::RangingMeasurementDataStruct::DecodableType rangingResultData; - - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace RangingResult } // namespace Commands } // namespace ProximityRanging } // namespace Clusters diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Commands.ipp b/zzz_generated/app-common/clusters/ProximityRanging/Commands.ipp index 95a248b5fd9ac7..b3a41db5a1d2b7 100644 --- a/zzz_generated/app-common/clusters/ProximityRanging/Commands.ipp +++ b/zzz_generated/app-common/clusters/ProximityRanging/Commands.ipp @@ -158,39 +158,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } // namespace StopRangingRequest. -namespace RangingResult { - -CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kSessionID), sessionID); - encoder.Encode(to_underlying(Fields::kRangingResultData), rangingResultData); - return encoder.Finalize(); -} - -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) -{ - detail::StructDecodeIterator __iterator(reader); - while (true) - { - uint8_t __context_tag = 0; - CHIP_ERROR err = __iterator.Next(__context_tag); - VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); - ReturnErrorOnFailure(err); - - if (__context_tag == to_underlying(Fields::kSessionID)) - { - err = DataModel::Decode(reader, sessionID); - } - else if (__context_tag == to_underlying(Fields::kRangingResultData)) - { - err = DataModel::Decode(reader, rangingResultData); - } - - ReturnErrorOnFailure(err); - } -} -} // namespace RangingResult. } // namespace Commands } // namespace ProximityRanging } // namespace Clusters diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Enums.h b/zzz_generated/app-common/clusters/ProximityRanging/Enums.h index c9121ee00a50f8..8aa99f29f7e034 100644 --- a/zzz_generated/app-common/clusters/ProximityRanging/Enums.h +++ b/zzz_generated/app-common/clusters/ProximityRanging/Enums.h @@ -28,6 +28,50 @@ namespace app { namespace Clusters { namespace ProximityRanging { +// Enum for BLTCSSecurityLevelEnum +enum class BLTCSSecurityLevelEnum : uint8_t +{ + kCsSecurityLevelUnknown = 0x00, + kCsSecurityLevelOne = 0x01, + kCsSecurityLevelTwo = 0x02, + kCsSecurityLevelThree = 0x03, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 4, +}; + +// Enum for NADMEnum +enum class NADMEnum : uint8_t +{ + kAttackExtremelyUnlikely = 0x00, + kAttackVeryUnlikely = 0x01, + kAttackUnlikely = 0x02, + kAttackIsPossible = 0x03, + kAttackIsLikely = 0x04, + kAttackVeryLikely = 0x05, + kAttackExtremelyLikely = 0x06, + kUnknown = 0xFF, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 7, +}; + +// Enum for RDRReferenceEnum +enum class RDRReferenceEnum : uint8_t +{ + kDeviceCoordinates = 0x00, + kEarthCoordinates = 0x01, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 2, +}; + // Enum for RangingRoleEnum enum class RangingRoleEnum : uint8_t { @@ -56,6 +100,20 @@ enum class RangingSecurityEnum : uint8_t kUnknownEnumValue = 2, }; +// Enum for RangingSessionStatusEnum +enum class RangingSessionStatusEnum : uint8_t +{ + kSessionEndTimeReached = 0x00, + kPeerNotFound = 0x01, + kHardwareError = 0x02, + kStopRequested = 0x03, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 4, +}; + // Enum for RangingTechEnum enum class RangingTechEnum : uint8_t { @@ -102,7 +160,7 @@ enum class RadioBandBitmap : uint16_t k5g = 0x4, k6g = 0x8, k60g = 0x10, - k1g = 0x20, + kS1g = 0x20, k45g = 0x40, }; diff --git a/zzz_generated/app-common/clusters/ProximityRanging/EnumsCheck.h b/zzz_generated/app-common/clusters/ProximityRanging/EnumsCheck.h index a2950aa9b60f16..35e72b850df185 100644 --- a/zzz_generated/app-common/clusters/ProximityRanging/EnumsCheck.h +++ b/zzz_generated/app-common/clusters/ProximityRanging/EnumsCheck.h @@ -25,6 +25,50 @@ namespace chip { namespace app { namespace Clusters { +static auto __attribute__((unused)) EnsureKnownEnumValue(ProximityRanging::BLTCSSecurityLevelEnum val) +{ + using EnumType = ProximityRanging::BLTCSSecurityLevelEnum; + switch (val) + { + case EnumType::kCsSecurityLevelUnknown: + case EnumType::kCsSecurityLevelOne: + case EnumType::kCsSecurityLevelTwo: + case EnumType::kCsSecurityLevelThree: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ProximityRanging::NADMEnum val) +{ + using EnumType = ProximityRanging::NADMEnum; + switch (val) + { + case EnumType::kAttackExtremelyUnlikely: + case EnumType::kAttackVeryUnlikely: + case EnumType::kAttackUnlikely: + case EnumType::kAttackIsPossible: + case EnumType::kAttackIsLikely: + case EnumType::kAttackVeryLikely: + case EnumType::kAttackExtremelyLikely: + case EnumType::kUnknown: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ProximityRanging::RDRReferenceEnum val) +{ + using EnumType = ProximityRanging::RDRReferenceEnum; + switch (val) + { + case EnumType::kDeviceCoordinates: + case EnumType::kEarthCoordinates: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} static auto __attribute__((unused)) EnsureKnownEnumValue(ProximityRanging::RangingRoleEnum val) { using EnumType = ProximityRanging::RangingRoleEnum; @@ -53,6 +97,20 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(ProximityRanging::Rangi return EnumType::kUnknownEnumValue; } } +static auto __attribute__((unused)) EnsureKnownEnumValue(ProximityRanging::RangingSessionStatusEnum val) +{ + using EnumType = ProximityRanging::RangingSessionStatusEnum; + switch (val) + { + case EnumType::kSessionEndTimeReached: + case EnumType::kPeerNotFound: + case EnumType::kHardwareError: + case EnumType::kStopRequested: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} static auto __attribute__((unused)) EnsureKnownEnumValue(ProximityRanging::RangingTechEnum val) { using EnumType = ProximityRanging::RangingTechEnum; diff --git a/zzz_generated/app-common/clusters/ProximityRanging/EventIds.h b/zzz_generated/app-common/clusters/ProximityRanging/EventIds.h index 7025c0dccaf453..249c96df9e3c7e 100644 --- a/zzz_generated/app-common/clusters/ProximityRanging/EventIds.h +++ b/zzz_generated/app-common/clusters/ProximityRanging/EventIds.h @@ -10,7 +10,16 @@ namespace chip { namespace app { namespace Clusters { namespace ProximityRanging { -namespace Events {} // namespace Events +namespace Events { +namespace RangingResult { +inline constexpr EventId Id = 0x00000000; +} // namespace RangingResult + +namespace RangingSessionStatus { +inline constexpr EventId Id = 0x00000001; +} // namespace RangingSessionStatus + +} // namespace Events } // namespace ProximityRanging } // namespace Clusters } // namespace app diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Events.h b/zzz_generated/app-common/clusters/ProximityRanging/Events.h index 46949e5573b1d2..929b32c22aee8a 100644 --- a/zzz_generated/app-common/clusters/ProximityRanging/Events.h +++ b/zzz_generated/app-common/clusters/ProximityRanging/Events.h @@ -42,7 +42,80 @@ namespace chip { namespace app { namespace Clusters { namespace ProximityRanging { -namespace Events {} // namespace Events +namespace Events { +namespace RangingResult { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kSessionID = 0, + kRangingResultData = 1, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::RangingResult::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + static constexpr bool kIsFabricScoped = false; + + uint8_t sessionID = static_cast(0); + Structs::RangingMeasurementDataStruct::Type rangingResultData; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::RangingResult::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + + uint8_t sessionID = static_cast(0); + Structs::RangingMeasurementDataStruct::DecodableType rangingResultData; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace RangingResult +namespace RangingSessionStatus { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kSessionID = 0, + kStatus = 1, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::RangingSessionStatus::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + static constexpr bool kIsFabricScoped = false; + + uint8_t sessionID = static_cast(0); + RangingSessionStatusEnum status = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::RangingSessionStatus::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ProximityRanging::Id; } + + uint8_t sessionID = static_cast(0); + RangingSessionStatusEnum status = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace RangingSessionStatus +} // namespace Events } // namespace ProximityRanging } // namespace Clusters } // namespace app diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Events.ipp b/zzz_generated/app-common/clusters/ProximityRanging/Events.ipp index aa11afde95a191..6b04b2f2e53504 100644 --- a/zzz_generated/app-common/clusters/ProximityRanging/Events.ipp +++ b/zzz_generated/app-common/clusters/ProximityRanging/Events.ipp @@ -29,7 +29,80 @@ namespace chip { namespace app { namespace Clusters { namespace ProximityRanging { -namespace Events {} // namespace Events +namespace Events { +namespace RangingResult { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSessionID), sessionID)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRangingResultData), rangingResultData)); + return aWriter.EndContainer(outer); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kSessionID)) + { + err = DataModel::Decode(reader, sessionID); + } + else if (__context_tag == to_underlying(Fields::kRangingResultData)) + { + err = DataModel::Decode(reader, rangingResultData); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace RangingResult. +namespace RangingSessionStatus { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSessionID), sessionID)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); + return aWriter.EndContainer(outer); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kSessionID)) + { + err = DataModel::Decode(reader, sessionID); + } + else if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace RangingSessionStatus. +} // namespace Events } // namespace ProximityRanging } // namespace Clusters } // namespace app diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Metadata.h b/zzz_generated/app-common/clusters/ProximityRanging/Metadata.h index ca9ad0dbb719a2..ffe0f1d0443da0 100644 --- a/zzz_generated/app-common/clusters/ProximityRanging/Metadata.h +++ b/zzz_generated/app-common/clusters/ProximityRanging/Metadata.h @@ -65,7 +65,15 @@ inline constexpr DataModel::AcceptedCommandEntry kMetadataEntry(StopRangingReque } // namespace Commands -namespace Events {} // namespace Events +namespace Events { +namespace RangingResult { +inline constexpr DataModel::EventEntry kMetadataEntry{ Access::Privilege::kView }; +} // namespace RangingResult +namespace RangingSessionStatus { +inline constexpr DataModel::EventEntry kMetadataEntry{ Access::Privilege::kView }; +} // namespace RangingSessionStatus + +} // namespace Events } // namespace ProximityRanging } // namespace Clusters } // namespace app diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Structs.h b/zzz_generated/app-common/clusters/ProximityRanging/Structs.h index 2e2611f1525a5c..cc66bab6938cb3 100644 --- a/zzz_generated/app-common/clusters/ProximityRanging/Structs.h +++ b/zzz_generated/app-common/clusters/ProximityRanging/Structs.h @@ -50,11 +50,11 @@ enum class Fields : uint8_t struct Type { public: - uint16_t azimuth = static_cast(0); - int16_t elevation = static_cast(0); - uint8_t azimuthAccuracy = static_cast(0); - uint8_t elevationAccuracy = static_cast(0); - uint8_t reference = static_cast(0); + uint16_t azimuth = static_cast(0); + int16_t elevation = static_cast(0); + uint8_t azimuthAccuracy = static_cast(0); + uint8_t elevationAccuracy = static_cast(0); + RDRReferenceEnum reference = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -69,15 +69,17 @@ using DecodableType = Type; namespace RangingMeasurementDataStruct { enum class Fields : uint8_t { - kWiFiDevIK = 0, - kBLEDeviceId = 1, - kBLTDevIK = 2, - kTimeOfMeasurement = 3, - kDistance = 4, - kAccuracy = 5, - kRdr = 6, - kRssi = 7, - kTxPower = 8, + kWiFiDevIK = 0, + kBLEDeviceId = 1, + kBLTDevIK = 2, + kTimeOfMeasurement = 3, + kTimeOfMeasurementOffset = 4, + kDistance = 5, + kErrorMargin = 6, + kRdr = 7, + kDetectedAttackLevel = 8, + kRssi = 9, + kTxPower = 10, }; struct Type @@ -87,9 +89,11 @@ struct Type Optional BLEDeviceId; Optional BLTDevIK; Optional timeOfMeasurement; + Optional timeOfMeasurementOffset; DataModel::Nullable distance; - Optional accuracy; + Optional errorMargin; Optional rdr; + Optional detectedAttackLevel; Optional> rssi; Optional> txPower; @@ -129,9 +133,10 @@ using DecodableType = Type; namespace BLTChannelSoundingDeviceRoleConfigStruct { enum class Fields : uint8_t { - kRole = 0, - kPeerBLTDevIK = 1, - kLtk = 2, + kRole = 0, + kPeerBLTDevIK = 1, + kBLTCSSecurityLevel = 2, + kLtk = 3, }; struct Type @@ -139,6 +144,7 @@ struct Type public: RangingRoleEnum role = static_cast(0); chip::ByteSpan peerBLTDevIK; + Optional BLTCSSecurityLevel; Optional ltk; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -206,7 +212,7 @@ enum class Fields : uint8_t { kMinDistanceCondition = 0, kMaxDistanceCondition = 1, - kAccuracyCondition = 2, + kErrorMarginCondition = 2, }; struct Type @@ -214,7 +220,7 @@ struct Type public: Optional minDistanceCondition; Optional maxDistanceCondition; - Optional accuracyCondition; + Optional errorMarginCondition; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/app-common/clusters/ProximityRanging/Structs.ipp b/zzz_generated/app-common/clusters/ProximityRanging/Structs.ipp index ce4435a7590b56..5c7db37648de46 100644 --- a/zzz_generated/app-common/clusters/ProximityRanging/Structs.ipp +++ b/zzz_generated/app-common/clusters/ProximityRanging/Structs.ipp @@ -86,9 +86,11 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const encoder.Encode(to_underlying(Fields::kBLEDeviceId), BLEDeviceId); encoder.Encode(to_underlying(Fields::kBLTDevIK), BLTDevIK); encoder.Encode(to_underlying(Fields::kTimeOfMeasurement), timeOfMeasurement); + encoder.Encode(to_underlying(Fields::kTimeOfMeasurementOffset), timeOfMeasurementOffset); encoder.Encode(to_underlying(Fields::kDistance), distance); - encoder.Encode(to_underlying(Fields::kAccuracy), accuracy); + encoder.Encode(to_underlying(Fields::kErrorMargin), errorMargin); encoder.Encode(to_underlying(Fields::kRdr), rdr); + encoder.Encode(to_underlying(Fields::kDetectedAttackLevel), detectedAttackLevel); encoder.Encode(to_underlying(Fields::kRssi), rssi); encoder.Encode(to_underlying(Fields::kTxPower), txPower); return encoder.Finalize(); @@ -120,18 +122,26 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, timeOfMeasurement); } + else if (__context_tag == to_underlying(Fields::kTimeOfMeasurementOffset)) + { + err = DataModel::Decode(reader, timeOfMeasurementOffset); + } else if (__context_tag == to_underlying(Fields::kDistance)) { err = DataModel::Decode(reader, distance); } - else if (__context_tag == to_underlying(Fields::kAccuracy)) + else if (__context_tag == to_underlying(Fields::kErrorMargin)) { - err = DataModel::Decode(reader, accuracy); + err = DataModel::Decode(reader, errorMargin); } else if (__context_tag == to_underlying(Fields::kRdr)) { err = DataModel::Decode(reader, rdr); } + else if (__context_tag == to_underlying(Fields::kDetectedAttackLevel)) + { + err = DataModel::Decode(reader, detectedAttackLevel); + } else if (__context_tag == to_underlying(Fields::kRssi)) { err = DataModel::Decode(reader, rssi); @@ -187,6 +197,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; encoder.Encode(to_underlying(Fields::kRole), role); encoder.Encode(to_underlying(Fields::kPeerBLTDevIK), peerBLTDevIK); + encoder.Encode(to_underlying(Fields::kBLTCSSecurityLevel), BLTCSSecurityLevel); encoder.Encode(to_underlying(Fields::kLtk), ltk); return encoder.Finalize(); } @@ -209,6 +220,10 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, peerBLTDevIK); } + else if (__context_tag == to_underlying(Fields::kBLTCSSecurityLevel)) + { + err = DataModel::Decode(reader, BLTCSSecurityLevel); + } else if (__context_tag == to_underlying(Fields::kLtk)) { err = DataModel::Decode(reader, ltk); @@ -304,7 +319,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; encoder.Encode(to_underlying(Fields::kMinDistanceCondition), minDistanceCondition); encoder.Encode(to_underlying(Fields::kMaxDistanceCondition), maxDistanceCondition); - encoder.Encode(to_underlying(Fields::kAccuracyCondition), accuracyCondition); + encoder.Encode(to_underlying(Fields::kErrorMarginCondition), errorMarginCondition); return encoder.Finalize(); } @@ -326,9 +341,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, maxDistanceCondition); } - else if (__context_tag == to_underlying(Fields::kAccuracyCondition)) + else if (__context_tag == to_underlying(Fields::kErrorMarginCondition)) { - err = DataModel::Decode(reader, accuracyCondition); + err = DataModel::Decode(reader, errorMarginCondition); } ReturnErrorOnFailure(err); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 9cf81213850c55..d2f99edfec6a63 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -11627,6 +11627,8 @@ class ColorControlStepColorTemperature : public ClusterCommand | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | +| * RangingResult | 0x0000 | +| * RangingSessionStatus | 0x0001 | \*----------------------------------------------------------------------------*/ /* @@ -29702,8 +29704,12 @@ void registerClusterProximityRanging(Commands & commands, CredentialIssuerComman // // Events // - make_unique(Id, credsIssuerConfig), // - make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "ranging-result", Events::RangingResult::Id, credsIssuerConfig), // + make_unique(Id, "ranging-session-status", Events::RangingSessionStatus::Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "ranging-result", Events::RangingResult::Id, credsIssuerConfig), // + make_unique(Id, "ranging-session-status", Events::RangingSessionStatus::Id, credsIssuerConfig), // }; commands.RegisterCluster(clusterName, clusterCommands); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index ffdb5acb4996af..be80ab7bafe7cb 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -5661,16 +5661,24 @@ ComplexArgumentParser::Setup(const char * label, } valueCopy.removeMember("timeOfMeasurement"); + if (value.isMember("timeOfMeasurementOffset")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "timeOfMeasurementOffset"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.timeOfMeasurementOffset, value["timeOfMeasurementOffset"])); + } + valueCopy.removeMember("timeOfMeasurementOffset"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "distance"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.distance, value["distance"])); valueCopy.removeMember("distance"); - if (value.isMember("accuracy")) + if (value.isMember("errorMargin")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "accuracy"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.accuracy, value["accuracy"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "errorMargin"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.errorMargin, value["errorMargin"])); } - valueCopy.removeMember("accuracy"); + valueCopy.removeMember("errorMargin"); if (value.isMember("rdr")) { @@ -5679,6 +5687,14 @@ ComplexArgumentParser::Setup(const char * label, } valueCopy.removeMember("rdr"); + if (value.isMember("detectedAttackLevel")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "detectedAttackLevel"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.detectedAttackLevel, value["detectedAttackLevel"])); + } + valueCopy.removeMember("detectedAttackLevel"); + if (value.isMember("rssi")) { snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rssi"); @@ -5702,9 +5718,11 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::ProximityRanging::Stru ComplexArgumentParser::Finalize(request.BLEDeviceId); ComplexArgumentParser::Finalize(request.BLTDevIK); ComplexArgumentParser::Finalize(request.timeOfMeasurement); + ComplexArgumentParser::Finalize(request.timeOfMeasurementOffset); ComplexArgumentParser::Finalize(request.distance); - ComplexArgumentParser::Finalize(request.accuracy); + ComplexArgumentParser::Finalize(request.errorMargin); ComplexArgumentParser::Finalize(request.rdr); + ComplexArgumentParser::Finalize(request.detectedAttackLevel); ComplexArgumentParser::Finalize(request.rssi); ComplexArgumentParser::Finalize(request.txPower); } @@ -5766,6 +5784,14 @@ CHIP_ERROR ComplexArgumentParser::Setup( ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.peerBLTDevIK, value["peerBLTDevIK"])); valueCopy.removeMember("peerBLTDevIK"); + if (value.isMember("BLTCSSecurityLevel")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "BLTCSSecurityLevel"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.BLTCSSecurityLevel, value["BLTCSSecurityLevel"])); + } + valueCopy.removeMember("BLTCSSecurityLevel"); + if (value.isMember("ltk")) { snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "ltk"); @@ -5781,6 +5807,7 @@ void ComplexArgumentParser::Finalize( { ComplexArgumentParser::Finalize(request.role); ComplexArgumentParser::Finalize(request.peerBLTDevIK); + ComplexArgumentParser::Finalize(request.BLTCSSecurityLevel); ComplexArgumentParser::Finalize(request.ltk); } @@ -5893,12 +5920,13 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, } valueCopy.removeMember("maxDistanceCondition"); - if (value.isMember("accuracyCondition")) + if (value.isMember("errorMarginCondition")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "accuracyCondition"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.accuracyCondition, value["accuracyCondition"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "errorMarginCondition"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.errorMarginCondition, value["errorMarginCondition"])); } - valueCopy.removeMember("accuracyCondition"); + valueCopy.removeMember("errorMarginCondition"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } @@ -5907,7 +5935,7 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::ProximityRanging::Stru { ComplexArgumentParser::Finalize(request.minDistanceCondition); ComplexArgumentParser::Finalize(request.maxDistanceCondition); - ComplexArgumentParser::Finalize(request.accuracyCondition); + ComplexArgumentParser::Finalize(request.errorMarginCondition); } CHIP_ERROR diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 1db58e9e784d7e..c08a0f9d99d5a4 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -5029,6 +5029,14 @@ DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = LogValue("TimeOfMeasurementOffset", indent + 1, value.timeOfMeasurementOffset); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TimeOfMeasurementOffset'"); + return err; + } + } { CHIP_ERROR err = LogValue("Distance", indent + 1, value.distance); if (err != CHIP_NO_ERROR) @@ -5038,10 +5046,10 @@ DataModelLogger::LogValue(const char * label, size_t indent, } } { - CHIP_ERROR err = LogValue("Accuracy", indent + 1, value.accuracy); + CHIP_ERROR err = LogValue("ErrorMargin", indent + 1, value.errorMargin); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Accuracy'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ErrorMargin'"); return err; } } @@ -5053,6 +5061,14 @@ DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = LogValue("DetectedAttackLevel", indent + 1, value.detectedAttackLevel); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DetectedAttackLevel'"); + return err; + } + } { CHIP_ERROR err = LogValue("Rssi", indent + 1, value.rssi); if (err != CHIP_NO_ERROR) @@ -5121,6 +5137,14 @@ CHIP_ERROR DataModelLogger::LogValue( return err; } } + { + CHIP_ERROR err = LogValue("BLTCSSecurityLevel", indent + 1, value.BLTCSSecurityLevel); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'BLTCSSecurityLevel'"); + return err; + } + } { CHIP_ERROR err = LogValue("Ltk", indent + 1, value.ltk); if (err != CHIP_NO_ERROR) @@ -5224,10 +5248,10 @@ DataModelLogger::LogValue(const char * label, size_t indent, } } { - CHIP_ERROR err = LogValue("AccuracyCondition", indent + 1, value.accuracyCondition); + CHIP_ERROR err = LogValue("ErrorMarginCondition", indent + 1, value.errorMarginCondition); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AccuracyCondition'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ErrorMarginCondition'"); return err; } } @@ -11935,6 +11959,54 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const ProximityRanging::Events::RangingResult::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("SessionID", indent + 1, value.sessionID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'SessionID'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("RangingResultData", indent + 1, value.rangingResultData); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'RangingResultData'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const ProximityRanging::Events::RangingSessionStatus::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("SessionID", indent + 1, value.sessionID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'SessionID'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("Status", indent + 1, value.status); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'Status'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const TargetNavigator::Events::TargetUpdated::DecodableType & value) { @@ -12991,15 +13063,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; } -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const ProximityRanging::Commands::RangingResult::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - ReturnErrorOnFailure(DataModelLogger::LogValue("sessionID", indent + 1, value.sessionID)); - ReturnErrorOnFailure(DataModelLogger::LogValue("rangingResultData", indent + 1, value.rangingResultData)); - DataModelLogger::LogString(indent, "}"); - return CHIP_NO_ERROR; -} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const WiFiNetworkManagement::Commands::NetworkPassphraseResponse::DecodableType & value) { @@ -24688,11 +24751,6 @@ CHIP_ERROR DataModelLogger::LogCommand(const chip::app::ConcreteCommandPath & pa ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("StartRangingResponse", 1, value); } - case ProximityRanging::Commands::RangingResult::Id: { - ProximityRanging::Commands::RangingResult::DecodableType value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("RangingResult", 1, value); - } } break; } @@ -25975,6 +26033,22 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip } break; } + case ProximityRanging::Id: { + switch (header.mPath.mEventId) + { + case ProximityRanging::Events::RangingResult::Id: { + chip::app::Clusters::ProximityRanging::Events::RangingResult::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("RangingResult", 1, value); + } + case ProximityRanging::Events::RangingSessionStatus::Id: { + chip::app::Clusters::ProximityRanging::Events::RangingSessionStatus::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("RangingSessionStatus", 1, value); + } + } + break; + } case TargetNavigator::Id: { switch (header.mPath.mEventId) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 035f30771ad3c0..376c58aefa5036 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -998,6 +998,10 @@ LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::AmbientContextSensing::Events::AmbientContextDetectEnded::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Events::RangingResult::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ProximityRanging::Events::RangingSessionStatus::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::TargetNavigator::Events::TargetUpdated::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, @@ -1174,8 +1178,6 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Commands::AtomicResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ProximityRanging::Commands::StartRangingResponse::DecodableType & value); -static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::ProximityRanging::Commands::RangingResult::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::WiFiNetworkManagement::Commands::NetworkPassphraseResponse::DecodableType & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp index ef6164ece2302d..16df8c919c867d 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp @@ -6974,8 +6974,6 @@ char const * GeneratedCommandIdToText(chip::ClusterId cluster, chip::CommandId i { case chip::app::Clusters::ProximityRanging::Commands::StartRangingResponse::Id: return "StartRangingResponse"; - case chip::app::Clusters::ProximityRanging::Commands::RangingResult::Id: - return "RangingResult"; default: return "Unknown"; } diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index 2c3ec141042c56..b910d58d16aec8 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -140989,6 +140989,8 @@ class SubscribeAttributeAmbientContextSensingClusterRevision : public SubscribeA | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | +| * RangingResult | 0x0000 | +| * RangingSessionStatus | 0x0001 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL @@ -141077,6 +141079,11 @@ class ProximityRangingStartRangingRequest : public ClusterCommand { params.bltChannelSoundingDeviceRoleConfig = [MTRProximityRangingClusterBLTChannelSoundingDeviceRoleConfigStruct new]; params.bltChannelSoundingDeviceRoleConfig.role = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.BLTChannelSoundingDeviceRoleConfig.Value().role)]; params.bltChannelSoundingDeviceRoleConfig.peerBLTDevIK = [NSData dataWithBytes:mRequest.BLTChannelSoundingDeviceRoleConfig.Value().peerBLTDevIK.data() length:mRequest.BLTChannelSoundingDeviceRoleConfig.Value().peerBLTDevIK.size()]; + if (mRequest.BLTChannelSoundingDeviceRoleConfig.Value().BLTCSSecurityLevel.HasValue()) { + params.bltChannelSoundingDeviceRoleConfig.bltcsSecurityLevel = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.BLTChannelSoundingDeviceRoleConfig.Value().BLTCSSecurityLevel.Value())]; + } else { + params.bltChannelSoundingDeviceRoleConfig.bltcsSecurityLevel = nil; + } if (mRequest.BLTChannelSoundingDeviceRoleConfig.Value().ltk.HasValue()) { params.bltChannelSoundingDeviceRoleConfig.ltk = [NSData dataWithBytes:mRequest.BLTChannelSoundingDeviceRoleConfig.Value().ltk.Value().data() length:mRequest.BLTChannelSoundingDeviceRoleConfig.Value().ltk.Value().size()]; } else { @@ -141130,10 +141137,10 @@ class ProximityRangingStartRangingRequest : public ClusterCommand { } else { params.reportingCondition.maxDistanceCondition = nil; } - if (mRequest.reportingCondition.Value().accuracyCondition.HasValue()) { - params.reportingCondition.accuracyCondition = [NSNumber numberWithUnsignedShort:mRequest.reportingCondition.Value().accuracyCondition.Value()]; + if (mRequest.reportingCondition.Value().errorMarginCondition.HasValue()) { + params.reportingCondition.errorMarginCondition = [NSNumber numberWithUnsignedShort:mRequest.reportingCondition.Value().errorMarginCondition.Value()]; } else { - params.reportingCondition.accuracyCondition = nil; + params.reportingCondition.errorMarginCondition = nil; } } else { params.reportingCondition = nil; @@ -202067,6 +202074,8 @@ void registerClusterProximityRanging(Commands & commands) make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL + make_unique(Id), // + make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands);