我们可以从另一个模块调用一个模块的叶子设备直接方法吗?

问题描述

我已经开发了两个定制的IoT边缘模块 例如 Module1,Module2

Module1在容器内部运行着多个IoT设备(叶设备)。

这些叶子设备具有某些直接的书面方法,例如 IsDeviceOnline

是否可以从 Module2 调用该直接方法

我尝试通过在如下所示的调用时编写叶子deviceid来尝试,但它给出了 {"status":500,"payload":null} 总是。

MethodRequest request = new MethodRequest("IsDeviceOnline");
var resp = await moduleclient.InvokeMethodAsync(deviceid,"Module1",request);

上面的代码正在从Module2执行

解决方法

我找到了解决方法...

我刚刚删除了moduleId,它运行正常

MethodRequest request = new MethodRequest("IsDeviceOnline");
         // Execute request
         var resp = await moduleclient.InvokeMethodAsync(deviceId,request);