Post-O. Finalize Vehicle HAL support for OBD2 diagnostics.
Add OBD2_DTC_INFO property to VHAL. This property returns a list of timestamps for which freeze frames are available to be read.
Make OBD2_FREEZE_FRAME indexed on timestamp, such that one has to pass a timestamp to retrieve the freeze frame at that timestamp.
Add OBD2_DTC_CLEAR to delete some or all of the freeze frames stored.
Test: build
Change-Id: I30344ffd6e7527f076b3382c32f5507973c9985b
diff --git a/automotive/vehicle/2.0/default/impl/DefaultVehicleHal.h b/automotive/vehicle/2.0/default/impl/DefaultVehicleHal.h
index edfc224..4b89f55 100644
--- a/automotive/vehicle/2.0/default/impl/DefaultVehicleHal.h
+++ b/automotive/vehicle/2.0/default/impl/DefaultVehicleHal.h
@@ -85,7 +85,8 @@
void doGetPropertyAll(emulator::EmulatorMessage& rxMsg, emulator::EmulatorMessage& respMsg);
void doSetProperty(emulator::EmulatorMessage& rxMsg, emulator::EmulatorMessage& respMsg);
VehiclePropValue* getVehiclePropValueLocked(int32_t propId, int32_t areaId);
- void initObd2LiveFrame(VehiclePropConfig& obd2LiveFramePropConfig);
+ void initObd2LiveFrame(VehiclePropConfig& propConfig);
+ void initObd2FreezeFrame(VehiclePropConfig& propConfig);
void parseRxProtoBuf(std::vector<uint8_t>& msg);
void populateProtoVehicleConfig(emulator::VehiclePropConfig* protoCfg,
const VehiclePropConfig& cfg);
@@ -96,14 +97,18 @@
void rxThread(void);
void txMsg(emulator::EmulatorMessage& txMsg);
StatusCode updateProperty(const VehiclePropValue& propValue);
- StatusCode fillObd2LiveFrame(VehiclePropValuePtr* v);
- StatusCode fillObd2FreezeFrame(VehiclePropValuePtr* v);
+ StatusCode fillObd2LiveFrame(VehiclePropValue* v);
+ StatusCode fillObd2FreezeFrame(const VehiclePropValue& requestedPropValue,
+ VehiclePropValue* v);
+ StatusCode fillObd2DtcInfo(VehiclePropValue *v);
+ StatusCode clearObd2FreezeFrames(const VehiclePropValue& propValue);
private:
// TODO: Use a hashtable to support indexing props
std::vector<std::unique_ptr<VehiclePropValue>> mProps;
std::atomic<int> mCurSocket;
std::atomic<int> mExit;
- std::unique_ptr<Obd2SensorStore> mObd2SensorStore{nullptr};
+ std::unique_ptr<VehiclePropValue> mLiveObd2Frame {nullptr};
+ std::vector<std::unique_ptr<VehiclePropValue>> mFreezeObd2Frames;
std::mutex mPropsMutex;
int mSocket;
std::mutex mTxMutex;