Category: Bluetooth

  • Use Microsoft Bluetooth Stack on Toshiba M200

    I was asked how to replace the default Toshiba stack installed on the M200 with the Windows stack (to allow for .NET programmability). Luckily it’s easy to do and Toshiba include the necessary bits on the hard disk.


    First you need to uninstall the Toshiba stack – Go to Add/Remove programs and select “Bluetooth Stack for Windows by Toshiba”


    Next run the C:TOSHIBAMS_BluetoothBtMon2Inst.exe installer to install the BT monitor.


    Finally reboot the machine, the system will detect the radio and install the necessary drivers.

  • New Personal Area Networking Libraries

    The Bluetooth.NET library has now reached it’s v1.5 milestone and is now part of the 32feet.NET suite. It joins an updated version of my IrDA library for the desktop which now adds some features (borrowed from the Bluetooth developments) so provides a superset of IrDA functionality on either full or compact frameworks. On top of both these libraries sits Object Exchange, this new library makes it easy to programmatically send and receive files and objects over the Object Exchange (OBEX) protocol. This is designed to provide a similar experience to functionality available for .NET for conducting HTTP requests – ObexWebRequest and ObexListener.


    The concept of 32feet.NET is to look at personal area networking for the .NET developer whether your platform of choice is .NETCF on Windows CE or full framework on XP, Tablet PC, XP Embedded or Vista (32 Feet is the range of a standard Bluetooth device, that’s 10 metres if you prefer metric). The website has been setup with discussion forums for the current libraries and associated technologies, you’ll also find all the class library documentation, and of course the download itself which contains assemblies, source, help documentation and samples.

  • Bluetooth COM Ports On Windows CE

    Greg Scott from the Windows CE Networking team has posted an interesting article on how Bluetooth Virtual COM ports are implemented on Windows CE.


    Alongside the native code to setup a port, there are some details on the improvements in Windows Mobile 5.0 which now includes UI options to set both incoming and outgoing ports and is integrated into the bonding/pairing process. This means that OEMs no longer need to produce their own individual applets to expose this functionality.


    For managed code the Bluetooth.NET library wraps this functionality with the BluetoothSerialPort class.

  • Bluetooth Socket Options on Windows XP

    Windows XP supports a much smaller number of socket options for Bluetooth than Windows CE, although it generally provides alternative ways to get/set those properties. The table below shows those that are supported on XP and how they relate to their Windows CE equivalent. Notice that the only one which behaves the same on both platforms is SO_BTH_ENCRYPT




























    Windows XP


    Windows CE


    #define SO_BTH_AUTHENTICATE 0x80000001  // optlen=sizeof(ULONG), optval = &(ULONG)TRUE/FALSE


    #define SO_BTH_AUTHENTICATE                                    0x00000001    // optlen=0, optval ignored


    #define SO_BTH_ENCRYPT      0x00000002  // optlen=sizeof(ULONG), optval = &(ULONG)TRUE/FALSE


    #define SO_BTH_ENCRYPT                                               0x00000002    // optlen=sizeof(unsigned int), optval = &(unsigned int)TRUE/FALSE


    #define SO_BTH_MTU          0x80000007  // optlen=sizeof(ULONG), optval = &mtu


     


    #define SO_BTH_SET_MTU                                                0x00000006    // unconnected only! optlen=sizeof(unsigned int), optval = &mtu


    #define SO_BTH_GET_MTU                                               0x00000007    // optlen=sizeof(unsigned int), optval = &mtu


    #define SO_BTH_MTU_MAX      0x80000008  // optlen=sizeof(ULONG), optval = &max. mtu


     


    #define SO_BTH_SET_MTU_MAX                                    0x00000008    // unconnected only! optlen=sizeof(unsigned int), optval = &max. mtu


    #define SO_BTH_GET_MTU_MAX                                    0x00000009    // bound only! optlen=sizeof(unsigned int), optval = &max. mtu


    #define SO_BTH_MTU_MIN      0x8000000a  // optlen=sizeof(ULONG), optval = &min. mtu


    #define SO_BTH_SET_MTU_MIN                          0x0000000a    // unconnected only! optlen=sizeof(unsigned int), optval = &min. mtu


    #define SO_BTH_GET_MTU_MIN                         0x0000000b    // bound only! optlen=sizeof(unsigned int), optval = &min. mtu


    The current version of the Bluetooth.NET library doesn’t include the XP versions in the BluetoothSocketOptionName enumeration, but I have added these for the next release.

  • Bluetooth v1.4

    Today I gave a session at Slide5 on the latest version of the Bluetooth library – v1.4. Key changes for this release were some bug fixes to the samples, increased functionality for the desktop side (ability to bond devices) and service discovery (as yet XP only). I’ve also tidied up some of the code, in order to have just a single place to determine the platform at runtime. I’ll post a version of the OBEX demo I did shortly, but I’ll build it as a VS2003 project (the app used for the session demo was built with VS2005 Beta 2)


    Downloads

  • Interesting Bluetooth Project

    One of our forum members posted about an open source social networking project which uses the Bluetooth.NET library. The project is created by Software Greenhouse which is a joint venture between Microsoft India and Cynapse.



    Their initial prototype release and source code can be downloaded by registering at the Software Greenhouse site. The software will allow users of Windows Mobile devices to compare user profiles to look for shared interests and chat with other users. This is an interesting use of the technology and it will be interesting to see how the project evolves. Have you used the Bluetooth library in any projects? if so please leave a comment.

  • Bluetooth v1.3

    Today I’ve completed the v1.3 release of Bluetooth. This pulls together the latest binaries, source code, samples and help documentation into a single package. There are few differences in the public interface from previous releases, notably the BluetoothSerialPort class has been fixed and re-introduced, also the BondedDevices property for retrieving previously bonded devices from the registry.


    I’ve also prepared a class-library diagram to accompany this release:-



    OpenNETCF.Net.Bluetooth.1.3.50525.png (136.1 KB)


    You can download the installation package from here.

  • Change Device Assigned to Outbound COM Port

    With the Microsoft Bluetooth stack a single outbound virtual COM port is supported, to set this up you have to bond with the device. If you want to switch between several devices at different times this is awkward. You can however alter the registry settings between connections to switch devices.


    1. Setup an Outbound COM port for the first device


    2. Bond with the other device(s) you wish to use


    3. Make a note of the bluetooth IDs of these bonded devices – see the subkeys of [HKEY_LOCAL_MACHINESOFTWAREMicrosoftBluetoothDevice] for details


    4. Before switching devices ensure you do not have the outbound virtual COM port opened (often COM 5 but check on your device).


    5. Replace the value of “OBBDaddr” in the key [HKEY_LOCAL_MACHINESOFTWAREMicrosoftBluetoothSerialPort] with the bluetooth address of your required device.


    6. Open the COM port – now connects to the device specified in the above registry key.

  • Bluetooth Comparison

    Now that the dust has settled on MEDC, I’m thinking about how to move forward with the Bluetooth library. I had essentially put development on hold when I first heard that Microsoft were preparing their own source package prior to MEDC. When it was released, I was a little disappointed in their functionality (and compatibility) so I’ve decided to press on improving the Bluetooth.NET library. It’s going to take a few weeks to put together the next version, one key aim is to synchronise the source, samples, documentation and binaries with this next release, some of the previous releases have been binary only.


    In the meantime here is a comparison of the functionality available today in the widely available Bluetooth libraries/SDKs:-
















































































































































































      Managed libraries Native code SDKs
      Bluetooth.NET Microsoft Windows Embedded Source Tools for Bluetooth Technology High-Point BTAccess Microsoft Windows CE SDK Broadcom SDK
    Bluetooth Functionality  
    Toggle Radio * *   *  
    Device Discovery *   * * *
    Service Discovery     * * *
    Client Sockets * * * * *
    Server Sockets * * * * *
    COM Port mapping *   * * *
    Bluetooth Stacks  
    Microsoft Stack * *   *  
    Broadcom Stack     *   *
    Runtimes  
    .NET v1 *      
    .NET v2 *    
    .NETCF v1 *   *
    .NETCF v2 * *  
    Platforms  
    Pocket PC 2002     *   *
    Windows CE.NET 4.2 *     *  
    Windows Mobile 2003 *   * * *
    Windows CE 5.0 * *   *  
    Windows Mobile 5.0 * *   *  
    Windows XP (SP1 and above) *     *
    Package features  
    Help documentation *   * * *
    Source code * *      
    Sample projects *     *  
    Price FREE FREE $750 FREE $1,395

    Obviously your feedback will help shape the library, so what are the key features you’d like to see added or improved?