使用Visual Studio Code 的 Azure IoT Tools在设备和 IoT Hub之间发送和接收消息

16 篇文章 0 订阅
14 篇文章 1 订阅

 

实验目的:

  • 使用适用于 Visual Studio Code 的 Azure IoT 工具来监视设备到云消息。

  • 使用适用于 Visual Studio Code 的 Azure IoT 工具来发送云到设备消息。

复制此 URL 并将其粘贴到浏览器窗口中,打开VS Code:vscode:extension/vsciot-vscode.azure-iot-tools

 

实验过程:

登录以访问 IoT 中心

  1. 在 VS Code 的“资源管理器” 视图中,展开左下角的“Azure IoT HUB” 部分。

  2. 在上下文菜单中单击“选择 IoT hub” 。

  3. 弹出窗口将显示在右下角,以便让你首次登录 Azure。

  4. 登录后,将显示 Azure 订阅列表,然后选择“Azure 订阅和 IoT Hub”。

  5. 几秒钟后,设备列表将显示在“Azure IoT 中心设备” 选项卡中。

     备注

    也可以选择“设置 IoT 中心连接字符串”来完成设置。 在弹出窗口中输入 IoT 设备连接到的 IoT 中心的 iothubowner 策略连接字符串。

Setup Azure IoT Hub through Connection String

You can use IoT Hub connection string to setup your IoT Hub

  1. In Explorer of VS Code, click "Azure IoT Hub Devices" in the bottom left corner.

  2. Click "Set IoT Hub Connection String" in context menu.

  3. An input box will pop up, then enter your IoT Hub Connection String (It is one-time configuration, and please make sure it is IoT Hub Connection String and not Device Connection String. The format is HostName=<my-hub>.azure-devices.net;SharedAccessKeyName=<my-policy>;SharedAccessKey=<my-policy-key>).

  4. The device list will be shown.

  5. Then you can manage your devices and interact with Azure IoT Hub through context menu.

NOTE: You can also go to File > Preferences > Settings (Code > Preferences > Settings), and update the configuration of azure-iot-toolkit.iotHubConnectionString to change your IoT Hub Connection String.

 

监视设备到云的消息

若要监视设备发送到 IoT 中心的消息,请执行以下步骤:

  1. 右键单击设备,然后选择“开始监视内置事件终结点” 。

  2. 受监视的消息将显示在“输出” > “Azure IoT Hub” 视图中。

  3. 若要停止监视,请右键单击“输出” 视图,然后选择“停止监视内置事件终结点” 。

发送“云到设备”消息

要将消息从 IoT 中心发送到设备,请执行以下步骤:

  1. 右键单击设备,然后选择“将 C2D 消息发送到设备” 。

  2. 在输入框中输入消息。

  3. 结果将显示在“输出” > “Azure IoT Hub” 视图中。

 

参照:https://docs.microsoft.com/zh-cn/azure/iot-hub/iot-hub-vscode-iot-toolkit-cloud-device-messaging 使用适用于 Visual Studio Code 的 Azure IoT 工具在设备和 IoT 中心之间发送和接收消息

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Visual Studio Code是一款轻量级的集成开发环境(IDE),它支持多种编程语言和版本控制系统。如果你想在Visual Studio Code使用TFVC连接Azure DevOps,可以按照以下步骤进行设置: 1. 安装Visual Studio Code:首先,你需要下载并安装Visual Studio Code。你可以从官方网站(https://code.visualstudio.com/)下载适用于你的操作系统的安装程序。 2. 安装Azure Repos扩展:打开Visual Studio Code后,在侧边栏的扩展面板中搜索并安装"Azure Repos"扩展。这个扩展提供了与Azure DevOps集成所需的功能。 3. 登录Azure DevOps:在Visual Studio Code中,按下Ctrl+Shift+P(或者Cmd+Shift+P)打开命令面板,然后输入"Azure Repos: Sign in"并选择该命令。按照提示登录到你的Azure DevOps帐户。 4. 克隆TFVC存储库:在Visual Studio Code中,按下Ctrl+Shift+P(或者Cmd+Shift+P)打开命令面板,然后输入"Azure Repos: Clone TFVC Repository"并选择该命令。输入你要克隆的TFVC存储库的URL,并选择本地存储库的位置。 5. 连接到Azure DevOps:在Visual Studio Code中,按下Ctrl+Shift+P(或者Cmd+Shift+P)打开命令面板,然后输入"Azure Repos: Connect to Team Foundation Server"并选择该命令。输入你的Azure DevOps服务器的URL,并选择你要连接的项目。 6. 进行版本控制操作:现在,你可以在Visual Studio Code使用TFVC进行版本控制操作了。你可以查看、检出、提交和合并代码等。 希望以上步骤对你有所帮助!如果你还有其他问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值