1 /* |
|
2 * Copyright (c) 2007 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: Monitor for PS Key changes from SysAp ( ME specific ) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <e32property.h> |
|
21 #include <mpxpskeywatcher.h> |
|
22 #include <mpxlog.h> |
|
23 #include "mpxmmcejectmonitor.h" |
|
24 |
|
25 // CONSTANTS |
|
26 const TUid KMmcEjectAppUid = { 0x101FFAFC }; |
|
27 const TUint KKeyMmcEjectOperation = 10; |
|
28 |
|
29 // ======== MEMBER FUNCTIONS ======== |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // Constructor |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 CMPXMMCEjectMonitor::CMPXMMCEjectMonitor( MMPXSystemEventObserver& aObserver ) : |
|
36 iObserver( aObserver ) |
|
37 { |
|
38 |
|
39 } |
|
40 |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // 2nd phased Constructor |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 void CMPXMMCEjectMonitor::ConstructL() |
|
47 { |
|
48 MPX_DEBUG1(_L("CMPXMMCEjectMonitor::ConstructL <---")); |
|
49 |
|
50 iPSKeyWatcher = CMPXPSKeyWatcher::NewL( KMmcEjectAppUid, |
|
51 KKeyMmcEjectOperation, |
|
52 this ); |
|
53 MPX_DEBUG1(_L("CMPXMMCEjectMonitor::ConstructL --->")); |
|
54 } |
|
55 |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // Two-Phase Constructor |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CMPXMMCEjectMonitor* CMPXMMCEjectMonitor::NewL( MMPXSystemEventObserver& aObserver ) |
|
62 { |
|
63 CMPXMMCEjectMonitor* self = new( ELeave ) CMPXMMCEjectMonitor( aObserver ); |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL(); |
|
66 CleanupStack::Pop( self ); |
|
67 return self; |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // Destructor |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 CMPXMMCEjectMonitor::~CMPXMMCEjectMonitor() |
|
75 { |
|
76 delete iPSKeyWatcher; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // Callback when a cenrep key is modified |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void CMPXMMCEjectMonitor::HandlePSEvent( TUid /*aUid*/, TInt /*aKey*/ ) |
|
84 { |
|
85 MPX_DEBUG1(_L("CMPXMMCEjectMonitor::HandlePSEvent <---")); |
|
86 TInt value; |
|
87 iPSKeyWatcher->GetValue( value ); |
|
88 |
|
89 // MMC About to be ejected from power key menu |
|
90 // |
|
91 if( value == 1 ) |
|
92 { |
|
93 TRAP_IGNORE( iObserver.HandleSystemEventL( EPowerKeyEjectEvent, 0 ) ); |
|
94 } |
|
95 MPX_DEBUG1(_L("CMPXMMCEjectMonitor::HandlePSEvent --->")); |
|
96 } |
|
97 |
|
98 // END OF FILE |
|