Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Unified Diff: sms_message.h

Issue 6612044: Added an SmsMessage class, and code for parsing a PDU to an SMS message. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cromo.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Makefile ('k') | sms_message.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sms_message.h
diff --git a/sms_message.h b/sms_message.h
new file mode 100644
index 0000000000000000000000000000000000000000..bcab9548b3a0d990d1be856c873673635e18aa54
--- /dev/null
+++ b/sms_message.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CROMO_SMS_MESSAGE_H_
+#define CROMO_SMS_MESSAGE_H_
+
+#include <base/basictypes.h>
+#include <string>
+
+// Simple class that represents SMS messages and their
+// metadata.
+class SmsMessage {
+ public:
+ // Create an SMS message from a PDU (Protocol Description Unit)
+ // as documented in 3GPP 23.040. Text of the message is represented
+ // in the GSM 7 alphabet as documented in 3GPP 23.038,
+ static SmsMessage* CreateMessage(const uint8_t* pdu, size_t pdu_len);
+
+ std::string& smsc_address() { return smsc_address_; }
+ std::string& sender_address() { return sender_address_; }
+ std::string& timestamp() { return timestamp_; }
+ // Return the body of the SMS message as a UTF-8 encoded string
+ std::string& text() { return text_; }
+
+ private:
+ SmsMessage() {} // disallow no-arg constructor invocation
+
+ SmsMessage(std::string& smsc_address,
+ std::string& sender_address,
+ std::string& timestamp,
+ std::string& text) :
+ smsc_address_(smsc_address),
+ sender_address_(sender_address),
+ timestamp_(timestamp),
+ text_(text) {}
+
+ std::string smsc_address_;
+ std::string sender_address_;
+ std::string timestamp_;
+ std::string text_;
+
+ DISALLOW_COPY_AND_ASSIGN(SmsMessage);
+};
+
+#endif // CROMO_SMS_MESSAGE_H_
« no previous file with comments | « Makefile ('k') | sms_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698