Hello Jakub.
> I found this project by accident! It is OK. I have written similar
> application for Windows but tried this one as well. It works with
> Windows using Python 2.7 and 2.7 with pySerial 2.4 (pySerial 2.5 gives
> Access Denied to COM ports - do not know why yet).
Nice to know, that it works on Windows, too.
> Anyway, it works but using Bluetooth gives the lag opening the COM
> port and resulting in communication error: "is the device turned on?".
> So I propose to add one line delaying the answer:
>
> def open_connection(self):
> '''Open the connection to the device.'''
> verbose('opening \'%s\'.. ' % self.ser.port, newline=False)
> self.ser.open()
> success = self.ser.isOpen()
> verbose('ok' if success else 'error')
> time.sleep(1)
> return success
I'm unsure why this works, because you didn't sleep while waiting on an
answer. I assume it would make more sense to add the wait-line between
open() and isOpen().
After opening the connection the device status is being checked. Maybe
this happens to fast after the opening process.
Either way, I will add the wait statement between open() and isOpen(),
if you can verify that this works for you.
Cheers,
Dennis
Best wishes, Leonid