We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After sending a cmd to RPi i got this warning in network manager and no response
W | NetworkManagerBluetoothServer: Got invalid json object "{c:0}\n"
My JS code:
button.addEventListener('pointerup', function(event) { navigator.bluetooth.requestDevice({ acceptAllDevices: true, optionalServices: [ 'ef6d6610-b8af-49e0-9eca-ab343513641c', '00001801-0000-1000-8000-00805f9b34fb', 'e081fec0-f757-4449-b9c9-bfa83133f7fc', '00001800-0000-1000-8000-00805f9b34fb', '0000180a-0000-1000-8000-00805f9b34fb' ] }) .then(device => device.gatt.connect()) .then(server => { // Getting Battery Service… return server.getPrimaryService('e081fec0-f757-4449-b9c9-bfa83133f7fc'); }) .then(service => { // Getting Battery Level Characteristic… return service.getCharacteristic('e081fec1-f757-4449-b9c9-bfa83133f7fc'); }) .then(characteristic => { let encoder = new TextEncoder('utf-8'); return characteristic.writeValue(encoder.encode({'c': 0}+'\n')); }) .then(value => { console.log( new TextDecoder("utf-8").decode(value)); }) .catch(error => { console.error(error); }); });
Do I something wrong? Have someone try to use Browser BT API to set WLAN on RPi?
The text was updated successfully, but these errors were encountered:
Looks like the received byte array does not contain valid json data. Try to send encoder.encode({"c": 0}+'\n') or encoder.encode('{"c": 0}'+'\n')
encoder.encode({"c": 0}+'\n')
encoder.encode('{"c": 0}'+'\n')
not sure about the syntax...
but the receiving string should actually look like this: {"c": 0}\n
{"c": 0}\n
Sorry, something went wrong.
No branches or pull requests
After sending a cmd to RPi i got this warning in network manager and no response
W | NetworkManagerBluetoothServer: Got invalid json object "{c:0}\n"
My JS code:
Do I something wrong? Have someone try to use Browser BT API to set WLAN on RPi?
The text was updated successfully, but these errors were encountered: