Skip to content

Commit

Permalink
fix race condition during retrieval of supported PIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
fr3ts0n committed Aug 20, 2015
1 parent 12f159f commit 3b37c45
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.fr3ts0n.ecu.gui.androbd"
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="10204"
android:versionCode="10205"
android:versionName="@string/app_version">

<uses-sdk
Expand Down
2 changes: 1 addition & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!-- AndrOBD -->
<string name="app_name" translatable="false">AndrOBD</string>
<string name="app_version" translatable="false">V1.2.4</string>
<string name="app_version" translatable="false">V1.2.5</string>
<string name="copyright_fr3ts0n" translatable="false">&#169; 2015 fr3ts0n</string>
<string name="app_description">Android OBD vehicle diagnostics app for ELM327 bluetooth adapter</string>
<string name="send">Send</string>
Expand Down
33 changes: 19 additions & 14 deletions src/com/fr3ts0n/ecu/prot/ElmProt.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,23 @@ public String toString()
/**
* numeric IDs for commands
*/
public static enum CMD
public enum CMD
{
RESET("ATZ", 0),
INFO("ATI", 0),
GETPROT("ATDP", 0),
CANMONITOR("ATMA", 0),
ECHO("ATE", 1),
SETPROT("ATSP", 1),
SETPROTAUTO("ATSPA", 1),
SETTIMEOUT("ATST", 2),
SETLINEFEED("ATL", 1),
SETSPACES("ATS", 1);
RESET( "Z" , 0), ///< reset adapter
INFO( "I" , 0), ///< request adapter info
ECHO( "E" , 1), ///< enable/disable echo
SETLINEFEED( "L" , 1), ///< enable/disable line feeds
SETSPACES( "S" , 1), ///< enable/disable spaces
SETHEADER( "H" , 1), ///< enable/disable header response
GETPROT( "DP" , 0), ///< get protocol
SETPROT( "SP" , 1), ///< set protocol
CANMONITOR( "MA" , 0), ///< monitor CAN messages
SETPROTAUTO( "SPA" , 1), ///< set protocol auto
SETTIMEOUT( "ST" , 2), ///< set timeout (x*4ms)
SETCANTXHDR( "SH" , 3), ///< set TX header
SETCANRXFLT( "CRA" , 3); ///< set CAN RX filter

protected static final String CMD_HEADER = "AT";
private String command;
protected int paramDigits;

Expand All @@ -160,7 +165,7 @@ public static enum CMD
@Override
public String toString()
{
return command;
return CMD_HEADER+command;
}
}

Expand All @@ -178,9 +183,9 @@ public ElmProt()
* for ELM message timeout handling
*/
/** LOW Learn value ELM Message Timeout [ms] */
static int ELM_TIMEOUT_LRN_LOW = 10;
static int ELM_TIMEOUT_LRN_LOW = 12;
/** min. ELM Message Timeout [ms] */
static final int ELM_TIMEOUT_MIN = 10;
static final int ELM_TIMEOUT_MIN = 12;
/** max. ELM Message Timeout [ms] */
static final int ELM_TIMEOUT_MAX = 200;
/** Learning resolution of ELM Message Timeout [ms] */
Expand Down
2 changes: 1 addition & 1 deletion src/com/fr3ts0n/ecu/prot/ObdProt.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public void preparePidPvs(PvList pvList)
* @param start Start PID (multiple of 0x20) to process bitmask for
* @param bitmask 32-Bit bitmask which indicates support for the next 32 PIDs
*/
protected void markSupportedPids(int start, long bitmask, PvList pvList)
synchronized protected void markSupportedPids(int start, long bitmask, PvList pvList)
{
currSupportedPid = 0;
// loop through bits and mark corresponding PIDs as supported
Expand Down

0 comments on commit 3b37c45

Please sign in to comment.