• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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_WAP_PUSH_HANDLER_H
17 #define SMS_WAP_PUSH_HANDLER_H
18 
19 #include <memory>
20 
21 #include "sms_broadcast_subscriber_receiver.h"
22 #include "sms_receive_indexer.h"
23 #include "sms_wap_push_buffer.h"
24 #include "sms_wap_push_content_type.h"
25 
26 namespace OHOS {
27 namespace Telephony {
28 class SmsWapPushHandler {
29 public:
30     explicit SmsWapPushHandler(int32_t slotId);
31     virtual ~SmsWapPushHandler();
32 
33     bool DecodeWapPushPduData(SmsWapPushBuffer &decodeBuffer, uint32_t startPos, uint32_t len);
34     bool DecodeWapPushPdu(std::shared_ptr<SmsReceiveIndexer> indexer, std::string &wapPdu);
35     bool DecodePushType(SmsWapPushBuffer &decodeBuffer);
36     bool DeocdeCheckIsBlock(std::string &hexData);
37     bool DecodeXWapApplicationField(SmsWapPushBuffer &decodeBuffer, std::string &strWapAppId);
38     bool DecodeXWapApplication(SmsWapPushBuffer &decodeBuffer, uint32_t headersLen);
39     bool DecodeXWapApplicationValue(SmsWapPushBuffer &decodeBuffer, std::string &strWapAppId);
40     bool DecodeXWapAbandonHeaderValue(SmsWapPushBuffer &decodeBuffer);
41     bool SendWapPushMessageBroadcast(std::shared_ptr<SmsReceiveIndexer> indexer);
42 
43 private:
44     void HiSysEventWapPushResult(bool publishResult);
45     void DeleteWapPush(std::shared_ptr<SmsReceiveIndexer> indexer);
46 
47 private:
48     static std::shared_ptr<SmsBroadcastSubscriberReceiver> g_receiver;
49     int32_t slotId_ = 0;
50     uint8_t pushType_ = 0;
51     std::string strAppId_;
52     uint8_t transactionId_ = 0;
53     SmsWapPushContentType contentType_;
54     std::string hexHeaderData_;
55     std::string hexWbXmlData_;
56 };
57 } // namespace Telephony
58 } // namespace OHOS
59 #endif
60