Skip to content

Commit 75be581

Browse files
restyled-commitslazarkov
authored andcommitted
Restyled by clang-format
1 parent 070261e commit 75be581

File tree

5 files changed

+61
-33
lines changed

5 files changed

+61
-33
lines changed

examples/tv-app/tv-common/include/AppTv.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ class DLL_EXPORT ContentAppImpl : public ContentApp
9191
KeypadInputDelegate * GetKeypadInputDelegate() override { return &mKeypadInputDelegate; };
9292
MediaPlaybackDelegate * GetMediaPlaybackDelegate() override { return &mMediaPlaybackDelegate; };
9393
TargetNavigatorDelegate * GetTargetNavigatorDelegate() override { return &mTargetNavigatorDelegate; };
94-
bool MatchesPidVid(uint16_t productId, uint16_t vendorId) { return vendorId == mApplicationBasicDelegate.HandleGetVendorId() && productId == mApplicationBasicDelegate.HandleGetProductId(); }
94+
bool MatchesPidVid(uint16_t productId, uint16_t vendorId)
95+
{
96+
return vendorId == mApplicationBasicDelegate.HandleGetVendorId() &&
97+
productId == mApplicationBasicDelegate.HandleGetProductId();
98+
}
9599

96100
protected:
97101
ApplicationBasicManager mApplicationBasicDelegate;

examples/tv-app/tv-common/shell/AppTvShellCommands.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,14 @@ static CHIP_ERROR AppPlatformHandler(int argc, char ** argv)
279279
pid = (uint16_t) strtol(argv[2], &eptr, 10);
280280
}
281281
ContentAppFactoryImpl * factory = GetContentAppFactoryImpl();
282-
bool isAppUninstalled = factory->UninstallContentApp(vid, pid);
282+
bool isAppUninstalled = factory->UninstallContentApp(vid, pid);
283283

284-
if (isAppUninstalled) {
284+
if (isAppUninstalled)
285+
{
285286
ChipLogProgress(DeviceLayer, "uninstalled an app");
286-
} else {
287+
}
288+
else
289+
{
287290
ChipLogProgress(DeviceLayer, "app not found.");
288291
}
289292

examples/tv-app/tv-common/src/AppTv.cpp

+42-23
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ class MyUserPrompter : public UserPrompter
101101

102102
// tv should override this with a dialog prompt
103103
inline void PromptForAppInstallOKPermission(uint16_t vendorId, uint16_t productId, const char * commissioneeName) override
104-
{ return; }
104+
{
105+
return;
106+
}
105107
};
106108

107109
MyUserPrompter gMyUserPrompter;
@@ -543,7 +545,8 @@ ContentApp * ContentAppFactoryImpl::LoadContentApp(const CatalogVendorApp & vend
543545
vendorApp.catalogVendorId, vendorApp.applicationId);
544546
int index = 0;
545547

546-
for (auto & contentApp : mContentApps) {
548+
for (auto & contentApp : mContentApps)
549+
{
547550

548551
auto app = contentApp.get();
549552

@@ -570,35 +573,51 @@ void ContentAppFactoryImpl::AddAdminVendorId(uint16_t vendorId)
570573

571574
void ContentAppFactoryImpl::InstallContentApp(uint16_t vendorId, uint16_t productId)
572575
{
573-
ChipLogProgress(DeviceLayer, "ContentAppFactoryImpl: InstallContentApp vendorId=%d productId=%d ",
574-
vendorId, productId);
575-
if (vendorId == 1 && productId == 11) {
576-
mContentApps.emplace_back(std::make_unique<ContentAppImpl>("Vendor1", vendorId, "exampleid", productId, "Version1", "34567890"));
577-
} else if (vendorId == 65521 && productId == 32768) {
578-
mContentApps.emplace_back(std::make_unique<ContentAppImpl>("Vendor2", vendorId, "exampleString", productId, "Version2", "20202021"));
579-
} else if (vendorId == 9050 && productId == 22) {
576+
ChipLogProgress(DeviceLayer, "ContentAppFactoryImpl: InstallContentApp vendorId=%d productId=%d ", vendorId, productId);
577+
if (vendorId == 1 && productId == 11)
578+
{
579+
mContentApps.emplace_back(
580+
std::make_unique<ContentAppImpl>("Vendor1", vendorId, "exampleid", productId, "Version1", "34567890"));
581+
}
582+
else if (vendorId == 65521 && productId == 32768)
583+
{
584+
mContentApps.emplace_back(
585+
std::make_unique<ContentAppImpl>("Vendor2", vendorId, "exampleString", productId, "Version2", "20202021"));
586+
}
587+
else if (vendorId == 9050 && productId == 22)
588+
{
580589
mContentApps.emplace_back(std::make_unique<ContentAppImpl>("Vendor3", vendorId, "App3", productId, "Version3", "20202021"));
581-
} else if (vendorId == 1111 && productId == 22) {
582-
mContentApps.emplace_back(std::make_unique<ContentAppImpl>("TestSuiteVendor", vendorId, "applicationId", productId, "v2", "20202021"));
583-
} else {
584-
mContentApps.emplace_back(std::make_unique<ContentAppImpl>("NewAppVendor", vendorId, "newAppApplicationId", productId, "v2", "20202021"));
590+
}
591+
else if (vendorId == 1111 && productId == 22)
592+
{
593+
mContentApps.emplace_back(
594+
std::make_unique<ContentAppImpl>("TestSuiteVendor", vendorId, "applicationId", productId, "v2", "20202021"));
595+
}
596+
else
597+
{
598+
mContentApps.emplace_back(
599+
std::make_unique<ContentAppImpl>("NewAppVendor", vendorId, "newAppApplicationId", productId, "v2", "20202021"));
585600
}
586601
}
587602

588603
bool ContentAppFactoryImpl::UninstallContentApp(uint16_t vendorId, uint16_t productId)
589604
{
590-
ChipLogProgress(DeviceLayer, "ContentAppFactoryImpl: UninstallContentApp vendorId=%d productId=%d ",
591-
vendorId, productId);
605+
ChipLogProgress(DeviceLayer, "ContentAppFactoryImpl: UninstallContentApp vendorId=%d productId=%d ", vendorId, productId);
592606

593607
int index = 0;
594-
for (auto & contentApp : mContentApps) {
608+
for (auto & contentApp : mContentApps)
609+
{
595610

596611
auto app = contentApp.get();
597612

598-
ChipLogProgress(DeviceLayer, "Looking next vid=%d pid=%d", app->GetApplicationBasicDelegate()->HandleGetVendorId(), app->GetApplicationBasicDelegate()->HandleGetProductId());
613+
ChipLogProgress(DeviceLayer, "Looking next vid=%d pid=%d", app->GetApplicationBasicDelegate()->HandleGetVendorId(),
614+
app->GetApplicationBasicDelegate()->HandleGetProductId());
599615

600-
if (app->MatchesPidVid(productId, vendorId)) {
601-
ChipLogProgress(DeviceLayer, "Found an app vid=%d pid=%d. Uninstalling it.", app->GetApplicationBasicDelegate()->HandleGetVendorId(), app->GetApplicationBasicDelegate()->HandleGetProductId());
616+
if (app->MatchesPidVid(productId, vendorId))
617+
{
618+
ChipLogProgress(DeviceLayer, "Found an app vid=%d pid=%d. Uninstalling it.",
619+
app->GetApplicationBasicDelegate()->HandleGetVendorId(),
620+
app->GetApplicationBasicDelegate()->HandleGetProductId());
602621
mContentApps.erase(mContentApps.begin() + index);
603622
return true;
604623
}
@@ -664,10 +683,10 @@ CHIP_ERROR AppTvInit()
664683
#if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
665684
ContentAppPlatform::GetInstance().SetupAppPlatform();
666685
ContentAppPlatform::GetInstance().SetContentAppFactory(&gFactory);
667-
gFactory.InstallContentApp((uint16_t)1, (uint16_t)11);
668-
gFactory.InstallContentApp((uint16_t)65521, (uint16_t)32768);
669-
gFactory.InstallContentApp((uint16_t)9050, (uint16_t)22);
670-
gFactory.InstallContentApp((uint16_t)1111, (uint16_t)22);
686+
gFactory.InstallContentApp((uint16_t) 1, (uint16_t) 11);
687+
gFactory.InstallContentApp((uint16_t) 65521, (uint16_t) 32768);
688+
gFactory.InstallContentApp((uint16_t) 9050, (uint16_t) 22);
689+
gFactory.InstallContentApp((uint16_t) 1111, (uint16_t) 22);
671690
uint16_t value;
672691
if (DeviceLayer::GetDeviceInstanceInfoProvider()->GetVendorId(value) != CHIP_NO_ERROR)
673692
{

src/controller/CommissionerDiscoveryController.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ void CommissionerDiscoveryController::InternalOk()
226226
return;
227227
}
228228

229-
if (!mAppInstallationService->LookupTargetContentApp(client->GetVendorId(), client->GetProductId())) {
229+
if (!mAppInstallationService->LookupTargetContentApp(client->GetVendorId(), client->GetProductId()))
230+
{
230231
ChipLogDetail(AppServer, "UX InternalOk: app not installed.");
231232

232233
// notify client that app will be installed
@@ -235,9 +236,8 @@ void CommissionerDiscoveryController::InternalOk()
235236
mUdcServer->SendCDCMessage(cd, Transport::PeerAddress::UDP(client->GetPeerAddress().GetIPAddress(), client->GetCdPort()));
236237

237238
// dialog
238-
ChipLogDetail(Controller,
239-
"------PROMPT USER: %s is requesting to install app on this TV. vendorId=%d, productId=%d",
240-
client->GetDeviceName(), client->GetVendorId(), client->GetProductId());
239+
ChipLogDetail(Controller, "------PROMPT USER: %s is requesting to install app on this TV. vendorId=%d, productId=%d",
240+
client->GetDeviceName(), client->GetVendorId(), client->GetProductId());
241241

242242
if (mUserPrompter != nullptr)
243243
{

src/controller/CommissionerDiscoveryController.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ class DLL_EXPORT UserPrompter
165165
*/
166166
virtual void PromptForAppInstallOKPermission(uint16_t vendorId, uint16_t productId, const char * commissioneeName) = 0;
167167

168-
169168
virtual ~UserPrompter() = default;
170169
};
171170

@@ -430,7 +429,10 @@ class CommissionerDiscoveryController : public chip::Protocols::UserDirectedComm
430429
/**
431430
* Assign an AppInstallationService
432431
*/
433-
inline void SetAppInstallationService(AppInstallationService * appInstallationService) { mAppInstallationService = appInstallationService; }
432+
inline void SetAppInstallationService(AppInstallationService * appInstallationService)
433+
{
434+
mAppInstallationService = appInstallationService;
435+
}
434436

435437
/**
436438
* Assign a Commissioner Callback to perform commissioning once user consent has been given

0 commit comments

Comments
 (0)