ne of the coolest things Microsoft has shipped with the Windows Mobile 6 SDK is the Cellular Emulator. The Cellular Emulator is a software-based emulator that emulates a real cellular network so that developers can test their phone and SMS applications without using a real device.
This article will walk you through the detailed steps for setting up your Windows Mobile 6 Professional and Standard emulators to work with the Cellular Emulator. You’ll also learn about some of the pitfalls and what workarounds you can use to leverage the Cellular Emulator successfully.
|Figure 1. Launching the Emulator: This shows the COM port number to which the Cellular Emulator is listening.
Launching the Cellular Emulator
To find the Cellular Emulator, go to Start?>Programs?>Windows Mobile 6 SDK?>Tools?>Cellular Emulator. After launching (see Figure 1), you can see the COM port number located at the bottom left of the screen. Most computers should display either COM3 or COM4.
Configuring a Windows Mobile Emulator to Connect to the Cellular Emulator
To launch a Windows Mobile emulator, launch Visual Studio 2008 and go to Tools?>Device Emulator Manager….
Select the emulator you want to use. As an example, choose a Professional emulator; right-click on Windows Mobile 6 Professional Emulator and select Connect (see Figure 2).
|Author’s Note: Remember that only Windows Mobile 6 Professional and Standard emulators can connect to the Cellular Emulator; Classic emulators cannot be used as they do not have phone radios.
Now, configure the Windows Mobile emulator by selecting File?>Configure…. In the emulator’s Properties page, select the Peripherals tab. Under “Serial Port 0,” enter the COM port that you see in your Cellular Emulator (see Figure 3). Click OK.
You need to perform a soft reset on the Windows Mobile Emulator (File?>Reset?>Soft). This is important because the emulator will not recognize the Cellular Emulator if you do not reset it. After the reset, the Windows Mobile emulator should have a full-signal indicator (see Figure 4).
For a Windows Mobile Standard device, the signal will look like Figure 5.
Configuring Data Connections
One of the uses of the Cellular Emulator is to emulate 2G and 3G network connections for your Windows Mobile emulator. Doing so will provide your applications with Internet access without needing to use the ActiveSync or network card mapping technique.
Configuring data connections using GPRS (via the Cellular Emulator) is straightforward for a Windows Mobile Professional emulator. Follow these steps to set up an Internet connection using the Cellular Emulator:
- Go to Start?>Settings.
- Select the Connections tab.
- Select Connections.
- Under the My ISP item, select “Add a new modem connection.”
- Enter a name for the connection and select Cellular Line (GPRS). Click Next (see Figure 6).
- For access point name and login credential information, leave them empty.
Using Internet Explorer, you can now determine whether the connection is successful. Figure 7 shows that, if the connection is successful, you’ll see the G icon shown at the top of the Windows Mobile emulator. On the Cellular Emulator’s end, you’ll see the number of bytes transferred across the data channels, as well as the indicator showing that GPRS is connected.
To emulate a faster network connection, click on the Switch to 3G button on the Cellular Emulator. You’ll see the 3G icon on the Windows Mobile emulator (see Figure 8).
If you cannot connect to the Internet, or you cannot see the G symbol, go to the Settings?>Advanced tab and click on the Select Networks button. Ensure that you have the configuration shown in Figure 9.
For Windows Mobile Standard devices, the process is a little more involved:
- Go to Start?>Settings.
- Select Connections.
- Select GPRS.
- Select New….
- In the “Description:” field, give the new connection a name, say PPP.
- In the “Connects to:” dropdown list, select Internet.
- In the “Access point:” name, enter some text. Click Done.
- Back in the Connections screen, select Menu?>Advanced.
- In the “Internet connection:” dropdown list, select PPP. Click Done.
You can now try to make a connection to the Internet to see if the setup works.
Making Phone Calls
You can make a phone call from the Cellular Emulator and the Windows Mobile emulator will receive an incoming call (see Figure 10).
Likewise, the Windows Mobile emulator can also make an outgoing call and the call will be displayed in the Cellular Emulator (see Figure 11). The Cellular Emulator also shows a list of numbers (7272024, 7272020, etc) that you can use to simulate different phone conditions (such as busy line, call reject, and so on).
Sending and Receiving SMS Messages
You can also use the Cellular Emulator to send SMS messages to the Windows Mobile emulator (see Figure 12). You can send a chain of messages by checking the “Repeatedly” checkbox and specifying the interval between messages.
You can also send SMS messages from the Windows Mobile emulator and the messages will be displayed in the Cellular Emulator (see Figure 13).
Some Common Problems
In my experience, you are likely to encounter problems with the Cellular Emulator if you install the Windows Mobile 6 SDK on a notebook. You are likely to see an error that says “COM17 is used, please verify” (or something similar). There is no official way to resolve this, but some folks have been able to work around this by first uninstalling the Windows Mobile 6 SDK, disabling the Bluetooth services, and then installing the Windows Mobile 6 SDK again.
If you find that the Windows Mobile emulator is not receiving SMS messages/phone calls made from the Cellular Emulator, the first place to check is the COM port settings in the Emulator Properties page. If you shut down the Windows Mobile emulator and do not save its current state, restarting it will cause it to lose the COM port number you have set previously. Hence, in general, it is always a good idea to save an emulator’s state when exiting it.