在node.js检测系统蓝牙设备是否断开

Detect in node.js whether system bluetooth device is disconnected

我正在使用 node.js(使用 Electron)作为 OS X 与两个蓝牙设备接口的中间件。时不时地,蓝牙设备(驱动程序)崩溃。我无法再 enable/disable 它并且它没有响应。

只有重新加载蓝牙驱动程序才有效(通过kextunloadkextload)。

那么有没有way/module检测设备是否已经断开连接的方法呢?

应该是用socketio吧?这是一个猜测;如果没有,请展示您使用的是什么,以便其他人提供帮助。

socket.on('disconnect', function() {
  console.log('disconnect!');
});