1/*
2 * Copyright (c) 2022-2023 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
16#ifndef OHOS_ABILITY_RUNTIME_TEST_OBSERVER_PROXY_H
17#define OHOS_ABILITY_RUNTIME_TEST_OBSERVER_PROXY_H
18
19#include "iremote_proxy.h"
20#include "itest_observer.h"
21
22namespace OHOS {
23namespace AAFwk {
24class TestObserverProxy : public IRemoteProxy<ITestObserver> {
25public:
26    /**
27     * A constructor used to create a TestObserverProxy instance with the input parameter object passed.
28     * @param object Indicates remote object.
29     */
30    explicit TestObserverProxy(const sptr<IRemoteObject>& object);
31
32    /**
33     * Deconstructor used to deconstruct.
34     */
35    virtual ~TestObserverProxy() override;
36
37    /**
38     * Outputs test status.
39     *
40     * @param msg, Indicates the status information.
41     * @param resultCode, Indicates the result code.
42     */
43    virtual void TestStatus(const std::string& msg, const int64_t& resultCode) override;
44
45    /**
46     * Outputs information and result code that the test has finished.
47     *
48     * @param msg, Indicates the status information.
49     * @param resultCode, Indicates the result code.
50     */
51    virtual void TestFinished(const std::string& msg, const int64_t& resultCode) override;
52
53    /**
54     * Executes the specified shell command.
55     *
56     * @param cmd, Indicates the specified shell command.
57     * @param timeoutSec, Indicates the specified time out time, in seconds.
58     * @return the result of the specified shell command.
59     */
60    virtual ShellCommandResult ExecuteShellCommand(const std::string& cmd, const int64_t timeoutSec) override;
61
62private:
63    static inline BrokerDelegator<TestObserverProxy> delegator_;
64    int32_t SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
65};
66}  // namespace AAFwk
67}  // namespace OHOS
68
69#endif  // OHOS_ABILITY_RUNTIME_TEST_OBSERVER_PROXY_H
70