【发布时间】:2013-07-12 13:06:05
【问题描述】:
是否可以使用蓝牙 javascript 扩展 API 来实现蓝牙服务器(换句话说,监听套接字),它可以允许设备(蓝牙客户端)连接?
根据当前的文档和极少数示例,我发现这是否可能是一种不确定性。
谢谢。
【问题讨论】:
标签: google-chrome bluetooth google-chrome-app chromium
是否可以使用蓝牙 javascript 扩展 API 来实现蓝牙服务器(换句话说,监听套接字),它可以允许设备(蓝牙客户端)连接?
根据当前的文档和极少数示例,我发现这是否可能是一种不确定性。
谢谢。
【问题讨论】:
标签: google-chrome bluetooth google-chrome-app chromium
是的:https://developer.chrome.com/apps/app_bluetooth#listening
var uuid = '1105';
chrome.bluetoothSocket.create(function(createInfo) {
chrome.bluetoothSocket.onAccept.addListener(function(acceptInfo) {
if (info.socketId != createInfo.socketId) return;
// Say hello...
chrome.bluetoothSocket.send(acceptInfo.clientSocketId,
data, onSendCallback);
// Accepted sockets are initially paused,
// set the onReceive listener first.
chrome.bluetoothSocket.onReceive.addListener(onReceive);
chrome.bluetoothSocket.setPaused(acceptInfo.clientSocketId, false);
});
chrome.bluetoothSocket.listenUsingRfcomm(
createInfo.socketId, uuid, function() {
// check chrome.runtime.lastError
});
});
【讨论】: