how do I assing "virtual (serial port ) " - (while ) using QSerialPort - ?
-
I am replacing physical cable (RS232 /EIA232) connecting PC (host/server) to a remote device (client) with Bluetooth.
According to many resources – if I use “rfcomm” - as part of the (wireless) solution I need to also have “virtual (serial) port”. I need to keep the RS232 communication configuration , irregardless if rfcomm does not care about it. It needs to pass the data in SAME format as the cable did.My PC has these “devices” - one real USB to serial device and one USB to Bluetooth device.
I am asking the forum - how do I assign – in C /C++ code the USB to serial device as “virtual serial port “?
I am using QT QSerialPort example code application and having trouble identifying the “virtual port” to use in C / C++ code , I do not want to use command to do so.
Any suggestions / code example would be appreciated , very much.
PS
Some documents use term pty ("pseudo-teletype" ) – is that a same as “virtual” port ?
Still need to know how to assassin ...if so.Bus 001 Device 021: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910P
Bus 001 Device 020: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) -
/dev/rfcommXYZ - it is bluetooth serial port
/dev/ttyUSBXYZ (or something like that) - it is virtual serial ports provided by Prolific 2303 chipwhat's a question?
-
Perhaps I do not get term "virtual" when the device is actually implemented in hardware.
What I really need is to be able to code ( not in command - using C /C++ code ) RS232 /EIA 232 communication setup for Bluetooth.
What I have now is Bluetooth ( using bluez library ) "rfcomm" . Rfcomm takes any data . it does not care.
What I am missing is the "front end " the actual setting of RS232 /EIA 232 which requires implementing "serial port" - and that part of the code is missing in Bluetooth examples- the only note I get is " add virtual serial port to the code" .Before I can actually use Bluetooth I have to have RS232 /EIA 232 configured , so if I skip the "virtual" term - my code need to have "serial port " implemented before I can pass the data to the local Bluetooth (hardware) adapter.
I imagine this setup would be similar to passing audio using Bluetooth - there has to be a source / physical form of the audio first...- hence I need "serial port" .
-
FWIW, "virtual comms port" is a windoze serial driver term...It has little meaning to linux designers. At least to me, it complicates what is being asked.
First, please specify which environment you're working in: linux? mac? windoze?
For Linux, the only one I care about, serial device names can be customized thru the use of udev rules: something to research. They can also be aliased using symlinks.
I suspect what you are really asking is about the working of the bluetooth stack, which is less of a Qt question, what I can't effectively answer because I avoid bluetooth in linux...like the plague.
-
FWIW, "virtual comms port" is a windoze serial driver term...It has little meaning to linux designers. At least to me, it complicates what is being asked.
First, please specify which environment you're working in: linux? mac? windoze?
For Linux, the only one I care about, serial device names can be customized thru the use of udev rules: something to research. They can also be aliased using symlinks.
I suspect what you are really asking is about the working of the bluetooth stack, which is less of a Qt question, what I can't effectively answer because I avoid bluetooth in linux...like the plague.
@Kent-Dorfman OK, I do respect your personal feelings / opinions about Bluetooth in Linux. That really does not answer my question - even if is not strictly QT - how do I instruct / code Bluetooth Linux QT QSerialPort to have an option to set the data parsed by Bluetooth using to RS232/EIA I232 configuration / format. .
Here is a snippet of QT documentation I am trying to understand and code:
Exchanging Data Between Devices
The more flexible approach for communication between two Bluetooth enabled devices, is to create a virtual serial port connection and freely exchange data over that connection. This can be done by the Serial Port Profile (SPP). The Serial Port Profile emulates a serial connection over the Bluetooth transport protocol RFCOMM.
To be able to receive incoming SPP connections, you need to listen to incoming connections using QBluetoothServer.
-
@AnneRanch said in how do I assing "virtual (serial port ) " - (while ) using QSerialPort - ?:
to set the data parsed by Bluetooth using to RS232/EIA I232 configuration
Just a WAG, without me doing research, but my sipdey sense tells me that you can't. The RS232 spec way predates bluetooth and is deisnged for pysical twisted pair medium. Bluetooth is designed for RF, so other than both supporting quasi-async comms, they probably lack any other commonality. I've spent a good part of my career trying to convince kids that RTS and DTR signals were good things and that they should learn and use them appropriately. ie, that async uart connections should be more than tx/rx/gnd wires. Good luck!
Oh, another point...there is no such thing as a "connection" in async serial. It's just a stream of characters. Any session framing is handled at a higher level in the protocol stack that async serial has no knowledge of.
-
@AnneRanch said in how do I assing "virtual (serial port ) " - (while ) using QSerialPort - ?:
to set the data parsed by Bluetooth using to RS232/EIA I232 configuration
Just a WAG, without me doing research, but my sipdey sense tells me that you can't. The RS232 spec way predates bluetooth and is deisnged for pysical twisted pair medium. Bluetooth is designed for RF, so other than both supporting quasi-async comms, they probably lack any other commonality. I've spent a good part of my career trying to convince kids that RTS and DTR signals were good things and that they should learn and use them appropriately. ie, that async uart connections should be more than tx/rx/gnd wires. Good luck!
Oh, another point...there is no such thing as a "connection" in async serial. It's just a stream of characters. Any session framing is handled at a higher level in the protocol stack that async serial has no knowledge of.
@Kent-Dorfman Well. this just goes against all the life experiences - including Bluetooth - it (opinions ?) plainly states that "rfcomm" does not care what format / data type is being passed. It also states that it "replaces the hardware / cable connection" hence I should be able to select the hardware emulation configuration SOMEWHERE . I am actually looking into "serial to Bluetooth (adapter ) " connection FIRST. Then Bluetooth to Bluetooth connection next .
So far the examples only cover Bluetooth to Bluetooth connection - if I need to communicate between PC and a remote device using 110 baud 6 bits start 2 bits stop format - where / how do I configure it ?I do not believe Bluetooth is only capable to "connect my PC to Android to pass my e-mail " ....
-
If you want to use the
/dev/rfcomm
device on PC, just use it trought QSerialPort. You can configure the desired baud rate, data byte, start/stop bits and etc as in usual cable serial connection. The RFCOMM just emulates that settings, but I'm not sure that the configured baud rate will be a "true", because it is over bluetooth that's RF.Before, you need to do the bluetooth pairing between the PC and the remote BT device (e.g. on Android with the started SPP server application). After the pairing finished, on PC will be created the
/dev/rfcomm
device, and then you can just use it with QSerialPort. On other side (e.g. on a remote Android device) the special SPP server application should be started to receive the rfcomm traffic.So, what's your question is?
-
If you want to use the
/dev/rfcomm
device on PC, just use it trought QSerialPort. You can configure the desired baud rate, data byte, start/stop bits and etc as in usual cable serial connection. The RFCOMM just emulates that settings, but I'm not sure that the configured baud rate will be a "true", because it is over bluetooth that's RF.Before, you need to do the bluetooth pairing between the PC and the remote BT device (e.g. on Android with the started SPP server application). After the pairing finished, on PC will be created the
/dev/rfcomm
device, and then you can just use it with QSerialPort. On other side (e.g. on a remote Android device) the special SPP server application should be started to receive the rfcomm traffic.So, what's your question is?
@kuzulis The question was stated - hence ? at the end of the sentence - in the post title.
Here is the answer
https://unix.stackexchange.com/questions/128531/rfcomm-device-seems-to-be-missing-dev-rfcomm0
CLOSED