1/*
2 * Copyright (C) 2022 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#ifndef SMS_MMS_TEST_HELPER_H
16#define SMS_MMS_TEST_HELPER_H
17
18#include <mutex>
19
20namespace OHOS {
21namespace Telephony {
22class SmsMmsTestHelper {
23public:
24    int32_t slotId = 0;
25    bool Run(void (*func)(SmsMmsTestHelper &), SmsMmsTestHelper &helper, int32_t waitTime = WAIT_TIME_SECOND);
26    void NotifyAll();
27    bool WaitForResult(int32_t timeoutSecond);
28    void SetBoolResult(bool result);
29    void SetSendSmsIntResult(int32_t result);
30    void SetDeliverySmsIntResult(int32_t result);
31    void SetIntResult(int32_t result);
32    void SetStringResult(const std::string &str);
33    bool GetBoolResult();
34    int32_t GetSendSmsIntResult();
35    int32_t GetDeliverySmsIntResult();
36    int32_t GetIntResult();
37    std::string GetStringResult();
38
39private:
40    int32_t result_ = 0;
41    bool boolResult_ = false;
42    int32_t sendSmsResult_ = 0;
43    int32_t deliverySmsResult_ = 0;
44    std::string strResult_ = "";
45    std::mutex mtx_;
46    std::condition_variable cv_;
47    constexpr static const int32_t WAIT_TIME_SECOND = 10;
48};
49} // namespace Telephony
50} // namespace OHOS
51
52#endif // SMS_MMS_TEST_HELPER_H
53