UWP apps can't read the hardware MAC address by design, there's no API call that provides it
All posts by
FTDI USB Devices
Finding Connected FTDI Devices using System.IO.Ports; using Microsoft.Win32; //< Needed to access registry int Count; int CheckEachPortCount; string RegistryMainFolder; string Port; string[] FoundCommPorts = new string[0]; string[] FoundSerialNumbers = new string[0]; //—– DISPLAY AVAILABLE SERIAL PORTS —– cmbSerialPort.Items.Add("Not connected"); try { //—– DISCOVER ALL AVAILABLE SERIAL PORTS —– string[] AvailableSerialPorts; AvailableSerialPorts = SerialPort.GetPortNames(); //—– CHECK […]
UART Port Names
List All UART Ports string AqsFilter = SerialDevice.GetDeviceSelector(); var dis = await DeviceInformation.FindAllAsync(AqsFilter); for (Count = 0; Count < dis.Count; Count++) System.Diagnostics.Debug.WriteLine("UART Port: " + dis[Count].Name + “, ” + dis[Count].Id); Connect To A specific UART Port string AqsFilter = SerialDevice.GetDeviceSelector(); var dis = await DeviceInformation.FindAllAsync(AqsFilter); for (Count = 0; Count < dis.Count; Count++) { […]
Inbound Pairing
At the time of writing (2016-12) this doesn't appear to be possible programatically or automatically. Pairing with devices can be carried out programatically where your app initiates the search and connection to a remote device, but there doesn't appear to be an api for incoming pairing requests. To make the Windows IoT device discoverable to […]
Working With Files-LocalFolder
Filepath for object that just want a string use the URI: ms-appdata:///local/SomeFolder\SomeFile.png Does File Exist Using await (note this is not good in loops etc as await doesn’t truly await!!) or Write Data To A Local File File will be saved to: User Files\LocalAppData\PackageName\LocalState\SomeFolder\SomeFile.txt Add String Array To A Local File Each string is added as […]
Text Files
Add Lines To Text File & Read Back Line By Line StorageFolder Folder1 = ApplicationData.Current.LocalFolder; StorageFile File1 = await Folder1.CreateFileAsync(“MyFolder\\MyFile.txt”, CreationCollisionOption.OpenIfExists); if (File1 != null) { string[] TagIds = new string[1]; TagIds[0] = NewRfidTagId; await FileIO.AppendLinesAsync(File1, TagIds); } StorageFolder Folder1 = ApplicationData.Current.LocalFolder; if (Folder1.TryGetItemAsync(“MyFolder\\MyFile.txt”) != null) { //File Exists StorageFile File1 = await Folder1.GetFileAsync(“MyFolder\\MyFile.txt”); var […]
String char
Convert Char[] Array To String Convert Char To Character Value or For each char in a string
.SQLite General
The sqlite-net project (http://github.com/praeclarum/sqlite-net) exposes functionality to .NET languages. You can install SQLite as a Visual Studio extension. Under Tools, Extensions and Updates, Online, you can search for “SQLite.” After installing it, you can add it to any project via Add Reference, Windows, Extensions, SQLite.
Working With Files-Temporary Files
Write Data To A Temporary File This is the same as for local files but using “TemporaryFolder” instead. Windows will automatically delete temporary files. You should assume that they only exist for the current app session. using Windows.Storage; StorageFolder Folder1 = ApplicationData.Current.TemporaryFolder; StorageFile File1 = await Folder1.CreateFileAsync(“SomeFolder\\SomeFile.txt”, CreationCollisionOption.ReplaceExisting); if (File1 != null) { await FileIO.WriteTextAsync(File1, […]
ApplicationData For Settings, Scores, Etc
ApplicationDataContainer values can be: bool, byte, int, uint, long, ulong, float, double, or string using Windows.Storage; Write Settings //—– STORE APP SETTINGS —– ApplicationDataContainer AppDataLocalSettings = ApplicationData.Current.LocalSettings; AppDataLocalSettings.Values[“MyInt”] = 5; AppDataLocalSettings.Values[“MyBool”] = true; AppDataLocalSettings.Values[“MyString”] = “Hello”; Read Settings Null is returned if setting does not exist //—– READ APP SETTINGS —– int SomeInt; bool SomeBool; […]