简体   繁体   English

Azure 适用于 Raspberry Pi 4 的 IoT Central 设备模板

[英]Azure IoT Central Device Template for Raspberry Pi 4

I was just following this document , and I see that there is no device template for Raspberry Pi 4 but for devices like MXChip it has, is it intended?我只是在关注这个文档,我看到树莓派 4 没有设备模板,但是对于像 MXChip 这样的设备,它有吗? Or is there any way to get the device template for Raspberry Pi 4?或者有什么方法可以获取树莓派 4 的设备模板?

在此处输入图像描述

This is intended.这是有意的。 A device template describes the capabilities of a device.设备模板描述了设备的功能。 For instance, the MXChip will send temperature, humidity, and motion events (among other things) and this is described in the device template.例如,MXChip 将发送温度、湿度和运动事件(除其他外),这在设备模板中进行了描述。 The ReButton you also posted in your screenshot will have capabilities like button press (with support for single/double/triple/long click).您还在屏幕截图中发布的 ReButton 将具有按钮按下等功能(支持单/双/三/长单击)。

This brings us to the reason there is no template for the Raspberry Pi, this device on its own has no out of the box capabilities to connect it to IoT Central.这给我们带来了 Raspberry Pi 没有模板的原因,该设备本身没有开箱即用的功能将其连接到 IoT Central。 I might decide to add a temperature sensor to it, so I will build a template describing that capability.我可能决定为其添加一个温度传感器,因此我将构建一个描述该功能的模板。 But you might decide to add a button and an LED to it, so you will build a template describing those capabilities.但是您可能决定为其添加一个按钮和一个 LED,因此您将构建一个描述这些功能的模板。

As you stated in your comment, if you want a starting point, you will begin with the most basic and nearly empty capability model, but you can't have a capability model without any interfaces, so you can add the DeviceInformation interface that Microsoft provides.正如您在评论中所说,如果您想要一个起点,您将从最基本且几乎为空的功能 model 开始,但是您不能没有任何接口的功能 model,因此您可以添加 Microsoft 提供的 DeviceInformation 接口. You will need to write the code that your Raspberry will run to actually fill out these fields!您需要编写 Raspberry 将运行的代码来实际填写这些字段!

{
  "@id": "urn:matthijsvdveer:RaspberryPi4_41:1",
  "@type": "CapabilityModel",
  "implements": [
    {
      "@id": "urn:matthijsvdveer:RaspberryPi4_41:2x_rlqmb2:1",
      "@type": "InterfaceInstance",
      "name": "DeviceInformation_z1",
      "schema": {
        "@id": "urn:azureiot:DeviceManagement:DeviceInformation:1",
        "@type": "Interface",
        "displayName": {
          "en": "Device information"
        },
        "contents": [
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:manufacturer:1",
            "@type": "Property",
            "comment": "Company name of the device manufacturer. This could be the same as the name of the original equipment manufacturer (OEM). Ex. Contoso.",
            "displayName": {
              "en": "Manufacturer"
            },
            "name": "manufacturer",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:model:1",
            "@type": "Property",
            "comment": "Device model name or ID. Ex. Surface Book 2.",
            "displayName": {
              "en": "Device model"
            },
            "name": "model",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:swVersion:1",
            "@type": "Property",
            "comment": "Version of the software on your device. This could be the version of your firmware. Ex. 1.3.45",
            "displayName": {
              "en": "Software version"
            },
            "name": "swVersion",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:osName:1",
            "@type": "Property",
            "comment": "Name of the operating system on the device. Ex. Windows 10 IoT Core.",
            "displayName": {
              "en": "Operating system name"
            },
            "name": "osName",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:processorArchitecture:1",
            "@type": "Property",
            "comment": "Architecture of the processor on the device. Ex. x64 or ARM.",
            "displayName": {
              "en": "Processor architecture"
            },
            "name": "processorArchitecture",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:processorManufacturer:1",
            "@type": "Property",
            "comment": "Name of the manufacturer of the processor on the device. Ex. Intel.",
            "displayName": {
              "en": "Processor manufacturer"
            },
            "name": "processorManufacturer",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:totalStorage:1",
            "@type": "Property",
            "comment": "Total available storage on the device in kilobytes. Ex. 2048000 kilobytes.",
            "displayName": {
              "en": "Total storage"
            },
            "name": "totalStorage",
            "displayUnit": {
              "en": "kilobytes"
            },
            "schema": "long"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:totalMemory:1",
            "@type": "Property",
            "comment": "Total available memory on the device in kilobytes. Ex. 256000 kilobytes.",
            "displayName": {
              "en": "Total memory"
            },
            "name": "totalMemory",
            "displayUnit": {
              "en": "kilobytes"
            },
            "schema": "long"
          }
        ]
      }
    }
  ],
  "displayName": {
    "en": "Raspberry Pi 4"
  },
  "@context": [
    "http://azureiot.com/v1/contexts/IoTModel.json"
  ]
}

My advice would be to create your own in IoT Central , while the above is a decent starting-off point, it takes only a minute to create your own in IoT Central and then you can add your own interfaces.我的建议是在 IoT Central 中创建您自己的接口,虽然以上是一个不错的起点,但在 IoT Central 中创建您自己的接口只需一分钟,然后您就可以添加自己的接口。

Hope this explains it a bit.希望这能解释一下。 Let me know if you need anything clarified.如果您需要任何澄清,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM