Update contrib.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\window\t_wsimp.cpp
19 #include <e32std_private.h>
27 LOCAL_D RConsole theConsole;
29 LOCAL_C void readKeys()
31 // Read keys until ESC pressed
40 User::WaitForRequest(s);
41 } while((TInt)k.Code()!=EKeyEscape);
44 LOCAL_C void printf(TRefByValue<const TDesC> aFmt,...)
46 // Print to the console
50 if (theConsole.Handle()==KNullHandle)
52 TInt r=theConsole.Init(_L("T_SWIMP"),TSize(KConsFullScreen,KConsFullScreen));
53 __ASSERT_ALWAYS(r==KErrNone,User::Panic(_L("Open-Console"),0));
54 r=theConsole.Control(_L("+Maximize +NewLine -Lock -Wrap"));
55 __ASSERT_ALWAYS(r==KErrNone,User::Panic(_L("Config-Console"),0));
60 aBuf.AppendFormatList(aFmt,list);
61 TInt r=theConsole.Write(aBuf);
62 __ASSERT_ALWAYS(r==KErrNone,User::Panic(_L("Write-Console"),0));
66 GLDEF_C TInt E32Main()
68 // Test the various kernel types.
72 TVersion v(KE32MajorVersionNumber,KE32MinorVersionNumber,KE32BuildVersionNumber);
73 TName vName = v.Name();
74 printf(_L("T_SWIMP %S\n"),&vName);
75 TName uvName = User::Version().Name();
76 printf(_L("Epoc/32 %S\n"),&uvName);
81 theConsole.ReadCancel();
82 User::WaitForRequest(s);
83 __ASSERT_ALWAYS(s.Int()==KErrCancel || s.Int()==KErrNone, User::Panic(_L("Test Fail"),1));
85 TInt r=theConsole.Control(_L("+Raw"));
86 __ASSERT_ALWAYS(r==KErrNone,User::Panic(_L("Set Raw Mode"),0));
88 printf(_L("Raw mode - hit ESC to continue\r\n"));
93 User::WaitForRequest(s);
94 if (k.Type()==TRawEvent::EKeyDown)
98 printf(_L("Down %d\r\n"),k.Code());
100 else if (k.Type()==TRawEvent::EKeyUp)
101 printf(_L("Up %d\r\n"),k.Code());
104 r=theConsole.Control(_L("-Raw"));
105 __ASSERT_ALWAYS(r==KErrNone,User::Panic(_L("Reset Raw Mode"),0));
107 printf(_L("Normal mode - hit ESC to continue\r\n"));
111 theConsole.Read(k,s);
112 User::WaitForRequest(s);
113 if (k.Code()==EKeyEscape)
115 printf(_L("Key %d\r\n"),k.Code());
118 printf(_L("Completed OK\n"));
120 printf(_L("Key click set to LOUD - press keys, ESC to continue...\n"));
123 HAL::Get(HAL::EKeyboardClickVolumeMax, max);
124 HAL::Set(HAL::EKeyboardClickVolume, max);
125 HAL::Set(HAL::EKeyboardClickState, ETrue);
129 printf(_L("Key click set to SOFT...\n"));
131 HAL::Set(HAL::EKeyboardClickVolume, 0);
132 HAL::Set(HAL::EKeyboardClickState, ETrue);
136 printf(_L("Key click set to LOUD...\n"));
138 HAL::Set(HAL::EKeyboardClickVolume, max);
139 HAL::Set(HAL::EKeyboardClickState, ETrue);
143 printf(_L("Key click set to LOUD and OFF...\n"));
145 HAL::Set(HAL::EKeyboardClickVolume, max);
146 HAL::Set(HAL::EKeyboardClickState, EFalse);