Bluetooth for Microsoft Device Emulator enables Bluetooth communication from and to the emulator.
Bluetooth connectivity with the Microsoft Device Emulator has been tested with the following SDKs images:
- Windows Mobile 5.0 Pocket PC SDK
- Windows Mobile 5.0 Smartphone SDK
- Windows Mobile 6 Professional SDK
- Windows Mobile 6 Standard SDK
Once I heard that Nokia has released S60 SDK Bluetooth Driver for Windows XP. Many of my Windows Mobile projects use Bluetooth, but Windows Mobile emulator doesn't support it. I realized if Nokia has done it, why I could not. Please notice I'm not a Microsoft employee and I'm here not to advertise either Microsoft or anyone else.
After a lot of investigations, I realized that Windows Mobile images have included 100% working Microsoft Bluetooth stack implementation. The only missing part was a Bluetooth hardware. Thus all to be done is to develop a Bluetooth HCI Transport Driver that carries HCI/ACL requests and responses to and from the real Bluetooth USB device connected to the desktop. But there were a few problems to address. The first one was how to access the HCI level of the Bluetooth Device. The only acceptable Bluetooth stack available for Windows that allows access to the HCI level is FreeBT stack. It's freeware and comes with source code. It's indeed the one I was looking for. The second problem was how to connect the device emulator and the desktop. I decided not to use the ActiveSync related methods. Also the Serial port sharing prevents me from using the Cellular Emulator. There is a CoreConn interface, but it has been introduced in Visual Studio 2008 and isn't available in Visual Studio 2005 which is my primary development platform. Thus the choice was quite obvious - Microsoft Remote Tools Framework. It uses the CoreCon interface either. Exactly the same the Visual Studio Smart Device Native Debugger uses. This way you get fully functional Bluetooth support on the emulator. You can write applications using managed or unmanaged code, use third party Bluetooth utilities and so on.
Please notice that you MUST have installed ALL the following:
- Windows XP or Windows Vista 32-bit with the latest service packs.
- Microsoft Visual Studio 2005 or 2008 with the latest service packs. Your Visual Studio installation must include the Smart Device Programmability feature.
- Windows Mobile 5.0 Pocket PC SDK and/or Windows Mobile 5.0 Smartphone SDK and/or Windows Mobile 6 Professional SDK and/or Windows Mobile 6 Standard SDK emulator images
- Microsoft Device Emulator (Recommended: Version 3.0)
- Microsoft Remote Tools Framework 1.00
Also you should have an available Bluetooth USB dongle.
This version of Bluetooth for Microsoft Device Emulator uses FreeBT project to access the Bluetooth USB dongle.
The project consists of the followings components:
- Device side
- Desktop side
- Microsoft Remote Tools Framework desktop plugin
- FreeBT USB Driver runtime
- FreeBT USB Driver
- Connected Bluetooth USB device
Bluetooth USB Driver Installation
- Open the Windows Device Manager.
- In the Device Manager, locate the Bluetooth device to be used as the FreeBT USB device.
- Click the right mouse button and select "Update Driver..." in the popup-menu.
- Select "No, not this time" and click "Next >".
- Select "Install from a list or specific location" and click "Next >".
- Select "Don't search. I will choose the driver to install" and click "Next >".
- Select the device driver and click the "Have Disk...".
- In the Locate File dialog, browse to fbtusb.inf file and click "Next >".
- When a "Hardware Installation warning" appears, click "Continue Anyway".
- Once the installation has been completed, click "Finish".
- The Device Manager should now display "FreeBT USB Driver" in the list of USB controllers.
Please refer to FreeBT documentation for more details.
- Install the Visual Studio 2005 or 2008 with the latest service packs. Your Visual Studio installation should include the Smart Device Programmability feature.
- Install the Microsoft Device Emulator. You should have already installed one along with the VS installation. Update it to the Microsoft Device Emulator 3.0.
- Install emulator images you need.
- You must have an USB Bluetooth dongle available. Plugin in it an available USB port.
- Install the FreeBT USB driver as described in the BLUETOOTH USB DRIVER INSTALLATION section.
- Install the Microsoft Remote Tools Framework 1.00.
- Install the FreeBT USB Driver as described in the BLUETOOTH USB DRIVER INSTALLATION section.
- Install all REQUIREMENTS section as described in the INSTALLATION section.
- Launch the Remote Tools Framework plugin BthEmulManager.cetool from "RTFx Plugin" folder.
- Select an emulator image from the list.
- Wait for the emulator to be connected.
- Select "Bluetooth for Microsoft Device Emulator" node.
- If you have a Bluetooth device attached successfully, then the Bluetooth device info (Address, Manufacturer, HCI Version, LMP Version) will be displayed. Bluetooth should now be operational in your emulator. An error code with the description will be displayed otherwise.
- To clear the communication log, click the right mouse button and select "Clear All".
- To copy current device information to the clipboard, select "Bluetooth for Microsoft Device Emulator" node, click the right mouse button and select "Copy to Clipboard".
- To switch off Bluetooth on the emulator, click "Connection" menu item and select "Disconnect from ... emulator".
- Microsoft Remote Tools Framework allows you to start two device emulators at the same time. If you have installed two or more FreeBT USB devices, click "Windows" menu item and select "Split Windows View". Repeat steps 3-6. You will get two Bluetooth powered emulators running simultaneously.
- It is possible to enable/disable device side logging. If you enable "Device Logging" checkbox, then remote logging will be enabled on the emulator. Have a look at \\Temp directory on the emulator. There should be created btd_bthemul_0.txt, btd_BthEmulAgent_0.txt, btd_bthemulcom_0.txt files.
- It is possible to enable/disable desktop side logging. If you enable "Desktop Logging" checkbox, then local logging will be enabled. Have a look at your installation directory. There should be created BthEmulManager.txt file.
- It is possible to enable/disable communication logging. Communication logging allows to see communication activities between the emulator and the Bluetooth device.
Q. I've installed the FreeBT USB Driver, but after deploying the emulator Bluetooth is still not working.
A. Install the Microsoft Remote Tools Framework 1.00 if you haven't done it yet. Launch the Remote Tools Framework plugin BthEmulManager.cetool from "RTFx Plugin" folder.
Q. I'm trying to connect Pocket PC 2003 SE Emulator, but I receive an error all the time: "The device Pocket PC 2003 SE VGA Emulator has a CPU type of ARMV4 and an operating system version of 4.21."
A. Pocket PC 2003 and Smartphone 2003 aren't supported yet.
Q. Which Windows Device Manager the README refers to?
A. Win2K&XP: Start -> Settings -> Control Panel -> System -> Hardware tab -> Device Manager
Vista: Start -> Settings -> Control Panel -> Hardware and Sound -> Device Manager
Q. I have started the BthEmulManager.cetool plugin for the first time, but nothing happens. There isn't Bluetooth in the emulator.
A. Try to restart the plugin for the previously chosen emulator. Also on the emulator, go to Settings -> Connections -> Bluetooth -> Mode tab and turn on Bluetooth.
You may also have problems with the FreeBT USB Driver itself. The driver is still (and will probably remain at this stage) in alpha version. There are a number of reports saying it has problems. The problems with this driver are the following:
- It stops working for no reason.
- It may miss packets in write/read operations. The problems start when you send large packets very fast. Most probably, the problem in an incorrect using HCI buffers (Read Buffer Size Command, Number Of Completed Packets Event).
- It isn't stable with some chipset like CSR.
I encourage you if you have such problems and have experience in the Windows driver development to try to improve the driver and share your results.
If something goes wrong after a while with the driver start the Device Manager, select the problem FreeBT USb Driver from the USB device list, click the right mouse button and select "Disable" in the popup-menu. After that, click the right mouse button again and select "Enable" in the popup-menu.
Thanks to Antony C. Roberts for his FreeBT open source stack. Without it, this release would not have been possible.
P.S. Sorry for my English. My native language is C++. But I also speak Russian very well. Please let me know about my mistakes.