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 #include "mms_receive.h"
17
18 #include "data_request.h"
19 #include "telephony_log_wrapper.h"
20
21 namespace OHOS {
22 namespace Telephony {
23 std::string DOWNLOAD_METHOD = "GET";
24
MmsReceive(int32_t slotId)25 MmsReceive::MmsReceive(int32_t slotId) : DataRequest(slotId)
26 {
27 slotId_ = slotId;
28 CreateRequestId();
29 }
30
~MmsReceive()31 MmsReceive::~MmsReceive() {}
32
ExecuteDownloadMms(const std::string & contentUrl,const std::string & pduDir,const std::string & ua,const std::string & uaprof)33 int32_t MmsReceive::ExecuteDownloadMms(
34 const std::string &contentUrl, const std::string &pduDir, const std::string &ua, const std::string &uaprof)
35 {
36 auto mmsNetworkMgr = std::make_shared<MmsNetworkManager>();
37 if (mmsNetworkMgr == nullptr) {
38 TELEPHONY_LOGE("mmsNetworkMgr_ is nullptr");
39 return TELEPHONY_ERR_LOCAL_PTR_NULL;
40 }
41
42 std::unique_lock<std::mutex> lock(downloadMmsMutex_);
43 return ExecuteMms(DOWNLOAD_METHOD, mmsNetworkMgr, contentUrl, pduDir);
44 }
45 } // namespace Telephony
46 } // namespace OHOS