Click here to Skip to main content
15,879,348 members
Articles / Mobile Apps / Windows Mobile

Bluetooth for Microsoft Device Emulator

Rate me:
Please Sign up or sign in to vote.
4.91/5 (17 votes)
31 Jul 2009GPL37 min read 160.5K   81   18
Bluetooth for Microsoft Device Emulator enables Bluetooth communication from and to the emulator.

Image 1

Introduction

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

Background 

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 <http:>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 <http:>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<http: familyid="35e9ef0f-833f-4987-9d1f-157a0a6a76e4&DisplayLang=en">. 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.

Requirements

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.

Note

This version of Bluetooth for Microsoft Device Emulator uses FreeBT project to access the Bluetooth USB dongle.

Architecture Overview

The project consists of the followings components:

  1. Device side
  2. Desktop side
    • Microsoft Remote Tools Framework desktop plugin
    • FreeBT USB Driver runtime
    • FreeBT USB Driver
    • Connected Bluetooth USB device

Image 2

Bluetooth USB Driver Installation

  1. Open the Windows Device Manager.
  2. In the Device Manager, locate the Bluetooth device to be used as the FreeBT USB device.
  3. Click the right mouse button and select "Update Driver..." in the popup-menu.
  4. Select "No, not this time" and click "Next >".
  5. Select "Install from a list or specific location" and click "Next >".
  6. Select "Don't search. I will choose the driver to install" and click "Next >".
  7. Select the device driver and click the "Have Disk...".
  8. In the Locate File dialog, browse to fbtusb.inf file and click "Next >".
  9. When a "Hardware Installation warning" appears, click "Continue Anyway".
  10. Once the installation has been completed, click "Finish".
  11. The Device Manager should now display "FreeBT USB Driver" in the list of USB controllers.

Please refer to FreeBT documentation for more details.

Installation

  1. Install the Visual Studio 2005 or 2008 with the latest service packs. Your Visual Studio installation should include the Smart Device Programmability feature.
  2. 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.
  3. Install emulator images you need.
  4. You must have an USB Bluetooth dongle available. Plugin in it an available USB port.
  5. Install the FreeBT USB driver as described in the BLUETOOTH USB DRIVER INSTALLATION section.
  6. Install the Microsoft Remote Tools Framework 1.00.

Getting Started

  1. Install the FreeBT USB Driver as described in the BLUETOOTH USB DRIVER INSTALLATION section.
  2. Install all REQUIREMENTS section as described in the INSTALLATION section.
  3. Launch the Remote Tools Framework plugin BthEmulManager.cetool from "RTFx Plugin" folder.
  4. Select an emulator image from the list.
  5. Wait for the emulator to be connected.
  6. Select "Bluetooth for Microsoft Device Emulator" node.
  7. 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.
  8. To clear the communication log, click the right mouse button and select "Clear All".
  9. 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".
  10. To switch off Bluetooth on the emulator, click "Connection" menu item and select "Disconnect from ... emulator".
  11. 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.
  12. 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.
  13. 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.
  14. It is possible to enable/disable communication logging. Communication logging allows to see communication activities between the emulator and the Bluetooth device.

Image 3

Image 4

Image 5

Troubleshooting

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:

  1. It stops working for no reason.
  2. 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).
  3. 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

Thanks to Antony C. Roberts for his FreeBT open source stack. Without it, this release would not have been possible.

History 

  • 2009-05-15
    • Small improvements
  • 2009-04-13
    • Small improvements
  • 2009-04-08 
    • Original article

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.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
Belarus Belarus
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionHow to select bluetooth device as audio source Pin
pankaj motiyar19-Jun-12 21:15
pankaj motiyar19-Jun-12 21:15 
AnswerRe: How to select bluetooth device as audio source Pin
Dmitry Klionsky19-Jun-12 22:06
Dmitry Klionsky19-Jun-12 22:06 
General64 bit OS Pin
trying2programme4-Oct-09 18:06
trying2programme4-Oct-09 18:06 
GeneralRe: 64 bit OS Pin
Dmitry Klionsky4-Oct-09 22:24
Dmitry Klionsky4-Oct-09 22:24 
GeneralRe: 64 bit OS Pin
trying2programme5-Oct-09 0:02
trying2programme5-Oct-09 0:02 
GeneralRe: 64 bit OS [modified] Pin
Dmitry Klionsky5-Oct-09 4:19
Dmitry Klionsky5-Oct-09 4:19 
GeneralRe: 64 bit OS Pin
Dmitry Klionsky5-Oct-09 5:56
Dmitry Klionsky5-Oct-09 5:56 
GeneralRe: 64 bit OS Pin
trying2programme5-Oct-09 19:15
trying2programme5-Oct-09 19:15 
GeneralSample Project Pin
sunil.n.cs30-Jul-09 0:40
sunil.n.cs30-Jul-09 0:40 
GeneralRe: Sample Project Pin
Dmitry Klionsky31-Jul-09 8:36
Dmitry Klionsky31-Jul-09 8:36 
Questionbluetooth hardware unavailable Pin
zjj_fly27-Apr-09 0:21
zjj_fly27-Apr-09 0:21 
Hi,
Although it appears "Bluetooth for microsoft Device Emulator", but it can not connected Emulator(Address, Manufacturer, HCI Version, LMP Version displays null).
Could you tell me? Thanks...
AnswerRe: bluetooth hardware unavailable Pin
Dmitry Klionsky27-Apr-09 4:05
Dmitry Klionsky27-Apr-09 4:05 
AnswerRe: bluetooth hardware unavailable Pin
renshou_20031-Jun-10 16:32
renshou_20031-Jun-10 16:32 
QuestionWhere is BthEmulManager.cetool Pin
Jeaken23-Apr-09 23:09
Jeaken23-Apr-09 23:09 
AnswerRe: Where is BthEmulManager.cetool Pin
Dmitry Klionsky24-Apr-09 0:10
Dmitry Klionsky24-Apr-09 0:10 
GeneralGood stuff Pin
Dr.Luiji13-Apr-09 20:57
professionalDr.Luiji13-Apr-09 20:57 
GeneralVery Useful Pin
Joel Ivory Johnson9-Apr-09 8:19
professionalJoel Ivory Johnson9-Apr-09 8:19 
GeneralGreat article! Pin
Kumar.Prabhu9-Apr-09 1:29
Kumar.Prabhu9-Apr-09 1:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.