Add scrollbars to settings/log tabs and fix android USB discovery for multiple serial devices (when using otg hubs for example)

pull/2/head
Doug McLain 3 years ago
parent e28a626559
commit da5e464249

@ -47,6 +47,7 @@ Item {
logTxt.height logTxt.height
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
clip: true clip: true
ScrollBar.vertical: ScrollBar {}
TextArea { TextArea {
id: logTxt id: logTxt
width: logTextBox.width width: logTextBox.width

@ -71,13 +71,14 @@ Item {
property alias modemNXDNTXLevelEdit: _modemNXDNTXLevelEdit property alias modemNXDNTXLevelEdit: _modemNXDNTXLevelEdit
Flickable { Flickable {
id: flickable
anchors.fill: parent anchors.fill: parent
contentWidth: parent.width contentWidth: parent.width
contentHeight: vocoderButton.y + contentHeight: vocoderButton.y +
vocoderButton.height + 10 vocoderButton.height + 10
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
clip: true clip: true
ScrollBar.vertical: ScrollBar {}
Text { Text {
id: csLabel id: csLabel
x: 10 x: 10

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<manifest package="org.dudetronics.droidstar" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="57" android:installLocation="auto"> <manifest package="org.dudetronics.droidstar" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="60" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/> <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.

@ -36,6 +36,7 @@ public class USBSerialWrapper implements SerialInputOutputManagerTest.Listener {
public int m_parity = 0; public int m_parity = 0;
public int m_flowcontrol = 0; public int m_flowcontrol = 0;
public int m_rts = 0; public int m_rts = 0;
public String m_devicename;
UsbSerialPort m_port; UsbSerialPort m_port;
SerialInputOutputManagerTest usbIoManager; SerialInputOutputManagerTest usbIoManager;
@ -46,6 +47,12 @@ public class USBSerialWrapper implements SerialInputOutputManagerTest.Listener {
counter++; counter++;
} }
public void set_port_name(String d)
{
m_devicename = d;
System.out.println("Java Devicename: " + m_devicename);
}
public void set_baud_rate(int br) public void set_baud_rate(int br)
{ {
m_baudrate = br; m_baudrate = br;
@ -96,7 +103,7 @@ public class USBSerialWrapper implements SerialInputOutputManagerTest.Listener {
System.out.println(availableDrivers.size() + " found"); System.out.println(availableDrivers.size() + " found");
for(int i = 0; i < availableDrivers.size(); ++i){ for(int i = 0; i < availableDrivers.size(); ++i){
devices[i] = availableDrivers.get(i).getDevice().getProductName(); devices[i] = availableDrivers.get(i).getDevice().getProductName() + ":" + availableDrivers.get(i).getDevice().getDeviceName();
System.out.println("USB device getDeviceName() == " + availableDrivers.get(i).getDevice().getDeviceName()); System.out.println("USB device getDeviceName() == " + availableDrivers.get(i).getDevice().getDeviceName());
System.out.println("USB device getProductName() == " + availableDrivers.get(i).getDevice().getProductName()); System.out.println("USB device getProductName() == " + availableDrivers.get(i).getDevice().getProductName());
System.out.println("USB device getProductId() == " + availableDrivers.get(i).getDevice().getProductId()); System.out.println("USB device getProductId() == " + availableDrivers.get(i).getDevice().getProductId());
@ -109,6 +116,7 @@ public class USBSerialWrapper implements SerialInputOutputManagerTest.Listener {
public String setup_serial(Context c) public String setup_serial(Context c)
{ {
m_context = c; m_context = c;
int devicenum = 0;
UsbManager manager = (UsbManager) m_context.getSystemService(Context.USB_SERVICE); UsbManager manager = (UsbManager) m_context.getSystemService(Context.USB_SERVICE);
List<UsbSerialDriver> availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager); List<UsbSerialDriver> availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager);
@ -123,10 +131,17 @@ public class USBSerialWrapper implements SerialInputOutputManagerTest.Listener {
System.out.println("USB device getProductName() == " + availableDrivers.get(i).getDevice().getProductName()); System.out.println("USB device getProductName() == " + availableDrivers.get(i).getDevice().getProductName());
System.out.println("USB device getProductId() == " + availableDrivers.get(i).getDevice().getProductId()); System.out.println("USB device getProductId() == " + availableDrivers.get(i).getDevice().getProductId());
System.out.println("USB device getVendorId() == " + availableDrivers.get(i).getDevice().getVendorId()); System.out.println("USB device getVendorId() == " + availableDrivers.get(i).getDevice().getVendorId());
//if((availableDrivers.get(i).getDevice().getDeviceName()) == m_devicename){
if(m_devicename.equals(availableDrivers.get(i).getDevice().getDeviceName())){
devicenum = i;
System.out.println("Found device == " + devicenum);
}
} }
} }
UsbSerialDriver driver = availableDrivers.get(0); UsbSerialDriver driver = availableDrivers.get(devicenum);
UsbDeviceConnection connection = manager.openDevice(driver.getDevice()); UsbDeviceConnection connection = manager.openDevice(driver.getDevice());
if (connection == null) { if (connection == null) {

@ -80,7 +80,9 @@ int AndroidSerialPort::write(QByteArray data)
void AndroidSerialPort::setPortName(QString s) void AndroidSerialPort::setPortName(QString s)
{ {
qDebug() << "setPortName() == " << s; QAndroidJniObject p = QAndroidJniObject::fromString(s);
jstring j = p.object<jstring>();
serialJavaObject.callMethod<void>("set_port_name", "(Ljava/lang/String;)V", j);
} }
void AndroidSerialPort::setBaudRate(int br) void AndroidSerialPort::setBaudRate(int br)

@ -290,12 +290,12 @@ void DroidStar::process_connect()
QString vocoder = ""; QString vocoder = "";
if( (m_vocoder != "Software vocoder") && (m_vocoder.contains(':')) ){ if( (m_vocoder != "Software vocoder") && (m_vocoder.contains(':')) ){
QStringList vl = m_vocoder.split(':'); QStringList vl = m_vocoder.split(':');
vocoder = vl.at(0); vocoder = vl.at(1);
} }
QString modem = ""; QString modem = "";
if( (m_modem != "None") && (m_modem.contains(':')) ){ if( (m_modem != "None") && (m_modem.contains(':')) ){
QStringList ml = m_modem.split(':'); QStringList ml = m_modem.split(':');
modem = ml.at(0); modem = ml.at(1);
} }
const bool rxInvert = true; const bool rxInvert = true;

@ -74,14 +74,14 @@ QMap<QString, QString> SerialAMBE::discover_devices()
fprintf(stderr, "%s", out.toStdString().c_str());fflush(stderr); fprintf(stderr, "%s", out.toStdString().c_str());fflush(stderr);
if(!serialPortInfo.isBusy()){ if(!serialPortInfo.isBusy()){
//devlist[serialPortInfo.systemLocation()] = serialPortInfo.portName() + " - " + serialPortInfo.manufacturer() + " " + serialPortInfo.description() + " - " + serialPortInfo.serialNumber(); //devlist[serialPortInfo.systemLocation()] = serialPortInfo.portName() + " - " + serialPortInfo.manufacturer() + " " + serialPortInfo.description() + " - " + serialPortInfo.serialNumber();
devlist[serialPortInfo.systemLocation()] = serialPortInfo.systemLocation() + ":" + serialPortInfo.description(); devlist[serialPortInfo.systemLocation()] = serialPortInfo.description() + ":" + serialPortInfo.systemLocation();
} }
} }
} }
#else #else
QStringList list = AndroidSerialPort::GetInstance().discover_devices(); QStringList list = AndroidSerialPort::GetInstance().discover_devices();
for ( const auto& i : list ){ for ( const auto& i : list ){
devlist[i] = i + ":" + i; devlist[i] = i;
} }
#endif #endif
return devlist; return devlist;

Loading…
Cancel
Save