All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 2/6] qcbsmessage: Add bestScheme method in QCBSMessage class
  2012-06-27 15:10 ` [PATCH 2/6] qcbsmessage: Add bestScheme method in QCBSMessage class Philippe Nunes
@ 2012-06-24 21:44   ` Denis Kenzior
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2012-06-24 21:44 UTC (permalink / raw)
  To: ofono

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

Hi Philippe,

On 06/27/2012 10:10 AM, Philippe Nunes wrote:
> ---
>   src/qcbsmessage.cpp |   10 ++++++++--
>   src/qcbsmessage.h   |    1 +
>   2 files changed, 9 insertions(+), 2 deletions(-)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/6] phonesim: Add support for USSD answer
  2012-06-27 15:10 ` [PATCH 5/6] phonesim: Add support for USSD answer Philippe Nunes
@ 2012-06-24 21:44   ` Denis Kenzior
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2012-06-24 21:44 UTC (permalink / raw)
  To: ofono

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

Hi Philippe,

On 06/27/2012 10:10 AM, Philippe Nunes wrote:
> ---
>   src/default.xml |    7 +++++++
>   1 file changed, 7 insertions(+)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6/6] phonesim: Add support for USSD session cancellation
  2012-06-27 15:10 ` [PATCH 6/6] phonesim: Add support for USSD session cancellation Philippe Nunes
@ 2012-06-24 21:44   ` Denis Kenzior
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2012-06-24 21:44 UTC (permalink / raw)
  To: ofono

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

Hi Philippe,

On 06/27/2012 10:10 AM, Philippe Nunes wrote:
> ---
>   src/default.xml |    7 +++++++
>   1 file changed, 7 insertions(+)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/6] hardwaremanipulator: Use the best scheme for CBS message
  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
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2012-06-24 22:12 UTC (permalink / raw)
  To: ofono

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

Hi Philippe,

On 06/27/2012 10:10 AM, Philippe Nunes wrote:
> ---
>   src/control.cpp             |    9 +++----
>   src/hardwaremanipulator.cpp |   61 ++++++++++++++++++++++---------------------
>   src/hardwaremanipulator.h   |    6 +++--
>   3 files changed, 38 insertions(+), 38 deletions(-)
>

<snip>

> @@ -91,43 +90,45 @@ QString HardwareManipulator::constructCBMessage(const QString&messageCode, int
>           warning(tr("Invalid Channel,"),
>                   tr("Channel  must be 4 hex digits long "
>                      "and no larger than FFFF"));
> -        return "";
> +        return;
>       }
>
> -    //scheme is currently hardcoded to QSMS8_BitCodingScheme
> -    //uint sch = convertString(scheme, NIBBLE_MAX, ONE_CHAR,HEX_BASE,&ok);
> -    //if ( !ok )
> -    //    return "";
> -
>       QCBSMessage::Language lang = (QCBSMessage::Language)language;
>
> -    uint npag = convertString(numPages, NIBBLE_MAX,ONE_CHAR,HEX_BASE,&ok);
> -    if ( !ok ) {
> -        warning(tr("Invalid number of pages,"),
> -                tr("Number of pages  must be 1 hex digit long "
> -                   "and no larger than F"));
> -        return "";
> -    }
> -
> -    uint pag = convertString(page, NIBBLE_MAX,ONE_CHAR,HEX_BASE,&ok);
> -    if ( !ok ) {
> -        warning(tr("Invalid page number,"),
> -                tr("Page number  must be 1 hex digit long "
> -                   "and no larger than F"));
> -        return "";
> -    }
> -
>       QCBSMessage m;
>       m.setMessageCode(mc);
>       m.setScope(gs);
>       m.setUpdateNumber(un);
>       m.setChannel(ch);
>       m.setLanguage(lang);
> -    m.setNumPages(npag);
> -    m.setPage(pag);
> +    m.setPage(1);
>       m.setText(content);
> +    m.setDataCodingScheme(m.bestScheme());
> +
> +    if ( m.dataCodingScheme() == QSMS_DefaultAlphabet&&
> +                content.length()>  (15*93)) {
> +        warning(tr("Text too long"),
> +        tr("The maximum number of pages (15) "
> +                          "is reached - text is truncated"));
> +        m.setText(content.mid( 0, 15*93 ));
> +    } else if (content.length()>  (15*40)) {
> +        warning(tr("Text too long"),
> +        tr("The maximum number of pages (15) "
> +                           "is reached - text is truncated"));
> +        m.setText(content.mid( 0, 15*40 ));
> +    }

Why are you adding these checks when computeSize can already tell you 
the number of pages required?  Also, this really belongs in the 
follow-on patch since that deals with multiple pages.  It sounds like 
bestScheme / dataCodingScheme need some more thought.

> +
> +    uint nbPages, spaceLeftInLast;
> +    m.computeSize( nbPages, spaceLeftInLast );
> +    m.setNumPages(nbPages);

The split() operation should really be setting the number of pages.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 0/6] phonesim: CBS/USSD improvments
@ 2012-06-27 15:10 Philippe Nunes
  2012-06-27 15:10 ` [PATCH 1/6] controbase: Remove entries in CBM UI Philippe Nunes
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Philippe Nunes @ 2012-06-27 15:10 UTC (permalink / raw)
  To: ofono

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

-CBS message is encoded using the best CBS data coding scheme. In case of 
non-GSM characters in the plain text body, the UCS-2 alphabet is used.

-CBS message is splitted automatically in pages if needed. The UI entries
related to the page number and the maximum of pages are removed since this is
handled internally.

-USSD answer and cancellation commands are now supported.

Philippe Nunes (6):
  controbase: Remove entries in CBM UI
  qcbsmessage: Add bestScheme method in QCBSMessage class
  hardwaremanipulator: Use the best scheme for CBS message
  hardwaremanipulator: Add multi-page support for CBS message
  phonesim: Add support for USSD answer
  phonesim: Add support for USSD session cancellation

 src/control.cpp             |    9 +--
 src/controlbase.ui          |  184 ++++++++++++++++---------------------------
 src/default.xml             |   14 ++++
 src/hardwaremanipulator.cpp |   70 +++++++++-------
 src/hardwaremanipulator.h   |    6 +-
 src/qcbsmessage.cpp         |   10 ++-
 src/qcbsmessage.h           |    1 +
 7 files changed, 137 insertions(+), 157 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/6] controbase: Remove entries in CBM UI
  2012-06-27 15:10 [PATCH 0/6] phonesim: CBS/USSD improvments Philippe Nunes
@ 2012-06-27 15:10 ` Philippe Nunes
  2012-06-27 15:10 ` [PATCH 2/6] qcbsmessage: Add bestScheme method in QCBSMessage class Philippe Nunes
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Philippe Nunes @ 2012-06-27 15:10 UTC (permalink / raw)
  To: ofono

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

---
 src/controlbase.ui |  184 +++++++++++++++++++---------------------------------
 1 file changed, 67 insertions(+), 117 deletions(-)

diff --git a/src/controlbase.ui b/src/controlbase.ui
index ce675d2..4eb1355 100644
--- a/src/controlbase.ui
+++ b/src/controlbase.ui
@@ -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&amp;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>&amp;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>&amp;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>&amp;Language</string>
+             <string>&amp;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>&amp;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>&amp;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>&amp;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>&amp;Page</string>
+             <string>&amp;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&amp;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>
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/6] qcbsmessage: Add bestScheme method in QCBSMessage class
  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
  2012-06-24 21:44   ` Denis Kenzior
  2012-06-27 15:10 ` [PATCH 3/6] hardwaremanipulator: Use the best scheme for CBS message Philippe Nunes
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Philippe Nunes @ 2012-06-27 15:10 UTC (permalink / raw)
  To: ofono

[-- 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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/6] hardwaremanipulator: Use the best scheme for CBS message
  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 ` [PATCH 2/6] qcbsmessage: Add bestScheme method in QCBSMessage class Philippe Nunes
@ 2012-06-27 15:10 ` Philippe Nunes
  2012-06-24 22:12   ` Denis Kenzior
  2012-06-27 15:10 ` [PATCH 4/6] hardwaremanipulator: Add multi-page support " Philippe Nunes
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Philippe Nunes @ 2012-06-27 15:10 UTC (permalink / raw)
  To: ofono

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

---
 src/control.cpp             |    9 +++----
 src/hardwaremanipulator.cpp |   61 ++++++++++++++++++++++---------------------
 src/hardwaremanipulator.h   |    6 +++--
 3 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 27910c2..9085acd 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -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()
diff --git a/src/hardwaremanipulator.cpp b/src/hardwaremanipulator.cpp
index 2d7b141..3d0f54a 100644
--- a/src/hardwaremanipulator.cpp
+++ b/src/hardwaremanipulator.cpp
@@ -62,8 +62,8 @@ void HardwareManipulator::setPhoneNumber( const QString& )
 
 QString PS_toHex( const QByteArray& binary );
 
-QString HardwareManipulator::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)
+void HardwareManipulator::constructCBMessage(const QString &messageCode, int geographicalScope, const QString &updateNumber,
+    const QString &channel, int language, const QString &content)
 {
 
     bool ok;
@@ -71,10 +71,9 @@ QString HardwareManipulator::constructCBMessage(const QString &messageCode, int
     if ( !ok ) {
         warning(tr("Invalid Message Code"),
                 tr("Message code 3 hex digits long and no larger than 3FF"));
-        return "";
+        return;
     }
 
-
     QCBSMessage::GeographicalScope gs = (QCBSMessage::GeographicalScope)geographicalScope;
 
     uint un = convertString(updateNumber,NIBBLE_MAX,ONE_CHAR,HEX_BASE,&ok);
@@ -82,7 +81,7 @@ QString HardwareManipulator::constructCBMessage(const QString &messageCode, int
         warning(tr("Invalid Update Number"),
                 tr("Update number must be 1 hex digit long"
                    "and no larger than F"));
-        return "";
+        return;
     }
 
 
@@ -91,43 +90,45 @@ QString HardwareManipulator::constructCBMessage(const QString &messageCode, int
         warning(tr("Invalid Channel,"),
                 tr("Channel  must be 4 hex digits long "
                    "and no larger than FFFF"));
-        return "";
+        return;
     }
 
-    //scheme is currently hardcoded to QSMS8_BitCodingScheme
-    //uint sch = convertString(scheme, NIBBLE_MAX, ONE_CHAR,HEX_BASE,&ok);
-    //if ( !ok )
-    //    return "";
-
     QCBSMessage::Language lang = (QCBSMessage::Language)language;
 
-    uint npag = convertString(numPages, NIBBLE_MAX,ONE_CHAR,HEX_BASE,&ok);
-    if ( !ok ) {
-        warning(tr("Invalid number of pages,"),
-                tr("Number of pages  must be 1 hex digit long "
-                   "and no larger than F"));
-        return "";
-    }
-
-    uint pag = convertString(page, NIBBLE_MAX,ONE_CHAR,HEX_BASE,&ok);
-    if ( !ok ) {
-        warning(tr("Invalid page number,"),
-                tr("Page number  must be 1 hex digit long "
-                   "and no larger than F"));
-        return "";
-    }
-
     QCBSMessage m;
     m.setMessageCode(mc);
     m.setScope(gs);
     m.setUpdateNumber(un);
     m.setChannel(ch);
     m.setLanguage(lang);
-    m.setNumPages(npag);
-    m.setPage(pag);
+    m.setPage(1);
     m.setText(content);
+    m.setDataCodingScheme(m.bestScheme());
+
+    if ( m.dataCodingScheme() == QSMS_DefaultAlphabet &&
+                content.length() > (15*93)) {
+        warning(tr("Text too long"),
+        tr("The maximum number of pages (15) "
+                          "is reached - text is truncated"));
+        m.setText(content.mid( 0, 15*93 ));
+    } else if (content.length() > (15*40)) {
+        warning(tr("Text too long"),
+        tr("The maximum number of pages (15) "
+                           "is reached - text is truncated"));
+        m.setText(content.mid( 0, 15*40 ));
+    }
+
+    uint nbPages, spaceLeftInLast;
+    m.computeSize( nbPages, spaceLeftInLast );
+    m.setNumPages(nbPages);
 
-    return PS_toHex( m.toPdu() );
+    sendCBS(m);
+}
+
+void HardwareManipulator::sendCBS( const QCBSMessage &m )
+{
+    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 )
diff --git a/src/hardwaremanipulator.h b/src/hardwaremanipulator.h
index 881125e..87a8c6e 100644
--- a/src/hardwaremanipulator.h
+++ b/src/hardwaremanipulator.h
@@ -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);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/6] hardwaremanipulator: Add multi-page support for CBS message
  2012-06-27 15:10 [PATCH 0/6] phonesim: CBS/USSD improvments Philippe Nunes
                   ` (2 preceding siblings ...)
  2012-06-27 15:10 ` [PATCH 3/6] hardwaremanipulator: Use the best scheme for CBS message Philippe Nunes
@ 2012-06-27 15:10 ` Philippe Nunes
  2012-06-27 15:10 ` [PATCH 5/6] phonesim: Add support for USSD answer Philippe Nunes
  2012-06-27 15:10 ` [PATCH 6/6] phonesim: Add support for USSD session cancellation Philippe Nunes
  5 siblings, 0 replies; 11+ messages in thread
From: Philippe Nunes @ 2012-06-27 15:10 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/hardwaremanipulator.cpp b/src/hardwaremanipulator.cpp
index 3d0f54a..6753da1 100644
--- a/src/hardwaremanipulator.cpp
+++ b/src/hardwaremanipulator.cpp
@@ -127,8 +127,17 @@ 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));
+    if( m.shouldSplit() ) {
+        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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/6] phonesim: Add support for USSD answer
  2012-06-27 15:10 [PATCH 0/6] phonesim: CBS/USSD improvments Philippe Nunes
                   ` (3 preceding siblings ...)
  2012-06-27 15:10 ` [PATCH 4/6] hardwaremanipulator: Add multi-page support " Philippe Nunes
@ 2012-06-27 15:10 ` 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
  5 siblings, 1 reply; 11+ messages in thread
From: Philippe Nunes @ 2012-06-27 15:10 UTC (permalink / raw)
  To: ofono

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

---
 src/default.xml |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/default.xml b/src/default.xml
index 7eabfbe..9a6c8c6 100644
--- a/src/default.xml
+++ b/src/default.xml
@@ -2009,6 +2009,13 @@
 </chat>
 
 <chat>
+    <!-- USSD answer that is supported by the network -->
+    <command>AT+CUSD=1,"response",15</command>
+    <response>+CUSD: 0,"Thank you.",15\n\nOK</response>
+    <set name="USD" value="1"/>
+</chat>
+
+<chat>
     <!-- SAT initiated 7-Bit USSD query that is supported by the network -->
     <command>AT+CUSD=1,"ABCD",240</command>
     <response>+CUSD: 0,"USSD string received from SS",240\n\nOK</response>
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/6] phonesim: Add support for USSD session cancellation
  2012-06-27 15:10 [PATCH 0/6] phonesim: CBS/USSD improvments Philippe Nunes
                   ` (4 preceding siblings ...)
  2012-06-27 15:10 ` [PATCH 5/6] phonesim: Add support for USSD answer Philippe Nunes
@ 2012-06-27 15:10 ` Philippe Nunes
  2012-06-24 21:44   ` Denis Kenzior
  5 siblings, 1 reply; 11+ messages in thread
From: Philippe Nunes @ 2012-06-27 15:10 UTC (permalink / raw)
  To: ofono

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

---
 src/default.xml |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/default.xml b/src/default.xml
index 9a6c8c6..9a1a8eb 100644
--- a/src/default.xml
+++ b/src/default.xml
@@ -2044,6 +2044,13 @@
 </chat>
 
 <chat>
+    <!-- cancel USSD session -->
+    <command>AT+CUSD=2</command>
+    <response>OK</response>
+    <set name="USD" value="1"/>
+</chat>
+
+<chat>
     <!-- Enable unstructured supplementary service presentation mode -->
     <command>AT+CUSD=1</command>
     <response>OK</response>
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-06-27 15:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/6] qcbsmessage: Add bestScheme method in QCBSMessage class Philippe Nunes
2012-06-24 21:44   ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.