即插即用裝置訊息承載

资讯 2024-07-12 阅读:88 评论:0
發行項05/13/2024...
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

裝置型號會定義:

defines:

  • 裝置傳送至服務的遙測。
  • 裝置與服務同步的屬性。
  • 服務在裝置上呼叫的命令。

提示

Hint

Azure IoT Central 是遵循即插即用慣例的服務。 在 IoT Central 中,裝置模型是裝置範本的一部分。 IoT Central 目前支援具有 IoT Central 延伸模組DTDL v2。 IoT Central 應用程式預期會收到 UTF-8 編碼的 JSON 資料。

Azure IoT Centre is a service that follows the rule of plug-in. In Iot Centre, the device model is .

本文說明裝置傳送和接收的 JSON 承載,用於 DTDL 裝置模型中定義的遙測、屬性和命令。

This indicates that the JSON carriers sent and received by the device are used to detect, attribute and command as defined in the DTDL device model.

本文不會說明每個可能類型的遙測、屬性和命令承載,但範例會說明關鍵類型。

This paper will not describe each possible type of remote, attribute and command carrying, but the example will describe the key type.

每個範例會顯示裝置模型的程式碼片段,其會定義類型和範例 JSON 承載,藉以說明裝置如何與 IoT Central 等隨插即用感知服務互動。

Each example displays a code snippet of the device model, which defines the type and example of JSON to be carried to explain how the device interacts with Iot Central and the like.

本文中的範例 JSON 代碼段會使用 Digital Twin Definition Language (DTDL) v2。 IoT Central 也會使用一些 DTDL 延伸模組

The example in this paper is used by JSON code paragraph . Iot Central will also use some of the

如需顯示其中一些使用中承載的範例裝置程式碼,請參閱將在 Linux 或 Windows 上執行的範例 IoT 隨插即用裝置應用程式連線至 IoT 中樞教學課程建立用戶端應用程式並將其連線至您的 Azure IoT Central 應用程式教學課程。

If you need to show some of the templates that are being used, please refer to or

如果您使用 IoT Central,則可以檢視裝置傳送至應用程式的未經處理資料。 對於疑難排解從裝置傳送承載的問題,此檢視相當實用。 若要檢視裝置傳送的未經處理資料:

If you use IOT Central, you can view unprocessed data from the device to the application. This view is useful for the question of how to send the load from the device. To view the unprocessed data from the device:

  1. 從 [裝置] 頁面瀏覽至裝置。

    Browse to the device from the [device] page.

  2. 選取 [未經處理資料] 索引標籤:

    Can not delete folder: %s: No such folder

    顯示原始數據檢視的螢幕快照。

    在此檢視中,您可以選取要顯示的資料行,並設定要檢視的時間範圍。 [未模型化的資料] 資料行會顯示裝置內不符合裝置範本中任何屬性或遙測定義的資料。

    In this view, you can select the data line you want to display and set the time range you want to view. [unmodeled data] will show any data in the device that does not match the properties or the remote definition of the device template.

如需更多疑難排解秘訣,請參閱針對裝置中的資料未顯示在 Azure IoT Central 的原因進行疑難排解

For more questions, see

若要深入了解 DTDL 遙測命名規則,請參閱 DTDL > 遙測。 您無法使用 字元作為遙測名稱的開頭。

For more information on the DTDL remote naming rules, please refer to DTDL & gt; remote . You cannot use the character as the starting point for the bytename.

請勿使用下列名稱建立下列遙測類型。 IoT Central 會內部使用這些保留名稱。 如果您嘗試使用這些名稱,IoT Central 將忽略您的資料:

Do not use the following names to create the following types of remote measurements. Iot Central uses these reserved names inside. If you try using these names, Iot Central ignores your data:

如果遙測是在元件中定義,請新增名為 的訊息屬性及裝置模型中定義的元件名稱。 若要深入了解,請參閱教學課程:連線 IoT 隨插即用多個元件裝置應用程式。 本教學課程示範如何使用不同的程式設計語言,從元件傳送遙測。

If the remote is defined in widgets, add the name of the component as defined in the message attribute and device model. For further information, please refer to .

重要

Important

若要正確顯示在 IoT Edge 模組中裝載元件的遙測,請使用 IoT Edge 版本 1.2.4 或更新版本。 如果您使用舊版本,IoT Edge 模組中元件的遙測會顯示為 _unmodeleddata

To correctly display the remotes of the widgets in the Iot Edge module, use or update. If you use the old version, the remotes of the widgets in the Iot Edge module will be shown as _unmodeddata.

如果遙測是在繼承介面中定義,您的裝置就會傳送遙測,如同在根介面中定義一樣。 指定下列裝置型號:

If the remote is defined in the successor interface, your device will transmit the remote as defined in the root interface. Specify the following device types:


裝置會使用下列承載來傳送計量電壓遙測。 裝置不包含承載中的介面名稱:

Devices use the following loads to transmit measured voltage remotes. The device does not contain the interface name of the load:



本節說明裝置可串流的基本遙測類型範本。

This section describes the basic remote type samples for which the device can stream.

下列裝置模型的程式碼片段顯示 遙測類型的定義:

Snippets of the following device models show the definition of the remote type:


裝置用戶端應以 JSON 的形式傳送遙測,如下列範例所示:

Device client should transmit remote measurements in the form of JSON, as shown in the following examples:


下列裝置模型的程式碼片段顯示 遙測類型的定義:

Snippets of the following device models show the definition of the remote type:


裝置用戶端應以 JSON 的形式傳送遙測,如下列範例所示:

Device client should transmit remote measurements in the form of JSON, as shown in the following examples:


下列裝置模型的程式碼片段顯示 遙測類型的定義:

Snippets of the following device models show the definition of the remote type:


裝置用戶端應以 JSON 的形式傳送遙測,如下列範例所示:

Device client should transmit remote measurements in the form of JSON, as shown in the following examples:


下列裝置模型的程式碼片段顯示 遙測類型的定義:

Snippets of the following device models show the definition of the remote type:


裝置用戶端應以 JSON 的形式傳送遙測,如下列範例所示:

Device client should transmit remote measurements in the form of JSON, as shown in the following examples:


下列裝置模型的程式碼片段顯示 遙測類型的定義:

Snippets of the following device models show the definition of the remote type:


裝置用戶端應以 JSON 的形式傳送遙測,如下列範例所示 - 類型的格式必須為 ISO 8061:

Device client should send remotes in the form of JSON, as shown in the following examples - the type must be formatted in ISO 8061:


下列裝置模型的程式碼片段顯示 遙測類型的定義:

Snippets of the following device models show the definition of the remote type:


裝置用戶端應以 JSON 的形式傳送遙測,如下列範例所示 - 持續時間的格式必須為 ISO 8601:

Device client should send remotes in the form of JSON, as shown in the following examples - the format of the duration must be ISO 8601:



本節說明裝置可串流的複雜遙測類型範本。

This section describes the complex remote type of device that can stream.

下列裝置模型的程式碼片段顯示 遙測類型的定義:

Snippets of the following device models show the definition of the remote type:


裝置用戶端應以 JSON 的形式傳送遙測,如下列範例所示。 可能的值為 、 和 ,其在 IoT Central 中顯示為 、 和 :

Device client should send remote measurements in the form of JSON, as shown in the following examples. Possible values are, and are shown in Iot Central as, and:


下列裝置模型的程式碼片段顯示 遙測類型的定義。 此物件有三個欄位,其類型為 、 和 :

The following device models have code snippets showing the definition of the remote type. This object has three columns of type, and:


裝置用戶端應以 JSON 的形式傳送遙測,如下列範例所示。 類型必須符合 ISO 8061 規範。 的可能值為 、,且在 IoT Central 中會顯示為 、 和 :

Device client should send remote measurements in the form of JSON, as shown in the following examples. Type must conform to ISO 8061. Possible values are, and will be shown in Iot Central as, and:


下列裝置模型的程式碼片段顯示 遙測類型的定義:

Snippets of the following device models show the definition of the remote type:


裝置用戶端應以 JSON 的形式傳送遙測,如下列範例所示:

Device client should transmit remote measurements in the form of JSON, as shown in the following examples:


下列裝置模型的程式碼片段顯示 遙測類型的定義:

Snippets of the following device models show the definition of the remote type:


注意

Attention.

geopoint 結構描述類型是 DTDL IoT Central 延伸模組的一部分。 為顧及回溯相容性,IoT Central 目前支援 geopoint 結構描述類型和 location 語意類型。

geopoint structural description type is DTDL . For the sake of retroactivity, Iot Central currently supports geopoint narratives and location synonyms.

裝置用戶端應以 JSON 的形式傳送遙測,如下列範例所示。 IoT Central 會顯示值作為地圖上的釘選:

Device client should send remote measurements in the form of JSON, as shown in the following examples. Iot Central displays values as nails on the map:



本節會顯示裝置傳送至 IoT Central 應用程式的遙測事件和狀態範例。

This section shows the remote event and status examples of the device sent to the Iot Central application.

下列裝置模型的程式碼片段顯示 事件類型的定義:

The following device models have code snippets showing the definition of the event type:


裝置用戶端應以 JSON 的形式傳送事件資料,如下列範例所示:

Device client should send event data in the form of JSON, as illustrated by the following examples:


下列裝置模型的程式碼片段顯示 狀態類型的定義:

The following device models have code snippets showing the definition of the status type:


裝置用戶端應以 JSON 的形式傳送狀態,如下列範例所示。 可能的整數狀態值為 、 或 :

Device client should transmit the status in the form of JSON, as shown in the following examples. Possible integer status values are, or:



若要深入了解 DTDL 屬性命名規則,請參閱 DTDL > 屬性。 您無法使用 字元作為屬性名稱的開頭。

For more information on the DTDL attribute naming rules, see . You cannot use a character as the beginning of a property name.

如果屬性是在元件中定義,請將屬性包裝在元件名稱中。 下列範例會設定 元件中的 。 標記 表示此區段會定義元件:

If properties are defined in widgets, package properties in widget names. The following examples are set in widgets. Marks indicate that this segment is defined in widgets:


若要深入了解,請參閱教學課程:建立用戶端應用程式並將其連線至您的 Azure IoT Central 應用程式

For more information, see .

本節說明裝置傳送至服務的基本屬性類型範圍。

This section describes the range of basic attributes that the device sends to the service.

下列裝置模型的程式碼片段顯示 屬性類型的定義:

The following device models have code snippets showing the definition of attribute type:


裝置用戶端應傳送 JSON 承載作為裝置對應項中的報告屬性,如下列範例所示:

Device client sends JSON to carry the report properties in the device response, as shown in the following examples:


下列裝置模型的程式碼片段顯示 屬性類型的定義:

The following device models have code snippets showing the definition of attribute type:


裝置用戶端應傳送 JSON 承載作為裝置對應項中的報告屬性,如下列範例所示:

Device client sends JSON to carry the report properties in the device response, as shown in the following examples:


下列裝置模型的程式碼片段顯示 屬性類型的定義:

The following device models have code snippets showing the definition of attribute type:


裝置用戶端應傳送 JSON 承載作為裝置對應項中的報告屬性,如下列範例所示。 類型必須符合 ISO 8061 規範:

Device client sends JSON to carry the report properties of the device as a response, as shown in the following examples. The type must conform to ISO 8061:


下列裝置模型的程式碼片段顯示 屬性類型的定義:

The following device models have code snippets showing the definition of attribute type:


裝置用戶端應傳送 JSON 承載作為裝置對應項中的報告屬性 - 持續時間必須符合 ISO 8601 規範,如下列範例所示:

Device client sends JSON to carry the report properties in the device response - the continuous time must meet ISO 8601, as shown in the following examples:


下列裝置模型的程式碼片段顯示 屬性類型的定義:

The following device models have code snippets showing the definition of attribute type:


裝置用戶端應傳送 JSON 承載作為裝置對應項中的報告屬性,如下列範例所示:

Device client sends JSON to carry the report properties in the device response, as shown in the following examples:


下列裝置模型的程式碼片段顯示 屬性類型的定義:

The following device models have code snippets showing the definition of attribute type:


裝置用戶端應傳送 JSON 承載作為裝置對應項中的報告屬性,如下列範例所示:

Device client sends JSON to carry the report properties in the device response, as shown in the following examples:



本節說明裝置傳送至服務的複雜屬性類型範圍。

This section describes the range of complex attributes that the device sends to the service.

下列裝置模型的程式碼片段顯示 屬性類型的定義:

The following device models have code snippets showing the definition of attribute type:


裝置用戶端應傳送 JSON 承載作為裝置對應項中的報告屬性,如下列範例所示。 可能的值為 、,其在 IoT Central 中顯示為 、 和 :

Device client sends JSON to carry the report properties of the device as a response, as shown in the following examples. Possible values are, in Iot Central, shown as, and:


下列裝置模型的程式碼片段顯示 屬性類型的定義。 此物件有兩個欄位,其類型為 和 :

The code snippets of the following device models show the definition of the attribute type. This object has two columns of type and:


裝置用戶端應傳送 JSON 承載作為裝置對應項中的報告屬性,如下列範例所示:

Device client sends JSON to carry the report properties in the device response, as shown in the following examples:


下列裝置模型的程式碼片段顯示 屬性類型的定義:

The following device models have code snippets showing the definition of attribute type:


裝置用戶端應傳送 JSON 承載作為裝置對應項中的報告屬性,如下列範例所示:

Device client sends JSON to carry the report properties in the device response, as shown in the following examples:


下列裝置模型的程式碼片段顯示 屬性類型的定義:

The following device models have code snippets showing the definition of attribute type:


注意

Attention.

geopoint 結構描述類型是 DTDL IoT Central 延伸模組的一部分。 為顧及回溯相容性,IoT Central 目前支援 geopoint 結構描述類型和 location 語意類型。

geopoint structural description type is DTDL . For the sake of retroactivity, Iot Central currently supports geopoint narratives and location synonyms.

裝置用戶端應傳送 JSON 承載作為裝置對應項中的報告屬性,如下列範例所示:

Device client sends JSON to carry the report properties in the device response, as shown in the following examples:



本節說明裝置從服務接收的可寫入屬性類型範例。

This section describes writeable attributes examples that the device receives from the service.

如果可寫入的屬性是在元件中定義,所需屬性訊息會包含元件名稱。 下列範例顯示要求裝置更新 元件中 的訊息。 標記 表示此區段會定義元件:

If the properties that can be written are defined in a widget, the required attribute message will contain a widget name. The following examples show the messages in the requested device update widget. Mark indicates that this segment will define the widget:


若要深入了解,請參閱連線 IoT 隨插即用多個元件裝置應用程式

For further information, please refer to

裝置或模組應該藉由傳送報告屬性來確認其已接收屬性。 報告的屬性應該包括:

Devices or modules should be identified by sending the report properties to confirm that they have received properties. The report should include:

  • - 屬性的實際值 (通常接收的值,但裝置可能會決定報告不同的值)。
  • - 使用 HTTP 狀態碼的確認代碼。
  • - 參考所需屬性 的確認版本。 您可以在所需的屬性 JSON 承載中找到此值。
  • - 選擇性確認描述。

若要深入了解這些欄位,請參閱 IoT 隨插即用慣例 > 通知回應

For more information on these columns, please refer to

下列裝置模型的程式碼片段顯示可寫入 屬性類型的定義:

Snippets of the following device models show the definition of the properties that can be written:


裝置會收到來自服務的下列承載:

The device will receive the following loads from the service:


裝置處理更新之後,應將下列 JSON 承載傳送至服務。 此訊行包含自服務所接收原始更新的版本號碼。

When the device is updated, the following JSON carriers should be sent to the service. This message line contains the original updated version number received by the service.

提示

Hint

如果服務為 IoT Central,則當其收到此訊息時,會在 UI 中將屬性標示為 [已同步]

If the service is IOT Central, the attribute is marked in UI as [synchronized] :


下列裝置模型的程式碼片段顯示可寫入 屬性類型的定義:

Snippets of the following device models show the definition of the properties that can be written:


裝置會收到來自服務的下列承載:

The device will receive the following loads from the service:


裝置處理更新之後,應將下列 JSON 承載傳送至服務。 此訊行包含自服務所接收原始更新的版本號碼。

When the device is updated, the following JSON carriers should be sent to the service. This message line contains the original updated version number received by the service.

提示

Hint

如果服務為 IoT Central,則當其收到此訊息時,會在 UI 中將屬性標示為 [已同步]

If the service is IOT Central, the attribute is marked in UI as [synchronized] :



若要深入了解 DTDL 命令命名規則,請參閱 DTDL > 命令。 您無法使用 字元作為命名名稱的開頭。

For more information on the DTDL command naming rules, please refer to . You cannot use a character as the beginning of a name name.

如果命令是在元件中定義,裝置接收的命令名稱包含元件名稱。 例如,如果命令稱為 而元件稱為 ,則裝置會收到執行名為 命令的要求。

If the command is defined in a widget, the command name of the device receiving the command contains the widget name. For example, if the command is called and the widget is called, the device will be required to execute the command by the name of the command.

下列裝置模型的程式碼片段會顯示沒有參數且不會預期裝置傳回任何項目的命令定義:

The following device models have code snippets that show no parameters and do not expect the device to return the definition of the command for any item:


裝置會在要求中收到空白承載並應會在回應中傳回空白承載,其中包含 HTPP 回應碼來表示成功。

The device receives a blank load in the request and responds to the blank load in the response, which contains a HTPP response to indicate success.

下列裝置模型的程式碼片段會顯示具有整數參數且預期裝置傳送整數值的命令定義:

The code snippets of the following device models show the command definition with integer parameters and the expected integer value of the device:


裝置會收到整數值作為要求承載。 裝置應傳回整數值作為回應承載,其中包含 HTTP 回應碼以表示成功。

Device receives integer values as required. The device returns the integer values as a response. It contains a HTTP response to indicate success.

下列裝置模型的程式碼片段顯示具有物件參數且預期裝置傳回物件的命令定義。 在此範例中,兩個物件皆有整數和字串欄位:

The code snippets of the following device models show the command definition of objects with object parameters and the intended device returns the object. In this example, both objects have integer and string fields:


下列程式碼片段顯示傳送至裝置的範例要求承載:

The following examples of code snippets showing the transmission to the device are required to be carried:


下列程式碼片段顯示從裝置傳送的範例回應承載。 使用 HTTP 回應碼來表示成功:

The following code snippets show the examples sent from the device responding to the load. Use the HTTP response to indicate success:


提示

Hint

IoT Central 有自己的慣例,可實作長時間執行的命令離線命令

IOT Central has its own custom to implement long-standing orders and 裝置開發人員指南

Since you already know how to carry the device, the suggested follow-on step is to read .

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明

分享:

扫一扫在手机阅读、分享本文

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
热门文章
  • 支付領域投下震撼彈!美國數位銀行Chime疑與GuardPay 神盾支付合作!

    支付領域投下震撼彈!美國數位銀行Chime疑與GuardPay 神盾支付合作!
    2020年,新冠肺炎(COVID-19)疫情加速數位貨幣進展。例如:2019年4月,國際清算銀行(BIS)的調查顯示,在全球66家中央銀行中,沒有一家計畫發行跨境支付的數位貨幣。惟到了2020年10月,BIS支付委員會主席康利夫(Jon Cunliffe)指出,肺炎疫情拉高民眾對無現金支付的需求,迫使各國加快數位貨幣的研發進程日本與韓國於2021年進入數位貨幣試驗階段。直到2019年12月,美國聯邦準備理事會(Fed)都尚無數位貨幣規劃,惟到了2020年2月,Fed已開始研擬...
  • 区块链:交易系统开发指南

    区块链:交易系统开发指南
    播报编辑《区块链:交易系统开发指南》使用通俗易懂的语言,从技术的角度详细介绍了区块链交易系统应有的功能架构及工作原理,让人们能够张开双臂轻松地拥抱区块链技术,享受区块链交易系统带来的惊喜与成就感。《区块链:交易系统开发指南》共分 7 章,第 1~2 章主要介绍区块链及数字货币的基本概念,以及各种公有链的 API 接口;第3~5 章主要介绍区块链交易系统的分类架构及功能; 6 章主要介绍区块链交易系统面临的问题及演进方向;第 7 章对全书做了总结。《区块链:交易系统开发指南》是...
  • 5.14加密货币价格:BTC突破6.2万美元以太坊和山寨币反映市场情绪

    5.14加密货币价格:BTC突破6.2万美元以太坊和山寨币反映市场情绪
    今天,随着比特币(BTC)的价格突破62 000美元的门槛,顶级加密货币的价格反弹了。 此外,以铁大幅上涨,维持在2 900美元的水平。 此外,其他顶尖山硬币,如索拉纳(SOL )、XRP、卡达诺(ADA )也大幅上涨。    今天密钥加密货币价格 1. 比特币价格    在5月14日星期二撰写本文时,比特币价格上升了2.57%,达到62 487.50美元。 另一方面,在过去24小时内,交易量从65.26 % 急剧上升至277亿美元。 与此同时,加密货币的市场价值为...
  • OKEx回应用户质疑:合约交易非期货 平台无机器人

    OKEx回应用户质疑:合约交易非期货 平台无机器人
       热点点 自选股份 数据中心 数据中心 研究和资料中心 资金流动 模拟交易 客户客户 具体来说,OKEx回答用户的问题:合同交易不是期货,平台不是机器人。 金融同步化,3月22日。    昨天下午,OKEx公司就维护先前用户线下的权利问题对同步财务公司作出了回应,指出OKEx公司提供的合同交易不是期货交易,在旗下的业务中没有正式的机器人。 同时,OKEX称,它不会以非法为由对任何投资损失索赔作出答复。 答复全文如下: 同步你的财务! 近日来,...
  • 0.00006694个比特币等于多少人民币/美金

    0.00006694个比特币等于多少人民币/美金
    0.00006694比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00006694比特币等于4.53424784美元/32.5436 16人民币。比特币(BTC)美元(USDT)人民币(CNY)0.000066944.53424784【比特币密码】32.82795436 16比特币对人民币的最新汇率为:490408.64 CNY(1比特币=490408.64人民币)(1美元=7.24人民币)(0.00006694USDT=0.0004846456 CNY)汇率更新时...
标签列表