blob: d799b4da3b53e6fc51000fcd2a30cb11a1294d1b [file] [log] [blame]
Douglas Rocha Ferraz172c0242022-04-06 14:02:03 -04001/*
2 *
3 * Copyright (c) 2020 Project CHIP Authors
MtTsai1eb09212022-05-30 22:21:57 +08004 * All rights reserved.
Douglas Rocha Ferraz172c0242022-04-06 14:02:03 -04005 *
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
MtTsai1eb09212022-05-30 22:21:57 +080019#include <AppMain.h>
Douglas Rocha Ferraz172c0242022-04-06 14:02:03 -040020
Erwin Pan6e9b15c2023-07-28 09:55:00 +080021#include <ChipShellCollection.h>
MtTsai1eb09212022-05-30 22:21:57 +080022#include <app-common/zap-generated/ids/Attributes.h>
23#include <app/ConcreteAttributePath.h>
MtTsai1eb09212022-05-30 22:21:57 +080024#include <lib/shell/Engine.h>
Erwin Pan6e9b15c2023-07-28 09:55:00 +080025#include <lib/support/logging/CHIPLogging.h>
Douglas Rocha Ferraz172c0242022-04-06 14:02:03 -040026
27using namespace chip;
28using namespace chip::Shell;
Douglas Rocha Ferraz20d21e72023-03-03 01:19:26 -030029using namespace chip::app;
Erwin Pan6e9b15c2023-07-28 09:55:00 +080030using namespace chip::app::Clusters;
Douglas Rocha Ferraz172c0242022-04-06 14:02:03 -040031
Boris Zbarsky6b01cb92023-07-12 15:29:54 -040032void ApplicationInit() {}
MtTsai1eb09212022-05-30 22:21:57 +080033
William7b6cbc52023-07-25 11:07:22 +010034void ApplicationShutdown() {}
35
MtTsai1eb09212022-05-30 22:21:57 +080036int main(int argc, char * argv[])
Douglas Rocha Ferraz172c0242022-04-06 14:02:03 -040037{
MtTsai1eb09212022-05-30 22:21:57 +080038 if (ChipLinuxAppInit(argc, argv) != 0)
39 {
40 return -1;
41 }
Douglas Rocha Ferraz172c0242022-04-06 14:02:03 -040042
43 const int rc = Engine::Root().Init();
Douglas Rocha Ferraz172c0242022-04-06 14:02:03 -040044 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 Ferraz172c0242022-04-06 14:02:03 -040052#if CHIP_SHELL_ENABLE_CMD_SERVER
53 cmd_app_server_init();
54#endif
55
MtTsai1eb09212022-05-30 22:21:57 +080056 ChipLinuxAppMainLoop();
57
Douglas Rocha Ferraz172c0242022-04-06 14:02:03 -040058 return 0;
59}