• 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_wap_push_buffer.h"
22 #include "sms_wap_push_content_type.h"
23 
24 namespace OHOS {
25 namespace Telephony {
26 class SmsWapPushHandler {
27 public:
28     explicit SmsWapPushHandler(int32_t slotId);
29     virtual ~SmsWapPushHandler();
30 
31     bool DecodeWapPushPduData(SmsWapPushBuffer &decodeBuffer, uint32_t startPos, uint32_t len);
32     bool DecodeWapPushPdu(std::string &wapPdu);
33     bool DecodePushType(SmsWapPushBuffer &decodeBuffer);
34     bool DeocdeCheckIsBlock(std::string &hexData);
35     bool DecodeXWapApplicationField(SmsWapPushBuffer &decodeBuffer, std::string &strWapAppId);
36     bool DecodeXWapApplication(SmsWapPushBuffer &decodeBuffer, uint32_t headersLen);
37     bool DecodeXWapApplicationValue(SmsWapPushBuffer &decodeBuffer, std::string &strWapAppId);
38     bool DecodeXWapAbandonHeaderValue(SmsWapPushBuffer &decodeBuffer);
39     bool SendWapPushMessageBroadcast();
40 
41 private:
42     int32_t slotId_ = 0;
43     uint8_t pushType_ = 0;
44     std::string strAppId_;
45     uint8_t transactionId_ = 0;
46     SmsWapPushContentType contentType_;
47     std::string hexHeaderData_;
48     std::string hexWbXmlData_;
49 
50     static constexpr uint8_t PDU_TYPE_PUSH = 0x06;
51     static constexpr uint8_t PDU_TYPE_CONFIRMED_PUSH = 0x07;
52     static constexpr uint32_t PARAMETER_X_WAP_APPLICATION_ID = 0x2F;
53     const std::string CONTENT_MIME_TYPE_B_PUSH_SI = "application/vnd.wap.sic";
54     const std::string CONTENT_MIME_TYPE_B_PUSH_SL = "application/vnd.wap.slc";
55     const std::string CONTENT_MIME_TYPE_B_PUSH_CO = "application/vnd.wap.coc";
56     const std::string CONTENT_MIME_TYPE_B_MMS = "application/vnd.wap.mms-message";
57 };
58 } // namespace Telephony
59 } // namespace OHOS
60 #endif
61