All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 1/6] callmanager: Add signal on call status change
Date: Thu, 28 Apr 2011 14:52:05 -0500	[thread overview]
Message-ID: <4DB9C565.7020405@gmail.com> (raw)
In-Reply-To: <1303984179-8333-2-git-send-email-nicolas.bertrand@linux.intel.com>

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

Hi Nicolas,

On 04/28/2011 04:49 AM, Nicolas Bertrand wrote:
> ---
>  src/callmanager.cpp |   34 ++++++++++++++++++++++++++--------
>  src/callmanager.h   |    3 +++
>  2 files changed, 29 insertions(+), 8 deletions(-)
> 
> diff --git a/src/callmanager.cpp b/src/callmanager.cpp
> index 585a3ac..9823f05 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 sendCallStatus( &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 sendCallStatus( &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 sendCallStatus( &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 sendCallStatus( &callList );
>  }
>  
>  void CallManager::hangupConnected()
> @@ -412,6 +418,8 @@ void CallManager::hangupConnected()
>  
>      if ( !hasCall( CallState_Held ) )
>          waitingToIncoming();
> +
> +    emit sendCallStatus( &callList );
>  }
>  
>  void CallManager::hangupHeld()
> @@ -429,6 +437,8 @@ void CallManager::hangupHeld()
>  
>      if ( !hasCall( CallState_Active ) )
>          waitingToIncoming();
> +
> +    emit sendCallStatus( &callList );
>  }
>  
>  void CallManager::hangupConnectedAndHeld()
> @@ -445,6 +455,7 @@ void CallManager::hangupConnectedAndHeld()
>      }
>      callList = newCallList;
>      waitingToIncoming();
> +    emit sendCallStatus( &callList );
>  }
>  
>  void CallManager::hangupCall( int id )
> @@ -464,15 +475,13 @@ bool CallManager::acceptCall()
>      } else if ( hasCall( CallState_Active ) ) {
>          // Put the active calls on hold and accept the incoming call.
>          changeGroup( CallState_Active, CallState_Held );
> -        callList[index].state = CallState_Active;
> -        sendState( callList[index] );
> -        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] );
> -        return true;
>      }
> +
> +	// No more active calls, so accept incoming

Please make sure to follow phonesim's 4-space indentation rules.

> +    callList[index].state = CallState_Active;
> +    sendState( callList[index] );
> +    emit sendCallStatus( &callList );
> +	return true;

This chunk is changing the behavior and does not belong in this patch.
Please send the behavior modification separately.  Also please note that
once any calls (active or held) exist, then you cannot have incoming
calls, only waiting calls.  The logic of this function can probably be
simplified somewhat.

>  }
>  
>  bool CallManager::chld0()
> @@ -500,6 +509,7 @@ bool CallManager::chld1()
>          int index = indexForId(id);
>          callList[index].state = CallState_Active;
>          sendState( callList[index] );
> +        emit sendCallStatus( &callList );
>          return true;
>      } else if ( hasCall( CallState_Held ) ) {
>          // Hangup the active calls and activate the held ones.
> @@ -508,6 +518,7 @@ bool CallManager::chld1()
>              if ( callList[index].state == CallState_Held ) {
>                  callList[index].state = CallState_Active;
>                  sendState( callList[index] );
> +                emit sendCallStatus( &callList );
>              }
>          }
>          return true;
> @@ -551,6 +562,7 @@ bool CallManager::chld1x( int x )
>      if ( !hasCall( CallState_Active ) && !hasCall( CallState_Held ) )
>          waitingToIncoming();
>  
> +    emit sendCallStatus( &callList );
>      return found;
>  }
>  
> @@ -570,6 +582,7 @@ bool CallManager::chld2()
>          int index = indexForId( id );
>          callList[index].state = CallState_Active;
>          sendState( callList[index] );
> +        emit sendCallStatus( &callList );
>          return true;
>      } else if ( hasCall( CallState_Active ) && hasCall( CallState_Held ) ) {
>          // Swap the active and held calls.
> @@ -620,6 +633,7 @@ bool CallManager::chld2x( int x )
>              // No active calls, so make just this call active.
>              callList[index].state = CallState_Active;
>              sendState( callList[index] );
> +            emit sendCallStatus( &callList );
>          }
>          return true;
>      } else if ( callList[index].state == CallState_Active ) {
> @@ -634,6 +648,7 @@ bool CallManager::chld2x( int x )
>                      return false;
>                  callList[index2].state = CallState_Held;
>                  sendState( callList[index2] );
> +                emit sendCallStatus( &callList );
>              }
>          }
>          return true;
> @@ -691,6 +706,7 @@ void CallManager::dialingToConnected()
>      // Transition the call to its new state.
>      callList[index].state = CallState_Active;
>      sendState( callList[index] );
> +    emit sendCallStatus( &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 +730,7 @@ void CallManager::dialingToAlerting()
>      // Transition the call to its new state.
>      callList[index].state = CallState_Alerting;
>      sendState( callList[index] );
> +    emit sendCallStatus( &callList );
>  }
>  
>  void CallManager::waitingToIncoming()
> @@ -856,6 +873,7 @@ void CallManager::changeGroup( CallState oldState, CallState newState )
>              sendState( callList[index] );
>          }
>      }
> +    emit sendCallStatus( &callList );
>  }
>  
>  void CallManager::sendState( const CallInfo& info )
> diff --git a/src/callmanager.h b/src/callmanager.h
> index 5876c87..69e8d3b 100644
> --- a/src/callmanager.h
> +++ b/src/callmanager.h
> @@ -114,6 +114,9 @@ signals:
>      // Send a call control event.
>      void controlEvent( const QSimControlEvent& event );
>  
> +    // Send calls list on status change
> +    void sendCallStatus( QList<CallInfo> *list );
> +

For Qt style APIs signals should use past-tense wording.  e.g. something
like callStatesChanged().  I know phonesim isn't really good in this
respect ;).  Lets strive to do better for new additions

>  private slots:
>      // Transition the active dialing or alerting call to connected.
>      void dialingToConnected();

Regards,
-Denis

  reply	other threads:[~2011-04-28 19:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28  9:49 [PATCH 0/6] phonesim: Add call status UI Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 1/6] callmanager: Add signal on call status change Nicolas Bertrand
2011-04-28 19:52   ` Denis Kenzior [this message]
2011-04-28  9:49 ` [PATCH 2/6] control: Update UI using call status Nicolas Bertrand
2011-04-28 19:58   ` Denis Kenzior
2011-04-28  9:49 ` [PATCH 3/6] hardwaremanipulator: add callmanagement method Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 4/6] phonesim: Connect call status signal Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 5/6] controlbase.ui: Add call mangement tab Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 6/6] control: Update call view Nicolas Bertrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DB9C565.7020405@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.