diff options
Diffstat (limited to 'obd2-lib')
-rw-r--r-- | obd2-lib/src/com/android/car/obd2/Obd2LiveFrameGenerator.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/obd2-lib/src/com/android/car/obd2/Obd2LiveFrameGenerator.java b/obd2-lib/src/com/android/car/obd2/Obd2LiveFrameGenerator.java index 5fb45391..121b54aa 100644 --- a/obd2-lib/src/com/android/car/obd2/Obd2LiveFrameGenerator.java +++ b/obd2-lib/src/com/android/car/obd2/Obd2LiveFrameGenerator.java | |||
@@ -27,6 +27,7 @@ import java.util.Optional; | |||
27 | import java.util.Set; | 27 | import java.util.Set; |
28 | 28 | ||
29 | public class Obd2LiveFrameGenerator { | 29 | public class Obd2LiveFrameGenerator { |
30 | public static final int FRAME_TYPE_LIVE = 1; | ||
30 | public static final String TAG = Obd2LiveFrameGenerator.class.getSimpleName(); | 31 | public static final String TAG = Obd2LiveFrameGenerator.class.getSimpleName(); |
31 | 32 | ||
32 | private final Obd2Connection mConnection; | 33 | private final Obd2Connection mConnection; |
@@ -63,6 +64,7 @@ public class Obd2LiveFrameGenerator { | |||
63 | 64 | ||
64 | public JsonWriter generate(JsonWriter jsonWriter, long timestamp) throws IOException { | 65 | public JsonWriter generate(JsonWriter jsonWriter, long timestamp) throws IOException { |
65 | jsonWriter.beginObject(); | 66 | jsonWriter.beginObject(); |
67 | jsonWriter.name("type").value(FRAME_TYPE_LIVE); | ||
66 | jsonWriter.name("timestamp").value(timestamp); | 68 | jsonWriter.name("timestamp").value(timestamp); |
67 | jsonWriter.name("intValues").beginArray(); | 69 | jsonWriter.name("intValues").beginArray(); |
68 | for (LiveFrameCommand<Integer> command : mIntegerCommands) { | 70 | for (LiveFrameCommand<Integer> command : mIntegerCommands) { |
@@ -75,8 +77,11 @@ public class Obd2LiveFrameGenerator { | |||
75 | jsonWriter.endObject(); | 77 | jsonWriter.endObject(); |
76 | } | 78 | } |
77 | } catch (IOException | InterruptedException e) { | 79 | } catch (IOException | InterruptedException e) { |
78 | Log.w(TAG, String.format("unable to retrieve OBD2 pid %d due to exception: %s", | 80 | Log.w( |
79 | command.getPid(), e)); | 81 | TAG, |
82 | String.format( | ||
83 | "unable to retrieve OBD2 pid %d due to exception: %s", | ||
84 | command.getPid(), e)); | ||
80 | // skip this entry | 85 | // skip this entry |
81 | } | 86 | } |
82 | } | 87 | } |
@@ -93,8 +98,11 @@ public class Obd2LiveFrameGenerator { | |||
93 | jsonWriter.endObject(); | 98 | jsonWriter.endObject(); |
94 | } | 99 | } |
95 | } catch (IOException | InterruptedException e) { | 100 | } catch (IOException | InterruptedException e) { |
96 | Log.w(TAG, String.format("unable to retrieve OBD2 pid %d due to exception: %s", | 101 | Log.w( |
97 | command.getPid(), e)); | 102 | TAG, |
103 | String.format( | ||
104 | "unable to retrieve OBD2 pid %d due to exception: %s", | ||
105 | command.getPid(), e)); | ||
98 | // skip this entry | 106 | // skip this entry |
99 | } | 107 | } |
100 | } | 108 | } |