def _get_supported_connection_list(self, device): supported_connections = [] if not self.rc_api.is_wireless_connection: supported_connections.append('USB') else: if is_android() and (device in ['RCP_MK2', 'RCP_MK3', 'RCP_Apex', 'RCT_MK2']): supported_connections.append('Bluetooth') supported_connections.append('WiFi') return supported_connections
def _get_supported_connection_list(self, device): supported_connections = [] if not self.rc_api.is_wireless_connection: supported_connections.append('USB') else: if is_android() and (device in ['RCP_MK2', 'RCP_MK3', 'RCP_Apex']): supported_connections.append('Bluetooth') supported_connections.append('WiFi') return supported_connections
def set_config_defaults(self): ''' Set defaults for preferences ''' # Base system preferences self.config.adddefaultsection('help') self.config.adddefaultsection('preferences') self.config.setdefault('preferences', 'distance_units', 'miles') self.config.setdefault('preferences', 'temperature_units', 'Fahrenheit') self.config.setdefault('preferences', 'show_laptimes', 1) self.config.setdefault('preferences', 'startup_screen', 'Home Page') default_user_files_dir = self.user_files_dir self.config.setdefault('preferences', 'config_file_dir', default_user_files_dir) self.config.setdefault('preferences', 'export_file_dir', default_user_files_dir) self.config.setdefault('preferences', 'firmware_dir', default_user_files_dir) self.config.setdefault('preferences', 'import_datalog_dir', default_user_files_dir) self.config.setdefault('preferences', 'send_telemetry', '0') self.config.setdefault('preferences', 'record_session', '1') self.config.setdefault('preferences', 'global_help', True) # Connection type for mobile if is_mobile_platform(): if is_android(): self.config.setdefault('preferences', 'conn_type', 'Bluetooth') elif is_ios(): self.config.setdefault('preferences', 'conn_type', 'WiFi') else: self.config.setdefault('preferences', 'conn_type', 'Serial') # Dashboard preferences self.config.adddefaultsection('dashboard_preferences') self.config.setdefault('dashboard_preferences', 'last_dash_screen', '5x_gauge_view') self.config.setdefault('dashboard_preferences', 'pitstoptimer_enabled', 1) self.config.setdefault('dashboard_preferences', 'pitstoptimer_trigger_speed', 5) self.config.setdefault('dashboard_preferences', 'pitstoptimer_alert_speed', 25) self.config.setdefault('dashboard_preferences', 'pitstoptimer_exit_speed', 55) # Track detection pref self.config.adddefaultsection('track_detection') self.config.setdefault('track_detection', 'last_selected_track_id', 0) self.config.setdefault('track_detection', 'last_selected_track_timestamp', 0) self.config.setdefault('track_detection', 'user_cancelled_location', '0,0') self.config.adddefaultsection('analysis_preferences') self.config.setdefault('analysis_preferences', 'selected_sessions_laps', '{"sessions":{}}') self.config.setdefault('analysis_preferences', 'selected_analysis_channels', ','.join(UserPrefs.DEFAULT_ANALYSIS_CHANNELS)) self.config.adddefaultsection('setup') self.config.setdefault('setup', 'setup_enabled', 1)
def __init__(self, rc_api, databus, **kwargs): super(GeoProvider, self).__init__(**kwargs) self._internal_gps_conn = None self._databus = databus self._rc_api = rc_api self._internal_gps_active = False self._rc_gps_quality = GpsConfig.GPS_QUALITY_NO_FIX self._last_internal_location_time = 0 self._current_gps_source = GeoProvider.GPS_SOURCE_NONE databus.addSampleListener(self._on_sample) self.register_event_type('on_location') self.register_event_type('on_internal_gps_available') self.register_event_type('on_gps_source') if is_android(): # only support android for now self._start_internal_gps()
# See the GNU General Public License for more details. You should # have received a copy of the GNU General Public License along with # this code. If not, see <http://www.gnu.org/licenses/>. import kivy kivy.require('1.9.1') from kivy.logger import Logger from utils import is_mobile_platform, is_android from kivy.clock import mainthread, Clock from kivy.logger import Logger from autosportlabs.racecapture.config.rcpconfig import GpsConfig from autosportlabs.racecapture.geo.geopoint import GeoPoint from kivy.event import EventDispatcher if is_mobile_platform(): from plyer import gps if is_android(): from jnius import autoclass class GeoProvider(EventDispatcher): """ Provides a unified source of GPS data- either from RaceCapture or an internal phone GPS sensor. """ GPS_SOURCE_NONE = 0 GPS_SOURCE_RACECAPTURE = 1 GPS_SOURCE_INTERNAL = 2 INTERNAL_GPS_UPDATE_INTERVAL_SEC = 0.5 def __init__(self, rc_api, databus, **kwargs): super(GeoProvider, self).__init__(**kwargs)
# See the GNU General Public License for more details. You should # have received a copy of the GNU General Public License along with # this code. If not, see <http://www.gnu.org/licenses/>. import kivy kivy.require('1.10.0') from kivy.logger import Logger from utils import is_mobile_platform, is_android from kivy.clock import mainthread, Clock from kivy.logger import Logger from autosportlabs.racecapture.config.rcpconfig import GpsConfig from autosportlabs.racecapture.geo.geopoint import GeoPoint from kivy.event import EventDispatcher if is_mobile_platform(): from plyer import gps if is_android(): from jnius import autoclass class GeoProvider(EventDispatcher): """ Provides a unified source of GPS data- either from RaceCapture or an internal phone GPS sensor. """ GPS_SOURCE_NONE = 0 GPS_SOURCE_RACECAPTURE = 1 GPS_SOURCE_INTERNAL = 2 INTERNAL_GPS_UPDATE_INTERVAL_SEC = 0.5 def __init__(self, rc_api, databus, **kwargs): super(GeoProvider, self).__init__(**kwargs)