Skip to content

Commit 11b6ee7

Browse files
[Darwin] API to list all network commissioning features supported by an MTRDevice (#36479)
* [Darwin] API to list all network commissioning features supported by an MTRDevice - Expose the network commissioning feature bitset as API to know what transports are supported by the device. * Code review comments * Code review comments * Restyled by clang-format --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 84babe0 commit 11b6ee7

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/darwin/Framework/CHIP/MTRDevice.h

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#import <Foundation/Foundation.h>
1919
#import <Matter/MTRAttributeValueWaiter.h>
20+
#import <Matter/MTRBaseClusters.h>
2021
#import <Matter/MTRBaseDevice.h>
2122
#import <Matter/MTRDefines.h>
2223

@@ -122,6 +123,11 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
122123
*/
123124
@property (nonatomic, readonly, nullable, copy) NSNumber * productID MTR_NEWLY_AVAILABLE;
124125

126+
/**
127+
* Network commissioning features supported by the device.
128+
*/
129+
@property (nonatomic, readonly) MTRNetworkCommissioningFeature networkCommissioningFeatures MTR_NEWLY_AVAILABLE;
130+
125131
/**
126132
* Set the delegate to receive asynchronous callbacks about the device.
127133
*

src/darwin/Framework/CHIP/MTRDevice_Concrete.mm

+6
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,12 @@ - (nullable NSNumber *)productID
514514
return [_pid copy];
515515
}
516516

517+
- (MTRNetworkCommissioningFeature)networkCommissioningFeatures
518+
{
519+
std::lock_guard lock(_descriptionLock);
520+
return [_allNetworkFeatures unsignedIntValue];
521+
}
522+
517523
- (void)_notifyDelegateOfPrivateInternalPropertiesChanges
518524
{
519525
os_unfair_lock_assert_owner(&self->_lock);

src/darwin/Framework/CHIP/MTRDevice_XPC.mm

+5
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ - (nullable NSNumber *)productID
141141
return [[self._internalState objectForKey:kMTRDeviceInternalPropertyKeyProductID] copy];
142142
}
143143

144+
- (MTRNetworkCommissioningFeature)networkCommissioningFeatures
145+
{
146+
return [[self._internalState objectForKey:kMTRDeviceInternalPropertyNetworkFeatures] unsignedIntValue];
147+
}
148+
144149
#pragma mark - Client Callbacks (MTRDeviceDelegate)
145150

146151
// required methods for MTRDeviceDelegates

0 commit comments

Comments
 (0)