3 * Copyright (c) 2020 Project CHIP Authors
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <lib/shell/shell.h>
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>
32 #include <ChipShellCollection.h>
35 using namespace chip::Shell;
36 using namespace chip::Logging;
38 int cmd_echo(int argc, char ** argv)
40 for (int i = 0; i < argc; i++)
42 streamer_printf(streamer_get(), "%s ", argv[i]);
44 streamer_printf(streamer_get(), "\n\r");
48 int cmd_log(int argc, char ** argv)
50 for (int i = 0; i < argc; i++)
52 ChipLogProgress(chipTool, "%s", argv[i]);
57 int cmd_rand(int argc, char ** argv)
59 streamer_printf(streamer_get(), "%d\n\r", GetRandU8());
63 static shell_command_t cmds_misc[] = {
64 { &cmd_echo, "echo", "Echo back provided inputs" },
65 { &cmd_log, "log", "Logging utilities" },
66 { &cmd_rand, "rand", "Random number utilities" },
71 shell_register(cmds_misc, ArraySize(cmds_misc));