Skip to content

Commit

Permalink
Rename to GPSd Forwarder
Browse files Browse the repository at this point in the history
Fix #7
  • Loading branch information
tiagoshibata committed Nov 15, 2019
1 parent a2866dd commit 5d0d02c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Android GPSd Client
# Android GPSd Forwarder

This application forwards NMEA data from your phone's GPS to a specified host. It's goal is to easily plug and feed data into a GPS server service (e.g. GPSd), using your cellphone as a GPS device. This way, your cellphone can be used as a GPS in navigation or robotics applications running in a host computer.

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</intent-filter>
</activity>
<service
android:name=".GpsdClientService"
android:name=".GpsdForwarderService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="location" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.net.InetSocketAddress;
import java.net.SocketException;

public class GpsdClientService extends Service implements LoggingCallback, OnNmeaMessageListenerCompat {
public class GpsdForwarderService extends Service implements LoggingCallback, OnNmeaMessageListenerCompat {
public static final String GPSD_SERVER_ADDRESS = "io.github.tiagoshibata.GPSD_SERVER_ADDRESS";
public static final String GPSD_SERVER_PORT = "io.github.tiagoshibata.GPSD_SERVER_PORT";
private static final String TAG = "GpsdClientService";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class MainActivity extends Activity {
private static final int REQUEST_CODE_FINE_LOCATION = 0;
private static final String SERVER_ADDRESS = "SERVER_ADDRESS";
private static final String SERVER_PORT = "SERVER_PORT";
private Intent gpsdClientServiceIntent;
private Intent gpsdForwarderServiceIntent;
private SharedPreferences preferences;
private TextView textView;
private TextView serverAddressTextView;
Expand All @@ -41,13 +41,13 @@ public class MainActivity extends Activity {

@Override
public void onServiceConnected(ComponentName name, IBinder service) {
GpsdClientService.Binder binder = (GpsdClientService.Binder)service;
GpsdForwarderService.Binder binder = (GpsdForwarderService.Binder)service;
binder.setLoggingCallback(logger);
}

@Override
public void onServiceDisconnected(ComponentName name) {
logger.log("GpsdClientService died");
logger.log("GpsdForwarderService died");
setServiceConnected(false);
startStopButton.setEnabled(true);
}
Expand Down Expand Up @@ -184,9 +184,9 @@ protected void onPostExecute(String address) {
MainActivity activity = activityRef.get();
if (activity == null)
return;
Intent intent = new Intent(activity, GpsdClientService.class);
intent.putExtra(GpsdClientService.GPSD_SERVER_ADDRESS, address)
.putExtra(GpsdClientService.GPSD_SERVER_PORT, port);
Intent intent = new Intent(activity, GpsdForwarderService.class);
intent.putExtra(GpsdForwarderService.GPSD_SERVER_ADDRESS, address)
.putExtra(GpsdForwarderService.GPSD_SERVER_PORT, port);
activity.print("Streaming to " + address + ":" + port);
try {
if (!activity.bindService(intent, activity.serviceConnection, BIND_ABOVE_CLIENT | BIND_IMPORTANT)) {
Expand All @@ -196,7 +196,7 @@ protected void onPostExecute(String address) {
activity.unbindService(activity.serviceConnection);
throw new RuntimeException("Failed to start service");
}
activity.gpsdClientServiceIntent = intent;
activity.gpsdForwarderServiceIntent = intent;
} catch (RuntimeException e) {
activity.setServiceConnected(false);
activity.print(e.getMessage());
Expand All @@ -211,10 +211,10 @@ private void stopGpsdService() {
gpsdServiceTask.cancel(true);
gpsdServiceTask = null;
}
if (gpsdClientServiceIntent != null) {
if (gpsdForwarderServiceIntent != null) {
unbindService(serviceConnection);
stopService(gpsdClientServiceIntent);
gpsdClientServiceIntent = null;
stopService(gpsdForwarderServiceIntent);
gpsdForwarderServiceIntent = null;
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<resources>
<string name="app_name">GPSd Client</string>
<string name="app_name">GPSd Forwarder</string>
<string name="notification_channel_name">GPS streaming notification</string>
<string name="start">Start</string>
<string name="stop">Stop</string>
Expand Down

0 comments on commit 5d0d02c

Please sign in to comment.