Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Trying to create a Serial port for UWP using Xamarin Forms.

$
0
0

I am moving an UWP app to Xamarin Forms. I am having difficulty connecting to the serial port.
This strictly a window / windows Iot core app at this time.

The code I am calling is
SerialDevice serialPort = await SerialDevice.FromIdAsync (entry.Id);

The entry is of type DeviceInformation. For some reason in Xamarin Forms, this call returns null and not a valid SerialDevice.

I have tested this code running both against a Local Machine (x86) with an arduino board plugged into a usb port and on a remote Machine (rpi3) with the arduino board plugged into it. In both cases it works fine when running the UWP app and fails (returns null) when running with the Xamarin Forms app (the code is part of the UWP code base). The code that gets the List of possible ports works fine in all cases.
string aqs = SerialDevice.GetDeviceSelector();
var dis = await DeviceInformation.FindAllAsync(aqs);

I am running the latest Visual Studio 2019 with the most recent NuGet's:
Microsoft.NETCore.Platforms (2.2.2)
Microsoft.NETCore.UniversalWindowsPlatform (6.2.8)
Xamarin.Essentials (1.2.0)
Xamarin.Forms(4.1.0.618606)
SdK
NETStandard.Library (2.0.3)

For the UWP app NuGet
Microsoft.NETCore.UniversalWindowsPlatform (6.2.8)

Am I missing some library in the Xamarin Forms app?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>