// ----------------------------------------------------------------------------- // CTestDomExtNotifiers::TestCANSASServiceL // ----------------------------------------------------------------------------- // TInt CTestDomExtNotifiers::TestCANSASServiceL( CStifItemParser& /*aItem*/ ) { // Print to UI _LIT( KTestDomExtNotifiers, "TestDomExtNotifiers" ); _LIT( KTestCANSASServiceL, "TestCANSASServiceL" ); TestModuleIf().Printf( 0, KTestDomExtNotifiers, KTestCANSASServiceL ); // Print to log file iLog->Log( KTestCANSASServiceL ); _LIT( KTextLine1, "RNotify(first line)" ); _LIT( KTextLine2, "second line" ); _LIT( KButton1, "Button1" ); _LIT( KButton2, "Button2" ); TInt response( -1 ); TRequestStatus status; RNotifier notifier; User::LeaveIfError( notifier.Connect() ); //This function can call ServiceL() function notifier.Notify( KTextLine1, KTextLine2, KButton1, KButton2, response,status ); User::WaitForRequest( status ); notifier.Close(); return KErrNone; }
void DoInteractiveTests() { TInt r; test.Start(_L("Connect to notifier server")); RNotifier n; r = n.Connect(); test(r==KErrNone); test.Next(_L("Launching simple notifier")); _LIT(KLine1,"Line1 - Select Button2"); _LIT(KLine2,"Line2 - or press enter"); _LIT(KButton1,"Button1"); _LIT(KButton2,"Button2"); TInt button=-1; TRequestStatus stat; n.Notify(KLine1,KLine2,KButton1,KButton2,button,stat); User::WaitForRequest(stat); test(button==1); test.Next(_L("Close connection to notifier server")); n.Close(); test.End(); }
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(); }
TInt CProfilerPowerListener::DisplayNotifierL(const TDesC& aLine1, const TDesC& aLine2, const TDesC& aButton1, const TDesC& aButton2) { RNotifier notifier; TRequestStatus stat; TInt buttonValue(0); User::LeaveIfError(notifier.Connect()); notifier.Notify(aLine1, aLine2, aButton1, aButton2, buttonValue, stat); User::WaitForRequest(stat); notifier.Close(); return buttonValue; }
// NOTE! This code does not do as documentation states. // Only second line text is shown and // "Ok" button on the left side. // return the value of button pressed (OK or CANCEL) TInt CSenBaseIdentityManager::YesNoQueryL(const TDesC& aLine1, const TDesC& aLine2, const TDesC& aButton1, const TDesC& aButton2) { RNotifier notifier; User::LeaveIfError(notifier.Connect()); CleanupClosePushL(notifier); TRequestStatus status; TInt buttonVal = -1; // NOTE! This code does not do as documentation states. // Only second line text is shown and // "Ok" button on the left side. // notifier.Notify(_L("Line 1 text"), _L("Line2 text"), // _L("B1Txt"), _L("B2Txt"), buttonVal, status); notifier.Notify(aLine1, aLine2, aButton1, aButton2, buttonVal, status); User::WaitForRequest(status); CleanupStack::PopAndDestroy(); // Close notifier #ifdef _SENDEBUG TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase , KMinLogLevel, _L8("User pressed button (%d)"), buttonVal)); #endif return buttonVal; }