diff --git a/device/idevicesettings.cpp b/device/idevicesettings.cpp index 09ca539..e0bae9a 100644 --- a/device/idevicesettings.cpp +++ b/device/idevicesettings.cpp @@ -759,7 +759,7 @@ bool IDeviceSettings::setTerminationFor(Network net, bool enabled) { return true; } -std::optional IDeviceSettings::isMasterResistorEnabledFor(Network net) const { +std::optional IDeviceSettings::isCommanderResistorEnabledFor(Network net) const { if(!settingsLoaded) { report(APIEvent::Type::SettingsReadError, APIEvent::Severity::Error); return std::nullopt; @@ -778,7 +778,7 @@ std::optional IDeviceSettings::isMasterResistorEnabledFor(Network net) con return std::nullopt; } - return (cfg->MasterResistor != RESISTOR_OFF); + return (cfg->CommanderResistor != RESISTOR_OFF); } default: report(APIEvent::Type::UnexpectedNetworkType, APIEvent::Severity::Error); @@ -786,7 +786,7 @@ std::optional IDeviceSettings::isMasterResistorEnabledFor(Network net) con } } -bool IDeviceSettings::setMasterResistorFor(Network net, bool resistor_on) { +bool IDeviceSettings::setCommanderResistorFor(Network net, bool resistor_on) { if(disabled) { report(APIEvent::Type::SettingsNotAvailable, APIEvent::Severity::Error); return false; @@ -810,7 +810,7 @@ bool IDeviceSettings::setMasterResistorFor(Network net, bool resistor_on) { return false; } - cfg->MasterResistor = resistor_on ? RESISTOR_ON : RESISTOR_OFF; + cfg->CommanderResistor = resistor_on ? RESISTOR_ON : RESISTOR_OFF; return true; } default: @@ -819,7 +819,7 @@ bool IDeviceSettings::setMasterResistorFor(Network net, bool resistor_on) { } } -std::optional IDeviceSettings::getLINModeFor(Network net) const { +std::optional IDeviceSettings::getLINModeFor(Network net) const { if(!settingsLoaded) { report(APIEvent::Type::SettingsReadError, APIEvent::Severity::Error); return std::nullopt; @@ -838,7 +838,7 @@ std::optional IDeviceSettings::getLINModeFor(Network net) const { return std::nullopt; } - return (enum LINMode)cfg->Mode; + return static_cast(cfg->Mode); } default: report(APIEvent::Type::UnexpectedNetworkType, APIEvent::Severity::Error); @@ -846,7 +846,7 @@ std::optional IDeviceSettings::getLINModeFor(Network net) const { } } -bool IDeviceSettings::setLINModeFor(Network net, enum LINMode mode) { +bool IDeviceSettings::setLINModeFor(Network net, LINMode mode) { if(disabled) { report(APIEvent::Type::SettingsNotAvailable, APIEvent::Severity::Error); return false; @@ -870,7 +870,7 @@ bool IDeviceSettings::setLINModeFor(Network net, enum LINMode mode) { return false; } - cfg->Mode = (uint8_t)mode; + cfg->Mode = static_cast(mode); return true; } default: @@ -879,7 +879,7 @@ bool IDeviceSettings::setLINModeFor(Network net, enum LINMode mode) { } } -std::optional IDeviceSettings::getLINMasterSlaveIntervalFor(Network net) const { +std::optional IDeviceSettings::getLINCommanderResponseTimeFor(Network net) const { if(!settingsLoaded) { report(APIEvent::Type::SettingsReadError, APIEvent::Severity::Error); return std::nullopt; @@ -906,7 +906,7 @@ std::optional IDeviceSettings::getLINMasterSlaveIntervalFor(Network net } } -bool IDeviceSettings::setLINMasterSlaveIntervalFor(Network net, uint8_t bits) { +bool IDeviceSettings::setLINCommanderResponseTimeFor(Network net, uint8_t bits) { if(disabled) { report(APIEvent::Type::SettingsNotAvailable, APIEvent::Severity::Error); return false; diff --git a/examples/cpp/lin/src/LINExample.cpp b/examples/cpp/lin/src/LINExample.cpp index 8ac3492..5c5a61b 100644 --- a/examples/cpp/lin/src/LINExample.cpp +++ b/examples/cpp/lin/src/LINExample.cpp @@ -84,8 +84,8 @@ int main() { else std::cout << "OK, " << (baud) << "bit/s" << std::endl; - std::cout << "Enable LIN master resistor... "; - ret &= device->settings->setMasterResistorFor(icsneo::Network::NetID::LIN, true); + std::cout << "Enable LIN commander resistor... "; + ret &= device->settings->setCommanderResistorFor(icsneo::Network::NetID::LIN, true); std::cout << (ret ? "OK" : "FAIL") << std::endl; std::cout << "Setting LIN2 to operate at " << baud << "bit/s... "; @@ -100,8 +100,8 @@ int main() { ret = device->settings->setLINModeFor(icsneo::Network::NetID::LIN2, NORMAL_MODE); std::cout << (ret ? "OK" : "FAIL") << std::endl; - std::cout << "Disable LIN2 master resistor... "; - ret &= device->settings->setMasterResistorFor(icsneo::Network::NetID::LIN2, false); + std::cout << "Disable LIN2 commander resistor... "; + ret &= device->settings->setCommanderResistorFor(icsneo::Network::NetID::LIN2, false); std::cout << (ret ? "OK" : "FAIL") << std::endl; std::cout << "Applying settings... "; diff --git a/include/icsneo/device/idevicesettings.h b/include/icsneo/device/idevicesettings.h index e0ff49a..3969068 100644 --- a/include/icsneo/device/idevicesettings.h +++ b/include/icsneo/device/idevicesettings.h @@ -558,7 +558,7 @@ typedef struct _LIN_SETTINGS uint16_t spbrg; /* Precompiled to be 40Mhz/Baudrate/16 - 1. Only used in neoVI FIRE/FIREVNET(4dw) */ uint8_t brgh; /* Must be zero */ uint8_t numBitsDelay; - uint8_t MasterResistor; + uint8_t CommanderResistor; uint8_t Mode; } LIN_SETTINGS; #define LIN_SETTINGS_SIZE 10 @@ -765,22 +765,22 @@ public: bool setTerminationFor(Network net, bool enabled); /** - * Check whether software switchable master resistor is currently + * Check whether software switchable commander resistor is currently * enabled for a given network in the currently active device settings. * * Returns true if the call was successful, otherwise an error * will have been reported in icsneo::getLastError(). */ - std::optional isMasterResistorEnabledFor(Network net) const; + std::optional isCommanderResistorEnabledFor(Network net) const; /** - * Enable or disable software switchable master resistor for a given + * Enable or disable software switchable commander resistor for a given * network. * * Returns true if the call was successful, otherwise an error * will have been reported in icsneo::getLastError(). */ - bool setMasterResistorFor(Network net, bool resistor_on); + bool setCommanderResistorFor(Network net, bool resistor_on); /** * Get LIN mode for a given network in the currently active device @@ -797,19 +797,19 @@ public: bool setLINModeFor(Network net, enum LINMode mode); /** - * Get number of bit delays between Master ID and first Slave byte for + * Get number of bit delays between commander ID and first responder byte for * a given network in the currently active device settings. */ - std::optional getLINMasterSlaveIntervalFor(Network net) const; + std::optional getLINCommanderResponseTimeFor(Network net) const; /** - * Set number of bit delays between Master ID and first Slave byte for + * Set number of bit delays between commander ID and first responder byte for * a given network * * Returns true if the call was successful, otherwise an error * will have been reported in icsneo::getLastError(). */ - bool setLINMasterSlaveIntervalFor(Network net, uint8_t bits); + bool setLINCommanderResponseTimeFor(Network net, uint8_t bits); const void* getRawStructurePointer() const { return settingsInDeviceRAM.data(); } void* getMutableRawStructurePointer() { return settings.data(); }