Commit b195b6c6 authored by Gus Grubba's avatar Gus Grubba

Fixed android package hierarchy to match package name.

Renamed main activity class with a more appropriate name.
parent f0c7608d
...@@ -14,8 +14,8 @@ OTHER_FILES += \ ...@@ -14,8 +14,8 @@ OTHER_FILES += \
$$PWD/android/src/com/hoho/android/usbserial/driver/UsbSerialDriver.java \ $$PWD/android/src/com/hoho/android/usbserial/driver/UsbSerialDriver.java \
$$PWD/android/src/com/hoho/android/usbserial/driver/UsbSerialProber.java \ $$PWD/android/src/com/hoho/android/usbserial/driver/UsbSerialProber.java \
$$PWD/android/src/com/hoho/android/usbserial/driver/UsbSerialRuntimeException.java \ $$PWD/android/src/com/hoho/android/usbserial/driver/UsbSerialRuntimeException.java \
$$PWD/android/src/org/qgroundcontrol/qgchelper/UsbDeviceJNI.java \ $$PWD/android/src/org/mavlink/qgroundcontrol/QGCActivity.java \
$$PWD/android/src/org/qgroundcontrol/qgchelper/UsbIoManager.java $$PWD/android/src/org/mavlink/qgroundcontrol/UsbIoManager.java
DISTFILES += \ DISTFILES += \
$$PWD/android/gradle/wrapper/gradle-wrapper.jar \ $$PWD/android/gradle/wrapper/gradle-wrapper.jar \
......
<?xml version="1.0"?> <?xml version="1.0"?>
<manifest package="org.mavlink.qgroundcontrol" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="3.0.0-243-gd759437" android:versionCode="300243" android:installLocation="auto"> <manifest package="org.mavlink.qgroundcontrol" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="3.0.0-243-gd759437" android:versionCode="300243" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:icon="@drawable/icon"> <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qgroundcontrol.qgchelper.UsbDeviceJNI" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:keepScreenOn="true"> <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.mavlink.qgroundcontrol.QGCActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:keepScreenOn="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
......
...@@ -39,7 +39,7 @@ import java.nio.ByteBuffer; ...@@ -39,7 +39,7 @@ import java.nio.ByteBuffer;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import org.qgroundcontrol.qgchelper.UsbDeviceJNI; import org.mavlink.qgroundcontrol.QGCActivity;
/** /**
* A {@link CommonUsbSerialDriver} implementation for a variety of FTDI devices * A {@link CommonUsbSerialDriver} implementation for a variety of FTDI devices
...@@ -231,35 +231,35 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver { ...@@ -231,35 +231,35 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver {
public void open() throws IOException { public void open() throws IOException {
D2xxManager ftD2xx = null; D2xxManager ftD2xx = null;
try { try {
ftD2xx = D2xxManager.getInstance(UsbDeviceJNI.m_context); ftD2xx = D2xxManager.getInstance(QGCActivity.m_context);
} catch (D2xxManager.D2xxException ex) { } catch (D2xxManager.D2xxException ex) {
UsbDeviceJNI.qgcLogDebug("D2xxManager.getInstance threw exception: " + ex.getMessage()); QGCActivity.qgcLogDebug("D2xxManager.getInstance threw exception: " + ex.getMessage());
} }
if (ftD2xx == null) { if (ftD2xx == null) {
String errMsg = "Unable to retrieve D2xxManager instance."; String errMsg = "Unable to retrieve D2xxManager instance.";
UsbDeviceJNI.qgcLogWarning(errMsg); QGCActivity.qgcLogWarning(errMsg);
throw new IOException(errMsg); throw new IOException(errMsg);
} }
UsbDeviceJNI.qgcLogDebug("Opened D2xxManager"); QGCActivity.qgcLogDebug("Opened D2xxManager");
int DevCount = ftD2xx.createDeviceInfoList(UsbDeviceJNI.m_context); int DevCount = ftD2xx.createDeviceInfoList(QGCActivity.m_context);
UsbDeviceJNI.qgcLogDebug("Found " + DevCount + " ftdi devices."); QGCActivity.qgcLogDebug("Found " + DevCount + " ftdi devices.");
if (DevCount < 1) { if (DevCount < 1) {
throw new IOException("No FTDI Devices found"); throw new IOException("No FTDI Devices found");
} }
m_ftDev = null; m_ftDev = null;
try { try {
m_ftDev = ftD2xx.openByIndex(UsbDeviceJNI.m_context, 0); m_ftDev = ftD2xx.openByIndex(QGCActivity.m_context, 0);
} catch (NullPointerException e) { } catch (NullPointerException e) {
UsbDeviceJNI.qgcLogDebug("ftD2xx.openByIndex exception: " + e.getMessage()); QGCActivity.qgcLogDebug("ftD2xx.openByIndex exception: " + e.getMessage());
} finally { } finally {
if (m_ftDev == null) { if (m_ftDev == null) {
throw new IOException("No FTDI Devices found"); throw new IOException("No FTDI Devices found");
} }
} }
UsbDeviceJNI.qgcLogDebug("Opened FTDI device."); QGCActivity.qgcLogDebug("Opened FTDI device.");
} }
@Override @Override
...@@ -268,7 +268,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver { ...@@ -268,7 +268,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver {
try { try {
m_ftDev.close(); m_ftDev.close();
} catch (Exception e) { } catch (Exception e) {
UsbDeviceJNI.qgcLogWarning("close exception: " + e.getMessage()); QGCActivity.qgcLogWarning("close exception: " + e.getMessage());
} }
m_ftDev = null; m_ftDev = null;
} }
...@@ -285,7 +285,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver { ...@@ -285,7 +285,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver {
totalBytesRead = m_ftDev.read(dest, bytesAvailable, timeoutMillis); totalBytesRead = m_ftDev.read(dest, bytesAvailable, timeoutMillis);
} catch (NullPointerException e) { } catch (NullPointerException e) {
final String errorMsg = "Error reading: " + e.getMessage(); final String errorMsg = "Error reading: " + e.getMessage();
UsbDeviceJNI.qgcLogWarning(errorMsg); QGCActivity.qgcLogWarning(errorMsg);
throw new IOException(errorMsg, e); throw new IOException(errorMsg, e);
} }
} }
...@@ -299,7 +299,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver { ...@@ -299,7 +299,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver {
m_ftDev.write(src); m_ftDev.write(src);
return src.length; return src.length;
} catch (Exception e) { } catch (Exception e) {
UsbDeviceJNI.qgcLogWarning("Error writing: " + e.getMessage()); QGCActivity.qgcLogWarning("Error writing: " + e.getMessage());
} }
return 0; return 0;
} }
...@@ -309,7 +309,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver { ...@@ -309,7 +309,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver {
m_ftDev.setBaudRate(baudRate); m_ftDev.setBaudRate(baudRate);
return baudRate; return baudRate;
} catch (Exception e) { } catch (Exception e) {
UsbDeviceJNI.qgcLogWarning("Error setting baud rate: " + e.getMessage()); QGCActivity.qgcLogWarning("Error setting baud rate: " + e.getMessage());
} }
return 0; return 0;
} }
...@@ -360,7 +360,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver { ...@@ -360,7 +360,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver {
try { try {
m_ftDev.setDataCharacteristics((byte)dataBits, (byte)stopBits, (byte)parity); m_ftDev.setDataCharacteristics((byte)dataBits, (byte)stopBits, (byte)parity);
} catch (Exception e) { } catch (Exception e) {
UsbDeviceJNI.qgcLogWarning("Error setDataCharacteristics: " + e.getMessage()); QGCActivity.qgcLogWarning("Error setDataCharacteristics: " + e.getMessage());
} }
} }
@Override @Override
...@@ -408,7 +408,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver { ...@@ -408,7 +408,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver {
m_ftDev.purge(D2xxManager.FT_PURGE_RX); m_ftDev.purge(D2xxManager.FT_PURGE_RX);
} catch (Exception e) { } catch (Exception e) {
String errMsg = "Error purgeHwBuffers(RX): "+ e.getMessage(); String errMsg = "Error purgeHwBuffers(RX): "+ e.getMessage();
UsbDeviceJNI.qgcLogWarning(errMsg); QGCActivity.qgcLogWarning(errMsg);
throw new IOException(errMsg); throw new IOException(errMsg);
} }
} }
...@@ -418,7 +418,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver { ...@@ -418,7 +418,7 @@ public class FtdiSerialDriver extends CommonUsbSerialDriver {
m_ftDev.purge(D2xxManager.FT_PURGE_TX); m_ftDev.purge(D2xxManager.FT_PURGE_TX);
} catch (Exception e) { } catch (Exception e) {
String errMsg = "Error purgeHwBuffers(TX): " + e.getMessage(); String errMsg = "Error purgeHwBuffers(TX): " + e.getMessage();
UsbDeviceJNI.qgcLogWarning(errMsg); QGCActivity.qgcLogWarning(errMsg);
throw new IOException(errMsg); throw new IOException(errMsg);
} }
} }
......
package org.qgroundcontrol.qgchelper; package org.mavlink.qgroundcontrol;
/* Copyright 2013 Google Inc. /* Copyright 2013 Google Inc.
* *
...@@ -23,7 +23,7 @@ package org.qgroundcontrol.qgchelper; ...@@ -23,7 +23,7 @@ package org.qgroundcontrol.qgchelper;
// Written by: Mike Goza April 2014 // Written by: Mike Goza April 2014
// //
// These routines interface with the Android USB Host devices for serial port communication. // These routines interface with the Android USB Host devices for serial port communication.
// The code uses the usb-serial-for-android software library. The UsbDeviceJNI class is the // The code uses the usb-serial-for-android software library. The QGCActivity class is the
// interface to the C++ routines through jni calls. Do not change the functions without also // interface to the C++ routines through jni calls. Do not change the functions without also
// changing the corresponding calls in the C++ routines or you will break the interface. // changing the corresponding calls in the C++ routines or you will break the interface.
// //
...@@ -52,10 +52,10 @@ import com.hoho.android.usbserial.driver.*; ...@@ -52,10 +52,10 @@ import com.hoho.android.usbserial.driver.*;
import org.qtproject.qt5.android.bindings.QtActivity; import org.qtproject.qt5.android.bindings.QtActivity;
import org.qtproject.qt5.android.bindings.QtApplication; import org.qtproject.qt5.android.bindings.QtApplication;
public class UsbDeviceJNI extends QtActivity implements TextToSpeech.OnInitListener public class QGCActivity extends QtActivity implements TextToSpeech.OnInitListener
{ {
public static int BAD_PORT = 0; public static int BAD_PORT = 0;
private static UsbDeviceJNI m_instance; private static QGCActivity m_instance;
private static UsbManager m_manager; // ANDROID USB HOST CLASS private static UsbManager m_manager; // ANDROID USB HOST CLASS
private static List<UsbSerialDriver> m_devices; // LIST OF CURRENT DEVICES private static List<UsbSerialDriver> m_devices; // LIST OF CURRENT DEVICES
private static HashMap<Integer, UsbSerialDriver> m_openedDevices; // LIST OF OPENED DEVICES private static HashMap<Integer, UsbSerialDriver> m_openedDevices; // LIST OF OPENED DEVICES
...@@ -64,7 +64,7 @@ public class UsbDeviceJNI extends QtActivity implements TextToSpeech.OnInitListe ...@@ -64,7 +64,7 @@ public class UsbDeviceJNI extends QtActivity implements TextToSpeech.OnInitListe
// USED TO DETECT WHEN A DEVICE HAS BEEN UNPLUGGED // USED TO DETECT WHEN A DEVICE HAS BEEN UNPLUGGED
private BroadcastReceiver m_UsbReceiver = null; private BroadcastReceiver m_UsbReceiver = null;
private final static ExecutorService m_Executor = Executors.newSingleThreadExecutor(); private final static ExecutorService m_Executor = Executors.newSingleThreadExecutor();
private static final String TAG = "QGC_UsbDeviceJNI"; private static final String TAG = "QGC_QGCActivity";
private static TextToSpeech m_tts; private static TextToSpeech m_tts;
private static PowerManager.WakeLock m_wl; private static PowerManager.WakeLock m_wl;
...@@ -101,7 +101,7 @@ public class UsbDeviceJNI extends QtActivity implements TextToSpeech.OnInitListe ...@@ -101,7 +101,7 @@ public class UsbDeviceJNI extends QtActivity implements TextToSpeech.OnInitListe
// Constructor. Only used once to create the initial instance for the static functions. // Constructor. Only used once to create the initial instance for the static functions.
// //
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
public UsbDeviceJNI() public QGCActivity()
{ {
m_instance = this; m_instance = this;
m_openedDevices = new HashMap<Integer, UsbSerialDriver>(); m_openedDevices = new HashMap<Integer, UsbSerialDriver>();
...@@ -193,7 +193,7 @@ public class UsbDeviceJNI extends QtActivity implements TextToSpeech.OnInitListe ...@@ -193,7 +193,7 @@ public class UsbDeviceJNI extends QtActivity implements TextToSpeech.OnInitListe
// GET THE LIST OF CURRENT DEVICES // GET THE LIST OF CURRENT DEVICES
if (!getCurrentDevices()) if (!getCurrentDevices())
{ {
Log.e(TAG, "UsbDeviceJNI instance not present"); Log.e(TAG, "QGCActivity instance not present");
return null; return null;
} }
......
package org.qgroundcontrol.qgchelper; package org.mavlink.qgroundcontrol;
/* Copyright 2011 Google Inc. /* Copyright 2011 Google Inc.
* *
......
...@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE ...@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
#define BAD_PORT 0 #define BAD_PORT 0
static const char kJniClassName[] {"org/qgroundcontrol/qgchelper/UsbDeviceJNI"}; static const char kJniClassName[] {"org/mavlink/qgroundcontrol/QGCActivity"};
static const char kJTag[] {"QGC_QSerialPort"}; static const char kJTag[] {"QGC_QSerialPort"};
static void jniDeviceHasDisconnected(JNIEnv *envA, jobject thizA, jint userDataA) static void jniDeviceHasDisconnected(JNIEnv *envA, jobject thizA, jint userDataA)
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include <android/log.h> #include <android/log.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static const char V_jniClassName[] {"org/qgroundcontrol/qgchelper/UsbDeviceJNI"}; static const char V_jniClassName[] {"org/mavlink/qgroundcontrol/QGCActivity"};
static const char V_TAG[] {"QGC_QSerialPortInfo"}; static const char V_TAG[] {"QGC_QSerialPortInfo"};
extern void cleanJavaException(); extern void cleanJavaException();
......
...@@ -61,7 +61,7 @@ bool GAudioOutput::say(const QString& inText) ...@@ -61,7 +61,7 @@ bool GAudioOutput::say(const QString& inText)
if (!muted && !qgcApp()->runningUnitTests()) { if (!muted && !qgcApp()->runningUnitTests()) {
#if defined __android__ #if defined __android__
#if defined QGC_SPEECH_ENABLED #if defined QGC_SPEECH_ENABLED
static const char V_jniClassName[] {"org/qgroundcontrol/qgchelper/UsbDeviceJNI"}; static const char V_jniClassName[] {"org/mavlink/qgroundcontrol/QGCActivity"};
QAndroidJniEnvironment env; QAndroidJniEnvironment env;
if (env->ExceptionCheck()) { if (env->ExceptionCheck()) {
env->ExceptionDescribe(); env->ExceptionDescribe();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <QtAndroidExtras/QtAndroidExtras> #include <QtAndroidExtras/QtAndroidExtras>
#include <QtAndroidExtras/QAndroidJniObject> #include <QtAndroidExtras/QAndroidJniObject>
static const char* kJniClassName = "org/qgroundcontrol/qgchelper/UsbDeviceJNI"; static const char* kJniClassName = "org/mavlink/qgroundcontrol/QGCActivity";
void MobileScreenMgr::setKeepScreenOn(bool keepScreenOn) void MobileScreenMgr::setKeepScreenOn(bool keepScreenOn)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment