IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.61k stars 490 forks source link

Error while trying to write empty byte array #281

Closed schef closed 5 years ago

schef commented 6 years ago

Hi, i am trying to write empty byte array but i get an error. This is possible on android for example in nrf-connect application also using Nordic's SDK. Do you have any suggestions on how this would be possible? What i have to modify?

Here is error i got.

  File "/home/work/bin/command_parser_client.py", line 39, in endStream
    self.char.write(bytearray.fromhex(''), withResponse=False)
  File "/usr/lib/python3.6/site-packages/bluepy/btle.py", line 163, in write
    return self.peripheral.writeCharacteristic(self.valHandle, val, withResponse)
  File "/usr/lib/python3.6/site-packages/bluepy/btle.py", line 503, in writeCharacteristic
    return self._getResp('wr')
  File "/usr/lib/python3.6/site-packages/bluepy/btle.py", line 370, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/usr/lib/python3.6/site-packages/bluepy/btle.py", line 333, in _waitResp
    raise BTLEException(BTLEException.COMM_ERROR, "Error from Bluetooth stack (%s)" % errcode)
bluepy.btle.BTLEException: Error from Bluetooth stack (badparam)

Thanks.

IanHarvey commented 5 years ago

This got fixed in revision b0abf7e; I haven't currently made a release to PyPI with it in.

schef commented 5 years ago

Thanks.