<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28110/windows-10-thingy-52-ble</link><description>I&amp;#39;m attempting to write a plugin/dll to pull data from the Nordic Thingy52. I can scan all devices that are paired with windows 10, and load up the services, etc. 
 I can also read from descriptors that have explicit Read permissions. However, when I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 24 Jun 2019 10:41:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28110/windows-10-thingy-52-ble" /><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/194295?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 10:41:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e561970-d0c3-4995-ad9b-0ad97d337da8</guid><dc:creator>Ev1lC</dc:creator><description>&lt;p&gt;Old thread but very relevant today!&lt;/p&gt;
&lt;p&gt;I&amp;#39;m having exactly this issue. Has anyone figured out how to connect to a PAIRED BLE device on Windows??? Any help appreciated. See below.&lt;/p&gt;
&lt;p class=""&gt;The following code snippet works if the Bluetooth LE device is NOT paired. After pairing the same device, the call to&amp;nbsp;WriteClientCharacteristicConfigurationDescriptorAsync() fails with UNREACHABLE. No PIN code required for pairing.&lt;/p&gt;
&lt;p class=""&gt;The code will become part of a library with Java JNI bindings, so needs to be in C++. That&amp;#39;s why I&amp;#39;m using the WinRT stuff. I&amp;#39;m using VS 2017 target SDK 10.0.18362.0 running on Windows 10 1903.&lt;/p&gt;
&lt;p class=""&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;quot;pch.h&amp;quot;

#include &amp;lt;combaseapi.h&amp;gt;

using namespace winrt;
using namespace Windows::Foundation;
using namespace winrt::Windows::Foundation;
using namespace Windows::Storage::Streams;
using namespace Windows::Devices::Bluetooth;
using namespace Windows::Foundation::Collections;
using namespace Windows::Devices::Bluetooth::Advertisement;
using namespace Windows::Devices::Bluetooth::GenericAttributeProfile;

#define NU_SERVICE			&amp;quot;{6E400001-B5A3-F393-E0A9-E50E24DCCA9E}&amp;quot;
#define TX_CHARACTERISTIC	&amp;quot;{6E400002-B5A3-F393-E0A9-E50E24DCCA9E}&amp;quot;
#define RX_CHARACTERISTIC	&amp;quot;{6E400003-B5A3-F393-E0A9-E50E24DCCA9E}&amp;quot;

std::wstring guidToString(GUID uuid) {
	std::wstring guid;
	WCHAR* wszUuid = NULL;
	if(::UuidToString(&amp;amp;uuid, (RPC_WSTR*) &amp;amp;wszUuid) == RPC_S_OK) {
		guid = wszUuid;
		::RpcStringFree((RPC_WSTR*) &amp;amp;wszUuid);
	}
	return guid;
}

void str2ba(const char *straddr, unsigned long long *btaddr) {
	int i;
	unsigned int aaddr[6];
	unsigned long long tmpaddr = 0;

	if (sscanf_s(straddr, &amp;quot;%02x:%02x:%02x:%02x:%02x:%02x&amp;quot;, &amp;amp;aaddr[0], &amp;amp;aaddr[1], &amp;amp;aaddr[2], &amp;amp;aaddr[3], &amp;amp;aaddr[4], &amp;amp;aaddr[5]) != 6) {
		return;
	}
	*btaddr = 0;
	for (i = 0; i &amp;lt; 6; i++) {
		tmpaddr = (unsigned long long) (aaddr[i] &amp;amp; 0xff);
		*btaddr = ((*btaddr) &amp;lt;&amp;lt; 8) + tmpaddr;
	}
}

IAsyncAction OpenDevice(unsigned long long deviceAddress) {
	auto device = co_await BluetoothLEDevice::FromBluetoothAddressAsync(deviceAddress);

	std::wcout &amp;lt;&amp;lt; std::hex &amp;lt;&amp;lt;
		&amp;quot;Device Information: &amp;quot; &amp;lt;&amp;lt; std::endl &amp;lt;&amp;lt;
		&amp;quot;\tName     :&amp;quot; &amp;lt;&amp;lt; device.Name().c_str() &amp;lt;&amp;lt; std::endl &amp;lt;&amp;lt;
		&amp;quot;\tAddress  :&amp;quot; &amp;lt;&amp;lt; device.BluetoothAddress() &amp;lt;&amp;lt; std::endl &amp;lt;&amp;lt;
		&amp;quot;\tStatus   :&amp;quot; &amp;lt;&amp;lt; (device.ConnectionStatus() == BluetoothConnectionStatus::Connected ? &amp;quot;Connected&amp;quot; : &amp;quot;Disconnected&amp;quot;) &amp;lt;&amp;lt; std::endl &amp;lt;&amp;lt;
		&amp;quot;\tDeviceId :&amp;quot; &amp;lt;&amp;lt; device.DeviceId().c_str()  &amp;lt;&amp;lt; std::endl &amp;lt;&amp;lt;
		std::endl;

	GUID nusGUID, txcGUID, rxcGUID;
	CLSIDFromString(TEXT(NU_SERVICE), &amp;amp;nusGUID);
	CLSIDFromString(TEXT(TX_CHARACTERISTIC), &amp;amp;txcGUID);
	CLSIDFromString(TEXT(RX_CHARACTERISTIC), &amp;amp;rxcGUID);

	auto services = co_await device.GetGattServicesAsync();//BluetoothCacheMode::Cached);
	for(GenericAttributeProfile::GattDeviceService const &amp;amp; s : services.Services()) {
		std::wcout &amp;lt;&amp;lt; std::hex &amp;lt;&amp;lt; &amp;quot;\t\tService - Guid: [&amp;quot; &amp;lt;&amp;lt; guidToString(s.Uuid()) &amp;lt;&amp;lt; &amp;quot;]&amp;quot; &amp;lt;&amp;lt; std::endl;

		auto characteristics = co_await s.GetCharacteristicsAsync();
		for(GenericAttributeProfile::GattCharacteristic const &amp;amp; c : characteristics.Characteristics()) {
			std::wcout &amp;lt;&amp;lt; std::hex &amp;lt;&amp;lt; &amp;quot;\t\tCharacteristic - Guid: [&amp;quot; &amp;lt;&amp;lt; guidToString(c.Uuid()) &amp;lt;&amp;lt; &amp;quot;]&amp;quot; &amp;lt;&amp;lt; std::endl;

			if(c.CharacteristicProperties() == GattCharacteristicProperties::Notify) {
				printf(&amp;quot;Notify supported\n&amp;quot;);

				GattCommunicationStatus status = co_await c.WriteClientCharacteristicConfigurationDescriptorAsync(GattClientCharacteristicConfigurationDescriptorValue::Notify);
				switch (status) {
				case GattCommunicationStatus::AccessDenied:
					printf(&amp;quot;access denied\n&amp;quot;);
					break;
				case GattCommunicationStatus::ProtocolError:
					printf(&amp;quot;protocol error\n&amp;quot;);
					break;
				case GattCommunicationStatus::Unreachable:
					printf(&amp;quot;unreachable\n&amp;quot;);
					break;
				case GattCommunicationStatus::Success:
					c.ValueChanged([](GattCharacteristic const&amp;amp; charateristic, GattValueChangedEventArgs const&amp;amp; args) {
						std::wcout &amp;lt;&amp;lt; std::hex &amp;lt;&amp;lt;
							&amp;quot;\t\tNotified GattCharacteristic - Guid: [&amp;quot; &amp;lt;&amp;lt; guidToString(charateristic.Uuid()) &amp;lt;&amp;lt; &amp;quot;]&amp;quot; &amp;lt;&amp;lt; std::endl;
					});

					//
					// Code to write to BT device ommitted.... Sleep 5 secs then exit.
					//
					Sleep(5000);
				}
			}
		}
	}

	device.Close();
}

int main() {
	init_apartment();

	// Connect to a specific Bluetooth device.
	unsigned long long deviceAddress;
	str2ba(&amp;quot;db:e7:df:00:52:32&amp;quot;, &amp;amp;deviceAddress);
	printf(&amp;quot;device = %lld\n&amp;quot;, deviceAddress);

	try {
		OpenDevice(deviceAddress).get();
	} catch (const std::exception&amp;amp; e) {
		std::cout &amp;lt;&amp;lt; e.what() &amp;lt;&amp;lt; std::endl;
		return FALSE;
	}
	return TRUE;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/110892?ContentTypeID=1</link><pubDate>Mon, 11 Dec 2017 11:08:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b531fec8-183f-48bc-bc51-0b69a3387194</guid><dc:creator>Dopler</dc:creator><description>&lt;p&gt;Hello.
I had the same problem. If my device is paired -  fail connection (unreachable).
In last windows version (Windows 10 Fall Creators Update (1709, build 16229.19)) you can communicate with unpaired devices. I updated windows platform in my PC app, and was able to connect and subscribe to notifications after deleted from paired list in windows settings.&lt;/p&gt;
&lt;p&gt;// search for unpaired devices
var findAllDevicesTask = DeviceInformation.FindAllAsync(BluetoothLEDevice.GetDeviceSelectorFromPairingState(false)).AsTask();
Task.WaitAll(findAllDevicesTask);
var devices = findAllDevicesTask.Result;&lt;/p&gt;
&lt;p&gt;// connect
BluetoothLEDevice bluetoothLeDevice = null;
var deviceTask = BluetoothLEDevice.FromIdAsync(di.Id).AsTask();
Task.WaitAll(deviceTask);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/110891?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2017 16:02:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c915892-7014-4be1-9a9e-5802a13fcb2b</guid><dc:creator>jublin</dc:creator><description>&lt;p&gt;I was able to figure it out. I had to include the latest (Fall/Spring Creators update winmd files via &lt;a href="https://blogs.windows.com/buildingapps/2017/01/25/calling-windows-10-apis-desktop-application/"&gt;blogs.windows.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And not have the device paired. For some reason, it&amp;#39;s the only device that can&amp;#39;t be paired with windows first and enumerated that way.&lt;/p&gt;
&lt;p&gt;There&amp;#39;s some other issues I&amp;#39;ve run into, but I think they are on the windows side entirely.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/110890?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2017 11:37:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7c989a3-3346-44aa-bba1-11a6dd8ab5ef</guid><dc:creator>ketil</dc:creator><description>&lt;p&gt;Did you manage to get it working? I think a lot of people would be interested in this project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/110887?ContentTypeID=1</link><pubDate>Fri, 03 Nov 2017 07:50:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41a7af2a-8436-4343-b12e-d9f973f091e3</guid><dc:creator>ketil</dc:creator><description>&lt;p&gt;We do not have any reference applications for Thingy:52 on Windows but a good starting point would be the official &lt;a href="https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BluetoothLE"&gt;Bluetooth Low Energy UWP samples on GitHub&lt;/a&gt;. You may also ask development questions directly to the &lt;a href="https://blogs.msdn.microsoft.com/btblog/2017/05/11/welcome-to-the-new-windows-bluetooth-core-team-blog/"&gt;Windows Bluetooth Core Team&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://github.com/NordicSemiconductor/Android-Nordic-Thingy"&gt;source code for the Thingy:52 Android app&lt;/a&gt; is also available on GitHub.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/110886?ContentTypeID=1</link><pubDate>Fri, 03 Nov 2017 07:42:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db7b1b1a-7bf0-4818-a0d7-164c916acd14</guid><dc:creator>ketil</dc:creator><description>&lt;p&gt;After verifying that you could connect, read, write and start notifications with the Bluetooth LE Explorer app it is unlikely that the problem lies with the Thingy:52 firmware. To be completely sure I recommend downloading either the Android or iOS app and verifying that everything works. The apps will also let you know which firmware version you are running as well as perform a firmware upgrade (DFU).&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/windows/uwp/devices-sensors/bluetooth-low-energy-overview"&gt;GATT and GAP roles were introduced in Windows 10 version 1703&lt;/a&gt; so you would not have been able to communicate with Thingy:52 or any other BLE device before this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/110885?ContentTypeID=1</link><pubDate>Thu, 02 Nov 2017 14:49:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61024f22-cab4-4f6f-80c3-cf6a3b72c54b</guid><dc:creator>jublin</dc:creator><description>&lt;p&gt;Well, I&amp;#39;ve also tried removing the motion characteristic config (and just using defaults) in my application. It still &lt;strong&gt;fails to even subscribe to notifications&lt;/strong&gt; (device unreachable).&lt;/p&gt;
&lt;p&gt;Is there a reason why a previously paired device (which was required before the spring update) would fail to connect?&lt;/p&gt;
&lt;p&gt;The device name characteristic works on LE Explorer. The last letter (I renamed to &amp;quot;jubthingy&amp;quot;) appears to be cut off on a scan (&amp;quot;jubthing&amp;quot; is shown in lists) for a few refreshes.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m beginning to wonder if it&amp;#39;d be faster to write an android app, but I feel like the problem lies somewhere in either the windows api&amp;#39;s or in the firmware itself. This is the first time I&amp;#39;ve seen a device that&amp;#39;s paired to the machine be unreachable, but work without being paired. They usually work both ways.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/110889?ContentTypeID=1</link><pubDate>Thu, 02 Nov 2017 09:10:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0c0f876-733a-41d4-a5e3-8a3501c998f8</guid><dc:creator>ketil</dc:creator><description>&lt;p&gt;I am unable to provide any help regarding the nuget package although I agree that it might be out of date.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/110888?ContentTypeID=1</link><pubDate>Thu, 02 Nov 2017 09:06:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b9cc4f7-25e4-47ca-897e-d160e514ead1</guid><dc:creator>ketil</dc:creator><description>&lt;p&gt;If I understand you correctly you are now able to connect to your Thingy:52 from the Bluetooth LE Explorer app. You are also able to list the complete GATT Profile and start notifications.&lt;/p&gt;
&lt;p&gt;Please try this: Write a new name (10 bytes or less) to the device name characteristic with UTF-8 as the format, using the Bluetooth LE Explorer app. Does it show the new name when you go back to the GATT overview?&lt;/p&gt;
&lt;p&gt;The reason I ask you to change the device name rather than the motion config characteristic is just to make it simple to verify if write operations work properly. The motion config characteristic is a bit more involved and if you try to write an invalid value it will not work and I am unsure if the Bluetooth LE Explorer app will let you know if it failed and why. See the list of &lt;a href="https://nordicsemiconductor.github.io/Nordic-Thingy52-FW/documentation/firmware_architecture.html#fw_arch_ble_services"&gt;Thingy:52 GATT Services and Characteristics&lt;/a&gt; for details.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/110884?ContentTypeID=1</link><pubDate>Thu, 02 Nov 2017 00:12:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4dedf830-2df1-4f01-bb32-66cbe5191571</guid><dc:creator>jublin</dc:creator><description>&lt;p&gt;So, I think i&amp;#39;ve narrowed down the problem, but have no idea how to fix it.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using this nuget package: &lt;a href="https://github.com/ljw1004/uwp-desktop/blob/master/README.md"&gt;github.com/.../README.md&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Which stops at Anniversary update prior to Spring Creators update. Spring update added pairing-free ble device enumeration and connection. If I have the device previously paired (which I have been doing for multiple other devices), it will fail to connect and show the device as unreachable. If I pair the device and leave the settings window open (Thingy thinks it&amp;#39;s connected), Bluetooth LE will Let me connect. If I turn the device off/on, it will be unreachable.&lt;/p&gt;
&lt;p&gt;In my windows application, If I pair and leave the window open, I can write the notify out and such, but the valuechanged for whichever characteristic is never hit.&lt;/p&gt;
&lt;p&gt;Any ideas on that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/110883?ContentTypeID=1</link><pubDate>Wed, 01 Nov 2017 15:43:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f9f4281-5b9d-4997-818b-ed47527823fb</guid><dc:creator>jublin</dc:creator><description>&lt;p&gt;So this doesn&amp;#39;t work either.&lt;/p&gt;
&lt;p&gt;Running BLE Explorer on Windows Version 1709 (fall 2017 update), I still get device unreachable on trying to connect, and the Thingy LED&amp;#39;s appear to flash a bright blue/white before going back into advertising mode. I can&amp;#39;t even list all the characteristics.&lt;/p&gt;
&lt;p&gt;This is a little funny, because I essentially had the same issue with TI sensortag on version 1703, where it wouldn&amp;#39;t ever write out (but the device wouldn&amp;#39;t reset).&lt;/p&gt;
&lt;p&gt;edit: unpaired from system and tried again, and it connects.&lt;/p&gt;
&lt;p&gt;I can get notifications, but I cannot write to the motion config characteristic still.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Windows 10, Thingy 52 BLE</title><link>https://devzone.nordicsemi.com/thread/110882?ContentTypeID=1</link><pubDate>Wed, 01 Nov 2017 11:18:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d74c3b08-e2ff-48f5-ab76-44f4463700c8</guid><dc:creator>ketil</dc:creator><description>&lt;p&gt;Hi jublin,&lt;/p&gt;
&lt;p&gt;Just did a test on a Microsoft Surface 2 with Windows 10 version 1703 (Creators update). I used the &lt;a href="https://www.microsoft.com/nb-no/store/p/bluetooth-le-explorer/9n0ztkf1qd98?rtc=1"&gt;Bluetooth LE Explorer&lt;/a&gt; app which was downloaded from the Windows Store.&lt;/p&gt;
&lt;p&gt;With the app I was able to connect to Thingy:52 and read the GATT profile. In addition I was able to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Read and write device name with the device name characteristic (EF680101-9B35-4933-9B10-52FFA9740042)&lt;/li&gt;
&lt;li&gt;Start notifications for the temperature characteristic (EF680201-9B35-4933-9B10-52FFA9740042)&lt;/li&gt;
&lt;li&gt;Read and write Eddystone URL with the Eddystone URL characteristic (EF680105-9B35-4933-9B10-52FFA9740042)&lt;/li&gt;
&lt;li&gt;Start notifications for the Euler characteristic (EF680407-9B35-4933-9B10-52FFA9740042)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Could you try to recreate these steps? Also make sure your Windows 10 version is updated since Microsoft has made several recent improvements to their BLE drivers and APIs.&lt;/p&gt;
&lt;p&gt;If you manage to get it working with the Bluetooth LE Explorer app you might want to take a look at the &lt;a href="https://blogs.msdn.microsoft.com/btblog/2017/08/21/bluetooth-le-explorer-code-is-open-source-now/"&gt;source code&lt;/a&gt; for tips on how to write your plugin/dll. I also recommend &lt;a href="https://channel9.msdn.com/Events/Build/2017/P4177"&gt;these videos&lt;/a&gt; introducing BLE for Windows developers.&lt;/p&gt;
&lt;p&gt;Also, there is no need to do an MTU request unless you are using the speaker or microphone on Thingy:52. The reason for this is to get an adequate throughput.&lt;/p&gt;
&lt;p&gt;Ketil&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>