1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This class is used to post events to the java. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMMAPLAYEREVENT_H |
|
20 #define CMMAPLAYEREVENT_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "cmmaevent.h" |
|
24 |
|
25 // CLASS DECLARATION |
|
26 /** |
|
27 * This class is used to post events to the java. |
|
28 */ |
|
29 |
|
30 NONSHARABLE_CLASS(CMMAPlayerEvent): public CMMAEvent |
|
31 { |
|
32 public: |
|
33 enum TEventType |
|
34 { |
|
35 EStarted = 0, |
|
36 EStopped = 1, |
|
37 EStoppedAtTime = 2, |
|
38 EEndOfMedia = 3, |
|
39 EDurationUpdated = 4, |
|
40 EAudioDeviceUnavailable = 5, |
|
41 EVolumeChanged = 6, |
|
42 ESizeChanged = 7, |
|
43 EError = 8, |
|
44 EClosed = 9, |
|
45 ERecordStarted = 10, |
|
46 ERecordStopped = 11, |
|
47 EPrivateDataAvailable = 12, |
|
48 EPrivateDataOverwritten = 13, |
|
49 EBufferingStarted = 14, |
|
50 EBufferingEStopped = 15, |
|
51 ERecordError = 16, |
|
52 ENOKIA_EXTERNAL_VOLUME_EVENT = 17, // Event ID for Nokia volume key |
|
53 EAudioOutputPreferenceChangeEvent =18 // Event ID for Audio Routing Preference Change |
|
54 }; |
|
55 |
|
56 private: |
|
57 enum TEventParams |
|
58 { |
|
59 ENormal = 0, // string and object |
|
60 EString, // int and string |
|
61 ELong, // int and long |
|
62 EObject // int and object |
|
63 }; |
|
64 |
|
65 public: |
|
66 /** |
|
67 * Constructor. One of set methods must be called before sending this |
|
68 * event. |
|
69 * @param aNotifyObject Java Objects. |
|
70 * @param aHandleEventMethod Java method. |
|
71 * @param aDisposable Defaults to disposable event. |
|
72 */ |
|
73 CMMAPlayerEvent(jobject aNotifyObject, |
|
74 jmethodID aHandleEventMethod, |
|
75 TDisposability aDisposable = EDisposableEvent); |
|
76 |
|
77 /** |
|
78 * Destructor. |
|
79 */ |
|
80 ~CMMAPlayerEvent(); |
|
81 |
|
82 /** |
|
83 * Sets event data. |
|
84 * @param aEventType Type of the event. |
|
85 * @param aEventData Data to be send to Java |
|
86 */ |
|
87 void SetLongEvent(TEventType aEventType, const TInt64& aEventData); |
|
88 |
|
89 /** |
|
90 * Sets event data. |
|
91 * @param aEventType Type of the event. |
|
92 * @param aEventData Data to be send to Java |
|
93 */ |
|
94 void SetStringEventL(TEventType aEventType, const TDesC& aEventData); |
|
95 |
|
96 /** |
|
97 * Sets event data. |
|
98 * @param aEventType Type of the event. |
|
99 * @param aEventData Data to be send to Java |
|
100 */ |
|
101 void SetObjectEventL(TEventType aEventType, const jobject aEventData); |
|
102 private: // from CJavaEvent |
|
103 void Dispatch(JNIEnv& aJni); |
|
104 |
|
105 private: // Data |
|
106 TEventType iEventType; |
|
107 TEventParams iEventParams; |
|
108 |
|
109 // Used when sending ELong event. |
|
110 TInt64 iLongEventData; |
|
111 |
|
112 // Owned event data. Used when sending EString event. |
|
113 HBufC* iStringEventData; |
|
114 // Owned event type. Used when sending ENormal event. |
|
115 HBufC* iStringEventType; |
|
116 |
|
117 // Used when sending ENormal or EObject event. |
|
118 jobject iObjectEventData; |
|
119 }; |
|
120 |
|
121 #endif // CMMAPLAYEREVENT_H |
|