我正在使用AltBeacon图书馆与我的信标(由深圳.提供)。我使用以下方法
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));设置布局。在我的logcat中,我看到来自我的信标的RSSI值如下:
06-21 01:50:27.091 13496-13507/com.example.tkobilov.minewtestapp D/BluetoothAdapter﹕ onScanResult() - Device=CD:A6:29:2F:08:26 RSSI=-73
06-21 01:50:27.503 13496-13508/com.example.tkobilov.minewtestapp D/BluetoothAdapter﹕ onScanResult() - Device=D3:EB:21:87:9D:7E RSSI=-58
06-21 01:50:27.508 13496-13582/com.example.tkobilov.minewtestapp D/BluetoothAdapter﹕ onScanResult() - Device=D3:EB:21:87:9D:7E RSSI=-59然而,在
protected Beacon fromScanData(byte[] bytesToProcess, int rssi, BluetoothDevice device, Beacon beacon) {
BleAdvertisement advert = new BleAdvertisement(bytesToProcess);
Pdu pduToParse = null;
for (Pdu pdu: advert.getPdus()) {
if (pdu.getType() == Pdu.GATT_SERVICE_UUID_PDU_TYPE ||
pdu.getType() == Pdu.MANUFACTURER_DATA_PDU_TYPE) {
pduToParse = pdu;
if (LogManager.isVerboseLoggingEnabled()) {
LogManager.d(TAG, "Processing pdu type %02X: %s with startIndex: %d, endIndex: %d", pdu.getType(), bytesToHex(bytesToProcess), pdu.getStartIndex(), pdu.getEndIndex());
}
break;
}
else {
if (LogManager.isVerboseLoggingEnabled()) {
LogManager.d(TAG, "Ignoring pdu type %02X", pdu.getType());
}
}我每次都会“忽视pdu类型.”。我检查了bytesToProcess数组。每次只有1和2的非零值。其他值为零。Minew推荐的BeaconCFG应用程序可以在没有任何问题的情况下创建这些信标,但是我的项目需要AltBeacon。原因可能是什么?
我的LogCat输出:
D/蓝牙设备: mAddress: EE:74:8B:CA:DB:F1 D/蓝牙适配器: onScanResult() - Device=EE:74:8B:CA:DB:F1 RSSI=-52 D/CycledLeScanerForJellyBeanMr2: got记录D/蓝牙设备: mAddress: EE:74:8B:CA:DB:F1 D/BeaconParser:忽略pdu类型01 D/BeaconParser:忽略pdu类型0A D/BeaconParser:没有pdu在此数据包中处理。D/BeaconParser:此数据包中没有要处理的PDU。D/BeaconParser:忽略pdu类型0A D/BeaconParser:忽略pdu类型01 D/BeaconParser:此数据包中没有要处理的pdu。D/BeaconParser:此数据包中没有要处理的PDU。D/蓝牙适配器: onScanResult() - Device=ED:EE:AD:02:1B:30 RSSI=-62 D/CycledLeScanerForJellyBeanMr2: got记录D/BluetoothDevice: mAddress: ED:EE:广告:02:1B:30 D/蓝牙适配器: onScanResult() - Device=ED:EE:AD:02:1B:30 RSSI=-62 D/CycledLeScanerForJellyBeanMr2: got记录D/蓝牙设备: mAddress: ED:EE:广告:02:1B:30 D/BeaconParser:忽略pdu类型01 D/BeaconParser:没有pdu在此数据包中处理。D/BeaconParser:忽略pdu类型01 D/BeaconParser:此数据包中没有要处理的pdu。D/BeaconParser:忽略pdu类型0A D/BeaconParser:在此数据包中没有要处理的pdu。D/BeaconParser:忽略pdu类型0A D/BeaconParser:在此数据包中没有要处理的pdu。D/CycledLeScanner:等待停止扫描周期98毫秒D/CycledLeScanner:完成扫描周期D/蓝牙适配器: isEnabled D/CycledLeScanner:停止蓝牙扫描D/蓝牙适配器: stopLeScan() D/CycledLeScanner:启动新的扫描周期D/蓝牙适配器: isEnabled D/CycledLeScanner:启动新的蓝牙扫描D/蓝牙适配器: startLeScan():空D/蓝牙适配器:onClientRegistered(OnClientRegistered)- status=0 clientIf=1 D/CycledLeScanner:等待停止扫描循环1100毫秒
我的的内容
D/CycledLeScanner:等待停止扫描周期再等待1100毫秒D/CycledLeScanner:扫描启动D/蓝牙适配器: onScanResult() - Device=EE:74:8B:CA:DB:F1 RSSI=-63 D/CycledLeScanerForJellyBeanMr2: got记录D/蓝牙设备: mAddress: EE:74:8B:CA:DB:F1 D/BeaconParser:忽略pdu类型01 D/BeaconParser:没有pdu在此数据包中处理00 00 00 D/BeaconParser:忽略pdu类型01 D/BeaconParser:没有pdu在此包中处理-- 02 01 00 00 00 0000 00 00 00 0000 00 00 00已见D/蓝牙适配器: onScanResult() - Device=EE:74:8B:CA:DB:F1 RSSI=-63
发布于 2015-06-21 16:31:17
从蓝牙信标读取标识符的方法主要有两种:
根据问题和评论中报告的信息,看来飞利浦v387安卓设备的蓝牙堆栈有问题,它无法使用第一种机制检测信标。(它错误地报告它读取的广告数据包包含所有零。)这意味着这个设备根本无法运行探测信标的应用程序。据报道,它可以使用配置应用程序,这意味着它可以成功地建立GATT连接来配置信标。
,飞利浦,v387,安卓设备不能用来检测通用应用程序中的信标。然而,它可以用于配置使用GATT接口可连接的信标。。
发布于 2015-06-21 18:45:29
最后,作为解决办法,我看到了一种检查PDU和生成假信标对象的方法,如果adv包是错误的,则使用真正的MACs、RSSI和信标名称。在这种情况下,我不能使用主要,次要和TxPower,但RSSI和信标名称是可用的。
https://stackoverflow.com/questions/30959738
复制相似问题