0

I am trying to make my VB.NET UWP application discoverable in iOS Bluetooth settings. I have based my implementation on the Bluetooth Advertisement sample code. However, my Windows device does not appear in iOS settings. I manually enable the Bluetooth radio via the Radios API, and have added the bluetooth, proximity and radio device capabilities to my app. I can tell that a signal is being sent out by my Bluetooth adapter, so I am unsure if I am sending the wrong data. The code I am using is below:

        Dim radlist = Await Radios.Radio.GetRadiosAsync()

        For Each rad As Radios.Radio In radlist
            If rad.Kind = Radios.RadioKind.Bluetooth Then
                Await rad.SetStateAsync(Radios.RadioState.On)
            End If
        Next

        Dim publisher As BluetoothLEAdvertisementPublisher = New BluetoothLEAdvertisementPublisher()
        Dim manufacturerData = New BluetoothLEManufacturerData()
        manufacturerData.CompanyId = &HFFFE
        Dim writer = New DataWriter()
        Dim uuidData As UInt16 = &H1234
        writer.WriteUInt16(uuidData)
        manufacturerData.Data = writer.DetachBuffer()
        publisher.Advertisement.ManufacturerData.Add(manufacturerData)
        publisher.Start()

What data should I send to make my Windows device discoverable, and how would I detect and handle pairing by the iOS device?

user9811991
  • 317
  • 5
  • 14
  • 1
    What would be the purpose of making your windows device discoverable in iOS settings? If suggest you download LightBlue for iOS, but you don't seem to be advertising a BLE service – Paulw11 Jul 11 '19 at 04:41
  • I read that a connection can be established by advertising the Windows device for pairing, and then the Windows device can begin querying and interacting with the iOS device. https://lists.apple.com/archives/bluetooth-dev/2013/Nov/msg00051.html So, I need to advertise some kind of service in order for Windows to show up as pairable? Are there any generic services I should use? @Paulw11 – user9811991 Jul 11 '19 at 13:06
  • 1
    If you want to connect to the iOS [ANCS](https://developer.apple.com/library/archive/documentation/CoreBluetooth/Reference/AppleNotificationCenterServiceSpecification/Introduction/Introduction.html) service then it is your device (the windows device) that needs to discover the ANCS service that is being advertised by iOS. Attempting to connect to the ANCS service and read the protected characteristic will trigger pairing/bonding – Paulw11 Jul 11 '19 at 13:24
  • Ah ok, thanks! @Paulw11 For some reason Windows wasn’t discovering any Bluetooth devices in the device picker, so that’s why I tried this. I might try discovering devices using a different API without the Windows device picker. – user9811991 Jul 11 '19 at 13:30
  • 1
    You can't use the device picker. You would need to write a program that looks specifically for the ANCS gatt service. – Paulw11 Jul 11 '19 at 13:35
  • So something like this should work? https://stackoverflow.com/a/36106137/ @Paulw11 – user9811991 Jul 11 '19 at 13:39
  • For watching Bluetooth devide (not BLE) Please refer this code [sample](https://github.com/microsoft/Windows-universal-samples/blob/master/Samples/DeviceEnumerationAndPairing/cs/Scenario2_DeviceWatcher.xaml.cs#L19). And before use it please enable Bluetooth capability. – Nico Zhu Jul 12 '19 at 10:08

0 Answers0