Thanks for your response.
No doubt it is something I am doing wrong.
Yes, the device is software, so no flow control.
Here is the code and the debug output:
PreferencesDialog
::PreferencesDialog(QWidget *parent
) : m_ui(new Ui::PreferencesDialog)
{
m_ui->setupUi(this);
//01202010 - Set up CAT preference values
AbstractSerial *MyDevice = new AbstractSerial();
// Getting Available Ports
list.sort();
int len = list.size();
for (int i = 0; i < len; i ++) {
m_ui->cbPort->addItem(list[i]);
qDebug() << "Port is " << list[i]; // see debug output below
}
MyDevice->close();
delete MyDevice;
// debug output
Port is "COM1"
Port is "COM2"
Port is "COM3"
Windows: NativeSerialEnginePrivate::nativeClose
-> hd == INVALID_HANDLE_VALUE. Error!
//
// Get tx vfo
cmd = "FT;";
len = 8;
ba = cmd.toAscii();
///
AbstractSerial *MyDevice = new AbstractSerial();
MyDevice->setDeviceName(port);
qDebug() << "serial device status is " << MyDevice->deviceName();
qDebug() << "Writing the command";
MyDevice->write(ba); // see debug output below
qDebug() << "Command written";
//printDataToHex(ba);
ba.clear();
}
// debug output
Windows: NativeSerialEnginePrivate::nativeOpen
-> Trying to open device: "COM3"
Windows: NativeSerialEnginePrivate::nativeOpen
-> Opened device: "COM3" succesfully. Ok!
serial device status is "COM3"
Writing the command
// no response now
PreferencesDialog::PreferencesDialog(QWidget *parent) :
QDialog(parent),
m_ui(new Ui::PreferencesDialog)
{
m_ui->setupUi(this);
//01202010 - Set up CAT preference values
AbstractSerial *MyDevice = new AbstractSerial();
// Getting Available Ports
QStringList list = MyDevice->serialDevicesAvailable();
list.sort();
int len = list.size();
for (int i = 0; i < len; i ++) {
m_ui->cbPort->addItem(list[i]);
qDebug() << "Port is " << list[i]; // see debug output below
}
MyDevice->close();
delete MyDevice;
// debug output
Port is "COM1"
Port is "COM2"
Port is "COM3"
Windows: NativeSerialEnginePrivate::nativeClose
-> hd == INVALID_HANDLE_VALUE. Error!
//
// Get tx vfo
cmd = "FT;";
len = 8;
ba = cmd.toAscii();
QByteArray ra = readWrite(port, len, ba);
///
QByteArray SerialComm::readWrite(QString port, int len, QByteArray ba) {
AbstractSerial *MyDevice = new AbstractSerial();
MyDevice->setDeviceName(port);
if (MyDevice->open(QIODevice::ReadWrite | QIODevice::Unbuffered)) {
qDebug() << "serial device status is " << MyDevice->deviceName();
qDebug() << "Writing the command";
MyDevice->write(ba); // see debug output below
qDebug() << "Command written";
//printDataToHex(ba);
ba.clear();
}
// debug output
Windows: NativeSerialEnginePrivate::nativeOpen
-> Trying to open device: "COM3"
Windows: NativeSerialEnginePrivate::nativeOpen
-> Opened device: "COM3" succesfully. Ok!
serial device status is "COM3"
Writing the command
// no response now
To copy to clipboard, switch view to plain text mode
Doesn't make any difference if I try to timeout the write(ba) command - it just never returns.
Bookmarks