Open Source Telephony
 help / color / mirror / Atom feed
From: Philippe Nunes <philippe.nunes@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH v2 4/4] hardwaremanipulator: Add multi-page support for CBS message
Date: Fri, 29 Jun 2012 17:53:03 +0200	[thread overview]
Message-ID: <1340985183-22049-5-git-send-email-philippe.nunes@linux.intel.com> (raw)
In-Reply-To: <1340985183-22049-1-git-send-email-philippe.nunes@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1526 bytes --]

---
 src/hardwaremanipulator.cpp |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/hardwaremanipulator.cpp b/src/hardwaremanipulator.cpp
index 93a9e02..528f119 100644
--- a/src/hardwaremanipulator.cpp
+++ b/src/hardwaremanipulator.cpp
@@ -108,8 +108,25 @@ void HardwareManipulator::constructCBMessage(const QString &messageCode, int geo
 
 void HardwareManipulator::sendCBS( const QCBSMessage &m )
 {
-    QByteArray pdu = m.toPdu();
-    emit unsolicitedCommand(QString("+CBM: ")+QString::number(pdu.length())+'\r'+'\n'+ PS_toHex(pdu));
+    uint numPages, spaceLeftInLast;
+    m.computeSize( numPages, spaceLeftInLast );
+
+    if ( numPages > 15) {
+            warning(tr("Text too long"),
+                    tr("The maximum number of pages (15) is reached"
+                       " - Text is truncated"));
+    }
+
+    if( numPages >1 ) {
+        QList<QCBSMessage> list = m.split();
+        for( int i =0; i < list.count(); i++ ) {
+            QByteArray pdu = list[i].toPdu();
+             emit unsolicitedCommand(QString("+CBM: ")+QString::number(pdu.length())+'\r'+'\n'+ PS_toHex(pdu));
+         }
+    } else {
+        QByteArray pdu = m.toPdu();
+        emit unsolicitedCommand(QString("+CBM: ")+QString::number(pdu.length())+'\r'+'\n'+ PS_toHex(pdu));
+    }
 }
 
 void HardwareManipulator::constructSMSMessage( const int type, const QString &sender, const QString &serviceCenter, const QString &text )
-- 
1.7.9.5


  parent reply	other threads:[~2012-06-29 15:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-29 15:52 [PATCH v2 0/4] phonesim: CBS/USSD improvments Philippe Nunes
2012-06-29 15:53 ` [PATCH v2 1/4] controbase: Remove entries in CBM UI Philippe Nunes
2012-06-29 15:53 ` [PATCH v2 2/4] qcbsmessage: apply the same coding scheme for all the pages Philippe Nunes
2012-06-29 15:53 ` [PATCH v2 3/4] hardwaremanipulator: Use the best scheme for CBS message Philippe Nunes
2012-06-29 15:53 ` Philippe Nunes [this message]
2012-07-09 16:04 ` [PATCH v2 0/4] phonesim: CBS/USSD improvments 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=1340985183-22049-5-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