|
1 /* |
|
2 * Copyright (c) 2006 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: AO for observing events within a rendering session |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #include "upnpaveventactive.h" |
|
24 |
|
25 #include "upnpavcontrollerclient.h" |
|
26 #include "upnpavrenderingsessionimpl.h" |
|
27 |
|
28 _LIT( KComponentLogfile, "upnpavcontrollerclient.txt"); |
|
29 #include "upnplog.h" |
|
30 |
|
31 // ======== MEMBER FUNCTIONS ======== |
|
32 |
|
33 // -------------------------------------------------------------------------- |
|
34 // CUPnPAVEventActive::NewL |
|
35 // See upnpeventactive.h |
|
36 // -------------------------------------------------------------------------- |
|
37 CUPnPAVEventActive* CUPnPAVEventActive::NewL( |
|
38 RUPnPAVControllerClient& aServer, |
|
39 CUPnPAVRenderingSessionImpl& aObserver ) |
|
40 { |
|
41 CUPnPAVEventActive* self = new (ELeave) CUPnPAVEventActive( |
|
42 aServer, aObserver ); |
|
43 CleanupStack::PushL( self ); |
|
44 self->ConstructL(); |
|
45 CleanupStack::Pop( self ); |
|
46 return self; |
|
47 } |
|
48 |
|
49 // -------------------------------------------------------------------------- |
|
50 // CUPnPAVEventActive::CUPnPAVEventActive |
|
51 // See upnpeventactive.h |
|
52 // -------------------------------------------------------------------------- |
|
53 CUPnPAVEventActive::CUPnPAVEventActive( |
|
54 RUPnPAVControllerClient& aServer, |
|
55 CUPnPAVRenderingSessionImpl& aObserver ): |
|
56 CActive( EPriorityStandard ), |
|
57 iServer( aServer ), |
|
58 iEventPkg( iEvent ), |
|
59 iObserver( aObserver ) |
|
60 { |
|
61 CActiveScheduler::Add( this ); |
|
62 } |
|
63 |
|
64 // -------------------------------------------------------------------------- |
|
65 // CUPnPAVEventActive::~CUPnPAVEventActive |
|
66 // See upnpeventactive.h |
|
67 // -------------------------------------------------------------------------- |
|
68 CUPnPAVEventActive::~CUPnPAVEventActive() |
|
69 { |
|
70 __LOG( "CUPnPAVEventActive::~CUPnPAVEventActive" ); |
|
71 |
|
72 Cancel(); |
|
73 } |
|
74 |
|
75 // -------------------------------------------------------------------------- |
|
76 // CUPnPAVEventActive::ConstructL |
|
77 // See upnpeventactive.h |
|
78 // -------------------------------------------------------------------------- |
|
79 void CUPnPAVEventActive::ConstructL() |
|
80 { |
|
81 __LOG( "CUPnPAVEventActive::ConstructL" ); |
|
82 } |
|
83 |
|
84 // -------------------------------------------------------------------------- |
|
85 // CUPnPAVEventActive::RunL |
|
86 // See upnpeventactive.h |
|
87 // -------------------------------------------------------------------------- |
|
88 void CUPnPAVEventActive::RunL() |
|
89 { |
|
90 __LOG2( "CUPnPAVEventActive::RunL, status: %d, event: %d", |
|
91 iStatus.Int(), iEvent ); |
|
92 // An event received |
|
93 TInt status = iStatus.Int(); |
|
94 TUnsolicitedEventC event = iEvent; |
|
95 |
|
96 if( status == KErrNone ) |
|
97 { |
|
98 iServer.EventRequest( iEventPkg, iId, iStatus ); |
|
99 SetActive(); |
|
100 } |
|
101 |
|
102 iObserver.EventReceived( status, event ); |
|
103 } |
|
104 |
|
105 // -------------------------------------------------------------------------- |
|
106 // CUPnPAVEventActive::DoCancel |
|
107 // See upnpeventactive.h |
|
108 // -------------------------------------------------------------------------- |
|
109 void CUPnPAVEventActive::DoCancel() |
|
110 { |
|
111 iServer.CancelEventRequest( iId ); |
|
112 } |
|
113 |
|
114 // -------------------------------------------------------------------------- |
|
115 // CUPnPAVEventActive::RunError |
|
116 // See upnpeventactive.h |
|
117 // -------------------------------------------------------------------------- |
|
118 TInt CUPnPAVEventActive::RunError( TInt /*aError*/ ) |
|
119 { |
|
120 return KErrNone; |
|
121 } |
|
122 |
|
123 // -------------------------------------------------------------------------- |
|
124 // CUPnPAVEventActive::StartListeningEvents |
|
125 // See upnpeventactive.h |
|
126 // -------------------------------------------------------------------------- |
|
127 void CUPnPAVEventActive::StartListeningEvents( TInt aId ) |
|
128 { |
|
129 __ASSERTD( !IsActive(), __FILE__, __LINE__ ); |
|
130 iId = aId; |
|
131 iServer.EventRequest( iEventPkg, aId, iStatus ); |
|
132 SetActive(); |
|
133 } |
|
134 |
|
135 // end of file |