epoc32/include/mw/playerinformationtarget.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 "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  @file
    18  @publishedAll
    19  @released
    20 */
    21 
    22 #ifndef REMCONPLAYERINFORMATIONTARGET_H
    23 #define REMCONPLAYERINFORMATIONTARGET_H
    24 
    25 #include <e32base.h>
    26 #include <s32mem.h>
    27 #include <e32hashtab.h>
    28 
    29 #include <remcon/remconinterfacebase.h>
    30 #include <remcon/remconinterfaceif.h>
    31 #include <remcon/avrcpspec.h>
    32 #include <playerinformationtargetobserver.h>
    33 
    34 class CRemConInterfaceSelector;
    35 class CPlayerApplicationSettings;
    36 class TEventsMask;
    37 
    38 // This is the maximum length of the player application setting attribute and value strings
    39 const TInt KMaxPlayerApplicationSettingsValue = 255 ;
    40 // This is the minimum length of the player application setting attribute and value strings
    41 const TInt KMinPlayerApplicationSettingsValue = 1 ;
    42 
    43 /**
    44 Client-instantiable class supporting player information responses.
    45 This is the container class for the three interface parts
    46 */
    47 NONSHARABLE_CLASS(CPlayerInfoTarget) : 	public CRemConInterfaceBase,
    48 								       	public MRemConInterfaceIf2, 
    49 								       	private MPlayerCapabilitiesObserver,
    50 										private MPlayerApplicationSettingsObserver,
    51 										private MPlayerEventsObserver
    52 								           
    53 	{
    54 public:
    55 	/**
    56 	Factory function.
    57 	@param aInterfaceSelector The interface selector. The client must have 
    58 	created one of these first.
    59 	@param aPlayerCapabilitiesObserver Returns a pointer to a MPlayerCapabilitiesObserver for this interface, owned by the CPlayerInfoTarget.
    60 	@param aPlayerApplicationSettingsObserver Returns a pointer to a MPlayerApplicationSettingsObserver for this interface, owned by the CPlayerInfoTarget
    61 	@param aPlayerEventsObserver Returns a pointer to a MPlayerEventsObserver for this interface, owned by the CPlayerInfoTarget
    62 	@return A new CPlayerInfoTarget, owned by the interface selector.
    63 	*/
    64 	IMPORT_C static CPlayerInfoTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector,
    65 								       	MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver,
    66 										MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver,
    67 										MPlayerEventsObserver*& aPlayerEventsObserver,
    68 										MPlayerApplicationSettingsNotify& aApplicationSettingNotifier );
    69 	
    70 	/** Destructor */
    71 	IMPORT_C ~CPlayerInfoTarget();
    72 
    73 
    74 
    75 private:
    76 	/** 
    77 	Constructor.
    78 	@param aInterfaceSelector The interface selector.
    79 	*/
    80 	CPlayerInfoTarget(CRemConInterfaceSelector& aInterfaceSelector, MPlayerApplicationSettingsNotify& aApplicationSettingNotifier );
    81 
    82 	void ConstructL(MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver,
    83 							MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver,
    84 							MPlayerEventsObserver*& aPlayerEventsObserver );
    85 	
    86 private: // from CRemConInterfaceBase
    87 	TAny* GetInterfaceIf(TUid aUid);
    88 
    89 private: // from MRemConInterfaceIf
    90 	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData, TRemConMessageSubType aMsgSubType);
    91 
    92 private: 
    93 	// Bearer attributes (settings) processing
    94 	void ProcessListPlayerApplicationAttributes( TInt aOperationId );
    95 	void ProcessGetPlayerApplicationAttributeText( const TDesC8& aData, TInt aOperationId );
    96 	void ProcessListPlayerApplicationValues( const TDesC8& aData, TInt aOperationId );
    97 	void ProcessGetPlayerApplicationValueText( const TDesC8& aData, TInt aOperationId );
    98 	void ProcessGetCurrentPlayerApplicationValue( const TDesC8& aData, TInt aOperationId );
    99 	void ProcessSetPlayerApplicationValue( const TDesC8& aData, TInt aOperationId );
   100 
   101 	// Bearer attributes (settings) API implementation from MPlayerApplicationSettingsObserver
   102 	void DoDefineAttributeL(TUint aAttributeID, TDesC8& aAttributeText, RArray<TUint> &aValues, RArray<TPtrC8> &aValueTexts, TUint aInitialValue);
   103 	void DoSetAttributeL(TUint aAttributeID, TUint aValue);
   104 
   105 	// Notifier Events API implementation from MPlayerEventsObserver
   106 	void DoPlaybackStatusChanged(TPlaybackStatus aStatus);
   107 	void DoTrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds);
   108 	void DoTrackReachedEnd();
   109 	void DoTrackReachedStart();
   110 	void DoSetPlaybackPosition(TUint32 aMilliseconds);	
   111 	void DoSetBatteryStatus(TTargetBatteryStatus aBatteryStatus);
   112 
   113 	// Notifier Events bearer processing  
   114 	void ProcessGetPlayStatus();
   115 	void ProcessGetStatusAndBeginObserving(TUint aOperationId, TRegisterNotificationEvent aEventId, const TDesC8& aData);
   116 	void ProcessGetStatus(TUint aOperationId, TRegisterNotificationEvent aEventId);
   117 	void SendNotificationResponse(TRegisterNotificationEvent aEventId, TRemConMessageSubType aMsgSubType);
   118 	void ProcessGetPlayStatusUpdate(const TDesC8& aData);
   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 	MPlayerEventsObserver::TTargetBatteryStatus DetectBatteryStatus();
   139 
   140 private: // owned
   141 	RBuf8								iOutBuf;
   142 
   143 	MPlayerApplicationSettingsNotify& 	iApplicationSettingNotifier;
   144 		
   145 	// data for MPlayerEventsObserver
   146 	TPlaybackStatus 					iPlayBackStatus;
   147 	TUint64 							iTrackId;
   148 	TUint32 							iLengthInMilliseconds;
   149 	TPlayPosition						iTrackPosition;
   150 	
   151 	// The time interval (received as part if the RegisterNotification) 
   152 	// in which the change in playback position will be notified
   153 	TUint32   							iPlayBackIntervalInMilliseconds;
   154 
   155 	TTargetBatteryStatus				iBatteryStatus;
   156 	TUint32 							iPlaybackPositionInMilliseconds;
   157 	TUint32								iLastNotifiedPlaybackPositionInMilliseconds;
   158 	
   159 	// data for MPlayerCapabilitiesObserver
   160 	TEventsMask*						iSupportedNotificationEventList;
   161 	RArray<TInt> 						iCompanyIdList;
   162 
   163 	// list of events for which notifications have been request 
   164 	RArray<TRegisterNotificationEvent> 			iPendingNotificationEventList;
   165 	
   166 	// Whether we've been asked for an update when the play status changes
   167 	TBool								iPlaybackStatusUpdatePending;
   168 
   169 	// Attribute (settings) data MPlayerApplicationSettingsObserver
   170 	RHashMap<TInt, CPlayerApplicationSettings*>		iPlayerApplicationSettings;
   171 
   172 	};
   173 
   174 
   175 #endif // REMCONPLAYERINFORMATIONTARGET_H