120
edits
No edit summary |
|||
| Line 131: | Line 131: | ||
console.log("Re-connect to remote LE device."); | console.log("Re-connect to remote LE device."); | ||
gatt.connect().then | gatt.connect().then ( function onResolve() { | ||
console.log("Re-connection succeeds. ConnectionState becomes:", gatt.connectionState); | console.log("Re-connection succeeds. ConnectionState becomes:", gatt.connectionState); | ||
}, function onReject(aReason) { | }, function onReject(aReason) { | ||
| Line 152: | Line 152: | ||
var gatt = device.gatt; | var gatt = device.gatt; | ||
if (gatt && gatt.connectionState === "connected") { | if (gatt && gatt.connectionState === "connected") { | ||
gatt.disconnect().then | gatt.disconnect().then ( function onResolve() { | ||
console.log("Disconnection succeeds. ConnectionState becomes:", gatt.connectionState); | console.log("Disconnection succeeds. ConnectionState becomes:", gatt.connectionState); | ||
}, function onReject(aReason) { | }, function onReject(aReason) { | ||
| Line 170: | Line 170: | ||
var gatt = device.gatt; | var gatt = device.gatt; | ||
if (gatt && gatt.connectionState === "connected") { | if (gatt && gatt.connectionState === "connected") { | ||
gatt.readRemoteRssi().then | gatt.readRemoteRssi().then ( function onResolve(rssi) { | ||
console.log("Remote RSSI value:", rssi); | console.log("Remote RSSI value:", rssi); | ||
}, function onReject(aReason) { | }, function onReject(aReason) { | ||
edits