Skip to content

Commit

Permalink
Discovery API with example code
Browse files Browse the repository at this point in the history
  • Loading branch information
sharadb-amazon committed Dec 29, 2023
1 parent 8ca4cf3 commit cbce91e
Show file tree
Hide file tree
Showing 25 changed files with 783 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
3C2346212B362B4F00FA276E /* MTRCastingPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C2346202B362B4F00FA276E /* MTRCastingPlayer.h */; };
3C2346232B362B9500FA276E /* MTRCastingPlayerDiscovery.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C2346222B362B9500FA276E /* MTRCastingPlayerDiscovery.h */; };
3C2346252B362BBB00FA276E /* MTRCastingPlayerDiscovery.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2346242B362BBB00FA276E /* MTRCastingPlayerDiscovery.m */; };
3C2346252B362BBB00FA276E /* MTRCastingPlayerDiscovery.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C2346242B362BBB00FA276E /* MTRCastingPlayerDiscovery.mm */; };
3C2346272B362BF400FA276E /* MTREndpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C2346262B362BF400FA276E /* MTREndpoint.h */; };
3C2346292B362C2100FA276E /* MTRCluster.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C2346282B362C2100FA276E /* MTRCluster.h */; };
3C23462B2B362C3D00FA276E /* MTRAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C23462A2B362C3D00FA276E /* MTRAttribute.h */; };
Expand All @@ -35,7 +35,10 @@
3C81C74C28F7A777001CB9D1 /* ContentApp.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C81C74B28F7A777001CB9D1 /* ContentApp.mm */; };
3C81C75028F7A7D3001CB9D1 /* VideoPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C81C74F28F7A7D3001CB9D1 /* VideoPlayer.m */; };
3C9437872B364F4F0096E5F4 /* MTREndpoint.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9437862B364F4F0096E5F4 /* MTREndpoint.m */; };
3C9437892B364F5E0096E5F4 /* MTRCastingPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9437882B364F5E0096E5F4 /* MTRCastingPlayer.m */; };
3C9437922B3B478E0096E5F4 /* MTRErrorUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C9437912B3B478E0096E5F4 /* MTRErrorUtils.h */; };
3C9437942B3B47A10096E5F4 /* MTRErrorUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C9437932B3B47A10096E5F4 /* MTRErrorUtils.mm */; };
3C9437962B3B51E00096E5F4 /* MTRConversionUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C9437952B3B51E00096E5F4 /* MTRConversionUtils.h */; };
3C9437982B3B51FD0096E5F4 /* MTRConversionUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C9437972B3B51FD0096E5F4 /* MTRConversionUtils.mm */; };
3CCB87212869085400771BAD /* MatterTvCastingBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CCB87202869085400771BAD /* MatterTvCastingBridge.h */; settings = {ATTRIBUTES = (Public, ); }; };
3CCB8737286A555500771BAD /* libTvCastingCommon.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CCB8735286A555500771BAD /* libTvCastingCommon.a */; };
3CCB8738286A555500771BAD /* libmbedtls.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CCB8736286A555500771BAD /* libmbedtls.a */; settings = {ATTRIBUTES = (Required, ); }; };
Expand Down Expand Up @@ -67,7 +70,7 @@
3C0D9CDF2920A30C00D3332B /* CommissionableDataProviderImpl.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CommissionableDataProviderImpl.hpp; sourceTree = "<group>"; };
3C2346202B362B4F00FA276E /* MTRCastingPlayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRCastingPlayer.h; sourceTree = "<group>"; };
3C2346222B362B9500FA276E /* MTRCastingPlayerDiscovery.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRCastingPlayerDiscovery.h; sourceTree = "<group>"; };
3C2346242B362BBB00FA276E /* MTRCastingPlayerDiscovery.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTRCastingPlayerDiscovery.m; sourceTree = "<group>"; };
3C2346242B362BBB00FA276E /* MTRCastingPlayerDiscovery.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRCastingPlayerDiscovery.mm; sourceTree = "<group>"; };
3C2346262B362BF400FA276E /* MTREndpoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTREndpoint.h; sourceTree = "<group>"; };
3C2346282B362C2100FA276E /* MTRCluster.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRCluster.h; sourceTree = "<group>"; };
3C23462A2B362C3D00FA276E /* MTRAttribute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRAttribute.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -101,6 +104,10 @@
3C81C75128F7A7DF001CB9D1 /* VideoPlayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VideoPlayer.h; sourceTree = "<group>"; };
3C9437862B364F4F0096E5F4 /* MTREndpoint.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTREndpoint.m; sourceTree = "<group>"; };
3C9437882B364F5E0096E5F4 /* MTRCastingPlayer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTRCastingPlayer.m; sourceTree = "<group>"; };
3C9437912B3B478E0096E5F4 /* MTRErrorUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRErrorUtils.h; sourceTree = "<group>"; };
3C9437932B3B47A10096E5F4 /* MTRErrorUtils.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRErrorUtils.mm; sourceTree = "<group>"; };
3C9437952B3B51E00096E5F4 /* MTRConversionUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRConversionUtils.h; sourceTree = "<group>"; };
3C9437972B3B51FD0096E5F4 /* MTRConversionUtils.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRConversionUtils.mm; sourceTree = "<group>"; };
3CA1CA7728E243750023ED44 /* MediaPlaybackTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaPlaybackTypes.h; sourceTree = "<group>"; };
3CCB871D2869085400771BAD /* MatterTvCastingBridge.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MatterTvCastingBridge.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3CCB87202869085400771BAD /* MatterTvCastingBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MatterTvCastingBridge.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -144,6 +151,27 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
3C94378A2B3654720096E5F4 /* Core */ = {
isa = PBXGroup;
children = (
);
path = Core;
sourceTree = "<group>";
};
3C94378B2B36547A0096E5F4 /* Support */ = {
isa = PBXGroup;
children = (
);
path = Support;
sourceTree = "<group>";
};
3C94378C2B3654960096E5F4 /* Clusters */ = {
isa = PBXGroup;
children = (
);
path = Clusters;
sourceTree = "<group>";
};
3CCB87132869085400771BAD = {
isa = PBXGroup;
children = (
Expand All @@ -165,11 +193,14 @@
3CCB871F2869085400771BAD /* MatterTvCastingBridge */ = {
isa = PBXGroup;
children = (
3C94378A2B3654720096E5F4 /* Core */,
3C94378B2B36547A0096E5F4 /* Support */,
3C94378C2B3654960096E5F4 /* Clusters */,
3CCB87202869085400771BAD /* MatterTvCastingBridge.h */,
3CF71C092A992D0D003A5CE5 /* MTRCastingApp.h */,
3CF71C0B2A992D25003A5CE5 /* MTRCastingApp.mm */,
3C2346222B362B9500FA276E /* MTRCastingPlayerDiscovery.h */,
3C2346242B362BBB00FA276E /* MTRCastingPlayerDiscovery.m */,
3C2346242B362BBB00FA276E /* MTRCastingPlayerDiscovery.mm */,
3C2346202B362B4F00FA276E /* MTRCastingPlayer.h */,
3C9437882B364F5E0096E5F4 /* MTRCastingPlayer.m */,
3C2346262B362BF400FA276E /* MTREndpoint.h */,
Expand All @@ -196,6 +227,12 @@
3C2346362B362D8E00FA276E /* MTRMediaPlaybackCluster.h */,
3C2346382B362DA100FA276E /* MTRMediaPlaybackCluster.m */,
3C23463A2B362E4200FA276E /* MTRCurrentState.h */,
3C9437952B3B51E00096E5F4 /* MTRConversionUtils.h */,
3C9437972B3B51FD0096E5F4 /* MTRConversionUtils.mm */,
3CF8532528E37ED800F07B9F /* MatterError.h */,
3CF8532628E37F1000F07B9F /* MatterError.mm */,
3C9437912B3B478E0096E5F4 /* MTRErrorUtils.h */,
3C9437932B3B47A10096E5F4 /* MTRErrorUtils.mm */,
3CCB873A286A593700771BAD /* CastingServerBridge.h */,
3CCB873D286A593700771BAD /* CastingServerBridge.mm */,
3C66FBFA2903279A00B63FE7 /* AppParameters.h */,
Expand All @@ -210,8 +247,6 @@
3C81C74B28F7A777001CB9D1 /* ContentApp.mm */,
3C81C75128F7A7DF001CB9D1 /* VideoPlayer.h */,
3C81C74F28F7A7D3001CB9D1 /* VideoPlayer.m */,
3CF8532528E37ED800F07B9F /* MatterError.h */,
3CF8532628E37F1000F07B9F /* MatterError.mm */,
3C4E53B428E5593700F293E8 /* ContentLauncherTypes.h */,
3C4E53B528E5595A00F293E8 /* ContentLauncherTypes.mm */,
3CA1CA7728E243750023ED44 /* MediaPlaybackTypes.h */,
Expand Down Expand Up @@ -258,9 +293,11 @@
3C23462B2B362C3D00FA276E /* MTRAttribute.h in Headers */,
3C23462D2B362C6E00FA276E /* MTREndpointClusterType.h in Headers */,
3CCB8742286A593700771BAD /* ConversionUtils.hpp in Headers */,
3C9437922B3B478E0096E5F4 /* MTRErrorUtils.h in Headers */,
3C23463B2B362E4200FA276E /* MTRCurrentState.h in Headers */,
3CCB8741286A593700771BAD /* DiscoveredNodeData.h in Headers */,
3C2346312B362D4700FA276E /* MTRContentLauncherCluster.h in Headers */,
3C9437962B3B51E00096E5F4 /* MTRConversionUtils.h in Headers */,
3CCB87212869085400771BAD /* MatterTvCastingBridge.h in Headers */,
3C2346352B362D7900FA276E /* MTRLaunchResponse.h in Headers */,
3C6920462AA1093300D0F613 /* MTRDeviceAttestationCredentialsProvider.h in Headers */,
Expand Down Expand Up @@ -367,7 +404,6 @@
3C2346332B362D5F00FA276E /* MTRContentLauncherCluster.m in Sources */,
3C4E53B228E5184C00F293E8 /* TargetNavigatorTypes.mm in Sources */,
3C6920482AA1094000D0F613 /* MTRDeviceAttestationCredentialsProvider.mm in Sources */,
3C9437892B364F5E0096E5F4 /* MTRCastingPlayer.m in Sources */,
3CE5ECD02A673E2C007CF331 /* CommissioningCallbackHandlers.m in Sources */,
3CD73F192A9E68A7009D82D1 /* MTRRotatingDeviceIdUniqueIdProvider.mm in Sources */,
3CF8532728E37F1000F07B9F /* MatterError.mm in Sources */,
Expand All @@ -378,11 +414,13 @@
3C4E53B028E4F28100F293E8 /* MediaPlaybackTypes.mm in Sources */,
3CD73F1E2A9E83C1009D82D1 /* MTRCommissionableDataProvider.mm in Sources */,
3CD73F222A9EA078009D82D1 /* MTRDeviceAttestationCredentials.mm in Sources */,
3C2346252B362BBB00FA276E /* MTRCastingPlayerDiscovery.m in Sources */,
3C2346252B362BBB00FA276E /* MTRCastingPlayerDiscovery.mm in Sources */,
3C66FBFC290327BB00B63FE7 /* AppParameters.mm in Sources */,
3C2346392B362DA100FA276E /* MTRMediaPlaybackCluster.m in Sources */,
3C9437942B3B47A10096E5F4 /* MTRErrorUtils.mm in Sources */,
3CE868F42946D76200FCB92B /* CommissionableDataProviderImpl.mm in Sources */,
3C26AC9329282B8100BA6881 /* DeviceAttestationCredentialsHolder.m in Sources */,
3C9437982B3B51FD0096E5F4 /* MTRConversionUtils.mm in Sources */,
3C9437872B364F4F0096E5F4 /* MTREndpoint.m in Sources */,
3C26AC902927008900BA6881 /* DeviceAttestationCredentialsProviderImpl.mm in Sources */,
3CCB873F286A593700771BAD /* DiscoveredNodeData.mm in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,41 @@
*/
+ (MTRCastingApp * _Nullable)getSharedInstance;

- (dispatch_queue_t _Nullable)getWorkQueue;

- (dispatch_queue_t _Nullable)getClientQueue;

/**
* @brief Initializes the MTRCastingApp with appParameters
*
* @param dataSource provides all the parameters required to initialize the MTRCastingApp
*/
- (MatterError * _Nonnull)initializeWithDataSource:(id<MTRDataSource> _Nonnull)dataSource;
- (NSError * _Nullable)initializeWithDataSource:(id<MTRDataSource> _Nonnull)dataSource;

/**
* @brief (async) Starts the Matter server that the MTRCastingApp runs on and registers all the necessary delegates
*/
- (void)startWithCompletionBlock:(void (^_Nonnull __strong)(NSError * _Nullable __strong))completion;

/**
* @brief (async) Stops the Matter server that the MTRCastingApp runs on
*/
- (void)stopWithCompletionBlock:(void (^_Nonnull __strong)(NSError * _Nullable __strong))completion;

/**
* @brief true, if MTRCastingApp is running. false otherwise
*/
- (bool)isRunning;

/**
* @brief Starts the Matter server that the MTRCastingApp runs on and registers all the necessary delegates
* @brief Tears down all active subscriptions.
*/
- (MatterError * _Nonnull)start;
- (NSError * _Nullable)ShutdownAllSubscriptions;

/**
* @brief Stops the Matter server that the MTRCastingApp runs on
* @brief Clears app cache that contains the information about CastingPlayers previously connected to
*/
- (MatterError * _Nonnull)stop;
- (NSError * _Nullable)ClearCache;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#import "MTRCommissionableDataProvider.h"
#import "MTRCommonCaseDeviceServerInitParamsProvider.h"
#import "MTRDeviceAttestationCredentialsProvider.h"
#import "MTRErrorUtils.h"
#import "MTRRotatingDeviceIdUniqueIdProvider.h"

#import "core/Types.h"
Expand All @@ -36,14 +37,17 @@ @interface MTRCastingApp ()
@property matter::casting::support::MTRDeviceAttestationCredentialsProvider * dacProvider;
@property MTRCommonCaseDeviceServerInitParamsProvider * serverInitParamsProvider;

// queue used to serialize all work performed by the CastingServerBridge
@property (atomic) dispatch_queue_t chipWorkQueue;
// queue used when calling the client code on completion blocks from any MatterTvCastingBridge API
@property dispatch_queue_t _Nonnull clientQueue;

// queue used to perform all work performed by the MatterTvCastingBridge
@property (atomic) dispatch_queue_t workQueue;

@end

@implementation MTRCastingApp

+ (MTRCastingApp * _Nullable)getSharedInstance
+ (MTRCastingApp *)getSharedInstance
{
static MTRCastingApp * instance = nil;
static dispatch_once_t onceToken;
Expand All @@ -53,63 +57,115 @@ + (MTRCastingApp * _Nullable)getSharedInstance
return instance;
}

- (MatterError * _Nonnull)initializeWithDataSource:(id _Nonnull)dataSource
- (dispatch_queue_t)getWorkQueue
{
return _workQueue;
}

- (dispatch_queue_t)getClientQueue
{
return _clientQueue;
}

- (NSError *)initializeWithDataSource:(id)dataSource
{
ChipLogProgress(AppServer, "MTRCastingApp.initializeWithDataSource called");

// get the clientQueue
VerifyOrReturnValue([dataSource clientQueue] != nil, [MTRErrorUtils NSErrorFromChipError:CHIP_ERROR_INVALID_ARGUMENT]);
_clientQueue = [dataSource clientQueue];

// Initialize cpp Providers
VerifyOrReturnValue(_uniqueIdProvider.Initialize(dataSource) == CHIP_NO_ERROR, MATTER_ERROR_INVALID_ARGUMENT);
VerifyOrReturnValue(_uniqueIdProvider.Initialize(dataSource) == CHIP_NO_ERROR, [MTRErrorUtils NSErrorFromChipError:CHIP_ERROR_INVALID_ARGUMENT]);

_commissionableDataProvider = new matter::casting::support::MTRCommissionableDataProvider();
VerifyOrReturnValue(_commissionableDataProvider->Initialize(dataSource) == CHIP_NO_ERROR, MATTER_ERROR_INVALID_ARGUMENT);
VerifyOrReturnValue(_commissionableDataProvider->Initialize(dataSource) == CHIP_NO_ERROR, [MTRErrorUtils NSErrorFromChipError:CHIP_ERROR_INVALID_ARGUMENT]);

_dacProvider = new matter::casting::support::MTRDeviceAttestationCredentialsProvider();
VerifyOrReturnValue(_dacProvider->Initialize(dataSource) == CHIP_NO_ERROR, MATTER_ERROR_INVALID_ARGUMENT);
VerifyOrReturnValue(_dacProvider->Initialize(dataSource) == CHIP_NO_ERROR, [MTRErrorUtils NSErrorFromChipError:CHIP_ERROR_INVALID_ARGUMENT]);

_serverInitParamsProvider = new MTRCommonCaseDeviceServerInitParamsProvider();

// Create cpp AppParameters
VerifyOrReturnValue(_appParameters.Create(&_uniqueIdProvider, _commissionableDataProvider, _dacProvider,
GetDefaultDACVerifier(chip::Credentials::GetTestAttestationTrustStore()), _serverInitParamsProvider)
== CHIP_NO_ERROR,
MATTER_ERROR_INVALID_ARGUMENT);
[MTRErrorUtils NSErrorFromChipError:CHIP_ERROR_INVALID_ARGUMENT]);

// Initialize cpp CastingApp
VerifyOrReturnValue(matter::casting::core::CastingApp::GetInstance()->Initialize(_appParameters) == CHIP_NO_ERROR,
MATTER_ERROR_INCORRECT_STATE);
[MTRErrorUtils NSErrorFromChipError:CHIP_ERROR_INCORRECT_STATE]);

// Get and store the CHIP Work queue
_chipWorkQueue = chip::DeviceLayer::PlatformMgrImpl().GetWorkQueue();
_workQueue = chip::DeviceLayer::PlatformMgrImpl().GetWorkQueue();

return MATTER_NO_ERROR;
return [MTRErrorUtils NSErrorFromChipError:CHIP_NO_ERROR];
}

- (MatterError * _Nonnull)start
- (void)startWithCompletionBlock:(void (^)(NSError *))completion
{
ChipLogProgress(AppServer, "MTRCastingApp.start called");
VerifyOrReturnValue(_chipWorkQueue != nil, MATTER_ERROR_INCORRECT_STATE);
ChipLogProgress(AppServer, "MTRCastingApp.startWithCompletionBlock called");
VerifyOrReturn(_workQueue != nil && _clientQueue != nil, dispatch_async(self->_clientQueue, ^{
completion([MTRErrorUtils NSErrorFromChipError:CHIP_ERROR_INCORRECT_STATE]);
}));

dispatch_async(_workQueue, ^{
__block CHIP_ERROR err = matter::casting::core::CastingApp::GetInstance()->Start();
dispatch_async(self->_clientQueue, ^{
completion([MTRErrorUtils NSErrorFromChipError:err]);
});
});
__block CHIP_ERROR err = chip::DeviceLayer::PlatformMgrImpl().StartEventLoopTask();
VerifyOrReturn(err == CHIP_NO_ERROR, dispatch_async(self->_clientQueue, ^{
completion([MTRErrorUtils NSErrorFromChipError:err]);
}));
}

__block CHIP_ERROR err = CHIP_NO_ERROR;
- (void)stopWithCompletionBlock:(void (^)(NSError *))completion
{
ChipLogProgress(AppServer, "MTRCastingApp.stopWithCompletionBlock called");
VerifyOrReturn(_workQueue != nil && _clientQueue != nil, dispatch_async(self->_clientQueue, ^{
completion([MTRErrorUtils NSErrorFromChipError:CHIP_ERROR_INCORRECT_STATE]);
}));

dispatch_sync(_chipWorkQueue, ^{
err = matter::casting::core::CastingApp::GetInstance()->Start();
});
dispatch_async(_workQueue, ^{
__block CHIP_ERROR err = matter::casting::core::CastingApp::GetInstance()->Stop();

return err == CHIP_NO_ERROR ? MATTER_NO_ERROR : MATTER_ERROR_INCORRECT_STATE;
dispatch_async(self->_clientQueue, ^{
completion([MTRErrorUtils NSErrorFromChipError:err]);
});
});
}

- (MatterError * _Nonnull)stop
- (bool)isRunning
{
ChipLogProgress(AppServer, "MTRCastingApp.stop called");
VerifyOrReturnValue(_chipWorkQueue != nil, MATTER_ERROR_INCORRECT_STATE);
VerifyOrReturnValue(_workQueue != nil && _clientQueue != nil, false);

__block CHIP_ERROR err = CHIP_NO_ERROR;
__block bool running = false;
dispatch_sync(_workQueue, ^{
running = matter::casting::core::CastingApp::GetInstance()->isRunning();
});
return running;
}

dispatch_sync(_chipWorkQueue, ^{
err = matter::casting::core::CastingApp::GetInstance()->Stop();
- (NSError *)ShutdownAllSubscriptions
{
ChipLogProgress(AppServer, "MTRCastingApp.ShutdownAllSubscriptions called");
__block CHIP_ERROR err = CHIP_NO_ERROR;
dispatch_sync(_workQueue, ^{
err = matter::casting::core::CastingApp::GetInstance()->ShutdownAllSubscriptions();
});
return [MTRErrorUtils NSErrorFromChipError:err];
}

return err == CHIP_NO_ERROR ? MATTER_NO_ERROR : MATTER_ERROR_INCORRECT_STATE;
- (NSError *)ClearCache
{
ChipLogProgress(AppServer, "MTRCastingApp.ClearCache called");
__block CHIP_ERROR err = CHIP_NO_ERROR;
dispatch_sync(_workQueue, ^{
err = matter::casting::core::CastingApp::GetInstance()->ClearCache();
});
return [MTRErrorUtils NSErrorFromChipError:err];
}

@end
Loading

0 comments on commit cbce91e

Please sign in to comment.