From de0c16a461543a7e7c795110dda066810960746c Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Tue, 8 Sep 2020 17:39:47 -0400 Subject: [PATCH] VividCAN: Better "Online Not Supported" Error --- api/icsneocpp/event.cpp | 3 +++ include/icsneo/api/event.h | 1 + include/icsneo/device/tree/vividcan/vividcan.h | 11 ++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/api/icsneocpp/event.cpp b/api/icsneocpp/event.cpp index ec95b20..933b1d5 100644 --- a/api/icsneocpp/event.cpp +++ b/api/icsneocpp/event.cpp @@ -94,6 +94,7 @@ static constexpr const char* MESSAGE_FORMATTING = "The message was not properly static constexpr const char* CANFD_NOT_SUPPORTED = "This device does not support CANFD."; static constexpr const char* RTR_NOT_SUPPORTED = "RTR is not supported with CANFD."; static constexpr const char* DEVICE_DISCONNECTED = "The device was disconnected."; +static constexpr const char* ONLINE_NOT_SUPPORTED = "This device does not support going online."; // Transport Errors static constexpr const char* FAILED_TO_READ = "A read operation failed."; @@ -187,6 +188,8 @@ const char* APIEvent::DescriptionForType(Type type) { return RTR_NOT_SUPPORTED; case Type::DeviceDisconnected: return DEVICE_DISCONNECTED; + case Type::OnlineNotSupported: + return ONLINE_NOT_SUPPORTED; // Transport Errors case Type::FailedToRead: diff --git a/include/icsneo/api/event.h b/include/icsneo/api/event.h index 2b3751b..d3efd2f 100644 --- a/include/icsneo/api/event.h +++ b/include/icsneo/api/event.h @@ -71,6 +71,7 @@ public: CANFDNotSupported = 0x2020, RTRNotSupported = 0x2021, DeviceDisconnected = 0x2022, + OnlineNotSupported = 0x2023, // Transport Events FailedToRead = 0x3000, diff --git a/include/icsneo/device/tree/vividcan/vividcan.h b/include/icsneo/device/tree/vividcan/vividcan.h index e540934..4966af5 100644 --- a/include/icsneo/device/tree/vividcan/vividcan.h +++ b/include/icsneo/device/tree/vividcan/vividcan.h @@ -23,7 +23,16 @@ public: return found; } - bool goOnline() override { return false; } + // VividCAN does not go online, you can only set settings + bool goOnline() override { + report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error); + return false; + } + + bool goOffline() override { + report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error); + return false; + } private: VividCAN(neodevice_t neodevice) : Device(neodevice) {