Skip to content

Commit 0613f7b

Browse files
committed
Update code
1 parent 5407248 commit 0613f7b

File tree

4 files changed

+80
-23
lines changed

4 files changed

+80
-23
lines changed

examples/tv-app/android/.idea/workspace.xml

+55
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

+2
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ static CHIP_ERROR AppPlatformHandler(int argc, char ** argv)
257257
{
258258
pid = (uint16_t) strtol(argv[2], &eptr, 10);
259259
}
260+
ContentAppFactoryImpl * factory = GetContentAppFactoryImpl();
261+
factory->AddContentApp(vid, pid);
260262
ContentAppPlatform::GetInstance().LoadContentAppByClient(vid, pid);
261263

262264
ChipLogProgress(DeviceLayer, "added app");

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,7 @@ class MyUserPrompter : public UserPrompter
103103

104104
// tv should override this with a dialog prompt
105105
inline void PromptForAppInstallOKPermission(uint16_t vendorId, uint16_t productId, const char * commissioneeName) override
106-
{
107-
gFactory.AddContentApp(vendorId, productId);
108-
return;
109-
}
106+
{ return; }
110107
};
111108

112109
MyUserPrompter gMyUserPrompter;

src/controller/CommissionerDiscoveryController.cpp

+22-19
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,28 @@ void CommissionerDiscoveryController::InternalOk()
219219
ChipLogError(AppServer, "UX InternalOk: could not find instance=%s", mCurrentInstance);
220220
return;
221221
}
222+
223+
bool isContentAppInstalled = mAppInstallationService->HasContentApp(client->GetVendorId(), client->GetProductId());
224+
225+
if (!isContentAppInstalled) {
226+
ChipLogDetail(AppServer, "UX InternalOk: app not installed.");
227+
228+
// TODO: send CDC message that user is prompted to install the app
229+
230+
// dialog
231+
ChipLogDetail(Controller,
232+
"------PROMPT USER: %s is requesting to install app on this TV. [" ChipLogFormatMEI "," ChipLogFormatMEI "]",
233+
client->GetDeviceName(), ChipLogValueMEI(client->GetVendorId()), ChipLogValueMEI(client->GetProductId()));
234+
235+
if (mUserPrompter != nullptr)
236+
{
237+
mUserPrompter->PromptForAppInstallOKPermission(client->GetVendorId(), client->GetProductId(), client->GetDeviceName());
238+
}
239+
ChipLogDetail(Controller, "------Via Shell Enter: app add <pid> <vid>");
240+
// TODO: force user to send again "cast request <id>" command?
241+
return;
242+
}
243+
222244
if (client->GetUDCClientProcessingState() != UDCClientProcessingState::kPromptingUser)
223245
{
224246
ChipLogError(AppServer, "UX InternalOk: invalid state for ok");
@@ -245,25 +267,6 @@ void CommissionerDiscoveryController::InternalOk()
245267

246268
uint8_t targetAppCount = client->GetNumTargetAppInfos();
247269

248-
bool isContentAppInstalled = mAppInstallationService->HasContentApp(client->GetVendorId(), client->GetProductId());
249-
250-
if (!isContentAppInstalled) {
251-
ChipLogDetail(AppServer, "UX InternalOk: app not installed.");
252-
253-
// dialog
254-
ChipLogDetail(Controller,
255-
"------PROMPT USER: %s is requesting to install app on this TV, accept? [" ChipLogFormatMEI "," ChipLogFormatMEI "]",
256-
client->GetDeviceName(), ChipLogValueMEI(client->GetVendorId()), ChipLogValueMEI(client->GetProductId()));
257-
258-
if (mUserPrompter != nullptr)
259-
{
260-
mUserPrompter->PromptForAppInstallOKPermission(client->GetVendorId(), client->GetProductId(), client->GetDeviceName());
261-
}
262-
ChipLogDetail(Controller, "------Via Shell Enter: controller ux accept|cancel");
263-
client->SetUDCClientProcessingState(UDCClientProcessingState::kPromptingUser);
264-
return;
265-
}
266-
267270
if (targetAppCount > 0)
268271
{
269272
ChipLogDetail(AppServer, "UX InternalOk: checking for each target app specified");

0 commit comments

Comments
 (0)