Accept inbound Bluetooth pairing request programmatically on an RPi3 running windows IoT - bluetooth

I am using an RPi3 to control a machine which will be able to communicate with android and other bluetooth devices. I used the Rfcomm Bluetooth chat example to establish bluetooth communication. The issue that I am facing right now is that my android app cannot connect to windows app until the two devices pair and I need to go on the windows device portal to accept the pairing request for the RPi. Is there a way to automate this programmatically so that the windows app can accept all inbound pairing requests?

You could programmatically pair/unpair request on RPi3 running with windows IoT. Please refer to scenarios 8 and 9 in this uwp sample: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/DeviceEnumerationAndPairing.
It seems that windows 10/ Windows 10 IoT Core does not support DevicePairingKinds.None.I have tested to pair with parameter as DevicePairingKinds.None,it is failed. You can set as DevicePairingKinds.ConfirmOnly to work around.
deviceInfoDisp.DeviceInformation.Pairing.Custom.PairAsync(DevicePairingKinds.ConfirmOnly);

Related

Bluetooth connection via HID/HSP profiles (Smartphone/PWA to IoT device)

Bluetooth connection via HID/HSP profiles (Smartphone/PWA to IoT device)
We are developing an IoT device and face issues with automatic connectivity to the smartphone via Bluetooth, as we have to use a PWA instead of a native app.
We consider using a standard profile (e.g. Headset Profile (HSP), Human Interface Device Profile (HID)) to enable communication via Bluetooth between device and PWA.
We now require a workaround for the following issue:
When using HSP/HID, existing connections to the smartphone's hardware (e.g. headset, keyboard) can be interrupted.
Have you faced similar issues and do you know workarounds for this?
Are you knowledgeable about alternative connection mechanisms (e.g. NFC, SIM) to connect IoT with PWA incl. pros and cons?

How to allow only 1 connection to BlueZ GATT server at any given moment?

I'm working on Bluetooth on the embedded Linux. I'm using BlueZ and D-Bus. I have a server taken from the example https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server.
I have the app such as nRF installed in 2 iPhones. I'm able to connect to my Linux Bluetooth server at the same time. I'm able to modify the characteristic from either of the iPhone app. But this is a problem because we don't want it. We'd like to have only 1 phone connected to the Linux device. That way, the same characteristic won't be modified by more than 1 phone app at the same time.
Is there a way to allow only 1 connection to the Linux Bluetooth GATT server at any given time?
Thanks.
Yes, the way to do this is to disable/stop advertisements on your Linux device as soon as a connection is established. This way, upon a connection, your Linux device will no longer be advertising and remote devices will no longer be able to connect to it.

Bluetooth LE - PAN1720 BlueRadios Serial Port Profile with Windows

I am using a Single-Mode Bluetooth Low Energy PAN1720BR BLE dongle which is loaded with the firmware "BlueRadios nBlue 1.2.1.3.1.0-PAN1720" (latest). When plugged to a computer, I can control and configure this PAN1720BR module with AT Commands through a terminal application on the computer.
With a second computer equipped with a standard BLE dongle, I can pair and connect to the PAN1720BR. See configuration below:
PC1 + PAN1720BR <---- BT 4.0 ----> PC2 + Standard BLE dongle + App running on PC2
The problem is that BLE does not have an SPP profile, so to establish a communication between the two PCs, I need to write an application on PC2. The PAN1720BR has a proprietary profile called BlueRadios Serial Port (BRPS) which is not a standard.
BlueRadios provides libraries for iOS and Android so that we can connect a cellphone to a PAN1720BR and communicate wih it. But they are silent about how to connect a PC (Windows) to a PAN1720BR. When establishing the connection, the Battery service (standard) installs properly on PC2, but the service corresponding to BRSP does not install, driver is missing. What is going on here is not very clear to me.
My goal is to write an application to be run on PC2 to enable communication between the two PCs. My question is, how can I access the Bluetooth with my application? Please correct me if I'm wrong, but I believe my app needs to access the ATT/GATT layer in order to read/write data.
Do you have any sample code that would help, in Java (prefered), C/C++, C# or anything else that would help on Windows?
Thank you
For an App with BLE Module from BlueRadios you must use the ATT/GATT Profile or you use the library from BlueRadios with there BRSP Profile.

How to connect to Bluetooth OBD II with visual C++ and for PC

I'm trying to use a Bluetooth OBDII (on-board diagnosis) to connect with a Bluetooth dongle connected to my computer (My OS is windows 7). The dongle connects to the device and assigns it 2 virtual com ports (COM4 for incoming and COM5 for outgoing), But unfortunately I couldn't communicate with this device over the virtual com port. I also attempted to work with winsock library but I didn't find any example for working with Bluetooth OBD and send and receive the instruments. I just found one Bluetooth API for android but it's not useful for me because I want to implement it inside the visual C++ and for PC. and right now I have 2 questions about that :
1. which method is better, Virtual com port or winsock and how ?
2. Do you have any sample code for working with Bluetooth OBD ?
1: Has your device a ELM327 chip? If so, you can setup a serial port over bluetooth, and communicate with that port. I don't know winsock very much, but I think a serial port is better suited for this job.
To set it up, have a look here: http://windows.microsoft.com/en-us/windows7/choose-a-com-port-for-a-bluetooth-enabled-device
Maybe if you can pair with the device, windows 7 will automagically set it up?
2:
You might want to have a look at: http://icculus.org/obdgpslogger/
It's open-source, so you can have a peek how it works. There's also a simulator in the package, which could help you developing/testing. Mostly is Linux based, but it should give you hints where to go. There are also windows installers available for the simulator.

Can PeerFinder class of .NET communicate with mobile phone devices through laptop via bluetooth?

I doubt the limitation of PeerFinder class in .NET. Can it make connection only with other laptops when implemented on laptop and phone to same phone when implemented on phone? Is it limited only to communicate with Windows OS devices, or is it able to communicate with any bluetooth device irrespective of OS?
Kindly, help me if you are sure of this class capabilities. I have seen the implementation of 32Feet.NET but my question is limited about PeerFinder class and its limitations.
Start from this link, in which you can find several useful links for WinRT communication (the suggested protocol to use from Windows Phone 8 to communicate using NFC or Bluetooth)
http://blogs.ugidotnet.org/Nick60/archive/2012/12/30/win-rt-proximity-communication.aspx
You have two possible scenarios:
App to Device: you can connect a Windows Phone 8 device to third party devices (for example a LEGO robot or car audio systems) Bluetooth/RFCOMM (that is serial port profile, for the emulation of RS232 serial connections).
App to App: for communications between Windows Phone 8 devices and also Windows 8/Windows RT devices!
The PeerFinder class is the base class for discover another instance of your app on a nearby device and create a socket connection between the peer apps by using a tap gesture or by browsing:
http://msdn.microsoft.com/en-us/library/windows/apps/br241203.aspx
Hope this helps!
Unfortunately, it seems that the only way to stablish a socket connection using Bluetooth between a WP8 app and a Windows 8 app is by triggering the connection using NFC tap gesture. Although the PeerFinder documentation suggests that you might be able to specify AlternateIdentities to advertise peers running on both devices, it seems that Windows 8 relies on WiFi Direct, while WP8 uses Bluetooth.
So, if you are not able to use the NFC tap gesture between both devices to trigger the connection, you might not be able to pair both apps running on the different devices.
See this thread for more info.

Resources