Apply Upstream code (2021-03-15)
[platform/upstream/connectedhomeip.git] / examples / shell / standalone / main.cpp
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *
5  *    Licensed under the Apache License, Version 2.0 (the "License");
6  *    you may not use this file except in compliance with the License.
7  *    You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *    Unless required by applicable law or agreed to in writing, software
12  *    distributed under the License is distributed on an "AS IS" BASIS,
13  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *    See the License for the specific language governing permissions and
15  *    limitations under the License.
16  */
17
18 #include <lib/shell/shell.h>
19
20 #include <lib/core/CHIPCore.h>
21 #include <lib/support/Base64.h>
22 #include <lib/support/CHIPArgParser.hpp>
23 #include <lib/support/CodeUtils.h>
24 #include <lib/support/RandUtils.h>
25 #include <support/logging/CHIPLogging.h>
26
27 #include <ChipShellCollection.h>
28
29 using namespace chip;
30 using namespace chip::Shell;
31
32 int main()
33 {
34     // Initialize the default streamer that was linked.
35     const int rc = streamer_init(streamer_get());
36
37     if (rc != 0)
38     {
39         ChipLogError(Shell, "Streamer initialization failed: %d", rc);
40         return rc;
41     }
42
43     cmd_misc_init();
44     cmd_base64_init();
45     cmd_device_init();
46     cmd_btp_init();
47     cmd_otcli_init();
48
49 #ifndef CHIP_DEVICE_CONFIG_DISABLE_SHELL_PING
50     cmd_ping_init();
51 #endif
52
53     shell_task(nullptr);
54     return 0;
55 }