OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CROMO_SMS_MESSAGE_H_ |
| 6 #define CROMO_SMS_MESSAGE_H_ |
| 7 |
| 8 #include <base/basictypes.h> |
| 9 #include <string> |
| 10 |
| 11 // Simple class that represents SMS messages and their |
| 12 // metadata. |
| 13 class SmsMessage { |
| 14 public: |
| 15 // Create an SMS message from a PDU (Protocol Description Unit) |
| 16 // as documented in 3GPP 23.040. Text of the message is represented |
| 17 // in the GSM 7 alphabet as documented in 3GPP 23.038, |
| 18 static SmsMessage* CreateMessage(const uint8_t* pdu, size_t pdu_len); |
| 19 |
| 20 std::string& smsc_address() { return smsc_address_; } |
| 21 std::string& sender_address() { return sender_address_; } |
| 22 std::string& timestamp() { return timestamp_; } |
| 23 // Return the body of the SMS message as a UTF-8 encoded string |
| 24 std::string& text() { return text_; } |
| 25 |
| 26 private: |
| 27 SmsMessage() {} // disallow no-arg constructor invocation |
| 28 |
| 29 SmsMessage(std::string& smsc_address, |
| 30 std::string& sender_address, |
| 31 std::string& timestamp, |
| 32 std::string& text) : |
| 33 smsc_address_(smsc_address), |
| 34 sender_address_(sender_address), |
| 35 timestamp_(timestamp), |
| 36 text_(text) {} |
| 37 |
| 38 std::string smsc_address_; |
| 39 std::string sender_address_; |
| 40 std::string timestamp_; |
| 41 std::string text_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(SmsMessage); |
| 44 }; |
| 45 |
| 46 #endif // CROMO_SMS_MESSAGE_H_ |
OLD | NEW |