Skip to content

Commit a04cbde

Browse files
Fixing style issues 2
1 parent 477978f commit a04cbde

File tree

6 files changed

+48
-18
lines changed

6 files changed

+48
-18
lines changed

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

+7-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@
7272
* @brief Verifies that a connection exists with this CastingPlayer, or triggers a new
7373
* commissioning session request. If the CastingApp does not have the nodeId and fabricIndex
7474
* of this CastingPlayer cached on disk, this will execute the User Directed Commissioning
75-
* (UDC) process by sending an IdentificationDeclaration message to the Commissioner. This method will run verifyOrEstablishConnection() with a default timeout of MCCastingPlayer.kMinCommissioningWindowTimeoutSec.
75+
* (UDC) process by sending an IdentificationDeclaration message to the Commissioner. This method
76+
* will run verifyOrEstablishConnection() with a default timeout of
77+
* MCCastingPlayer.kMinCommissioningWindowTimeoutSec.
7678
* @param identificationDeclarationOptions (Optional) Parameters in the IdentificationDeclaration
7779
* message sent by the Commissionee to the Commissioner. These parameters specify the
7880
* information relating to the requested commissioning session.
@@ -94,7 +96,10 @@
9496
* @brief Verifies that a connection exists with this CastingPlayer, or triggers a new
9597
* commissioning session request. If the CastingApp does not have the nodeId and fabricIndex
9698
* of this CastingPlayer cached on disk, this will execute the User Directed Commissioning
97-
* (UDC) process by sending an IdentificationDeclaration message to the Commissioner. This method will run verifyOrEstablishConnection() with a default timeout of MCCastingPlayer.kMinCommissioningWindowTimeoutSec and MCIdentificationDeclarationOptions initailized with the defualt values.
99+
* (UDC) process by sending an IdentificationDeclaration message to the Commissioner. This method
100+
* will run verifyOrEstablishConnection() with a default timeout of
101+
* MCCastingPlayer.kMinCommissioningWindowTimeoutSec and MCIdentificationDeclarationOptions
102+
* initailized with the defualt values.
98103
* @return nil if request submitted successfully, otherwise a NSError object corresponding to the error.
99104
* @see verifyOrEstablishConnectionWithCallbacks:timeout:identificationDeclarationOptions:
100105
*/

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

+19-8
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ - (NSError *)verifyOrEstablishConnectionWithCallbacks:(MCConnectionCallbacks * _
7878
dispatch_sync(workQueue, ^{
7979
matter::casting::core::IdentificationDeclarationOptions cppIdOptions = [self setupCppIdOptions:identificationDeclarationOptions];
8080

81-
// Handles the connection complete event and calls the MCConnectionCallbacks connectionCompleteCallback callback provided by the Swift client. This callback is called by the cpp layer when the connection process has ended, regardless of whether it was successful or not.
81+
// Handles the connection complete event and calls the MCConnectionCallbacks connectionCompleteCallback callback provided by
82+
// the Swift client. This callback is called by the cpp layer when the connection process has ended, regardless of whether it
83+
// was successful or not.
8284
void (^connectCallback)(CHIP_ERROR, matter::casting::core::CastingPlayer *) = ^(CHIP_ERROR err, matter::casting::core::CastingPlayer * castingPlayer) {
8385
ChipLogProgress(AppServer, "MCCastingPlayer.verifyOrEstablishConnectionWithCallbacks() connectCallback() called");
8486
dispatch_queue_t clientQueue = [[MCCastingApp getSharedInstance] getClientQueue];
@@ -90,15 +92,20 @@ - (NSError *)verifyOrEstablishConnectionWithCallbacks:(MCConnectionCallbacks * _
9092
}
9193
});
9294
};
93-
// Handles the Commissioner Declaration event and calls the MCConnectionCallbacks commissionerDeclarationCallback callback provided by the Swift client. This callback is called by the cpp layer when the Commissionee receives a CommissionerDeclaration message from the CastingPlayer/Commissioner.
94-
void (^commissionerDeclarationCallback)(const chip::Transport::PeerAddress & source, const chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cppCommissionerDeclaration) = ^(const chip::Transport::PeerAddress & source, const chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cppCommissionerDeclaration) {
95+
// Handles the Commissioner Declaration event and calls the MCConnectionCallbacks commissionerDeclarationCallback callback
96+
// provided by the Swift client. This callback is called by the cpp layer when the Commissionee receives a
97+
// CommissionerDeclaration message from the CastingPlayer/Commissioner.
98+
void (^commissionerDeclarationCallback)(const chip::Transport::PeerAddress & source, const chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cppCommissionerDeclaration) = ^(const chip::Transport::PeerAddress &
99+
source,
100+
const chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cppCommissionerDeclaration) {
95101
ChipLogProgress(AppServer, "MCCastingPlayer.verifyOrEstablishConnectionWithCallbacks() commissionerDeclarationCallback() called with cpp CommissionerDeclaration message");
96102
dispatch_queue_t clientQueue = [[MCCastingApp getSharedInstance] getClientQueue];
97103
dispatch_async(clientQueue, ^{
98104
if (connectionCallbacks.commissionerDeclarationCallback) {
99105
// convert cppCommissionerDeclaration to a shared_ptr<CommissionerDeclaration> and pass it to the client callback
100106
auto cppCommissionerDeclarationPtr = std::make_shared<chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration>(cppCommissionerDeclaration);
101-
MCCommissionerDeclaration * objcCommissionerDeclaration = [[MCCommissionerDeclaration alloc] initWithCppCommissionerDeclaration:cppCommissionerDeclarationPtr];
107+
MCCommissionerDeclaration * objcCommissionerDeclaration = [[MCCommissionerDeclaration alloc]
108+
initWithCppCommissionerDeclaration:cppCommissionerDeclarationPtr];
102109
connectionCallbacks.commissionerDeclarationCallback(objcCommissionerDeclaration);
103110
} else {
104111
ChipLogError(AppServer, "MCCastingPlayer.verifyOrEstablishConnectionWithCallbacks() commissionerDeclarationCallback(), client failed to set the optional commissionerDeclarationCallback() callback");
@@ -134,7 +141,8 @@ - (NSError *)verifyOrEstablishConnectionWithCallbacks:(MCConnectionCallbacks * _
134141
- (NSError *)continueConnecting
135142
{
136143
ChipLogProgress(AppServer, "MCCastingPlayer.continueConnecting() called");
137-
VerifyOrReturnValue([[MCCastingApp getSharedInstance] isRunning], [MCErrorUtils NSErrorFromChipError:CHIP_ERROR_INCORRECT_STATE], ChipLogError(AppServer, "MCCastingPlayer.continueConnecting() MCCastingApp NOT running"));
144+
VerifyOrReturnValue([[MCCastingApp getSharedInstance] isRunning], [MCErrorUtils NSErrorFromChipError:CHIP_ERROR_INCORRECT_STATE],
145+
ChipLogError(AppServer, "MCCastingPlayer.continueConnecting() MCCastingApp NOT running"));
138146

139147
ChipLogProgress(AppServer, "MCCastingPlayer.continueConnecting() calling MCCastingApp.updateCommissionableDataProvider()");
140148
NSError * updateError = [[MCCastingApp getSharedInstance] updateCommissionableDataProvider];
@@ -146,7 +154,8 @@ - (NSError *)continueConnecting
146154
err = _cppCastingPlayer->ContinueConnecting();
147155
});
148156
if (err != CHIP_NO_ERROR) {
149-
ChipLogError(AppServer, "MCCastingPlayer.continueConnecting() call to cppCastingPlayer->ContinueConnecting() failed due to %" CHIP_ERROR_FORMAT, err.Format());
157+
ChipLogError(AppServer, "MCCastingPlayer.continueConnecting() call to cppCastingPlayer->ContinueConnecting() failed due to %" CHIP_ERROR_FORMAT,
158+
err.Format());
150159
return [MCErrorUtils NSErrorFromChipError:err];
151160
}
152161
return nil;
@@ -163,7 +172,8 @@ - (NSError *)stopConnecting
163172
err = _cppCastingPlayer->StopConnecting();
164173
});
165174
if (err != CHIP_NO_ERROR) {
166-
ChipLogError(AppServer, "MCCastingPlayer.continueConnecting() call to cppCastingPlayer->StopConnecting() failed due to %" CHIP_ERROR_FORMAT, err.Format());
175+
ChipLogError(AppServer, "MCCastingPlayer.continueConnecting() call to cppCastingPlayer->StopConnecting() failed due to %" CHIP_ERROR_FORMAT,
176+
err.Format());
167177
return [MCErrorUtils NSErrorFromChipError:err];
168178
}
169179
return nil;
@@ -205,7 +215,8 @@ + (MCCastingPlayer * _Nullable)getTargetCastingPlayer
205215
- (NSString * _Nonnull)description
206216
{
207217
return [NSString stringWithFormat:@"%@ with Product ID: %hu and Vendor ID: %hu. Resolved IPAddr?: %@. Supports Commissioner-Generated Passcode?: %@.",
208-
self.deviceName, self.productId, self.vendorId, self.ipAddresses != nil && self.ipAddresses.count > 0 ? @"YES" : @"NO", self.supportsCommissionerGeneratedPasscode ? @"YES" : @"NO"];
218+
self.deviceName, self.productId, self.vendorId, self.ipAddresses != nil && self.ipAddresses.count > 0 ? @"YES" : @"NO",
219+
self.supportsCommissionerGeneratedPasscode ? @"YES" : @"NO"];
209220
}
210221

211222
- (NSString * _Nonnull)identifier

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

+12-4
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,26 @@
2626
@interface MCConnectionCallbacks : NSObject
2727

2828
/**
29-
* @param connectionCompleteCallback (Required) The callback called when the connection process has ended, regardless of whether it was successful or not.
30-
* @param commissionerDeclarationCallback (Optional) The callback called when the Client/Commissionee receives a CommissionerDeclaration message from the CastingPlayer/Commissioner. This callback is needed to support UDC features where a reply from the Commissioner is expected. It provides information indicating the Commissioner’s pre-commissioning state.
29+
* @param connectionCompleteCallback (Required) The callback called when the connection process
30+
* has ended, regardless of whether it was successful or not.
31+
* @param commissionerDeclarationCallback (Optional) The callback called when the Client/Commissionee
32+
* receives a CommissionerDeclaration message from the CastingPlayer/Commissioner. This callback is
33+
* needed to support UDC features where a reply from the Commissioner is expected. It provides information
34+
* indicating the Commissioner’s pre-commissioning state.
3135
*
32-
* For example: During CastingPlayer/Commissioner-Generated passcode commissioning, the Commissioner replies with a CommissionerDeclaration message with PasscodeDialogDisplayed and CommissionerPasscode set to true. Given these Commissioner state details, the client is expected to perform some actions and responf accrdingly.
36+
* For example: During CastingPlayer/Commissioner-Generated passcode commissioning, the Commissioner
37+
* replies with a CommissionerDeclaration message with PasscodeDialogDisplayed and CommissionerPasscode
38+
* set to true. Given these Commissioner state details, the client is expected to perform some actions
39+
* and responf accrdingly.
3340
*
3441
* @return A new instance of MCConnectionCallbacks.
3542
*/
3643
- (instancetype _Nonnull)initWithCallbacks:(void (^_Nonnull)(NSError * _Nonnull))connectionCompleteCallback
3744
commissionerDeclarationCallback:(void (^_Nullable)(MCCommissionerDeclaration * _Nonnull))commissionerDeclarationCallback;
3845

3946
/**
40-
* The callback called when the connection process has ended, regardless of whether it was successful or not.
47+
* The callback called when the connection process has ended, regardless of whether it was
48+
* successful or not.
4149
*/
4250
@property void (^_Nullable connectionCompleteCallback)(NSError * _Nonnull);
4351

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
/**
2424
* This class contains the optional parameters used in the IdentificationDeclaration Message, sent
25-
* by the Commissionee (CastingApp) to the Commissioner (CastingPlayer). The options specify information relating to the
26-
* requested UDC commissioning session.
25+
* by the Commissionee (CastingApp) to the Commissioner (CastingPlayer). The options specify
26+
* information relating to the requested UDC commissioning session.
2727
*/
2828
@interface MCIdentificationDeclarationOptions : NSObject
2929

examples/tv-casting-app/darwin/TvCasting/TvCasting/MCConnectionExampleViewModel.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ class MCConnectionExampleViewModel: ObservableObject {
7070
self.displayPasscodeInputDialog(on: topViewController, continueConnecting: { passcode in
7171
self.Log.info("MCConnectionExampleViewModel connect() commissionerDeclarationCallback, Continuing to connect with user entered MCCastingPlayer/Commissioner-Generated passcode: \(passcode)")
7272

73-
// Update the CommissionableData in the client defined MCAppParametersDataSource with the user entered CastingPlayer/Commissioner-Generated setup passcode. This is mandatory for the Commissioner-Generated passcode commissioning flow since the commissioning session's PAKE verifier needs to be updated with the entered passcode. Get the singleton instane of the MCInitializationExample.
73+
// Update the CommissionableData in the client defined MCAppParametersDataSource with the user
74+
// entered CastingPlayer/Commissioner-Generated setup passcode. This is mandatory for the
75+
// Commissioner-Generated passcode commissioning flow since the commissioning session's PAKE
76+
// verifier needs to be updated with the entered passcode. Get the singleton instane of the
77+
// MCInitializationExample.
7478
let initializationExample = MCInitializationExample.shared
7579
self.Log.info("MCConnectionExampleViewModel connect() commissionerDeclarationCallback calling MCInitializationExample.getAppParametersDataSource()")
7680
if let dataSource = initializationExample.getAppParametersDataSource() {

examples/tv-casting-app/darwin/TvCasting/TvCasting/MCInitializationExample.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ class MCInitializationExample {
127127
let Log = Logger(subsystem: "com.matter.casting",
128128
category: "MCInitializationExample")
129129

130-
// We store the client defined instance of the MCAppParametersDataSource passed to CastingApp.initialize(). MCAppParametersDataSource may need to be updated by the client in case of the Casting Player/Commissioner-Generated passcode commissioning flow.
130+
// We store the client defined instance of the MCAppParametersDataSource passed to CastingApp.initialize().
131+
// MCAppParametersDataSource may need to be updated by the client in case of the Casting
132+
// Player/Commissioner-Generated passcode commissioning flow.
131133
private var appParametersDataSource: MCAppParametersDataSource?
132134

133135
private init() {

0 commit comments

Comments
 (0)