Add support of remote hangup
cover Add support of remote hangup
These patchs introduce the possibility of remote hangup by selecting the call in the call table and use the new button "hangup".
Nicolas Bertrand (5):
controlbase: Add hangup button
callmanager: Remote hangup slot
hardwaremanipulator: add hangup signal
control: Handle hangup call
phonesim: Connect hangup signal
src/callmanager.cpp | 23 +++++++++++++++++++++++ src/callmanager.h | 3 +++ src/control.cpp | 24 +++++++++++++++++++++++- src/control.h | 2 ++ src/controlbase.ui | 7 +++++++ src/hardwaremanipulator.h | 1 + src/phonesim.cpp | 2 ++ 7 files changed, 61 insertions(+), 1 deletions(-)
PATCH 1/5 controlbase: Add hangup button
--- src/controlbase.ui | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
src/controlbase.ui +7 -0
@@ -1410,6 +1410,13 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> + <item> + <widget class="QPushButton" name="pbHangup"> + <property name="text"> + <string>Hangup</string> + </property> + </widget> + </item> </layout> </item> <item>
Signature · 1 line
1.7.1
PATCH 2/5 callmanager: Remote hangup slot
In reply to Nicolas Bertrand--- src/callmanager.cpp | 23 +++++++++++++++++++++++ src/callmanager.h | 3 +++ 2 files changed, 26 insertions(+), 0 deletions(-)
src/callmanager.cpp +23 -0
@@ -445,6 +445,29 @@ void CallManager::hangupCall( int id ) chld1x( id ); } +void CallManager::hangupRemote( int id ) +{ + int index = indexForId( id ); + if ( index >= 0 ) + { + if ( callList[index].state == CallState_Dialing || + callList[index].state == CallState_Alerting ) + { + hangupTimer->stop(); + } + callList[index].state = CallState_Hangup; + sendState( callList[index] ); + + callList.removeAt( index ); + + if ( !hasCall( CallState_Active ) && !hasCall( CallState_Held ) ) + waitingToIncoming(); + + send ( "NO CARRIER" ); + emit callStatesChanged( &callList ); + } +} + bool CallManager::acceptCall() { int id = idForIncoming();
src/callmanager.h +3 -0
@@ -106,6 +106,9 @@ public slots:// Transition the active dialing call to alerting. void dialingToAlerting (); +// Simulate a remote hangup. +void hangupRemote (int id ); + signals:// Send a response to a command. void send( const QString& line );
Signature · 1 line
1.7.1
PATCH 3/5 hardwaremanipulator: add hangup signal
In reply to Nicolas Bertrand--- src/hardwaremanipulator.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
src/hardwaremanipulator.h +1 -0
@@ -60,6 +60,7 @@ signals: void startIncomingCall(const QString &number, const QString &called_number, const QString &name);void stateChangedToAlerting ();void stateChangedToConnected (); +void stateChangedToHangup (int callId ); protected: virtual QString constructCBMessage(const QString &messageCode, int geographicalScope, const QString &updateNumber, const QString &channel,
Signature · 1 line
1.7.1
PATCH 4/5 control: Handle hangup call
In reply to Nicolas Bertrand--- src/control.cpp | 24 +++++++++++++++++++++++- src/control.h | 2 ++ 2 files changed, 25 insertions(+), 1 deletions(-)
src/control.cpp +23 -1
@@ -90,6 +90,7 @@ ControlWidget::ControlWidget(const QString &ruleFile, Control *parent) connect(ui->pbSendNotif, SIGNAL(clicked()), this, SLOT(sendCSSN())); connect(ui->pbAlerting, SIGNAL(clicked()), this, SLOT(setStateAlerting())); connect(ui->pbActive, SIGNAL(clicked()), this, SLOT(setStateConnected())); + connect(ui->pbHangup, SIGNAL(clicked()), this, SLOT(setStateHangup())); QStringList headers; headers << "Sender" << "Priority" << "Notification Status";
@@ -127,7 +128,8 @@ Control::Control(const QString& ruleFile, SimRules *sr, QObject *parent) << SIGNAL(switchTo(QString)) << SIGNAL(startIncomingCall(QString, QString, QString)) << SIGNAL(stateChangedToAlerting()) - << SIGNAL(stateChangedToConnected()); + << SIGNAL(stateChangedToConnected()) + << SIGNAL(stateChangedToHangup(int)); foreach (QByteArray sig, proxySignals) connect(widget, sig, this, sig);
@@ -182,6 +184,26 @@ void ControlWidget::setStateAlerting() emit stateChangedToAlerting(); } +void ControlWidget::setStateHangup() +{ + QList <QTableWidgetItem *> items = ui->twCallMgt->selectedItems(); + + foreach ( QTableWidgetItem *item, items ) + { + int row = item->row(); + if ( row >= 0 ) + { + QTableWidgetItem *itemCallId = ui->twCallMgt->item( row, 0 ); + if ( itemCallId != 0 ) + { + QString strid = itemCallId->text(); + int id = strid.toInt(); + emit p->stateChangedToHangup( id ); + } + } + } +} + void ControlWidget::setCssiEnabled( bool enableCSSI ) { ui->cbCSSI->setEnabled( enableCSSI );
src/control.h +2 -0
@@ -106,6 +106,7 @@ private slots:void sendCSSN ();void setStateAlerting ();void setStateConnected (); +void setStateHangup (); signals: void unsolicitedCommand(const QString &);
@@ -115,6 +116,7 @@ signals: void startIncomingCall(const QString &, const QString &, const QString &);void stateChangedToAlerting ();void stateChangedToConnected (); +void stateChangedToHangup (int callId ); protected:void closeEvent (QCloseEvent *event);
Signature · 1 line
1.7.1
PATCH 5/5 phonesim: Connect hangup signal
In reply to Nicolas Bertrand--- src/phonesim.cpp | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
src/phonesim.cpp +2 -0
@@ -534,6 +534,8 @@ SimRules::SimRules( int fd, QObject *p, const QString& filename, HardwareManipu SLOT( dialingToAlerting() ) ); connect ( machine, SIGNAL( stateChangedToConnected() ), _callManager, SLOT( dialingToConnected() ) ); + connect ( machine, SIGNAL( stateChangedToHangup( int ) ), _callManager, + SLOT( hangupRemote( int ) ) ); } connect(this,SIGNAL(readyRead()),
Signature · 1 line
1.7.1
Hi Nicolas,
Quoted 11 lines · Nicolas Bertrand
These patchs introduce the possibility of remote hangup by selecting the call in the call table and use the new button "hangup".
Nicolas Bertrand (5):
controlbase: Add hangup button
callmanager: Remote hangup slot
hardwaremanipulator: add hangup signal
control: Handle hangup call
phonesim: Connect hangup signal
All 5 patches have been applied, thanks.
Regards,
-Denis