• 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_RECEIVE_INDEXER_H
17 #define SMS_RECEIVE_INDEXER_H
18 
19 #include <string>
20 #include <vector>
21 
22 namespace OHOS {
23 namespace Telephony {
24 class SmsReceiveIndexer {
25 public:
26     SmsReceiveIndexer();
27     virtual ~SmsReceiveIndexer() = default;
28     SmsReceiveIndexer(const std::vector<uint8_t> &pdu, long timestamp, int16_t destPort, bool isCdma,
29         const std::string &address, const std::string &displayAddress, int16_t msgRefId, uint16_t msgSeqId,
30         uint16_t msgCount, bool isCdmaWapPdu, const std::string &messageBody);
31     SmsReceiveIndexer(const std::vector<uint8_t> &pdu, long timestamp, int16_t destPort, bool isCdma,
32         bool isCdmaWapPdu, const std::string &address, const std::string &displayAddress,
33         const std::string &messageBody);
34     const std::vector<uint8_t>& GetPdu() const;
35     void SetPdu(const std::vector<uint8_t> &pdu);
36     long GetTimestamp() const;
37     void SetTimestamp(long timestamp);
38     int16_t GetDestPort() const;
39     void SetDestPort(int16_t destPort);
40     bool GetIsCdma() const;
41     void SetIsCdma(bool isCdma);
42     bool GetIsCdmaWapPdu() const;
43     void SetIsCdmaWapPdu(bool isCdmaWapPdu);
44     std::string GetVisibleMessageBody() const;
45     void SetVisibleMessageBody(const std::string &messageBody);
46     std::string GetOriginatingAddress() const;
47     void SetOriginatingAddress(const std::string &address);
48     uint16_t GetMsgRefId() const;
49     void SetMsgRefId(uint16_t msgRefId);
50     uint16_t GetMsgSeqId() const;
51     void SetMsgSeqId(uint16_t msgSeqId);
52     uint16_t GetMsgCount() const;
53     void SetMsgCount(uint16_t msgCount);
54     std::string GetEraseRefId() const;
55     void SetEraseRefId(const std::string &eraseRefId);
56     std::string GetVisibleAddress() const;
57     void SetVisibleAddress(const std::string &visibleAddress);
58     bool GetIsText() const;
59     bool GetIsWapPushMsg() const;
60     void SetPdu(const std::vector<uint8_t> &&pdu);
61     bool IsSingleMsg() const;
62     std::string GetRawUserData() const;
63     void SetRawUserData(const std::string &rawUserData);
64 
65 private:
66     static constexpr int8_t TEXT_PORT_NUM = -1;
67     static constexpr int16_t WAP_PUSH_PORT = 2948;
68     std::vector<uint8_t> pdu_;
69     long timestamp_;
70     int16_t destPort_;
71     bool isCdma_ = false;
72     bool isCdmaWapPdu_ = false;
73     std::string visibleMessageBody_;
74     std::string originatingAddress_;
75     int16_t msgRefId_;
76     uint16_t msgSeqId_;
77     uint16_t msgCount_;
78     std::string eraseRefId_;
79     std::string visibleAddress_;
80     std::string rawUserData_;
81 };
82 } // namespace Telephony
83 } // namespace OHOS
84 #endif