1 /*
2  * Copyright (C) 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 #ifndef NAPI_MMS_PDU_HELPER_H
16 #define NAPI_MMS_PDU_HELPER_H
17 
18 #include <condition_variable>
19 #include <mutex>
20 
21 #include "datashare_helper.h"
22 #include "datashare_predicates.h"
23 
24 namespace OHOS {
25 namespace Telephony {
26 class NapiMmsPduHelper {
27 public:
28     bool Run(void (*func)(NapiMmsPduHelper &), NapiMmsPduHelper &helper);
29     void NotifyAll();
30     bool WaitForResult(int32_t timeoutSecond);
31     void SetPduFileName(const std::string &pduFileName);
32     void SetStoreFileName(const std::string &storeFileName);
33     void SetDbUrl(const std::string &dbUrl);
34     void SetDataShareHelper(std::shared_ptr<DataShare::DataShareHelper> &datashareHelper);
35 
36     std::string GetPduFileName();
37     std::string GetStoreFileName();
38     std::string GetDbUrl();
39     std::shared_ptr<DataShare::DataShareHelper> GetDataShareHelper();
40 
41 private:
42     std::string pduFileName_;
43     std::mutex mtx_;
44     std::condition_variable cv_;
45     std::shared_ptr<DataShare::DataShareHelper> datashareHelper_;
46     std::string dbUrl_;
47     std::string storeFileName_;
48 };
49 } // namespace Telephony
50 } // namespace OHOS
51 
52 #endif // NAPI_MMS_PDU_HELPER_H
53