1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/playerinformationtarget.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,171 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +
1.20 +
1.21 +/**
1.22 + @file
1.23 + @publishedAll
1.24 + @released
1.25 +*/
1.26 +
1.27 +#ifndef REMCONPLAYERINFORMATIONTARGET_H
1.28 +#define REMCONPLAYERINFORMATIONTARGET_H
1.29 +
1.30 +#include <e32base.h>
1.31 +#include <s32mem.h>
1.32 +#include <e32hashtab.h>
1.33 +
1.34 +#include <remcon/remconinterfacebase.h>
1.35 +#include <remcon/remconinterfaceif.h>
1.36 +#include <remcon/avrcpspec.h>
1.37 +#include <playerinformationtargetobserver.h>
1.38 +
1.39 +class CRemConInterfaceSelector;
1.40 +class CPlayerApplicationSettings;
1.41 +
1.42 +// This is the maximum length of the player application setting attribute and value strings
1.43 +const TInt KMaxPlayerApplicationSettingsValue = 255 ;
1.44 +// This is the minimum length of the player application setting attribute and value strings
1.45 +const TInt KMinPlayerApplicationSettingsValue = 1 ;
1.46 +
1.47 +/**
1.48 +Client-instantiable class supporting player information responses.
1.49 +This is the container class for the three interface parts
1.50 +*/
1.51 +NONSHARABLE_CLASS(CPlayerInfoTarget) : public CRemConInterfaceBase,
1.52 + public MRemConInterfaceIf2,
1.53 + private MPlayerCapabilitiesObserver,
1.54 + private MPlayerApplicationSettingsObserver,
1.55 + private MPlayerEventsObserver
1.56 +
1.57 + {
1.58 +public:
1.59 + /**
1.60 + Factory function.
1.61 + @param aInterfaceSelector The interface selector. The client must have
1.62 + created one of these first.
1.63 + @param aPlayerCapabilitiesObserver Returns a pointer to a MPlayerCapabilitiesObserver for this interface, owned by the CPlayerInfoTarget.
1.64 + @param aPlayerApplicationSettingsObserver Returns a pointer to a MPlayerApplicationSettingsObserver for this interface, owned by the CPlayerInfoTarget
1.65 + @param aPlayerEventsObserver Returns a pointer to a MPlayerEventsObserver for this interface, owned by the CPlayerInfoTarget
1.66 + @return A new CPlayerInfoTarget, owned by the interface selector.
1.67 + */
1.68 + IMPORT_C static CPlayerInfoTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector,
1.69 + MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver,
1.70 + MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver,
1.71 + MPlayerEventsObserver*& aPlayerEventsObserver,
1.72 + MPlayerApplicationSettingsNotify& aApplicationSettingNotifier );
1.73 +
1.74 + /** Destructor */
1.75 + IMPORT_C ~CPlayerInfoTarget();
1.76 +
1.77 +
1.78 +
1.79 +private:
1.80 + /**
1.81 + Constructor.
1.82 + @param aInterfaceSelector The interface selector.
1.83 + */
1.84 + CPlayerInfoTarget(CRemConInterfaceSelector& aInterfaceSelector, MPlayerApplicationSettingsNotify& aApplicationSettingNotifier );
1.85 +
1.86 + void ConstructL(MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver,
1.87 + MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver,
1.88 + MPlayerEventsObserver*& aPlayerEventsObserver );
1.89 +
1.90 +private: // from CRemConInterfaceBase
1.91 + TAny* GetInterfaceIf(TUid aUid);
1.92 +
1.93 +private: // from MRemConInterfaceIf
1.94 + void MrcibNewMessage(TUint aOperationId, const TDesC8& aData, TRemConMessageSubType aMsgSubType);
1.95 +
1.96 +private:
1.97 + // Bearer attributes (settings) processing
1.98 + void ProcessListPlayerApplicationAttributes( TInt aOperationId );
1.99 + void ProcessGetPlayerApplicationAttributeText( const TDesC8& aData, TInt aOperationId );
1.100 + void ProcessListPlayerApplicationValues( const TDesC8& aData, TInt aOperationId );
1.101 + void ProcessGetPlayerApplicationValueText( const TDesC8& aData, TInt aOperationId );
1.102 + void ProcessGetCurrentPlayerApplicationValue( const TDesC8& aData, TInt aOperationId );
1.103 + void ProcessSetPlayerApplicationValue( const TDesC8& aData, TInt aOperationId );
1.104 +
1.105 + // Bearer attributes (settings) API implementation from MPlayerApplicationSettingsObserver
1.106 + void DoDefineAttributeL(TUint aAttributeID, TDesC8& aAttributeText, RArray<TUint> &aValues, RArray<TPtrC8> &aValueTexts, TUint aInitialValue);
1.107 + void DoSetAttributeL(TUint aAttributeID, TUint aValue);
1.108 +
1.109 + // Notifier Events API implementation from MPlayerEventsObserver
1.110 + void DoPlaybackStatusChanged(TPlaybackStatus aStatus);
1.111 + void DoTrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds);
1.112 + void DoTrackReachedEnd();
1.113 + void DoTrackReachedStart();
1.114 + void DoSetPlaybackPosition(TUint32 aMilliseconds);
1.115 + void DoSetBatteryStatus(TTargetBatteryStatus aBatteryStatus);
1.116 +
1.117 + // Notifier Events bearer processing
1.118 + void ProcessGetPlayStatus();
1.119 + void ProcessGetStatusAndBeginObserving(TUint aOperationId, TRegisterNotificationEvent aEventId, const TDesC8& aData);
1.120 + void ProcessGetStatus(TUint aOperationId, TRegisterNotificationEvent aEventId);
1.121 + void SendNotificationResponse(TRegisterNotificationEvent aEventId, TRemConMessageSubType aMsgSubType);
1.122 +
1.123 + // Capabilities API implementation from MPlayerCapabilitiesObserver
1.124 + void DoClearEvents();
1.125 + TInt DoAddEvent(TRegisterNotificationEvent aEvent);
1.126 + TInt DoRemoveEvent(TRegisterNotificationEvent aEvent);
1.127 + void DoClearCompanyIds();
1.128 + TInt DoAddCompanyId(TInt aID);
1.129 + TInt DoRemoveCompanyID(TInt aID);
1.130 +
1.131 + // Capabilities bearer processing
1.132 + void ProcessGetCapabilities( const TDesC8& aData );
1.133 +
1.134 + // Miscellaneous
1.135 + TBool AttributeSettingExists(TUint anAttribute);
1.136 + TBool IsValidAttributeValue(TUint anAttributeId, TUint aAttributeValue);
1.137 + TBool AttributeValueCanBeSet(TUint anAttributeId, TUint aAttributeValue);
1.138 + void SendError(TInt, TInt);
1.139 + void SendError(TInt, TInt, TRemConMessageSubType aSubType);
1.140 + CPlayerApplicationSettings* GetSetting(TUint anAttribute);
1.141 +
1.142 +private: // owned
1.143 + RBuf8 iOutBuf;
1.144 +
1.145 + MPlayerApplicationSettingsNotify& iApplicationSettingNotifier;
1.146 +
1.147 + // data for MPlayerEventsObserver
1.148 + TPlaybackStatus iPlayBackStatus;
1.149 + TUint64 iTrackId;
1.150 + TUint32 iLengthInMilliseconds;
1.151 + TPlayPosition iTrackPosition;
1.152 +
1.153 + // The time interval (received as part if the RegisterNotification)
1.154 + // in which the change in playback position will be notified
1.155 + TUint32 iPlayBackIntervalInMilliseconds;
1.156 +
1.157 + TTargetBatteryStatus iBatteryStatus;
1.158 + TUint32 iPlaybackPositionInMilliseconds;
1.159 + TUint32 iLastNotifiedPlaybackPositionInMilliseconds;
1.160 +
1.161 + // data for MPlayerCapabilitiesObserver
1.162 + RArray<TRegisterNotificationEvent> iSupportedNotificationEventList;
1.163 + RArray<TInt> iCompanyIdList;
1.164 +
1.165 + // list of events for which notifications have been request
1.166 + RArray<TRegisterNotificationEvent> iPendingNotificationEventList;
1.167 +
1.168 + // Attribute (settings) data MPlayerApplicationSettingsObserver
1.169 + RHashMap<TInt, CPlayerApplicationSettings*> iPlayerApplicationSettings;
1.170 +
1.171 + };
1.172 +
1.173 +
1.174 +#endif // REMCONPLAYERINFORMATIONTARGET_H