Giter Club home page Giter Club logo

openxc-android's People

Contributors

alokonly avatar arunganesan avatar creitz avatar cwbaldwin avatar davemelcher avatar dominicmeroux avatar emarsman avatar genojaford avatar ismailarilik avatar jayanthi-rao avatar jkristin avatar jrod-001 avatar jstoke53 avatar mstocke avatar nathorne avatar peplin avatar pjt0620 avatar ppraka30 avatar ranjanios avatar rwoberholzer avatar samavinod avatar sskinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openxc-android's Issues

Bluetooth can get stuck disabled and disconnected

A report from Joe:

I’ve been testing out the Bluesmirf device on the Sony box using BlueTerm on my Nexus S.

If the connection drops after a power cycle I can get it back to a state where it no longer disconnects.

  1.   Disconnect RX pin 1/TX pin 0
    
  2.   Enter command mode in BlueTerm using $$$
    
  3.   Type in f,1 (Fast Data Mode)
    
  4.   Reconnect RX/TX
    

The data runs smoothly again.

The problem is reconnecting to the OpenXC Enabler on the tablet. I’m thinking part of the problem reconnecting is the Bluetooth implemented on the tablet.

  •      It doesn’t show BluetoothInterface under Data Sources. 
    
  •      I’ve tried closing the Enabler, with and without selecting BT.
    
  •      Repairing to Bluesmirf doesn’t help.
    
  •      Only once was I able to reconnect to the Enabler. I’m not sure why that happened.
    

I can go back to BlueTerm and see the data flowing.

Running the Enabler on my phone when the BT disconnects after power cycling the openxc box, disable the BT in the Enabler Settings

  1.   Go to BlueTerm and go through steps 1-3 above.
    
  2.   Disconnect BlueTerm.
    
  3.   Go to Enabler and enable BT again. This still doesn’t happen 100% of the time.
    
  4.   Reconnect RX/TX.
    

The data flows again.

So the problem seems to be a combination of the BT on the android device, returning to Fast Data Mode, and a problem with Bluesmirf when power cycling the open xc box.

Document trace file header format in official docs

{"metadata": {
    "version": "v3.0",
    "vehicle_interface_id": "7ABF",
    "vehicle": {
        "make": "Ford",
        "model": "Mustang",
        "trim": "V6 Premium",
        "year": 2013
    },
    "description": "highway drive to work",
    "driver_name": "TJ Giuli",
    "vehicle_id": "17N1039247929"
}

{"name":"accelerator_pedal_position","value":0,"timestamp":1364314054.403000}
{"name":"engine_speed","value":0,"timestamp":1364314054.415000}
{"name":"torque_at_transmission…….

Add header metadata to trace files

Tracefiles should have metadata that includes the version number of the tracefile being generated, and any other metadata from the vehicle we're currently connected to, such as model, vehicle interface firmware version, etc.

Latest proposed format:

{"metadata": {
    "version": "v3.0",
    "vehicle_interface_id": "7ABF",
    "vehicle": {
        "make": "Ford",
        "model": "Mustang",
        "trim": "V6 Premium",
        "year": 2013
    },
    "description": "highway drive to work",
    "driver_name": "TJ Giuli",
    "vehicle_id": "17N1039247929"
}

{"name":"accelerator_pedal_position","value":0,"timestamp":1364314054.403000}
{"name":"engine_speed","value":0,"timestamp":1364314054.415000}
{"name":"torque_at_transmission…….
  • All fields are optional, just leave out if not used
  • Entire header JSON object is optional - if you don't plan to use any of the fields, don't include the header object at all. Trace file parsers should check if the first record has the metadata field.

Clean up Bluetooth interface classes

  • Condition variable is no longer necessary without discovery, everything is synchronous
  • Remove duplicate cancelDiscovery calls if they could have side effects
  • Increase retry time from 5 seconds to 10 to give stack even more time to sober up
  • Delay after canceling discovery to give stack more time to recover

Intermittent bluetooth connection on Toshiba Thrive tablet

The issue seems to be in the bluetooth stack on the Toshiba Thrive. Bluetooth will only remain connected for a few seconds at a time.

Process:

  1. Bluetooth connects to enabler
  2. Data is sent for 5 - 20 seconds
  3. Bluetooth drops
  4. Less than a minute later, bluetooth is reconnected and loops back up to 2.

Disable "Playback trace file" setting if "Record Trace" has been selected as the data source.

Due to my own user-errors I have accidentally recorded a tracefile of a trip while simultaneously playing back an old tracefile. The resultant new tracefile that is recorded is garbage as it has two different "trips" stored at the same time.

I think the enabler should do one or the other if both settings are checked. My vote would be to disable "Playback trace file" if the "Record Trace" setting is enabled.

Enabler should report exceptions

This came up during one of the past OpenXC workshops. Someone tried to play back a tracefile that was still gzipped, so the Enabler threw a bunch of exceptions in the log, but there was no feedback to the user.

The main screen of the Enabler should show some kind of information about exceptions being thrown. The UI shouldn't badger the user or continuously display scrolling text that is too fast to read. It should also report any kind of problem it has parsing messages, whether from a tracefile or a live data stream.

FAILED BINDER TRANSACTION in Android at high data rates

I've been getting this with the CAN emulator lately, which pushes out way more data than any of our vehicles.

My suspicion is that we're pushing too much data over the AIDL, too fast. Perhaps we need to batch up a few messages and send them all at once.

AgingData#getAge() returns milliseconds but reports to return seconds

https://github.com/openxc/openxc-android/blob/master/openxc/src/com/openxc/util/AgingData.java

Similarly, getTimestamp returns milliseconds but setTimestamp's parameter is expected to be in seconds (given the multiplication by 1000 on line 58).

Moreover, since most Java applications use milliseconds as a long (given System#currentTimeMillis()), why not simply report age as standard epoch time in milliseconds (as a long) instead of double?

Consider not storing values in remote service side

Why do we construct the Measurement on the VehicleService side when reading data? We want to be able to get the last known value, so we parse and store it in a map. We will be getting a new value relatively soon anyway, and this is adding lots of complication. Instead, VehicleService.get() could be killed and the VehicleService can stop caring about storing the last value of everything. It's really just for the USB source anyway. This might also solve the problem of unrecognized signals.

Eclipse error: projects missing required source folder: 'gen'

When first importing openxc-android into eclipse, "Project 'openxc' is missing required source folder: gen' occurs. Creating an empty folder named 'gen' in each project, project -> clean -> clean all, then Build All fixes the errors allowing the projects to build.

Support reading OBD-II messages from commonly available hardware

There are many existing Bluetooth or wired OBD-II scanners (with a wide range of quality and performance), and it would be useful to have an option in the library to read as much OpenXC-compatible data from one of these devices.

For example, in the same way that the UsbVehicleDataSource reads OpenXC-formatted JSON messages and deserializes them into Java objects for Android apps to use, there could be a ScantoolDataSource that reads and deserializes OBD-II messages.

The Enabler app will also need to be updated to add an option to enable/disable the scantool data source.

This issue is also related to openxc/vi-firmware#24

Re-plugging USB OTG at micro-USB end causes quick disconnect

The weirdest issue I found when using the Nexus 7 is with USB, but it's a problem we can safely ignore for now. If the CAN translator stays powered on, i.e. you have a constant mini USB connection to a laptop, and then you unplug/replug the micro-USB side of the USB OTG adapter, it'll connect to the translator for a split second and then disconnect. This happens every time. If you unplug/replug from the USB-A side of the adapter, it works fine! The connection comes back stable. I need to learn more about USB OTG and what this adapter has on the inside. My assumption is that we're not doing some proper setup on the CAN translator when it stays powered on but has a USB host reconnect. I say this issue is safe to ignore because every scenario we're talking about in the car has the CAN translator powering down whenever the car is off.

Losing reference to an RFCOMM socket

02-27 18:36:00.998: W/bt-sdp(18490): process_service_search_attr_rsp
02-27 18:36:01.008: E/bt-rfcomm(18490): RFCOMM_CreateConnection - already opened state:2, RFC state:4, MCB state:5
02-27 18:36:01.008: E/bt-btif(18490): bta_jv_rfcomm_connect, RFCOMM_CreateConnection failed
02-27 18:36:01.008: W/bt-btif(18490): invalid rfc slot id: 11
02-27 18:36:01.008: E/DeviceManager(18181): Could connect socket to SPP service on 00:06:66:46:C2:AF
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181): Unable to connect to device at address 00:06:66:46:C2:AF
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181): com.openxc.interfaces.bluetooth.BluetoothException: Could connect socket to SPP service on 00:06:66:46:C2:AF
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181):     at com.openxc.interfaces.bluetooth.DeviceManager.setupSocket(DeviceManager.java:108)
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181):     at com.openxc.interfaces.bluetooth.DeviceManager.connect(DeviceManager.java:67)
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181):     at com.openxc.interfaces.bluetooth.BluetoothVehicleInterface.waitForConnection(BluetoothVehicleInterface.java:138)
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181):     at com.openxc.sources.BytestreamDataSource.run(BytestreamDataSource.java:55)
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181):     at java.lang.Thread.run(Thread.java:856)
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181): Caused by: java.io.IOException: read failed, socket might closed or timeout, read ret: -1
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181):     at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:492)
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181):     at android.bluetooth.BluetoothSocket.waitSocketSignal(BluetoothSocket.java:469)
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181):     at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:322)
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181):     at com.openxc.interfaces.bluetooth.DeviceManager.setupSocket(DeviceManager.java:101)
02-27 18:36:01.028: W/BluetoothVehicleInterface(18181):     ... 4 more
02-27 18:36:01.028: I/BluetoothVehicleInterface(18181): Unable to connect to target device -- sleeping for awhile before trying again
02-27 18:36:01.048: D/dalvikvm(18181): GC_CONCURRENT freed 355K, 8% free 7439K/8076K, paused 6ms+2ms, total 28ms
02-27 18:36:01.048: W/bt-rfcomm(18490): Port state disc_wait_ua Event ignored 12
02-27 18:36:01.048: W/bt-btif(18490): invalid rfc slot id: 7
02-27 18:36:01.048: A/PowerManager(18181): WakeLock finalized while still held: BluetoothVehicleInterface
02-27 18:36:05.188: E/bt-btm(18490): btm_sec_disconnected - Clearing Pending flag

Two interesting things to note:

Do we lose a reference to the RFCOMM socket without actually closing it?

How/where is the WakeLock leaked?

Sinks and sources controlled by Enabler disabled on context switch

We can let the Bluetooth and Network interfaces be controlled by the VehicleInterface (i.e. not shut them down when the Enabler goes away, see #22), but that doesn't work for the sources and sinks that run in the same process as the Enabler.

With the currently implementation, if we don't shut them down you get duplicates every time you reload the Enabler.

Detect and split trace files by trips

Instead of splitting trace files every hour detect when we haven't received data in awhile and split then, because that more reliably indicates a new trip.

Start VehicleService as a foreground service to notify user of activity

Over a recent long drive, I was running the enabler with trace file recording and trace uploading enabled, streaming music via Bluetooth and running Google Nav. I noticed a couple of times that the vehicle service and/or enabler were either crashing or getting killed by Android. On the way back without nav, it worked flawlessly. My suspicion is that my phone was running out of memory at the OpenXC service was getting killed - I could see in the logs that it was shutting down properly, there was just not explanation of why.

The recommended path is to start it as a foreground service and add a notification (required for foreground services).

The primary reason for this is to be able to notify the user via a notification that the vehicle service is active and connected (or if it's not), and a side benefit is that it may result in our process not being killed in low memory situations.

Allow checking if a vehicle measurement is supported by the underlying interface

The parent class provides a standard interface for all measurements, starting
with a way to determine if a specific data type is supported by the vehicle
you're running on:

if(vehicleService.supports(VehicleSpeed.class) {
    // it supports it
} else {
    // if we try to get it and it doesn't support it, we throw an
    // UnsupportedMeasurementException
    vehicleService.get(VehicleSpeed.class);
    /* boom */
}

Some measurements may be supported, but may not have been received from the CAN
translator yet - it could be a malfunction, or you're just checking too early
for an infrequently updated measurement:

if(vehicleService.supports(VehicleSpeed.class) {
    VehicleSpeed measurement = vehicleService.get(VehicleSpeed.class);
    if(measurement.isNone()) {
        // do stuff with it
    }
}

Trace file can overwrite itself

I was recording a trace file via USB and checked that after a few minutes, the size was still increasing and was over one megabyte. 30 minute later, that same file was only 64kb and had stopped updating 15 minutes later even though I was still driving. A new trace file started as the hot clicked over to 7pm and that one looked OK.

Are we hitting some file size limit?

Throughput seems capped at ~45KB/s

With USB and Ethernet, where I know the potential throughput is much higher, I still get this:

I/BytestreamDataSourceMixin(27032): Transferred 4194.816 KB in 92 seconds at an average of 45.59582608695652 KB/s
I/BytestreamDataSourceMixin(27032): Transferred 5243.52 KB in 111 seconds at an average of 47.23891891891892 KB/s
I/BytestreamDataSourceMixin(27032): Transferred 6292.16 KB in 133 seconds at an average of 47.30947368421052 KB/s
I/BytestreamDataSourceMixin(27032): Transferred 7340.864 KB in 154 seconds at an average of 47.66794805194805 KB/s

The message count is jumping up at almost 1200 messages per second with Ethernet, even faster than USB, but the data throughput recorded here is still about 45-47KB/s. The CPU is not pegged - in this case the combined remote process and enabler app are only using ~35%. There is either something else that is blocking, or a bug in the transfer stats logger.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.