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
@@ -1283,6 +1289,9 @@ Value is a base64 encoded string of written bytes. Use bluetoothle.encodedString
1283
1289
var returnObj = {"status":"written","service":"180F","characteristic":"2A19","value":"V3JpdGUgSGVsbG8gV29ybGQ=","address":"ABC123"}
1284
1290
var bytes =bluetoothle.encodedStringToBytes(returnObj.value);
1285
1291
var string =bluetoothle.bytesToString(bytes); //This should equal Write Hello World
1292
+
1293
+
// if your code includes special characters you should use the decodeUnicode helper function
1294
+
var string =bluetoothle.decodeUnicode(returnObj.value);
1286
1295
```
1287
1296
1288
1297
@@ -2243,6 +2252,20 @@ if (obj.status == "subscribedResult")
2243
2252
}
2244
2253
```
2245
2254
2255
+
### encodeUnicode ###
2256
+
Helper function to convert unicode string to base64 encoded string. This function can be used to encode special characters such as emojis.
2257
+
2258
+
```javascript
2259
+
bluetoothle.encodeUnicode(string);
2260
+
```
2261
+
2262
+
### decodeUnicode ###
2263
+
Helper function to convert a base64 encoded string to unicode string. This function also decodes special characters such as emojis.
2264
+
2265
+
```javascript
2266
+
bluetoothle.decodeUnicode(string);
2267
+
```
2268
+
2246
2269
## Sample: Discover and interact with Bluetooth LE devices ##
2247
2270
2248
2271
We'll build an app that lets you discover Bluetooth Low Energy (LE) devices that are around you, connect to a one, and then look at all of the information that you can obtain from that device such as signal strength, supported services, battery level and more.
0 commit comments