--- a/bluetoothengine/bthid/bthidserver/src/bthidserver.cpp Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/bthid/bthidserver/src/bthidserver.cpp Mon Jun 21 15:51:46 2010 +0300
@@ -101,7 +101,7 @@
delete iHidSdpClient;
- RProperty::Delete( KPSUidBthidSrv, KBTMouseCursorState );
+
}
CBTHidServer* CBTHidServer::NewL()
@@ -210,13 +210,8 @@
}
TRACE_INFO(_L("[BTHID]\tCBTHidServer::ConstructL(): Starting the server"));
-
- User::LeaveIfError( RProperty::Define( KPSUidBthidSrv,
- KBTMouseCursorState,
- RProperty::EInt,
- KBTHIDPSKeyReadPolicy,
- KBTHIDPSKeyWritePolicy) );
-
+
+
StartL(KBTHidSrvName);
iActiveState = EFalse;
--- a/bluetoothengine/bthid/common/inc/bthidPsKey.h Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/bthid/common/inc/bthidPsKey.h Mon Jun 21 15:51:46 2010 +0300
@@ -20,7 +20,9 @@
#ifndef BTHIDPSKEY_H_
#define BTHIDPSKEY_H_
-const TUid KPSUidBthidSrv = {0x2001E301};
+
+
+const TUid KPSUidBthidSrv = { 0x2001FE5C };
const TUint KBTMouseCursorState = 0x00000001;
--- a/bluetoothengine/bthid/keyboard/group/keyboard.mmp Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/bthid/keyboard/group/keyboard.mmp Mon Jun 21 15:51:46 2010 +0300
@@ -22,7 +22,7 @@
TARGETTYPE PLUGIN
UID ECOM_UID KEYBOARD_UID
-CAPABILITY CAP_APPLICATION
+CAPABILITY CAP_APPLICATION CommDD ProtServ
VENDORID VID_DEFAULT
USERINCLUDE ../inc
@@ -60,4 +60,5 @@
LIBRARY apgrfx.lib
LIBRARY apparc.lib
LIBRARY bthidsettings.lib
+//LIBRARY avkon.lib
DEBUGLIBRARY flogger.lib
--- a/bluetoothengine/bthid/keyboard/inc/keyboard.h Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/bthid/keyboard/inc/keyboard.h Mon Jun 21 15:51:46 2010 +0300
@@ -22,14 +22,12 @@
#include <e32std.h>
#include <w32std.h>
#include <e32event.h>
+//#include <aknkeylock.h>
#include "hidinterfaces.h"
#include "hidkeys.h"
#include "layoutmgr.h"
#include "timeoutnotifier.h"
-#include <e32msgqueue.h>
-#include <e32cmn.h>
-#include "pointmsgqueue.h"
#include "bthidsettings.h"
class CField;
@@ -67,16 +65,6 @@
KNumInputFieldTypes
};
- // The types of keyboard input report fields that we handle:
- enum TMouseFieldType
- {
- EMouseButtons = 0,
- EMouseXY = 1,
- EMouseWheel = 2,
- EMouseMediaKeys = 3,
- EMousePowerKeys = 4,
- KMouseInputFieldTypes
- };
public:
// Constructors and destructor
/*!
@@ -210,14 +198,6 @@
// Handles the states of the modifier keys
void UpdateModifiers(TInt aFieldIndex, const TDesC8& aReport);
- // Handles the states of the XY (mouse up, down, left, right)
- void UpdateXY(TInt aFieldIndex, const TDesC8& aReport);
-
- // Handles the states of the Buttons (left & right button)
- void UpdateButtons(TInt aFieldIndex, const TDesC8& aReport);
-
- // Handles the states of the wheel
- void UpdateWheel(TInt aFieldIndex, const TDesC8& aReport);
// Handle key presses
void ProcessKeys(TInt aFieldIndex, const TDesC8& aReport);
@@ -265,12 +245,18 @@
void LaunchApplicationL(TInt aAppUid);
// Checks if multimedia-key (play,stop,..) and sends to RemCon
- TBool HandleMultimediaKeys(TUint16 aScancodeKey, TBool aIsKeyDown,
+ TBool HandleKeyMapping(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
+ TUint8 aModifiers);
+ TBool HandleKeyMappingUp(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
+ TUint8 aModifiers);
+ TBool HandleKeyMappingDown(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
TUint8 aModifiers);
- TBool HandleMultimediaKeysForNokia(TUint16 aScancodeKey,
- TBool aIsKeyDown, TUint8 aModifiers);
- TBool HandleMultimediaKeysForStandard(TUint16 aScancodeKey,
- TBool aIsKeyDown, TUint8 aModifiers);
+ TBool HandleKeyMappingLeft(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
+ TUint8 aModifiers);
+ TBool HandleKeyMappingRight(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
+ TUint8 aModifiers);
+ TBool HandleKeyMappingOther(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
+ TUint8 aModifiers);
TInt AppMenuId();
TInt PhoneAppId();
@@ -281,12 +267,23 @@
// bitmap for Multimedia key states
enum TMmKeyDown
{
- EVolUp = 1,
- EVolDown = 2,
- EPlay = 4,
- EStop = 8,
- ENext = 16,
- EPrev = 32
+ ENone = 0x00,
+ EVolUp = 0x01,
+ EVolDown = 0x02,
+ EPlay = 0x04,
+ EStop = 0x08,
+ ENext = 0x10,
+ EPrev = 0x20,
+ };
+
+ // bitmap for navigation keys
+ enum TNavKeyDown
+ {
+ ELsk = 0x01,
+ ERsk = 0x02,
+ ESend = 0x04,
+ EEnd = 0x08,
+ EEsc = 0x10
};
void ResetBitmap(TBool aIsKeyDown, TMmKeyDown aBitmapToReset);
@@ -302,17 +299,10 @@
// ----------------------------------------
static TInt ResetArrayToSize(RArray<TInt>& aArray, TInt aSize);
- void MoveCursor(const TPoint& aPoint);
- TInt PostPointer(const TPoint& aPoint);
- TInt SendButtonEvent(TBool aButtonDown);
TBool IsDigitKey(TInt aScanCode);
TBool IsSpecialHandleKey(TInt aUniCode);
- void LaunchApplicationL(const TDesC& aName);
-
- //Redraw cursor
- void CursorRedraw();
private:
TKeyboardDriverState iDriverState;
@@ -333,9 +323,6 @@
// various types of key:
const CField* iField[KNumInputFieldTypes];
- // Pointers to the fields in the report descriptor containing the
- // various types of key:
- const CField* iMouseField[KMouseInputFieldTypes];
// Pointer to the field in the report descriptor containing the LEDs:
const CField* iLedField;
@@ -371,13 +358,9 @@
// This timer stops key repeating after defined time to prevent endless key repeats in error cases. Fix for EMKD-7FBB9H
CTimeOutTimer* iRepeatEndTimer;
-
- TBool iComboDevice;
-
- RMsgQueue<TPointBuffer> iPointBufQueue;
- TPointBuffer iPointerBuffer;
- TBool iButtonDown;
- TBool iButton2Down;
+
+ TUint8 iNavKeyDown;
+// RAknKeyLock iKeyLock;
};
// ----------------------------------------------------------------------
--- a/bluetoothengine/bthid/keyboard/src/keyboard.cpp Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/bthid/keyboard/src/keyboard.cpp Mon Jun 21 15:51:46 2010 +0300
@@ -23,8 +23,8 @@
#include <eiksvdef.h>
#include <apgcli.h>
#include <apgtask.h>
-#include <apacmdln.h>
-#include <e32property.h>
+#include <e32keys.h>
+#include <avkondomainpskeys.h>
#include "hidtranslate.h"
#include "finder.h"
@@ -52,7 +52,28 @@
const TInt KKeyRepeatDelay = 500000;
const TInt KKeyRepeatInterval = 75000;
-_LIT(KAppName, "PaintCursor.exe");
+
+// The bitmap of modifier byte is defined in the HID spec.
+// 8.3 Report Format for Array Items (HID1_11.pdf p56)
+//
+// bit description mask
+// -------------------------
+// 0 LEFT CTRL = 0x01
+// 1 LEFT SHIFT = 0x02
+// 2 LEFT ALT = 0x04
+// 3 LEFT GUI = 0x08
+// 4 RIGHT CTRL = 0x10
+// 5 RIGHT SHIFT = 0x20
+// 6 RIGHT ALT = 0x40
+// 7 RIGHT GUI = 0x80
+
+const TUint KHidModifierCtrl = 0x01;
+const TUint KHidModifierCtrlRight = 0x10;
+const TUint KHidModifierAlt = 0x04;
+const TUint KHidModifierAltRight = 0x40;
+const TUint KHidModifierShift = 0x02;
+const TUint KHidModifierShiftRight = 0x20;
+
//----------------------------------------------------------------------------
// CHidKeyboardDriver::CHidKeyboardDriver
//----------------------------------------------------------------------------
@@ -112,9 +133,12 @@
iPhoneAppId = PhoneAppId();
iIdleAppId = IdleAppId();
- iComboDevice = EFalse;
-
iSettings = CBtHidSettings::NewL();
+
+ // create a keylock session
+/* TInt err = iKeyLock.Connect();
+ TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::ConstructL: key lock err = %d"), err));
+ User::LeaveIfError(err); */
}
//----------------------------------------------------------------------------
@@ -136,58 +160,12 @@
iKeys[i].Reset();
}
- iPointBufQueue.Close();
-
- if (iComboDevice)
- {
- RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorNotInitialized );
- }
-
if (iSettings)
delete iSettings;
+
+// iKeyLock.Close();
}
-void CHidKeyboardDriver::MoveCursor(const TPoint& aPoint)
- {
- DBG(RDebug::Print(
- _L("CHidKeyboard::MoveCursor")));
-
- PostPointer(aPoint);
- }
-// ---------------------------------------------------------------------------
-// CHidMouseDriver::PostPointer
-// Save the event to the buffer
-// ---------------------------------------------------------------------------
-//
-TInt CHidKeyboardDriver::PostPointer(const TPoint& aPoint)
- {
- DBG(RDebug::Print(_L("CHidKeyboard::PostPointer")));
- iPointerBuffer.iPoint[iPointerBuffer.iNum] = aPoint;
- iPointerBuffer.iType[iPointerBuffer.iNum] = KBufferPlainPointer;
- iPointerBuffer.iNum++;
- TInt ret = KErrNone;
-
- if (iPointerBuffer.iNum > KPMaxEvent)
- {
- ret = iPointBufQueue.Send(iPointerBuffer);
- iPointerBuffer.iNum = 0;
- }
- return ret;
- }
-
-TInt CHidKeyboardDriver::SendButtonEvent(TBool aButtonDown)
- {
- DBG(RDebug::Print(
- _L("CHidKeyboard::SendButtonEvent")));
- iPointerBuffer.iPoint[iPointerBuffer.iNum] = TPoint(0, 0);
- iPointerBuffer.iType[iPointerBuffer.iNum] = aButtonDown
- ? KBufferPenDown
- : KBufferPenUp;
- iPointerBuffer.iNum++;
- TInt ret = iPointBufQueue.Send(iPointerBuffer);
- iPointerBuffer.iNum = 0;
- return ret;
- }
//----------------------------------------------------------------------------
// CHidKeyboardDriver:::StartL
//----------------------------------------------------------------------------
@@ -196,6 +174,7 @@
{
TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::StartL")));
aConnectionId = aConnectionId;
+
// No keys are pressed:
iModifiers = 0;
for (TInt i = 0; i < KNumInputFieldTypes; ++i)
@@ -233,25 +212,10 @@
//Used the layoutID from CenRep
iLayoutMgr.SetLayout(iLastSelectedLayout);
}
- TInt err = iPointBufQueue.OpenGlobal(KMsgBTMouseBufferQueue);
- if (err == KErrNotFound)
- {
- User::LeaveIfError(iPointBufQueue.CreateGlobal(KMsgBTMouseBufferQueue, KPointQueueLen));
- }
- else
- {
- User::LeaveIfError( err );
- }
// Ready to process keyboard events:
iDriverState = EInitialised;
- if (iComboDevice)
- {
- LaunchApplicationL(KAppName);
- RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorShow );
- }
-
}
//----------------------------------------------------------------------------
@@ -286,41 +250,6 @@
{
iDriverState = EDisabled;
CancelAllKeys();
- if (iComboDevice)
- {
- RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorNotInitialized );
- }
- }
-
-//----------------------------------------------------------------------------
-// CHidMouseDriver::LaunchApplicationL
-//----------------------------------------------------------------------------
-//
-void CHidKeyboardDriver::LaunchApplicationL(const TDesC& aName)
- {
- //Check if application is already running in the background
- TApaTaskList tasks(iWsSession);
- TApaTask task = tasks.FindApp(aName);
- if (task.Exists())
- {
- // Application is active, so just bring to foreground
- }
- else
- {
- // If application is not running, then create a new one
- CApaCommandLine* cmd = CApaCommandLine::NewLC();
- cmd->SetExecutableNameL(aName);
- cmd->SetCommandL(EApaCommandBackground); // EApaCommandRun
-
- RApaLsSession arcSession;
- //connect to AppArc server
- User::LeaveIfError(arcSession.Connect());
- CleanupClosePushL(arcSession);
- User::LeaveIfError(arcSession.StartApp(*cmd));
- arcSession.Close();
- CleanupStack::PopAndDestroy(2);
- }
-
}
// ----------------------------------------------------------------------
@@ -339,21 +268,6 @@
case CHidTransport::EHidChannelInt:
if (EInitialised == iDriverState)
{
- if (iComboDevice)
- {
- TInt mouseStatus;
- TInt err = RProperty::Get( KPSUidBthidSrv, KBTMouseCursorState, mouseStatus );
- if ( !err &&
- ((static_cast<THidMouseCursorState>(mouseStatus) == ECursorRedraw)||
- (static_cast<THidMouseCursorState>(mouseStatus) == ECursorReset)) )
- {
- err = RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorShow );
- DBG(RDebug::Print(
- _L("[BTHID]\tCHidKeyboardDriver::DataIn() ECursorRedraw ||ECursorReset ")) );
- }
-
- CursorRedraw();
- }
InterruptData(aPayload);
}
break;
@@ -386,127 +300,6 @@
Stop();
}
-void CHidKeyboardDriver::UpdateXY(TInt aFieldIndex, const TDesC8& aReport)
- {
- // DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateModifiers()")));
-
- // Translate the HID usage values into a boot protocol style
- // modifier bitmask:
- //
- TReportTranslator report(aReport, iMouseField[aFieldIndex]);
-
- TInt Xvalue = 0;
- TInt Yvalue = 0;
-
- TInt errX = report.GetValue(Xvalue, EGenericDesktopUsageX);
- TInt errY = report.GetValue(Yvalue, EGenericDesktopUsageY);
-
- DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateXY (%d,%d)"), Xvalue, Yvalue));
- if ((Xvalue != 0) || (Yvalue != 0))
- {
- MoveCursor(TPoint(Xvalue, Yvalue));
- }
- }
-
-void CHidKeyboardDriver::UpdateWheel(TInt aFieldIndex, const TDesC8& aReport)
- {
- TReportTranslator report(aReport, iMouseField[aFieldIndex]);
-
- TInt Yvalue = 0;
-
- TInt errY = report.GetValue(Yvalue, EGenericDesktopUsageWheel);
- DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateWheel (%d)"), Yvalue));
- TInt absValue(Abs(Yvalue));
- if ((errY == KErrNone) && (absValue >= 1))
- {
- TRawEvent rawEvent;
- for (TInt ii = 0; ii < absValue; ii++)
- {
- rawEvent.Set(TRawEvent::EKeyDown,
- (Yvalue > 0) ? EStdKeyUpArrow : EStdKeyDownArrow);
- UserSvr::AddEvent(rawEvent);
- rawEvent.Set(TRawEvent::EKeyUp,
- (Yvalue > 0) ? EStdKeyUpArrow : EStdKeyDownArrow);
- UserSvr::AddEvent(rawEvent);
- }
- }
- DBG(RDebug::Print(_L("[HID]\t new iModifiers = %02x"), iModifiers));
- }
-
-void CHidKeyboardDriver::UpdateButtons(TInt aFieldIndex,
- const TDesC8& aReport)
- {
- DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateButtons()")));
- // Translate the HID usage values into a boot protocol style
- // modifier bitmask:
- //
- const TInt KButton1 = 1;
- const TInt KButton2 = 2;
- const TInt KButton3 = 3;
-
- TBool buttonPressed(EFalse);
-
- DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateButtons() %d, %d, %d"),
- iMouseField[aFieldIndex]->UsagePage(),
- iMouseField[aFieldIndex]->UsageMin(),
- iMouseField[aFieldIndex]->UsageMax()));
- (void) aFieldIndex;
- // Hack but works
- // We dont come here if the report is wrong?
- TInt buttonByte = aReport[1];
- if (KButton1 == buttonByte)
- {
- DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateButtons() Button1")));
- buttonPressed = ETrue;
- }
-
- if (KButton2 == buttonByte)
- {
- DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateButtons() Button2")));
- if (!iButton2Down)
- {
- iButton2Down = ETrue;
- TRawEvent rawEvent;
- rawEvent.Set(TRawEvent::EKeyDown, EStdKeyApplication0);
- CursorRedraw();
- UserSvr::AddEvent(rawEvent);
- }
- }
- else
- {
- if (iButton2Down)
- {
- iButton2Down = EFalse;
- TRawEvent rawEvent;
- rawEvent.Set(TRawEvent::EKeyUp, EStdKeyApplication0);
- CursorRedraw();
- UserSvr::AddEvent(rawEvent);
- }
- }
-
- if (KButton3 == buttonByte)
- {
- DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver::UpdateButtons() Button3")));
- buttonPressed = ETrue;
- }
-
- if (buttonPressed)
- {
- if (!iButtonDown)
- {
- iButtonDown = ETrue;
- SendButtonEvent(ETrue);//Send Mouse Button Down
- }
- }
- else
- {
- if (iButtonDown)
- {
- iButtonDown = EFalse;
- SendButtonEvent(EFalse); //Send Mouse Button Up
- }
- }
- }
//----------------------------------------------------------------------------
// CHidKeyboardDriver::InterruptData
//----------------------------------------------------------------------------
@@ -531,30 +324,6 @@
ii, nextByte));
}
#endif
- TBool mouseEvent(EFalse);
- if (iMouseField[EMouseXY] && iMouseField[EMouseXY]->IsInReport(firstByte))
- {
- UpdateXY(EMouseXY, aPayload);
- mouseEvent = ETrue;
- }
-
- if (iMouseField[EMouseButtons] && iMouseField[EMouseButtons]->IsInReport(
- firstByte))
- {
- UpdateButtons(EMouseButtons, aPayload);
- mouseEvent = ETrue;
- }
- if (iMouseField[EMouseXY] && iMouseField[EMouseXY]->IsInReport(firstByte))
- {
- UpdateWheel(EMouseWheel, aPayload);
- mouseEvent = ETrue;
- }
- DBG(RDebug::Print(_L("[HID]\tCHidKeyboardDriver::InterruptData() mouseevent %d"),
- mouseEvent));
- if (mouseEvent)
- {
- return;
- }
// First check for any rollover errors:
//
TInt i;
@@ -758,8 +527,7 @@
//check if the key is multimedia key that needs to be sent as RawEvent and send it.
// if key event is consumed don't send it anymore.
- if (!HandleMultimediaKeys(decodedKeys.iScanCode, aIsKeyDown,
- iModifiers)) //check if the key is multimedia key that needs to be sent as RawEvent and send it.
+ if (!HandleKeyMapping(decodedKeys, aIsKeyDown, iModifiers))
{
if (decodedKeys.iScanCode != EStdKeyNull)
{
@@ -778,7 +546,8 @@
//Send key codes differently to idle app
if ((IsDigitKey(decodedKeys.iScanCode) || IsSpecialHandleKey(
unikey) || decodedKeys.iScanCode == EStdKeyYes
- || decodedKeys.iScanCode == EStdKeyBackspace)
+ || decodedKeys.iScanCode == EStdKeyBackspace
+ || decodedKeys.iScanCode == EStdKeyNo)
&& IsPhoneAppTopMost())
{
TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::KeyEvent: Send event %c to idle editor"), unikey));
@@ -1523,18 +1292,6 @@
{
valid = KErrNone;
}
-
- TMouseFinder mousefinder;
- search.SearchL(aReportRoot, &mousefinder);
- iMouseField[EMouseButtons] = mousefinder.ButtonsField();
- iMouseField[EMouseXY] = mousefinder.XYField();
- iMouseField[EMouseWheel] = mousefinder.WheelField();
-
- if ((iMouseField[EMouseButtons] != 0) && (iMouseField[EMouseXY] != 0))
- {
- iComboDevice = ETrue;
- }
-
TRACE_INFO( (
_L("CHidKeyboard::CanHandleReport() returning %d"), valid));
@@ -1674,17 +1431,589 @@
//----------------------------------------------------------------------------
//
-TBool CHidKeyboardDriver::HandleMultimediaKeys(TUint16 aScancodeKey,
- TBool aIsKeyDown, TUint8 aHIDModifiers)
+TBool CHidKeyboardDriver::HandleKeyMapping(TDecodedKeyInfo& aKey,
+ TBool aIsKeyDown,
+ TUint8 aHIDModifiers)
+ {
+ TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleKeyMapping")));
+
+ TBool ret = EFalse;
+
+ switch (aKey.iScanCode)
+ {
+ case EStdKeyUpArrow:
+ {
+ ret = HandleKeyMappingUp(aKey, aIsKeyDown, aHIDModifiers);
+ break;
+ }
+ case EStdKeyDownArrow:
+ {
+ ret = HandleKeyMappingDown(aKey, aIsKeyDown, aHIDModifiers);
+ break;
+ }
+ case EStdKeyLeftArrow:
+ {
+ ret = HandleKeyMappingLeft(aKey, aIsKeyDown, aHIDModifiers);
+ break;
+ }
+ case EStdKeyRightArrow:
+ {
+ ret = HandleKeyMappingRight(aKey, aIsKeyDown, aHIDModifiers);
+ break;
+ }
+ case EStdKeyEscape:
+ // fall through
+ case EStdKeyF8:
+ // fall through
+ case EStdKeyApplication2:
+ // fall through
+ case EStdKeyApplication3:
+ // fall through
+ case EStdKeyF9:
+ // break;
+ case EStdKeyApplication4:
+ // fall through
+ case EStdKeyF7:
+ // fall through
+ case EStdKeyApplication5:
+ // fall through
+ case EStdKeyF12:
+ // fall through
+ case EStdKeyIncVolume:
+ // fall through
+ case EStdKeyF11:
+ // fall through
+ case EStdKeyDecVolume:
+ // fall through
+ case EStdKeyF10:
+ {
+ ret = HandleKeyMappingOther(aKey, aIsKeyDown, aHIDModifiers);
+ break;
+ }
+ default:
+ {
+ // no actions for these keys
+ break;
+ }
+ }
+
+ return ret;
+ }
+
+// ----------------------------------------------------------------------
+// CHidKeyboardDriver::HandleKeyMappingUp
+// Handle key mapping gor UP + MODIFIER
+// ----------------------------------------------------------------------
+//
+TBool CHidKeyboardDriver::HandleKeyMappingUp(TDecodedKeyInfo& aKey,
+ TBool aIsKeyDown,
+ TUint8 aHIDModifiers)
{
- TBool ret = HandleMultimediaKeysForNokia(aScancodeKey, aIsKeyDown,
- aHIDModifiers);
+ TRACE_INFO((_L("[HID]\tCHidKeyboardDriver::HandleKeyMappingUp")));
+
+ TBool ret = EFalse;
+ TInt scancode = 0;
+ TUint modifier = 0;
+ TBool isMmKey = EFalse;
+ TMmKeyDown bitmapToReset = ENone;
+
+ switch (aKey.iScanCode)
+ {
+ case EStdKeyUpArrow:
+ {
+ // Key up and send key was emulated
+ if (!aIsKeyDown &&
+ iNavKeyDown & ESend)
+ {
+ TRACE_INFO((_L("[HID]\tCTRL + UP >>> SEND KEY UP")));
+
+ aKey.iScanCode = EStdKeyYes;
+ TTranslatedKey& key = aKey.iEvent[0];
+ key.iIsRepeatingKey = aIsKeyDown;
+ key.iScanCode = EStdKeyYes;
+ key.iUnicode = EKeyYes;
+
+ iNavKeyDown = (iNavKeyDown & !ESend);
+ }
+
+ //CTRL = Send key
+ else if (aIsKeyDown &&
+ aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight))
+ {
+ TRACE_INFO((_L("[HID]\tCTRL + UP >>> SEND KEY DOWN")));
+
+ aKey.iScanCode = EStdKeyYes;
+ aKey.iCount = 1;
+ TTranslatedKey& key = aKey.iEvent[0];
+ key.iIsRepeatingKey = aIsKeyDown;
+ key.iScanCode = EStdKeyYes;
+ key.iUnicode = EKeyYes;
+
+ iNavKeyDown = (iNavKeyDown | ESend);
+ }
+
+ //ALT = Stop
+ else if (aHIDModifiers & (KHidModifierAlt | KHidModifierAltRight) ||
+ iMmKeyDown & EStop)
+ {
+ TRACE_INFO((_L("[HID]\tALT + UP >>> STOP")));
+
+ scancode = EStdKeyApplication3;
+ isMmKey = ETrue;
+ bitmapToReset = EStop;
+ }
+
+ //SHIFT = Volume up
+ else if (aHIDModifiers & (KHidModifierShift | KHidModifierShiftRight) ||
+ iMmKeyDown & EVolUp)
+ {
+ TRACE_INFO((_L("[HID]\tSHIFT + UP >>> VOLUME UP")));
+
+ scancode = EStdKeyIncVolume;
+ isMmKey = ETrue;
+ bitmapToReset = EVolUp;
+ }
+ break;
+ }
+ default:
+ {
+ // no actions
+ break;
+ }
+ }
+
+ if (isMmKey)
+ {
+ if (bitmapToReset)
+ {
+ ResetBitmap(aIsKeyDown, bitmapToReset);
+ }
+ SendRawEvent(scancode, aIsKeyDown, modifier);
+ ret = ETrue;
+ }
+
+ return ret;
+ }
+
+// ----------------------------------------------------------------------
+// CHidKeyboardDriver::HandleKeyMappingDown
+// Handle key mapping gor DOWN + MODIFIER
+// ----------------------------------------------------------------------
+//
+TBool CHidKeyboardDriver::HandleKeyMappingDown(TDecodedKeyInfo& aKey,
+ TBool aIsKeyDown,
+ TUint8 aHIDModifiers)
+ {
+ TRACE_INFO((_L("[HID]\tCHidKeyboardDriver::HandleKeyMappingDown")));
+
+ TBool ret = EFalse;
+ TInt scancode = 0;
+ TUint modifier = 0;
+ TBool isMmKey = EFalse;
+ TMmKeyDown bitmapToReset = ENone;
+
+ switch (aKey.iScanCode)
+ {
+ case EStdKeyDownArrow:
+ {
+ // Key up and end key was emulated
+ if (!aIsKeyDown &&
+ iNavKeyDown & EEnd)
+ {
+ TRACE_INFO((_L("[HID]\tCTRL + DOWN >>> END KEY UP")));
+
+ aKey.iScanCode = EStdKeyNo;
+ TTranslatedKey& key = aKey.iEvent[0];
+ key.iIsRepeatingKey = aIsKeyDown;
+ key.iScanCode = EStdKeyNo;
+ key.iUnicode = EKeyNo;
+
+ iNavKeyDown = (iNavKeyDown & !EEnd);
+ }
+
+ //CTRL = End key
+ else if (aIsKeyDown &&
+ aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight))
+ {
+ TRACE_INFO((_L("[HID]\tCTRL + DOWN >>> END KEY DOWN")));
+
+ aKey.iScanCode = EStdKeyNo;
+ aKey.iCount = 1;
+ TTranslatedKey& key = aKey.iEvent[0];
+ key.iIsRepeatingKey = aIsKeyDown;
+ key.iScanCode = EStdKeyNo;
+ key.iUnicode = EKeyNo;
+
+ iNavKeyDown = (iNavKeyDown | EEnd);
+ }
+
+ //ALT = Stop
+ else if (aHIDModifiers & (KHidModifierAlt | KHidModifierAltRight) ||
+ iMmKeyDown & EPlay)
+ {
+ TRACE_INFO((_L("[HID]\tALT + DOWN >>> PLAY / PAUSE")));
+
+ scancode = EStdKeyApplication2;
+ isMmKey = ETrue;
+ bitmapToReset = EPlay;
+ }
+
+ //SHIFT = Volume down
+ else if (aHIDModifiers & (KHidModifierShift | KHidModifierShiftRight) ||
+ iMmKeyDown & EVolDown)
+ {
+ TRACE_INFO((_L("[HID]\tSHIFT + DOWN >>> VOLUME DOWN")));
+
+ scancode = EStdKeyDecVolume;
+ isMmKey = ETrue;
+ bitmapToReset = EVolDown;
+ }
+ break;
+ }
+ default:
+ {
+ // no actions
+ break;
+ }
+ }
+
+ if (isMmKey)
+ {
+ if (bitmapToReset)
+ {
+ ResetBitmap(aIsKeyDown, bitmapToReset);
+ }
+ SendRawEvent(scancode, aIsKeyDown, modifier);
+ ret = ETrue;
+ }
+
+ return ret;
+ }
+
+// ----------------------------------------------------------------------
+// CHidKeyboardDriver::HandleKeyMappingLeft
+// Handle key mapping gor LEFT + MODIFIER
+// ----------------------------------------------------------------------
+//
+TBool CHidKeyboardDriver::HandleKeyMappingLeft(TDecodedKeyInfo& aKey,
+ TBool aIsKeyDown,
+ TUint8 aHIDModifiers)
+ {
+ TRACE_INFO((_L("[HID]\tCHidKeyboardDriver::HandleKeyMappingLeft")));
- if (!ret)
+ TBool ret = EFalse;
+ TInt scancode = 0;
+ TUint modifier = 0;
+ TBool isMmKey = EFalse;
+ TMmKeyDown bitmapToReset = ENone;
+
+ switch (aKey.iScanCode)
+ {
+ case EStdKeyLeftArrow:
+ {
+ // Key up and LSK was simulated
+ if (!aIsKeyDown &&
+ iNavKeyDown & ELsk)
+ {
+ TRACE_INFO((_L("[HID]\tCTRL + LEFT >>> LEFT SOFTKEY UP")));
+
+ aKey.iScanCode = EStdKeyDevice0;
+ TTranslatedKey& key = aKey.iEvent[0];
+ key.iIsRepeatingKey = aIsKeyDown;
+ key.iScanCode = EStdKeyDevice0;
+ key.iUnicode = EKeyDevice0;
+
+ iNavKeyDown = (iNavKeyDown & !ELsk);
+ }
+
+ //CTRL = LSK
+ else if (aIsKeyDown &&
+ aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight))
+ {
+ TRACE_INFO((_L("[HID]\tCTRL + LEFT >>> LEFT SOFTKEY DOWN")));
+
+ aKey.iScanCode = EStdKeyDevice0;
+ aKey.iCount = 1;
+ TTranslatedKey& key = aKey.iEvent[0];
+ key.iIsRepeatingKey = aIsKeyDown;
+ key.iScanCode = EStdKeyDevice0;
+ key.iUnicode = EKeyDevice0;
+
+ iNavKeyDown = (iNavKeyDown | ELsk);
+ }
+
+ //ALT (short) = Previous
+ //ALT (long) = Backwards
+ else if (aHIDModifiers & (KHidModifierAlt | KHidModifierAltRight) ||
+ iMmKeyDown & EPrev)
+ {
+ TRACE_INFO((_L("[HID]\tALT + LEFT >>> PREVIOUS / REW")));
+
+ scancode = EStdKeyApplication5;
+ isMmKey = ETrue;
+ bitmapToReset = ENext;
+ }
+
+ //SHIFT = Mute toggle
+ else if (aHIDModifiers & (KHidModifierShift | KHidModifierShiftRight) ||
+ iMmKeyDown & EPlay)
+ {
+ TRACE_INFO((_L("[HID]\tSHIFT + LEFT >>> MUTE / UNMUTE")));
+
+ scancode = EStdKeyApplication2;
+ isMmKey = ETrue;
+ bitmapToReset = EPlay;
+ }
+ break;
+ }
+ default:
+ {
+ // no actions
+ break;
+ }
+ }
+
+ if (isMmKey)
+ {
+ if (bitmapToReset)
+ {
+ ResetBitmap(aIsKeyDown, bitmapToReset);
+ }
+ SendRawEvent(scancode, aIsKeyDown, modifier);
+ ret = ETrue;
+ }
+
+ return ret;
+ }
+
+// ----------------------------------------------------------------------
+// CHidKeyboardDriver::HandleKeyMappingRight
+// Handle key mapping gor RIGHT + MODIFIER
+// ----------------------------------------------------------------------
+//
+TBool CHidKeyboardDriver::HandleKeyMappingRight(TDecodedKeyInfo& aKey,
+ TBool aIsKeyDown,
+ TUint8 aHIDModifiers)
+ {
+ TRACE_INFO((_L("[HID]\tCHidKeyboardDriver::HandleKeyMappingRight")));
+
+ TBool ret = EFalse;
+ TInt scancode = 0;
+ TUint modifier = 0;
+ TBool isMmKey = EFalse;
+ TMmKeyDown bitmapToReset = ENone;
+
+ switch (aKey.iScanCode)
{
- ret = HandleMultimediaKeysForStandard(aScancodeKey, aIsKeyDown,
- aHIDModifiers);
+ case EStdKeyRightArrow:
+ {
+ // Key up and RSK was simulated
+ if (!aIsKeyDown &&
+ iNavKeyDown & ERsk)
+ {
+ TRACE_INFO((_L("[HID]\tCTRL + LEFT >>> RIGHT SOFTKEY UP")));
+
+ aKey.iScanCode = EStdKeyDevice1;
+ TTranslatedKey& key = aKey.iEvent[0];
+ key.iIsRepeatingKey = aIsKeyDown;
+ key.iScanCode = EStdKeyDevice1;
+ key.iUnicode = EKeyDevice1;
+
+ iNavKeyDown = (iNavKeyDown & !ERsk);
+ }
+
+ //CTRL = RSK
+ else if (aIsKeyDown &&
+ aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight))
+ {
+ TRACE_INFO((_L("[HID]\tCTRL + RIGHT >>> RIGHT SOFTKEY DOWN")));
+
+ aKey.iScanCode = EStdKeyDevice1;
+ aKey.iCount = 1;
+ TTranslatedKey& key = aKey.iEvent[0];
+ key.iIsRepeatingKey = aIsKeyDown;
+ key.iScanCode = EStdKeyDevice1;
+ key.iUnicode = EKeyDevice1;
+
+ iNavKeyDown = (iNavKeyDown | ERsk);
+ }
+
+ //ALT (short) = Next
+ //ALT (long) = Forward
+ else if (aHIDModifiers & (KHidModifierAlt | KHidModifierAltRight) ||
+ iMmKeyDown & EPrev)
+ {
+ TRACE_INFO((_L("[HID]\tALT + RIGHT >>> NEXT / FF")));
+
+ scancode = EStdKeyApplication4;
+ isMmKey = ETrue;
+ bitmapToReset = EPrev;
+ }
+
+ //SHIFT = Mute toggle (currently just toggle play / pause)
+ else if (aHIDModifiers & (KHidModifierShift | KHidModifierShiftRight) ||
+ iMmKeyDown & EPlay)
+ {
+ TRACE_INFO((_L("[HID]\tSHIFT + RIGHT >>> MUTE / UNMUTE")));
+
+ scancode = EStdKeyApplication2;
+ isMmKey = ETrue;
+ bitmapToReset = EPlay;
+ }
+ break;
+ }
+ default:
+ {
+ // no actions
+ break;
+ }
+ }
+
+ if (isMmKey)
+ {
+ if (bitmapToReset)
+ {
+ ResetBitmap(aIsKeyDown, bitmapToReset);
+ }
+ SendRawEvent(scancode, aIsKeyDown, modifier);
+ ret = ETrue;
}
+
+ return ret;
+ }
+
+// ----------------------------------------------------------------------
+// CHidKeyboardDriver::HandleKeyMappingOther
+// Handle key mapping gor OTHER + MODIFIER
+// ----------------------------------------------------------------------
+//
+TBool CHidKeyboardDriver::HandleKeyMappingOther(TDecodedKeyInfo& aKey,
+ TBool aIsKeyDown,
+ TUint8 /*aHIDModifiers*/)
+ {
+ TRACE_INFO((_L("[HID]\tCHidKeyboardDriver::HandleKeyMappingOther")));
+
+ TBool ret = EFalse;
+ TInt scancode = 0;
+ TUint modifier = 0;
+ TBool isMmKey = EFalse;
+
+ switch (aKey.iScanCode)
+ {
+ case EStdKeyEscape:
+ {
+ // ESC is released and keys were locked, eat the key press
+ if (!aIsKeyDown &&
+ iNavKeyDown & EEsc)
+ {
+ TRACE_INFO((_L("[HID]\tESC >>> DISBALE KEY LOCK UP")));
+
+ ret = ETrue;
+ iNavKeyDown = (iNavKeyDown & !EEsc);
+ }
+
+ // ESC when keylock enabled >>> Disabled key lock
+/* else if (aIsKeyDown &&
+ iKeyLock.IsKeyLockEnabled())
+ {
+ TRACE_INFO((_L("[HID]\tESC >>> DISBALE KEY LOCK DOWN")));
+
+ iKeyLock.DisableKeyLock();
+
+ ret = ETrue;
+ iNavKeyDown = (iNavKeyDown | EEsc);
+ }
+*/
+ break;
+ }
+ case EStdKeyF8:
+ // fall through
+ case EStdKeyApplication2:
+ {
+ TRACE_INFO((_L("[HID]\tF8 / APPLICATION2 >>> PLAY / PAUSE")));
+
+ // PLAY / PAUSE
+ if (aKey.iScanCode != EStdKeyApplication2)
+ {
+ scancode = EStdKeyApplication2;
+ isMmKey = ETrue;
+ }
+ break;
+ }
+ case EStdKeyApplication3:
+ {
+ TRACE_INFO((_L("[HID]\tAPPLICATION3 >>> STOP")));
+
+ // STOP
+ scancode = EStdKeyApplication3;
+ isMmKey = ETrue;
+ break;
+ }
+ case EStdKeyF9:
+ // break;
+ case EStdKeyApplication4:
+ {
+ TRACE_INFO((_L("[HID]\tF9 / APPLICATION4 >>> NEXT / FF")));
+
+ // NEXT
+ scancode = EStdKeyApplication4;
+ isMmKey = ETrue;
+ break;
+ }
+ case EStdKeyF7:
+ // fall through
+ case EStdKeyApplication5:
+ {
+ TRACE_INFO((_L("[HID]\tF7 / APPLICATION5 >>> PREVIOUS / REW")));
+
+ // PREVIOUS
+ scancode = EStdKeyApplication5;
+ isMmKey = ETrue;
+ break;
+ }
+ case EStdKeyF12:
+ // fall through
+ case EStdKeyIncVolume:
+ {
+ TRACE_INFO((_L("[HID]\tF12 / INCVOLUME >>> VOLUME UP")));
+
+ // VOLUME UP
+ scancode = EStdKeyIncVolume;
+ isMmKey = ETrue;
+ break;
+ }
+ case EStdKeyF11:
+ // fall through
+ case EStdKeyDecVolume:
+ {
+ TRACE_INFO((_L("[HID]\tF11 / DECVOLUME >>> VOLUME DOWN")));
+
+ // VOLUME DOWN
+ scancode = EStdKeyDecVolume;
+ isMmKey = ETrue;
+ break;
+ }
+ case EStdKeyF10:
+ {
+ TRACE_INFO((_L("[HID]\tF10 >>> MUTE")));
+
+ // MUTE (currently just toggle play / pause)
+ scancode = EStdKeyApplication2;
+ isMmKey = ETrue;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ if (isMmKey)
+ {
+ SendRawEvent(scancode, aIsKeyDown, modifier);
+ ret = ETrue;
+ }
+
return ret;
}
@@ -1701,184 +2030,6 @@
}
}
-TBool CHidKeyboardDriver::HandleMultimediaKeysForNokia(TUint16 aScancodeKey,
- TBool aIsKeyDown, TUint8 aHIDModifiers)
- {
- const TUint KHidModifierCtrl = 0x01;
- const TUint KHidModifierCtrlRight = 0x10;
- const TUint KHidModifierAlt = 0x04;
-
- // const TUint KHidModifierAltGr = 0x64;
- TInt scancode = 0;
- TUint modifier = 0;
- TBool isMmKey = EFalse;
-
- TMmKeyDown bitmapToReset;
-
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: scancode 0x%08x, HIDmodifiers 0x%08x"), aScancodeKey, aHIDModifiers));
-
- switch (aScancodeKey)
- {
-
- // Mappings for Nokia SU-8W
- // Key down events are stored into bitmap in order to detect if keys are released in reverse order, which caused jamming.
- // For example: control key released before arrow key.
-
- case EStdKeyUpArrow:
- {
- if (aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight)
- || iMmKeyDown & EVolUp)
- {
- scancode = EStdKeyIncVolume; //Volume Up = Ctrl + ArrowUp
- isMmKey = ETrue;
- // Set or reset flag bit
-
- bitmapToReset = EVolUp;
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Volume up %d"), aIsKeyDown));
- }
- break;
- }
-
- case EStdKeyDownArrow:
- {
- if (aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight)
- || iMmKeyDown & EVolDown)
- {
- scancode = EStdKeyDecVolume; //Volume Down = Ctrl + ArrowDown
- isMmKey = ETrue;
- bitmapToReset = EVolDown;
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Volume down %d"), aIsKeyDown));
- }
- break;
- }
-
- case EStdKeyRightArrow:
- {
- if (aHIDModifiers & KHidModifierAlt || iMmKeyDown & EPlay)
- {
- scancode = EStdKeyApplication2; //Play = Alt + ArrowRight
- isMmKey = ETrue;
- bitmapToReset = EPlay;
-
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Play %d"), aIsKeyDown));
- }
- else if (aHIDModifiers & (KHidModifierCtrl
- | KHidModifierCtrlRight) || iMmKeyDown & ENext)
- {
- scancode = EStdKeyApplication4; //Next = Ctrl + ArrowRight
- isMmKey = ETrue;
- bitmapToReset = ENext;
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Next %d"), aIsKeyDown));
- }
- break;
- }
-
- case EStdKeyLeftArrow:
- {
- if (aHIDModifiers & KHidModifierAlt || iMmKeyDown & EStop)
- {
- scancode = EStdKeyApplication3; //Stop = Alt + ArrowLeft
- isMmKey = ETrue;
- bitmapToReset = EStop;
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Stop %d"), aIsKeyDown));
- }
- else if (aHIDModifiers & (KHidModifierCtrl
- | KHidModifierCtrlRight) || iMmKeyDown & EPrev)
- {
- scancode = EStdKeyApplication5; //Prev = Ctrl + ArrowLeft
- isMmKey = ETrue;
- bitmapToReset = EPrev;
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Prev %d"), aIsKeyDown));
- }
- break;
- }
-
- default:
- break;
- }
-
- if (isMmKey)
- {
- ResetBitmap(aIsKeyDown, bitmapToReset);
- SendRawEvent(scancode, aIsKeyDown, modifier);
- }
- return isMmKey;
- }
-
-TBool CHidKeyboardDriver::HandleMultimediaKeysForStandard(
- TUint16 aScancodeKey, TBool aIsKeyDown, TUint8 aHIDModifiers)
- {
- TInt scancode = 0;
- TUint modifier = 0;
- TBool isMmKey = EFalse;
-
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: scancode 0x%08x, HIDmodifiers 0x%08x"), aScancodeKey, aHIDModifiers));
- //please complier...
- (void) aHIDModifiers;
-
- switch (aScancodeKey)
- {
- // Mappings for standard keyboards
-
- case EStdKeyApplication2: //Play
- {
- scancode = EStdKeyApplication2;
- isMmKey = ETrue;
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Play %d"), aIsKeyDown));
- break;
- }
-
- case EStdKeyApplication3: //Stop
- {
- scancode = EStdKeyApplication3;
- isMmKey = ETrue;
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Stop %d"), aIsKeyDown));
- break;
- }
-
- case EStdKeyApplication4: //Next
- {
- scancode = EStdKeyApplication4;
- isMmKey = ETrue;
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Next %d"), aIsKeyDown));
- break;
- }
-
- case EStdKeyApplication5: //Prev
- {
- scancode = EStdKeyApplication5;
- isMmKey = ETrue;
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Prev %d"), aIsKeyDown));
- break;
- }
-
- case EStdKeyIncVolume: //Volume up
- {
- scancode = EStdKeyIncVolume;
- isMmKey = ETrue;
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Volume up %d"), aIsKeyDown));
- break;
- }
-
- case EStdKeyDecVolume: //Volume down
- {
- scancode = EStdKeyDecVolume;
- isMmKey = ETrue;
- TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Volume down %d"), aIsKeyDown));
- break;
- }
-
- default:
- break;
- }
-
- if (isMmKey)
- {
- SendRawEvent(scancode, aIsKeyDown, modifier);
- }
- return isMmKey;
- }
-
// ----------------------------------------------------------------------
// CHidKeyboardDriver::SendRawEvent
// Send raw key event to window server
@@ -1937,18 +2088,5 @@
CancelAllKeys();
}
-void CHidKeyboardDriver::CursorRedraw()
- {
- TInt mouseStatus;
-
- TInt err = RProperty::Get( KPSUidBthidSrv, KBTMouseCursorState, mouseStatus );
- if ( !err )
- {
- err = RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorRedraw );
- DBG(RDebug::Print(
- _L("[BTHID]\tCHidKeyboardDriver::CursorRedraw() X->ECursorRedraw") ) );
- }
- }
-
// ----------------------------------------------------------------------
// End of file
--- a/bluetoothengine/bthid/mouse/PaintCursor/src/paintcursorappview.cpp Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/bthid/mouse/PaintCursor/src/paintcursorappview.cpp Mon Jun 21 15:51:46 2010 +0300
@@ -16,11 +16,20 @@
*/
#include <coecntrl.h>
+#include <e32property.h>
+#include <bthidPsKey.h>
#include "paintcursorappview.h"
#include "pointmsgqueue.h"
#include "debug.h"
+/** PubSub key read and write policies */
+_LIT_SECURITY_POLICY_C2( KBTHIDPSKeyReadPolicy,
+ ECapabilityLocalServices, ECapabilityReadDeviceData );
+_LIT_SECURITY_POLICY_C2( KBTHIDPSKeyWritePolicy,
+ ECapabilityLocalServices, ECapabilityWriteDeviceData );
+
+
CPaintCursorAppView* CPaintCursorAppView::NewL(const TRect& aRect)
{
CPaintCursorAppView* self = CPaintCursorAppView::NewLC(aRect);
@@ -38,6 +47,13 @@
void CPaintCursorAppView::ConstructL(const TRect& aRect)
{
+
+ User::LeaveIfError( RProperty::Define( KPSUidBthidSrv,
+ KBTMouseCursorState,
+ RProperty::EInt,
+ KBTHIDPSKeyReadPolicy,
+ KBTHIDPSKeyWritePolicy) );
+
// Create a window for this application view
CreateWindowL();
@@ -110,6 +126,8 @@
// Close the animation server
iMouseCursorDll.Close();
+
+ RProperty::Delete( KPSUidBthidSrv, KBTMouseCursorState );
}
void CPaintCursorAppView::SizeChanged()
--- a/bluetoothengine/bthid/mouse/hidmousedriver/group/mouse.mmp Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/bthid/mouse/hidmousedriver/group/mouse.mmp Mon Jun 21 15:51:46 2010 +0300
@@ -23,7 +23,7 @@
TARGETTYPE PLUGIN
UID ECOM_UID MOUSE_UID
-CAPABILITY CAP_APPLICATION
+CAPABILITY CAP_APPLICATION CommDD ProtServ
VENDORID VID_DEFAULT
--- a/bluetoothengine/bthid/mouse/hidmousedriver/inc/mouse.h Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/bthid/mouse/hidmousedriver/inc/mouse.h Mon Jun 21 15:51:46 2010 +0300
@@ -176,7 +176,8 @@
TInt SendButtonEvent(TBool aButtonDown);
void LaunchApplicationL(const TDesC& aName);
- //void LaunchApplicationL(TInt aAppUid);
+
+ TBool IsAlreadyRunning();
private:
// The Generic HID layer
--- a/bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp Mon Jun 21 15:51:46 2010 +0300
@@ -183,10 +183,7 @@
void CHidMouseDriver::LaunchApplicationL(const TDesC& aName)
{
//Check if application is already running in the background
- TApaTaskList tasks( iWsSession );
- TApaTask task = tasks.FindApp( aName );
-
- if ( task.Exists() )
+ if (IsAlreadyRunning())
{
// Application is active, so just bring to foreground
}
@@ -208,6 +205,32 @@
CleanupStack::PopAndDestroy(2);
}
}
+
+TBool CHidMouseDriver::IsAlreadyRunning()
+ {
+ TFindProcess processFinder(_L("*[2001fe5c]*")); //search by paintcursor.exe UID3
+
+ TBool found = EFalse;
+ TFullName result;
+ if (processFinder.Next(result) == KErrNone)
+ {
+ DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - process found Inside while")) );
+ found = ETrue;
+ }
+
+ if (found)
+ {
+ DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - Process found ")) );
+ }
+ else
+ {
+ DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - Process was never found")) );
+ }
+
+ return found;
+}
+
+
// ----------------------------------------------------------------------
// CHidDriver mandatory functions:
@@ -231,6 +254,7 @@
_L("[BTHID]\tCHidMouseDriver::DataIn() ECursorRedraw ||ECursorReset ")) );
}
+ LaunchApplicationL(KAppName);
CursorRedraw();
--- a/bluetoothengine/btui/Ecom/data/BtuiViewResources.rss Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/btui/Ecom/data/BtuiViewResources.rss Mon Jun 21 15:51:46 2010 +0300
@@ -339,15 +339,15 @@
items =
{
MENU_ITEM { command = EBTUICmdNewPairedDevice; txt = qtn_bt_new_paired_device; },
- MENU_ITEM { command = EBTUICmdConnect; txt = qtn_bt_gen_connect; },
- MENU_ITEM { command = EBTUICmdConnectAudio; txt = qtn_bt_connect; },
- MENU_ITEM { command = EBTUICmdDisconnect; txt = qtn_bt_disconnect; },
- MENU_ITEM { command = EBTUICmdGiveNickname; txt = qtn_bt_give_nickname; },
- MENU_ITEM { command = EBTUICmdSetTrusted; txt = qtn_bt_set_as_trusted; },
- MENU_ITEM { command = EBTUICmdSetUnTrusted; txt = qtn_bt_set_as_untrusted; },
- MENU_ITEM { command = EBTUICmdSetBlocked; txt = qtn_bt_block; },
- MENU_ITEM { command = EBTUICmdDelete; txt = qtn_bt_delete; },
- MENU_ITEM { command = EBTUICmdSettings; txt = qtn_bt_settings; },
+ MENU_ITEM { command = EBTUICmdConnect; txt = qtn_bt_gen_connect; flags = EEikMenuItemSpecific; },
+ MENU_ITEM { command = EBTUICmdConnectAudio; txt = qtn_bt_connect; flags = EEikMenuItemSpecific;},
+ MENU_ITEM { command = EBTUICmdDisconnect; txt = qtn_bt_disconnect; flags = EEikMenuItemSpecific;},
+ MENU_ITEM { command = EBTUICmdGiveNickname; txt = qtn_bt_give_nickname; flags = EEikMenuItemSpecific;},
+ MENU_ITEM { command = EBTUICmdSetTrusted; txt = qtn_bt_set_as_trusted; flags = EEikMenuItemSpecific;},
+ MENU_ITEM { command = EBTUICmdSetUnTrusted; txt = qtn_bt_set_as_untrusted; flags = EEikMenuItemSpecific;},
+ MENU_ITEM { command = EBTUICmdSetBlocked; txt = qtn_bt_block; flags = EEikMenuItemSpecific; },
+ MENU_ITEM { command = EBTUICmdDelete; txt = qtn_bt_delete; flags = EEikMenuItemSpecific; },
+ MENU_ITEM { command = EBTUICmdSettings; txt = qtn_bt_settings; flags = EEikMenuItemSpecific;},
MENU_ITEM { command = EBTUICmdDeleteAll; txt = qtn_bt_delete_all; }
};
}
@@ -1328,7 +1328,7 @@
{
items =
{
- MENU_ITEM { command = EBTUICmdUnblock; txt = qtn_bt_delete;},
+ MENU_ITEM { command = EBTUICmdUnblock; txt = qtn_bt_delete; flags = EEikMenuItemSpecific;},
MENU_ITEM { command = EBTUICmdUnblockAll; txt = qtn_bt_delete_all; }
};
}
--- a/bluetoothengine/btui/Ecom/inc/BTUIPairedDevicesView.h Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/btui/Ecom/inc/BTUIPairedDevicesView.h Mon Jun 21 15:51:46 2010 +0300
@@ -319,6 +319,14 @@
*/
void LaunchSettingViewL();
+ /** Setup device specific menu options
+ *
+ * @param None.
+ * @return None.
+ */
+ void SetupMenuCmd(TInt aIndex, CEikMenuPane* aMenu);
+
+
public: // Inherited from MBTEngSdpResultReceiver
--- a/bluetoothengine/btui/Ecom/src/BTUIBlockedDevicesView.cpp Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/btui/Ecom/src/BTUIBlockedDevicesView.cpp Mon Jun 21 15:51:46 2010 +0300
@@ -266,6 +266,10 @@
(iBaseView->TabbedViews()) );
}
+
+ MenuBar()->SetContextMenuTitleResourceId(
+ R_BTUI_MENUBAR_BLOCK_DEVICES_VIEW);
+
// notify observer
if( iActivationObserver && iConstructAsGsPlugin == EFalse)
{
@@ -349,19 +353,17 @@
!FeatureManager::FeatureSupported( KFeatureIdHelp ) );
}
- // do not show "unblock" and "unblock all" commands
+ // do not "unblock all" commands
// if there is nothing to unblock
if (aResId == R_BTUI_BLOCK_DEVICES_VIEW_MENU)
{
if( iContainer->CountItems() == 0)
{
- aMenu->SetItemDimmed(EBTUICmdUnblock, ETrue);
aMenu->SetItemDimmed(EBTUICmdUnblockAll, ETrue);
}
else
{
aMenu->SetItemDimmed(EBTUICmdUnblockAll, EFalse);
- aMenu->SetItemDimmed(EBTUICmdUnblock, ETrue);
}
}
TRACE_FUNC_EXIT
--- a/bluetoothengine/btui/Ecom/src/BTUIPairedDevicesView.cpp Wed Jun 09 09:52:54 2010 +0300
+++ b/bluetoothengine/btui/Ecom/src/BTUIPairedDevicesView.cpp Mon Jun 21 15:51:46 2010 +0300
@@ -415,7 +415,7 @@
void CBTUIPairedDevicesView::DynInitMenuPaneL(TInt aResId, CEikMenuPane* aMenu)
{
TRACE_FUNC_ENTRY
- iActiveMenuPane = aMenu;
+
// dim help if it exists and is not supported
TInt tmp;
if ( aMenu->MenuItemExists(EAknCmdHelp,tmp ) )
@@ -426,31 +426,24 @@
if ( aResId == R_BTUI_OTHER_DEVICES_VIEW_MENU )
{
+
TInt index = iContainer->CurrentItemIndex();
-
- // we only show "new pair device", "help" , "Exit" and "Delete All" if view contains device(s).
- aMenu->SetItemDimmed(EBTUICmdSetTrusted, ETrue);
- aMenu->SetItemDimmed(EBTUICmdDelete,ETrue);
- aMenu->SetItemDimmed(EBTUICmdSetTrusted,ETrue);
- aMenu->SetItemDimmed(EBTUICmdSetUnTrusted,ETrue);
- aMenu->SetItemDimmed(EBTUICmdConnect,ETrue);
- aMenu->SetItemDimmed(EBTUICmdConnectAudio,ETrue);
- aMenu->SetItemDimmed(EBTUICmdDisconnect,ETrue);
- aMenu->SetItemDimmed(EBTUICmdSetBlocked,ETrue);
- aMenu->SetItemDimmed(EBTUICmdSettings,ETrue);
- aMenu->SetItemDimmed(EBTUICmdGiveNickname, ETrue);
-
+
if ( index < 0 ) // No devices at list. Hide all device related commands.
{
aMenu->SetItemDimmed(EBTUICmdDeleteAll, ETrue);
}
-
+ else
+ {
+ SetupMenuCmd(index, aMenu);
+ }
}
if ( aResId == R_BTUI_OTHER_DEVICES_VIEW_MENU_CONTEXT )
{
+ iActiveMenuPane = aMenu;
TInt index = iContainer->CurrentItemIndex();
-
+
// If user is fast enough to click the RSK option between
// bt discovery view and device found view, bt ui will crash.
// Therefore, we disable commands if bt discovery is onging.
@@ -485,51 +478,8 @@
}
else // There are devices at list
{
- TBTDevice device;
- device.iIndex = index;
- iModel->GetDevice(device);
- iMenuDevice = device;
-
- TRACE_INFO(_L("there are device in list"))
-
- TBool dim = (device.iStatus & EStatusTrusted) == EStatusTrusted;
-
- aMenu->SetItemDimmed(EBTUICmdSetTrusted, dim);
- aMenu->SetItemDimmed(EBTUICmdSetUnTrusted, !dim);
-
- // Check if device can be connected or disconnected
- dim = (! (device.iStatus & EStatusConnectable)
- || device.iStatus & EStatusBtuiConnected);
-
- if (dim)
- {
- aMenu->SetItemDimmed(EBTUICmdConnect, dim);
- aMenu->SetItemDimmed(EBTUICmdConnectAudio, dim);
- }
- else
- {
- if ( device.iDeviceClass.MajorDeviceClass() == EMajorDeviceComputer)
- {
- aMenu->SetItemDimmed(EBTUICmdConnect, ETrue);
- }
- else
- {
- aMenu->SetItemDimmed(EBTUICmdConnectAudio, ETrue);
- }
- }
- dim = (device.iStatus & EStatusBtuiConnected) != EStatusBtuiConnected;
- aMenu->SetItemDimmed(EBTUICmdDisconnect, dim);
-
- if ( !iBTPluginMan->IsPluginAvaiable(device.iDeviceClass) )
- {
- aMenu->SetItemDimmed(EBTUICmdSettings, ETrue);
- }
- else
- {
- dim = (device.iStatus & EStatusBtuiConnected) != EStatusBtuiConnected;
- aMenu->SetItemDimmed(EBTUICmdSettings, dim);
- }
- //Hide New pair device
+ SetupMenuCmd(index, aMenu);
+ //Hide New pair device in context menu
aMenu->SetItemDimmed(EBTUICmdNewPairedDevice, ETrue);
}
}
@@ -1899,6 +1849,56 @@
return icon;
}
+
+
+void CBTUIPairedDevicesView::SetupMenuCmd(TInt aIndex, CEikMenuPane* aMenu)
+ {
+ TBTDevice device;
+ device.iIndex = aIndex;
+ iModel->GetDevice(device);
+ iMenuDevice = device;
+
+ TRACE_INFO(_L("there are device in list"))
+
+ TBool dim = (device.iStatus & EStatusTrusted) == EStatusTrusted;
+
+ aMenu->SetItemDimmed(EBTUICmdSetTrusted, dim);
+ aMenu->SetItemDimmed(EBTUICmdSetUnTrusted, !dim);
+
+ // Check if device can be connected or disconnected
+ dim = (! (device.iStatus & EStatusConnectable)
+ || device.iStatus & EStatusBtuiConnected);
+
+ if (dim)
+ {
+ aMenu->SetItemDimmed(EBTUICmdConnect, dim);
+ aMenu->SetItemDimmed(EBTUICmdConnectAudio, dim);
+ }
+ else
+ {
+ if ( device.iDeviceClass.MajorDeviceClass() == EMajorDeviceComputer)
+ {
+ aMenu->SetItemDimmed(EBTUICmdConnect, ETrue);
+ }
+ else
+ {
+ aMenu->SetItemDimmed(EBTUICmdConnectAudio, ETrue);
+ }
+ }
+ dim = (device.iStatus & EStatusBtuiConnected) != EStatusBtuiConnected;
+ aMenu->SetItemDimmed(EBTUICmdDisconnect, dim);
+
+ if ( !iBTPluginMan->IsPluginAvaiable(device.iDeviceClass) )
+ {
+ aMenu->SetItemDimmed(EBTUICmdSettings, ETrue);
+ }
+ else
+ {
+ dim = (device.iStatus & EStatusBtuiConnected) != EStatusBtuiConnected;
+ aMenu->SetItemDimmed(EBTUICmdSettings, dim);
+ }
+ }
+
// End of File