os/mm/devsoundextensions/telephonyaudiorouting/Session/src/TelephonyAudioRoutingPolicyRequest.cpp
First public contribution.
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Active object for each asynchronous request in RTelephonyAudioRoutingSession.
15 * Notifies MTelephonyAudioRoutingPolicyObserver upon request completion.
23 #include "TelephonyAudioRoutingPolicyRequest.h"
24 #include "MTelephonyAudioRoutingPolicyObserver.h"
25 #include "TelephonyAudioRoutingClientServer.h"
28 // ============================ MEMBER FUNCTIONS ===============================
30 // -----------------------------------------------------------------------------
31 // CTelephonyAudioRoutingPolicyRequest::CTelephonyAudioRoutingPolicyRequest
32 // C++ default constructor can NOT contain any code, that
34 // -----------------------------------------------------------------------------
37 CTelephonyAudioRoutingPolicyRequest::CTelephonyAudioRoutingPolicyRequest(
38 RTelephonyAudioRoutingManagerSession& aManagerSession,
39 MTelephonyAudioRoutingPolicyObserver& aObserver,
40 CTelephonyAudioRoutingManager& aAudioRouting,
41 TTelAudRtngServRqst aRequest )
42 : CActive(EPriorityStandard),
43 iManagerSession(aManagerSession),
44 iPolicyObserver(aObserver),
45 iAudioRoutingManager(aAudioRouting),
51 // -----------------------------------------------------------------------------
52 // CTelephonyAudioRoutingPolicyRequest::ConstructL
53 // Symbian 2nd phase constructor can leave.
54 // -----------------------------------------------------------------------------
56 void CTelephonyAudioRoutingPolicyRequest::ConstructL()
58 TELAUDRTNG_RDEBUG(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingPolicyRequest::ConstructL"));
59 CActiveScheduler::Add(this);
62 // -----------------------------------------------------------------------------
63 // CTelephonyAudioRoutingPolicyRequest::NewL
64 // Two-phased constructor.
65 // -----------------------------------------------------------------------------
68 CTelephonyAudioRoutingPolicyRequest* CTelephonyAudioRoutingPolicyRequest::NewL(
69 RTelephonyAudioRoutingManagerSession& aManagerSession,
70 MTelephonyAudioRoutingPolicyObserver& aObserver,
71 CTelephonyAudioRoutingManager& aAudioRouting,
72 TTelAudRtngServRqst aRequest )
74 CTelephonyAudioRoutingPolicyRequest* self = new( ELeave ) CTelephonyAudioRoutingPolicyRequest(aManagerSession, aObserver, aAudioRouting, aRequest);
75 CleanupStack::PushL( self );
82 CTelephonyAudioRoutingPolicyRequest::~CTelephonyAudioRoutingPolicyRequest()
84 TELAUDRTNG_RDEBUG(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingPolicyRequest::~CTelephonyAudioRoutingPolicyRequest"));
89 // -----------------------------------------------------------------------------
90 // CTelephonyAudioRoutingPolicyRequest::CompleteRequest
91 // This method completes the request status and sets the object active
92 // to provide asynchronous behavior.
93 // -----------------------------------------------------------------------------
95 void CTelephonyAudioRoutingPolicyRequest::CompleteRequest(
96 TTelAudRtngServRqst aRequest,
100 TRequestStatus* stat = &iStatus;
101 User::RequestComplete(stat, aError);
105 // -----------------------------------------------------------------------------
106 // CTelephonyAudioRoutingPolicyRequest::DoCancel
107 // -----------------------------------------------------------------------------
109 void CTelephonyAudioRoutingPolicyRequest::DoCancel()
111 iManagerSession.CancelRequest(iRequest);
114 // -----------------------------------------------------------------------------
115 // CTelephonyAudioRoutingPolicyRequest::RunL
116 // -----------------------------------------------------------------------------
118 void CTelephonyAudioRoutingPolicyRequest::RunL()
120 TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingPolicyRequest::RunL with %d "), iStatus.Int());
121 CTelephonyAudioRouting::TAudioOutput aResponse;
123 switch( iStatus.Int() )
125 case ETelAudRtngServOutputChangeRequested:
128 aResponse = (iManagerSession.AudioOutputPkg())();
131 TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingPolicyRequest::RunL, Calling OutputChangeRequested With: %d "), aResponse);
132 iPolicyObserver.OutputChangeRequested(iAudioRoutingManager, aResponse);
133 iManagerSession.MonitorOutputChangeRequest();
139 User::Panic(_L("TelephonyAudioRouting"), KErrGeneral );