Skip to content

Commit

Permalink
added USB out autopilot
Browse files Browse the repository at this point in the history
  • Loading branch information
apps4av committed Feb 25, 2023
1 parent cb8f7ec commit caeff18
Show file tree
Hide file tree
Showing 8 changed files with 453 additions and 42 deletions.
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Redistribution and use in source and binary forms, with or without modification,
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ds.avare"
android:versionCode="377"
android:versionName="10.2.7"
android:versionCode="378"
android:versionName="10.2.8"
android:installLocation="auto">

<!-- Network State Permissions to detect Internet status -->
Expand All @@ -22,6 +22,7 @@ Redistribution and use in source and binary forms, with or without modification,
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET" />

<!-- Request legacy Bluetooth permissions on older devices. -->
Expand Down
51 changes: 13 additions & 38 deletions app/src/main/assets/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,25 @@ <h3 class="western" align="center">Notice</h3>
<p><B>CAUTION</b> - Before flight the user <B>must always ensure</b> that Avare is updated to and thoroughly tested on the latest version, and <b>ensure that all Avare databases and charts are kept current</b>. If Avare and its databases and charts are not of the exact same version, the <B><U>GPS position displayed may be inaccurate</u></b>, because <b>the FAA sometimes changes the format</b> of their materials. <u>Avare does not automatically fetch</u> any databases and charts when they are expired, so it is the user's sole responsibility to update any expired charts and databases. To do so, ensure that your device has an internet connection and then just press the <B>Map, Menu, Preferences, Download,</b> and <b>Update</b> buttons in Avare.</p>

<h3 class="western">Avare Releases</h3>
<p><b>10.2.8</b></p>
<ul>
<li><p>Added auto pilot control over USB serial</li>
</p>
</ul>

<p><b>10.2.7</b></p>
<ul>
<li>Fix plate tagging</li>
<li><p>Fix plate tagging</li>
</p>
</ul>
<p><b>10.2.6</b></p>
<ul>
<li>Improved help file</li>
<li><p>Improved help file</li>
</p>
</ul>
<p><b>10.2.5</b></p>
<ul>
<li>Improved audible traffic alerts for traffic</li>
<li><p>Improved audible traffic alerts for traffic</li>
</p>
</ul>
<p><b>10.2.4</b></p>
Expand All @@ -92,9 +98,9 @@ <h3 class="western">Avare Releases</h3>
</ul>
<p><b>10.2.1</b></p>
<ul>
<li><p style="margin-bottom: 0in">Improved ADS-B traffic display
<li><p>Improved ADS-B traffic display
</p>
<li><p style="margin-bottom: 0in">Added audible traffic alerts for
<li><p>Added audible traffic alerts for
traffic
</p>
<li><p>Improved weather display color
Expand All @@ -112,10 +118,10 @@ <h3 class="western">Avare Releases</h3>
</ul>
<p><b>10.1.8</b></p>
<ul>
<li><p style="margin-bottom: 0in">Bluetooth and USB connection
<li><p>Bluetooth and USB connection
improvements
</p>
<li><p style="margin-bottom: 0in">Changed UI for long-press in Find
<li><p>Changed UI for long-press in Find
and Search tabs
</p>
<li><p>Improvements in drawing
Expand All @@ -126,37 +132,6 @@ <h3 class="western">Avare Releases</h3>
<li><p>Stop bug fix
</p>
</ul>
<p><b>10.1.6</b></p>
<ul>
<li><p style="margin-bottom: 0in">Increase in max zoom
</p>
<li><p style="margin-bottom: 0in">Stop bug fix
</p>
<li><p>Preferences can be exported / imported / deleted
</p>
</ul>
<p><b>10.1.5</b></p>
<ul>
<li><p style="margin-bottom: 0in">New improved mapping engine.
</p>
<li><p style="margin-bottom: 0in">Added ability to delete imported
waypoints.
</p>
<li><p style="margin-bottom: 0in">Added elevation profile to
imported waypoints.
</p>
<li><p style="margin-bottom: 0in">Fixed destination in IO/GPS
simulation destination.
</p>
<li><p>Added auto connect to external Bluetooth, WiFi, USB, and
autopilots on start.
</p>
</ul>
<p><b>10.1.4</b></p>
<ul>
<li><p>Bug fix
</p>
</ul>
<h3 class="western">Help Categories</h3>
<p>Below is a list of your choices for Help with Avare (pronounced "Ah-vAir" - like "aware" with a "v"). Nearly all are available <b>Offline</b> (without internet access on your device), such as when you are flying or your device is in Airplane Mode.<br/>

Expand Down
10 changes: 8 additions & 2 deletions app/src/main/java/com/ds/avare/IOActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class IOActivity extends BaseActivity {
private Location mCurrentLocation;
private GpsStatus mCurrentGpsStatus;

private Fragment[] mFragments = new Fragment[10];
private Fragment[] mFragments = new Fragment[11];

private WifiManager.MulticastLock mMulticastLock;

Expand Down Expand Up @@ -122,6 +122,7 @@ public void onCreate(Bundle savedInstanceState) {
mFragments[pos++] = new FileFragment();
mFragments[pos++] = new GPSSimulatorFragment();
mFragments[pos++] = new USBInFragment();
mFragments[pos++] = new USBOutFragment();
mFragments[pos++] = new Dump1090Fragment();
mFragments[pos++] = new ToolsFragment();

Expand Down Expand Up @@ -154,6 +155,7 @@ public void onNothingSelected(AdapterView<?> parent) {
getString(R.string.Play),
getString(R.string.GPSSIM),
getString(R.string.USBIN),
getString(R.string.APUSB),
"Dump1090",
getString(R.string.Tools)
});
Expand Down Expand Up @@ -225,10 +227,14 @@ private void changeFragment(int id) {
fragmentTransaction.replace(R.id.detailFragment, usbin);
break;
case 8:
USBOutFragment usbout = (USBOutFragment) mFragments[id];
fragmentTransaction.replace(R.id.detailFragment, usbout);
break;
case 9:
Dump1090Fragment d1090 = (Dump1090Fragment) mFragments[id];
fragmentTransaction.replace(R.id.detailFragment, d1090);
break;
case 9:
case 10:
ToolsFragment tools = (ToolsFragment) mFragments[id];
fragmentTransaction.replace(R.id.detailFragment, tools);
break;
Expand Down
105 changes: 105 additions & 0 deletions app/src/main/java/com/ds/avare/USBOutFragment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
Copyright (c) 2012, Apps4Av Inc. (ds.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.ds.avare;


import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;

import com.ds.avare.connections.Connection;
import com.ds.avare.connections.ConnectionFactory;
import com.ds.avare.storage.Preferences;
import com.ds.avare.storage.SavedEditText;

import java.io.File;

/**
*
* @author zkhan
*
*/
public class USBOutFragment extends Fragment {

private Connection mUSB;
private Context mContext;
private Button mConnectButton;
private SavedEditText mParamsText;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

mContext = container.getContext();

View view = inflater.inflate(R.layout.layout_usbout, container, false);

mParamsText = (SavedEditText) view.findViewById(R.id.usbout_params_text);

mUSB = ConnectionFactory.getConnection(ConnectionFactory.CF_USBConnectionOut, mContext);

mConnectButton = (Button) view.findViewById(R.id.usbout_button_connect);
mConnectButton.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
/*
* If connected, disconnect
*/
if (mUSB.isConnected()) {
mUSB.stop();
mUSB.disconnect();
setStates();
return;
}
/*
* Connect to the given device in list
*/
if (!mUSB.isConnected()) {
mConnectButton.setText(getString(R.string.Connect));
mUSB.connect(mParamsText.getText().toString(), false);
Preferences pref = StorageService.getInstance().getPreferences();
if (mUSB.isConnected()) {
mUSB.start();
pref.setLastConnectedUSB(mParamsText.getText().toString()); // save where we connected
} else {
pref.setLastConnectedUSB(null); // clear
}
setStates();
}
}
});
return view;
}

/**
*
*/
private void setStates() {
if (mUSB.isConnected()) {
mConnectButton.setText(getString(R.string.Disconnect));
} else {
mConnectButton.setText(getString(R.string.Connect));
}
}

@Override
public void onDestroyView() {
super.onDestroyView();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class ConnectionFactory {
public static final String CF_USBConnectionIn = "USBConnectionIn";
public static final String CF_XplaneConnection = "XplaneConnection";
public static final String CF_Dump1090Connection = "Dump1090Connection";
public static final String CF_USBConnectionOut = "USBConnectionOut";

public static Connection getConnection(String type, Context ctx) {
if(type.equals(CF_BlueToothConnectionIn)) {
Expand Down Expand Up @@ -59,6 +60,9 @@ public static Connection getConnection(String type, Context ctx) {
if(type.equals(CF_Dump1090Connection)) {
return Dump1090Connection.getInstance(ctx);
}
if(type.equals(CF_USBConnectionOut)) {
return USBConnectionOut.getInstance(ctx);
}
return null;
}

Expand All @@ -76,6 +80,7 @@ public static String getActiveConnections(Context ctx) {
s += getConnection(CF_FileConnectionIn, ctx).isConnected() ? "," + ctx.getString(R.string.Play) : "";
s += getConnection(CF_GPSSimulatorConnection, ctx).isConnected() ? "," + ctx.getString(R.string.GPSSIM) : "";
s += getConnection(CF_USBConnectionIn, ctx).isConnected() ? "," + ctx.getString(R.string.USBIN) : "";
s += getConnection(CF_USBConnectionOut, ctx).isConnected() ? "," + ctx.getString(R.string.APUSB) : "";
s += getConnection(CF_Dump1090Connection, ctx).isConnected() ? "," + ctx.getString(R.string.DUMP1090) : "";
if(s.startsWith(",")) {
s = s.substring(1);
Expand Down
Loading

0 comments on commit caeff18

Please sign in to comment.