auto-sync

This commit is contained in:
rusEfi 2016-06-04 16:02:50 -04:00
parent 352248356d
commit 8de46e97bd
2 changed files with 19 additions and 3 deletions

View File

@ -36,6 +36,9 @@ public class EngineState {
registerStringValueAction(key, callback);
}
/**
* text protocol key and callback associated with this key
*/
private static class StringActionPair extends Pair<String, ValueCallback<String>> {
public final String prefix;
@ -206,8 +209,21 @@ public class EngineState {
}
if (originalResponse.length() == response.length()) {
FileLog.MAIN.logLine("EngineState.unknown: " + response);
// discarding invalid line
return "";
int keyEnd = response.indexOf(SEPARATOR);
if (keyEnd == -1) {
// discarding invalid line
return "";
}
String unknownKey = response.substring(0, keyEnd);
int valueEnd = response.indexOf(SEPARATOR, keyEnd + 1);
if (valueEnd == -1) {
// discarding invalid line
return "";
}
String value = response.substring(keyEnd, valueEnd);
FileLog.MAIN.logLine("Invalid key [" + unknownKey + "] value [" + value + "]");
// trying to process the rest of the line
response = response.substring(valueEnd + SEPARATOR.length());
}
return response;
}

View File

@ -36,7 +36,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see EngineSnifferPanel
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20160528;
public static final int CONSOLE_VERSION = 20160604;
public static final boolean SHOW_STIMULATOR = false;
private static final String TAB_INDEX = "main_tab";
protected static final String PORT_KEY = "port";