This PoC shows how to use a base interface to describe the capabilities needed to implement self describing devices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Azure.Devices.Client; | |
| using System; | |
| using System.IO; | |
| using System.Threading.Tasks; | |
| namespace c2d_device | |
| { | |
| class Program | |
| { | |
| static async Task Main(string[] args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Azure.Devices; | |
| using Microsoft.Azure.Devices.Client; | |
| using Microsoft.Azure.Devices.Shared; | |
| using Newtonsoft.Json; | |
| using System; | |
| using System.Threading.Tasks; | |
| namespace rido_learn_WritableProperties | |
| { | |
| class Program |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Azure.Devices.Client; | |
| using System; | |
| using System.IO; | |
| using System.Security.Cryptography; | |
| using System.Text; | |
| using System.Text.Json; | |
| using System.Threading.Tasks; | |
| namespace rido_self_describing | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Azure.Devices; | |
| using Microsoft.Azure.Devices.Client; | |
| using Microsoft.Azure.Devices.Serialization; | |
| using Microsoft.Azure.Devices.Shared; | |
| using Newtonsoft.Json; | |
| using System; | |
| using System.Threading.Tasks; | |
| namespace rido_learn_WritableProperties | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Azure.DigitalTwins.Parser; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Net.Http; | |
| using System.Threading.Tasks; | |
| namespace ResolutionSample | |
| { | |
| class Resolver | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gci -r dtmi/**/*.json | foreach { dmr-client validate -m $_.FullName --strict --repo . --debug } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Azure.Devices.Client; | |
| using Microsoft.Azure.Devices.Shared; | |
| using Newtonsoft.Json; | |
| using Newtonsoft.Json.Linq; | |
| using System; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace STS.Device | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "@context": "dtmi:dtdl:context;2", | |
| "@id": "dtmi:rido:maps;1", | |
| "@type": "Interface", | |
| "displayName": "maps", | |
| "contents": [ | |
| { | |
| "@type": "Property", | |
| "writable": true, | |
| "name": "networkConfig", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://stackoverflow.com/questions/58138793/system-text-json-jsonelement-toobject-workaround | |
| // https://stackoverflow.com/questions/61553962/getting-nested-properties-with-system-text-json | |
| static class JsonExtensions | |
| { | |
| public static JsonElement GetJsonElement(this JsonElement jsonElement, string path) | |
| { | |
| if (jsonElement.ValueKind is JsonValueKind.Null or JsonValueKind.Undefined) | |
| return default; | |
| string[] segments = path.Split('.', StringSplitOptions.RemoveEmptyEntries); |