IoT apps on the Windows 10 IoT Core platform ARE Windows 10 apps.
I do regret the couple snags I had during my demos. Still, someone approached me after the presentation with the idea that I should pre-record portions of my presentation in order to avoid these kinds of things. I like to run live for several real reasons. 1) I’m a coder, not a professional presenter… I don’t often have time to polish my presentations to that level. 2) Glossing over rough edges hides what development is. Development is tough. You have to have backup plans and contingencies. My Raspberry Pi didn’t want to connect to the guest WiFi, so I fell back to plan B, and moved on. It’s a real world scenario; you hit a snag, but keep pressing on.
IoT is already about the last mile of the Sci-fi story, bringing Internet omnipotence to the fringes of reality, enabling the “Computer” of Star Trek (or the Cortana of the modern desktop) to reach it’s potential (hopefully without becoming Skynet).
It’s the stuff of science fiction… but it’s not fiction.
Visual Studio 2017’s ability to debug into a remote embedded device and make hot changes to a running executable is beyond top notch; it’s the stuff of science fiction… but it’s not fiction.
[office src=”https://onedrive.live.com/embed?cid=90A564D76FC99F8F&resid=90A564D76FC99F8F%211283217&authkey=AKQG9LbQcNcUSkk&em=2&wdAr=1.7777777777777776″]
private async void iotHubButton_Click(object sender, RoutedEventArgs e)
{
try
{
using (var client = DeviceClient.CreateFromConnectionString(
$"HostName=BOSCC-IOTHub.azure-devices.net;DeviceId=GraniteStHacker;SharedAccessKey={Credentials.LuisAccessKeyFromAzurePortal}",
TransportType.Mqtt))
{
var twinProperties = new TwinCollection();
twinProperties["MeasuredTemperature"] = manager.MeasuredTemperature;
twinProperties["HeaterPowerOn"] = manager.HeaterPowerOn;
twinProperties["ACPowerOn"] = manager.ACPowerOn;
twinProperties["Device_BOSCC"] = DateTime.Now.ToString();
await client.UpdateReportedPropertiesAsync(twinProperties);
Console.WriteLine("Done");
}
}
catch(Exception ex)
{
Console.WriteLine(ex);
}
}
}
Click the image below to see the device I was using for the demo in Azure IoT Hub’s Device Twin view.
“deviceId”: “GraniteStHacker”,
“etag”: “AAAAAAAAAAE=”,
“version”: 8,
“status”: “enabled”,
“statusUpdateTime”: “0001-01-01T00:00:00”,
“connectionState”: “Disconnected”,
“lastActivityTime”: “0001-01-01T00:00:00”,
“cloudToDeviceMessageCount”: 0,
“authenticationType”: “sas”,
“x509Thumbprint”: {
“primaryThumbprint”: null,
“secondaryThumbprint”: null
},
“properties”: {
“desired”: {
“$metadata”: {
“$lastUpdated”: “2017-11-14T01:48:45.8322179Z”
},
“$version”: 1
},
“reported”: {
“MeasuredTemperature”: 74,
“HeaterPowerOn”: true,
“ACPowerOn”: false,
“Device_BOSCC”: “11/18/2017 8:34:08 AM”,
“$metadata”: {
“$lastUpdated”: “2017-11-18T16:34:20.1258514Z”,
“MeasuredTemperature”: {
“$lastUpdated”: “2017-11-18T16:34:20.1258514Z”
},
“HeaterPowerOn”: {
“$lastUpdated”: “2017-11-18T16:34:20.1258514Z”
},
“ACPowerOn”: {
“$lastUpdated”: “2017-11-18T16:34:20.1258514Z”
},
“Device_BOSCC”: {
“$lastUpdated”: “2017-11-18T16:34:20.1258514Z”
}
},
“$version”: 7
}
}
}