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