This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CC2650STK:将Web演示上运行的MQTT客户端连接到边缘路由器上的代理,并将传感器数据显示到控制台

Guru**** 2535750 points
Other Parts Discussed in Thread: CC2650STK, CC2531EMK

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/585842/cc2650stk-connecting-the-mqtt-client-running-on-the-web-demo-to-a-broker-on-the-edge-router-and-displaying-sensor-data-to-console

部件号:CC2650STK
主题中讨论的其他部件: CC2531EMK

我遵循此教程:
http://processors.wiki.ti.com/index.php/Cc26xx_sw_examples

但是,我没有使用cc26xx-demo,而是使用cc26xx-web-demo并成功地管理了一切,我可以访问6lbr网页,当我访问sensorTag页面时,我看到了一个MQTT配置页,如下所示:
ztzui

我正在尝试使用javascript本地连接到MQTT代理,并让它发送传感器数据,以便我将其打印到控制台。

我的js文件
var MQTT = require('qtt');
var FS = require('fs');

var端口= 1883;
var主机='0064:ff9b:0000:0000:0000:0000:0000:0000:b8ac:7cbd';0000;

var0000var选项0000选项=0000={0000{端口0000端口:端口,主机:主机,};
client = MQTT.connect(options);

client.on( var.on(选项

console.log ("它到达1点")
client.subscribe("topic, command or data");
console.log("subbed")


client.publish("topic, command or data", data, function (){
console.log("已发布")
});

});



client.on ('error',函数(){console.log("error")});

client.on ('offline',函数(){ console.log("off-line")});

client.on('message',函数(主题,消息){

console.log(message.toString();});

但这是我得到的结果
screenshot from 2017-04-02 16-20-20

我在边缘路由器(BeagleBone black wirless)上运行tcpdump来侦听端口1883上的流量,它似乎正在收集数据包,如图所示
1

在我遵守之前,我在Web演示中唯一更改的是project-conf.h

/* Change to match your configuration */
#define IEEE802154_CONF_PANID            0xABCD
#define RF_CORE_CONF_CHANNEL                 26
#define RF_BLE_CONF_ENABLED                   0

然后将它闪到我的sensorTag cc2650stk

我要连接的MQTT代理IP和端口是吗?

我的设置

BBB无线:运行6lbr的边缘路由器
使用上面的TI示例中使用CC2531-SLIP RADIO_容器 刷新的CC2531EMK加密狗
cc2650STK:使用cc26xx-web-demo刷新,并提及我对project-conf.h所做的更改

6lbr设置:

MODE=ROUTER

RAW_ETH=1
BRIDGE=0
DEV_BRIDGE=br0
DEV_TAP=tap0
DEV_ETH=wlan0
RAW_ETH_FCS=0

DEV_RADIO=/dev/ttyACM0 
BAUDRATE=115200
LOG_LEVEL=3
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    要访问在BBB上运行的边缘路由器上的任何服务,您需要在桥接模式下设置6lbr接口,请执行以下步骤: github.com/.../6LBR-Interface-Configuration

    我建议您首先在连接到同一子网的PC上运行MQTT代理,您的配置看起来不错。