[PATCH v2 0/6] phonesim: Add call status UI

2011-05-02 Thread Nicolas Bertrand
This  patch introduce a new tab call in phonesim UI in order to display calls
informationsi (id, number, status, name and direction).
The interface to send CSSU and CSSI notification is now dynamic based on the
type of current calls.
Fix some coding-style violations.

Nicolas Bertrand (6):
  callmanager: Add signal on call status change
  control: Update UI using call status
  hardwaremanipulator: add callmanagement method
  phonesim: Connect call status signal
  controlbase.ui: Add call mangement tab
  control: Update call view

 src/callmanager.cpp |   22 +++
 src/callmanager.h   |3 +
 src/control.cpp |  140 ++-
 src/control.h   |6 ++
 src/controlbase.ui  |   61 +++
 src/hardwaremanipulator.cpp |4 +
 src/hardwaremanipulator.h   |2 +
 src/phonesim.cpp|2 +
 8 files changed, 224 insertions(+), 16 deletions(-)

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 2/6] control: Update UI using call status

2011-05-02 Thread Nicolas Bertrand
---
 src/control.cpp |   40 +++-
 src/control.h   |5 +
 2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 645219c..1e71593 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -134,6 +134,32 @@ Control::~Control()
 delete widget;
 }
 
+void Control::callManagement( QListCallInfo *list )
+{
+bool enableCSSU = false;
+bool enableCSSI = false;
+
+foreach( CallInfo i, *list ) {
+if ( i.incoming  !enableCSSU )
+enableCSSU = true;
+if ( !i.incoming  !enableCSSI )
+enableCSSI = true;
+}
+
+widget-setCssiEnabled( enableCSSI );
+widget-setCssuEnabled( enableCSSU );
+}
+
+void ControlWidget::setCssiEnabled( bool enableCSSI )
+{
+ui-cbCSSI-setEnabled( enableCSSI );
+}
+
+void ControlWidget::setCssuEnabled( bool enableCSSU )
+{
+ui-cbCSSU-setEnabled( enableCSSU );
+}
+
 void Control::setPhoneNumber( const QString number )
 {
 widget-setWindowTitle(Phonesim - Number:  + number);
@@ -146,6 +172,10 @@ void Control::warning( const QString title, const QString 
message )
 
 void ControlWidget::handleCSSNNotif()
 {
+
+ui-cbCSSU-setEnabled( false );
+ui-cbCSSI-setEnabled( false );
+
 ui-cbCSSU-insertItem(0, );
 ui-cbCSSU-insertItem(1, 0 - forwarded, 0);
 ui-cbCSSU-insertItem(3, 2 - on hold, 2);
@@ -160,15 +190,15 @@ void ControlWidget::handleCSSNNotif()
 
 void ControlWidget::sendCSSN()
 {
-QVariant v = ui-cbCSSU-itemData(ui-cbCSSU-currentIndex());
+QVariant v = ui-cbCSSU-itemData( ui-cbCSSU-currentIndex() );
 
-if (v.canConvertint())
-emit unsolicitedCommand(+CSSU: +QString::number(v.toInt()));
+if ( v.canConvertint()  ui-cbCSSU-isEnabled() )
+emit unsolicitedCommand( +CSSU: +QString::number( v.toInt() ) );
 
 v = ui-cbCSSI-itemData(ui-cbCSSI-currentIndex());
 
-if (v.canConvertint())
-emit unsolicitedCommand(+CSSI: +QString::number(v.toInt()));
+if ( v.canConvertint()  ui-cbCSSI-isEnabled() )
+emit unsolicitedCommand( +CSSI: +QString::number( v.toInt() ) );
 }
 
 void ControlWidget::sendSQ()
diff --git a/src/control.h b/src/control.h
index c17146a..3acffc9 100644
--- a/src/control.h
+++ b/src/control.h
@@ -25,6 +25,7 @@
 #include QtScript
 #include ui_controlbase.h
 #include attranslator.h
+#include callmanager.h
 
 class Control;
 
@@ -71,6 +72,9 @@ public:
 void handleToData( const QString );
 void handleNewApp();
 void handleCSSNNotif();
+void setCssuEnabled( bool enableCSSU );
+void setCssiEnabled( bool enableCSSI );
+
 
 private slots:
 void sendSQ();
@@ -146,6 +150,7 @@ public slots:
 void handleToData( const QString );
 void setPhoneNumber( const QString );
 void handleNewApp();
+void callManagement( QListCallInfo *info );
 
 protected:
 virtual void warning( const QString, const QString );
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 3/6] hardwaremanipulator: add callmanagement method

2011-05-02 Thread Nicolas Bertrand
---
 src/hardwaremanipulator.cpp |4 
 src/hardwaremanipulator.h   |2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/hardwaremanipulator.cpp b/src/hardwaremanipulator.cpp
index c7bbe6a..909ce2a 100644
--- a/src/hardwaremanipulator.cpp
+++ b/src/hardwaremanipulator.cpp
@@ -337,3 +337,7 @@ void HardwareManipulator::simAppAbort()
 if (app)
 return app-abort();
 }
+
+void HardwareManipulator::callManagement( QListCallInfo *info )
+{
+}
diff --git a/src/hardwaremanipulator.h b/src/hardwaremanipulator.h
index df8f65e..ae8e716 100644
--- a/src/hardwaremanipulator.h
+++ b/src/hardwaremanipulator.h
@@ -27,6 +27,7 @@
 class QSMSMessage;
 class QVMMessage;
 class SimRules;
+struct CallInfo;
 class HardwareManipulator : public QObject
 {
 Q_OBJECT
@@ -49,6 +50,7 @@ public slots:
 virtual void simAppStart( int appIndex );
 virtual void simAppAbort();
 virtual void handleNewApp();
+virtual void callManagement( QListCallInfo *info );
 
 signals:
 void unsolicitedCommand(const QString cmd);
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 1/6] callmanager: Add signal on call status change

2011-05-02 Thread Nicolas Bertrand
---
 src/callmanager.cpp |   22 ++
 src/callmanager.h   |3 +++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index 585a3ac..0ede2ad 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -149,6 +149,8 @@ bool CallManager::command( const QString cmd )
 info.dialBack = false;
 callList += info;
 
+emit callStatesChanged( callList );
+
 // Advertise the call state change and then return to command mode.
 sendState( info );
 send( OK );
@@ -176,6 +178,8 @@ bool CallManager::command( const QString cmd )
 info.dialBack = false;
 callList += info;
 
+emit callStatesChanged( callList );
+
 // Advertise the call state change and then return to command 
mode.
 sendState( info );
 send( CONNECT 19200 );
@@ -369,6 +373,7 @@ void CallManager::startIncomingCall( const QString number,
 callList += info;
 
 emitRing(info);
+emit callStatesChanged( callList );
 
 // Announce the incoming call using Ericsson-style state notifications.
 sendState( info );
@@ -395,6 +400,7 @@ void CallManager::hangupAll()
 connectTimer-stop();
 alertingTimer-stop();
 hangupTimer-stop();
+emit callStatesChanged( callList );
 }
 
 void CallManager::hangupConnected()
@@ -412,6 +418,8 @@ void CallManager::hangupConnected()
 
 if ( !hasCall( CallState_Held ) )
 waitingToIncoming();
+
+emit callStatesChanged( callList );
 }
 
 void CallManager::hangupHeld()
@@ -429,6 +437,8 @@ void CallManager::hangupHeld()
 
 if ( !hasCall( CallState_Active ) )
 waitingToIncoming();
+
+emit callStatesChanged( callList );
 }
 
 void CallManager::hangupConnectedAndHeld()
@@ -445,6 +455,7 @@ void CallManager::hangupConnectedAndHeld()
 }
 callList = newCallList;
 waitingToIncoming();
+emit callStatesChanged( callList );
 }
 
 void CallManager::hangupCall( int id )
@@ -466,11 +477,13 @@ bool CallManager::acceptCall()
 changeGroup( CallState_Active, CallState_Held );
 callList[index].state = CallState_Active;
 sendState( callList[index] );
+emit callStatesChanged( callList );
 return true;
 } else {
 // Only held calls, or no other calls, so just make the incoming call 
active.
 callList[index].state = CallState_Active;
 sendState( callList[index] );
+emit callStatesChanged( callList );
 return true;
 }
 }
@@ -500,6 +513,7 @@ bool CallManager::chld1()
 int index = indexForId(id);
 callList[index].state = CallState_Active;
 sendState( callList[index] );
+emit callStatesChanged( callList );
 return true;
 } else if ( hasCall( CallState_Held ) ) {
 // Hangup the active calls and activate the held ones.
@@ -508,6 +522,7 @@ bool CallManager::chld1()
 if ( callList[index].state == CallState_Held ) {
 callList[index].state = CallState_Active;
 sendState( callList[index] );
+emit callStatesChanged( callList );
 }
 }
 return true;
@@ -551,6 +566,7 @@ bool CallManager::chld1x( int x )
 if ( !hasCall( CallState_Active )  !hasCall( CallState_Held ) )
 waitingToIncoming();
 
+emit callStatesChanged( callList );
 return found;
 }
 
@@ -570,6 +586,7 @@ bool CallManager::chld2()
 int index = indexForId( id );
 callList[index].state = CallState_Active;
 sendState( callList[index] );
+emit callStatesChanged( callList );
 return true;
 } else if ( hasCall( CallState_Active )  hasCall( CallState_Held ) ) {
 // Swap the active and held calls.
@@ -620,6 +637,7 @@ bool CallManager::chld2x( int x )
 // No active calls, so make just this call active.
 callList[index].state = CallState_Active;
 sendState( callList[index] );
+emit callStatesChanged( callList );
 }
 return true;
 } else if ( callList[index].state == CallState_Active ) {
@@ -634,6 +652,7 @@ bool CallManager::chld2x( int x )
 return false;
 callList[index2].state = CallState_Held;
 sendState( callList[index2] );
+emit callStatesChanged( callList );
 }
 }
 return true;
@@ -691,6 +710,7 @@ void CallManager::dialingToConnected()
 // Transition the call to its new state.
 callList[index].state = CallState_Active;
 sendState( callList[index] );
+emit callStatesChanged( callList );
 // If the dialed number starts with 05123, disconnect the
 // call after xx seconds, where xx is part of the dial string
 // as 05123xx
@@ -714,6 +734,7 @@ void CallManager::dialingToAlerting()
 // Transition the call to its new state.
 

[PATCH v2 4/6] phonesim: Connect call status signal

2011-05-02 Thread Nicolas Bertrand
---
 src/phonesim.cpp |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index a822cd9..6b45cf6 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -528,6 +528,8 @@ SimRules::SimRules( int fd, QObject *p,  const QString 
filename, HardwareManipu
 if ( machine ) {
 connect( machine, SIGNAL(startIncomingCall(QString,QString,QString)),
  _callManager, 
SLOT(startIncomingCall(QString,QString,QString)) );
+connect ( _callManager, SIGNAL( callStatesChanged( QListCallInfo * ) 
),
+  machine, SLOT( callManagement( QListCallInfo * ) ) );
 }
 
 connect(this,SIGNAL(readyRead()),
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 5/6] controlbase.ui: Add call mangement tab

2011-05-02 Thread Nicolas Bertrand
---
 src/controlbase.ui |   61 
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/src/controlbase.ui b/src/controlbase.ui
index cfadfe8..41c6d12 100644
--- a/src/controlbase.ui
+++ b/src/controlbase.ui
@@ -1458,6 +1458,67 @@ p, li { white-space: pre-wrap; }
/property
   /widget
  /widget
+ widget class=QWidget name=tab_9
+  attribute name=title
+   stringCall/string
+  /attribute
+  layout class=QVBoxLayout name=verticalLayout_3
+   item
+widget class=QTableWidget name=twCallMgt
+ property name=columnCount
+  number5/number
+ /property
+ attribute name=horizontalHeaderMinimumSectionSize
+  number50/number
+ /attribute
+ attribute name=horizontalHeaderShowSortIndicator stdset=0
+  booltrue/bool
+ /attribute
+ attribute name=verticalHeaderDefaultSectionSize
+  number50/number
+ /attribute
+ column
+  property name=text
+   stringid/string
+  /property
+ /column
+ column
+  property name=text
+   stringnumber/string
+  /property
+ /column
+ column
+  property name=text
+   stringstate/string
+  /property
+ /column
+ column
+  property name=text
+   stringname/string
+  /property
+ /column
+ column
+  property name=text
+   stringtype/string
+  /property
+ /column
+/widget
+   /item
+   item
+spacer name=verticalSpacer
+ property name=orientation
+  enumQt::Vertical/enum
+ /property
+ property name=sizeHint stdset=0
+  size
+   width20/width
+   height40/height
+  /size
+ /property
+/spacer
+   /item
+  /layout
+ /widget
 /widget
/item
item
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 6/6] control: Update call view

2011-05-02 Thread Nicolas Bertrand
---
 src/control.cpp |  100 +--
 src/control.h   |3 +-
 2 files changed, 91 insertions(+), 12 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 1e71593..a9b2fd5 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -136,14 +136,79 @@ Control::~Control()
 
 void Control::callManagement( QListCallInfo *list )
 {
+int row = 0;
 bool enableCSSU = false;
 bool enableCSSI = false;
 
+widget-clearCallView();
+
 foreach( CallInfo i, *list ) {
+QString param[5];
+
 if ( i.incoming  !enableCSSU )
 enableCSSU = true;
 if ( !i.incoming  !enableCSSI )
 enableCSSI = true;
+
+param[0].setNum( i.id );
+param[1] = i.number;
+
+switch( i.state ) {
+
+case CallState_Active:
+{
+param[2] = Active;
+}
+break;
+
+case CallState_Held:
+{
+param[2] = Held;
+}
+break;
+
+case CallState_Dialing:
+{
+param[2] = Dialing;
+}
+break;
+
+case CallState_Alerting:
+{
+param[2] = Alerting;
+}
+break;
+
+case CallState_Incoming:
+{
+param[2] = Incoming;
+}
+break;
+
+case CallState_Waiting:
+{
+param[2] = Waiting;
+}
+break;
+
+case CallState_Hangup:
+{
+param[2] = Hangup;
+}
+break;
+
+case CallState_SwapDummy:
+{
+param[2] = SwapDummy;
+}
+break;
+}
+
+param[3] = i.name;
+param[4] = i.incoming ? incoming : outgoing;
+
+widget-updateCallView( param, row );
+row++;
 }
 
 widget-setCssiEnabled( enableCSSI );
@@ -160,6 +225,20 @@ void ControlWidget::setCssuEnabled( bool enableCSSU )
 ui-cbCSSU-setEnabled( enableCSSU );
 }
 
+void ControlWidget::clearCallView()
+{
+ui-twCallMgt-clearContents();
+}
+
+void ControlWidget::updateCallView( QString callParameters [5], int row )
+{
+if ( row  ui-twCallMgt-rowCount() - 1 )
+ui-twCallMgt-insertRow( row );
+
+for ( int i = 0; i  5; i++ )
+ui-twCallMgt-setItem( row, i, new QTableWidgetItem( 
callParameters[i] ) );
+}
+
 void Control::setPhoneNumber( const QString number )
 {
 widget-setWindowTitle(Phonesim - Number:  + number);
@@ -172,20 +251,19 @@ void Control::warning( const QString title, const 
QString message )
 
 void ControlWidget::handleCSSNNotif()
 {
-
 ui-cbCSSU-setEnabled( false );
 ui-cbCSSI-setEnabled( false );
 
-ui-cbCSSU-insertItem(0, );
-ui-cbCSSU-insertItem(1, 0 - forwarded, 0);
-ui-cbCSSU-insertItem(3, 2 - on hold, 2);
-ui-cbCSSU-insertItem(4, 3 - retrieved, 3);
-ui-cbCSSU-insertItem(5, 4 - multiparty, 4);
+ui-cbCSSU-insertItem( 0,  );
+ui-cbCSSU-insertItem( 1, 0 - forwarded, 0 );
+ui-cbCSSU-insertItem( 3, 2 - on hold, 2 );
+ui-cbCSSU-insertItem( 4, 3 - retrieved, 3 );
+ui-cbCSSU-insertItem( 5, 4 - multiparty, 4 );
 
-ui-cbCSSI-insertItem(0, );
-ui-cbCSSI-insertItem(3, 2 - forwarded, 2);
-ui-cbCSSI-insertItem(6, 5 - outgoing barred, 5);
-ui-cbCSSI-insertItem(7, 6 - incomming barred, 6);
+ui-cbCSSI-insertItem( 0,  );
+ui-cbCSSI-insertItem( 3, 2 - forwarded, 2 );
+ui-cbCSSI-insertItem( 6, 5 - outgoing barred, 5 );
+ui-cbCSSI-insertItem( 7, 6 - incomming barred, 6 );
 }
 
 void ControlWidget::sendCSSN()
@@ -195,7 +273,7 @@ void ControlWidget::sendCSSN()
 if ( v.canConvertint()  ui-cbCSSU-isEnabled() )
 emit unsolicitedCommand( +CSSU: +QString::number( v.toInt() ) );
 
-v = ui-cbCSSI-itemData(ui-cbCSSI-currentIndex());
+v = ui-cbCSSI-itemData( ui-cbCSSI-currentIndex() );
 
 if ( v.canConvertint()  ui-cbCSSI-isEnabled() )
 emit unsolicitedCommand( +CSSI: +QString::number( v.toInt() ) );
diff --git a/src/control.h b/src/control.h
index 3acffc9..ac39eb3 100644
--- a/src/control.h
+++ b/src/control.h
@@ -74,7 +74,8 @@ public:
 void handleCSSNNotif();
 void setCssuEnabled( bool enableCSSU );
 void setCssiEnabled( bool enableCSSI );
-
+void updateCallView( QString callParameters [5], int row );
+void clearCallView();
 
 private slots:
 void sendSQ();
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: Using ofono in C

2011-05-02 Thread Marcel Holtmann
Hi Artem,

 I am looking for some examples how to use ofono in C.
 
 I need something lightweight without using thinks like Qt so ofono might
 be run on low end devices like wifi routers.

you can use oFono directly via the libdbus C binding. It is pretty
lightweight. An example would be tools/auto-enable.c to get you started
with things.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/7] voicecall: Fix variable initialization

2011-05-02 Thread Frédéric Dalleau
---
 src/voicecall.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 3e66004..4564a65 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2600,6 +2600,7 @@ static void emulator_generic_cb(const struct ofono_error 
*error, void *data)
struct ofono_emulator *em = data;
struct ofono_error result;
 
+   result.error = error-error;
result.type = error-type;
 
ofono_emulator_send_final(em, result);
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/7] Add CHLD support to HFP profile

2011-05-02 Thread Frédéric Dalleau
This patch adds CHLD support to HFP profile.

AT+CHLD=0 uses release_all_held and set_udub
AT+CHLD=1 uses release_all_active
AT+CHLD=2 uses hold_all_active
AT+CHLD=3 uses create_multiparty
AT+CHLD=4 uses transfer
AT+CHLD=1X uses release_specific
AT+CHLD=2X uses private_chat

Best regards!


Frédéric Dalleau (7):
  voicecall: Fix variable initialization
  voicecall: add +CHLD support for HFP emulator
  voicecall: add +CHLD=0 support for HFP emulator
  voicecall: add +CHLD=3 support for HFP emulator
  voicecall: add +CHLD=4 support for HFP emulator
  voicecall: add +CHLD=1X support for HFP emulator
  voicecall: add +CHLD=2X support for HFP emulator

 src/voicecall.c |  157 +++
 1 files changed, 157 insertions(+), 0 deletions(-)

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 2/7] voicecall: add +CHLD support for HFP emulator

2011-05-02 Thread Frédéric Dalleau
---
 src/voicecall.c |   70 +++
 1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 4564a65..3507f33 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2417,6 +2417,10 @@ static void emulator_hfp_unregister(struct ofono_atom 
*atom)
OFONO_ATOM_TYPE_EMULATOR_HFP,
emulator_remove_handler,
+CLCC);
+   __ofono_modem_foreach_registered_atom(modem,
+   OFONO_ATOM_TYPE_EMULATOR_HFP,
+   emulator_remove_handler,
+   +CHLD);
 
__ofono_modem_remove_atom_watch(modem, vc-hfp_watch);
 }
@@ -2737,6 +2741,71 @@ static void emulator_clcc_cb(struct ofono_emulator *em,
ofono_emulator_send_final(em, result);
 }
 
+static void emulator_chld_cb(struct ofono_emulator *em,
+   struct ofono_emulator_request *req, void *userdata)
+{
+   struct ofono_voicecall *vc = userdata;
+   struct ofono_error result;
+   char buf[22];
+   char *info;
+   int chld;
+
+   result.error = 0;
+
+   switch (ofono_emulator_request_get_type(req)) {
+   case OFONO_EMULATOR_REQUEST_TYPE_SET:
+   if (!ofono_emulator_request_next_number(req, chld))
+   goto fail;
+
+   switch (chld) {
+   case 1:
+   if (vc-driver-release_all_active == NULL)
+   goto fail;
+
+   vc-driver-release_all_active(vc,
+   emulator_generic_cb, em);
+   return;
+   case 2:
+   if (vc-driver-hold_all_active == NULL)
+   goto fail;
+
+   vc-driver-hold_all_active(vc,
+   emulator_generic_cb, em);
+   return;
+   default:
+   goto fail;
+   }
+   break;
+
+   case OFONO_EMULATOR_REQUEST_TYPE_SUPPORT:
+   memcpy(buf, +CHLD=, 6);
+   info = buf + 6;
+
+   if (vc-driver-release_all_active)
+   *info++ = '1';
+
+   if (vc-driver-hold_all_active) {
+   if (info - buf  6)
+   *info++ = ',';
+
+   *info++ = '2';
+   }
+
+   *info++ = '\0';
+
+   ofono_emulator_send_info(em, buf, TRUE);
+   result.type = OFONO_ERROR_TYPE_NO_ERROR;
+   break;
+
+   case OFONO_EMULATOR_REQUEST_TYPE_QUERY:
+   case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY:
+fail:
+   result.type = OFONO_ERROR_TYPE_FAILURE;
+   }
+
+   ofono_emulator_send_final(em, result);
+}
+
 static void emulator_hfp_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond,
void *data)
@@ -2751,6 +2820,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom,
ofono_emulator_add_handler(em, A, emulator_ata_cb, data, NULL);
ofono_emulator_add_handler(em, +CHUP, emulator_chup_cb, data, NULL);
ofono_emulator_add_handler(em, +CLCC, emulator_clcc_cb, data, NULL);
+   ofono_emulator_add_handler(em, +CHLD, emulator_chld_cb, data, NULL);
 }
 
 void ofono_voicecall_register(struct ofono_voicecall *vc)
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 4/7] voicecall: add +CHLD=3 support for HFP emulator

2011-05-02 Thread Frédéric Dalleau
---
 src/voicecall.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 9225de9..b420071 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2788,6 +2788,13 @@ static void emulator_chld_cb(struct ofono_emulator *em,
vc-driver-hold_all_active(vc,
emulator_generic_cb, em);
return;
+   case 3:
+   if (vc-driver-create_multiparty == NULL)
+   goto fail;
+
+   vc-driver-create_multiparty(vc,
+   emulator_generic_cb, em);
+   return;
default:
goto fail;
}
@@ -2814,6 +2821,13 @@ static void emulator_chld_cb(struct ofono_emulator *em,
*info++ = '2';
}
 
+   if (vc-driver-create_multiparty) {
+   if (info - buf  6)
+   *info++ = ',';
+
+   *info++ = '3';
+   }
+
*info++ = '\0';
 
ofono_emulator_send_info(em, buf, TRUE);
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 3/7] voicecall: add +CHLD=0 support for HFP emulator

2011-05-02 Thread Frédéric Dalleau
---
 src/voicecall.c |   25 -
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 3507f33..9225de9 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2758,6 +2758,22 @@ static void emulator_chld_cb(struct ofono_emulator *em,
goto fail;
 
switch (chld) {
+   case 0:
+   if (vc-driver-set_udub == NULL)
+   goto fail;
+
+   if (vc-driver-release_all_held == NULL)
+   goto fail;
+
+   if (voicecalls_have_waiting(vc)) {
+   vc-driver-set_udub(vc,
+   emulator_generic_cb, em);
+   return;
+   }
+
+   vc-driver-release_all_held(vc,
+   emulator_generic_cb, em);
+   return;
case 1:
if (vc-driver-release_all_active == NULL)
goto fail;
@@ -2781,8 +2797,15 @@ static void emulator_chld_cb(struct ofono_emulator *em,
memcpy(buf, +CHLD=, 6);
info = buf + 6;
 
-   if (vc-driver-release_all_active)
+   if (vc-driver-release_all_held  vc-driver-set_udub)
+   *info++ = '0';
+
+   if (vc-driver-release_all_active) {
+   if (info - buf  6)
+   *info++ = ',';
+
*info++ = '1';
+   }
 
if (vc-driver-hold_all_active) {
if (info - buf  6)
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 6/7] voicecall: add +CHLD=1X support for HFP emulator

2011-05-02 Thread Frédéric Dalleau
---
 src/voicecall.c |   22 --
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 3fe590d..432c739 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2803,9 +2803,19 @@ static void emulator_chld_cb(struct ofono_emulator *em,
emulator_generic_cb, em);
return;
default:
-   goto fail;
+   break;
}
-   break;
+
+   if (chld = 10  chld = 17) {
+   if (vc-driver-release_specific == NULL)
+   goto fail;
+
+   vc-driver-release_specific(vc, chld - 10,
+   emulator_generic_cb, em);
+   return;
+   }
+
+   goto fail;
 
case OFONO_EMULATOR_REQUEST_TYPE_SUPPORT:
memcpy(buf, +CHLD=, 6);
@@ -2842,6 +2852,14 @@ static void emulator_chld_cb(struct ofono_emulator *em,
*info++ = '4';
}
 
+   if (vc-driver-release_specific) {
+   if (info - buf  6)
+   *info++ = ',';
+
+   *info++ = '1';
+   *info++ = 'X';
+   }
+
*info++ = '\0';
 
ofono_emulator_send_info(em, buf, TRUE);
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 7/7] voicecall: add +CHLD=2X support for HFP emulator

2011-05-02 Thread Frédéric Dalleau
---
 src/voicecall.c |   17 +
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 432c739..69cd238 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2815,6 +2815,15 @@ static void emulator_chld_cb(struct ofono_emulator *em,
return;
}
 
+   if (chld = 20  chld = 27) {
+   if (vc-driver-private_chat == NULL)
+   goto fail;
+
+   vc-driver-private_chat(vc, chld - 20,
+   emulator_generic_cb, em);
+   return;
+   }
+
goto fail;
 
case OFONO_EMULATOR_REQUEST_TYPE_SUPPORT:
@@ -2860,6 +2869,14 @@ static void emulator_chld_cb(struct ofono_emulator *em,
*info++ = 'X';
}
 
+   if (vc-driver-private_chat) {
+   if (info - buf  6)
+   *info++ = ',';
+
+   *info++ = '2';
+   *info++ = 'X';
+   }
+
*info++ = '\0';
 
ofono_emulator_send_info(em, buf, TRUE);
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono