How to use BluetoothSetLocalServiceInfo function in bluetooth developing?


  • Hi all, now I'm doing some experiment about the bluetooth app development. I want to change the local bluetooth device name use the function BluetoothSetLocalServiceInfo

    DWORD WINAPI BluetoothSetLocalServiceInfo(
      _In_opt_  HANDLE hRadioIn,
      _In_      const GUID *pClassGuid,
      ULONG ulInstance,
      const BLUETOOTH_LOCAL_SERVICE_INFO *pServiceInfoIn

    But I don't know what the parameters pClassGuid and ulInstance are. Is there any examle about the function BluetoothSetLocalServiceInfo?

    Thanks in advance.

    Kobe Yang

    Tuesday, April 02, 2013 8:25 AM

All replies

  • HI,

    For GUID it is defined in bthdef.h as
    SerialPortServiceClass_UUID (i.e. UUID16 0x1101).pass it in the function.

    Also you can try paasing ulong from these structures.It worked for me.  

    typedefstruct _BLUETOOTH_ADDRESS { union { BTH_ADDR ullLong; BYTE     rgBytes[6]; }; } BLUETOOTH_ADDRESS;

    typedefstruct _BLUETOOTH_DEVICE_INFO {
      DWORD             dwSize;
      ULONG             ulClassofDevice;
      BOOL              fConnected;
      BOOL              fRemembered;
      BOOL              fAuthenticated;
      SYSTEMTIME        stLastSeen;
      SYSTEMTIME        stLastUsed;
      WCHAR             szName[BLUETOOTH_MAX_NAME_SIZE];
    Createinstance like :BLUETOOTH_DEVICE_INFO btinfo;

    And get it filled via Bluetoothfindfirsrdevice();

    • Edited by Vipin1_44 Tuesday, October 22, 2013 6:56 PM
    Tuesday, October 22, 2013 6:05 PM