OLD | NEW |
1 <h1>Bluetooth</h1> | 1 <h1>Bluetooth</h1> |
2 | 2 |
3 <p> | 3 <p> |
4 This document describes how to use the <a href="bluetooth.html">Bluetooth</a>, | 4 This document describes how to use the <a href="bluetooth.html">Bluetooth</a>, |
5 <a href="bluetoothSocket.html">Bluetooth Socket</a> and | 5 <a href="bluetoothSocket.html">Bluetooth Socket</a> and |
6 <a href="bluetoothLowEnergy.html">Bluetooth Low Energy</a> APIs to | 6 <a href="bluetoothLowEnergy.html">Bluetooth Low Energy</a> APIs to |
7 communicate with Bluetooth and Bluetooth Low Energy devices. | 7 communicate with Bluetooth and Bluetooth Low Energy devices. |
8 </p> | 8 </p> |
9 | 9 |
10 <p> | 10 <p> |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 // Do stuff with the bytes. | 787 // Do stuff with the bytes. |
788 ... | 788 ... |
789 }); | 789 }); |
790 </pre> | 790 </pre> |
791 | 791 |
792 <p> | 792 <p> |
793 Some characteristics are writable, especially those that behave as "Control | 793 Some characteristics are writable, especially those that behave as "Control |
794 Points", where writing the value has side effects. For example, the <em>Heart | 794 Points", where writing the value has side effects. For example, the <em>Heart |
795 Rate Control Point</em> characteristic is used to tell a heart rate sensor to | 795 Rate Control Point</em> characteristic is used to tell a heart rate sensor to |
796 reset its count of total calories burned and only supports writes. To achieve | 796 reset its count of total calories burned and only supports writes. To achieve |
797 this, Chrome provides the $(ref:bluetootLowEnergy.writeCharacteristicValue) | 797 this, Chrome provides the $(ref:bluetoothLowEnergy.writeCharacteristicValue) |
798 method: | 798 method: |
799 </p> | 799 </p> |
800 | 800 |
801 <pre> | 801 <pre> |
802 var myBytes = new Uint8Array([ ... ]); | 802 var myBytes = new Uint8Array([ ... ]); |
803 chrome.bluetoothLowEnergy.writeCharacteristicValue(chrc.instanceId, | 803 chrome.bluetoothLowEnergy.writeCharacteristicValue(chrc.instanceId, |
804 myBytes.buffer, | 804 myBytes.buffer, |
805 function() { | 805 function() { |
806 if (chrome.runtime.lastError) { | 806 if (chrome.runtime.lastError) { |
807 console.log('Failed to write value: ' + | 807 console.log('Failed to write value: ' + |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 | 920 |
921 <p> | 921 <p> |
922 <span style="font-weight: bold;">NOTE:</span> If a characteristic supports | 922 <span style="font-weight: bold;">NOTE:</span> If a characteristic supports |
923 notifications/indications, it will have the "Client Characteristic | 923 notifications/indications, it will have the "Client Characteristic |
924 Configuration" descriptor to enable/disable notifications. Chrome does not | 924 Configuration" descriptor to enable/disable notifications. Chrome does not |
925 permit apps to write to this descriptor. Apps should instead use the | 925 permit apps to write to this descriptor. Apps should instead use the |
926 $(ref:bluetoothLowEnergy.startCharacteristicNotifications) and | 926 $(ref:bluetoothLowEnergy.startCharacteristicNotifications) and |
927 $(ref:bluetoothLowEnergy.stopCharacteristicNotifications) methods to control | 927 $(ref:bluetoothLowEnergy.stopCharacteristicNotifications) methods to control |
928 notification behavior. | 928 notification behavior. |
929 </p> | 929 </p> |
OLD | NEW |