1 /* |
1 /* |
2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
24 #include <remconcoreapi.h> |
24 #include <remconcoreapi.h> |
25 #include <mediakeysinternalpskeys.h> |
25 #include <mediakeysinternalpskeys.h> |
26 #include <UsbWatcherInternalPSKeys.h> |
26 #include <UsbWatcherInternalPSKeys.h> |
27 #include <usbpersonalityids.h> |
27 #include <usbpersonalityids.h> |
28 #include <PSVariables.h> // Property values |
28 #include <PSVariables.h> // Property values |
|
29 #include <keyguardaccessapi.h> |
29 |
30 |
30 // Include this once it is exported |
31 // Include this once it is exported |
31 // #include <RemConExtensionApi.h> |
32 // #include <RemConExtensionApi.h> |
32 |
33 |
33 #include "MMKeyBearerImplementation.h" |
34 #include "MMKeyBearerImplementation.h" |
72 |
73 |
73 delete iMMKeyBearerObserver; |
74 delete iMMKeyBearerObserver; |
74 delete iMediaKeyObserver; |
75 delete iMediaKeyObserver; |
75 delete iAccessoryVolKeyObserver; |
76 delete iAccessoryVolKeyObserver; |
76 delete iUSBFileTransferObserver; |
77 delete iUSBFileTransferObserver; |
77 iAknServer.Close(); |
78 delete iKeyguardAccess; |
78 } |
79 } |
79 |
80 |
80 // --------------------------------------------------------- |
81 // --------------------------------------------------------- |
81 // CMMKeyBearer::CMMKeyBearer() |
82 // CMMKeyBearer::CMMKeyBearer() |
82 // construction. |
83 // construction. |
83 // --------------------------------------------------------- |
84 // --------------------------------------------------------- |
84 // |
85 // |
85 CMMKeyBearer::CMMKeyBearer(TBearerParams& aParams) |
86 CMMKeyBearer::CMMKeyBearer(TBearerParams& aParams) |
86 : CRemConBearerPlugin(aParams), |
87 : CRemConBearerPlugin(aParams), |
87 iUSBFileTransfer(KUsbWatcherSelectedPersonalityNone), |
88 iUSBFileTransfer(KUsbWatcherSelectedPersonalityNone) |
88 iAknServerConnected(EFalse) |
89 { |
89 { |
90 FUNC_LOG; |
90 FUNC_LOG; |
91 |
91 |
|
92 //Pass |
92 //Pass |
93 } |
93 } |
94 |
94 |
95 // --------------------------------------------------------- |
95 // --------------------------------------------------------- |
96 // CMMKeyBearer::ConstructL() |
96 // CMMKeyBearer::ConstructL() |
103 |
103 |
104 // throw an indication up to RemCon. |
104 // throw an indication up to RemCon. |
105 TRemConAddress addr; |
105 TRemConAddress addr; |
106 addr.BearerUid() = Uid(); |
106 addr.BearerUid() = Uid(); |
107 TInt err = Observer().ConnectIndicate(addr); |
107 TInt err = Observer().ConnectIndicate(addr); |
|
108 iKeyguardAccess = CKeyguardAccessApi::NewL(); |
108 |
109 |
109 // Start Active object for listening key events from P&S |
110 // Start Active object for listening key events from P&S |
110 TRAP_AND_LEAVE( |
111 TRAP_AND_LEAVE( |
111 iMMKeyBearerObserver = CMMKeyBearerObserver::NewL(*this, ESideVolumeKeys), |
112 iMMKeyBearerObserver = CMMKeyBearerObserver::NewL(*this, ESideVolumeKeys), |
112 "Volume key observer init failed" ); |
113 "Volume key observer init failed" ); |
359 |
360 |
360 // Check for keypadlock if the events are from device keypad |
361 // Check for keypadlock if the events are from device keypad |
361 // If events are from accessory device,then do not check for keypadlock |
362 // If events are from accessory device,then do not check for keypadlock |
362 if (aKeyType != EAccessoryVolumeKeys) |
363 if (aKeyType != EAccessoryVolumeKeys) |
363 { |
364 { |
364 TBool keysLocked = EFalse; |
365 |
365 if (!(iAknServerConnected)) // Connect to server for first time |
366 TInt err=iKeyguardAccess->ShowKeysLockedNote(); |
366 { |
367 |
367 if(iAknServer.Connect() == KErrNone) |
368 if (err==KErrNone) |
368 { |
|
369 iAknServerConnected = ETrue; |
|
370 } |
|
371 else // If connection fails, then return |
|
372 { |
|
373 //Start the listener once again |
|
374 if (aKeyType == ESideVolumeKeys) |
|
375 { |
|
376 iMMKeyBearerObserver->Start(); |
|
377 } |
|
378 if (aKeyType == EMediaKeys) |
|
379 { |
|
380 iMediaKeyObserver->Start(); |
|
381 } |
|
382 return ; |
|
383 } |
|
384 } |
|
385 iAknServer.ShowKeysLockedNote(keysLocked); |
|
386 |
|
387 if (keysLocked) |
|
388 { |
369 { |
389 // Device is locked , Discard the key event |
370 // Device is locked , Discard the key event |
390 |
371 |
391 //Start the listener once again |
372 //Start the listener once again |
392 if (aKeyType == ESideVolumeKeys) |
373 if (aKeyType == ESideVolumeKeys) |