diff options
author | Philippe Nunes <philippe.nunes@linux.intel.com> | 2012-06-29 17:53:03 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2012-07-09 11:03:37 -0500 |
commit | 01caed2f3b4d8f3ade5ce39d14908a3a93e11178 (patch) | |
tree | 0ce93a290c51451ac49d9fae563c9223883429f2 | |
parent | ac0a92f124f970aabb1758d6c0aa05b878efe03b (diff) | |
download | phonesim-01caed2f3b4d8f3ade5ce39d14908a3a93e11178.tar.gz |
hardwaremanipulator: Add multi-page support for CBS message
-rw-r--r-- | src/hardwaremanipulator.cpp | 21 |
1 files 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 ) |