Lazar Kovacic | e1d4664 | 2021-02-17 20:23:08 +0100 | [diff] [blame] | 1 | /* |
| 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 Guo | 787c2da | 2021-04-23 21:23:48 +0800 | [diff] [blame] | 19 | #include "AppMain.h" |
Artur Tynecki | e39e16f | 2023-06-23 16:44:41 +0200 | [diff] [blame] | 20 | #include "AppTv.h" |
Lazar Kovacic | e1d4664 | 2021-02-17 20:23:08 +0100 | [diff] [blame] | 21 | |
chrisdecenzo | 6e47fae | 2022-03-01 18:03:25 -0800 | [diff] [blame] | 22 | #include <access/AccessControl.h> |
Vivien Nicolas | 02cbf69 | 2021-10-11 20:46:29 +0200 | [diff] [blame] | 23 | #include <app-common/zap-generated/ids/Attributes.h> |
| 24 | #include <app-common/zap-generated/ids/Clusters.h> |
yunhanw-google | 4584707 | 2021-12-08 14:14:10 -0800 | [diff] [blame] | 25 | #include <app/CommandHandler.h> |
chrisdecenzo | 0c94a80 | 2022-01-27 09:05:43 -0800 | [diff] [blame] | 26 | #include <app/app-platform/ContentAppPlatform.h> |
Andrei Litvin | 660c928 | 2024-04-04 18:34:51 -0400 | [diff] [blame] | 27 | #include <app/util/endpoint-config-api.h> |
Vivien Nicolas | 02cbf69 | 2021-10-11 20:46:29 +0200 | [diff] [blame] | 28 | |
chrisdecenzo | 2b0679a | 2021-12-02 17:47:43 -0800 | [diff] [blame] | 29 | #if defined(ENABLE_CHIP_SHELL) |
Artur Tynecki | e39e16f | 2023-06-23 16:44:41 +0200 | [diff] [blame] | 30 | #include "AppTvShellCommands.h" |
chrisdecenzo | 2b0679a | 2021-12-02 17:47:43 -0800 | [diff] [blame] | 31 | #endif |
| 32 | |
Lazar Kovacic | e1d4664 | 2021-02-17 20:23:08 +0100 | [diff] [blame] | 33 | using namespace chip; |
Lazar Kovacic | e1d4664 | 2021-02-17 20:23:08 +0100 | [diff] [blame] | 34 | using namespace chip::Transport; |
| 35 | using namespace chip::DeviceLayer; |
chrisdecenzo | 2b0679a | 2021-12-02 17:47:43 -0800 | [diff] [blame] | 36 | using namespace chip::AppPlatform; |
chrisdecenzo | 0c94a80 | 2022-01-27 09:05:43 -0800 | [diff] [blame] | 37 | using namespace chip::app::Clusters; |
Lazar Kovacic | e1d4664 | 2021-02-17 20:23:08 +0100 | [diff] [blame] | 38 | |
chrisdecenzo | 8ee4bee | 2022-07-28 13:01:59 -0700 | [diff] [blame] | 39 | void 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 Kovacic | e3cab4d | 2024-07-11 10:38:50 +0200 | [diff] [blame] | 48 | |
| 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 |
chrisdecenzo | 8ee4bee | 2022-07-28 13:01:59 -0700 | [diff] [blame] | 73 | } |
Song GUO | 1d06bb2 | 2021-12-21 08:59:48 +0800 | [diff] [blame] | 74 | |
William | 7b6cbc5 | 2023-07-25 11:07:22 +0100 | [diff] [blame] | 75 | void ApplicationShutdown() {} |
| 76 | |
Lazar Kovacic | e1d4664 | 2021-02-17 20:23:08 +0100 | [diff] [blame] | 77 | int main(int argc, char * argv[]) |
| 78 | { |
Lazar Kovacic | 6adb865 | 2021-04-28 19:33:53 +0200 | [diff] [blame] | 79 | |
Song Guo | 787c2da | 2021-04-23 21:23:48 +0800 | [diff] [blame] | 80 | VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); |
chrisdecenzo | 2b0679a | 2021-12-02 17:47:43 -0800 | [diff] [blame] | 81 | |
Artur Tynecki | e39e16f | 2023-06-23 16:44:41 +0200 | [diff] [blame] | 82 | AppTvInit(); |
chrisdecenzo | 2b0679a | 2021-12-02 17:47:43 -0800 | [diff] [blame] | 83 | |
| 84 | #if defined(ENABLE_CHIP_SHELL) |
| 85 | #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED |
Artur Tynecki | e39e16f | 2023-06-23 16:44:41 +0200 | [diff] [blame] | 86 | Shell::RegisterAppTvCommands(); |
chrisdecenzo | 2b0679a | 2021-12-02 17:47:43 -0800 | [diff] [blame] | 87 | #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED |
| 88 | #endif |
| 89 | |
Song Guo | 787c2da | 2021-04-23 21:23:48 +0800 | [diff] [blame] | 90 | ChipLinuxAppMainLoop(); |
Lazar Kovacic | b0af6ba | 2022-01-04 02:17:19 +0100 | [diff] [blame] | 91 | |
Lazar Kovacic | e1d4664 | 2021-02-17 20:23:08 +0100 | [diff] [blame] | 92 | return 0; |
| 93 | } |