Azure IoT Edge入门(9)云到边缘设备控制-Azure iot edge module direct method
本文介绍:
1. Azure IoT edge 从云到边缘设备的控制方式之一 direct method。
2. Edge-agent中内置的 direct method
本文参考:https://docs.microsoft.com/zh-cn/azure/iot-edge/how-to-edgeagent-direct-method
视频:
https://www.51azure.cloud/post/2020/11/14/azure-iot-edge9azure-iot-edge-module-direct-method
图文:
我们之前介绍过Azure IoT Hub 的云到设备控制的方法之一是direct method,参见《云到设备的控制-direct method》。
与此类似,Azure IoT Edge Module中也支持direct method,可以实现对在线module的控制及数据传输(通过payload)。
同时,Azure IoT Edge的系统Module之一的Edge-agent中也内置了几个direct method。
direct metod 功能通过 Module client 提供,各个语言的Module client 语法, 请参阅首选 SDK 语言的 API 参考:C#、C、Python、Java 或 Node.js。
例如C#语言的 direct method 相关的方法:
ModuleClient.SetMessageHandlerAsync Method
Definition
Overloads
SetMessageHandlerAsync(MessageHandler, Object) |
Sets a new default delegate which applies to all endpoints. If a delegate is already associated with the input, it will be called, else the default delegate will be called. If a default delegate was set previously, it will be overwritten. |
SetMessageHandlerAsync(MessageHandler, Object, CancellationToken) |
Sets a new default delegate which applies to all endpoints. If a delegate is already associated with the input, it will be called, else the default delegate will be called. If a default delegate was set previously, it will be overwritten. |
![](https://www.51azure.cloud/uploads/img-26aab019-925d-432d-8296-0bb265dc59f1.png)
![](https://www.51azure.cloud/uploads/img-471a7d7d-8262-4e76-b619-646792f12100.png)
PING
![](https://www.51azure.cloud/uploads/img-c4af6f33-bda4-43bf-b858-83a9565f220d.png)
![](https://www.51azure.cloud/uploads/img-29ad2d60-58dd-48da-8c66-dcc5b97c6b3f.png)
RestartModule
![](https://www.51azure.cloud/uploads/img-a286c7c4-013b-4753-a19d-391b20314b24.png)
![](https://www.51azure.cloud/uploads/img-e85af415-e7b4-409a-8ed4-0ed517a82208.png)
![](https://www.51azure.cloud/uploads/img-eff325c4-d196-45c5-9bd8-f473efe73145.png)
诊断相关的直接方法:
- GetModuleLogs:在直接方法的响应中检索内联模块日志。
- UploadModuleLogs:检索模块日志,并将其上传到 Azure Blob 存储。
- UploadSupportBundle:使用支持捆绑检索模块日志,并将 zip 文件上传到 Azure Blob 存储。
- GetTaskStatus:检查上传日志或支持捆绑请求的状态。
注意,IoT Edge Runtime 1.0.10 版本提供这些诊断直接方法。
点击可查阅本站文章目录 《文章分类目录》
本站所有内容仅代表个人观点,如与官文档冲突,请以官方文档为准。
可在本页面下方留言或通过下方联系方式联系我:
微信:wxyusz;邮箱:shuzhen.yu@foxmail.com
欢迎关注公众号“云计算实战”,接收最新文章推送。
本作品由Sean Yu 采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。
欢迎转载、使用、重新发布,但务必保留文章链接:https://www.51azure.cloud,且不得用于商业目的。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步