You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot/concepts-model-discovery.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Use IoT Plug and Play models in a solution | Microsoft Docs
3
3
description: As a solution builder, learn about how you can use IoT Plug and Play models in your IoT solution.
4
4
author: dominicbetts
5
5
ms.author: dobett
6
-
ms.date: 03/13/2024
6
+
ms.date: 08/30/2024
7
7
ms.topic: conceptual
8
8
ms.service: iot
9
9
---
@@ -105,7 +105,7 @@ content-encoding:utf-8
105
105
106
106
## Retrieve a model definition
107
107
108
-
A solution uses model ID identified above to retrieve the corresponding model definition.
108
+
A solution uses the model ID identified previously to retrieve the corresponding model definition.
109
109
110
110
A solution can get the model definition by using one of the following options:
111
111
@@ -149,7 +149,7 @@ dtmi:com:example:Thermostat;1
149
149
dtmi:azure:DeviceManagement:DeviceInformation;1
150
150
```
151
151
152
-
The `ModelsRepositoryClient` can be configured to query a custom DMR -available through http(s)- and to specify the dependency resolution by using the `ModelDependencyResolution` flag:
152
+
The `ModelsRepositoryClient` can be configured to query a custom DMR--available through https--and to specify the dependency resolution by using the `ModelDependencyResolution` flag:
153
153
154
154
- Disabled. Returns the specified interface only, without any dependency.
155
155
- Enabled. Returns all the interfaces in the dependency chain
@@ -188,7 +188,7 @@ After you identify the model ID for a new device connection, follow these steps:
188
188
189
189
## Next steps
190
190
191
-
Now that you've learned how to integrate IoT Plug and Play models in an IoT solution, some suggested next steps are:
191
+
Now that you learned how to integrate IoT Plug and Play models in an IoT solution, some suggested next steps are:
192
192
193
193
-[Interact with a device from your solution](tutorial-service.md)
194
194
-[IoT Digital Twin REST API](/rest/api/iothub/service/digitaltwin)
Copy file name to clipboardExpand all lines: articles/iot/concepts-modeling-guide.md
+41-7Lines changed: 41 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Understand IoT Plug and Play device models | Microsoft Docs
3
3
description: Understand the Digital Twins Definition Language (DTDL) modeling language for IoT Plug and Play devices. The article describes primitive and complex datatypes, reuse patterns that use components and inheritance, and semantic types. The article provides guidance on the choice of device twin model identifier and tooling support for model authoring.
4
4
author: dominicbetts
5
5
ms.author: dobett
6
-
ms.date: 1/23/2024
6
+
ms.date: 08/30/2024
7
7
ms.topic: conceptual
8
8
ms.service: iot
9
9
@@ -565,7 +565,7 @@ Because the geospatial types are array-based, they can't currently be used in pr
565
565
566
566
## Semantic types
567
567
568
-
The data type of a property or telemetry definition specifies the format of the data that a device exchanges with a service. The semantic type provides information about telemetry and properties that an application can use to determine how to process or display a value. Each semantic type has one or more associated units. For example, celsius and fahrenheit are units for the temperature semantic type. IoT Central dashboards and analytics can use the semantic type information to determine how to plot telemetry or property values and display units. To learn how you can use the model parser to read the semantic types, see [Understand the digital twins model parser](concepts-model-parser.md).
568
+
The data type of a property or telemetry definition specifies the format of the data that a device exchanges with a service. The semantic type provides information about telemetry and properties that an application can use to determine how to process or display a value. Each semantic type has one or more associated units. For example, celsius and fahrenheit are units for the temperature semantic type. IoT Central dashboards and analytics can use the semantic type information to determine how to plot telemetry or property values and display units. To learn how you can use the model parser to read the semantic types, see [Understand the Digital Twins model parser](#understand-the-digital-twins-model-parser).
569
569
570
570
The following snippet shows an example telemetry definition that includes semantic type information. The semantic type `Temperature` is added to the `@type` array, and the `unit` value, `degreeCelsius` is one of the valid units for the semantic type:
571
571
@@ -583,7 +583,7 @@ The following snippet shows an example telemetry definition that includes semant
583
583
584
584
## Localization
585
585
586
-
Applications, such as IoT Central, use information in the model to dynamically build a UI around the data that's exchanged with an IoT Plug and Play device. For example, tiles on a dashboard can display names and descriptions for telemetry, properties, and commands.
586
+
Applications, such as IoT Central, use information in the model to dynamically build a UI around the data exchanged with an IoT Plug and Play device. For example, tiles on a dashboard can display names and descriptions for telemetry, properties, and commands.
587
587
588
588
The optional `description` and `displayName` fields in the model hold strings intended for use in a UI. These fields can hold localized strings that an application can use to render a localized UI.
589
589
@@ -644,7 +644,7 @@ There's a DTDL authoring extension for VS Code that supports both DTDL v2 and DT
644
644
645
645
To install the DTDL extension for VS Code, go to [DTDL editor for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.vscode-dtdl). You can also search for **DTDL** in the **Extensions** view in VS Code.
646
646
647
-
When you've installed the extension, use it to help you author DTDL model files in VS Code:
647
+
After you install the extension, use it to help you author DTDL model files in VS Code:
648
648
649
649
- The extension provides syntax validation in DTDL model files, highlighting errors as shown on the following screenshot:
650
650
@@ -663,7 +663,7 @@ Applications, such as IoT Central, use device models. In IoT Central, a model is
663
663
> [!NOTE]
664
664
> IoT Central defines some extensions to the DTDL language. To learn more, see [IoT Central extension](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/DTDL.iotcentral.v2.md).
665
665
666
-
A custom solution can use the [digital twins model parser](concepts-model-parser.md) to understand the capabilities of a device that implements the model. To learn more, see [Use IoT Plug and Play models in an IoT solution](concepts-model-discovery.md).
666
+
A custom solution can use the [Digital Twins model parser](#understand-the-digital-twins-model-parser) to understand the capabilities of a device that implements the model. To learn more, see [Use IoT Plug and Play models in an IoT solution](concepts-model-discovery.md).
667
667
668
668
### Version
669
669
@@ -675,7 +675,7 @@ IoT Central implements more versioning rules for device models. If you version a
675
675
676
676
### Publish
677
677
678
-
As of February 2024, the Azure Certified Device program has been retired. Therefore, Microsoft is no longer accepting submissions of DTDL models to the[Azure IoT plug and play models](https://github.com/Azure/iot-plugandplay-models) repository.
678
+
As of February 2024, the Azure Certified Device program is retired. Therefore, Microsoft is no longer accepting submissions of DTDL models to the[Azure IoT plug and play models](https://github.com/Azure/iot-plugandplay-models) repository.
679
679
680
680
If you want to set up your own model repository, you can use the [Azure IoT plug and play models tools](https://github.com/Azure/iot-plugandplay-models-tools) repository. This repository includes the code for the `dmr-client` CLI tool that can validate, import, and expand DTDL models. This tool also lets you index model repositories that follow the device model repository conventions.
681
681
@@ -689,9 +689,43 @@ The following list summarizes some key constraints and limits on models:
689
689
- An interface can extend at most two other interfaces.
690
690
- A component can't contain another component.
691
691
692
+
## Understand the Digital Twins model parser
693
+
694
+
The Digital Twins Definition Language (DTDL) is described in the [DTDL Specification](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/README.md). Users can use the _Digital Twins Model Parser_ NuGet package to validate and query a DTDL v2 or v3 model. The DTDL model can be defined in multiple files.
695
+
696
+
### Install the DTDL model parser
697
+
698
+
The parser is available in NuGet.org with the ID: [DTDLParser](https://www.nuget.org/packages/DTDLParser). To install the parser, use any compatible NuGet package manager such as the one in Visual Studio or in the `dotnet` CLI.
699
+
700
+
```bash
701
+
dotnet add package DTDLParser
702
+
```
703
+
704
+
> [!NOTE]
705
+
> At the time of writing, the parser version is `1.0.52`.
706
+
707
+
### Use the parser to validate and inspect a model
708
+
709
+
The DTDLParser is a library that you can use to:
710
+
711
+
- Determine whether one or more models are valid according to the language v2 or v3 specifications.
712
+
- Identify specific modeling errors.
713
+
- Inspect model contents.
714
+
715
+
A model can be composed of one or more interfaces described in JSON files. You can use the parser to load all the files that define a model and then validate all the files as a whole, including any references between the files.
716
+
717
+
The [DTDLParser for .NET](https://github.com/digitaltwinconsortium/DTDLParser) repository includes the following samples that illustrate the use of the parser:
718
+
719
+
- [DTDLParserResolveSample](https://github.com/digitaltwinconsortium/DTDLParser/blob/main/samples/DTDLParserResolveSample) shows how to parse an interface with external references, resolve the dependencies using the `Azure.IoT.ModelsRepository` client.
720
+
- [DTDLParserJSInteropSample](https://github.com/digitaltwinconsortium/DTDLParser/blob/main/samples/DTDLParserJSInteropSample) shows how to use the DTDL Parser from JavaScript running in the browser, using .NET JSInterop.
721
+
722
+
The DTDLParser for .NET repository also includes a [collection of tutorials](https://github.com/digitaltwinconsortium/DTDLParser/blob/main/tutorials/README.md) that show you how to use the parser to validate and inspect models.
723
+
724
+
The model parser API enables many scenarios to automate or validate tasks that depend on DTDL models. For example, you could dynamically build a UI from the information in the model.
725
+
692
726
## Next steps
693
727
694
-
Now that you've learned about device modeling, here are some more resources:
728
+
Now that you learned about device modeling, here are some more resources:
695
729
696
730
- [Digital Twins Definition Language (DTDL)](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/README.md)
0 commit comments