aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaavo Leinonen <paavo.leinonen@tieto.com>2011-03-08 15:59:59 +0200
committerDenis Kenzior <denkenz@gmail.com>2011-03-18 00:11:58 -0500
commitb71ea46ccc714e1a02629db83db2b2f8d58a64b8 (patch)
tree3c7b315f2dd33a3beae257eff01dd650d8b482f2
parent4a2068c45f916741ba6fcd8caceef2740773a26b (diff)
downloadphonesim-b71ea46ccc714e1a02629db83db2b2f8d58a64b8.tar.gz
phonesim: add support for +CPOSR unsolicited code
Enables positioning XML sending from PhoneSIM
-rw-r--r--src/control.cpp32
-rw-r--r--src/control.h2
-rw-r--r--src/controlbase.ui68
-rw-r--r--src/default.xml49
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..fc28509 100644
--- a/src/default.xml
+++ b/src/default.xml
@@ -304,13 +304,15 @@
<!-- TTY (hearing impared) state -->
<set name="PTTY" value="1" />
+ <!-- Positioning reporting state -->
+ <set name="CPOSR" value="0" />
+
<!-- Time -->
<!-- Enable for testing
<unsolicited delay="3000" once="true">*TTZ: 2, "11/25/2007, 12:12:12+40", 0</unsolicited>
<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