Skip to content

Commit

Permalink
Fixing issues with running the iOS TvCasting app on physical iPhones (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sharadb-amazon authored and pull[bot] committed Aug 9, 2022
1 parent 4279321 commit 2b8b008
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

#import "DiscoveredNodeDataConverter.hpp"

#include <credentials/DeviceAttestationCredsProvider.h>
#include <credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h>
#include <credentials/attestation_verifier/DeviceAttestationVerifier.h>
#include <credentials/examples/DeviceAttestationCredsExample.h>
#include <lib/support/CHIPMem.h>
#include <platform/PlatformManager.h>

Expand Down Expand Up @@ -57,6 +61,16 @@ - (instancetype)init
return nil;
}

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(chip::Credentials::Examples::GetExampleDACProvider());

// Initialize device attestation verifier from a constant version
{
// TODO: Replace testingRootStore with a AttestationTrustStore that has the necessary official PAA roots available
const chip::Credentials::AttestationTrustStore * testingRootStore = chip::Credentials::GetTestAttestationTrustStore();
SetDeviceAttestationVerifier(GetDefaultDACVerifier(testingRootStore));
}

// init app Server
static chip::CommonCaseDeviceServerInitParams initParams;
err = initParams.InitializeStaticResourcesBeforeServerInit();
Expand Down Expand Up @@ -161,9 +175,10 @@ - (void)openBasicCommissioningWindow:(nullable void (^)(bool))commissioningCompl
{
ChipLogProgress(AppServer, "CastingServerBridge().openBasicCommissioningWindow() called");

_commissioningCompleteCallback = commissioningCompleteCallback;
dispatch_async(_chipWorkQueue, ^{
CHIP_ERROR err = CastingServer::GetInstance()->OpenBasicCommissioningWindow(
[&commissioningCompleteCallback](CHIP_ERROR err) { commissioningCompleteCallback(CHIP_NO_ERROR == err); });
[](CHIP_ERROR err) { [CastingServerBridge getSharedInstance].commissioningCompleteCallback(CHIP_NO_ERROR == err); });

dispatch_async(clientQueue, ^{
commissioningWindowRequestedHandler(CHIP_NO_ERROR == err);
Expand All @@ -179,10 +194,11 @@ - (void)contentLauncherLaunchUrl:(NSString * _Nonnull)contentUrl
{
ChipLogProgress(AppServer, "CastingServerBridge().contentLauncherLaunchUrl() called");

_launchUrlResponseCallback = launchUrlResponseCallback;
dispatch_async(_chipWorkQueue, ^{
CHIP_ERROR err
= CastingServer::GetInstance()->ContentLauncherLaunchURL([contentUrl UTF8String], [contentDisplayStr UTF8String],
[&launchUrlResponseCallback](CHIP_ERROR err) { launchUrlResponseCallback(CHIP_NO_ERROR == err); });
[](CHIP_ERROR err) { [CastingServerBridge getSharedInstance].launchUrlResponseCallback(CHIP_NO_ERROR == err); });
dispatch_async(clientQueue, ^{
launchUrlRequestSentHandler(CHIP_NO_ERROR == err);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
GCC_PREPROCESSOR_DEFINITIONS = (
CHIP_HAVE_CONFIG_H,
"CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>",
"CHIP_CONFIG_KVS_PATH=\"chip_casting_kvs\"",
"DEBUG=1",
"$(inherited)",
);
Expand All @@ -410,9 +411,12 @@
"$(CHIP_ROOT)/zzz_generated/app-common",
"$(CHIP_ROOT)/zzz_generated/controller-clusters",
);
INFOPLIST_FILE = TvCasting/Info.plist;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UIRequiredDeviceCapabilities = armv7;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -477,6 +481,7 @@
GCC_PREPROCESSOR_DEFINITIONS = (
CHIP_HAVE_CONFIG_H,
"CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>",
"CHIP_CONFIG_KVS_PATH=\"chip_casting_kvs\"",
"$(inherited)",
);
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -496,9 +501,12 @@
"$(CHIP_ROOT)/zzz_generated/app-common",
"$(CHIP_ROOT)/zzz_generated/controller-clusters",
);
INFOPLIST_FILE = TvCasting/Info.plist;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UIRequiredDeviceCapabilities = armv7;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
23 changes: 23 additions & 0 deletions examples/tv-casting-app/darwin/TvCasting/TvCasting/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleURLSchemes</key>
<array>
<string>mt</string>
</array>
</dict>
</array>
<key>NSBonjourServices</key>
<array>
<string>_matter._tcp</string>
<string>_matterc._udp</string>
<string>_matterd._udp</string>
</array>
</dict>
</plist>
5 changes: 4 additions & 1 deletion examples/tv-casting-app/tv-casting-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ chip_data_model("tv-casting-common") {
}

static_library("tvCastingCommon") {
public_deps = [ "${chip_root}/examples/tv-casting-app/tv-casting-common" ]
public_deps = [
"${chip_root}/examples/tv-casting-app/tv-casting-common",
"${chip_root}/src/credentials:default_attestation_verifier",
]

cflags = [ "-Wconversion" ]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

// include the CHIPProjectConfig from config/standalone

#ifndef CHIP_CONFIG_KVS_PATH
#define CHIP_CONFIG_KVS_PATH "/tmp/chip_casting_kvs"
#endif

#include <CHIPProjectConfig.h>

Expand Down

0 comments on commit 2b8b008

Please sign in to comment.