B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt: Difference between revisions

Jump to navigation Jump to search
no edit summary
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 { function onResolve() {
       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 { function onResolve() {
   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 { function onResolve(rssi) {
   gatt.readRemoteRssi().then ( function onResolve(rssi) {
     console.log("Remote RSSI value:", rssi);
     console.log("Remote RSSI value:", rssi);
   }, function onReject(aReason) {
   }, function onReject(aReason) {
120

edits

Navigation menu