Skip to content

Commit

Permalink
Merge pull request #165 from openxc/limit-1-vi
Browse files Browse the repository at this point in the history
Only allow at most 1 vehicle interface to be active via the Enabler.
  • Loading branch information
peplin committed Sep 1, 2014
2 parents 2fd9343 + 2f9c4a0 commit 45be059
Show file tree
Hide file tree
Showing 14 changed files with 291 additions and 204 deletions.
8 changes: 1 addition & 7 deletions enabler/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,17 @@
<string name="native_gps_checkbox_summary">For vehicles without a GPS receiver, send the host\'s built-in GPS location instead</string>
<string name="gps_overwrite_checkbox_title">Overwrite Native GPS</string>
<string name="gps_overwrite_checkbox_summary">Overwrite Android native GPS values with those from the vehicle (if available)</string>
<string name="bluetooth_checkbox_title">Use a Bluetooth vehicle interface</string>
<string name="bluetooth_checkbox_summary">Read vehicle data from a vehicle interface connected wirelessly via Bluetooth</string>
<string name="bluetooth_polling_title">Use background polling to detect a BT VI</string>
<string name="bluetooth_polling_summary">To save battery life, disable this if your VI can act as a Bluetooth master</string>
<string name="bluetooth_mac_title">Bluetooth device address</string>
<string name="bluetooth_mac_automatic_option">Automatically detect</string>
<string name="bluetooth_mac_automatic_summary">Automatically connect to paired OpenXC-VI device</string>
<string name="network_settings">Network</string>
<string name="network_checkbox_title">Use a network device</string>
<string name="network_checkbox_summary">Read vehicle data from the network</string>
<string name="network_host_title">Network host address</string>
<string name="network_port_title">Network port</string>
<string name="trace_source_settings">Trace file playback</string>
<string name="trace_source_checkbox_title">Use a pre-recorded trace file</string>
<string name="trace_source_checkbox_summary">Use an OpenXC vehicle data trace file as the source</string>
<string name="trace_source_file_title">Select a trace file for playback</string>
<string name="about_summary">About OpenXCEnabler</string>
<string name="about_summary">About OpenXC</string>
<string name="application_version_title">Version</string>
<string name="application_version_summary">Version Number</string>
<string name="application_version_key">application_version</string>
Expand Down
32 changes: 32 additions & 0 deletions enabler/res/values/vehicle_interfaces.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="vehicle_interface_key">vehicle_interface</string>
<string name="vehicle_interface_title">Vehicle Interface</string>

<string name="bluetooth_interface_option">Bluetooth</string>
<string name="bluetooth_interface_option_value">bluetooth</string>
<string name="usb_interface_option">USB</string>
<string name="usb_interface_option_value">usb</string>
<string name="network_interface_option">Network</string>
<string name="network_interface_option_value">network</string>
<string name="trace_interface_option">Pre-recorded Trace</string>
<string name="trace_interface_option_value">trace</string>
<string name="disabled_interface_option">None</string>
<string name="disabled_interface_option_value">none</string>

<string-array name="vehicle_interface_types">
<item>@string/bluetooth_interface_option</item>
<item>@string/usb_interface_option</item>
<item>@string/network_interface_option</item>
<item>@string/trace_interface_option</item>
<item>@string/disabled_interface_option</item>
</string-array>

<string-array name="vehicle_interface_type_aliases">
<item>@string/bluetooth_interface_option_value</item>
<item>@string/usb_interface_option_value</item>
<item>@string/network_interface_option_value</item>
<item>@string/trace_interface_option_value</item>
<item>@string/disabled_interface_option_value</item>
</string-array>
</resources>
31 changes: 16 additions & 15 deletions enabler/res/xml/data_source_preferences.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<PreferenceScreen
android:key="preference_screen"
xmlns:android="http://schemas.android.com/apk/res/android">

<ListPreference
android:key="@string/vehicle_interface_key"
android:title="@string/vehicle_interface_title"
android:entries="@array/vehicle_interface_types"
android:entryValues="@array/vehicle_interface_type_aliases"
android:defaultValue="@string/bluetooth_interface_option_value"
android:persistent="true"/>

<PreferenceCategory
android:title="@string/gps_settings">
<CheckBoxPreference
Expand All @@ -8,13 +18,10 @@
android:summary="@string/native_gps_checkbox_summary"
android:defaultValue="false" />
</PreferenceCategory>

<PreferenceCategory
android:key="@string/bluetooth_settings"
android:title="@string/bluetooth_settings">
<CheckBoxPreference
android:key="@string/bluetooth_checkbox_key"
android:title="@string/bluetooth_checkbox_title"
android:summary="@string/bluetooth_checkbox_summary"
android:defaultValue="true" />
<CheckBoxPreference
android:key="@string/bluetooth_polling_key"
android:title="@string/bluetooth_polling_title"
Expand All @@ -26,13 +33,10 @@
android:defaultValue="@string/bluetooth_mac_automatic_option"
android:persistent="true"/>
</PreferenceCategory>

<PreferenceCategory
android:key="@string/network_settings"
android:title="@string/network_settings">
<CheckBoxPreference
android:key="@string/network_checkbox_key"
android:title="@string/network_checkbox_title"
android:summary="@string/network_checkbox_summary"
android:defaultValue="false" />
<EditTextPreference
android:key="@string/network_host_key"
android:title="@string/network_host_title"
Expand All @@ -42,13 +46,10 @@
android:title="@string/network_port_title"
android:inputType="number" />
</PreferenceCategory>

<PreferenceCategory
android:key="@string/trace_source_settings"
android:title="@string/trace_source_settings">
<CheckBoxPreference
android:key="@string/trace_source_checkbox_key"
android:title="@string/trace_source_checkbox_title"
android:summary="@string/trace_source_checkbox_summary"
android:defaultValue="false" />
<Preference
android:key="@string/trace_source_file_key"
android:title="@string/trace_source_file_title" />
Expand Down
4 changes: 2 additions & 2 deletions enabler/res/xml/preference_headers.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<preference-headers
xmlns:android="http://schemas.android.com/apk/res/android">

<header android:fragment="com.openxc.enabler.SettingsActivity$RecordingPreferences"
android:title="@string/recording_preferences" />
<header android:fragment="com.openxc.enabler.SettingsActivity$DataSourcePreferences"
android:title="@string/data_source_preferences" />
<header android:fragment="com.openxc.enabler.SettingsActivity$RecordingPreferences"
android:title="@string/recording_preferences" />
<header android:fragment="com.openxc.enabler.SettingsActivity$OutputPreferences"
android:title="@string/output_preferences" />
<header android:fragment="com.openxc.enabler.SettingsActivity$AboutPreferences"
Expand Down
Loading

0 comments on commit 45be059

Please sign in to comment.