os/mm/devsoundextensions/addeddevsoundcontrol/AddedDevSoundControlMsgHdlr/src/AddedDevSoundControlMsgHdlr.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 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:   Message handler for AddedDevSoundControl CI.
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
sl@0
    20
// INCLUDE FILES
sl@0
    21
#include "AddedDevSoundControlCI.h"
sl@0
    22
#include "AddedDevSoundControlMsgHdlr.h"
sl@0
    23
#include "AddedDevSoundControlMsgs.h"
sl@0
    24
sl@0
    25
// EXTERNAL DATA STRUCTURES
sl@0
    26
sl@0
    27
// EXTERNAL FUNCTION PROTOTYPES
sl@0
    28
sl@0
    29
// CONSTANTS
sl@0
    30
sl@0
    31
// MACROS
sl@0
    32
sl@0
    33
// LOCAL CONSTANTS AND MACROS
sl@0
    34
sl@0
    35
// MODULE DATA STRUCTURES
sl@0
    36
sl@0
    37
// LOCAL FUNCTION PROTOTYPES
sl@0
    38
sl@0
    39
// FORWARD DECLARATIONS
sl@0
    40
sl@0
    41
// ============================= LOCAL FUNCTIONS ===============================
sl@0
    42
sl@0
    43
// ============================ MEMBER FUNCTIONS ===============================
sl@0
    44
sl@0
    45
/**
sl@0
    46
 * CAddedDevSoundControlMsgHdlr::CAddedDevSoundControlMsgHdlr
sl@0
    47
 * C++ default constructor can NOT contain any code, that might leave.
sl@0
    48
 */
sl@0
    49
CAddedDevSoundControlMsgHdlr::CAddedDevSoundControlMsgHdlr(
sl@0
    50
                              MAddedDevSoundControl* aAddedDSControlCI) :
sl@0
    51
	CMMFObject(KUidAddedDevSoundControlInterface)
sl@0
    52
    {
sl@0
    53
    iAddedDSControlCI = aAddedDSControlCI;
sl@0
    54
    }
sl@0
    55
sl@0
    56
/**
sl@0
    57
 * CAddedDevSoundControlMsgHdlr::ConstructL
sl@0
    58
 * Symbian 2nd phase constructor can leave.
sl@0
    59
 */
sl@0
    60
void CAddedDevSoundControlMsgHdlr::ConstructL()
sl@0
    61
    {
sl@0
    62
    }
sl@0
    63
sl@0
    64
/**
sl@0
    65
 * CAddedDevSoundControlMsgHdlr::NewL
sl@0
    66
 * Two-phased constructor.
sl@0
    67
 */
sl@0
    68
EXPORT_C CAddedDevSoundControlMsgHdlr*
sl@0
    69
CAddedDevSoundControlMsgHdlr::NewL(TAny* aAddedDSControlCI)
sl@0
    70
    {
sl@0
    71
    MAddedDevSoundControl* addedDevSoundControlCI =
sl@0
    72
            (MAddedDevSoundControl*)aAddedDSControlCI;
sl@0
    73
    CAddedDevSoundControlMsgHdlr* self =
sl@0
    74
            new (ELeave) CAddedDevSoundControlMsgHdlr(addedDevSoundControlCI);
sl@0
    75
    CleanupStack::PushL( self );
sl@0
    76
    self->ConstructL();
sl@0
    77
    CleanupStack::Pop( self );
sl@0
    78
sl@0
    79
    return self;
sl@0
    80
    }
sl@0
    81
sl@0
    82
/**
sl@0
    83
 * Destructor
sl@0
    84
 */
sl@0
    85
CAddedDevSoundControlMsgHdlr::~CAddedDevSoundControlMsgHdlr()
sl@0
    86
	{
sl@0
    87
	delete iAddedDSControlCI;
sl@0
    88
	}
sl@0
    89
sl@0
    90
/**
sl@0
    91
 * CAddedDevSoundControlMsgHdlr::HandleRequest
sl@0
    92
 * Handles messages from the proxy.
sl@0
    93
 * Calls a subfunction, which determines what custom interface to call.
sl@0
    94
 * A subfunction is used to contain multiple leaving functions for a single
sl@0
    95
 * trap.
sl@0
    96
 * (other items were commented in a header).
sl@0
    97
 */
sl@0
    98
void CAddedDevSoundControlMsgHdlr::HandleRequest(TMMFMessage& aMessage)
sl@0
    99
	{
sl@0
   100
	ASSERT(
sl@0
   101
	aMessage.Destination().InterfaceId() == KUidAddedDevSoundControlInterface);
sl@0
   102
sl@0
   103
	TRAPD(error, DoHandleRequestL(aMessage));
sl@0
   104
	if (error)
sl@0
   105
		{
sl@0
   106
		aMessage.Complete(error);
sl@0
   107
		}
sl@0
   108
	}
sl@0
   109
sl@0
   110
/**
sl@0
   111
 * CAddedDevSoundControlMsgHdlr::DoHandleRequestL
sl@0
   112
 * Determines which custom interface to call.
sl@0
   113
 * (other items were commented in a header).
sl@0
   114
 */
sl@0
   115
void CAddedDevSoundControlMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
   116
	{
sl@0
   117
	switch(aMessage.Function())
sl@0
   118
		{
sl@0
   119
		case EAddedDSControlSetHwAwareness:
sl@0
   120
			{
sl@0
   121
    		DoSetHwAwarenessL(aMessage);
sl@0
   122
			break;
sl@0
   123
			}
sl@0
   124
		case EAddedDSControlPauseAndFlush:
sl@0
   125
			{
sl@0
   126
    		DoPauseAndFlushL(aMessage);
sl@0
   127
			break;
sl@0
   128
			}
sl@0
   129
		default:
sl@0
   130
			{
sl@0
   131
			aMessage.Complete(KErrNotSupported);
sl@0
   132
			}
sl@0
   133
		}
sl@0
   134
	}
sl@0
   135
sl@0
   136
/**
sl@0
   137
 * CAddedDevSoundControlMsgHdlr::DoSetHwAwarenessL
sl@0
   138
 * Handles EAddedDSControlSetHwAwareness message from the proxy and calls 
sl@0
   139
 * custom interface method.
sl@0
   140
 *
sl@0
   141
 * (other items were commented in a header).
sl@0
   142
 */
sl@0
   143
void CAddedDevSoundControlMsgHdlr::DoSetHwAwarenessL(TMMFMessage& aMessage)
sl@0
   144
    {
sl@0
   145
	TPckgBuf<TBool> pckg;
sl@0
   146
	aMessage.ReadData1FromClientL(pckg);
sl@0
   147
	TInt status = iAddedDSControlCI->SetHwAwareness(pckg());
sl@0
   148
    aMessage.Complete(status);
sl@0
   149
    }
sl@0
   150
sl@0
   151
/**
sl@0
   152
 * CAddedDevSoundControlMsgHdlr::DoPauseAndFlushL
sl@0
   153
 * Handles EAddedDSControlPauseAndFlush message from the proxy and calls 
sl@0
   154
 * custom interface method.
sl@0
   155
 *
sl@0
   156
 * (other items were commented in a header).
sl@0
   157
 */
sl@0
   158
void CAddedDevSoundControlMsgHdlr::DoPauseAndFlushL(TMMFMessage& aMessage)
sl@0
   159
    {
sl@0
   160
	TInt status = iAddedDSControlCI->PauseAndFlush();
sl@0
   161
    aMessage.Complete(status);
sl@0
   162
    }
sl@0
   163
sl@0
   164
// End of File