本文整理汇总了C++中TRawEvent::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ TRawEvent::Set方法的具体用法?C++ TRawEvent::Set怎么用?C++ TRawEvent::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRawEvent
的用法示例。
在下文中一共展示了TRawEvent::Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SimulatePasswordEntry
void CLayerTestSsmEventObserver::SimulatePasswordEntry()
{
/*RWsSession wsSession;
wsSession.Connect();*/
TRawEvent eventDown;
TRawEvent eventUp;
//Simulate the key press ,(comma) in to pin notifier dialogue
eventDown.Set(TRawEvent::EKeyDown, EStdKeyComma);
UserSvr::AddEvent(eventDown);
eventUp.Set(TRawEvent::EKeyUp, EStdKeyComma);
UserSvr::AddEvent(eventUp);
User::After(1000000);
/* eventDown.Set(TRawEvent::EKeyDown, EStdKeyEnter);
UserSvr::AddEvent(eventDown);
eventUp.Set(TRawEvent::EKeyUp, EStdKeyEnter);
UserSvr::AddEvent(eventUp);*/
eventDown.Set(TRawEvent::EButton1Down, 60, 600);
UserSvr::AddEvent(eventDown);
eventUp.Set(TRawEvent::EButton1Up, 60, 600);
UserSvr::AddEvent(eventUp);
User::After(1000000);
/* wsSession.Flush();
wsSession.Close();*/
}
示例2:
void DKeyboardNE1_TB::EventDfc()
{
__KTRACE_OPT(KHARDWARE,Kern::Printf("DKeyboardNE1_TB::EventDfc"));
TInt irq=NKern::DisableAllInterrupts();
while (IsKeyReady()) // while there are keys in the controller's output buffer
{
NKern::RestoreInterrupts(irq);
TRawEvent e;
TUint keyCode=GetKeyCode(); // Read keycodes from controller
__KTRACE_OPT(KHARDWARE,Kern::Printf("#%02x",keyCode));
//
// TO DO: (mandatory)
//
// Convert from hardware scancode to EPOC scancode and send the scancode as an event (key pressed or released)
// as per below EXAMPLE ONLY:
//
TUint bareCode=keyCode&~KFlagKeyPressed;
TUint8 stdKey=convertCode[bareCode];
if (keyCode&KFlagKeyPressed)
e.Set(TRawEvent::EKeyUp,stdKey,0);
else
e.Set(TRawEvent::EKeyDown,stdKey,0);
Kern::AddEvent(e);
NKern::Sleep(1); // pause before reading more keycodes
irq=NKern::DisableAllInterrupts();
}
Interrupt::Enable(iIrqHandle);
NKern::RestoreInterrupts(irq);
}
示例3: SimulateKeyPress
LOCAL_C void SimulateKeyPress(TStdScanCode aScanCode)
{
TRawEvent eventDown;
eventDown.Set(TRawEvent::EKeyDown, aScanCode);
UserSvr::AddEvent(eventDown);
TRawEvent eventUp;
eventUp.Set(TRawEvent::EKeyUp, aScanCode);
UserSvr::AddEvent(eventUp);
}
示例4: TestNotify
void TestNotify()
//
// Test Notify by launching a simple notifier. Gets closed
// using timer and simulated keypress.
//
{
TInt r;
test.Start(_L("Connect to notifier server"));
RNotifier n;
r = n.Connect();
test(r==KErrNone);
TInt button=0;
TRequestStatus status;
TRequestStatus timerStatus;
RTimer timer;
timer.CreateLocal();
test.Next(_L("Launching simple notifier"));
_LIT(KLine1,"Line1 - Select Button2");
_LIT(KLine2,"Line2 - or press enter");
_LIT(KButton1,"Button1");
_LIT(KButton2,"Button2");
n.Notify(KLine1,KLine2,KButton1,KButton2,button,status);
timer.After(timerStatus,KTimeOut); // launch timer for getting control back after timeout
User::WaitForRequest(status, timerStatus);
if (status==KRequestPending)
{
test.Printf(_L("Timeout in waiting for keypress, continuing\n"));
// make the notifier to disappear
TRawEvent eventDown;
eventDown.Set(TRawEvent::EKeyDown,EStdKeyEnter);
TRawEvent eventUp;
eventUp.Set(TRawEvent::EKeyUp,EStdKeyEnter);
UserSvr::AddEvent(eventDown);
UserSvr::AddEvent(eventUp);
User::WaitForRequest(status); // wait again
}
else
{
timer.Cancel();
}
timer.Close();
test(status.Int()==KErrNone);
test.Next(_L("Close connection to notifier server"));
n.Close();
test.End();
}
示例5:
void CNav2Connect::TimerExpired()
{
//If the Gui channel has recieved data
if( !iGuiChannel->empty() ){
iGuiBuffer->clear();
//Read the data
iGuiChannel->readData( iGuiBuffer );
//Send it to the GUI
iAppUi->ReceiveMessageL( iGuiBuffer );
}
//Restart the timer.
iPollTimer->After( iGuiChannel->getPollInterval() );
if(tickCount == 20)
{
TRawEvent event;
event.Set(TRawEvent::EActive);
UserSvr::AddEvent(event);
tickCount=0;
}
tickCount = tickCount + 1;
}
示例6: TurnOffAndOn
void CPasswordTest::TurnOffAndOn()
{
/*#if defined(LOG_TESTS)
TLogMessageText buf;
_LIT(KSettingTime,"Setting Off Timer");
buf.Append(KSettingTime);
Client()->LogMessage(buf);
#endif*/
RTimer timer;
timer.CreateLocal();
TTime time;
time.HomeTime();
time+=TTimeIntervalSeconds(7); // For some reason the O/S won't switch off for less than 6 seconds
TRequestStatus status;
timer.At(status,time);
UserHal::SwitchOff();
User::WaitForRequest(status);
#if !defined(__WINS__)
TRawEvent event;
event.Set(TRawEvent::ESwitchOn);
UserSvr::AddEvent(event);
#endif
/*#if defined(LOG_TESTS)
TLogMessageText buf;
_LIT(KTimerOff,"Timer Gone Off (P=%d,S=%d)");
buf.AppendFormat(KTimerOff,iState,iPassState);
Client()->LogMessage(buf);
#endif*/
}
示例7: RunL
void CSerialKeyboard::RunL()
{
TInt c=KeyCode();
if (c>=0)
{
// convert character to keycode and shift, func, ctrl status
TUint16 code = convertCode[c];
TBool isShifted = ISSHIFTED(code);
TBool isFunced = ISFUNCED(code);
TBool isCtrled = ISCTRLED(code);
TUint8 stdKey = STDKEY(code);
TRawEvent e;
// post it as a sequence of events
if (isShifted)
{
e.Set(TRawEvent::EKeyDown,EStdKeyRightShift,0);
UserSvr::AddEvent(e);
}
if (isCtrled)
{
e.Set(TRawEvent::EKeyDown,EStdKeyLeftCtrl,0);
UserSvr::AddEvent(e);
}
if (isFunced)
{
e.Set(TRawEvent::EKeyDown,EStdKeyLeftFunc,0);
UserSvr::AddEvent(e);
}
e.Set(TRawEvent::EKeyDown,stdKey,0);
UserSvr::AddEvent(e);
e.Set(TRawEvent::EKeyUp,stdKey,0);
UserSvr::AddEvent(e);
if (isFunced)
{
e.Set(TRawEvent::EKeyUp,EStdKeyLeftFunc,0);
UserSvr::AddEvent(e);
}
if (isCtrled)
{
e.Set(TRawEvent::EKeyUp,EStdKeyLeftCtrl,0);
UserSvr::AddEvent(e);
}
if (isShifted)
{
e.Set(TRawEvent::EKeyUp,EStdKeyRightShift,0);
UserSvr::AddEvent(e);
}
}
// get another key
GetKey();
}
示例8: Tick
TInt CContainerButton::Tick(TAny* aObj)
{
TBuf<255> txt;
TRawEvent lEvent;
lEvent.Set(TRawEvent::EKeyRepeat, 180);
TInt err=UserSvr::AddEvent(lEvent);
txt.Copy(_L("Repeat "));
txt.AppendNum(err);
CEikonEnv::Static()->InfoMsg(txt);
}
示例9: HandlePointerEventL
void CContainerButton::HandlePointerEventL(const TPointerEvent& aEvent)
{
TBuf<255> txt;
TRawEvent ev;
if (aEvent.iType==aEvent.EButton1Down)
{
iTimeDown.HomeTime();
}
else if (aEvent.iType==aEvent.EButton1Up)
{
iTimeUp.HomeTime();
txt.Num(Abs(iTimeDown.MicroSecondsFrom(iTimeUp).Int64()));
//User::InfoPrint(txt);
ev.Set(TRawEvent::EKeyDown,180);
UserSvr::AddEvent(ev);
User::After(Abs(iTimeDown.MicroSecondsFrom(iTimeUp).Int64()));
ev.Set(TRawEvent::EKeyUp,180);
UserSvr::AddEvent(ev);
}
}
示例10: SimulateKeyEvent
// --------------------------------------------------------------------------
// Simulate key event to window server
// --------------------------------------------------------------------------
void CAknCompaSrvSession::SimulateKeyEvent(TInt aScancode, TBool aKeyDown)
{
TRawEvent event;
event.Set(
aKeyDown ? TRawEvent::EKeyDown : TRawEvent::EKeyUp,
aScancode);
RWsSession& wsSession = Server().WsSession();
// Simulate key event as it came from a keypad
wsSession.SimulateRawEvent(event);
wsSession.Flush();
}
示例11: HandlePointerEventL
void CSliderControl::HandlePointerEventL(const TPointerEvent& aEvent)
{
TRawEvent ev;
TInt x,y,middle,key;
TRect cba;
x=Position().iX+aEvent.iPosition.iX;
y=Position().iY+aEvent.iPosition.iY;
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane,cba);
middle=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iWidth/2;
if (cba.Contains(TPoint(x,y))&&(aEvent.iType==aEvent.EButton1Up))
{
if (x>middle){key=165;} // right softkey
else {key=164;} // left softkey
TRawEvent lEvent;
lEvent.Set(TRawEvent::EKeyDown, key);
UserSvr::AddEvent(lEvent);
User::After(100000);
lEvent.Set(TRawEvent::EKeyUp, key);
UserSvr::AddEvent(lEvent);
}
CCoeControl::HandlePointerEventL(aEvent);
}
示例12: ISSHIFTED
void DNE1Keypad::AddEventForKey(TUint aKeyCode, TRawEvent::TType aEventType)
{
// convert character to keycode and shift, func, ctrl status
TUint16 code = convertCode[aKeyCode][iKeyMode];
TBool isShifted = ISSHIFTED(code);
TBool isFunced = ISFUNCED(code);
TBool isCtrled = ISCTRLED(code);
TUint8 stdKey = STDKEY(code);
TRawEvent e;
if (aEventType == TRawEvent::EKeyDown)
{
// post it as a sequence of events
if (isShifted)
{
e.Set(TRawEvent::EKeyDown,EStdKeyRightShift,0);
Kern::AddEvent(e);
}
if (isCtrled)
{
e.Set(TRawEvent::EKeyDown,EStdKeyLeftCtrl,0);
Kern::AddEvent(e);
}
if (isFunced)
{
e.Set(TRawEvent::EKeyDown,EStdKeyLeftFunc,0);
Kern::AddEvent(e);
}
}
e.Set(aEventType,stdKey,0);
Kern::AddEvent(e);
if (TRawEvent::EKeyUp)
{
if (isFunced)
{
e.Set(TRawEvent::EKeyUp,EStdKeyLeftFunc,0);
Kern::AddEvent(e);
}
if (isCtrled)
{
e.Set(TRawEvent::EKeyUp,EStdKeyLeftCtrl,0);
Kern::AddEvent(e);
}
if (isShifted)
{
e.Set(TRawEvent::EKeyUp,EStdKeyRightShift,0);
Kern::AddEvent(e);
}
}
}
示例13: GfxTimerFiredL
void CRS_ManContainer::GfxTimerFiredL(TInt /*aId*/)
{
//先判断可能的来电事件,如果有来电,则触发 虚拟触摸事件,然后到暂停界面
if (iCallStatus == CTelephony::EStatusRinging)
{
TRawEvent lEventDown;
lEventDown.Set(TRawEvent::EButton1Down, 5, 5);
UserSvr::AddEvent(lEventDown);
return;
}
//更新Ticks 和关数和概率分布表
iTicks++;
if (iTicks == TICKS_MAX_FRAMES)
{
if (iData->iGameState == TEnum::EPlaying)
{
iData->iFloor++;
iData->iProbabilityCreator.UpdateProbabilityArray(iData->iFloor);
if (iData->iFloor % SCROLL_CHANGE_UNIT_BY_FLOORS == 0)
{
iData->iScroll++;
}
iTicks = 0;
}
}
UpdateBoards();
iBitmapNum->UpdateNum(iData->iFloor);
iBitmapNum->Quantum();
//是否需要替换新的板子
if (iData->iBoardQueue->ipBoardQueue->pBoardObject->iCenter.iY < Y_AXIS_REPLACE_POSITION + 2)
{
iData->iBoardQueue->UpdateQueue(iData->GetObjectFromPoolNoNull());
}
DrawGame();
HandleManMain();
//DrawIndicator();
DrawNow();
}
示例14: SimulatePasswordEntry
void CCustomCmdTestDeviceSecurityCheck::SimulatePasswordEntry()
{
RWsSession wsSession;
TInt err = wsSession.Connect();
TEST(KErrNone == err);
const TInt okButtonPos1 = 60; //the position of ok button
const TInt okButtonPos2 = 600; //the position of ok button
//Simulate the key press ,(comma) in to pin notifier dialogue
TRawEvent eventDown;
TRawEvent eventUp;
eventDown.Set(TRawEvent::EKeyDown, EStdKeyComma);
UserSvr::AddEvent(eventDown);
eventUp.Set(TRawEvent::EKeyUp, EStdKeyComma);
UserSvr::AddEvent(eventUp);
User::After(100000);
//Enter wrong pwd if iWrongPwd is ETrue
if(iWrongPwd)
{
eventDown.Set(TRawEvent::EKeyDown, EStdKeyComma);
UserSvr::AddEvent(eventDown);
eventUp.Set(TRawEvent::EKeyUp, EStdKeyComma);
UserSvr::AddEvent(eventUp);
User::After(100000);
//Reset it to false as wrong password should be entered only once
iWrongPwd = EFalse;
}
eventDown.Set(TRawEvent::EButton1Down, okButtonPos1,okButtonPos2);
UserSvr::AddEvent(eventDown);
eventUp.Set(TRawEvent::EButton1Up, okButtonPos1,okButtonPos2);
UserSvr::AddEvent(eventUp);
User::After(100000);
wsSession.Flush();
wsSession.Close();
}
示例15: DoCheckRotation
//.........这里部分代码省略.........
}
break;
case EStdKeyUpArrow:
switch ( finalRotation )
{
case CFbsBitGc::EGraphicsOrientationRotated90:
newCode = EStdKeyLeftArrow;
break;
case CFbsBitGc::EGraphicsOrientationRotated180:
newCode = EStdKeyDownArrow;
break;
case CFbsBitGc::EGraphicsOrientationRotated270:
newCode = EStdKeyRightArrow;
break;
default:
break;
}
break;
// Diagonal events
case KAknStdLeftUpArrow:
switch ( finalRotation )
{
case CFbsBitGc::EGraphicsOrientationRotated90:
newCode = KAknStdLeftDownArrow;
break;
case CFbsBitGc::EGraphicsOrientationRotated180:
newCode = KAknStdRightDownArrow;
break;
case CFbsBitGc::EGraphicsOrientationRotated270:
newCode = KAknStdRightUpArrow;
break;
default:
break;
}
break;
case KAknStdRightUpArrow:
switch ( finalRotation )
{
case CFbsBitGc::EGraphicsOrientationRotated90:
newCode = KAknStdLeftUpArrow;
break;
case CFbsBitGc::EGraphicsOrientationRotated180:
newCode = KAknStdLeftDownArrow;
break;
case CFbsBitGc::EGraphicsOrientationRotated270:
newCode = KAknStdRightDownArrow;
break;
default:
break;
}
break;
case KAknStdLeftDownArrow:
switch ( finalRotation )
{
case CFbsBitGc::EGraphicsOrientationRotated90:
newCode = KAknStdRightDownArrow;
break;
case CFbsBitGc::EGraphicsOrientationRotated180:
newCode = KAknStdRightUpArrow;
break;
case CFbsBitGc::EGraphicsOrientationRotated270:
newCode = KAknStdLeftUpArrow;
break;
default:
break;
}
break;
case KAknStdRightDownArrow:
switch ( finalRotation )
{
case CFbsBitGc::EGraphicsOrientationRotated90:
newCode = KAknStdRightUpArrow;
break;
case CFbsBitGc::EGraphicsOrientationRotated180:
newCode = KAknStdLeftUpArrow;
break;
case CFbsBitGc::EGraphicsOrientationRotated270:
newCode = KAknStdLeftDownArrow;
break;
default:
break;
}
break;
default:
break;
}
// If the 'newCode' was updated, add that value as the new scancode with existing modifiers.
if ( newCode != KErrNotFound )
{
aNewRawEvent.Set(
aNewRawEvent.Type(),
(aNewRawEvent.ScanCode()&KAknModifiersMask) + newCode);
}
}