bluetoothappprofiles/avrcp/absolutevolumeapi/src/absolutevolumesender.cpp
changeset 70 f5508c13dfe0
parent 67 16e4b9007960
child 71 083fd884d7dd
equal deleted inserted replaced
67:16e4b9007960 70:f5508c13dfe0
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "absolutevolumesender.h"
       
    17 #include <bluetooth/logger.h>
       
    18 
       
    19 #ifdef __FLOG_ACTIVE
       
    20 _LIT8(KLogComponent, LOG_COMPONENT_REMCONABSOLUTEVOLUME);
       
    21 #endif
       
    22 
       
    23 CAbsVolSender* CAbsVolSender::NewL(CRemConInterfaceSelector& aIfSel, MAbsVolSenderObserver& aObserver)
       
    24 	{
       
    25 	LOG_STATIC_FUNC
       
    26 	return new(ELeave)CAbsVolSender(aIfSel, aObserver);
       
    27 	}
       
    28 
       
    29 CAbsVolSender::CAbsVolSender(CRemConInterfaceSelector& aIfSel, MAbsVolSenderObserver& aObserver)
       
    30 	: CActive(EPriorityStandard), iIfSel(aIfSel), iObserver(aObserver)
       
    31 	{
       
    32 	LOG_FUNC
       
    33 	CActiveScheduler::Add(this);
       
    34 	}
       
    35 
       
    36 CAbsVolSender::~CAbsVolSender()
       
    37 	{
       
    38 	LOG_FUNC
       
    39 	Cancel();
       
    40 	}
       
    41 
       
    42 void CAbsVolSender::RunL()
       
    43 	{
       
    44 	LOG_LINE
       
    45 	LOG_FUNC
       
    46 	iObserver.MavsoSendComplete(iStatus.Int());
       
    47 	}
       
    48 
       
    49 void CAbsVolSender::DoCancel()
       
    50 	{
       
    51 	LOG_FUNC
       
    52 	LOG1(_L8("\tiSendingNotify = %d"), iSendingNotify);
       
    53 	
       
    54 	if(iSendingNotify)
       
    55 		{
       
    56 		iIfSel.SendCancel(ERemConNotifyCommand);
       
    57 		}
       
    58 	else
       
    59 		{
       
    60 		iIfSel.SendCancel(ERemConCommand);
       
    61 		}
       
    62 	}
       
    63 
       
    64 void CAbsVolSender::SendNotify(const TDesC8& aData)
       
    65 	{
       
    66 	LOG_FUNC
       
    67 	iIfSel.SendNotify(iStatus, 
       
    68 			TUid::Uid(KRemConAbsoluteVolumeControllerApiUid),
       
    69 			KRemConAbsoluteVolumeNotification,
       
    70 			ERemConNotifyCommand,
       
    71 			ERemConNotifyCommandAwaitingInterim,
       
    72 			aData);
       
    73 	iSendingNotify = ETrue;
       
    74 	
       
    75 	SetActive();
       
    76 	}
       
    77 
       
    78 void CAbsVolSender::SendSetAbsoluteVolume(TUint& aNumRemotes, const TDesC8& aData)
       
    79 	{
       
    80 	LOG_FUNC
       
    81 	iIfSel.Send(iStatus, 
       
    82 			TUid::Uid(KRemConAbsoluteVolumeControllerApiUid), 
       
    83 			KRemConSetAbsoluteVolume,
       
    84 			aNumRemotes,
       
    85 			ERemConCommand,
       
    86 			aData);
       
    87 	iSendingNotify = EFalse;
       
    88 	
       
    89 	SetActive();
       
    90 	}