locked
Bluetooth Guid RRS feed

  • Question

  • Hi,

    I have been looking at the code sample in Windows Mobile 6 SDK called SpaceWar2D. Here, the main program uses the Microsoft.WindowsMobile.SharedSource.Bluetooth library. 

    In order to start the Bluetooth service for the game, the author uses as Guid: {54C12AE8-160C-4422-8550-4900EC1C4ACD}

    - How could I know which Guid should I use in order to transfer a file to another device which doesn´t have Windows Mobile as OS?

    - Which is the best alternative to this library in order to work with Bluetooth? 
       I ask this because it seems I need to have paired devices in order to use the library.

    Thanks in advance.


    Friday, December 11, 2009 9:10 AM

Answers


  • The service GUID is whatever you specify (Guid.NewGuid()) to indentify the service; the client needs to use the same GUID to connect to the service.

    There is another bluetooth library 32feet.NET:
    http://www.codeplex.com/32feet 

    You will find sample codes after you install the library.



    Please mark the post that helps you, and unmark that does not. This benefits our community.
    • Marked as answer by lopezavila69 Tuesday, December 15, 2009 9:30 AM
    Tuesday, December 15, 2009 9:10 AM

  • The following pages will show you how to discover bluetooth devices, and once you find the device how to query the services it provides.

    Discovering Bluetooth Devices Using Winsock 
    Querying Service Capability on Remote Bluetooth Devices

    The sample codes are native but you can get the general idea. As you can see both tasks (device discovery and service discovery) use the same set of functions SALookupServiceBegin/WSALookupServiceNext/WSALookupServiceEnd but with different arguments.


    Please mark the post that helps you, and unmark that does not. This benefits our community.
    • Marked as answer by lopezavila69 Wednesday, December 16, 2009 1:10 PM
    Wednesday, December 16, 2009 3:33 AM

All replies


  • The service GUID is whatever you specify (Guid.NewGuid()) to indentify the service; the client needs to use the same GUID to connect to the service.

    There is another bluetooth library 32feet.NET:
    http://www.codeplex.com/32feet 

    You will find sample codes after you install the library.



    Please mark the post that helps you, and unmark that does not. This benefits our community.
    • Marked as answer by lopezavila69 Tuesday, December 15, 2009 9:30 AM
    Tuesday, December 15, 2009 9:10 AM
  • But what GUID should I use if, for example, I want to transfer a file to a Nokia or a Iphone mobile which doesn´t support Windows Mobile?
    Tuesday, December 15, 2009 11:29 AM

  • The following pages will show you how to discover bluetooth devices, and once you find the device how to query the services it provides.

    Discovering Bluetooth Devices Using Winsock 
    Querying Service Capability on Remote Bluetooth Devices

    The sample codes are native but you can get the general idea. As you can see both tasks (device discovery and service discovery) use the same set of functions SALookupServiceBegin/WSALookupServiceNext/WSALookupServiceEnd but with different arguments.


    Please mark the post that helps you, and unmark that does not. This benefits our community.
    • Marked as answer by lopezavila69 Wednesday, December 16, 2009 1:10 PM
    Wednesday, December 16, 2009 3:33 AM
  • Hi Chunseng,

    It seems difficult to create a new library using PINVOKE. 
    As you say in other thread, using Winsocks should be the last alternative. I´ll try with the OpenNetCF project and 32feet.NET.
    I´ll try to post any possible solution.

    Does anyone know any other alternatives?

    Thanks in advance.
    Tuesday, December 22, 2009 8:46 AM
  • Hi, 

    The bluetooth library 32feet.NET is very useful because it encapsulates the RFCOMM-based profiles used in Bluetooth. 
    I have looked again to the Microsoft Library provided in the sample and the methods you pointed at me appears: 

    [DllImport(WINSOCK_DLL)] public static extern int WSALookupServiceBegin(byte[] querySet, int flags, ref int lookupHandle);
    
    [DllImport(WINSOCK_DLL)] public static extern int WSALookupServiceNext(int lookupHandle, int flags, ref int bufferLen, byte[] results); 
    
    [DllImport(WINSOCK_DLL)] public static extern int WSALookupServiceEnd(int lookupHndle); 

    Using the former library you can avoid all these steps (apart from creating some byte arrays) by calling one function. 

    Do you think it would be faster using home-made P/Invokes or the 32feet library? 
    Is there any complete sample with P/Invokes?

    Thanks in advance.


    Tuesday, December 22, 2009 5:51 PM