mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
Added location feature and made fake stream create movement
This commit is contained in:
parent
c8c7323ab7
commit
2139954e49
@ -4,10 +4,14 @@
|
|||||||
android:versionName="1.0">
|
android:versionName="1.0">
|
||||||
<uses-sdk android:minSdkVersion="7" />
|
<uses-sdk android:minSdkVersion="7" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
|
|
||||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||||
|
<!-- for map overlay -->
|
||||||
|
<uses-library android:name="com.google.android.maps" />
|
||||||
|
|
||||||
<!-- Object browser - main activity at the moment -->
|
<!-- Object browser - main activity at the moment -->
|
||||||
<activity android:name="HomePage" android:label="@string/app_name">
|
<activity android:name="HomePage" android:label="@string/app_name">
|
||||||
@ -16,13 +20,15 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
|
||||||
<activity android:name="ObjectBrowser" android:label="@string/object_browser_name" />
|
<activity android:name="ObjectBrowser" android:label="@string/object_browser_name" />
|
||||||
<activity android:name="PFD" android:label="PFD"/>
|
<activity android:name="PFD" android:label="PFD" />
|
||||||
<activity android:name="Preferences" android:label="@string/preference_title"/>
|
<activity android:name="Preferences" android:label="@string/preference_title" />
|
||||||
<activity android:name="ObjectEditor" android:label="ObjectEditor" android:theme="@android:style/Theme.Dialog"/>
|
<activity android:name="UAVLocation" android:label="@string/location_name" />
|
||||||
|
<activity android:name="ObjectEditor" android:label="ObjectEditor"
|
||||||
|
android:theme="@android:style/Theme.Dialog" />
|
||||||
|
|
||||||
<receiver android:name="TelemetryWidget">
|
<receiver android:name="TelemetryWidget">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||||
|
@ -8,4 +8,4 @@
|
|||||||
# project structure.
|
# project structure.
|
||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-10
|
target=Google Inc.:Google APIs:8
|
||||||
|
@ -11,4 +11,5 @@
|
|||||||
android:id="@+id/launch_object_browser"
|
android:id="@+id/launch_object_browser"
|
||||||
android:drawableLeft="@drawable/browser_icon" android:layout_centerHorizontal="true"/>
|
android:drawableLeft="@drawable/browser_icon" android:layout_centerHorizontal="true"/>
|
||||||
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/pfd_name" android:id="@+id/launch_pfd" android:drawableLeft="@drawable/browser_icon" android:layout_below="@+id/launch_object_browser" android:layout_alignLeft="@+id/launch_object_browser" android:layout_alignRight="@+id/launch_object_browser"></Button>
|
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/pfd_name" android:id="@+id/launch_pfd" android:drawableLeft="@drawable/browser_icon" android:layout_below="@+id/launch_object_browser" android:layout_alignLeft="@+id/launch_object_browser" android:layout_alignRight="@+id/launch_object_browser"></Button>
|
||||||
|
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/location_name" android:id="@+id/launch_location" android:drawableLeft="@drawable/browser_icon" android:layout_below="@+id/launch_pfd" android:layout_alignLeft="@+id/launch_object_browser" android:layout_alignRight="@+id/launch_object_browser"></Button>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
10
androidgcs/res/layout/map_layout.xml
Normal file
10
androidgcs/res/layout/map_layout.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical" android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
<com.google.android.maps.MapView
|
||||||
|
android:id="@+id/map_view" android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent" android:enabled="true"
|
||||||
|
android:clickable="true" android:apiKey="0wrDHCybTiyzQZNBmbMVW9UU-8kzQfF7Ar1KhNw" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -1,19 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">OpenPilot GCS Home</string>
|
<string name="app_name">OpenPilot GCS Home</string>
|
||||||
<string name="object_browser_name">OpenPilot Object Browser</string>
|
<string name="object_browser_name">OpenPilot Object Browser</string>
|
||||||
<string name="pfd_name">OpenPilot PFD</string>
|
<string name="pfd_name">OpenPilot PFD</string>
|
||||||
<string name="menu_item_settings">Settings</string>
|
<string name="location_name">OpenPilot Location</string>
|
||||||
<string name="menu_item_connect">Connect</string>
|
|
||||||
<string name="menu_item_disconnect">Disconnect</string>
|
<string name="menu_item_settings">Settings</string>
|
||||||
<string name="preference_title">Settings</string>
|
<string name="menu_item_connect">Connect</string>
|
||||||
<string name="preference_checkbox_autoconnect">Automatically Connect</string>
|
<string name="menu_item_disconnect">Disconnect</string>
|
||||||
<string name="preference_checkbox_connection_type">Connection Type</string>
|
|
||||||
<string name="preference_checkbox_bluetooth">Bluetooth</string>
|
<string name="preference_title">Settings</string>
|
||||||
<string name="preference_connection_method_summary">Select the connection method</string>
|
<string name="preference_checkbox_autoconnect">Automatically Connect</string>
|
||||||
<string name="compass_name">Compass</string>
|
<string name="preference_checkbox_connection_type">Connection Type</string>
|
||||||
<string name="cardinal_north">N</string>
|
<string name="preference_checkbox_bluetooth">Bluetooth</string>
|
||||||
<string name="cardinal_east">E</string>
|
<string name="preference_connection_method_summary">Select the connection method</string>
|
||||||
<string name="cardinal_south">S</string>
|
|
||||||
<string name="cardinal_west">W</string>
|
<string name="compass_name">Compass</string>
|
||||||
|
<string name="cardinal_north">N</string>
|
||||||
|
<string name="cardinal_east">E</string>
|
||||||
|
<string name="cardinal_south">S</string>
|
||||||
|
<string name="cardinal_west">W</string>
|
||||||
|
<string name="connected">Connected</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -27,6 +27,12 @@ public class HomePage extends ObjectManagerActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Button location = (Button) findViewById(R.id.launch_location);
|
||||||
|
location.setOnClickListener(new OnClickListener() {
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
startActivity(new Intent(HomePage.this, UAVLocation.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -212,18 +212,45 @@ public class OPTelemetryService extends Service {
|
|||||||
//toastMessage("Started fake telemetry thread");
|
//toastMessage("Started fake telemetry thread");
|
||||||
UAVDataObject systemStats = (UAVDataObject) objMngr.getObject("SystemStats");
|
UAVDataObject systemStats = (UAVDataObject) objMngr.getObject("SystemStats");
|
||||||
UAVDataObject attitudeActual = (UAVDataObject) objMngr.getObject("AttitudeActual");
|
UAVDataObject attitudeActual = (UAVDataObject) objMngr.getObject("AttitudeActual");
|
||||||
|
UAVDataObject homeLocation = (UAVDataObject) objMngr.getObject("HomeLocation");
|
||||||
|
UAVDataObject positionActual = (UAVDataObject) objMngr.getObject("PositionActual");
|
||||||
|
|
||||||
|
homeLocation.getField("Latitude").setDouble(379420315);
|
||||||
|
homeLocation.getField("Longitude").setDouble(-88330078);
|
||||||
|
homeLocation.getField("ECEF").setDouble(497665694,0);
|
||||||
|
homeLocation.getField("ECEF").setDouble(-77336320,1);
|
||||||
|
homeLocation.getField("ECEF").setDouble(390037169,2);
|
||||||
|
homeLocation.getField("RNE").setDouble(-0.60757166,0);
|
||||||
|
homeLocation.getField("RNE").setDouble(0.09441550,1);
|
||||||
|
homeLocation.getField("RNE").setDouble(0.78863323,2);
|
||||||
|
homeLocation.getField("RNE").setDouble(0.15355512,3);
|
||||||
|
homeLocation.getField("RNE").setDouble(0.98814011,4);
|
||||||
|
homeLocation.getField("RNE").setDouble(0,5);
|
||||||
|
homeLocation.getField("RNE").setDouble(-0.77928013,6);
|
||||||
|
homeLocation.getField("RNE").setDouble(0.12109867,7);
|
||||||
|
homeLocation.getField("RNE").setDouble(-0.61486387,8);
|
||||||
|
homeLocation.getField("Be").setDouble(26702.78710938,0);
|
||||||
|
homeLocation.getField("Be").setDouble(-1468.33605957,1);
|
||||||
|
homeLocation.getField("Be").setDouble(34181.78515625,2);
|
||||||
|
|
||||||
|
|
||||||
double roll = 0;
|
double roll = 0;
|
||||||
double pitch = 0;
|
double pitch = 0;
|
||||||
double yaw = 0;
|
double yaw = 0;
|
||||||
|
double north = 0;
|
||||||
|
double east = 0;
|
||||||
while( !terminate ) {
|
while( !terminate ) {
|
||||||
attitudeActual.getField("Roll").setDouble(roll);
|
attitudeActual.getField("Roll").setDouble(roll);
|
||||||
attitudeActual.getField("Pitch").setDouble(pitch);
|
attitudeActual.getField("Pitch").setDouble(pitch);
|
||||||
attitudeActual.getField("Yaw").setDouble(yaw);
|
attitudeActual.getField("Yaw").setDouble(yaw);
|
||||||
|
positionActual.getField("North").setDouble(north += 100);
|
||||||
|
positionActual.getField("East").setDouble(east += 100);
|
||||||
roll = (roll + 10) % 180;
|
roll = (roll + 10) % 180;
|
||||||
pitch = (pitch + 10) % 180;
|
pitch = (pitch + 10) % 180;
|
||||||
yaw = (yaw + 10) % 360;
|
yaw = (yaw + 10) % 360;
|
||||||
systemStats.updated();
|
systemStats.updated();
|
||||||
attitudeActual.updated();
|
attitudeActual.updated();
|
||||||
|
positionActual.updated();
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
273
androidgcs/src/org/openpilot/androidgcs/UAVLocation.java
Normal file
273
androidgcs/src/org/openpilot/androidgcs/UAVLocation.java
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
package org.openpilot.androidgcs;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Observable;
|
||||||
|
import java.util.Observer;
|
||||||
|
|
||||||
|
import org.openpilot.androidgcs.OPTelemetryService.LocalBinder;
|
||||||
|
import org.openpilot.androidgcs.OPTelemetryService.TelemTask;
|
||||||
|
import org.openpilot.uavtalk.UAVDataObject;
|
||||||
|
import org.openpilot.uavtalk.UAVObject;
|
||||||
|
import org.openpilot.uavtalk.UAVObjectManager;
|
||||||
|
|
||||||
|
import com.google.android.maps.GeoPoint;
|
||||||
|
import com.google.android.maps.MapActivity;
|
||||||
|
import com.google.android.maps.MapController;
|
||||||
|
import com.google.android.maps.MapView;
|
||||||
|
import com.google.android.maps.Overlay;
|
||||||
|
import com.google.android.maps.Projection;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
import android.content.ServiceConnection;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.graphics.RectF;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
public class UAVLocation extends MapActivity
|
||||||
|
{
|
||||||
|
private final String TAG = "UAVLocation";
|
||||||
|
private static int LOGLEVEL = 0;
|
||||||
|
// private static boolean WARN = LOGLEVEL > 1;
|
||||||
|
private static boolean DEBUG = LOGLEVEL > 0;
|
||||||
|
|
||||||
|
private MapView mapView;
|
||||||
|
private MapController mapController;
|
||||||
|
|
||||||
|
UAVObjectManager objMngr;
|
||||||
|
boolean mBound = false;
|
||||||
|
boolean mConnected = false;
|
||||||
|
LocalBinder binder;
|
||||||
|
|
||||||
|
GeoPoint homeLocation;
|
||||||
|
GeoPoint uavLocation;
|
||||||
|
|
||||||
|
@Override public void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
setContentView(R.layout.map_layout);
|
||||||
|
mapView = (MapView)findViewById(R.id.map_view);
|
||||||
|
mapController = mapView.getController();
|
||||||
|
|
||||||
|
mapView.displayZoomControls(true);
|
||||||
|
Double lat = 37.422006*1E6;
|
||||||
|
Double lng = -122.084095*1E6;
|
||||||
|
homeLocation = new GeoPoint(lat.intValue(), lng.intValue());
|
||||||
|
uavLocation = homeLocation;
|
||||||
|
mapController.setCenter(homeLocation);
|
||||||
|
mapController.setZoom(18);
|
||||||
|
|
||||||
|
List<Overlay> overlays = mapView.getOverlays();
|
||||||
|
UAVOverlay myOverlay = new UAVOverlay();
|
||||||
|
overlays.add(myOverlay);
|
||||||
|
mapView.postInvalidate();
|
||||||
|
|
||||||
|
// ObjectManager related stuff (can't inherit standard class)
|
||||||
|
BroadcastReceiver connectedReceiver = new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
Log.d(TAG, "Received intent");
|
||||||
|
TelemTask task;
|
||||||
|
if(intent.getAction().compareTo(OPTelemetryService.INTENT_ACTION_CONNECTED) == 0) {
|
||||||
|
|
||||||
|
if(binder == null)
|
||||||
|
return;
|
||||||
|
if((task = binder.getTelemTask(0)) == null)
|
||||||
|
return;
|
||||||
|
objMngr = task.getObjectManager();
|
||||||
|
mConnected = true;
|
||||||
|
onOPConnected();
|
||||||
|
Log.d(TAG, "Connected()");
|
||||||
|
} else if (intent.getAction().compareTo(OPTelemetryService.INTENT_ACTION_DISCONNECTED) == 0) {
|
||||||
|
objMngr = null;
|
||||||
|
mConnected = false;
|
||||||
|
onOPDisconnected();
|
||||||
|
Log.d(TAG, "Disonnected()");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.addCategory(OPTelemetryService.INTENT_CATEGORY_GCS);
|
||||||
|
filter.addAction(OPTelemetryService.INTENT_ACTION_CONNECTED);
|
||||||
|
filter.addAction(OPTelemetryService.INTENT_ACTION_DISCONNECTED);
|
||||||
|
registerReceiver(connectedReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
//@Override
|
||||||
|
protected boolean isRouteDisplayed() {
|
||||||
|
// IMPORTANT: This method must return true if your Activity // is displaying driving directions. Otherwise return false.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UAVOverlay extends Overlay {
|
||||||
|
@Override
|
||||||
|
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
|
||||||
|
|
||||||
|
Projection projection = mapView.getProjection();
|
||||||
|
|
||||||
|
if (shadow == false) {
|
||||||
|
Point myPoint = new Point();
|
||||||
|
projection.toPixels(uavLocation, myPoint);
|
||||||
|
|
||||||
|
//// Draw UAV
|
||||||
|
// Create and setup your paint brush
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setARGB(250, 255, 0, 0);
|
||||||
|
paint.setAntiAlias(true);
|
||||||
|
paint.setFakeBoldText(true);
|
||||||
|
|
||||||
|
// Create the circle
|
||||||
|
int rad = 5;
|
||||||
|
RectF oval = new RectF(myPoint.x-rad, myPoint.y-rad, myPoint.x+rad, myPoint.y+rad);
|
||||||
|
|
||||||
|
// Draw on the canvas
|
||||||
|
canvas.drawOval(oval, paint);
|
||||||
|
canvas.drawText("UAV", myPoint.x+rad, myPoint.y, paint);
|
||||||
|
|
||||||
|
//// Draw Home
|
||||||
|
myPoint = new Point();
|
||||||
|
projection.toPixels(homeLocation, myPoint);
|
||||||
|
|
||||||
|
// Create and setup your paint brush
|
||||||
|
paint.setARGB(250, 0, 0, 0);
|
||||||
|
paint.setAntiAlias(true);
|
||||||
|
paint.setFakeBoldText(true);
|
||||||
|
|
||||||
|
// Create the circle
|
||||||
|
rad = 5;
|
||||||
|
oval = new RectF(myPoint.x-rad, myPoint.y-rad, myPoint.x+rad, myPoint.y+rad);
|
||||||
|
|
||||||
|
// Draw on the canvas
|
||||||
|
canvas.drawOval(oval, paint);
|
||||||
|
canvas.drawText("Home", myPoint.x+rad, myPoint.y, paint);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTap(GeoPoint point, MapView mapView1) {
|
||||||
|
// Return true if screen tap is handled by this overlay
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onOPConnected() {
|
||||||
|
UAVObject obj = objMngr.getObject("HomeLocation");
|
||||||
|
if(obj != null)
|
||||||
|
obj.addUpdatedObserver(new Observer() {
|
||||||
|
public void update(Observable observable, Object data) {
|
||||||
|
UAVDataObject obj = (UAVDataObject) data;
|
||||||
|
Double lat = obj.getField("Latitude").getDouble() / 10;
|
||||||
|
Double lon = obj.getField("Longitude").getDouble() / 10;
|
||||||
|
homeLocation = new GeoPoint(lat.intValue(), lon.intValue());
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
mapController.setCenter(homeLocation);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
System.out.println("HomeLocation: " + homeLocation.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Hacky - trigger an update
|
||||||
|
obj.updated();
|
||||||
|
|
||||||
|
obj = objMngr.getObject("PositionActual");
|
||||||
|
if(obj != null)
|
||||||
|
obj.addUpdatedObserver(new Observer() {
|
||||||
|
public void update(Observable observable, Object data) {
|
||||||
|
UAVDataObject obj = (UAVDataObject) data;
|
||||||
|
Double north = obj.getField("North").getDouble();
|
||||||
|
Double east = obj.getField("East").getDouble();
|
||||||
|
// TODO: Correct convertion from NED to LLA. This is erroneous conversion from cm to deg
|
||||||
|
uavLocation = new GeoPoint((int) (homeLocation.getLatitudeE6() + north / 100 * 1e6 / 78847),
|
||||||
|
(int) (homeLocation.getLongitudeE6() + east / 100 * 1e6 / 78847));
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
mapView.invalidate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void onOPDisconnected() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch(item.getItemId()) {
|
||||||
|
case R.id.menu_connect:
|
||||||
|
binder.openConnection();
|
||||||
|
return true;
|
||||||
|
case R.id.menu_disconnect:
|
||||||
|
binder.stopConnection();
|
||||||
|
return true;
|
||||||
|
case R.id.menu_settings:
|
||||||
|
startActivity(new Intent(this, Preferences.class));
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
MenuInflater inflater = getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.options_menu, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
Intent intent = new Intent(this, OPTelemetryService.class);
|
||||||
|
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onBind() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Defines callbacks for service binding, passed to bindService() */
|
||||||
|
private ServiceConnection mConnection = new ServiceConnection() {
|
||||||
|
public void onServiceConnected(ComponentName arg0, IBinder service) {
|
||||||
|
// We've bound to LocalService, cast the IBinder and attempt to open a connection
|
||||||
|
if (DEBUG) Log.d(TAG,"Service bound");
|
||||||
|
mBound = true;
|
||||||
|
binder = (LocalBinder) service;
|
||||||
|
|
||||||
|
if(binder.isConnected()) {
|
||||||
|
TelemTask task;
|
||||||
|
if((task = binder.getTelemTask(0)) != null) {
|
||||||
|
objMngr = task.getObjectManager();
|
||||||
|
mConnected = true;
|
||||||
|
onOPConnected();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onServiceDisconnected(ComponentName name) {
|
||||||
|
mBound = false;
|
||||||
|
binder = null;
|
||||||
|
mConnected = false;
|
||||||
|
objMngr = null;
|
||||||
|
objMngr = null;
|
||||||
|
mConnected = false;
|
||||||
|
onOPDisconnected();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user