bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeapitarget.h
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     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 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @publishedAll
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef REMCONABSOLUTEVOLUMEAPITARGET_H
       
    25 #define REMCONABSOLUTEVOLUMEAPITARGET_H
       
    26 
       
    27 #include <remcon/remconinterfacebase.h>
       
    28 #include <remcon/remconinterfaceif.h>
       
    29 
       
    30 _LIT(KAbsoluteVolumeTargetPanicName, "AbsoluteVolumeTarget");
       
    31 enum TAbsoluteVolumeTargetPanics
       
    32     {
       
    33     ETargetInvalidMaxVolume = 0,
       
    34     ETargetVolumeBeyondMaxVolume = 1,
       
    35     };
       
    36 
       
    37 class MRemConAbsoluteVolumeTargetObserver;
       
    38 
       
    39 /**
       
    40 Client-instantiable type supporting sending absolute volume API responses for
       
    41 Set Absolute Volume and Register Absolute Volume Change Notification. This API
       
    42 should be used in preference to the extapi.
       
    43 */
       
    44 NONSHARABLE_CLASS(CRemConAbsoluteVolumeTarget) : public CRemConInterfaceBase,
       
    45                                                  public MRemConInterfaceIf2
       
    46 	{
       
    47 public:
       
    48 	IMPORT_C static CRemConAbsoluteVolumeTarget* NewL(
       
    49 			CRemConInterfaceSelector& aInterfaceSelector, 
       
    50 			MRemConAbsoluteVolumeTargetObserver& aObserver,
       
    51 			TUint32 aVolume, 
       
    52 			TUint32 aMaxVolume);
       
    53 	
       
    54 	IMPORT_C ~CRemConAbsoluteVolumeTarget();
       
    55 
       
    56 public:
       
    57 	IMPORT_C void SetAbsoluteVolumeResponse(TUint32 aVolume, 
       
    58 			TInt aErr);
       
    59 	
       
    60 	IMPORT_C void AbsoluteVolumeChanged(TUint32 aVolume);
       
    61 	
       
    62 private:
       
    63     CRemConAbsoluteVolumeTarget(CRemConInterfaceSelector& aInterfaceSelector,
       
    64     		MRemConAbsoluteVolumeTargetObserver& aObserver,
       
    65     		TUint32 aVolume, 
       
    66     		TUint32 aMaxVolume);
       
    67 
       
    68 	void ConstructL();
       
    69 
       
    70 private: // From CRemConInterfaceBase
       
    71 	TAny* GetInterfaceIf(TUid aUid);
       
    72 
       
    73 private: // From MRemConInterfaceIf2
       
    74 	void MrcibNewMessage(TUint aOperationId, 
       
    75 			const TDesC8& aData, 
       
    76 			TRemConMessageSubType aMsgSubType);
       
    77 
       
    78 private: // Utility Funtions
       
    79 	void SendError(TInt aError, TUint aOperationId);
       
    80 	void SendNotificationResponse(TRemConMessageSubType aMsgSubType);
       
    81 	void ProcessGetStatus();
       
    82 	void ProcessGetStatusAndBeginObserving();
       
    83 	void ProcessSetAbsoluteVolume(const TDesC8& aData);
       
    84 
       
    85 private: // Unowned
       
    86     MRemConAbsoluteVolumeTargetObserver& iObserver;
       
    87 
       
    88 private: // Owned
       
    89 	// ETrue indicates a request for absolute volume change notification has 
       
    90 	// been received.
       
    91 	TBool                     iAbsoluteVolumeNotificationRequest;
       
    92 	RBuf8                     iOutBuf;
       
    93 	TUint32                   iClientVolume;
       
    94 	TUint32                   iClientMaxVolume;
       
    95 	};
       
    96 #endif // ABSOLUTEVOLUMEAPITARGET_H