|
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: Implementation of CSAStubEventListener class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifdef __STARTER_MODULE_TEST_SUPPORT__ |
|
20 |
|
21 #include "sastubeventlistener.h" |
|
22 #include "sastubeventsender.h" |
|
23 #include "startupadaptationstubdebug.h" |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // ?description_if_needed |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CSAStubEventListener::CSAStubEventListener( MSAStubEventSender& aSender ) |
|
32 : CActive( EPriorityStandard ), |
|
33 iSender( aSender ) |
|
34 { |
|
35 CActiveScheduler::Add( this ); |
|
36 } |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // ?description_if_needed |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 void CSAStubEventListener::ConstructL() |
|
43 { |
|
44 RProperty::Define( TUid::Uid( 0x0AA01499 ), 1, 0 ); |
|
45 User::LeaveIfError( iProperty.Attach( TUid::Uid( 0x0AA01499 ), 1 ) ); |
|
46 |
|
47 iProperty.Subscribe( iStatus ); |
|
48 SetActive(); |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // ?description_if_needed |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CSAStubEventListener* CSAStubEventListener::NewL( MSAStubEventSender& aSender ) |
|
56 { |
|
57 CSAStubEventListener* self = new( ELeave ) CSAStubEventListener( aSender ); |
|
58 CleanupStack::PushL( self ); |
|
59 self->ConstructL(); |
|
60 CleanupStack::Pop( self ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // ?description_if_needed |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CSAStubEventListener::~CSAStubEventListener() |
|
69 { |
|
70 Cancel(); |
|
71 |
|
72 iProperty.Close(); |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // From class CActive. |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 void CSAStubEventListener::DoCancel() |
|
80 { |
|
81 iProperty.Cancel(); |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // From class CActive. |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 void CSAStubEventListener::RunL() |
|
89 { |
|
90 if ( iStatus == KErrNone ) |
|
91 { |
|
92 TInt newValue; |
|
93 TInt errorCode = iProperty.Get( newValue ); |
|
94 |
|
95 if ( errorCode == KErrNone ) |
|
96 { |
|
97 RDEBUG_1( _L( "CStartupAdaptationStub: Event: 0x%08x." ), newValue ); |
|
98 |
|
99 iProperty.Set( 0 ); |
|
100 TInt event = newValue & 0xFFFF0000; |
|
101 event = event >> 16; |
|
102 TInt arg = newValue & 0x0000FFFF; |
|
103 |
|
104 iSender.SendEvent( event, arg ); |
|
105 } |
|
106 } |
|
107 |
|
108 if ( iStatus != KErrCancel ) |
|
109 { |
|
110 iProperty.Subscribe( iStatus ); |
|
111 SetActive(); |
|
112 } |
|
113 } |
|
114 |
|
115 #endif // __STARTER_MODULE_TEST_SUPPORT__ |