Edit The serial port is a bluetooth serial port, it is talking to a bluetooth radio which in turn talks to a microcontroller. As it takes up to 4 seconds to open a serial port, the best solution would be to use a direct HID connection to the bluetooth radio instead of a SPP serial connection, however it appears that nobody has ever connected realbasic to a bluetooth HID device before and so there's no info or help on it. It's highly possible that the serial device disconnected from an opened port, and of course this is going to cause problems. Download Microsoft Office 2013 For Mac ![]()
![]()
![]()
Also, calling serial close() on a serial port on OSX causes a momentary freeze (desktop cursor freezes), I suspect 100% cpu usage, this does not happen on windows and I therefore want to minimize the number of port opens and closes that I have to do as I am polling data from around 10 bluetooth devices once a minute.. I can of course close the port and try and open it again, but instead I would like to detect whether the device is still connected to the bluetooth serial port.. So is it possible to detect whether a port is open and alive so that I can leave the port open and only close and re-open it when I detect that the connected device has gone away.. My initial idea was to open the port, read the data and then close it again, The problem is, that opening a serial port can take up to 4 seconds and I may need to read from up to 8 ports, so opening and closing the port is not practical for each cycle.. Your request is kind of odd because typically what you do is connect to the serial port and then wait to receive any data sent to that port.. About the bad performance: That's usually due to RB's limited control over its event management: It doesn't see that it needs to poll the serial port more often, and thus only checks on it rarely as long as it has no other reasons to ask for more idle time from the OS.. The Serial class has a 'LineStateChanged' event Have you checked if that gets invoked once the BT conn is lost or reconnected? If that doesn't work, you could try using the low level BSD/POSIX functions to open the port and use ioctl() calls to figure out its state.. The trick is to run a Timer with a high frequency (e g Once every 10ms), and then invoke the serial port's Poll function from the Timer's Action event.. You're either listening or your not You have to connect to the port and listen for data. 773a7aa168
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |