Skip to content

Web bluetooth breaks callbackResponse #44

New issue

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

Open
FPSUsername opened this issue Feb 7, 2020 · 2 comments
Open

Web bluetooth breaks callbackResponse #44

FPSUsername opened this issue Feb 7, 2020 · 2 comments

Comments

@FPSUsername
Copy link

I am trying to get the characteristics using web bluetooth, but I receive this error when the javascript calls the service.

return device.gatt.connect().
            then(server => {
                return server.getPrimaryService('b923d807-d8de-469d-89aa-c0d61a4e59a4');
            }).
            then(service => {
                service.getCharacteristic('b923d807-d8de-469d-89aa-c0d61a4e59a5');
            })';

Error from the beacon:

Exception in thread HCISocketPoller:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/ubuntu/.local/lib/python3.6/site-packages/pybleno/hci_socket/BluetoothHCI/BluetoothHCI.py", line 197, in _socket_poller
self._socket_on_data_user_callback(bytearray(data))
File "/home/ubuntu/.local/lib/python3.6/site-packages/pybleno/hci_socket/Hci.py", line 414, in onSocketData
self.emit('aclDataPkt', [handle, cid, pktData])
File "/home/ubuntu/.local/lib/python3.6/site-packages/pybleno/hci_socket/Emit.py", line 17, in emit
handler(*arguments)
File "/home/ubuntu/.local/lib/python3.6/site-packages/pybleno/hci_socket/Bindings.py", line 169, in onAclDataPkt
self._aclStream.push(cid, data)
File "/home/ubuntu/.local/lib/python3.6/site-packages/pybleno/hci_socket/AclStream.py", line 18, in push
self.emit('data', [cid, data])
File "/home/ubuntu/.local/lib/python3.6/site-packages/pybleno/hci_socket/Emit.py", line 17, in emit
handler(*arguments)
File "/home/ubuntu/.local/lib/python3.6/site-packages/pybleno/hci_socket/Gatt.py", line 228, in onAclStreamData
self.handleRequest(data)
File "/home/ubuntu/.local/lib/python3.6/site-packages/pybleno/hci_socket/Gatt.py", line 271, in handleRequest
response = self.handleReadOrReadBlobRequest(request)
File "/home/ubuntu/.local/lib/python3.6/site-packages/pybleno/hci_socket/Gatt.py", line 681, in handleReadOrReadBlobRequest
callback(result, data)
File "/home/ubuntu/.local/lib/python3.6/site-packages/pybleno/hci_socket/Gatt.py", line 620, in callback
callbackResponse[1 + i] = data[i]
TypeError: an integer is required (got type str)

@Adam-Langley
Copy link
Owner

Adam-Langley commented Feb 7, 2020 via email

@FPSUsername
Copy link
Author

I only used the onReadRequest funtion from the echo example. Apparently adding self._updateValueCallback = None fixed the issue.

I also tried using the callback method from the pizza example (onReadRequest) callback(Characteristic.RESULT_SUCCESS, data); but that gave me some errors regarding the data (I defined data the same way it has been set in the class itself).

Last problem is that the descriptor doesn't work unless I put the uuid and value into a dict. This however produces the same TypeError when doing a read request for the descriptor (which I tried with BLE Scanner)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants