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