mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Device: WiVI: Add VIN support
This commit is contained in:
committed by
Kyle Schwarz
parent
ec350b522a
commit
99a2ca4f0d
@@ -17,6 +17,7 @@ struct Info {
|
||||
uint8_t sleepRequest;
|
||||
uint16_t connectionTimeoutMinutes;
|
||||
std::vector<CaptureInfo> captures;
|
||||
uint8_t vinAvailable;
|
||||
};
|
||||
|
||||
// The response for Command::WiVICommand
|
||||
@@ -27,6 +28,7 @@ public:
|
||||
std::optional<Command> responseTo;
|
||||
std::optional<int32_t> value;
|
||||
std::optional<Info> info;
|
||||
std::optional<std::string> vin;
|
||||
};
|
||||
|
||||
} // namespace WiVI
|
||||
|
||||
@@ -56,6 +56,7 @@ enum class Command : uint16_t {
|
||||
GetSignal = 0x0013,
|
||||
Result = 0x0014,
|
||||
GetPhysicalSignal = 0x0015,
|
||||
GetVIN = 0x0016,
|
||||
};
|
||||
|
||||
enum class SignalType : uint16_t { // enumCoreMiniValueMiscValueType
|
||||
@@ -66,6 +67,7 @@ enum class SignalType : uint16_t { // enumCoreMiniValueMiscValueType
|
||||
ConnectionTimeout = 0x006e,
|
||||
TimeSinceLastMessageMs = 0x006f,
|
||||
UploadsPending = 0x0077,
|
||||
VINEnabled = 0x007D,
|
||||
};
|
||||
|
||||
struct Upload {
|
||||
@@ -125,7 +127,7 @@ struct CommandPacket {
|
||||
CoreMiniFixedPointValue value;
|
||||
};
|
||||
|
||||
struct GetAll {
|
||||
struct GetAllHeader {
|
||||
static std::vector<uint8_t> Encode();
|
||||
|
||||
Header header;
|
||||
@@ -133,7 +135,6 @@ struct CommandPacket {
|
||||
uint8_t sleepRequest;
|
||||
uint16_t connectionTimeoutMinutes;
|
||||
uint16_t numCaptureInfos;
|
||||
CaptureInfo captureInfos[0];
|
||||
};
|
||||
|
||||
struct ClearUploads {
|
||||
@@ -142,6 +143,13 @@ struct CommandPacket {
|
||||
Header header;
|
||||
uint8_t bitmask[0];
|
||||
};
|
||||
|
||||
struct GetVIN {
|
||||
static std::vector<uint8_t> Encode();
|
||||
|
||||
Header header;
|
||||
char VIN[17];
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace WiVI
|
||||
|
||||
@@ -568,6 +568,12 @@ public:
|
||||
NODISCARD("If the Lifetime is not held, the callback will be immediately removed")
|
||||
Lifetime addLoggingCallback(ScriptStatusCallback cb) { return addScriptStatusCallback(ScriptStatus::Logging, std::move(cb)); }
|
||||
|
||||
typedef std::function<void(void)> VINAvailableCallback;
|
||||
NODISCARD("If the Lifetime is not held, the callback will be immediately removed")
|
||||
Lifetime addVINAvailableCallback(VINAvailableCallback cb);
|
||||
std::optional<bool> isVINEnabled() const;
|
||||
std::optional<std::string> getVIN() const;
|
||||
|
||||
virtual std::vector<std::shared_ptr<FlexRay::Controller>> getFlexRayControllers() const { return {}; }
|
||||
|
||||
void addExtension(std::shared_ptr<DeviceExtension>&& extension);
|
||||
@@ -931,6 +937,7 @@ private:
|
||||
std::atomic<bool> wiviSleepRequested{false};
|
||||
std::vector<NewCaptureCallback> newCaptureCallbacks;
|
||||
std::vector< std::pair<SleepRequestedCallback, bool /* notified */> > sleepRequestedCallbacks;
|
||||
std::vector<std::pair<VINAvailableCallback, bool /* notified */>> vinAvailableCallbacks;
|
||||
void wiviThreadBody();
|
||||
void stopWiVIThreadIfNecessary(std::unique_lock<std::mutex> lk);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user