LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine disconnected serial via virtual com port?

When using a bluetooth connection one of the services is a virtual com port.

I am using this virtual com port via the visa drivers to write and read commands and responses to a bluetooth device.

 

 

What is the best way to determine the bluetooth connection has been lost.  The is port connected is a National instruments proprietary instrument.  So that is not an option, I'm looking for others that will yield a fast and fool proof method of detection.

 

 

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 Kudos
Message 1 of 5
(3,153 Views)

Hi eximo!

By default visa communication does not have built in handshaking which would be the easiest way to determine when a connection is lost or disconnected.  For an intentional disconnect, the easiest way to notify bluetooth receiver would be to send a signal which required an acknowledgement before disconnecting.  With that said, that won't work for an unprompted disconnect--going out of range, low power, etc.

 

One thing you could do is develop a heartbeat type of communication--every so often send a specific bit of data that causes the device to respond that can be recognized so the host knows the device is still connected.  A single transmission of a specific integer or a boolean or any other predetermined bit of data can be used as the "heartbeat."  You can send this heartbeat every second, or every minute... whatever you would like, and that checks if the connection is still open.

 

Unfortunately you will have to build up something that basically does what TCP/IP has built into it in handshaking.  Let us know if you have any questions about that.

 

 

0 Kudos
Message 2 of 5
(3,133 Views)

I have not check if the property node work for virtual COM port (works with real COM Port), could try the same. (Attached SerialPort.png)

0 Kudos
Message 3 of 5
(3,114 Views)

only works with National instrument devices

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 Kudos
Message 4 of 5
(3,096 Views)

I'm thinking that when the connectionis lost, some place in the computer there is recognition that the connection is lost.  Some DLL or line assertion etc.  I just don't know enough about that part of the hardware to look it up.

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 Kudos
Message 5 of 5
(3,095 Views)