All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phonesim: add support for +CPOSR unsolicited code
@ 2011-03-08 13:59 Paavo Leinonen
  2011-03-18  5:13 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Paavo Leinonen @ 2011-03-08 13:59 UTC (permalink / raw)
  To: ofono

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

Enables positioning XML sending from PhoneSIM
---

This patch is related to Jarko's GNSS patch. Patch will enable GNSS
testing with PhoneSIM.

 src/control.cpp    |   32 ++++++++++++++++++++++++
 src/control.h      |    2 +
 src/controlbase.ui |   68 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/default.xml    |   49 ++++++++++++++++++++++++++++++++++++-
 4 files changed, 149 insertions(+), 2 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 34c109a..279bade 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -85,6 +85,8 @@ ControlWidget::ControlWidget(const QString &ruleFile, Control *parent)
     connect(ui->pbStart, SIGNAL(clicked()), this, SLOT(simAppStart()));
     connect(ui->pbAbort, SIGNAL(clicked()), this, SLOT(simAppAbort()));
     connect(ui->pbReset, SIGNAL(clicked()), this, SLOT(modemSilentReset()));
+    connect(ui->pbSendGNSSData, SIGNAL(clicked()), this, SLOT(sendGNSSData()));
+    connect(ui->pbGNSSDefault, SIGNAL(clicked()), this, SLOT(setDefaultGNSSData()));
 
     QStringList headers;
     headers << "Sender" << "Priority" << "Notification Status";
@@ -222,6 +224,33 @@ void ControlWidget::sendSMSMessage()
     p->constructSMSMessage(ui->leSMSClass->text().toInt(), ui->leMessageSender->text(), ui->leSMSServiceCenter->text(), ui->teSMSText->toPlainText());
 }
 
+void ControlWidget::setDefaultGNSSData()
+{
+    ui->teGNSStext->clear();
+
+    ui->teGNSStext->append("<?xml version=\"1.0\" ?>");
+    ui->teGNSStext->append("<pos>");
+    ui->teGNSStext->append("  <pos_err>");
+    ui->teGNSStext->append("    <err_reason literal=\"not_enough_gps_satellites\" />");
+    ui->teGNSStext->append("  </pos_err>");
+    ui->teGNSStext->append("</pos>");
+}
+
+void ControlWidget::sendGNSSData()
+{
+    QStringList xml = ui->teGNSStext->toPlainText().split("\n");
+
+    foreach ( QString line, xml )
+    {
+        if (!line.isEmpty()) {
+            QString cposr =  "+CPOSR: " + line;
+
+            emit unsolicitedCommand(cposr);
+            handleFromData( cposr );
+        }
+    }
+}
+
 void ControlWidget::sendMGD()
 {
     emit command("AT+CMGD=1");
@@ -505,6 +534,9 @@ Script::Script(QObject *obj, Ui_ControlBase *ui) : QDBusAbstractAdaptor(obj)
 
     QScriptValue qsTab6 = engine.newQObject(ui->tab_6);
     engine.globalObject().setProperty("tabSIM", qsTab6);
+
+    QScriptValue qsTab8 = engine.newQObject(ui->tab_8);
+    engine.globalObject().setProperty("tabPosition", qsTab8);
 }
 
 void Script::SetPath(const QString &path, const QDBusMessage &msg)
diff --git a/src/control.h b/src/control.h
index 2c14863..eac4288 100644
--- a/src/control.h
+++ b/src/control.h
@@ -95,6 +95,8 @@ private slots:
     void simAppStart();
     void simAppAbort();
     void modemSilentReset();
+    void sendGNSSData();
+    void setDefaultGNSSData();
 
 signals:
     void unsolicitedCommand(const QString &);
diff --git a/src/controlbase.ui b/src/controlbase.ui
index 36fe3cd..11943ed 100644
--- a/src/controlbase.ui
+++ b/src/controlbase.ui
@@ -818,7 +818,13 @@
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
 p, li { white-space: pre-wrap; }
 &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
+&lt;tr&gt;
+&lt;td style=&quot;border: none;&quot;&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
             </property>
            </widget>
           </item>
@@ -1349,6 +1355,66 @@ p, li { white-space: pre-wrap; }
        </layout>
       </widget>
      </widget>
+     <widget class="QWidget" name="tab_8">
+      <attribute name="title">
+       <string>Positioning</string>
+      </attribute>
+      <widget class="QLabel" name="lbGNSSdata">
+       <property name="geometry">
+        <rect>
+         <x>10</x>
+         <y>10</y>
+         <width>271</width>
+         <height>31</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>Positioning Reporting XML Data (+CPOSR)</string>
+       </property>
+      </widget>
+      <widget class="QTextEdit" name="teGNSStext">
+       <property name="geometry">
+        <rect>
+         <x>10</x>
+         <y>40</y>
+         <width>601</width>
+         <height>311</height>
+        </rect>
+       </property>
+       <property name="lineWrapMode">
+        <enum>QTextEdit::NoWrap</enum>
+       </property>
+       <property name="acceptRichText">
+        <bool>false</bool>
+       </property>
+      </widget>
+      <widget class="QPushButton" name="pbSendGNSSData">
+       <property name="geometry">
+        <rect>
+         <x>10</x>
+         <y>360</y>
+         <width>80</width>
+         <height>26</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>SendData</string>
+       </property>
+      </widget>
+      <widget class="QPushButton" name="pbGNSSDefault">
+       <property name="geometry">
+        <rect>
+         <x>100</x>
+         <y>360</y>
+         <width>80</width>
+         <height>26</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>Default</string>
+       </property>
+      </widget>
+     </widget>
     </widget>
    </item>
    <item>
diff --git a/src/default.xml b/src/default.xml
index 00b4381..4d4b1a1 100644
--- a/src/default.xml
+++ b/src/default.xml
@@ -303,6 +303,9 @@
 
     <!-- TTY (hearing impared) state -->
     <set name="PTTY" value="1" />
+
+    <!-- Positioning reporting state -->
+    <set name="CPOSR" value="0" />
 
 <!-- Time -->
 <!-- Enable for testing
@@ -310,7 +313,6 @@
 <unsolicited delay="3000" once="true">*TTZ: 2, "Cingluar", 0</unsolicited>
 -->
 
-
 <!-- GSM 07.07: General commands -->
 
 <chat>
@@ -2993,6 +2995,49 @@
     <response>ERROR</response>
 </chat>
 
+<!-- Positioning related commands -->
+
+<chat>
+    <!-- Query if CPOSR is supported -->
+    <command>AT+CPOSR=?</command>
+    <response>OK</response>
+</chat>
+
+<chat>
+    <!-- Set unsolicited position reporting -->
+    <command>AT+CPOSR=*</command>
+    <response>OK</response>
+    <set name="CPOSR" value="*"/>
+</chat>
+
+<chat>
+    <!-- Read unsolicited position reporting state -->
+    <command>AT+CPOSR?</command>
+    <response>+CPOSR: ${CPOSR}\n\nOK</response>
+</chat>
+
+<chat>
+    <!-- Query if CPOS supported -->
+    <command>AT+CPOS=?</command>
+    <response>OK</response>
+</chat>
+
+<chat>
+    <!-- Send positioning element -->
+    <command>AT+CPOS</command>
+<!--    <response eol="false">&gt; </response> -->
+    <response eol="false"></response>
+    <switch name="cposread"/>
+</chat>
+
+<state name="cposread">
+    <chat>
+        <command wildcard="true"></command>
+        <response>OK</response>
+        <switch name="default"/>
+    </chat>
+</state>
+
 <!-- Modem compatibility commands for phones that support data services -->
 
 <chat>
@@ -3200,6 +3245,8 @@
 +CPBR
 +CPBF
 +CPBW
++CPOS
++CPOSR
 +CMEE
 +CMGF
 +CMGS
-- 
1.7.1


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

* Re: [PATCH] phonesim: add support for +CPOSR unsolicited code
  2011-03-08 13:59 [PATCH] phonesim: add support for +CPOSR unsolicited code Paavo Leinonen
@ 2011-03-18  5:13 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2011-03-18  5:13 UTC (permalink / raw)
  To: ofono

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

Hi Paavo,

On 03/08/2011 07:59 AM, Paavo Leinonen wrote:
> Enables positioning XML sending from PhoneSIM
> ---
> 
> This patch is related to Jarko's GNSS patch. Patch will enable GNSS
> testing with PhoneSIM.
> 
>  src/control.cpp    |   32 ++++++++++++++++++++++++
>  src/control.h      |    2 +
>  src/controlbase.ui |   68 +++++++++++++++++++++++++++++++++++++++++++++++++++-
>  src/default.xml    |   49 ++++++++++++++++++++++++++++++++++++-
>  4 files changed, 149 insertions(+), 2 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2011-03-18  5:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-08 13:59 [PATCH] phonesim: add support for +CPOSR unsolicited code Paavo Leinonen
2011-03-18  5:13 ` 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.