phoneclientserver/phoneserver/Src/Standard/Standard_Aiw/CPhSrvSubSessionNotifier.cpp
changeset 0 ff3b6d0fd310
child 19 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Sub Session Notifier.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <PhCltTypes.h>
       
    22 #include "CPhSrvSubSessionNotifier.h"
       
    23 #include "CPhSrvSession.h"
       
    24 #include "CPhSrvServer.h"
       
    25 #include "MPhSrvEmergencyNegotiators.h"
       
    26 #include "MPhSrvObjectNegotiators.h"
       
    27 #include "MPhSrvComHandNegotiators.h"
       
    28 
       
    29 // CONSTANTS
       
    30 // None.
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CPhSrvSubSessionNotifier::CPhSrvSubSessionNotifier
       
    36 // 
       
    37 // C++ Constructor
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 CPhSrvSubSessionNotifier::CPhSrvSubSessionNotifier( CPhSrvSession& aSession )
       
    41     :   CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeCallNotifier ),
       
    42         iTelNumberPckg( iTelNumber )
       
    43     {
       
    44     
       
    45     }
       
    46 
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CPhSrvSubSessionNotifier::~CPhSrvSubSessionNotifier
       
    50 // 
       
    51 // C++ Destructor
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CPhSrvSubSessionNotifier::~CPhSrvSubSessionNotifier()
       
    55     {
       
    56     if ( PhoneSession().PhoneServer().IsCallNegotiator() )
       
    57         {
       
    58         PhoneSession().
       
    59             PhoneServer().
       
    60                 CallNegotiator().
       
    61                     SetNegotiatorReadyCallCancel( *this ); 
       
    62         }   
       
    63     if ( PhoneSession().PhoneServer().IsEmergencyCallNegotiator() )
       
    64         {
       
    65         PhoneSession().
       
    66             PhoneServer().
       
    67                 EmergencyCallNegotiator().
       
    68                     SetNegotiatorReadyCallCancel( *this );
       
    69         }
       
    70     if ( PhoneSession().PhoneServer().IsComHandNegotiator() )
       
    71         {
       
    72         PhoneSession().
       
    73             PhoneServer().
       
    74                 ComHandNegotiator().
       
    75                     SetNegotiatorReadyRequestCancel( *this );
       
    76         
       
    77         }
       
    78     delete iDialData;
       
    79     }
       
    80 
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CPhSrvSubSessionNotifier::ConstructL
       
    84 // 
       
    85 // Symbian OS 2nd phase constructor
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 /*****************************************************
       
    89 *   Series 60 Customer / ETel
       
    90 *   Series 60  ETel API
       
    91 *****************************************************/
       
    92 void CPhSrvSubSessionNotifier::ConstructL()
       
    93     {
       
    94     CPhSrvSubSessionBase::ConstructL();
       
    95     }
       
    96 
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CPhSrvSubSessionNotifier::PhSrvMessageDecoderCanProcessMessage
       
   100 // 
       
   101 // Framework function. Returns ETrue for the op codes that
       
   102 // this subsession can handle.
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 TBool CPhSrvSubSessionNotifier::PhSrvMessageDecoderCanProcessMessage(
       
   106         TInt aFunction )
       
   107     {
       
   108     switch( aFunction )
       
   109         {
       
   110         case EPhoneServerNotifySubSessionClose:
       
   111         case EPhoneServerNotifySubSessionNotifyCallRequest:
       
   112         case EPhoneServerNotifySubSessionNotifyCallRequestCancel:
       
   113         case EPhoneServerNotifySubSessionReportCallResult:
       
   114         case EPhoneServerNotifySubSessionDialData:
       
   115 
       
   116         case EPhoneServerNotifyEmergencySubSessionNotifyCallRequest:
       
   117         case EPhoneServerNotifyEmergencySubSessionNotifyCallRequestCancel:
       
   118         case EPhoneServerNotifyEmergencySubSessionReportCallResult:
       
   119 
       
   120         case EPhoneServerComHandNotifySubSessionComHandRequest:
       
   121         case EPhoneServerComHandNotifySubSessionComHandRequestCancel:
       
   122         case EPhoneServerComHandNotifySubSessionReportComHandResult:
       
   123 
       
   124             return ETrue;
       
   125 
       
   126         default:
       
   127             return EFalse;
       
   128         }   
       
   129     }
       
   130 
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // CPhSrvSubSessionNotifier::PhSrvMessageProcessorHandleMessageL
       
   134 // 
       
   135 // Framework function. Handle any op-codes here.
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 void CPhSrvSubSessionNotifier::PhSrvMessageProcessorHandleMessageL(
       
   139     const RMessage2& aMessage )
       
   140     {
       
   141     switch( aMessage.Function() )
       
   142         {
       
   143         case EPhoneServerNotifySubSessionClose:
       
   144             CmdSubSessionCloseL( aMessage );
       
   145             break;
       
   146         case EPhoneServerNotifySubSessionNotifyCallRequest:
       
   147             CmdSubSessionNotifyCallRequestL( aMessage );
       
   148             break;
       
   149         case EPhoneServerNotifySubSessionNotifyCallRequestCancel:
       
   150             CmdSubSessionNotifyCallRequestCancelL( aMessage );
       
   151             break;
       
   152         case EPhoneServerNotifySubSessionReportCallResult:
       
   153             CmdSubSessionReportCallResultL( aMessage );
       
   154             break;
       
   155         case EPhoneServerNotifySubSessionDialData:
       
   156             CmdSubSessionDialDataL( aMessage );
       
   157             break;
       
   158         case EPhoneServerNotifyEmergencySubSessionNotifyCallRequest:
       
   159             CmdSubSessionNotifyEmergencyL( aMessage );
       
   160             break;
       
   161         case EPhoneServerNotifyEmergencySubSessionNotifyCallRequestCancel:
       
   162             CmdSubSessionNotifyEmergencyCancel( aMessage );
       
   163             break;
       
   164         case EPhoneServerNotifyEmergencySubSessionReportCallResult:
       
   165             CmdSubSessionReportEmergencyCallResultL( aMessage );
       
   166             break;  
       
   167         case EPhoneServerComHandNotifySubSessionComHandRequest:
       
   168             CmdSubSessionComHandNotifyRequestL( aMessage );
       
   169             break;
       
   170         case EPhoneServerComHandNotifySubSessionComHandRequestCancel:
       
   171             CmdSubSessionComHandNotifyRequestCancelL( aMessage );
       
   172             break;
       
   173         case EPhoneServerComHandNotifySubSessionReportComHandResult:
       
   174             CmdSubSessionComHandNotifyReportL( aMessage );
       
   175             break;             
       
   176         default:
       
   177             PhoneSession().PanicClient(
       
   178                 aMessage,
       
   179                 EPhCltServerInitiatedPanicInvalidRequest );
       
   180             break;
       
   181         }
       
   182     }
       
   183 
       
   184 
       
   185 // -----------------------------------------------------------------------------
       
   186 // CPhSrvSubSessionNotifier::InitiatorMakeAsynchronousCall
       
   187 // 
       
   188 // Called by the phone call negotiator when it wants this
       
   189 // object to initiate a call (on behalf of the external
       
   190 // interface).
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 void CPhSrvSubSessionNotifier::InitiatorMakeAsynchronousCallL(
       
   194       CPhCltExtPhoneDialData& aArgs )
       
   195     {
       
   196     // data length to send
       
   197     const TInt dataLength = aArgs.CalculatePackageSize();
       
   198     
       
   199     const TPckg< TInt > pDataLength( dataLength );
       
   200     //save dial data  
       
   201     CmdSubSessionCloneDialDataL( aArgs );
       
   202 
       
   203     PhoneSession().Write(
       
   204     iPendingDialRequestPointer,
       
   205     0,
       
   206     pDataLength );   
       
   207 
       
   208     // Indicate that the phone notifier should try and make the call.
       
   209     if ( !iPendingDialRequestPointer.IsNull() )
       
   210         {
       
   211         iPendingDialRequestPointer.Complete( KErrNone );
       
   212         }
       
   213     iHavePendingDialRequestPointer = EFalse;
       
   214 	
       
   215     }
       
   216 
       
   217 
       
   218 // -----------------------------------------------------------------------------
       
   219 // CPhSrvSubSessionNotifier::InitiatorIsReadyToMakeCall
       
   220 // 
       
   221 // Does this session have a pending request?
       
   222 // -----------------------------------------------------------------------------
       
   223 //
       
   224 TBool CPhSrvSubSessionNotifier::InitiatorIsReadyToMakeCall() const
       
   225     {
       
   226     return iHavePendingDialRequestPointer;
       
   227     }
       
   228 
       
   229 
       
   230 // -----------------------------------------------------------------------------
       
   231 // CPhSrvSubSessionNotifier::CmdSubSessionCloseL
       
   232 // 
       
   233 // Close the sub-session
       
   234 // -----------------------------------------------------------------------------
       
   235 //
       
   236 void CPhSrvSubSessionNotifier::CmdSubSessionCloseL(
       
   237     const RMessage2& aMessage )
       
   238     {
       
   239     PhoneSession().CloseSubSession( aMessage );
       
   240     }
       
   241 
       
   242 
       
   243 // -----------------------------------------------------------------------------
       
   244 // CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestL
       
   245 // 
       
   246 // Setup an asynchronous request to handle external interface
       
   247 // call requests.
       
   248 // -----------------------------------------------------------------------------
       
   249 //
       
   250 void CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestL(
       
   251     const RMessage2& aMessage )
       
   252     {
       
   253     // Update our pending request pointer if it's not already set
       
   254     if  ( iHavePendingDialRequestPointer )
       
   255         {
       
   256         PhoneSession().PanicClient(
       
   257             aMessage,
       
   258             EPhCltServerInitiatedPanicRequestAlreadyActive );
       
   259         }
       
   260     else
       
   261         {
       
   262         iPendingDialRequestPointer = aMessage;
       
   263         iHavePendingDialRequestPointer = ETrue;
       
   264 
       
   265         // The phone app engine is ready to process a call request. 
       
   266         // Tell the negotiator that we're ready to process any pending 
       
   267         // requests.
       
   268         MPhSrvNegotiatorCall& callNegotiator = 
       
   269             PhoneSession().PhoneServer().CallNegotiatorL();
       
   270         callNegotiator.SetNegotiatorReadyCallL( *this );
       
   271         }
       
   272     }
       
   273 
       
   274 
       
   275 // -----------------------------------------------------------------------------
       
   276 // CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestCancelL
       
   277 // 
       
   278 // Cancel an outstanding request to handle call initiations.
       
   279 // -----------------------------------------------------------------------------
       
   280 //
       
   281 void CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestCancelL(
       
   282     const RMessage2& aMessage )
       
   283     {
       
   284     if  ( !iHavePendingDialRequestPointer )
       
   285         {
       
   286         PhoneSession().PanicClient(
       
   287             aMessage,
       
   288             EPhCltServerInitiatedPanicRequestNotActive );
       
   289         }
       
   290     else
       
   291         {
       
   292         if ( !iPendingDialRequestPointer.IsNull() )
       
   293             {
       
   294             iPendingDialRequestPointer.Complete( KErrCancel );
       
   295             }
       
   296         iHavePendingDialRequestPointer = EFalse;
       
   297         }
       
   298 
       
   299     aMessage.Complete( KErrNone );
       
   300     }
       
   301 
       
   302 
       
   303 // -----------------------------------------------------------------------------
       
   304 // CPhSrvSubSessionNotifier::CmdSubSessionReportCallResultL
       
   305 // 
       
   306 // Tell the external call interface client the result of 
       
   307 // dialing a call.
       
   308 // -----------------------------------------------------------------------------
       
   309 //
       
   310 void CPhSrvSubSessionNotifier::CmdSubSessionReportCallResultL(
       
   311     const RMessage2& aMessage )
       
   312     {
       
   313     // Get result
       
   314     const TPhCltPhoneResults result = 
       
   315         static_cast< TPhCltPhoneResults >( aMessage.Int0() );
       
   316 
       
   317     // Tell call negotiator of result
       
   318     MPhSrvNegotiatorCall& callNegotiator = 
       
   319         PhoneSession().PhoneServer().CallNegotiatorL();
       
   320     callNegotiator.SetNegotiatorAttemptedCallResponseValue( result );
       
   321 
       
   322     // Complete the request
       
   323     aMessage.Complete( KErrNone );
       
   324     }
       
   325 
       
   326 // -----------------------------------------------------------------------------
       
   327 // CPhSrvSubSessionNotifier::CmdSubSessionCloneDialData
       
   328 // 
       
   329 // Clones call arguments to object
       
   330 // -----------------------------------------------------------------------------
       
   331 //
       
   332 void CPhSrvSubSessionNotifier::CmdSubSessionCloneDialDataL(
       
   333  CPhCltExtPhoneDialData& aArgs )
       
   334 	{
       
   335 	iDialData = CPhCltExtPhoneDialData::NewL();
       
   336 	iDialData->SetTelephoneNumber( aArgs.TelephoneNumber() );
       
   337 	iDialData->SetCallType( aArgs.CallType() );
       
   338 	iDialData->SetNameL( aArgs.Name() );
       
   339 	iDialData->SetWindowGroup( aArgs.WindowGroup() );
       
   340 	iDialData->SetRedial( aArgs.Redial() );
       
   341 	iDialData->SetRedialMaximumDuration( aArgs.RedialMaximumDuration() );
       
   342 	iDialData->SetContactLinkL( aArgs.ContactLink() );
       
   343 	iDialData->SetSubAddressL( aArgs.SubAddress() );
       
   344 	iDialData->SetShowNumber( aArgs.ShowNumber() );
       
   345 	iDialData->SetAllowMatch( aArgs.AllowMatch() );
       
   346 	iDialData->SetSATCall( aArgs.SATCall() );
       
   347 	iDialData->SetEndOtherCalls( aArgs.EndOtherCalls() );
       
   348 	iDialData->SetBearerL( aArgs.Bearer() );
       
   349 	iDialData->SetSendKeyPressed( aArgs.SendKeyPressed() );
       
   350 	iDialData->SetInitiateCall( aArgs.InitiateCall() );
       
   351 	iDialData->SetServiceId( aArgs.ServiceId() );
       
   352 	iDialData->SetUUIL( aArgs.UUI() );
       
   353 	}
       
   354     
       
   355 // -----------------------------------------------------------------------------
       
   356 // CPhSrvSubSessionNotifier::CmdSubSessionDialDataL
       
   357 // 
       
   358 // Tell the external call interface client the result of 
       
   359 // dialing a call.
       
   360 // -----------------------------------------------------------------------------
       
   361 //  
       
   362 void CPhSrvSubSessionNotifier::CmdSubSessionDialDataL ( 
       
   363     const RMessage2& aMessage )
       
   364     {
       
   365     HBufC8* package = NULL;
       
   366     package = iDialData->PackLC();
       
   367     if ( package )
       
   368         {
       
   369         PhoneSession().Write(
       
   370         aMessage,
       
   371         0,
       
   372        *package );
       
   373         aMessage.Complete( KErrNone );   
       
   374         CleanupStack::PopAndDestroy( package );
       
   375         }
       
   376     delete iDialData;
       
   377     iDialData = NULL;
       
   378     }
       
   379 
       
   380 
       
   381 // -----------------------------------------------------------------------------
       
   382 // CPhSrvSubSessionNotifier::InitiatorMakeAsynchronousCall
       
   383 // 
       
   384 // Called by the phone call negotiator when it wants this
       
   385 // object to initiate a call (on behalf of the external
       
   386 // interface).
       
   387 // -----------------------------------------------------------------------------
       
   388 //
       
   389 void CPhSrvSubSessionNotifier::InitiatorMakeEmergencyCall( const RMessage2& aMessage )
       
   390     {
       
   391     
       
   392     // Write to phone notifier's address space
       
   393     PhoneSession().Read(
       
   394         aMessage,
       
   395         0,
       
   396          iTelNumberPckg );
       
   397     
       
   398     PhoneSession().Write(
       
   399         iPendingEmergencyRequestPointer,
       
   400         0,
       
   401         iTelNumberPckg );
       
   402         
       
   403     // Indicate that the phone notifier should try and make the call.
       
   404     if ( !iPendingEmergencyRequestPointer.IsNull() )
       
   405         {
       
   406         iPendingEmergencyRequestPointer.Complete( KErrNone );
       
   407         }
       
   408     iHavePendingEmergencyRequestPointer = EFalse;
       
   409     }
       
   410 
       
   411 
       
   412 // -----------------------------------------------------------------------------
       
   413 // CPhSrvSubSessionNotifier::InitiatorIsReadyToMakeCall
       
   414 // 
       
   415 // Does this session have a pending request?
       
   416 // -----------------------------------------------------------------------------
       
   417 //
       
   418 TBool CPhSrvSubSessionNotifier::InitiatorIsReadyToMakeEmergencyCall() const
       
   419     {
       
   420     return iHavePendingEmergencyRequestPointer;
       
   421     }
       
   422 
       
   423 // -----------------------------------------------------------------------------
       
   424 // CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestL
       
   425 // 
       
   426 // Setup an asynchronous request to handle external interface
       
   427 // call requests.
       
   428 // -----------------------------------------------------------------------------
       
   429 //
       
   430 void CPhSrvSubSessionNotifier::CmdSubSessionNotifyEmergencyL(
       
   431     const RMessage2& aMessage )
       
   432     {
       
   433     // Update our pending request pointer if it's not already set
       
   434     if  ( iHavePendingEmergencyRequestPointer )
       
   435         {
       
   436         PhoneSession().PanicClient(
       
   437             aMessage,
       
   438             EPhCltServerInitiatedPanicRequestAlreadyActive );
       
   439         }
       
   440     else
       
   441         {
       
   442         iPendingEmergencyRequestPointer = aMessage;
       
   443         iHavePendingEmergencyRequestPointer = ETrue;
       
   444 
       
   445         // The phone app engine is ready to process a call request. 
       
   446         // Tell the negotiator that we're ready to process any pending 
       
   447         // requests.
       
   448         MPhSrvEmergencyNegotiatorCall& emergencyNegotiator = 
       
   449             PhoneSession().PhoneServer().EmergencyCallNegotiatorL();
       
   450         emergencyNegotiator.SetNegotiatorReadyCall( *this );
       
   451         }
       
   452     }
       
   453 
       
   454 
       
   455 // -----------------------------------------------------------------------------
       
   456 // CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestCancelL
       
   457 // 
       
   458 // Cancel an outstanding request to handle call initiations.
       
   459 // -----------------------------------------------------------------------------
       
   460 //
       
   461 void CPhSrvSubSessionNotifier::CmdSubSessionNotifyEmergencyCancel(
       
   462     const RMessage2& aMessage )
       
   463     {
       
   464     if  ( !iHavePendingEmergencyRequestPointer )
       
   465         {
       
   466         PhoneSession().PanicClient(
       
   467             aMessage,
       
   468             EPhCltServerInitiatedPanicRequestNotActive );
       
   469         }
       
   470     else
       
   471         {
       
   472         if ( !iPendingEmergencyRequestPointer.IsNull() )
       
   473             {
       
   474             iPendingEmergencyRequestPointer.Complete( KErrCancel );
       
   475             }
       
   476         iHavePendingEmergencyRequestPointer = EFalse;
       
   477         }
       
   478 
       
   479     aMessage.Complete( KErrNone );
       
   480     }
       
   481 
       
   482 
       
   483 // -----------------------------------------------------------------------------
       
   484 // CPhSrvSubSessionNotifier::CmdSubSessionReportEmergencyCallResultL
       
   485 // 
       
   486 // Tell the external call interface client the result of 
       
   487 // dialing a call.
       
   488 // -----------------------------------------------------------------------------
       
   489 //
       
   490 void CPhSrvSubSessionNotifier::CmdSubSessionReportEmergencyCallResultL(
       
   491     const RMessage2& aMessage )
       
   492     {
       
   493     // Get result
       
   494     const TPhCltPhoneResults result = 
       
   495         static_cast< TPhCltPhoneResults >( aMessage.Int0() );
       
   496 
       
   497     // Tell call negotiator of result
       
   498     MPhSrvEmergencyNegotiatorCall& emergencyNegotiator = 
       
   499         PhoneSession().PhoneServer().EmergencyCallNegotiatorL();
       
   500     emergencyNegotiator.SetNegotiatorAttemptedCallResponseValue( result );
       
   501 
       
   502     // Complete the request
       
   503     aMessage.Complete( KErrNone );
       
   504     }
       
   505 
       
   506 // -----------------------------------------------------------------------------
       
   507 // CPhSrvSubSessionNotifier::InitiatorMakeAsynchronousComHandRequest
       
   508 // 
       
   509 // Called by the command handler negotiator when it wants this object to 
       
   510 // initiate a command handler request (on behalf of the external interface).
       
   511 // -----------------------------------------------------------------------------
       
   512 //
       
   513 void CPhSrvSubSessionNotifier::
       
   514     InitiatorMakeAsynchronousComHandRequest( 
       
   515     const TPhCltComHandCommandParameters& aParams )
       
   516     {
       
   517     // Package up the data to send
       
   518     TPckgC< TPhCltComHandCommandParameters > 
       
   519         comHandDetails( aParams );
       
   520 
       
   521     // Write to command handler notifier's address space
       
   522     PhoneSession().Write( 
       
   523         iPendingComHandRequestPointer,
       
   524         0,
       
   525         comHandDetails );
       
   526 
       
   527     // Indicate that the command handler notifier should try to perform the 
       
   528     // request.
       
   529     if ( !iPendingComHandRequestPointer.IsNull() )
       
   530         {
       
   531         iPendingComHandRequestPointer.Complete( KErrNone );
       
   532         }
       
   533     iHavePendingComHandRequestPointer = EFalse;
       
   534     }
       
   535 
       
   536 
       
   537 // -----------------------------------------------------------------------------
       
   538 // CPhSrvSubSessionNotifier::InitiatorIsReadyToPerformRequest
       
   539 // 
       
   540 // Does this session have a pending request?
       
   541 // -----------------------------------------------------------------------------
       
   542 //
       
   543 TBool CPhSrvSubSessionNotifier::InitiatorIsReadyToPerformRequest() 
       
   544     const
       
   545     {
       
   546     return iHavePendingComHandRequestPointer;
       
   547     }
       
   548 
       
   549 // -----------------------------------------------------------------------------
       
   550 // CPhSrvSubSessionNotifier::CmdSubSessionComHandNotifyRequestL
       
   551 // 
       
   552 // Handle command handler notifier's request.
       
   553 // -----------------------------------------------------------------------------
       
   554 //
       
   555 void CPhSrvSubSessionNotifier::CmdSubSessionComHandNotifyRequestL( 
       
   556     const RMessage2& aMessage )
       
   557     {
       
   558     // Update our pending request pointer if it's not already set
       
   559     if  ( iHavePendingComHandRequestPointer )
       
   560         {
       
   561         PhoneSession().PanicClient(
       
   562             aMessage,
       
   563             EPhCltServerInitiatedPanicRequestAlreadyActive );
       
   564         }
       
   565     else
       
   566         {
       
   567         iPendingComHandRequestPointer = aMessage;
       
   568         iHavePendingComHandRequestPointer = ETrue;
       
   569 
       
   570         // The phone app engine is ready to process a command handler request.
       
   571         // Tell the negotiator that we're ready to process any pending 
       
   572         // requests.
       
   573         MPhSrvComHandNegotiator& comHandNegotiator = 
       
   574             PhoneSession().PhoneServer().ComHandNegotiatorL();
       
   575         comHandNegotiator.SetNegotiatorReadyRequestL( *this );
       
   576         }
       
   577     }
       
   578 
       
   579 
       
   580 // -----------------------------------------------------------------------------
       
   581 // CPhSrvSubSessionNotifier::
       
   582 // CmdSubSessionComHandNotifyRequestCancelL
       
   583 // 
       
   584 // Handle command handler notifier's request cancel.
       
   585 // -----------------------------------------------------------------------------
       
   586 //
       
   587 void CPhSrvSubSessionNotifier::
       
   588     CmdSubSessionComHandNotifyRequestCancelL( 
       
   589         const RMessage2& aMessage )
       
   590     {
       
   591     if  ( iHavePendingComHandRequestPointer )
       
   592         {
       
   593         iPendingComHandRequestPointer.Complete( KErrCancel );
       
   594         iHavePendingComHandRequestPointer = EFalse;
       
   595         }
       
   596 
       
   597     aMessage.Complete( KErrNone );
       
   598     }
       
   599 
       
   600 
       
   601 // -----------------------------------------------------------------------------
       
   602 // CPhSrvSubSessionNotifier::CmdSubSessionComHandNotifyReportL
       
   603 // 
       
   604 // Tell the result of the request execution to the command handler client.
       
   605 // -----------------------------------------------------------------------------
       
   606 //
       
   607 void CPhSrvSubSessionNotifier::CmdSubSessionComHandNotifyReportL( 
       
   608     const RMessage2& aMessage )
       
   609     {
       
   610     // Get result
       
   611     const TPhCltPhoneResults result = 
       
   612         static_cast< TPhCltPhoneResults >( aMessage.Int0() );
       
   613 
       
   614     // Tell command handler negotiator of result
       
   615     MPhSrvComHandNegotiator& comHandNegotiator = 
       
   616         PhoneSession().PhoneServer().ComHandNegotiatorL();
       
   617     comHandNegotiator.SetNegotiatorAttemptedRequestResponseValue( result );
       
   618 
       
   619     // Complete the request
       
   620     aMessage.Complete( KErrNone );
       
   621     }
       
   622 
       
   623 // End of File