1 /*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 #include "svc_control_test.h"
16
17 #include <string>
18
19 #include "ipc_skeleton.h"
20
21 namespace OHOS {
SvcControlTest()22 SvcControlTest::SvcControlTest()
23 {
24 }
25
~SvcControlTest()26 SvcControlTest::~SvcControlTest()
27 {
28 }
29
ParseCmd(char * argv[],int32_t cnt,bool & isEnd)30 SvcCmd SvcControlTest::ParseCmd(char *argv[], int32_t cnt, bool &isEnd)
31 {
32 struct {
33 std::string op;
34 SvcCmd cmd;
35 bool isEnd;
36 } options[] = {
37 { "test", static_cast<SvcCmd>(TEST_CMD), false },
38 { "help", SvcCmd::HELP_CMD, true },
39 };
40 SvcCmd cmd = SvcCmd::ARGS_INVALID;
41 for (auto &op: options) {
42 if (op.op == argv[cnt]) {
43 cmd = op.cmd;
44 isEnd = op.isEnd;
45 break;
46 }
47 }
48 return cmd;
49 }
50 }
51
main(int argc,char * argv[])52 int main(int argc, char *argv[])
53 {
54 OHOS::SvcControlTest svc;
55 return svc.Main(argc, argv, STDOUT_FILENO);
56 }
57