|
||
The housekeeping chores normally undertaken by the GUI consists of ensuring the file server is running, loading the physical and logical device drivers, and starting the comms server.
Emulator console applications must ensure that they explicitly force a connection to the file server. If this isn’t done, none of the required device drivers or comms modules will be able to load.
#if defined (__WINS__)
RFs f;
User::LeaveIfError(f.Connect());
f.Close();
#endif
Any test applications that haven’t been launched by the GUI will need to explicitly load up the correct physical and logical device drivers. Notice that the physical device driver for emulator builds is different to that for target builds (which is, of course, what you would expect).
#if defined (__WINS__)
#define PDD_NAME _L("ECDRV")
#else
#define PDD_NAME _L("EUART1")
#endif
#define LDD_NAME _L("ECOMM")
TInt r = User::LoadPhysicalDevice (PDD_NAME);
if (r != KErrNone && r != KErrAlreadyExists)
User::Leave (r);
r = User::LoadLogicalDevice (LDD_NAME);
if (r != KErrNone && r != KErrAlreadyExists)
User::Leave (r);
Finally, while the comms server is normally opened by both a GUI and the emulator as a matter of course, it would have to be explicitly started if neither were present.
r = StartC32 ();
User::LeaveIfError (r);