You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,9 @@ Another option is to connect to the device and use the "Device Information" (0x1
93
93
See the following StackOverflow posts for more info: [here](https://stackoverflow.com/questions/18973098/get-mac-address-of-bluetooth-low-energy-peripheral) and [here](https://stackoverflow.com/questions/22833198/get-advertisement-data-for-ble-in-ios)
94
94
95
95
96
+
## Data Values ##
97
+
98
+
96
99
## Emulator ##
97
100
Neither Android nor iOS support Bluetooth on emulators, so you'll need to test on a real device.
Value is a base64 encoded string of bytes to write. Use bluetoothle.bytesToEncodedString(bytes) to convert to base64 encoded string from a unit8Array.
1054
1057
To write without response, set type to "noResponse". Any other value will default to write with response. Note, no callback will occur on write without response on iOS.
1055
1058
```javascript
1056
-
var string ="Hello World";
1059
+
var string ="Write Hello World";
1057
1060
var bytes =bluetoothle.stringToBytes(string);
1058
1061
var encodedString =bluetoothle.bytesToEncodedString(bytes);
1059
1062
1060
1063
//Note, this example doesn't actually work since it's read only characteristic
Value is a base64 encoded string of written bytes. Use bluetoothle.encodedStringToBytes(obj.value) to convert to a unit8Array. See characteristic's specification and example below on how to correctly parse this.
1066
1069
1067
1070
```javascript
1068
-
var returnObj = {"status":"written","service":"180F","characteristic":"2A19","value":"SGVsbG8gV29ybGQ=","address":"ABC123"}
1071
+
var returnObj = {"status":"written","service":"180F","characteristic":"2A19","value":"V3JpdGUgSGVsbG8gV29ybGQ=","address":"ABC123"}
1069
1072
var bytes =bluetoothle.encodedStringToBytes(returnObj.value);
1070
-
var string =bluetoothle.bytesToString(bytes); //This should equal Hello World!
1073
+
var string =bluetoothle.bytesToString(bytes); //This should equal Write Hello World
1071
1074
```
1072
1075
1073
1076
@@ -1157,14 +1160,14 @@ var string = "Hello World";
1157
1160
var bytes =bluetoothle.stringToBytes(string);
1158
1161
var encodedString =bluetoothle.bytesToEncodedString(bytes);
0 commit comments