phoneclientserver/phoneclient/Src/CommandHandler/RPhCltCommandHandler.cpp
changeset 0 ff3b6d0fd310
child 12 ae8abd0db65c
child 43 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2003-2004 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:  This class is used to perform command handler originated 
       
    15 *                commands.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDES
       
    22 
       
    23 #include    "RPhCltCommandHandler.h"
       
    24 #include    <RPhCltServer.h>
       
    25 #include    <PhCltTypes.h>
       
    26 #include    "PhCltClientServer.h"
       
    27 #include    <e32std.h>
       
    28 #include    <e32base.h>
       
    29 
       
    30 
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // RPhCltCommandHandler::RPhCltCommandHandler
       
    37 // 
       
    38 // C++ constructor can NOT contain any code, that might leave.
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 RPhCltCommandHandler::RPhCltCommandHandler()
       
    42 :   RSubSessionBase(),
       
    43     iComHandParams( TPhCltComHandCommandParameters() )
       
    44     {
       
    45     }
       
    46 
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // RPhCltCommandHandler::Open
       
    50 // 
       
    51 // Open subsession to Phone Server.
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 TInt RPhCltCommandHandler::Open( RPhCltServer& aServer )
       
    55     {
       
    56     __ASSERT_ALWAYS( aServer.Handle(), User::Panic( 
       
    57             KPhClientPanicCategory, 
       
    58             EPhCltClientSidePanicNullHandle ) );
       
    59 
       
    60     return CreateSubSession( 
       
    61         aServer, 
       
    62         EPhoneServerComHandSubSessionOpen, 
       
    63         TIpcArgs() );
       
    64     }
       
    65 
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // RPhCltCommandHandler::Close
       
    69 // 
       
    70 // Close subsession.
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 void RPhCltCommandHandler::Close()
       
    74     {
       
    75     CloseSubSession( EPhoneServerComHandSubSessionClose );
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // RPhCltCommandHandler::Atd
       
    80 // 
       
    81 // Dial. Only voice call is supported.
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 void RPhCltCommandHandler::Atd(
       
    85     TRequestStatus& aStatus, 
       
    86     const TPhCltTelephoneNumber& aTPhCltTelephoneNumber )
       
    87     {
       
    88     __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( 
       
    89         KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
       
    90 
       
    91     // This is Atd function call.
       
    92     iComHandParams().iCommandHandlerCommand = EPhCltCommandAtd;
       
    93 	iComHandParams().iTelNumber = aTPhCltTelephoneNumber;
       
    94     SendReceive( 
       
    95         EPhoneServerComHandSubSessionAtd, 
       
    96         TIpcArgs( &iComHandParams ), 
       
    97         aStatus );
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // RPhCltCommandHandler::Ata
       
   102 // 
       
   103 // Answer the call. 
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 void RPhCltCommandHandler::Ata(
       
   107     TRequestStatus& aStatus )
       
   108     {
       
   109     __ASSERT_ALWAYS( 
       
   110         SubSessionHandle(), User::Panic( 
       
   111             KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
       
   112 
       
   113     // This is Ata function call.
       
   114     iComHandParams().iCommandHandlerCommand = EPhCltCommandAta;
       
   115 
       
   116     // Ata method does not have parameters <=> Uniformity reason for this.
       
   117     SendReceive( 
       
   118         EPhoneServerComHandSubSessionAta, 
       
   119         TIpcArgs( &iComHandParams ),
       
   120         aStatus );
       
   121     }
       
   122 
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // RPhCltCommandHandler::Chld
       
   126 // 
       
   127 // Call hold and multiparty handling.
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 void RPhCltCommandHandler::Chld(
       
   131     TRequestStatus& aStatus, 
       
   132     const TPhCltChldCommand aChldCommand,
       
   133     const TUint aCallNumber )
       
   134     {
       
   135     __ASSERT_ALWAYS( 
       
   136         SubSessionHandle(), User::Panic( 
       
   137             KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
       
   138 
       
   139     // Save the chld arguments.
       
   140     iComHandParams().iChldCommand    = aChldCommand;
       
   141     iComHandParams().iChldCallNumber = aCallNumber;
       
   142     
       
   143     // This is Chld function call.
       
   144     iComHandParams().iCommandHandlerCommand = EPhCltCommandChld;
       
   145 
       
   146     SendReceive( 
       
   147         EPhoneServerComHandSubSessionChld, 
       
   148         TIpcArgs( &iComHandParams ),
       
   149         aStatus );
       
   150     }
       
   151 
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // RPhCltCommandHandler::Chup
       
   155 // 
       
   156 // Hangup current call.
       
   157 // -----------------------------------------------------------------------------
       
   158 //
       
   159 void RPhCltCommandHandler::Chup(
       
   160     TRequestStatus& aStatus )
       
   161     {
       
   162     __ASSERT_ALWAYS( 
       
   163         SubSessionHandle(), User::Panic( 
       
   164             KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
       
   165 
       
   166     // This is Chup function call.
       
   167     iComHandParams().iCommandHandlerCommand = EPhCltCommandChup;
       
   168 
       
   169     // Chup method does not have parameters <=> Uniformity reason for this.
       
   170     SendReceive( 
       
   171         EPhoneServerComHandSubSessionChup, 
       
   172         TIpcArgs( &iComHandParams ),
       
   173         aStatus );
       
   174     }
       
   175 
       
   176 
       
   177 // -----------------------------------------------------------------------------
       
   178 // RPhCltCommandHandler::Vts
       
   179 // 
       
   180 // DTMF sending, starting and stopping in same function. 
       
   181 // -----------------------------------------------------------------------------
       
   182 //
       
   183 void RPhCltCommandHandler::Vts(
       
   184     TRequestStatus& aStatus, 
       
   185     const TPhCltDtmfTone aDtmfTone,
       
   186     const TPhCltDtmfAction aAction )
       
   187     {
       
   188     __ASSERT_ALWAYS( 
       
   189         SubSessionHandle(), User::Panic( 
       
   190             KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
       
   191 
       
   192     // Save the Vts arguments.
       
   193     iComHandParams().iDtmfTone   = aDtmfTone;
       
   194     iComHandParams().iDtmfAction = aAction;
       
   195     
       
   196     // This is Vts function call.
       
   197     iComHandParams().iCommandHandlerCommand = EPhCltCommandVts;
       
   198 
       
   199     SendReceive( 
       
   200         EPhoneServerComHandSubSessionVts, 
       
   201         TIpcArgs( &iComHandParams ),
       
   202         aStatus );
       
   203     }
       
   204 
       
   205 // -----------------------------------------------------------------------------
       
   206 // RPhCltCommandHandler::CancelAsyncRequest
       
   207 // 
       
   208 // Cancel the ongoing asynchronous request.
       
   209 // -----------------------------------------------------------------------------
       
   210 //
       
   211 void RPhCltCommandHandler::CancelAsyncRequest( 
       
   212     const TPhCltComHandCommand aReqToCancel )
       
   213     {
       
   214     __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( 
       
   215         KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
       
   216 
       
   217     // Save the cancel arguments.
       
   218     iComHandParams().iCommandHandlerCommand = aReqToCancel;
       
   219 
       
   220     SendReceive( 
       
   221         EPhoneServerComHandSubSessionCancel, 
       
   222         TIpcArgs( &iComHandParams ) );
       
   223     }
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // RPhCltCommandHandler::MuteMicrophone
       
   227 // 
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 void RPhCltCommandHandler::MuteMicrophone(
       
   231     TRequestStatus& aStatus, const TBool aMute )
       
   232     {
       
   233     __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( 
       
   234         KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
       
   235     
       
   236     // Save the MuteMic arguments.
       
   237     iComHandParams().iMute = aMute;
       
   238 
       
   239      // This is MuteMic function call.
       
   240     iComHandParams().iCommandHandlerCommand = EPhCltCommandMuteMic;
       
   241 
       
   242     // MuteMic method does not have parameters <=> Uniformity reason for this.
       
   243     SendReceive( 
       
   244         EPhoneServerComHandSubSessionMuteMic, 
       
   245         TIpcArgs( &iComHandParams ),
       
   246         aStatus );
       
   247 
       
   248     }
       
   249 
       
   250 // -----------------------------------------------------------------------------
       
   251 // RPhCltCommandHandler::MuteRingingTone
       
   252 // 
       
   253 // -----------------------------------------------------------------------------
       
   254 //
       
   255 void RPhCltCommandHandler::MuteRingingTone(
       
   256     TRequestStatus& aStatus )
       
   257     {
       
   258     __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( 
       
   259         KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
       
   260 
       
   261      // This is MuteRingingTone function call.
       
   262     iComHandParams().iCommandHandlerCommand = EPhCltCommandMuteRingingTone;
       
   263 
       
   264     // MuteRingingTone method does not have parameters <=> Uniformity reason for this.
       
   265     SendReceive( 
       
   266         EPhoneServerComHandSubSessionMuteRingingTone, 
       
   267         TIpcArgs( &iComHandParams ),
       
   268         aStatus );
       
   269 
       
   270     }    
       
   271             
       
   272 // End of File