array(2) { ["docs"]=> array(10) { [0]=> array(10) { ["id"]=> string(3) "428" ["text"]=> string(77) "Visual Studio 2017 单独启动MSDN帮助(Microsoft Help Viewer)的方法" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(8) "DonetRen" ["tagsname"]=> string(55) "Visual Studio 2017|MSDN帮助|C#程序|.NET|Help Viewer" ["tagsid"]=> string(23) "[401,402,403,"300",404]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400964" ["_id"]=> string(3) "428" } [1]=> array(10) { ["id"]=> string(3) "427" ["text"]=> string(42) "npm -v;报错 cannot find module "wrapp"" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "zzty" ["tagsname"]=> string(50) "node.js|npm|cannot find module "wrapp“|node" ["tagsid"]=> string(19) "[398,"239",399,400]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400760" ["_id"]=> string(3) "427" } [2]=> array(10) { ["id"]=> string(3) "426" ["text"]=> string(54) "说说css中pt、px、em、rem都扮演了什么角色" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(12) "zhengqiaoyin" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400640" ["_id"]=> string(3) "426" } [3]=> array(10) { ["id"]=> string(3) "425" ["text"]=> string(83) "深入学习JS执行--创建执行上下文(变量对象,作用域链,this)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "Ry-yuan" ["tagsname"]=> string(33) "Javascript|Javascript执行过程" ["tagsid"]=> string(13) "["169","191"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511399901" ["_id"]=> string(3) "425" } [4]=> array(10) { ["id"]=> string(3) "424" ["text"]=> string(30) "C# 排序技术研究与对比" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "vveiliang" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(8) ".Net Dev" ["catesid"]=> string(5) "[199]" ["createtime"]=> string(10) "1511399150" ["_id"]=> string(3) "424" } [5]=> array(10) { ["id"]=> string(3) "423" ["text"]=> string(72) "【算法】小白的算法笔记:快速排序算法的编码和优化" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "penghuwan" ["tagsname"]=> string(6) "算法" ["tagsid"]=> string(7) "["344"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511398109" ["_id"]=> string(3) "423" } [6]=> array(10) { ["id"]=> string(3) "422" ["text"]=> string(64) "JavaScript数据可视化编程学习(二)Flotr2,雷达图" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "chengxs" ["tagsname"]=> string(28) "数据可视化|前端学习" ["tagsid"]=> string(9) "[396,397]" ["catesname"]=> string(18) "前端基本知识" ["catesid"]=> string(5) "[198]" ["createtime"]=> string(10) "1511397800" ["_id"]=> string(3) "422" } [7]=> array(10) { ["id"]=> string(3) "421" ["text"]=> string(36) "C#表达式目录树(Expression)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "wwym" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(4) ".NET" ["catesid"]=> string(7) "["119"]" ["createtime"]=> string(10) "1511397474" ["_id"]=> string(3) "421" } [8]=> array(10) { ["id"]=> string(3) "420" ["text"]=> string(47) "数据结构 队列_队列实例:事件处理" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "idreamo" ["tagsname"]=> string(40) "C语言|数据结构|队列|事件处理" ["tagsid"]=> string(23) "["246","247","248",395]" ["catesname"]=> string(12) "数据结构" ["catesid"]=> string(7) "["133"]" ["createtime"]=> string(10) "1511397279" ["_id"]=> string(3) "420" } [9]=> array(10) { ["id"]=> string(3) "419" ["text"]=> string(47) "久等了,博客园官方Android客户端发布" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(3) "cmt" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511396549" ["_id"]=> string(3) "419" } } ["count"]=> int(200) } 222 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#CPythonJava 或 Node.js

例如C#语言的 direct method 相关的方法:

https://docs.microsoft.com/zh-cn/dotnet/api/microsoft.azure.devices.client.moduleclient.setmessagehandlerasync?view=azure-dotnet

ModuleClient.SetMessageHandlerAsync Method

Definition

Namespace:

Microsoft.Azure.Devices.Client

Assembly:

Microsoft.Azure.Devices.Client.dll

Package:

Microsoft.Azure.Devices.Client v1.33.1

Overloads

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://github.com/Azure/iotedge/blob/master/edge-modules/SimulatedTemperatureSensor/src/Program.cs

 

相关逻辑请参考:

云端发送了“Reset” direct method请求,edge 设备的 module 执行了响应:

 

Azure IoT Edge入门(9)云到边缘设备控制-Azure iot edge module direct method

 

Azure IoT Edge入门(9)云到边缘设备控制-Azure iot edge module direct method

 

 

 

 

 

我们可以自行根据Module client 中的 SetMethodHandlerAsync 语法自行实现自己的 direct method:例如控制module重启,控制module 调整发送频率等等。

 

除了自行写代码实现这些功能,IoT Edge 中的 系统module之一的Edge-agnet 也内置了一些direct method:

 

https://docs.microsoft.com/zh-cn/azure/iot-edge/how-to-edgeagent-direct-method

 

PING

在IoT edge 中找到执行 direct method的设备,然后进入 edgeAgent module:

 

Azure IoT Edge入门(9)云到边缘设备控制-Azure iot edge module direct method

 

Azure IoT Edge入门(9)云到边缘设备控制-Azure iot edge module direct method

 

 

RestartModule

重启指定module:

在第八讲基础上运行的module,SensorModule会在重启后发送一条特殊的消息:Sensor Module Start

如下图所示:

Azure IoT Edge入门(9)云到边缘设备控制-Azure iot edge module direct method

 

接下来我们通过EdgeAgent的 RestartModule重启SensorModule,观察云端收到的数据

Azure IoT Edge入门(9)云到边缘设备控制-Azure iot edge module direct method

 

云端收到Module重启后发送的指令:

Azure IoT Edge入门(9)云到边缘设备控制-Azure iot edge module direct method

 

 

 

 

 

诊断相关的直接方法:

  • GetModuleLogs:在直接方法的响应中检索内联模块日志。
  • UploadModuleLogs:检索模块日志,并将其上传到 Azure Blob 存储。
  • UploadSupportBundle:使用支持捆绑检索模块日志,并将 zip 文件上传到 Azure Blob 存储。
  • GetTaskStatus:检查上传日志或支持捆绑请求的状态。

注意,IoT Edge Runtime 1.0.10 版本提供这些诊断直接方法。

 


 


声明:

 

点击可查阅本站文章目录 《文章分类目录》

本站所有内容仅代表个人观点,如与官文档冲突,请以官方文档为准。

可在本页面下方留言或通过下方联系方式联系我:

微信:wxyusz;邮箱:[email protected]

欢迎关注公众号“云计算实战”,接收最新文章推送。

Azure IoT Edge入门(9)云到边缘设备控制-Azure iot edge module direct method

Azure IoT Edge入门(9)云到边缘设备控制-Azure iot edge module direct method

本作品由Sean Yu 采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。
欢迎转载、使用、重新发布,但务必保留文章链接:https://www.51azure.cloud,且不得用于商业目的。

相关文章: