c#


Connecting to bluetooth device using BluetoothLEDevice.FromIdAsync results in errors


I am building an app for the hololens using Unity. I want to connect to a bluetooth device. I started building a plugin in Visual Studio which I could call from my Unity project to find and connect to a device using bluetooth.
I used the documentation of Microsoft regarding this project: https://docs.microsoft.com/en-us/windows/uwp/devices-sensors/gatt-client
The query for nearby devices works like a charm. Upon calling this function the events are properly launched when a device is found or removed. But when trying to create the function to connect to a device using the BluetootLEDevice.FromIdAsync() I get the following error:
ErrorCS4036'IAsyncOperation' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'IAsyncOperation' could be found (are you missing a using directive for 'System'?)
I am using the System reference though, so what am I doing wrong here? This is the code I'm using:
private static async void ConnectDevice(string deviceInfoID)
{
// Note: BluetoothLEDevice.FromIdAsync must be called from a UI thread because it may prompt for consent.
BluetoothLEDevice bluetoothLeDevice = await BluetoothLEDevice.FromIdAsync(deviceInfoID);
}

Related Links

rabbitmq when to use basic reject over basic nack?
I can't use variable assigned in Try{} scope, in main scope, but after adding return in catch{} I can?
How to emulate PuTTY raw connection in C#?
Postgresql npgsql first connection takes too long
c# how to end streamreader
LINQ to Entities does not recognize the method 'Int32 CompareTo(System.String)' method
Setting the SelectIndex of combobox invoking SelectedIndexChanged event
Creating Dynamic Elements inside Div C# ASP.NET
Get text property of all forms in an assembly via reflection
call event with parameters from another event , both different namespace
How to query a SingleResult object in a ASP.NET based server?
c# WebApi.SelfHost post is null
Entity Framework circular dll reference
What is the optimal collection if the keys are sequential integers but not zero-based?
How to hide the listitems in master page based on user login in asp .net c#
WinForms Inheritance InitializeComponent

Categories

HOME
qlikview
redux
sip
android-ndk
gaussian
data-modeling
salesforce-lightning
coordinates
opc-ua
perl6
python-3.4
scapy
rmarkdown
xmlhttprequest
popup
keystone
prepros
struts
priority-queue
suitescript
android-cursorloader
restangular
ds-5
ocl
slim-lang
contextmenustrip
tunnel
geocomplete
android-geofence
ansible-inventory
ragel
rythm
stencyl
libconfig
jslider
ape-phylo
libzip
head
google-chrome-storage
runner
appcmd
seyren
selection-sort
cc
cardview
vertex-shader
spring-social-twitter
visual-web-developer
vga
qtruby
kik
jde
opendolphin
recode
play-json
php-gd
persian
pushwoosh
hexagonal-tiles
tooltwist
tokudb
litedb
transparentproxy
page-refresh
avd
jeet-grid
accpac
optimistic-locking
fedena
diffmerge
powershell-v1.0
selenium-grid2
sat4j
ccmenuitem
triplestore
atg-dynamo
mvcgrid
twitter-finagle
xps
farpoint-spread
class-library
object-oriented-database
kernel-density
xtify
randomaccessfile
8-puzzle
ironworker
listpicker
forward-declaration
codeigniter-form-helper
bho
vline
quit
towerjs
yii-cactiverecord
cherokee
pex-and-moles
jqtransform
chars
pitch-shifting
for-xml
uccapi
scala-designer
ffdshow
jettison
cons
office-2003

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App