phonesim: CBS/USSD improvments
v2 cover phonesim: CBS/USSD improvments
-mDataCodingScheme is set when we need to apply the same scheme in case of multi-page CBS message.
-The method 'shouldsplit' is removed since we are using directly the method compute size in order to check the number of pages.
-When the text is too long, the text truncation is done directly by the method 'split'.
Philippe Nunes (4):
controbase: Remove entries in CBM UI
qcbsmessage: apply the same coding scheme for all the pages
hardwaremanipulator: Use the best scheme for CBS message
hardwaremanipulator: Add multi-page support for CBS message
src/control.cpp | 9 +-- src/controlbase.ui | 184 ++++++++++++++++--------------------------- src/hardwaremanipulator.cpp | 59 +++++++------- src/hardwaremanipulator.h | 6 +- src/qcbsmessage.cpp | 38 ++++----- src/qcbsmessage.h | 1 - 6 files changed, 117 insertions(+), 180 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 1/4 controbase: Remove entries in CBM UI
--- src/controlbase.ui | 184 +++++++++++++++++++--------------------------------- 1 file changed, 67 insertions(+), 117 deletions(-)
src/controlbase.ui +67 -117
@@ -393,7 +393,17 @@ <property name="spacing"> <number>6</number> </property> - <item row="1" column="0"> + <item row="2" column="0"> + <widget class="QLabel" name="lblMessageCode"> + <property name="text"> + <string>Message C&ode:</string> + </property> + <property name="buddy"> + <cstring>leMessageCode</cstring> + </property> + </widget> + </item> + <item row="3" column="0"> <widget class="QLabel" name="lblUpdateNumber"> <property name="text"> <string>&Update Number:</string>
@@ -404,6 +414,33 @@ </widget> </item> <item row="1" column="1"> + <widget class="QComboBox" name="cbGeographicalScope"> + <property name="currentIndex"> + <number>3</number> + </property> + <item> + <property name="text"> + <string>Cell wide(immediate)</string> + </property> + </item> + <item> + <property name="text"> + <string>PLMN wide</string> + </property> + </item> + <item> + <property name="text"> + <string>Location Area wide</string> + </property> + </item> + <item> + <property name="text"> + <string>Cell wide(norm)</string> + </property> + </item> + </widget> + </item> + <item row="3" column="1"> <widget class="QLineEdit" name="leUpdateNumber"> <property name="text"> <string>A</string>
@@ -413,27 +450,27 @@ </property> </widget> </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblNumPages"> + <item row="4" column="1"> + <widget class="QLineEdit" name="leChannel"> <property name="text"> - <string>&Number of Pages</string> + <string>0032</string> </property> - <property name="buddy"> - <cstring>leNumPages</cstring> + <property name="maxLength"> + <number>4</number> </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="lblLanguage"> + <item row="4" column="0"> + <widget class="QLabel" name="lblChannel"> <property name="text"> - <string>&Language</string> + <string>&Channel</string> </property> <property name="buddy"> - <cstring>cbLanguage</cstring> + <cstring>leChannel</cstring> </property> </widget> </item> - <item row="3" column="2"> + <item row="1" column="0"> <widget class="QLabel" name="lblGeographicalScope"> <property name="text"> <string>&Geographical Scope</string>
@@ -443,17 +480,7 @@ </property> </widget> </item> - <item row="2" column="3"> - <widget class="QLineEdit" name="lePage"> - <property name="text"> - <string>1</string> - </property> - <property name="maxLength"> - <number>1</number> - </property> - </widget> - </item> - <item row="3" column="1"> + <item row="5" column="1"> <widget class="QComboBox" name="cbLanguage"> <property name="currentIndex"> <number>1</number>
@@ -525,50 +552,17 @@ </item> </widget> </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblScheme"> - <property name="text"> - <string>&Scheme</string> - </property> - <property name="buddy"> - <cstring>leScheme</cstring> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblChannel"> - <property name="text"> - <string>&Channel</string> - </property> - <property name="buddy"> - <cstring>leChannel</cstring> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblPage"> + <item row="5" column="0"> + <widget class="QLabel" name="lblLanguage"> <property name="text"> - <string>&Page</string> + <string>&Language</string> </property> <property name="buddy"> - <cstring>lePage</cstring> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLineEdit" name="leScheme"> - <property name="text"> - <string>4</string> - </property> - <property name="maxLength"> - <number>1</number> - </property> - <property name="readOnly"> - <bool>true</bool> + <cstring>cbLanguage</cstring> </property> </widget> </item> - <item row="0" column="1"> + <item row="2" column="1"> <widget class="QLineEdit" name="leMessageCode"> <property name="text"> <string>012</string>
@@ -578,62 +572,21 @@ </property> </widget> </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="leChannel"> - <property name="text"> - <string>0032</string> + <item row="1" column="2" rowspan="5"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> </property> - <property name="maxLength"> - <number>4</number> + <property name="sizeType"> + <enum>QSizePolicy::Ignored</enum> </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLineEdit" name="leNumPages"> - <property name="text"> - <string>1</string> - </property> - <property name="maxLength"> - <number>1</number> + <property name="sizeHint" stdset="0"> + <size> + <width>290</width> + <height>150</height> + </size> </property> - </widget> - </item> - <item row="3" column="3"> - <widget class="QComboBox" name="cbGeographicalScope"> - <property name="currentIndex"> - <number>3</number> - </property> - <item> - <property name="text"> - <string>Cell wide(immediate)</string> - </property> - </item> - <item> - <property name="text"> - <string>PLMN wide</string> - </property> - </item> - <item> - <property name="text"> - <string>Location Area wide</string> - </property> - </item> - <item> - <property name="text"> - <string>Cell wide(norm)</string> - </property> - </item> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="lblMessageCode"> - <property name="text"> - <string>Message C&ode:</string> - </property> - <property name="buddy"> - <cstring>leMessageCode</cstring> - </property> - </widget> + </spacer> </item> </layout> </widget>
@@ -1575,9 +1528,7 @@ <tabstop>pbSendSMSDatagram</tabstop> <tabstop>atViewer</tabstop> <tabstop>openSpecButton</tabstop> - <tabstop>leScheme</tabstop> - <tabstop>leNumPages</tabstop> - <tabstop>lePage</tabstop> + <tabstop>teContent</tabstop> <tabstop>cbGeographicalScope</tabstop> <tabstop>pbSelectOperator</tabstop> <tabstop>hsBatteryCharge</tabstop>
@@ -1591,7 +1542,6 @@ <tabstop>leLAC</tabstop> <tabstop>pbSendCellBroadcast</tabstop> <tabstop>leCellID</tabstop> - <tabstop>teContent</tabstop> <tabstop>tabWidget</tabstop> <tabstop>leChannel</tabstop> <tabstop>cbLanguage</tabstop>
Signature · 1 line
1.7.9.5
PATCH v2 2/4 qcbsmessage: apply the same coding scheme for all the pages
In reply to Philippe Nunes--- src/qcbsmessage.cpp | 38 ++++++++++++++------------------------ src/qcbsmessage.h | 1 - 2 files changed, 14 insertions(+), 25 deletions(-)
src/qcbsmessage.cpp +14 -24
@@ -408,6 +408,9 @@ int QCBSMessage::bestScheme() const uint len = body.length(); bool gsmSafe; + if ( d->mDataCodingScheme != (QSMSDataCodingScheme)-1 ) + return d->mDataCodingScheme; + // Encode zero-length bodies in the default alphabet. if ( len == 0 ) return QSMS_DefaultAlphabet;
@@ -430,14 +433,8 @@ int QCBSMessage::bestScheme() const QByteArray QCBSMessage::toPdu() const { QCBSDeliverMessage deliver; - QSMSDataCodingScheme scheme; - - if(dataCodingScheme() == -1) - scheme = (QSMSDataCodingScheme)bestScheme(); - else - scheme = (QSMSDataCodingScheme)dataCodingScheme(); - deliver.pack( *this, scheme ); + deliver.pack( *this, (QSMSDataCodingScheme)bestScheme() ); return deliver.toByteArray(); }
@@ -461,7 +458,7 @@ void QCBSMessage::computeSize( uint& numPages, uint& spaceLeftInLast ) const { QString body = text(); uint len = body.length(); - uint scheme= dataCodingScheme(); + uint scheme= bestScheme(); if ( scheme == QSMS_DefaultAlphabet ) { // Encode the message using 7-bit GSM.
@@ -493,19 +490,6 @@ void QCBSMessage::computeSize( uint& numPages, uint& spaceLeftInLast ) const } /*! - Returns true if this message needs to be split into multiple messages - before being transmitted over a GSM network; otherwise returns false. - - \sa split() -*/ -bool QCBSMessage::shouldSplit() const -{ - uint numPages, spaceLeftInLast; - this->computeSize( numPages, spaceLeftInLast ); - return ( numPages <=1 ? false : true ); -} - -/*! Split this message into several pages of 88 bytes for transmission over a GSM network.
@@ -521,11 +505,13 @@ QList<QCBSMessage> QCBSMessage::split() const // Splitting is not necessary, so return a list with one page. list += *this; return list; - } + } else if ( numPages > 15) + //Up to 15 pages can be concatenated to form a CBS message + numPages = 15; // Get the number of characters to transmit in each page. int split; - uint scheme= dataCodingScheme(); + uint scheme= bestScheme(); switch ( scheme ) { case QSMS_UCS2Alphabet:
@@ -542,7 +528,7 @@ QList<QCBSMessage> QCBSMessage::split() const QCBSMessage tmp; number = 1; QString txt = text(); - while ( posn < txt.length() ) { + while ( posn < txt.length() && number <= numPages ) { tmp = *this; len = txt.length() - posn; if ( len > split ) {
@@ -550,6 +536,10 @@ QList<QCBSMessage> QCBSMessage::split() const } tmp.setText( txt.mid( posn, len ) ); tmp.setPage( number++ ); + tmp.setNumPages(numPages); + // Set mDataCodingScheme to apply the same scheme for all the pages + // of the CBS message + tmp.setDataCodingScheme(scheme); posn += len; list.append(tmp); }
src/qcbsmessage.h +0 -1
@@ -97,7 +97,6 @@ public: static QCBSMessage fromPdu( const QByteArray& pdu ); int bestScheme() const; - bool shouldSplit() const; QList<QCBSMessage> split() const; void computeSize( uint& numPages, uint& spaceLeftInLast ) const;
Signature · 1 line
1.7.9.5
PATCH v2 3/4 hardwaremanipulator: Use the best scheme for CBS message
In reply to Philippe Nunes--- src/control.cpp | 9 +++------ src/hardwaremanipulator.cpp | 42 ++++++++++++------------------------------ src/hardwaremanipulator.h | 6 ++++-- 3 files changed, 19 insertions(+), 38 deletions(-)
src/control.cpp +3 -6
@@ -329,12 +329,9 @@ void ControlWidget::sendREG() void ControlWidget::sendCBM() { - QString pdu = p->constructCBMessage(ui->leMessageCode->text(),ui->cbGeographicalScope->currentIndex(), - ui->leUpdateNumber->text(),ui->leChannel->text(),ui->leScheme->text(), - ui->cbLanguage->currentIndex(),ui->leNumPages->text(),ui->lePage->text(), - ui->teContent->toPlainText()); - - emit unsolicitedCommand(QString("+CBM: ")+QString::number(pdu.length()/2)+'\r'+'\n'+ pdu); + p->constructCBMessage(ui->leMessageCode->text(),ui->cbGeographicalScope->currentIndex(), + ui->leUpdateNumber->text(),ui->leChannel->text(), + ui->cbLanguage->currentIndex(),ui->teContent->toPlainText()); } void ControlWidget::sendSMSMessage()
src/hardwaremanipulator.cpp +12 -30
80 lines not on this page · raw message
src/hardwaremanipulator.h +4 -2
@@ -25,6 +25,7 @@#include "qsmsmessagelist.h" class QSMSMessage; +class QCBSMessage;class QVMMessage;class SimRules;struct CallInfo ;
@@ -43,6 +44,7 @@ public slots: virtual void handleToData( const QString& ); virtual void setPhoneNumber( const QString& ); virtual void constructSMSMessage(const int type, const QString &sender, const QString &serviceCenter, const QString &text); + virtual void sendCBS( const QCBSMessage& m ); virtual void sendSMS( const QSMSMessage& m ); virtual void sendVMNotify( int type, int count, const QList<QVMMessage> &received, const QList<QVMMessage> &deleted, const QString &mailbox ); virtual void sendUSSD( bool cancel, bool response, const QString &content );
@@ -63,8 +65,8 @@ signals:void stateChangedToHangup (int callId ); protected: - virtual QString constructCBMessage(const QString &messageCode, int geographicalScope, const QString &updateNumber, const QString &channel, - const QString &scheme, int language, const QString &numPages, const QString &page, const QString &content); + virtual void constructCBMessage(const QString &messageCode, int geographicalScope, const QString &updateNumber, const QString &channel, + int language, const QString &content); virtual void constructSMSDatagram(int src, int dst, const QString &sender, const QByteArray &data, const QByteArray &contentType); virtual void warning(const QString &title, const QString &message);
Signature · 1 line
1.7.9.5
PATCH v2 4/4 hardwaremanipulator: Add multi-page support for CBS message
In reply to Philippe Nunes--- src/hardwaremanipulator.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
src/hardwaremanipulator.cpp +19 -2
@@ -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 )
Signature · 1 line
1.7.9.5
Hi Philippe,
Quoted 13 lines · Philippe Nunes
-mDataCodingScheme is set when we need to apply the same scheme in case of multi-page CBS message.
-The method 'shouldsplit' is removed since we are using directly the method compute size in order to check the number of pages.
-When the text is too long, the text truncation is done directly by the method 'split'.Philippe Nunes (4):
controbase: Remove entries in CBM UI
qcbsmessage: apply the same coding scheme for all the pages
hardwaremanipulator: Use the best scheme for CBS message
hardwaremanipulator: Add multi-page support for CBS message
Quoted 8 lines
src/control.cpp | 9 +-- src/controlbase.ui | 184 ++++++++++++++++--------------------------- src/hardwaremanipulator.cpp | 59 +++++++------- src/hardwaremanipulator.h | 6 +- src/qcbsmessage.cpp | 38 ++++----- src/qcbsmessage.h | 1 - 6 files changed, 117 insertions(+), 180 deletions(-)
All patches in this series have been applied, thanks.
Regards,
-Denis