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 
16 #ifndef NAPI_SEND_RECV_H
17 #define NAPI_SEND_RECV_H
18 #include <codecvt>
19 #include <locale>
20 
21 #include "base_context.h"
22 #include "mms_codec_type.h"
23 #include "mms_msg.h"
24 #include "napi/native_api.h"
25 #include "napi/native_node_api.h"
26 #include "napi_sms.h"
27 
28 namespace OHOS {
29 namespace Telephony {
30 struct MmsConfigPara {
31     std::u16string userAgent = u"";
32     std::u16string userAgentProfile = u"";
33 };
34 
35 struct MmsContext : BaseContext {
36     int32_t slotId = DEFAULT_SIM_SLOT_ID;
37     std::u16string mmsc = u"";
38     std::u16string data = u"";
39     MmsConfigPara mmsConfig;
40 };
41 
42 class NapiSendRecvMms {
43 public:
44     NapiSendRecvMms();
45     ~NapiSendRecvMms() = default;
46     static napi_value SendMms(napi_env env, napi_callback_info info);
47     static napi_value DownloadMms(napi_env env, napi_callback_info info);
48 
49 public:
50     static std::mutex downloadCtx_;
51     static std::mutex countCtx_;
52     static std::int32_t reqCount_;
53     static bool waitFlag;
54 };
55 } // namespace Telephony
56 } // namespace OHOS
57 #endif // NAPI_SEND_RECV_H