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
Traceback (most recent call last):
File "test.py", line 14, in <module>
machine.groups[0].startBrewing()
File "/Users/ben/Github/bt4prototype/MockEspresso/Group.py", line 86, in startBrewing
listener.didStartBrewing(self.id)
File "/Users/ben/Github/bt4prototype/MockEspresso/EspressoMachine.py", line 32, in didStartBrewing
self.bluetooth.write_attribute(24,'01')
File "/Users/ben/Github/bt4prototype/MockEspresso/Bluetooth.py", line 55, in write_attribute
self.ble.send_command(self.ser, self.ble.ble_cmd_attributes_write(handle, 0, value))
File "/Users/ben/Github/bt4prototype/bglib.py", line 172, in ble_cmd_attributes_write
return struct.pack('<4BHBB' + str(len(value)) + 's', 0, 4 + len(value), 2, 0, handle, offset, len(value), b''.join(chr(i) for i in value))
File "/Users/ben/Github/bt4prototype/bglib.py", line 172, in <genexpr>
return struct.pack('<4BHBB' + str(len(value)) + 's', 0, 4 + len(value), 2, 0, handle, offset, len(value), b''.join(chr(i) for i in value))
TypeError: an integer is required
I think the problem line is Line 172 in bglib.py
It reads:
Your solution works, but I wrote the code under the assumption that the values being written would be byte arrays rather than string literals, and without extra code I don't think there's a simple way to handle both seamlessly. If you change your "value" definition to the following:
value = [ 0x30, 0x31 ]
...then it should work without changes. For efficiency, data sent over BLE is often sent in compact binary form rather than strings, which is why I made that design choice. Does that work?
Your solution works, but I wrote the code under the assumption that the
values being written would be byte arrays rather than string literals, and
without extra code I don't think there's a simple way to handle both
seamlessly. If you change your "value" definition to the following:
value = [ 0x30, 0x31 ]
...then it should work without changes. For efficiency, data sent over BLE
is often sent in compact binary form rather than strings, which is why I
made that design choice. Does that work?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-23518596
.
When I call:
I get the following error:
I think the problem line is Line 172 in bglib.py
It reads:
When I change it to:
I am able to successfully write attributes.
Am I overlooking something?
The text was updated successfully, but these errors were encountered: