blob: c2055e0abd03f30a4651ebe15fb24df550cae621 [file] [log] [blame]
Lazar Kovacice1d46642021-02-17 20:23:08 +01001/*
2 *
3 * Copyright (c) 2020 Project CHIP Authors
4 * All rights reserved.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
Song Guo787c2da2021-04-23 21:23:48 +080019#include "AppMain.h"
Artur Tyneckie39e16f2023-06-23 16:44:41 +020020#include "AppTv.h"
Lazar Kovacice1d46642021-02-17 20:23:08 +010021
chrisdecenzo6e47fae2022-03-01 18:03:25 -080022#include <access/AccessControl.h>
Vivien Nicolas02cbf692021-10-11 20:46:29 +020023#include <app-common/zap-generated/ids/Attributes.h>
24#include <app-common/zap-generated/ids/Clusters.h>
yunhanw-google45847072021-12-08 14:14:10 -080025#include <app/CommandHandler.h>
chrisdecenzo0c94a802022-01-27 09:05:43 -080026#include <app/app-platform/ContentAppPlatform.h>
Andrei Litvin660c9282024-04-04 18:34:51 -040027#include <app/util/endpoint-config-api.h>
Vivien Nicolas02cbf692021-10-11 20:46:29 +020028
chrisdecenzo2b0679a2021-12-02 17:47:43 -080029#if defined(ENABLE_CHIP_SHELL)
Artur Tyneckie39e16f2023-06-23 16:44:41 +020030#include "AppTvShellCommands.h"
chrisdecenzo2b0679a2021-12-02 17:47:43 -080031#endif
32
Lazar Kovacice1d46642021-02-17 20:23:08 +010033using namespace chip;
Lazar Kovacice1d46642021-02-17 20:23:08 +010034using namespace chip::Transport;
35using namespace chip::DeviceLayer;
chrisdecenzo2b0679a2021-12-02 17:47:43 -080036using namespace chip::AppPlatform;
chrisdecenzo0c94a802022-01-27 09:05:43 -080037using namespace chip::app::Clusters;
Lazar Kovacice1d46642021-02-17 20:23:08 +010038
chrisdecenzo8ee4bee2022-07-28 13:01:59 -070039void ApplicationInit()
40{
41 ChipLogProgress(Zcl, "TV Linux App: ApplicationInit()");
42
43 // Disable last fixed endpoint, which is used as a placeholder for all of the
44 // supported clusters so that ZAP will generated the requisite code.
45 ChipLogDetail(DeviceLayer, "TV Linux App: Warning - Fixed Content App Endpoint Not Disabled");
46 // Can't disable this without breaking CI unit tests that act upon account login cluster (only available on ep3)
47 // emberAfEndpointEnableDisable(3, false);
Lazar Kovacice3cab4d2024-07-11 10:38:50 +020048
49#if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
50 // Install Content Apps
51 ContentAppFactoryImpl * factory = GetContentAppFactoryImpl();
52
53 // Content App 1
54 constexpr uint16_t kApp1VendorId = 65521;
55 constexpr uint16_t kApp1ProductId = 32769;
56 factory->InstallContentApp(kApp1VendorId, kApp1ProductId);
57
58 // Content App 2
59 constexpr uint16_t kApp2VendorId = 1;
60 constexpr uint16_t kApp2ProductId = 11;
61 factory->InstallContentApp(kApp2VendorId, kApp2ProductId);
62
63 // Content App 3
64 constexpr uint16_t kApp3VendorId = 9050;
65 constexpr uint16_t kApp3ProductId = 22;
66 factory->InstallContentApp(kApp3VendorId, kApp3ProductId);
67
68 // Content App 4
69 constexpr uint16_t kApp4VendorId = 1111;
70 constexpr uint16_t kApp4ProductId = 22;
71 factory->InstallContentApp(kApp4VendorId, kApp4ProductId);
72#endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
chrisdecenzo8ee4bee2022-07-28 13:01:59 -070073}
Song GUO1d06bb22021-12-21 08:59:48 +080074
William7b6cbc52023-07-25 11:07:22 +010075void ApplicationShutdown() {}
76
Lazar Kovacice1d46642021-02-17 20:23:08 +010077int main(int argc, char * argv[])
78{
Lazar Kovacic6adb8652021-04-28 19:33:53 +020079
Song Guo787c2da2021-04-23 21:23:48 +080080 VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0);
chrisdecenzo2b0679a2021-12-02 17:47:43 -080081
Artur Tyneckie39e16f2023-06-23 16:44:41 +020082 AppTvInit();
chrisdecenzo2b0679a2021-12-02 17:47:43 -080083
84#if defined(ENABLE_CHIP_SHELL)
85#if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
Artur Tyneckie39e16f2023-06-23 16:44:41 +020086 Shell::RegisterAppTvCommands();
chrisdecenzo2b0679a2021-12-02 17:47:43 -080087#endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
88#endif
89
Song Guo787c2da2021-04-23 21:23:48 +080090 ChipLinuxAppMainLoop();
Lazar Kovacicb0af6ba2022-01-04 02:17:19 +010091
Lazar Kovacice1d46642021-02-17 20:23:08 +010092 return 0;
93}