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 SMS_RECEIVE_RELIABILITY_HANDLER_H 17 #define SMS_RECEIVE_RELIABILITY_HANDLER_H 18 19 #include "common_event_manager.h" 20 #include "sms_wap_push_handler.h" 21 #include "want.h" 22 23 namespace OHOS { 24 namespace Telephony { 25 class SmsReceiveReliabilityHandler : public std::enable_shared_from_this<SmsReceiveReliabilityHandler> { 26 public: 27 explicit SmsReceiveReliabilityHandler(int32_t slotId); 28 virtual ~SmsReceiveReliabilityHandler(); 29 void SmsReceiveReliabilityProcessing(); 30 std::string GetSmsExpire(); 31 bool DeleteExpireSmsFromDB(); 32 bool CheckSmsCapable(); 33 void DeleteMessageFormDb(const uint16_t refId, const uint16_t dataBaseId = 0); 34 bool CheckBlockedPhoneNumber(std::string originatingAddress); 35 void SendBroadcast( 36 const std::shared_ptr<SmsReceiveIndexer> indexer, const std::shared_ptr<std::vector<std::string>> pdus); 37 38 private: 39 void RemoveBlockedSms(std::vector<SmsReceiveIndexer> &dbIndexers); 40 void CheckUnReceiveWapPush(std::vector<SmsReceiveIndexer> &dbIndexers); 41 void HiSysEventCBResult(bool publishResult); 42 void GetWapPushUserDataSinglePage( 43 SmsReceiveIndexer &indexer, std::shared_ptr<std::vector<std::string>> userDataRaws); 44 void GetWapPushUserDataMultipage(int32_t &smsPagesCount, std::vector<SmsReceiveIndexer> &dbIndexers, int32_t place, 45 std::shared_ptr<std::vector<std::string>> userDataRaws); 46 void ReadyDecodeWapPushUserData(SmsReceiveIndexer &indexer, std::shared_ptr<std::vector<std::string>> userDataRaws); 47 void GetSmsUserDataMultipage(int32_t &smsPagesCount, std::vector<SmsReceiveIndexer> &dbIndexers, int32_t position, 48 std::shared_ptr<std::vector<std::string>> pdus); 49 void ReadySendSmsBroadcast(SmsReceiveIndexer &indexerObj, std::shared_ptr<std::vector<std::string>> pdus); 50 void PacketSmsData(EventFwk::Want &want, const std::shared_ptr<SmsReceiveIndexer> indexer, 51 EventFwk::CommonEventData &data, EventFwk::CommonEventPublishInfo &publishInfo); 52 void DeleteAutoSmsFromDB( 53 std::shared_ptr<SmsReceiveReliabilityHandler> handler, uint16_t refId, uint16_t dataBaseId); 54 55 private: 56 std::unique_ptr<SmsWapPushHandler> smsWapPushHandler_; 57 int32_t slotId_ = -1; 58 }; 59 } // namespace Telephony 60 } // namespace OHOS 61 #endif