我试了一下,用树莓来传达Linkdesk运动传感器(ble)。 起初我用iphone 6 + HomeControl Device + IFTTT测试了传感器,我在进入或离开房间时收到了通知。
我没有找到有关产品服务和功能的信息。
我检查了系统使用实用程序“bluetoothctl”可以很好地看到检测器。 所以我开始寻找nodejs的模块,用“贵族”完成,这使我能够列出服务和功能,见下文:
服务:1800 服务:1801 服务:ff10 服务:ff20 服务:ff30 服务:ff00
ServiceUuid:'1800' Caracteristiques:{“uuid”:“2a00”,“name”:“Device Name”,“type”:“org.bluetooth.characteristic.gap.device_name”,“properties”:[“read”]} Caracteristiques:{“uuid”:“2a01”,“name”:“Appearance”,“type”:“org.bluetooth.characteristic.gap.appearance”,“properties”:[“read”]} Caracteristiques:{“uuid”:“2a02”,“name”:“Peripheral Privacy Flag”,“type”:“org.bluetooth.characteristic.gap.peripheral_privacy_flag”,“properties”:[“read”,“write”] } Caracteristiques:{“uuid”:“2a04”,“name”:“Peripheral Preferred Connection Parameters”,“type”:“org.bluetooth.characteristic.gap.peripheral_preferred_connection_parameters”,“properties”:[“read”]}
ServiceUuid:'1801': Caracteristiques:{“uuid”:“2a05”,“name”:“Service Changed”,“type”:“org.bluetooth.characteristic.gatt.service_changed”,“properties”:[“read”,“indication”]}
ServiceUuid:'ff10': Caracteristiques:{“uuid”:“ff11”,“name”:null,“type”:null,“properties”:[“read”,“write”,“notify”]} Caracteristiques:{“uuid”:“ff12”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff13”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff14”,“name”:null,“type”:null,“properties”:[“read”]} Caracteristiques:{“uuid”:“ff15”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff16”,“name”:null,“type”:null,“properties”:[“read”,“write”]}
ServiceUuid:'ff20': Caracteristiques:{“uuid”:“ff21”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff22”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff23”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff24”,“name”:null,“type”:null,“properties”:[“read”]} Caracteristiques:{“uuid”:“ff25”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff26”,“name”:null,“type”:null,“properties”:[“read”,“write”]}
ServiceUuid:'ff30': Caracteristiques:{“uuid”:“ff31”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff32”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff33”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff34”,“name”:null,“type”:null,“properties”:[“read”]} Caracteristiques:{“uuid”:“ff35”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff36”,“name”:null,“type”:null,“properties”:[“read”,“write”]}
ServiceUuid:'ff00': Caracteristiques:{“uuid”:“ff01”,“name”:null,“type”:null,“properties”:[“read”]} Caracteristiques:{“uuid”:“ff02”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff03”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff04”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff05”,“name”:null,“type”:null,“properties”:[“read”]} Caracteristiques:{“uuid”:“ff06”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff07”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff08”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff09”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff0a”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff0b”,“name”:null,“type”:null,“properties”:[“read”,“write”]} Caracteristiques:{“uuid”:“ff0c”,“name”:null,“type”:null,“properties”:[“read”,“write”]}
如果我理解正确,只有“ff11”功能可以处理通知。所以我测试了这些代码行,但没有......我在控制台上没有收到任何通知:(
...
peripheral.connect(function(error) {
peripheral.discoverServices(['ff10'], function(error, services) {
var serviceIndex = 0;
if (!error) {
var service = services[0];
service.discoverCharacteristics(['ff11'], function(error, characteristics) {
var characteristic = characteristics[0];
console.log('Discovered sensor caracteristics');
characteristic.on('data', function(data, isNotification) {
console.log('Detection is : ', data);
});
characteristic.subscribe(function(error) {
console.log('Detection notification on');
});
});
}
});
});
...
有人有想法帮助我吗? 在此先感谢您的帮助