请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:CC2652R 工具与软件:
SDK 版本: 7.40.00.77
#!/bin/sh #/usr/bin/blescan.sh tty="$(uci -q get tisbl.tisbl.tty)" [ -z "$tty" ] && tty='/dev/ttyMSM1' exec 100>"/var/lock/ble.lock" flock 100 MAX_COUNT=20 count=1 com-wr.sh "$tty" 3 "\x01\x1D\xFC\x01\x00" > /dev/null # this reset command delay time must >= 3, if small than 3, the following commands will be something wrong com-wr.sh "$tty" 1 "\x01\x00\xFE\x08\x02\x00\x00\x00\x00\x00\x00\x00" > /dev/null com-wr.sh "$tty" 1 "\x01\x60\xFE\x04\x01\x00\x20\x00" > /dev/null com-wr.sh "$tty" 1 "\x01\x60\xFE\x04\x01\x01\x20\x00" > /dev/null com-wr.sh "$tty" 1 "\x01\x61\xFE\x02\x01\x02" > /dev/null com-wr.sh "$tty" 1 "\x01\x61\xFE\x02\x01\x03" > /dev/null com-wr.sh "$tty" 1 "\x01\x61\xFE\x02\x01\x04" > /dev/null com-wr.sh "$tty" 1 "\x01\x61\xFE\x02\x01\x05" > /dev/null #com-wr.sh "$tty" 3 "\x01\x51\xFE\x06\x00\x00\xF4\x01\x28\x00" | tee /tmp/blescan.data | ble-scan-rx-parser.sh while [ $count -le $MAX_COUNT ] do com-wr.sh "$tty" 10 "\x01\x51\xFE\x06\x00\x00\x00\x04\x00\x02" | tee /tmp/blescan.data | ble-scan-rx-parser.sh com-wr.sh "$tty" 1 "\x01\x52\xFE\x00" > /dev/null count=$((count + 1)) done exec 100>&-
下面随附的代码介绍了我们如何在每个扫描周期向 CC2652发送命令。
#!/bin/sh # com-wr.sh tty time command parser # example com-wr.sh /dev/ttyMSM1 1 "\x01\x1D\xFC\x01\x00" | hexdump.sh --> send "\x01\x1D\xFC\x01\x00" to /dev/ttyMSM1 and then hexdump receive data until 100ms timeout #command example "\x7E\x03\xD0\xAF und normaler Text" usleep 10000 tty=$1 time=$2 command=$3 parser=$4 stty -F $tty time $time exec 99< $tty echo -en $command > $tty cat $tty exec 99<&-
下面 随附代码介绍了我们向 TTY 发送命令的方式。
在当前情况下、我们发送命令 "\x01\x51\xFE\x06\x00\x00\x04\x00\x02" 从而使 CC2652R 扫描 BLE 数据。
在我们多次重复该操作(大约6000次)之后、CC2652R 将不会有响应。
我们想知道扫描时间是否有任何限制、或者根本原因是什么。