I'm having issues trying to find my Bluetooth Smart heart rate monitor in a Windows Phone app I'm creating. To start I'm using the sample app from MSDN that demonstrates use of the Bluetooth Generic Attribute Profile (Gatt) Windows Runtime API. This is a new API available for WP 8.1.
The following snippet is where the heart rate monitor discovery takes place:
var devices = await DeviceInformation.FindAllAsync(
GattDeviceService.GetDeviceSelectorFromUuid(GattServiceUuids.HeartRate),
new string[] { "System.Devices.ContainerId" });
After debugging on my phone the devices found is always zero. After some research I believe this is because the DeviceInformation.FindAllAsync method only returns devices that has been already paired on the phone using the system settings. I am unable to pair my heart rate monitor in the Bluetooth system settings as it cannot find it. I've tested it on my PC and it can find the heart rate monitor however it always fails when I try to pair it.
One thing to note is that I am able to use my heart rate monitor with the Adidas miCoach app (which does not require pairing through the system settings). The discovery and connection takes place directly in the app. Does any know how this works?
My hardware:
Wahoo Tickr heart rate monitor
Lumia 925 (OS version: 8.10.12397.895)
Resources:
MSDN Sample - Bluetooth Generic Attribute Profile - Heart Rate Service
Channel9 - Apps for Bluetooth Smart Devices
UPDATE 2014-07-23:
I'm running the Lumia Cyan update and the Tickr heart rate monitor now shows up in the Bluetooth system settings, however I am unable to pair it. I get the error message "couldn't connect". This is the same behaviour as on a PC. Interestingly I can no longer connect the Tickr heart rate monitor to the miCoach app. It seems like they updated the app and the page for configuring a heart rate monitor has changed.
You'll need Windows Phone 8.1 with Nokia Cyan update, otherwise you won't be able to pair your HRM. For testing, you could get an HTC phone, or a 630, that comes with Cyan.
The phone itself supports BLE heart rate monitor obviously, but the API to access the monitor is private. That's why micoach / Sports Tracker can access it, but your app (which uses the official 8.1 API) cannot until Cyan.
Related
I'm working on an universal application running in a Rpi3 with Windows 10 IoT 14393.67 using speech synthesis and recognition. I've been using an USB microphone for the input and the audio jack connected to speakers for the synthetized voice, but I wanted to change it to use a bluetooth headset instead.
I've paired a headset to the device using the integrated bluetooth connection in the Rpi3, but I couldn't figure out how to access the microphone and the speakers on the headset from my c# code. Is this possible to archieve?
UWP apps can do quite advanced stuff even on the Raspberry Pi. What you described is quite common and Microsoft even provides a set of Bluetooth related samples to get started with:
Device enumeration and pairing sample
You might also want to take a look at the Bluetooth section of UWP documentation on MSDN.
When developing an application that communicates with a Bluetooth Low Energy device on Windows, does one have to write separate code for Windows 8.1 and Windows 10?
I need to connect to a custom device that only has a Bluetooth Low Energy chip in it, the reason I think it would need a separate version is because the API might be different for Windows 10? That is the question, is it the same API?
I wonder if it is possible to discover unpaired Bluetooth devices programmatically within a Windows 10 tablet application.
I really don't want to pair by Settings -> Devices -> Bluetooth.
Unfortunately I couldn't find any documentation/example that would have helped.
I tried to search for Bluetooth devices by using the BluetoothLEAdvertisementWatcher but I wasn't able to find any. Probably because these devices were no BluetoothLE devices. Thought these were compatible.
Also I thought it would be possible to create a CLI/C++ wrapper that I could reuse in my UWP application but I feel very uncertain about that as not the whole (especially the interfacing part of the) Win32 API is re-usable in UWP environment.
At a last option I thought there must be a way to just get the list of devices that Windows generates when entering Settings -> Devices -> Bluetooth and I tried to achieve that by using a DeviceWachter but without success.
Now I am very desperate. For my application it would be horrible to manually pair each and every device before using it. I cannot understand why Microsoft cuts the developers so enormous.
Thanks in advance for your help.
Grace's answer is correct. I tried this sample before but stopped working on it as it expected a Windows Phone instead of a Windows 10 tablet.
Now I extracted the DeviceWatcher part but created the DeviceWatcher with the selector BluetoothDevice.GetDeviceSelectorFromPairingState(false). Only with this selecter the watcher was able to finde unpaired Bluetooth devices.
It also works with:
DeviceInformation.FindAllAsync(BluetoothDevice.GetDeviceSelectorFromPairingState(false))
I wonder if it is possible to discover unpaired Bluetooth devices programmatically within a Windows 10 tablet application.
Yes, it's possible.
I tried to search for Bluetooth devices by using the BluetoothLEAdvertisementWatcher but I wasn't able to find any. Probably because these devices were no BluetoothLE devices.
You used a wrong watcher. What you need is DeviceWatcher, not BluetoothLEAdvertisementWatcher. The difference between them is that the DeviceWatcher is for enumerating devices dynamically, while the BluetoothLEAdvertisementWatcher is for receiving Bluetooth Low Energy (LE) advertisements.
There is an official Device enumeration and pairing sample, you can refer to scenario 8 of this sample, this sample is absolutely what you need.
I'm working on a Windows Universal App that communicates with BluetoothLE heart rate monitors. As of yesterday (related to a windows update, I'm thinking), things appear to be suddenly broken.
Specifically:
When I first pair a HRM device to my computer (in windows settings, not through their API), my app sees the device just fine, and can subscribe to notifications from the GATT Heart Rate Service (through a method close to the code here, in the C# sample.)
In all subsequent connection attempts, the app will detect the device normally, and indicate that it is paired to windows, but the HRM in question has a Device.ConnectionStatus of BluetoothConnectionStatus.Disconnected, and never reports hear rate updates.
If you run the MSDN sample above, you'll see the same thing, even though it's a Windows 8/8.1 sample.
This leaves me in a really sticky spot - I need to be able to communicate with these devices, but as of right now, it appears that I can only do so consistently unpairing the device from windows, and repairing it. That is obviously not acceptable.
I've found a few articles that seem to be tangentially related, but none seem to have found a solution. Help!
apologies if the question is quite basic, I am inexperienced in USB programming and I might be missing some conceptual detail here.
For our industrial solution we are supposed to provide communication between our PC wpf application and windows embedded HH 8.1 application. Ideally we would like this to be over USB.
I see a lot of sample code to connect directly to USB devices from host role.
However in our case the Windows Embedded HH device (Panasonic FZ-E1) will have the device role listening. I could not find any way to register to raw data sent from our PC application via USB events. I examined UMDF (user mode driver framework) which has examples about writing drivers for usb devices, yet it seems like it is for device manufacturers and us not being the manufacturer for Panasonic HH we should not/cannot use our own driver and we have to use the WinUSB driver it already has in place.
Windows Embedded 8.1 HH has some USB apis unlike windows phone, yet all the functionality provided in the API seems like connecting to external USB devices with the host role. When we use USBlyzer I see that there is some USB traffic towards the device from the PC so it looks it should be possible for the HH to have the listening device role. What am I missing here, any ideas?
Any help/direction is greatly appreciated.
P.S: I also tried windows connectivity api examining the source code of windows phone power tools yet it seems like the the dlls for addon packages here to handle transfer via agents is not there for newer versions of windows phone anymore.