using the nugget package Microsoft.Windows.SDK.Contracts and following the code example provided by Microsoft # github
I am able to enumerate the BLE devices and get the exposed GATT services, but any attempt at pairing : DevicePairingResult result = await info.Pairing.PairAsync(DevicePairingProtectionLevel.EncryptionAndAuthentication);
(Tested with all of the possible protection levels) fails.
Form the official documentation no pairing is discussed. It seems that you can get a ble device which windows will automatically connect to and proceed, but my device requires a pin when pairing by hand which confuses me as to how windows could interact with my attributes without providing a pin or even pairing? (not tested).
If anyone has experience with pairing BLE devices to windows via code, any pointer would be greatly appreciated!
Related
Context: I'm working on a Windows 10 app that will allow users to quickly connect to a Bluetooth device. Because the native API is difficult to work with, I'm using the 'In The Hand' library. Anyway, back to the point: whenever I make a connect request. Before allowing me to connect, I receive this Pair a device notification.
I'm wondering if I can set Windows to automatically accept this permission for connecting the device. Is there a method in the Windows API that I can use to accomplish this?
Here is the link to the code: https://github.com/hasham7861/bluetooth-le-experiment/blob/master/Program.cs
In the picture I make a connect request to a bluetooth headset and then I get the notification on the bottom right, and only if I click allow to pair device then it pairs the device.
I hope this link helps you.
I apologize in advance if I misunderstood the question or if the data were meaningless
Windows 10 Connect to Bluetooth Classic Device without Pairing
https://github.com/microsoft/Windows-universal-samples/blob/main/Samples/DeviceEnumerationAndPairing/cs/Scenario9_CustomPairDevice.xaml.cs
I tried to create a little application to detect my Raspberry 3 B with a Xamarin Forms.
So, I used this package to use Bluetooth in my app.
As you can see, I only can scan Bluetooth Low Energy devices.
Well, when I use my bluetooth setting in my Android 6, I can see my RPI.
But when I use the sample of the author of the package, I can't see it.
I already opened a issue ticket, and it told me:
This library supports Bluetooth LE, not standard bluetooth. You need to make sure that your device is broadcasting on BLE.
But, I have lot of difficulties to broadcast on BLE and I don't understand how to do that.
Can you help me?
Thank you.
How can i test if my application bluetooth connection is working properly. I cant test it on phone because i dont have 2 windows phones. Also if 2 users connect do they share the same screen i.e if one of them enters some info in a textbox can i make it so that the other one is unable to see while the user that wrote text in the tb can clearly read it.
You can get the Bluetooth Manager in NuGet.
Download Bluetooth Manager
To practice I've packaged up my Bluetooth Manager library. This is a little wrapper class that makes it really easy to use Bluetooth on Windows 10 applications. I've not tried it on Windows 10 on Raspberry Pi (but I've tried it on lots of other systems and it works fine). You can find out a bit more about it here. I use it so that I can print message on my little home made Bluetooth printer, but you can use it anywhere you want to talk over a Bluetooth serial connection.
Oh, and in case you are wondering why it is version 1.0.1 and not version 1.0.0 I found an interesting quirk in nuget. If your library class doesn't have a public constructor the package will fail to work because Visual Studio will complain that the class is "Inaccessible due to its protection level.". That's what happens when you try to use version 1.0.0
I'm trying to broadcast a bluetooth signal from a Raspberry Pi 2 running Windows Iot Core so that I can connect to it from smartphones and other devices, but I've been stuck for the last couple days on actually receiving a pairing signal.
Using the Windows Bluetooth docs I am able to broadcast the signal and I can see it from my desktop as well as from my phone.
However, this is as far as I can get. I want to be able to pair without a PIN (the device will not have a screen), but the pairing fails any time the device is selected.
I am using
SocketProtectionLevel.BluetoothEncryptionAllowNullAuthentication
and
DevicePairingKinds.None
But the connection callback is never hit. I have looked at many similar questions that are either unanswered or do not have the appropriate information since I am using an RPI2 and not a desktop app.
I am not looking to pair via the web interface, but simply through code
.
[UPDATE]
I've tried the 32feet.NET library but it appears to be too old to support the PI2.
I also tried a few NuGet packages, nothing seems to work yet.
I am not master in IoT but recently, I have started exploring it so I know Raspberry Pi 2 is hardware and we can use it to develop some basic IoT device/concepts. I can not help you with the code but may be with some idea.
I remember, for making any embedded system, we used serial port of pc and transferred command to devices. Something similar I found in one of the tutorial from David Jones. It is about to connect Bluetooth to windows 10 using serial port.
In both the explanations, SPP (Serial Port Profile) is used and also Universal Windows App is referenced. May be you get some start point or spark to comlete you work.
Check this and this. It also uses RPi 2.
I've been given the task of building a Windows Mobile app for our company that quickly pairs a device by scanning it's bar code. I can discover the device, and talk to it, but I am stuck as far as pairing.
In C# / Windows Mobile 6, how do I pair a device? I don't really need to talk to the device within the app, I need to pair it so other applications can use it.
Is there an API I need to do this? I've seen things saying I need to register a pass key, etc? I can't seem to find any documentation on the actual pairing process, just connecting to it. (Just connecting to it, doesn't actually pair it.)
You can use my library 32feet.NET. Use method BluetoothSecurity.PairRequest See e.g. Bluetooth Security (That should work regardless of whether the device has Microsoft's own Bluetooth stack installed or the device has Widcomm/Broadcom or SSO Bluetopia).
The process of 'pairing' should also enable the services at the same time. If not we probably have other APIs for that too. Which services are used? SerialPort, others?