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 CDMA_SMS_TELESERVICE_MESSAGE_H 17 #define CDMA_SMS_TELESERVICE_MESSAGE_H 18 19 #include <vector> 20 21 #include "cdma_sms_common.h" 22 #include "cdma_sms_sub_parameter.h" 23 #include "sms_pdu_buffer.h" 24 25 namespace OHOS { 26 namespace Telephony { 27 28 class CdmaSmsTeleserviceMessage { 29 public: 30 virtual ~CdmaSmsTeleserviceMessage(); 31 virtual bool Encode(SmsWriteBuffer &pdu); 32 virtual bool Decode(SmsReadBuffer &pdu); 33 static uint8_t GetMessageType(SmsReadBuffer &pdu); 34 35 public: 36 enum MessageType : uint8_t { 37 RESERVED = 0x00, 38 DELIVER, 39 SUBMIT, 40 CANCELLATION, 41 DELIVERY_ACK, 42 USER_ACK, 43 READ_ACK, 44 DELIVER_REPORT, 45 SUBMIT_REPORT, 46 }; 47 48 protected: 49 uint8_t type_ { RESERVED }; 50 std::vector<std::unique_ptr<CdmaSmsSubParameter>> parameter_; 51 }; 52 53 class CdmaSmsSubmitMessage : public CdmaSmsTeleserviceMessage { 54 public: 55 explicit CdmaSmsSubmitMessage(TeleserviceSubmit &msg); 56 CdmaSmsSubmitMessage(TeleserviceSubmit &msg, SmsReadBuffer &pdu); 57 }; 58 59 class CdmaSmsCancelMessage : public CdmaSmsTeleserviceMessage { 60 public: 61 explicit CdmaSmsCancelMessage(TeleserviceCancel &msg); 62 }; 63 64 class CdmaSmsDeliverReport : public CdmaSmsTeleserviceMessage { 65 public: 66 explicit CdmaSmsDeliverReport(TeleserviceDeliverReport &msg); 67 }; 68 69 class CdmaSmsDeliverMessage : public CdmaSmsTeleserviceMessage { 70 public: 71 CdmaSmsDeliverMessage(TeleserviceDeliver &msg, SmsReadBuffer &pdu, bool isCMAS = false); 72 private: 73 void PushParameter(uint8_t id, TeleserviceDeliver &msg); 74 }; 75 76 class CdmaSmsDeliveryAck : public CdmaSmsTeleserviceMessage { 77 public: 78 CdmaSmsDeliveryAck(TeleserviceDeliverAck &msg, SmsReadBuffer &pdu); 79 }; 80 81 class CdmaSmsUserAck : public CdmaSmsTeleserviceMessage { 82 public: 83 CdmaSmsUserAck(TeleserviceUserAck &msg, SmsReadBuffer &pdu); 84 }; 85 86 class CdmaSmsReadAck : public CdmaSmsTeleserviceMessage { 87 public: 88 CdmaSmsReadAck(TeleserviceReadAck &msg, SmsReadBuffer &pdu); 89 }; 90 91 } // namespace Telephony 92 } // namespace OHOS 93 #endif 94