Received advertising data format is not ArrayBuffer
See original GitHub issueVersion
- react-native-ble-manager v5.0.4
- react-native v0.45.1
- Android v5.0.2
Expected behavior
From your example code, it is shown that in handleDiscoverPeripheral
, the peripheral
object will have a advertising key and it will be an ArrayBuffer ( the same thing also specified in cordova-plugin-ble-central documentation ). it can then be easily converted to UInt8Array or String.
Actual behavior
When I logged the peripheral
object it is showing that the advertising
key is an object with two keys: ‘CDVType’ and ‘data’. I tried to convert this object to UInt8Array using new Uint8Array(peripheral.advertising)
and to String using String.fromCharCode.apply(null, new Uint16Array(buf))
. But failed. It is showing an empty result. Am I missing something?
Stack trace and console log
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
I am stuck in determining whether BLE device is connectable ...
The advertisement data in the buffer you are examining is part of the payload and does not contain information from the PDU header....
Read more >ArrayBuffer, binary arrays - The Modern JavaScript Tutorial
In web-development we meet binary data mostly while dealing with files (create, upload, download). Another typical use case is image ...
Read more >20. Typed Arrays - Exploring JS
Instances of ArrayBuffer store the binary data to be processed. Two kinds of views are used to access the data: Typed Arrays (...
Read more >Node.js v19.3.0 Documentation
Basic Node-API data types ... No require , exports , or module.exports; No __filename or __dirname ... arrayBuffer(stream); streamConsumers.blob(stream) ...
Read more >Persisting and manipulating JS ArrayBuffer data on the server
If I store every Buffer in a binary file, and use filesystem seek/read/write ops, I get finegrained control but I lose convenience, and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@marcosinigaglia How do you think about this idea (using bytes rather than base64 for advertising data) ? I can try to make a PR about this one, for both iOS and Android.
On LollipopScanner onScanResult i get the advertising data like this
SparseArray<byte[]> array = result.getScanRecord().getManufacturerSpecificData(); byte[] manufacture_data = [] if(array.valueAt(0) != null){ manufacture_data = array.valueAt(0); } and you get an array of bytes with the manufacturerData inside.