From: Philippe Nunes <philippe.nunes@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 2/6] qcbsmessage: Add bestScheme method in QCBSMessage class
Date: Wed, 27 Jun 2012 17:10:41 +0200 [thread overview]
Message-ID: <1340809845-26595-3-git-send-email-philippe.nunes@linux.intel.com> (raw)
In-Reply-To: <1340809845-26595-1-git-send-email-philippe.nunes@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1507 bytes --]
---
src/qcbsmessage.cpp | 10 ++++++++--
src/qcbsmessage.h | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/qcbsmessage.cpp b/src/qcbsmessage.cpp
index 0556cc0..e4403ae 100644
--- a/src/qcbsmessage.cpp
+++ b/src/qcbsmessage.cpp
@@ -396,9 +396,15 @@ void QCBSMessage::print()
<< ", text=" << text();
}
-static QSMSDataCodingScheme bestScheme( const QString& body )
+/*!
+ Returns the best CBS data coding scheme to use for this
+ message, determined by an inspection of the plain text body.
+
+*/
+int QCBSMessage::bestScheme() const
{
QTextCodec *codec = QAtUtils::codec( "gsm-noloss" );
+ QString body = text();
uint len = body.length();
bool gsmSafe;
@@ -427,7 +433,7 @@ QByteArray QCBSMessage::toPdu() const
QSMSDataCodingScheme scheme;
if(dataCodingScheme() == -1)
- scheme = bestScheme( text() );
+ scheme = (QSMSDataCodingScheme)bestScheme();
else
scheme = (QSMSDataCodingScheme)dataCodingScheme();
diff --git a/src/qcbsmessage.h b/src/qcbsmessage.h
index f6ed364..0f055b7 100644
--- a/src/qcbsmessage.h
+++ b/src/qcbsmessage.h
@@ -96,6 +96,7 @@ public:
QByteArray toPdu() const;
static QCBSMessage fromPdu( const QByteArray& pdu );
+ int bestScheme() const;
bool shouldSplit() const;
QList<QCBSMessage> split() const;
void computeSize( uint& numPages, uint& spaceLeftInLast ) const;
--
1.7.9.5
next prev parent reply other threads:[~2012-06-27 15:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-27 15:10 [PATCH 0/6] phonesim: CBS/USSD improvments Philippe Nunes
2012-06-27 15:10 ` [PATCH 1/6] controbase: Remove entries in CBM UI Philippe Nunes
2012-06-27 15:10 ` Philippe Nunes [this message]
2012-06-24 21:44 ` [PATCH 2/6] qcbsmessage: Add bestScheme method in QCBSMessage class Denis Kenzior
2012-06-27 15:10 ` [PATCH 3/6] hardwaremanipulator: Use the best scheme for CBS message Philippe Nunes
2012-06-24 22:12 ` Denis Kenzior
2012-06-27 15:10 ` [PATCH 4/6] hardwaremanipulator: Add multi-page support " Philippe Nunes
2012-06-27 15:10 ` [PATCH 5/6] phonesim: Add support for USSD answer Philippe Nunes
2012-06-24 21:44 ` Denis Kenzior
2012-06-27 15:10 ` [PATCH 6/6] phonesim: Add support for USSD session cancellation Philippe Nunes
2012-06-24 21:44 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1340809845-26595-3-git-send-email-philippe.nunes@linux.intel.com \
--to=philippe.nunes@linux.intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox