mainnav-reader + BT + Mainnav MG-950dl

61 views
Skip to first unread message

qbak

unread,
Oct 7, 2010, 3:30:38 AM10/7/10
to mainnav-reader
Hi, all.
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).
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

Value one seemed to work at all times but others could verify that.
THX

Dennis Keitzel

unread,
Oct 13, 2010, 1:09:18 PM10/13/10
to mainnav...@googlegroups.com
On 10/07/2010 09:30 AM, qbak wrote:
> Hi, all.

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

signature.asc

Leo Goo

unread,
May 19, 2015, 11:20:02 AM5/19/15
to mainnav...@googlegroups.com
Hello Dennis

So many years and no one agree...
I agree, wait-line really helpful for bluetooth connection.

Best wishes, Leonid


13 oct 2010 г., 20:09:18 UTC+3 Dennis Keitzel:
Reply all
Reply to author
Forward
0 new messages