获取 IoT 边缘设备的现有 child 设备列表
Get list of existing child device of IoT edge device
我正在使用 Azure IoT SDK. It supports establishing parent child relationship between IoT edge and IoT leaf device. The device object has Scope
property. If Scope
value of edge device is assigned to leaf device, it becomes the child of edge device. Here's 的预览版 (v1.27.0-preview-003) 作为测试用例。
RegistryManager registryManager = RegistryManager.CreateFromConnectionString(ConnectionString);
var edgeDevice = new Device(Guid.NewGuid().ToString())
{
Capabilities = new DeviceCapabilities
{
IotEdge = true
}
};
edgeDevice = await registryManager.AddDeviceAsync(edgeDevice).ConfigureAwait(false);
var leafDevice = new Device(Guid.NewGuid().ToString())
{
Scope = edgeDevice.Scope
};
Device receivedDevice = await registryManager.AddDeviceAsync(leafDevice).ConfigureAwait(false);
我想获取任何边缘设备的 child 设备,我该怎么做?我找不到任何方法来检索 child 设备的列表。其实我想修改边缘设备的children列表。对于leaf设备,很简单,有一个parent所以更换起来非常简单。
如果您想以编程方式执行此操作,则必须使用边缘设备的 deviceScope
.
对设备注册表进行查询
它可以直接在 az iot 扩展中使用:
https://docs.microsoft.com/en-us/cli/azure/ext/azure-cli-iot-ext/iot/hub/device-identity?view=azure-cli-latest#ext-azure-cli-iot-ext-az-iot-hub-device-identity-list-children
我正在使用 Azure IoT SDK. It supports establishing parent child relationship between IoT edge and IoT leaf device. The device object has Scope
property. If Scope
value of edge device is assigned to leaf device, it becomes the child of edge device. Here's 的预览版 (v1.27.0-preview-003) 作为测试用例。
RegistryManager registryManager = RegistryManager.CreateFromConnectionString(ConnectionString);
var edgeDevice = new Device(Guid.NewGuid().ToString())
{
Capabilities = new DeviceCapabilities
{
IotEdge = true
}
};
edgeDevice = await registryManager.AddDeviceAsync(edgeDevice).ConfigureAwait(false);
var leafDevice = new Device(Guid.NewGuid().ToString())
{
Scope = edgeDevice.Scope
};
Device receivedDevice = await registryManager.AddDeviceAsync(leafDevice).ConfigureAwait(false);
我想获取任何边缘设备的 child 设备,我该怎么做?我找不到任何方法来检索 child 设备的列表。其实我想修改边缘设备的children列表。对于leaf设备,很简单,有一个parent所以更换起来非常简单。
如果您想以编程方式执行此操作,则必须使用边缘设备的 deviceScope
.
它可以直接在 az iot 扩展中使用: https://docs.microsoft.com/en-us/cli/azure/ext/azure-cli-iot-ext/iot/hub/device-identity?view=azure-cli-latest#ext-azure-cli-iot-ext-az-iot-hub-device-identity-list-children