mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
AndroidGCS: An ugly system alarms gadget that lists all the alarm values
This commit is contained in:
parent
3eb84e188e
commit
a3038af4ad
@ -28,6 +28,7 @@
|
|||||||
<activity android:name="Controller" android:label="@string/controller_name" />
|
<activity android:name="Controller" android:label="@string/controller_name" />
|
||||||
<activity android:name="Preferences" android:label="@string/preference_title" />
|
<activity android:name="Preferences" android:label="@string/preference_title" />
|
||||||
<activity android:name="UAVLocation" android:label="@string/location_name" />
|
<activity android:name="UAVLocation" android:label="@string/location_name" />
|
||||||
|
<activity android:name="SystemAlarmActivity" android:label="System Alarms" />
|
||||||
<activity android:name="ObjectEditor" android:label="ObjectEditor"
|
<activity android:name="ObjectEditor" android:label="ObjectEditor"
|
||||||
android:theme="@android:style/Theme.Dialog" />
|
android:theme="@android:style/Theme.Dialog" />
|
||||||
<activity android:name="Logger" android:label="Logger"
|
<activity android:name="Logger" android:label="Logger"
|
||||||
|
12
androidgcs/res/layout/system_alarms.xml
Normal file
12
androidgcs/res/layout/system_alarms.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/system_alarms_status"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -48,6 +48,12 @@ public class HomePage extends ObjectManagerActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Button alarms = (Button) findViewById(R.id.launch_alarms);
|
||||||
|
alarms.setOnClickListener(new OnClickListener() {
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
startActivity(new Intent(HomePage.this, SystemAlarmActivity.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
package org.openpilot.androidgcs;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.openpilot.uavtalk.UAVObject;
|
||||||
|
import org.openpilot.uavtalk.UAVObjectField;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class SystemAlarmActivity extends ObjectManagerActivity {
|
||||||
|
/**
|
||||||
|
* Update the UI whenever the attitude is updated
|
||||||
|
*/
|
||||||
|
protected void objectUpdated(UAVObject obj) {
|
||||||
|
if (obj.getName().compareTo("SystemAlarms") != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
TextView alarms = (TextView) findViewById(R.id.system_alarms_status);
|
||||||
|
UAVObjectField a = obj.getField("Alarm");
|
||||||
|
List<String> names = a.getElementNames();
|
||||||
|
String contents = new String();
|
||||||
|
for (int i = 0; i < names.size(); i++) {
|
||||||
|
contents += names.get(i) + " : " + a.getValue(i).toString() + "\n";
|
||||||
|
}
|
||||||
|
alarms.setText(contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.system_alarms);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void onOPConnected() {
|
||||||
|
super.onOPConnected();
|
||||||
|
|
||||||
|
// Connect the update method to AttitudeActual
|
||||||
|
UAVObject obj = objMngr.getObject("SystemAlarms");
|
||||||
|
if (obj != null)
|
||||||
|
registerObjectUpdates(obj);
|
||||||
|
objectUpdated(obj);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user