aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-12-16 18:31:02 -0600
committerDenis Kenzior <denkenz@gmail.com>2010-12-16 18:31:02 -0600
commit9153c011353a1310926fba1898eaebd55f4fdfee (patch)
tree606eecff63a67dfc343bbd8bf4ee9b8b0e6233f2
parentc673dadefe8ca228c92cb5e5d3178262ef574670 (diff)
downloadphonesim-9153c011353a1310926fba1898eaebd55f4fdfee.tar.gz
Add ability to provide CLIP / CNAP information
And also add a stub in the UI for CDIP information, which is very similar to CLIP / CNAP The current behavior is for the modem to provide CLIP and CNAP if the appropriate check box is checked. If the box is checked but the line edit is empty, then the number / name is assumed to be withheld.
-rw-r--r--src/callmanager.cpp46
-rw-r--r--src/callmanager.h2
-rw-r--r--src/control.cpp11
-rw-r--r--src/controlbase.ui157
-rw-r--r--src/qatutils.cpp3
5 files changed, 157 insertions, 62 deletions
diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index 03fd341..d746333 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -302,6 +302,41 @@ bool CallManager::command( const QString& cmd )
return true;
}
+void CallManager::emitRing(const CallInfo &info)
+{
+ QString str;
+
+ // Annouce the incoming call using GSM 27.007 notifications.
+ if ( info.state == CallState_Waiting ) {
+ str = "+CCWA: " + QAtUtils::encodeNumber( info.number ) + ",1,";
+
+ if (info.number.isNull())
+ str += "2";
+ else if (info.number.isEmpty())
+ str += "1";
+ else
+ str += "0";
+ } else {
+ str = "+CRING: VOICE";
+
+ if (info.number.isNull())
+ ;
+ else if (info.number.isEmpty())
+ str += "\\n\\n+CLIP: " + QAtUtils::encodeNumber( info.number ) + ",,,,1";
+ else
+ str += "\\n\\n+CLIP: " + QAtUtils::encodeNumber( info.number ) + ",,,,0";
+
+ if (info.name.isNull())
+ ;
+ else if (info.name.isEmpty())
+ str += "\\n\\n+CNAP: \"" + info.name + "\",1";
+ else
+ str += "\\n\\n+CNAP: \"" + info.name + "\",0";
+ }
+
+ emit unsolicited(str);
+}
+
void CallManager::startIncomingCall( const QString& number,
const QString& name, bool dialBack )
{
@@ -323,15 +358,10 @@ void CallManager::startIncomingCall( const QString& number,
info.number = number;
info.incoming = true;
info.dialBack = dialBack;
+ info.name = name;
callList += info;
- // Annouce the incoming call using GSM 27.007 notifications.
- if ( info.state == CallState_Waiting ) {
- emit unsolicited( "+CCWA: " + QAtUtils::encodeNumber( number ) + ",1" );
- } else {
- emit unsolicited( "RING\\n\\n+CLIP: " + QAtUtils::encodeNumber( number )
- + "\\n\\n+CNAP: \"" + name + "\"" );
- }
+ emitRing(info);
// Announce the incoming call using Ericsson-style state notifications.
sendState( info );
@@ -714,7 +744,7 @@ void CallManager::sendNextRing()
} else {
for ( int index = 0; index < callList.size(); ++index )
if ( callList[index].id == idForIncoming() && callList[index].state == CallState_Incoming )
- emit unsolicited( "RING" );
+ emitRing(callList[index]);
ringTimer->start(2000);
}
}
diff --git a/src/callmanager.h b/src/callmanager.h
index a2de574..f29bdce 100644
--- a/src/callmanager.h
+++ b/src/callmanager.h
@@ -41,6 +41,7 @@ struct CallInfo
QString number;
bool incoming;
bool dialBack;
+ QString name;
};
class QSimControlEvent;
@@ -154,6 +155,7 @@ private:
bool hasCall( CallState state );
void changeGroup( CallState oldState, CallState newState );
void sendState( const CallInfo& info );
+ void emitRing( const CallInfo &info );
};
#endif
diff --git a/src/control.cpp b/src/control.cpp
index 49f9f04..68c5584 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -281,7 +281,16 @@ void ControlWidget::sendSMSDatagram()
void ControlWidget::sendCall()
{
- emit startIncomingCall( ui->leCaller->text() , ui->leCallerName->text() );
+ QString number;
+ QString name;
+
+ if (ui->cbCaller->isChecked())
+ number = ui->leCaller->text();
+
+ if (ui->cbCallerName->isChecked())
+ name = ui->leCallerName->text();
+
+ emit startIncomingCall( number, name );
}
void ControlWidget::handleFromData( const QString& cmd )
diff --git a/src/controlbase.ui b/src/controlbase.ui
index 76abd4b..669078c 100644
--- a/src/controlbase.ui
+++ b/src/controlbase.ui
@@ -35,9 +35,9 @@
<attribute name="title">
<string>Registration</string>
</attribute>
- <layout class="QVBoxLayout">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <layout class="QHBoxLayout">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QGroupBox" name="gbHardware">
<property name="title">
@@ -117,46 +117,49 @@
<property name="title">
<string>Incoming Call</string>
</property>
- <layout class="QVBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>9</number>
- </property>
- <item>
- <widget class="QLabel" name="lblCaller">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="cbCaller">
<property name="text">
- <string>C&amp;aller</string>
+ <string>Caller Identity</string>
</property>
- <property name="alignment">
- <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
- </property>
- <property name="buddy">
- <cstring>leCaller</cstring>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
- <item>
+ <item row="0" column="1">
<widget class="QLineEdit" name="leCaller"/>
</item>
- <item>
- <widget class="QLabel" name="lblCallerName">
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="cbCallerName">
<property name="text">
- <string>Caller Na&amp;me</string>
+ <string>Caller Name</string>
</property>
- <property name="alignment">
- <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="leCallerName">
+ <property name="enabled">
+ <bool>false</bool>
</property>
- <property name="buddy">
- <cstring>leCallerName</cstring>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="cbCalledLine">
+ <property name="text">
+ <string>Called Line</string>
</property>
</widget>
</item>
- <item>
- <widget class="QLineEdit" name="leCallerName"/>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="leCalledLine">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
- <item>
+ <item row="3" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
@@ -1323,7 +1326,7 @@ p, li { white-space: pre-wrap; }
<height>511</height>
</rect>
</property>
- <layout class="QGridLayout" >
+ <layout class="QGridLayout">
<item row="0" column="1">
<spacer>
<property name="orientation">
@@ -1446,12 +1449,12 @@ p, li { white-space: pre-wrap; }
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>139</x>
- <y>495</y>
+ <x>161</x>
+ <y>616</y>
</hint>
<hint type="destinationlabel">
- <x>248</x>
- <y>463</y>
+ <x>338</x>
+ <y>587</y>
</hint>
</hints>
</connection>
@@ -1462,12 +1465,12 @@ p, li { white-space: pre-wrap; }
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>116</x>
- <y>495</y>
+ <x>138</x>
+ <y>616</y>
</hint>
<hint type="destinationlabel">
- <x>312</x>
- <y>463</y>
+ <x>471</x>
+ <y>587</y>
</hint>
</hints>
</connection>
@@ -1478,12 +1481,12 @@ p, li { white-space: pre-wrap; }
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>120</x>
- <y>458</y>
+ <x>134</x>
+ <y>571</y>
</hint>
<hint type="destinationlabel">
- <x>373</x>
- <y>385</y>
+ <x>612</x>
+ <y>615</y>
</hint>
</hints>
</connection>
@@ -1494,12 +1497,12 @@ p, li { white-space: pre-wrap; }
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>124</x>
- <y>492</y>
+ <x>134</x>
+ <y>607</y>
</hint>
<hint type="destinationlabel">
- <x>238</x>
- <y>494</y>
+ <x>267</x>
+ <y>608</y>
</hint>
</hints>
</connection>
@@ -1510,12 +1513,12 @@ p, li { white-space: pre-wrap; }
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>124</x>
- <y>458</y>
+ <x>134</x>
+ <y>571</y>
</hint>
<hint type="destinationlabel">
- <x>238</x>
- <y>426</y>
+ <x>267</x>
+ <y>536</y>
</hint>
</hints>
</connection>
@@ -1526,12 +1529,60 @@ p, li { white-space: pre-wrap; }
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>82</x>
- <y>438</y>
+ <x>105</x>
+ <y>571</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>348</x>
+ <y>574</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cbCaller</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>leCaller</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>326</x>
+ <y>77</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>401</x>
+ <y>75</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cbCallerName</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>leCallerName</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>357</x>
+ <y>100</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>432</x>
+ <y>105</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cbCalledLine</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>leCalledLine</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>354</x>
+ <y>131</y>
</hint>
<hint type="destinationlabel">
- <x>259</x>
- <y>413</y>
+ <x>424</x>
+ <y>136</y>
</hint>
</hints>
</connection>
diff --git a/src/qatutils.cpp b/src/qatutils.cpp
index a5725c9..6fa191f 100644
--- a/src/qatutils.cpp
+++ b/src/qatutils.cpp
@@ -161,6 +161,9 @@ QString QAtUtils::decodeNumber( QAtResultParser& parser )
*/
QString QAtUtils::encodeNumber( const QString& value, bool keepPlus )
{
+ if (value.isNull())
+ return "\"\",129";
+
if ( value.length() > 0 && value[0] == '+' ) {
if ( keepPlus )
return "\"" + quote( value ) + "\",145";