• 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_receive_indexer.h"
22 #include "sms_wap_push_buffer.h"
23 #include "sms_wap_push_content_type.h"
24 
25 namespace OHOS {
26 namespace Telephony {
27 class SmsWapPushHandler {
28 public:
29     explicit SmsWapPushHandler(int32_t slotId);
30     virtual ~SmsWapPushHandler();
31 
32     bool DecodeWapPushPduData(SmsWapPushBuffer &decodeBuffer, uint32_t startPos, uint32_t len);
33     bool DecodeWapPushPdu(std::shared_ptr<SmsReceiveIndexer> indexer, std::string &wapPdu);
34     bool DecodePushType(SmsWapPushBuffer &decodeBuffer);
35     bool DeocdeCheckIsBlock(std::string &hexData);
36     bool DecodeXWapApplicationField(SmsWapPushBuffer &decodeBuffer, std::string &strWapAppId);
37     bool DecodeXWapApplication(SmsWapPushBuffer &decodeBuffer, uint32_t headersLen);
38     bool DecodeXWapApplicationValue(SmsWapPushBuffer &decodeBuffer, std::string &strWapAppId);
39     bool DecodeXWapAbandonHeaderValue(SmsWapPushBuffer &decodeBuffer);
40     bool SendWapPushMessageBroadcast(std::shared_ptr<SmsReceiveIndexer> indexer);
41 
42 private:
43     void HiSysEventWapPushResult(bool publishResult);
44 
45 private:
46     int32_t slotId_ = 0;
47     uint8_t pushType_ = 0;
48     std::string strAppId_;
49     uint8_t transactionId_ = 0;
50     SmsWapPushContentType contentType_;
51     std::string hexHeaderData_;
52     std::string hexWbXmlData_;
53 };
54 } // namespace Telephony
55 } // namespace OHOS
56 #endif
57