Skip to content

Commit b73e49f

Browse files
authored
Merge branch 'master' into fix/ActivePresetHandle-subscription-report
2 parents b9ee16d + 0ab4e1f commit b73e49f

21 files changed

Lines changed: 2059 additions & 40 deletions

File tree

data_model/1.5.1/clusters/OccupancySensing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Davis, CA 95616, USA
5757
5858
:xrefstyle: basic
5959
-->
60-
<cluster xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="types types.xsd cluster cluster.xsd" id="0x0406" name="Occupancy Sensing Cluster" revision="7">
60+
<cluster xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="types types.xsd cluster cluster.xsd" id="0x0406" name="Occupancy Sensing Cluster" revision="6">
6161
<revisionHistory>
6262
<revision revision="1" summary="Mandatory global ClusterRevision attribute added"/>
6363
<revision revision="2" summary="Physical Contact Occupancy feature with mandatory OccupancySensorTypeBitmap"/>

data_model/1.5.1/device_types/RoomAirConditioner.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Davis, CA 95616, USA
5757
5858
:xrefstyle: basic
5959
-->
60-
<deviceType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="types types.xsd devicetype devicetype.xsd" id="0x0072" name="Room Air Conditioner" revision="4">
60+
<deviceType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="types types.xsd devicetype devicetype.xsd" id="0x0072" name="Room Air Conditioner" revision="3">
6161
<revisionHistory>
6262
<revision revision="1" summary="Initial revision"/>
6363
<revision revision="2" summary="Thermostat User Interface Configuration cluster added; Updated the Scenes cluster to Scenes Management with Cluster ID: 0x0062"/>

examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,11 @@ JNI_METHOD(jobject, finishStartup)(JNIEnv *, jobject)
120120
#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT
121121
// Set a handler for Commissioner's CommissionerDeclaration messages. This is set in
122122
// connectedhomeip/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h
123-
chip::Server::GetInstance().GetUserDirectedCommissioningClient()->SetCommissionerDeclarationHandler(
124-
CommissionerDeclarationHandler::GetInstance());
123+
auto * client = chip::Server::GetInstance().GetUserDirectedCommissioningClient();
124+
if (client != nullptr)
125+
{
126+
client->SetCommissionerDeclarationHandler(CommissionerDeclarationHandler::GetInstance());
127+
}
125128
#endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT
126129

127130
return support::convertMatterErrorFromCppToJava(CHIP_NO_ERROR);
@@ -134,7 +137,11 @@ JNI_METHOD(void, finishStopping)(JNIEnv *, jobject)
134137

135138
#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT
136139
// Remove the handler previously set for Commissioner's CommissionerDeclaration messages.
137-
chip::Server::GetInstance().GetUserDirectedCommissioningClient()->SetCommissionerDeclarationHandler(nullptr);
140+
auto * client = chip::Server::GetInstance().GetUserDirectedCommissioningClient();
141+
if (client != nullptr)
142+
{
143+
client->SetCommissionerDeclarationHandler(nullptr);
144+
}
138145
#endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT
139146
}
140147

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj/project.pbxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@
8181
3CD73F1E2A9E83C1009D82D1 /* MCCommissionableDataProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3CD73F1D2A9E83C1009D82D1 /* MCCommissionableDataProvider.mm */; };
8282
3CD73F202A9EA060009D82D1 /* MCDeviceAttestationCredentials.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CD73F1F2A9EA060009D82D1 /* MCDeviceAttestationCredentials.h */; };
8383
3CD73F222A9EA078009D82D1 /* MCDeviceAttestationCredentials.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3CD73F212A9EA077009D82D1 /* MCDeviceAttestationCredentials.mm */; };
84+
3CD73F242B1EA001009D82D1 /* MCDeviceInstanceInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CD73F232B1EA001009D82D1 /* MCDeviceInstanceInfo.h */; };
85+
3CD73F262B1EA002009D82D1 /* MCDeviceInstanceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CD73F252B1EA002009D82D1 /* MCDeviceInstanceInfo.m */; };
86+
3CD73F282B1EA003009D82D1 /* MCDeviceInstanceInfoProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CD73F272B1EA003009D82D1 /* MCDeviceInstanceInfoProvider.h */; };
87+
3CD73F2A2B1EA004009D82D1 /* MCDeviceInstanceInfoProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3CD73F292B1EA004009D82D1 /* MCDeviceInstanceInfoProvider.mm */; };
8488
3CE5ECCE2A673B30007CF331 /* CommissioningCallbackHandlers.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CE5ECCD2A673B30007CF331 /* CommissioningCallbackHandlers.h */; };
8589
3CE5ECD02A673E2C007CF331 /* CommissioningCallbackHandlers.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CE5ECCF2A673E2C007CF331 /* CommissioningCallbackHandlers.m */; };
8690
3CF71C0A2A992D0D003A5CE5 /* MCCastingApp.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CF71C092A992D0D003A5CE5 /* MCCastingApp.h */; };
@@ -178,6 +182,10 @@
178182
3CD73F1D2A9E83C1009D82D1 /* MCCommissionableDataProvider.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommissionableDataProvider.mm; sourceTree = "<group>"; };
179183
3CD73F1F2A9EA060009D82D1 /* MCDeviceAttestationCredentials.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCDeviceAttestationCredentials.h; sourceTree = "<group>"; };
180184
3CD73F212A9EA077009D82D1 /* MCDeviceAttestationCredentials.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCDeviceAttestationCredentials.mm; sourceTree = "<group>"; };
185+
3CD73F232B1EA001009D82D1 /* MCDeviceInstanceInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCDeviceInstanceInfo.h; sourceTree = "<group>"; };
186+
3CD73F252B1EA002009D82D1 /* MCDeviceInstanceInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MCDeviceInstanceInfo.m; sourceTree = "<group>"; };
187+
3CD73F272B1EA003009D82D1 /* MCDeviceInstanceInfoProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCDeviceInstanceInfoProvider.h; sourceTree = "<group>"; };
188+
3CD73F292B1EA004009D82D1 /* MCDeviceInstanceInfoProvider.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCDeviceInstanceInfoProvider.mm; sourceTree = "<group>"; };
181189
3CE5ECCD2A673B30007CF331 /* CommissioningCallbackHandlers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommissioningCallbackHandlers.h; sourceTree = "<group>"; };
182190
3CE5ECCF2A673E2C007CF331 /* CommissioningCallbackHandlers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CommissioningCallbackHandlers.m; sourceTree = "<group>"; };
183191
3CF71C092A992D0D003A5CE5 /* MCCastingApp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCastingApp.h; sourceTree = "<group>"; };
@@ -321,6 +329,10 @@
321329
3CD73F212A9EA077009D82D1 /* MCDeviceAttestationCredentials.mm */,
322330
3C6920452AA1093300D0F613 /* MCDeviceAttestationCredentialsProvider.h */,
323331
3C6920472AA1094000D0F613 /* MCDeviceAttestationCredentialsProvider.mm */,
332+
3CD73F232B1EA001009D82D1 /* MCDeviceInstanceInfo.h */,
333+
3CD73F252B1EA002009D82D1 /* MCDeviceInstanceInfo.m */,
334+
3CD73F272B1EA003009D82D1 /* MCDeviceInstanceInfoProvider.h */,
335+
3CD73F292B1EA004009D82D1 /* MCDeviceInstanceInfoProvider.mm */,
324336
3C69204B2AA136BA00D0F613 /* MCCommonCaseDeviceServerInitParamsProvider.h */,
325337
3CF8532528E37ED800F07B9F /* MatterError.h */,
326338
3CF8532628E37F1000F07B9F /* MatterError.mm */,
@@ -370,6 +382,8 @@
370382
3CF71C102A99312D003A5CE5 /* MCCommissionableData.h in Headers */,
371383
3C4F522A2B51DFAE00BB8A10 /* MCCommand_Internal.h in Headers */,
372384
3CD73F202A9EA060009D82D1 /* MCDeviceAttestationCredentials.h in Headers */,
385+
3CD73F242B1EA001009D82D1 /* MCDeviceInstanceInfo.h in Headers */,
386+
3CD73F282B1EA003009D82D1 /* MCDeviceInstanceInfoProvider.h in Headers */,
373387
3CCB8740286A593700771BAD /* CastingServerBridge.h in Headers */,
374388
3CE5ECCE2A673B30007CF331 /* CommissioningCallbackHandlers.h in Headers */,
375389
39589F162B91556B00BE040C /* MCInteractionModelStructs.h in Headers */,
@@ -506,6 +520,8 @@
506520
3CD73F1E2A9E83C1009D82D1 /* MCCommissionableDataProvider.mm in Sources */,
507521
39F589E02C1781E4000AAADD /* MCCommissionerDeclaration.mm in Sources */,
508522
3CD73F222A9EA078009D82D1 /* MCDeviceAttestationCredentials.mm in Sources */,
523+
3CD73F262B1EA002009D82D1 /* MCDeviceInstanceInfo.m in Sources */,
524+
3CD73F2A2B1EA004009D82D1 /* MCDeviceInstanceInfoProvider.mm in Sources */,
509525
39BF57C72B8CFFB90081653C /* MCAttributeObjects.mm in Sources */,
510526
3C2346252B362BBB00FA276E /* MCCastingPlayerDiscovery.mm in Sources */,
511527
3C4F52242B507CA800BB8A10 /* MCCluster.mm in Sources */,

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCastingApp.mm

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@
2020
#import "MCCommissionableDataProvider.h"
2121
#import "MCCommonCaseDeviceServerInitParamsProvider.h"
2222
#import "MCDeviceAttestationCredentialsProvider.h"
23+
#import "MCDeviceInstanceInfoProvider.h"
2324
#import "MCErrorUtils.h"
2425
#import "MCRotatingDeviceIdUniqueIdProvider.h"
2526

2627
#import "core/Types.h"
2728
#include <credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h>
2829
#include <credentials/attestation_verifier/DeviceAttestationVerifier.h>
30+
#include <platform/DeviceInstanceInfoProvider.h>
2931

3032
#import <Foundation/Foundation.h>
3133

@@ -35,6 +37,7 @@ @interface MCCastingApp ()
3537
@property matter::casting::support::MCRotatingDeviceIdUniqueIdProvider uniqueIdProvider;
3638
@property matter::casting::support::MCCommissionableDataProvider * commissionableDataProvider;
3739
@property matter::casting::support::MCDeviceAttestationCredentialsProvider * dacProvider;
40+
@property matter::casting::support::MCDeviceInstanceInfoProviderBridge * deviceInstanceInfoProvider;
3841
@property MCCommonCaseDeviceServerInitParamsProvider * serverInitParamsProvider;
3942

4043
// queue used when calling the client code on completion blocks from any MatterTvCastingBridge API
@@ -92,6 +95,17 @@ - (NSError *)initializeWithDataSource:(id)dataSource
9295

9396
_serverInitParamsProvider = new MCCommonCaseDeviceServerInitParamsProvider();
9497

98+
// Initialize MCDeviceInstanceInfoProviderBridge if the dataSource provides a delegate
99+
if ([dataSource respondsToSelector:@selector(castingAppDidReceiveRequestForDeviceInstanceInfoProvider:)]) {
100+
id<MCDeviceInstanceInfoProvider> infoProvider = [dataSource castingAppDidReceiveRequestForDeviceInstanceInfoProvider:self];
101+
if (infoProvider != nil) {
102+
ChipLogProgress(AppServer, "MCCastingApp.initializeWithDataSource() setting up pull-based MCDeviceInstanceInfoProviderBridge");
103+
delete _deviceInstanceInfoProvider;
104+
_deviceInstanceInfoProvider = new matter::casting::support::MCDeviceInstanceInfoProviderBridge();
105+
_deviceInstanceInfoProvider->SetDelegate(infoProvider);
106+
}
107+
}
108+
95109
// Create cpp AppParameters
96110
// TODO: Properly validate revocation!
97111
chip::Credentials::DeviceAttestationRevocationDelegate * kDeviceAttestationRevocationNotChecked = nullptr;
@@ -105,6 +119,12 @@ - (NSError *)initializeWithDataSource:(id)dataSource
105119
VerifyOrReturnValue(matter::casting::core::CastingApp::GetInstance()->Initialize(_appParameters) == CHIP_NO_ERROR,
106120
[MCErrorUtils NSErrorFromChipError:CHIP_ERROR_INCORRECT_STATE]);
107121

122+
// Register the custom DeviceInstanceInfoProvider if one was created
123+
if (_deviceInstanceInfoProvider != nullptr) {
124+
ChipLogProgress(AppServer, "MCCastingApp.initializeWithDataSource() setting custom DeviceInstanceInfoProvider");
125+
chip::DeviceLayer::SetDeviceInstanceInfoProvider(_deviceInstanceInfoProvider);
126+
}
127+
108128
// Get and store the CHIP Work queue
109129
_workQueue = chip::DeviceLayer::PlatformMgrImpl().GetWorkQueue();
110130

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCDataSource.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#import "MCCommissionableData.h"
1919
#import "MCDeviceAttestationCredentials.h"
20+
#import "MCDeviceInstanceInfo.h"
2021
#import "MatterError.h"
2122

2223
#ifndef MCDataSource_h
@@ -54,6 +55,19 @@
5455
*/
5556
- (MatterError * _Nonnull)castingApp:(id _Nonnull)sender didReceiveRequestToSignCertificateRequest:(NSData * _Nonnull)csrData outRawSignature:(NSData * _Nonnull * _Nonnull)outRawSignature;
5657

58+
@optional
59+
60+
/**
61+
* @brief Provides an object conforming to MCDeviceInstanceInfoProvider that the platform
62+
* will query at runtime for device instance info fields (vendorName, productName, etc.)
63+
* used during Matter commissioning.
64+
*
65+
* The platform pulls values from the returned provider each time they are needed,
66+
* allowing the app to return dynamic data. Methods not implemented or returning nil
67+
* will fall back to compile-time defaults.
68+
*/
69+
- (id<MCDeviceInstanceInfoProvider> _Nullable)castingAppDidReceiveRequestForDeviceInstanceInfoProvider:(id _Nonnull)sender;
70+
5771
@end
5872

5973
#endif /* MCDataSource_h */
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
*
3+
* Copyright (c) 2024 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#import <Foundation/Foundation.h>
19+
20+
#ifndef MCDeviceInstanceInfo_h
21+
#define MCDeviceInstanceInfo_h
22+
23+
/**
24+
* @brief Pull-based protocol for providing device instance info at runtime.
25+
*
26+
* Implement this protocol to supply device instance information fields
27+
* used during Matter commissioning. The platform layer queries these methods
28+
* when it needs each value, allowing the app to return dynamic/current data.
29+
*
30+
* All methods are optional. If a method is not implemented or returns nil,
31+
* the platform falls back to compile-time defaults.
32+
*/
33+
@protocol MCDeviceInstanceInfoProvider <NSObject>
34+
@optional
35+
36+
- (NSString * _Nullable)vendorName;
37+
- (NSNumber * _Nullable)vendorId;
38+
- (NSString * _Nullable)productName;
39+
- (NSNumber * _Nullable)productId;
40+
- (NSString * _Nullable)serialNumber;
41+
- (NSNumber * _Nullable)hardwareVersion;
42+
- (NSString * _Nullable)hardwareVersionString;
43+
44+
@end
45+
46+
#endif /* MCDeviceInstanceInfo_h */
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
*
3+
* Copyright (c) 2024 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
// MCDeviceInstanceInfo.h now defines a protocol (@protocol MCDeviceInstanceInfoProvider).
19+
// No implementation file is needed for a protocol definition.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
*
3+
* Copyright (c) 2024 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#pragma once
20+
21+
#import "MCDeviceInstanceInfo.h"
22+
23+
#include <lib/core/CHIPError.h>
24+
#include <lib/core/Optional.h>
25+
#include <platform/ConfigurationManager.h>
26+
#include <platform/Darwin/DeviceInstanceInfoProviderImpl.h>
27+
#include <platform/DeviceInstanceInfoProvider.h>
28+
29+
#ifndef MCDeviceInstanceInfoProvider_h
30+
#define MCDeviceInstanceInfoProvider_h
31+
32+
namespace matter {
33+
namespace casting {
34+
namespace support {
35+
36+
/**
37+
* Pull-based DeviceInstanceInfoProvider that queries an ObjC delegate
38+
* each time the platform layer requests a value.
39+
*/
40+
class MCDeviceInstanceInfoProviderBridge : public chip::DeviceLayer::DeviceInstanceInfoProvider
41+
{
42+
public:
43+
void SetDelegate(id<MCDeviceInstanceInfoProvider> _Nullable delegate) { mDelegate = delegate; }
44+
45+
// Overridden methods — query delegate if available, else fall back to default
46+
CHIP_ERROR GetVendorName(char * buf, size_t bufSize) override;
47+
CHIP_ERROR GetVendorId(uint16_t & vendorId) override;
48+
CHIP_ERROR GetProductName(char * buf, size_t bufSize) override;
49+
CHIP_ERROR GetProductId(uint16_t & productId) override;
50+
CHIP_ERROR GetSerialNumber(char * buf, size_t bufSize) override;
51+
CHIP_ERROR GetHardwareVersion(uint16_t & hardwareVersion) override;
52+
CHIP_ERROR GetHardwareVersionString(char * buf, size_t bufSize) override;
53+
54+
// Delegated methods — always use default implementation
55+
CHIP_ERROR GetPartNumber(char * buf, size_t bufSize) override;
56+
CHIP_ERROR GetProductURL(char * buf, size_t bufSize) override;
57+
CHIP_ERROR GetProductLabel(char * buf, size_t bufSize) override;
58+
CHIP_ERROR GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & day) override;
59+
CHIP_ERROR GetRotatingDeviceIdUniqueId(chip::MutableByteSpan & uniqueIdSpan) override;
60+
61+
private:
62+
__weak id<MCDeviceInstanceInfoProvider> _Nullable mDelegate = nil;
63+
chip::DeviceLayer::DeviceInstanceInfoProviderImpl mDefaultProvider;
64+
};
65+
66+
}; // namespace support
67+
}; // namespace casting
68+
}; // namespace matter
69+
70+
#endif /* MCDeviceInstanceInfoProvider_h */

0 commit comments

Comments
 (0)