连接 IoT 平台
<p><span style="font-size:16px"><strong>前提条件</strong></span></p>
<p>已在IoT平台控制台创建产品和设备,并获取设备证书信息(ProductKey、设备名称和DeviceSerect)。创建产品和设备具体操作细节,请参考<a href="https://yun.pingan.com/ssr/help/iot/iotplatform/iotplatform_serviceManual.productmanagement.createproduct">创建产品</a>、<a href="https://yun.pingan.com/ssr/help/iot/iotplatform/iotplatform_serviceManual.devicemanagement.createdevice">创建设备</a>。</p>
<p><strong>操作步骤</strong></p>
<p>1. 打开 MQTT.fx 下载页面,找到适合的版本下载并安装 <a href="http://mqttfx.jensd.de/index.php/download">MQTT.fx 客户端</a>,本文以 MQTT.fx 1.7.1 for Mac 版本为例。</p>
<p>2. 打开 MQTT.fx 客户端程序,单击<strong>设置</strong>并打开设置页面。</p>
<p><img src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20191907170748-1320a489933d.png" style="height:208px; width:830px" /></p>
<p>3. 在设置页面左下角单击<strong>+ </strong>,创建一个新的配置文件。</p>
<p>4. 填写 Connection Profile 相关信息和 General 信息。</p>
<p><img src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20191907170814-1872e0b8936e.png" style="height:663px; width:830px" /></p>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="background-color:#ededed; width:151px">
<p><strong>配置项</strong></p>
</td>
<td style="background-color:#ededed; width:578px">
<p><strong>说明</strong></p>
</td>
</tr>
<tr>
<td style="width:151px">
<p>Profile Name</p>
</td>
<td style="width:578px">
<p>配置文件保存为的名称。</p>
</td>
</tr>
<tr>
<td style="width:151px">
<p>Broker Address</p>
</td>
<td style="width:578px">
<p>MQTT 服务器连接地址。</p>
</td>
</tr>
<tr>
<td style="width:151px">
<p>Broker Port</p>
</td>
<td style="width:578px">
<p>MQTT 服务器连接端口。</p>
</td>
</tr>
<tr>
<td style="width:151px">
<p>Client ID</p>
</td>
<td style="width:578px">
<p>MQTT 协议字段,按照物联网通信约束填入:${productKey}@@${deviceName}@@${signMethod}@@${timestamp},如:"QWE123@@demo1@@md5@@ 1563027106", QWE123是productKey,demo1 是设备名称,md5是Hash算法,1563027106是时间戳。</p>
<p>其中signMethod签名方法支持MD5, SHA-1, SHA-2, SHA-256。</p>
</td>
</tr>
<tr>
<td style="width:151px">
<p>Connection Timeout</p>
</td>
<td style="width:578px">
<p>连接超时时间,单位为秒。</p>
</td>
</tr>
<tr>
<td style="width:151px">
<p>Keep Alive Interval</p>
</td>
<td style="width:578px">
<p>心跳间隔时间,单位为秒。</p>
</td>
</tr>
<tr>
<td style="width:151px">
<p>Auto Reconnect</p>
</td>
<td style="width:578px">
<p>断网自动重连</p>
</td>
</tr>
</tbody>
</table>
<p>5. 填写 User Credentials 信息。</p>
<p><img src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20191907170913-170a12fd91fd.png" style="height:445px; width:830px" /></p>
<p>6. 选择开启 SSL/TLS,这里我们选择CA certificate file为例。</p>
<p><img src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20191907170937-1203dcb1974a.png" style="height:620px; width:830px" /></p>
<p><strong>说明</strong>: 图中使用的CA证书可以从<a href="https://pacloud.obs-cn-shanghai.pinganyun.com/IOT%2Froot.crt?response-content-disposition=attachment%3Bfilename%3Droot.crt">这里</a>下载</p>
<p>7. 完成以上步骤设置后,单击<strong>Apply</strong>和<strong>OK</strong>进行保存,并在配置文件框中选择刚才创建的文件名,单击<strong>Connect</strong>。当右上角圆形图标为绿色时,说明已连接 IoT 平台成功,可进行发布和订阅操作。</p>
<p><img src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20191907171014-120b4f549571.jpg" style="height:503px; width:830px" /></p>
提交成功!非常感谢您的反馈,我们会继续努力做到更好!