Douglas Rocha Ferraz | 172c024 | 2022-04-06 14:02:03 -0400 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (c) 2020 Project CHIP Authors |
MtTsai | 1eb0921 | 2022-05-30 22:21:57 +0800 | [diff] [blame] | 4 | * All rights reserved. |
Douglas Rocha Ferraz | 172c024 | 2022-04-06 14:02:03 -0400 | [diff] [blame] | 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 | |
MtTsai | 1eb0921 | 2022-05-30 22:21:57 +0800 | [diff] [blame] | 19 | #include <AppMain.h> |
Douglas Rocha Ferraz | 172c024 | 2022-04-06 14:02:03 -0400 | [diff] [blame] | 20 | |
Erwin Pan | 6e9b15c | 2023-07-28 09:55:00 +0800 | [diff] [blame] | 21 | #include <ChipShellCollection.h> |
MtTsai | 1eb0921 | 2022-05-30 22:21:57 +0800 | [diff] [blame] | 22 | #include <app-common/zap-generated/ids/Attributes.h> |
| 23 | #include <app/ConcreteAttributePath.h> |
MtTsai | 1eb0921 | 2022-05-30 22:21:57 +0800 | [diff] [blame] | 24 | #include <lib/shell/Engine.h> |
Erwin Pan | 6e9b15c | 2023-07-28 09:55:00 +0800 | [diff] [blame] | 25 | #include <lib/support/logging/CHIPLogging.h> |
Douglas Rocha Ferraz | 172c024 | 2022-04-06 14:02:03 -0400 | [diff] [blame] | 26 | |
| 27 | using namespace chip; |
| 28 | using namespace chip::Shell; |
Douglas Rocha Ferraz | 20d21e7 | 2023-03-03 01:19:26 -0300 | [diff] [blame] | 29 | using namespace chip::app; |
Erwin Pan | 6e9b15c | 2023-07-28 09:55:00 +0800 | [diff] [blame] | 30 | using namespace chip::app::Clusters; |
Douglas Rocha Ferraz | 172c024 | 2022-04-06 14:02:03 -0400 | [diff] [blame] | 31 | |
Boris Zbarsky | 6b01cb9 | 2023-07-12 15:29:54 -0400 | [diff] [blame] | 32 | void ApplicationInit() {} |
MtTsai | 1eb0921 | 2022-05-30 22:21:57 +0800 | [diff] [blame] | 33 | |
William | 7b6cbc5 | 2023-07-25 11:07:22 +0100 | [diff] [blame] | 34 | void ApplicationShutdown() {} |
| 35 | |
MtTsai | 1eb0921 | 2022-05-30 22:21:57 +0800 | [diff] [blame] | 36 | int main(int argc, char * argv[]) |
Douglas Rocha Ferraz | 172c024 | 2022-04-06 14:02:03 -0400 | [diff] [blame] | 37 | { |
MtTsai | 1eb0921 | 2022-05-30 22:21:57 +0800 | [diff] [blame] | 38 | if (ChipLinuxAppInit(argc, argv) != 0) |
| 39 | { |
| 40 | return -1; |
| 41 | } |
Douglas Rocha Ferraz | 172c024 | 2022-04-06 14:02:03 -0400 | [diff] [blame] | 42 | |
| 43 | const int rc = Engine::Root().Init(); |
Douglas Rocha Ferraz | 172c024 | 2022-04-06 14:02:03 -0400 | [diff] [blame] | 44 | if (rc != 0) |
| 45 | { |
| 46 | ChipLogError(Shell, "Streamer initialization failed: %d", rc); |
| 47 | return rc; |
| 48 | } |
| 49 | |
| 50 | cmd_misc_init(); |
| 51 | cmd_otcli_init(); |
Douglas Rocha Ferraz | 172c024 | 2022-04-06 14:02:03 -0400 | [diff] [blame] | 52 | #if CHIP_SHELL_ENABLE_CMD_SERVER |
| 53 | cmd_app_server_init(); |
| 54 | #endif |
| 55 | |
MtTsai | 1eb0921 | 2022-05-30 22:21:57 +0800 | [diff] [blame] | 56 | ChipLinuxAppMainLoop(); |
| 57 | |
Douglas Rocha Ferraz | 172c024 | 2022-04-06 14:02:03 -0400 | [diff] [blame] | 58 | return 0; |
| 59 | } |