os/mm/devsoundextensions/audiorouting/Output/AudioOutputProxy/src/AudioOutputProxyAO.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:   AudioOutput Proxy Active Object
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
#include "AudioOutput.h"
sl@0
    20
#include "AudioOutputMessageTypes.h"
sl@0
    21
#include <e32svr.h>
sl@0
    22
#include "AudioOutputProxyAO.h"
sl@0
    23
#include <CustomCommandUtility.h>
sl@0
    24
#include <MAudioOutputObserver.h>
sl@0
    25
sl@0
    26
sl@0
    27
// Two-phased constructor.
sl@0
    28
CAudioOutputProxyAO* CAudioOutputProxyAO::NewL(CAudioOutput *aOutputProxy,MAudioOutputObserver& aObserver,MCustomCommand* aUtility)
sl@0
    29
	{
sl@0
    30
	CAudioOutputProxyAO* self = new(ELeave) CAudioOutputProxyAO(aOutputProxy,aObserver,aUtility);
sl@0
    31
    CleanupStack::PushL(self);
sl@0
    32
    self->ConstructL();
sl@0
    33
    CleanupStack::Pop(self);
sl@0
    34
    return self;
sl@0
    35
	}
sl@0
    36
sl@0
    37
// Destructor
sl@0
    38
CAudioOutputProxyAO::~CAudioOutputProxyAO()
sl@0
    39
	{
sl@0
    40
	Cancel();
sl@0
    41
	}
sl@0
    42
sl@0
    43
// C++ default constructor can NOT contain any code, that
sl@0
    44
// might leave.
sl@0
    45
//
sl@0
    46
CAudioOutputProxyAO::CAudioOutputProxyAO(CAudioOutput *aOutputProxy,MAudioOutputObserver& aObserver,MCustomCommand* aUtility):
sl@0
    47
	CActive(CActive::EPriorityStandard),
sl@0
    48
		iAudioOutputProxy(aOutputProxy),
sl@0
    49
		iCustomCommandUtility(aUtility),
sl@0
    50
		iObserver(&aObserver)
sl@0
    51
	{
sl@0
    52
	}
sl@0
    53
sl@0
    54
void CAudioOutputProxyAO::ConstructL()
sl@0
    55
	{
sl@0
    56
	CActiveScheduler::Add(this);
sl@0
    57
	}
sl@0
    58
sl@0
    59
// ---------------------------------------------------------
sl@0
    60
// CAudioOutputProxyAO::RunL
sl@0
    61
// ?implementation_description
sl@0
    62
// (other items were commented in a header).
sl@0
    63
// ---------------------------------------------------------
sl@0
    64
//
sl@0
    65
void CAudioOutputProxyAO::RunL()
sl@0
    66
	{
sl@0
    67
#ifdef _DEBUG
sl@0
    68
	RDebug::Print(_L("CAudioOutputProxyAO::RunL"));
sl@0
    69
#endif
sl@0
    70
	if ( iRegistered != EFalse )
sl@0
    71
		{
sl@0
    72
		iCustomCommandUtility->CustomCommandAsync( *iDestination,iFunction,KNullDesC8,KNullDesC8,iCallbackData,iStatus );
sl@0
    73
		SetActive();
sl@0
    74
		iObserver->DefaultAudioOutputChanged(*iAudioOutputProxy,iCallbackData());
sl@0
    75
		}
sl@0
    76
	}
sl@0
    77
sl@0
    78
// ---------------------------------------------------------
sl@0
    79
// CAudioOutputProxyAO::DoCancel
sl@0
    80
// ?implementation_description
sl@0
    81
// (other items were commented in a header).
sl@0
    82
// ---------------------------------------------------------
sl@0
    83
//
sl@0
    84
void CAudioOutputProxyAO::DoCancel()
sl@0
    85
	{
sl@0
    86
       if ( iRegistered != EFalse )
sl@0
    87
       	{
sl@0
    88
       	iCustomCommandUtility->CustomCommandSync( *iDestination, EAofUnregisterObserver, KNullDesC8, KNullDesC8);
sl@0
    89
       	}
sl@0
    90
	}
sl@0
    91
sl@0
    92
// ---------------------------------------------------------
sl@0
    93
// CAudioOutputProxyAO::SendAsyncMessage
sl@0
    94
// ?implementation_description
sl@0
    95
// (other items were commented in a header).
sl@0
    96
// ---------------------------------------------------------
sl@0
    97
//
sl@0
    98
void CAudioOutputProxyAO::SendAsyncMessage(const TMMFMessageDestinationPckg& aDestination,
sl@0
    99
	                                      TInt aFunction)
sl@0
   100
	{
sl@0
   101
	iDestination = &aDestination;
sl@0
   102
	iFunction = aFunction;
sl@0
   103
	iCustomCommandUtility->CustomCommandAsync( aDestination,aFunction,KNullDesC8,KNullDesC8,iCallbackData,iStatus );
sl@0
   104
	SetActive();
sl@0
   105
	}
sl@0
   106
sl@0
   107
sl@0
   108
// ---------------------------------------------------------
sl@0
   109
// CAudioOutputProxyAO::SetRegisterFlag
sl@0
   110
// ?implementation_description
sl@0
   111
// (other items were commented in a header).
sl@0
   112
// ---------------------------------------------------------
sl@0
   113
//
sl@0
   114
void CAudioOutputProxyAO::SetRegisterFlag(TBool aFlag)
sl@0
   115
	{
sl@0
   116
	iRegistered = aFlag;
sl@0
   117
	}
sl@0
   118
// ---------------------------------------------------------
sl@0
   119
// CAudioOutputProxyAO::SetObserver
sl@0
   120
// ?implementation_description
sl@0
   121
// (other items were commented in a header).
sl@0
   122
// ---------------------------------------------------------
sl@0
   123
//
sl@0
   124
void CAudioOutputProxyAO::SetObserver(MAudioOutputObserver& aObserver)
sl@0
   125
    {
sl@0
   126
    iObserver = &aObserver;
sl@0
   127
    }