Event: Better error message for USB powered devices

This commit is contained in:
Paul Hollinsky
2021-04-29 18:15:56 -04:00
parent f629125e67
commit 0ce52f064b
15 changed files with 70 additions and 3 deletions
+6
View File
@@ -254,6 +254,8 @@ protected:
// Hook for devices such as FIRE which need to inject traffic before RequestSerialNumber
// Return false to bail
virtual bool afterCommunicationOpen() { return true; }
virtual bool requiresVehiclePower() const { return true; }
template<typename Extension>
std::shared_ptr<Extension> getExtension() const {
@@ -291,6 +293,10 @@ private:
bool heartbeatSuppressed() const { return heartbeatSuppressedByUser > 0 || (settings && settings->applyingSettings); }
void handleNeoVIMessage(std::shared_ptr<CANMessage> message);
bool firmwareUpdateSupported();
APIEvent::Type getCommunicationNotEstablishedError();
enum class LEDState : uint8_t {
Offline = 0x04,
@@ -27,6 +27,8 @@ public:
virtual void onGoOffline() {}
virtual void onDeviceClose() {}
virtual bool providesFirmware() const { return false; }
virtual void handleMessage(const std::shared_ptr<Message>&) {}
// Return true to continue transmitting, success should be written to if false is returned
@@ -58,6 +58,8 @@ protected:
// The supported TX networks are the same as the supported RX networks for this device
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
bool requiresVehiclePower() const override { return false; }
};
}
@@ -45,6 +45,8 @@ private:
// The supported TX networks are the same as the supported RX networks for this device
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
bool requiresVehiclePower() const override { return false; }
};
}
@@ -45,6 +45,8 @@ private:
// The supported TX networks are the same as the supported RX networks for this device
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
bool requiresVehiclePower() const override { return false; }
};
}
@@ -84,6 +84,8 @@ protected:
Device::setupDecoder(decoder);
decoder.timestampResolution = 10; // Timestamps are in 10ns increments instead of the usual 25ns
}
bool requiresVehiclePower() const override { return false; }
};
}
@@ -47,6 +47,8 @@ protected:
// The supported TX networks are the same as the supported RX networks for this device
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
bool requiresVehiclePower() const override { return false; }
};
}
@@ -53,6 +53,8 @@ protected:
// The supported TX networks are the same as the supported RX networks for this device
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
bool requiresVehiclePower() const override { return false; }
};
}
@@ -82,6 +82,8 @@ protected:
// The supported TX networks are the same as the supported RX networks for this device
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
bool requiresVehiclePower() const override { return false; }
};
}
@@ -45,6 +45,8 @@ private:
// The supported TX networks are the same as the supported RX networks for this device
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
bool requiresVehiclePower() const override { return false; }
};
}
@@ -20,6 +20,8 @@ protected:
}
ValueCAN4(neodevice_t neodevice) : Device(neodevice) {}
bool requiresVehiclePower() const override { return false; }
};
}
@@ -35,6 +35,9 @@ public:
return false;
}
protected:
bool requiresVehiclePower() const override { return false; }
private:
VividCAN(neodevice_t neodevice) : Device(neodevice) {
initialize<STM32, VividCANSettings>();