epoc32/include/mw/playerinformationtarget.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
equal deleted inserted replaced
2:2fe1408b6811 3:e1b950c65cb4
       
     1 // Copyright (c) 2007-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 REMCONPLAYERINFORMATIONTARGET_H
       
    25 #define REMCONPLAYERINFORMATIONTARGET_H
       
    26 
       
    27 #include <e32base.h>
       
    28 #include <s32mem.h>
       
    29 #include <e32hashtab.h>
       
    30 
       
    31 #include <remcon/remconinterfacebase.h>
       
    32 #include <remcon/remconinterfaceif.h>
       
    33 #include <remcon/avrcpspec.h>
       
    34 #include <playerinformationtargetobserver.h>
       
    35 
       
    36 class CRemConInterfaceSelector;
       
    37 class CPlayerApplicationSettings;
       
    38 
       
    39 // This is the maximum length of the player application setting attribute and value strings
       
    40 const TInt KMaxPlayerApplicationSettingsValue = 255 ;
       
    41 // This is the minimum length of the player application setting attribute and value strings
       
    42 const TInt KMinPlayerApplicationSettingsValue = 1 ;
       
    43 
       
    44 /**
       
    45 Client-instantiable class supporting player information responses.
       
    46 This is the container class for the three interface parts
       
    47 */
       
    48 NONSHARABLE_CLASS(CPlayerInfoTarget) : 	public CRemConInterfaceBase,
       
    49 								       	public MRemConInterfaceIf2, 
       
    50 								       	private MPlayerCapabilitiesObserver,
       
    51 										private MPlayerApplicationSettingsObserver,
       
    52 										private MPlayerEventsObserver
       
    53 								           
       
    54 	{
       
    55 public:
       
    56 	/**
       
    57 	Factory function.
       
    58 	@param aInterfaceSelector The interface selector. The client must have 
       
    59 	created one of these first.
       
    60 	@param aPlayerCapabilitiesObserver Returns a pointer to a MPlayerCapabilitiesObserver for this interface, owned by the CPlayerInfoTarget.
       
    61 	@param aPlayerApplicationSettingsObserver Returns a pointer to a MPlayerApplicationSettingsObserver for this interface, owned by the CPlayerInfoTarget
       
    62 	@param aPlayerEventsObserver Returns a pointer to a MPlayerEventsObserver for this interface, owned by the CPlayerInfoTarget
       
    63 	@return A new CPlayerInfoTarget, owned by the interface selector.
       
    64 	*/
       
    65 	IMPORT_C static CPlayerInfoTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector,
       
    66 								       	MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver,
       
    67 										MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver,
       
    68 										MPlayerEventsObserver*& aPlayerEventsObserver,
       
    69 										MPlayerApplicationSettingsNotify& aApplicationSettingNotifier );
       
    70 	
       
    71 	/** Destructor */
       
    72 	IMPORT_C ~CPlayerInfoTarget();
       
    73 
       
    74 
       
    75 
       
    76 private:
       
    77 	/** 
       
    78 	Constructor.
       
    79 	@param aInterfaceSelector The interface selector.
       
    80 	*/
       
    81 	CPlayerInfoTarget(CRemConInterfaceSelector& aInterfaceSelector, MPlayerApplicationSettingsNotify& aApplicationSettingNotifier );
       
    82 
       
    83 	void ConstructL(MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver,
       
    84 							MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver,
       
    85 							MPlayerEventsObserver*& aPlayerEventsObserver );
       
    86 	
       
    87 private: // from CRemConInterfaceBase
       
    88 	TAny* GetInterfaceIf(TUid aUid);
       
    89 
       
    90 private: // from MRemConInterfaceIf
       
    91 	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData, TRemConMessageSubType aMsgSubType);
       
    92 
       
    93 private: 
       
    94 	// Bearer attributes (settings) processing
       
    95 	void ProcessListPlayerApplicationAttributes( TInt aOperationId );
       
    96 	void ProcessGetPlayerApplicationAttributeText( const TDesC8& aData, TInt aOperationId );
       
    97 	void ProcessListPlayerApplicationValues( const TDesC8& aData, TInt aOperationId );
       
    98 	void ProcessGetPlayerApplicationValueText( const TDesC8& aData, TInt aOperationId );
       
    99 	void ProcessGetCurrentPlayerApplicationValue( const TDesC8& aData, TInt aOperationId );
       
   100 	void ProcessSetPlayerApplicationValue( const TDesC8& aData, TInt aOperationId );
       
   101 
       
   102 	// Bearer attributes (settings) API implementation from MPlayerApplicationSettingsObserver
       
   103 	void DoDefineAttributeL(TUint aAttributeID, TDesC8& aAttributeText, RArray<TUint> &aValues, RArray<TPtrC8> &aValueTexts, TUint aInitialValue);
       
   104 	void DoSetAttributeL(TUint aAttributeID, TUint aValue);
       
   105 
       
   106 	// Notifier Events API implementation from MPlayerEventsObserver
       
   107 	void DoPlaybackStatusChanged(TPlaybackStatus aStatus);
       
   108 	void DoTrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds);
       
   109 	void DoTrackReachedEnd();
       
   110 	void DoTrackReachedStart();
       
   111 	void DoSetPlaybackPosition(TUint32 aMilliseconds);	
       
   112 	void DoSetBatteryStatus(TTargetBatteryStatus aBatteryStatus);
       
   113 
       
   114 	// Notifier Events bearer processing  
       
   115 	void ProcessGetPlayStatus();
       
   116 	void ProcessGetStatusAndBeginObserving(TUint aOperationId, TRegisterNotificationEvent aEventId, const TDesC8& aData);
       
   117 	void ProcessGetStatus(TUint aOperationId, TRegisterNotificationEvent aEventId);
       
   118 	void SendNotificationResponse(TRegisterNotificationEvent aEventId, TRemConMessageSubType aMsgSubType);
       
   119 	
       
   120 	// Capabilities API implementation from MPlayerCapabilitiesObserver
       
   121 	void DoClearEvents();
       
   122 	TInt DoAddEvent(TRegisterNotificationEvent aEvent);
       
   123 	TInt DoRemoveEvent(TRegisterNotificationEvent aEvent);
       
   124 	void DoClearCompanyIds();
       
   125 	TInt DoAddCompanyId(TInt aID);
       
   126 	TInt DoRemoveCompanyID(TInt aID);
       
   127 
       
   128 	// Capabilities bearer processing 
       
   129 	void ProcessGetCapabilities( const TDesC8& aData );
       
   130 	
       
   131 	// Miscellaneous
       
   132 	TBool AttributeSettingExists(TUint anAttribute);
       
   133 	TBool IsValidAttributeValue(TUint anAttributeId, TUint aAttributeValue);
       
   134 	TBool AttributeValueCanBeSet(TUint anAttributeId, TUint aAttributeValue);
       
   135 	void SendError(TInt, TInt);
       
   136 	void SendError(TInt, TInt, TRemConMessageSubType aSubType);
       
   137 	CPlayerApplicationSettings* GetSetting(TUint anAttribute);
       
   138 	
       
   139 private: // owned
       
   140 	RBuf8								iOutBuf;
       
   141 
       
   142 	MPlayerApplicationSettingsNotify& 	iApplicationSettingNotifier;
       
   143 		
       
   144 	// data for MPlayerEventsObserver
       
   145 	TPlaybackStatus 					iPlayBackStatus;
       
   146 	TUint64 							iTrackId;
       
   147 	TUint32 							iLengthInMilliseconds;
       
   148 	TPlayPosition						iTrackPosition;
       
   149 	
       
   150 	// The time interval (received as part if the RegisterNotification) 
       
   151 	// in which the change in playback position will be notified
       
   152 	TUint32								iPlayBackIntervalInMilliseconds;
       
   153 
       
   154 	TTargetBatteryStatus				iBatteryStatus;
       
   155 	TUint32 							iPlaybackPositionInMilliseconds;
       
   156 	TUint32								iLastNotifiedPlaybackPositionInMilliseconds;
       
   157 	
       
   158 	// data for MPlayerCapabilitiesObserver
       
   159 	RArray<TRegisterNotificationEvent> 			iSupportedNotificationEventList;
       
   160 	RArray<TInt> 						iCompanyIdList;
       
   161 
       
   162 	// list of events for which notifications have been request 
       
   163 	RArray<TRegisterNotificationEvent> 			iPendingNotificationEventList;
       
   164 
       
   165 	// Attribute (settings) data MPlayerApplicationSettingsObserver
       
   166 	RHashMap<TInt, CPlayerApplicationSettings*>		iPlayerApplicationSettings;
       
   167 
       
   168 	};
       
   169 
       
   170 
       
   171 #endif // REMCONPLAYERINFORMATIONTARGET_H