Wiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007 (779890), страница 56
Текст из файла (страница 56)
These are specified in the epoc.ini file in \epoc32\data.Table 10.2 shows the keys that are available in the UIQ emulator.Table 10.2 PC key mappings to UIQ emulator keysPC keyUIQ emulator keyNumeric keypad <minus>Numeric keypad +Numeric keypad 8Numeric keypad 4Numeric keypad 6Numeric keypad 2Numeric keypad 5Numeric keypad EnterPage up (TwoWayUp)Page down (TwoWayDown)Cursor up (FourWayUp)Cursor left (FourWayLeft)Cursor right (FourWayRight)Cursor down (FourWayDown)Enter (FourWayConfirm)Enter (FourWayConfirm)CommunicationsThe Symbian OS emulator can use a variety of communications methods,such as Bluetooth, infrared or TCP/IP, to access the outside world.• You can use a supported serial infrared pod for infrared beaming orcommunication with an infrared-enabled mobile phone.• You can use a serial Bluetooth device.
The S60 v3 FP1 emulator alsocontains support for USB Bluetooth dongles.• You can use a LAN for TCP/IP communications.• You can use a PC-style serial cable, often available for data-capablemobile phones, to connect the Symbian OS emulator to a mobilephone. Note that particular phones may not support all the ATcommands required.InfraredThe easiest way to set up the SDK for IrDA is via the configuration dialogs.288DEBUGGING AND THE EMULATORIn the S60 3rd Edition emulator, go to Tools, Preferences, then selectthe PAN tab. Enable IrDA then choose the appropriate COM port number.If your pod doesn’t work with the default settings, you’ll need to edit theconfiguration file, as explained below.For the UIQ 3 SDK, launch the SDKConfig application from theStart menu, select the default device and click on OK, then go to theCommunications tab and select the appropriate IrDA port.
Again, ifyou use a pod incompatible with the default, you’ll need to edit theconfiguration file manually.Symbian OS needs a plain serial port interface to the IR pod – USBpods are unsupported. This means that you must not install any Windowsdrivers that come with the IR pod you are using. You can see if there areany IR drivers installed by looking in the Windows Device Manager andchecking for infrared devices. If you see your IR pod listed there you willneed to uninstall the Windows drivers before Symbian OS can use it.To edit the configuration file for non-default hardware, open the file\epoc32\release\winscw\udeb\z\private\101f7989\esock\ir.irda.esk.
The two settings you need to change are irPod andirPhysicalCommPort.• The irPhysicalCommPort should be set to the value of the SymbianOS port to which the IR pod is attached. Note that COM1 on Windowsis COMM::0 on Symbian OS, COM2 is COMM::1 etc.• The irPod value should be set to one of following options, dependingon which IR pod you are using: actisys220l, actisys220l+,actisys220li, tekram, jeteye7201, jeteye7401, parallax, ifoundry8001a, connectTech.Make sure that the lines contains precisely one space after the ‘=’ sign:irPod= actisys220lBluetoothThe easiest way to set up the SDK for Bluetooth is via the configurationdialogs.In the S60 3rd Edition emulator, go to Tools, Preferences, then selectthe PAN tab.
Enable Bluetooth then choose the appropriate HCI and portnumber.For the UIQ 3 SDK, launch the SDKConfig application from the Startmenu, select the default device and click on OK, then go to the Communications tab and select the appropriate COM port. If you need to changethe HCI in use, you’ll need to edit the configuration file manually. Openthe file \epoc32\release\winscw\udeb\z\private\101f7989\EMULATOR DEBUGGING289esock\bt.bt.esk and find the [hci] section.
Edit the port= setting to the appropriate Symbian OS COMM port number (remember thatCOM1 on Windows is COMM::0 on Symbian OS, COM2 is COMM::1etc.). The hcidllfilename= setting should contain the name of theappropriate DLL. Again, ensure that both lines contain only a singlespace, after the ‘=’ sign.IP networkThere are various ways to connect the emulator to an IP network – infact, the S60 3rd Edition emulator is already set up to use WinSock. TheUIQ 3 emulator can install WinPCap during installation – if you allowedthis, just launch the SDKConfig application from the Start menu, go to theCommunications tab and press Apply Ethernet to set it up.10.2 Emulator DebuggingIDEs such as Carbide.c++ or CodeWarrior allow you to interactivelydebug programs running in the emulator.
They support standard debugging techniques such as setting breakpoints in the source code, steppingthrough code, and examining memory and variables.To do this, you must do a debug build (in Carbide.c++ choose an‘emulator debug’ option when you select the SDK and Build Configurationinitially; in CodeWarrior, select Project, Set Default Target, WINSCWUDEB) to generate the debugging information that the emulator needs.The following sections outline debugging issues related to SymbianOS on Carbide.c++ and CodeWarrior. They can be used in conjunctionwith the standard debugging techniques mentioned above, which arediscussed in the product documentation.Carbide.c++ IDEBefore debugging your program, set up the debugger configuration panel,by selecting Run, Debug (see Figure 10.3). Ensure that, when debugging,you use the UDEB versions of both your program and the emulator.In the Debugging tab, select the View Process output checkbox to directstandard output messages to the console.
Selecting the View Windowssystem messages checkbox logs all Windows’ system messages.Run the debug build of your project by right-clicking the project namein the C/C++ Projects view and selecting Debug As, Debug Symbian OSApplication.Carbide.c++ allows you to step over, step into and step out of code byusing breakpoints.
You can set or hide breakpoints and examine threadstacks, memory and variables during the debugging process. Symbolics290DEBUGGING AND THE EMULATORFigure 10.3Carbide.c++ Debugger Settingsfiles are loaded by default and symbolics can be viewed. Figure 10.4shows the debugging console layout.CodeWarrior IDEBefore starting to debug an application, you should turn on the logging.Select Edit, <selected build> Settings (e.g., WINSCW UDEB Settings).
Inthe Debugger, Debugger Settings panel (see Figure 10.5), select the LogSystem Messages checkbox. If you select Auto-Targeting in the LibraryTargeting selection box, the debugger retrieves symbolic data for DLLs asthey are loaded.Once you have started to debug your program, by pressing F5 or byselecting Project, Debug, you may inspect current active processes fromView, Processes (see Figure 10.6). This provides information about therunning processes and is useful if your program invokes other processes orcomponents, to check whether all those processes are correctly invokedand running or not.EMULATOR DEBUGGINGFigure 10.4Carbide.c++ debugging console layoutFigure 10.5CodeWarrior Debugger Settings panel291292DEBUGGING AND THE EMULATORFigure 10.6CodeWarrior Process ViewFurthermore, you can open symbolics files by selecting View, Symbolics (see Figure 10.7).
When debugging information is available for loadedDLLs, the function names are displayed, so you can then look into theimplementations of problematic functions provided by the relevant DLL.You can set or hide breakpoints and examine program stack, memoryand variables during the debugging process. If the DLL source code isavailable, you can even step into it and set breakpoints in it.Emulator Debugging KeysIn debug builds, the emulator GUI provides special key combinationsfor resource checking and redrawing, trapping memory leaks and checking that drawing code functions correctly.
These are available usingCtrl+Alt+Shift. There are also some special key combinations for loggingwindow server events and actions, and a few other miscellaneous keys.Resource allocation keys• A shows the number of heap cells allocated on the user heap by thecurrent program.• B shows the number of file server resources in use by the currentprogram.• C shows the number of window server resources in use by the currentprogram.EMULATOR DEBUGGING293Figure 10.7 CodeWarrior Symbolics View• P shows the settings dialog for the heap-failure tool.The heap failure tool artificially generates resource allocation failures.It is used to test the efficiency of an application during such failures. Youcan set the options as: App heap failure Type (Random or Deterministic),Wserv heap failure Type, and File failure tool.• Q turns off heap-failure mode.Drawing keys• R redraws the whole screen, to test whether the application handles acomplete redraw properly.• F enables window server auto-flush for all programs using the currentcontrol environment.• G disables window server auto-flush for all programs using the currentcontrol environment.Window server logging keysNote that this group of keys does not work on the UIQ 3 SDK.• E starts (enables) window server logging.• D stops (disables) window server logging.294DEBUGGING AND THE EMULATOR• W dumps the full window tree.• H dumps the contents of the window server’s heap.Miscellaneous keys• K kills the application that currently has keyboard focus.• T brings up a task list in which running applications can be switchedto or closed down.
Note that this is a debugging aid only.• V turns on or off verbose information messages in the emulator logfile epocwind.out.• Z sends keys A through J in fast sequence to the application, to test itsability to handle fast repeated keys.Emulator SettingsThe emulator can be configured by editing the file \epoc32\data\epoc.ini. You should back up this file before making anychanges.For example, the platform security settings can be modified, allowingyou to ignore platform security when you are debugging:• PlatSecDiagnostics: when a platform security policy check fails andthis setting is ON, a diagnostic message may be written to theemulator log file epocwind.out.
Diagnostic messages start with thetext ‘∗PlatSec∗’ followed by either ‘ERROR’ or ‘WARNING’• PlatSecEnforcement: when a capability or other platform security policy check fails and after any diagnostic message has been displayed,if this setting is OFF, the system continues as though the platformsecurity check was passed. If this setting is ON, then the appropriateaction for a failed platform security check happens• MegabytesOfFreeMemory: if you are testing memory, you can set theamount of RAM memory (enter a number)• LogToDebugger: if set to 1, system messages are logged to a debuggingwindow that can be viewed from the IDE.