Compare commits
2 Commits
299766403f
...
8af6d5f2a8
| Author | SHA1 | Date |
|---|---|---|
|
|
8af6d5f2a8 | |
|
|
54fb89b675 |
|
|
@ -825,6 +825,30 @@ icsneoc2_error_t icsneoc2_device_gptp_status_get(const icsneoc2_device_t* device
|
|||
return icsneoc2_error_success;
|
||||
}
|
||||
|
||||
icsneoc2_error_t icsneoc2_device_supports_reboot(const icsneoc2_device_t* device, bool* supported) {
|
||||
auto res = icsneoc2_device_is_valid(device);
|
||||
if(res != icsneoc2_error_success) {
|
||||
return res;
|
||||
}
|
||||
if(!supported) {
|
||||
return icsneoc2_error_invalid_parameters;
|
||||
}
|
||||
*supported = device->device->supportsReboot();
|
||||
|
||||
return icsneoc2_error_success;
|
||||
}
|
||||
|
||||
icsneoc2_error_t icsneoc2_device_reboot(const icsneoc2_device_t* device, bool safe) {
|
||||
auto res = icsneoc2_device_is_valid(device);
|
||||
if(res != icsneoc2_error_success) {
|
||||
return res;
|
||||
}
|
||||
if(!device->device->reboot(safe)) {
|
||||
return icsneoc2_error_transmit_message_failed;
|
||||
}
|
||||
return icsneoc2_error_success;
|
||||
}
|
||||
|
||||
icsneoc2_error_t icsneoc2_device_digital_io_get(const icsneoc2_device_t* device, icsneoc2_io_type_t type, uint32_t number, bool* value) {
|
||||
auto res = icsneoc2_device_is_valid(device);
|
||||
if(res != icsneoc2_error_success) {
|
||||
|
|
|
|||
|
|
@ -867,6 +867,90 @@ icsneoc2_error_t icsneoc2_settings_misc_io_analog_output_set(icsneoc2_device_t*
|
|||
return icsneoc2_error_success;
|
||||
}
|
||||
|
||||
icsneoc2_error_t icsneoc2_settings_linux_boot_enabled_get(icsneoc2_device_t* device, bool* value) {
|
||||
// Make sure the device is valid
|
||||
auto res = icsneoc2_device_is_valid(device);
|
||||
if(res != icsneoc2_error_success) {
|
||||
return res;
|
||||
}
|
||||
if(!value) {
|
||||
return icsneoc2_error_invalid_parameters;
|
||||
}
|
||||
if(auto result = device->device->settings->getLinuxBootEnabled(); result.has_value()) {
|
||||
*value = result.value();
|
||||
return icsneoc2_error_success;
|
||||
}
|
||||
return icsneoc2_error_get_settings_failure;
|
||||
}
|
||||
|
||||
icsneoc2_error_t icsneoc2_settings_linux_boot_enabled_set(icsneoc2_device_t* device, bool value) {
|
||||
// Make sure the device is valid
|
||||
auto res = icsneoc2_device_is_valid(device);
|
||||
if(res != icsneoc2_error_success) {
|
||||
return res;
|
||||
}
|
||||
if(!device->device->settings->setLinuxBootEnabled(value)) {
|
||||
return icsneoc2_error_set_settings_failure;
|
||||
}
|
||||
return icsneoc2_error_success;
|
||||
}
|
||||
|
||||
icsneoc2_error_t icsneoc2_settings_external_wifi_antenna_enabled_get(icsneoc2_device_t* device, bool* value) {
|
||||
// Make sure the device is valid
|
||||
auto res = icsneoc2_device_is_valid(device);
|
||||
if(res != icsneoc2_error_success) {
|
||||
return res;
|
||||
}
|
||||
if(!value) {
|
||||
return icsneoc2_error_invalid_parameters;
|
||||
}
|
||||
if(auto result = device->device->settings->getExternalWifiAntennaEnabled(); result.has_value()) {
|
||||
*value = result.value();
|
||||
return icsneoc2_error_success;
|
||||
}
|
||||
return icsneoc2_error_get_settings_failure;
|
||||
}
|
||||
|
||||
icsneoc2_error_t icsneoc2_settings_external_wifi_antenna_enabled_set(icsneoc2_device_t* device, bool value) {
|
||||
// Make sure the device is valid
|
||||
auto res = icsneoc2_device_is_valid(device);
|
||||
if(res != icsneoc2_error_success) {
|
||||
return res;
|
||||
}
|
||||
if(!device->device->settings->setExternalWifiAntennaEnabled(value)) {
|
||||
return icsneoc2_error_set_settings_failure;
|
||||
}
|
||||
return icsneoc2_error_success;
|
||||
}
|
||||
|
||||
icsneoc2_error_t icsneoc2_settings_linux_configuration_port_get(icsneoc2_device_t* device, icsneoc2_linux_configuration_port_t* value) {
|
||||
// Make sure the device is valid
|
||||
auto res = icsneoc2_device_is_valid(device);
|
||||
if(res != icsneoc2_error_success) {
|
||||
return res;
|
||||
}
|
||||
if(!value) {
|
||||
return icsneoc2_error_invalid_parameters;
|
||||
}
|
||||
if(auto result = device->device->settings->getLinuxConfigurationPort(); result.has_value()) {
|
||||
*value = static_cast<icsneoc2_linux_configuration_port_t>(result.value());
|
||||
return icsneoc2_error_success;
|
||||
}
|
||||
return icsneoc2_error_get_settings_failure;
|
||||
}
|
||||
|
||||
icsneoc2_error_t icsneoc2_settings_linux_configuration_port_set(icsneoc2_device_t* device, icsneoc2_linux_configuration_port_t value) {
|
||||
// Make sure the device is valid
|
||||
auto res = icsneoc2_device_is_valid(device);
|
||||
if(res != icsneoc2_error_success) {
|
||||
return res;
|
||||
}
|
||||
if(!device->device->settings->setLinuxConfigurationPort(static_cast<LinuxConfigurationPort>(value))) {
|
||||
return icsneoc2_error_set_settings_failure;
|
||||
}
|
||||
return icsneoc2_error_success;
|
||||
}
|
||||
|
||||
icsneoc2_error_t icsneoc2_settings_disabled_get(icsneoc2_device_t* device, bool* value) {
|
||||
if(!value) {
|
||||
return icsneoc2_error_invalid_parameters;
|
||||
|
|
|
|||
|
|
@ -52,9 +52,11 @@ void init_device(pybind11::module_& m) {
|
|||
.def("set_digital_io", pybind11::overload_cast<IO, size_t, bool>(&Device::setDigitalIO), pybind11::arg("type"), pybind11::arg("number"), pybind11::arg("value"), pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_polling_message_limit", &Device::setPollingMessageLimit)
|
||||
.def("set_rtc", &Device::setRTC, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("reboot", &Device::reboot, pybind11::arg("safe") = false, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("start_script", &Device::startScript, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("stop_script", &Device::stopScript, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("supports_tc10", &Device::supportsTC10)
|
||||
.def("supports_reboot", &Device::supportsReboot)
|
||||
.def("supports_live_data", &Device::supportsLiveData)
|
||||
.def("subscribe_live_data", &Device::subscribeLiveData, pybind11::arg("message"), pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("unsubscribe_live_data", &Device::unsubscribeLiveData, pybind11::arg("handle"), pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ void init_idevicesettings(pybind11::module_& m) {
|
|||
.value("V4", MiscIOAnalogVoltage::V4)
|
||||
.value("V5", MiscIOAnalogVoltage::V5);
|
||||
|
||||
pybind11::enum_<LinuxConfigurationPort>(settings, "LinuxConfigurationPort")
|
||||
.value("USB", LinuxConfigurationPort::USB)
|
||||
.value("ETH01", LinuxConfigurationPort::ETH01);
|
||||
|
||||
pybind11::classh<IDeviceSettings>(m, "IDeviceSettings")
|
||||
.def("apply", &IDeviceSettings::apply, pybind11::arg("temporary") = 0, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("apply_defaults", &IDeviceSettings::applyDefaults, pybind11::arg("temporary") = 0, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
|
@ -142,7 +146,15 @@ void init_idevicesettings(pybind11::module_& m) {
|
|||
.def("set_gptp_enabled_port", &IDeviceSettings::setGPTPEnabledPort, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("is_gptp_clock_syntonization_enabled", &IDeviceSettings::isGPTPClockSyntonizationEnabled, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_gptp_clock_syntonization_enabled", &IDeviceSettings::setGPTPClockSyntonizationEnabled, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
||||
|
||||
// Linux operating-system settings (Fire3 family devices)
|
||||
.def("get_linux_boot_enabled", &IDeviceSettings::getLinuxBootEnabled, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_linux_boot_enabled", &IDeviceSettings::setLinuxBootEnabled, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_external_wifi_antenna_enabled", &IDeviceSettings::getExternalWifiAntennaEnabled, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_external_wifi_antenna_enabled", &IDeviceSettings::setExternalWifiAntennaEnabled, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_linux_configuration_port", &IDeviceSettings::getLinuxConfigurationPort, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_linux_configuration_port", &IDeviceSettings::setLinuxConfigurationPort, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
||||
// Status properties
|
||||
.def_readonly("disabled", &IDeviceSettings::disabled)
|
||||
.def_readonly("readonly", &IDeviceSettings::readonly);
|
||||
|
|
|
|||
|
|
@ -3735,6 +3735,15 @@ bool Device::requestTC10Sleep(Network::NetID network) {
|
|||
return typed->response == ExtendedResponse::OK;
|
||||
}
|
||||
|
||||
bool Device::reboot(bool safe) {
|
||||
if(!supportsReboot()) {
|
||||
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
// The device reboots in response to this command, so no reply is expected.
|
||||
return com->sendCommand(ExtendedCommand::Reboot, { uint8_t(safe ? 1 : 0) });
|
||||
}
|
||||
|
||||
std::optional<TC10StatusMessage> Device::getTC10Status(Network::NetID network) {
|
||||
if(!supportsTC10()) {
|
||||
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
||||
|
|
|
|||
|
|
@ -1035,3 +1035,74 @@ bool IDeviceSettings::setGPTPClockSyntonizationEnabled(bool enable) {
|
|||
gptp->enableClockSyntonization = enable ? 1 : 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<bool> IDeviceSettings::getLinuxBootEnabled() {
|
||||
const auto* os = getLinuxSettings();
|
||||
if(os == nullptr) {
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||
return std::nullopt;
|
||||
}
|
||||
return os->allowBoot != 0;
|
||||
}
|
||||
|
||||
bool IDeviceSettings::setLinuxBootEnabled(bool enabled) {
|
||||
auto os = getMutableLinuxSettings();
|
||||
if(!os) {
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
(*os)->allowBoot = enabled ? 1 : 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<bool> IDeviceSettings::getExternalWifiAntennaEnabled() {
|
||||
const auto* os = getLinuxSettings();
|
||||
if(os == nullptr) {
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||
return std::nullopt;
|
||||
}
|
||||
return os->useExternalWifiAntenna != 0;
|
||||
}
|
||||
|
||||
bool IDeviceSettings::setExternalWifiAntennaEnabled(bool enabled) {
|
||||
auto os = getMutableLinuxSettings();
|
||||
if(!os) {
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
(*os)->useExternalWifiAntenna = enabled ? 1 : 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<LinuxConfigurationPort> IDeviceSettings::getLinuxConfigurationPort() {
|
||||
const auto* os = getLinuxSettings();
|
||||
if(os == nullptr) {
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||
return std::nullopt;
|
||||
}
|
||||
switch(static_cast<LinuxConfigurationPort>(os->ethConfigurationPort)) {
|
||||
case LinuxConfigurationPort::ETH01:
|
||||
return LinuxConfigurationPort::ETH01;
|
||||
case LinuxConfigurationPort::USB:
|
||||
default: // Any other value means the configuration interface is over USB
|
||||
return LinuxConfigurationPort::USB;
|
||||
}
|
||||
}
|
||||
|
||||
bool IDeviceSettings::setLinuxConfigurationPort(LinuxConfigurationPort port) {
|
||||
switch(port) {
|
||||
case LinuxConfigurationPort::USB:
|
||||
case LinuxConfigurationPort::ETH01:
|
||||
break;
|
||||
default:
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
auto os = getMutableLinuxSettings();
|
||||
if(!os) {
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
(*os)->ethConfigurationPort = static_cast<uint8_t>(port);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -862,10 +862,17 @@ public:
|
|||
|
||||
virtual bool supportsGPTP() const { return false; }
|
||||
|
||||
virtual bool supportsReboot() const { return false; }
|
||||
|
||||
bool requestTC10Wake(Network::NetID network);
|
||||
|
||||
bool requestTC10Sleep(Network::NetID network);
|
||||
|
||||
// Reboot the device. When safe is true the device boots the Linux rescue image and does not
|
||||
// load coremini ("safe boot"); otherwise it reboots normally. The device reboots in response,
|
||||
// so no reply is expected. Only supported on devices where supportsReboot() is true.
|
||||
bool reboot(bool safe = false);
|
||||
|
||||
std::optional<TC10StatusMessage> getTC10Status(Network::NetID network);
|
||||
std::optional<GPTPStatus> getGPTPStatus(std::chrono::milliseconds timeout = std::chrono::milliseconds(100));
|
||||
|
||||
|
|
|
|||
|
|
@ -773,6 +773,13 @@ enum class MiscIOAnalogVoltage : uint8_t
|
|||
V5 = icsneoc2_misc_io_analog_voltage_v5
|
||||
};
|
||||
|
||||
// Selects which Ethernet port(s) are reserved for the Linux configuration interface.
|
||||
enum class LinuxConfigurationPort : icsneoc2_linux_configuration_port_t
|
||||
{
|
||||
USB = icsneoc2_linux_configuration_port_usb, // Linux configuration interface accessed over USB (default)
|
||||
ETH01 = icsneoc2_linux_configuration_port_eth01 // ETH 01 reserved for Linux configuration
|
||||
};
|
||||
|
||||
class IDeviceSettings {
|
||||
public:
|
||||
using TerminationGroup = std::vector<Network>;
|
||||
|
|
@ -1302,6 +1309,20 @@ public:
|
|||
virtual const RAD_GPTP_SETTINGS* getGPTPSettings() const { return nullptr; }
|
||||
virtual RAD_GPTP_SETTINGS* getMutableGPTPSettings() { return nullptr; }
|
||||
|
||||
/* Linux operating-system settings (Fire3 family devices) */
|
||||
|
||||
// Whether the device is allowed to boot its Linux operating system.
|
||||
std::optional<bool> getLinuxBootEnabled();
|
||||
bool setLinuxBootEnabled(bool enabled);
|
||||
|
||||
// Whether the external WiFi antenna is used (true) instead of the internal antenna (false).
|
||||
std::optional<bool> getExternalWifiAntennaEnabled();
|
||||
bool setExternalWifiAntennaEnabled(bool enabled);
|
||||
|
||||
// Which Ethernet port(s) are reserved for the Linux configuration interface.
|
||||
std::optional<LinuxConfigurationPort> getLinuxConfigurationPort();
|
||||
bool setLinuxConfigurationPort(LinuxConfigurationPort port);
|
||||
|
||||
const void* getRawStructurePointer() const { return settingsInDeviceRAM.data(); }
|
||||
void* getMutableRawStructurePointer() { return settings.data(); }
|
||||
template<typename T> const T* getStructurePointer() const { return reinterpret_cast<const T*>(getRawStructurePointer()); }
|
||||
|
|
@ -1334,6 +1355,12 @@ protected:
|
|||
IDeviceSettings(warn_t createInoperableSettings, std::shared_ptr<Communication> com)
|
||||
: disabled(true), readonly(true), report(com->report), structSize(0) { (void)createInoperableSettings; }
|
||||
|
||||
// Devices that embed a Fire3LinuxSettings block in their settings structure override these to
|
||||
// expose it; all other devices report not-available (nullptr / nullopt) and the Linux accessors
|
||||
// report not-available in turn.
|
||||
virtual const Fire3LinuxSettings* getLinuxSettings() const { return nullptr; }
|
||||
virtual std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() { return std::nullopt; }
|
||||
|
||||
virtual ICSNEO_UNALIGNED(const uint64_t*) getTerminationEnables() const { return nullptr; }
|
||||
virtual ICSNEO_UNALIGNED(uint64_t*) getMutableTerminationEnables() {
|
||||
if(disabled || readonly)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ public:
|
|||
return supportedNetworks;
|
||||
}
|
||||
|
||||
bool supportsReboot() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::Connect;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,16 @@ static_assert(sizeof(neoviconnect_settings_t) == 628, "NeoVIConnect settings siz
|
|||
class NeoVIConnectSettings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIConnectSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neoviconnect_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neoviconnect_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
}
|
||||
std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() override {
|
||||
auto cfg = getMutableStructurePointer<neoviconnect_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return std::nullopt;
|
||||
return &cfg->os_settings;
|
||||
}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neoviconnect_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ public:
|
|||
}
|
||||
size_t getEthernetActivationLineCount() const override { return 2; }
|
||||
|
||||
bool supportsReboot() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIFIRE3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,16 @@ static_assert(sizeof(neovifire3_settings_t) == 1722, "NeoVIFire3 settings size m
|
|||
class NeoVIFIRE3Settings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRE3Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire3_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovifire3_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
}
|
||||
std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() override {
|
||||
auto cfg = getMutableStructurePointer<neovifire3_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return std::nullopt;
|
||||
return &cfg->os_settings;
|
||||
}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovifire3_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ public:
|
|||
return supportedNetworks;
|
||||
}
|
||||
|
||||
bool supportsReboot() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIFIRE3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,6 +150,16 @@ static_assert(sizeof(neovifire3flexray_settings_t) == 1372, "NeoVIFire3Flexray s
|
|||
class NeoVIFIRE3FlexRaySettings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRE3FlexRaySettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire3flexray_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovifire3flexray_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
}
|
||||
std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() override {
|
||||
auto cfg = getMutableStructurePointer<neovifire3flexray_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return std::nullopt;
|
||||
return &cfg->os_settings;
|
||||
}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovifire3flexray_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ public:
|
|||
|
||||
bool supportsTC10() const override { return true; }
|
||||
|
||||
bool supportsReboot() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIFIRE3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,6 +159,16 @@ static_assert(sizeof(neovifire3t1slin_settings_t) == 1594, "NeoVIFire3T1SLIN set
|
|||
class NeoVIFIRE3T1SLINSettings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRE3T1SLINSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire3t1slin_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
}
|
||||
std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() override {
|
||||
auto cfg = getMutableStructurePointer<neovifire3t1slin_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return std::nullopt;
|
||||
return &cfg->os_settings;
|
||||
}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public:
|
|||
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
bool supportsReboot() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIFIRE3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,6 +112,16 @@ static_assert(sizeof(neovired2_settings_t) == 918, "NeoVIRED2 settings size mism
|
|||
class NeoVIRED2Settings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIRED2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovired2_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovired2_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
}
|
||||
std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() override {
|
||||
auto cfg = getMutableStructurePointer<neovired2_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return std::nullopt;
|
||||
return &cfg->os_settings;
|
||||
}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovired2_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
|
|
|||
|
|
@ -602,6 +602,29 @@ icsneoc2_error_t icsneoc2_device_supports_gptp(const icsneoc2_device_t* device,
|
|||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_invalid_type otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_device_gptp_status_get(const icsneoc2_device_t* device, uint32_t timeout_ms, icsneoc2_gptp_status_t* status);
|
||||
|
||||
/**
|
||||
* Check if the device supports rebooting.
|
||||
*
|
||||
* @param[in] device The device to check against.
|
||||
* @param[out] supported Pointer to a bool to copy the value into.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_device_supports_reboot(const icsneoc2_device_t* device, bool* supported);
|
||||
|
||||
/**
|
||||
* Reboot the device. When safe is true the device boots the Linux rescue image and does not load
|
||||
* coremini ("safe boot"); otherwise it reboots normally. The device reboots in response, so no reply
|
||||
* is expected. Only supported on devices where icsneoc2_device_supports_reboot() reports true.
|
||||
*
|
||||
* @param[in] device The device to reboot.
|
||||
* @param[in] safe true to reboot into safe boot mode, false to reboot normally.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_transmit_message_failed otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_device_reboot(const icsneoc2_device_t* device, bool safe);
|
||||
|
||||
/**
|
||||
* Get the current state of a digital I/O pin.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -656,6 +656,66 @@ icsneoc2_error_t icsneoc2_settings_misc_io_analog_output_enabled_set(icsneoc2_de
|
|||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_misc_io_analog_output_set(icsneoc2_device_t* device, uint8_t pin, icsneoc2_misc_io_analog_voltage_t value);
|
||||
|
||||
/**
|
||||
* Get whether the device is allowed to boot its Linux operating system (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to query.
|
||||
* @param[out] value Pointer to a bool to copy the value into.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_get_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_linux_boot_enabled_get(icsneoc2_device_t* device, bool* value);
|
||||
|
||||
/**
|
||||
* Set whether the device is allowed to boot its Linux operating system (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to configure.
|
||||
* @param[in] value true to allow Linux to boot, false to prevent it.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_set_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_linux_boot_enabled_set(icsneoc2_device_t* device, bool value);
|
||||
|
||||
/**
|
||||
* Get whether the external WiFi antenna is used instead of the internal antenna (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to query.
|
||||
* @param[out] value Pointer to a bool to copy the value into (true for external, false for internal).
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_get_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_external_wifi_antenna_enabled_get(icsneoc2_device_t* device, bool* value);
|
||||
|
||||
/**
|
||||
* Set whether the external WiFi antenna is used instead of the internal antenna (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to configure.
|
||||
* @param[in] value true to use the external antenna, false to use the internal antenna.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_set_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_external_wifi_antenna_enabled_set(icsneoc2_device_t* device, bool value);
|
||||
|
||||
/**
|
||||
* Get which Ethernet port(s) are reserved for the Linux configuration interface (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to query.
|
||||
* @param[out] value Pointer to a icsneoc2_linux_configuration_port_t to copy the value into.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_get_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_linux_configuration_port_get(icsneoc2_device_t* device, icsneoc2_linux_configuration_port_t* value);
|
||||
|
||||
/**
|
||||
* Set which Ethernet port(s) are reserved for the Linux configuration interface (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to configure.
|
||||
* @param[in] value The configuration port selection to set.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_set_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_linux_configuration_port_set(icsneoc2_device_t* device, icsneoc2_linux_configuration_port_t value);
|
||||
|
||||
/**
|
||||
* Check if settings are disabled.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -387,6 +387,16 @@ typedef struct icsneoc2_gptp_status_t {
|
|||
uint8_t short_format; // Non-zero if firmware returned a partial response
|
||||
} icsneoc2_gptp_status_t;
|
||||
|
||||
typedef enum _icsneoc2_linux_configuration_port_t {
|
||||
icsneoc2_linux_configuration_port_usb = 0, // Linux configuration interface accessed over USB (default)
|
||||
icsneoc2_linux_configuration_port_eth01 = 1, // ETH 01 reserved for the Linux configuration interface
|
||||
|
||||
// Must be last entry. Don't use as a configuration port.
|
||||
icsneoc2_linux_configuration_port_maxsize
|
||||
} _icsneoc2_linux_configuration_port_t;
|
||||
|
||||
typedef uint32_t icsneoc2_linux_configuration_port_t;
|
||||
|
||||
typedef struct icsneoc2_disk_details_t icsneoc2_disk_details_t;
|
||||
|
||||
typedef enum _icsneoc2_disk_layout_t {
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ TEST(icsneoc2, test_icsneoc2_error_invalid_parameters_and_invalid_device)
|
|||
icsneoc2_eth_phy_link_mode_t placeholderEthPhyLinkMode = 0;
|
||||
icsneoc2_eth_phy_link_mode_t* placeholderEthPhyLinkModePtr = nullptr;
|
||||
icsneoc2_misc_io_analog_voltage_t placeholderMiscIoAnalogVoltage = 0;
|
||||
icsneoc2_linux_configuration_port_t placeholderLinuxConfigPort = 0;
|
||||
|
||||
// All of these don't have a device parameter
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_device_enumerate(0, NULL));
|
||||
|
|
@ -227,6 +228,8 @@ TEST(icsneoc2, test_icsneoc2_error_invalid_parameters_and_invalid_device)
|
|||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_device_tc10_status_get(NULL, icsneoc2_netid_dwcan_01, &sleep_s, &wake_s));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_device_tc10_status_get(NULL, icsneoc2_netid_dwcan_01, NULL, NULL));
|
||||
}
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_device_supports_reboot(NULL, &placeholderBool));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_device_reboot(NULL, false));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_netid_network_type_get(icsneoc2_netid_dwcan_01, NULL));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_device_timestamp_resolution_get(NULL, &placeholderInteger32));
|
||||
|
||||
|
|
@ -296,6 +299,12 @@ TEST(icsneoc2, test_icsneoc2_error_invalid_parameters_and_invalid_device)
|
|||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_multi_id_set(NULL, 0, 0, placeholderInteger8));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_misc_io_analog_output_enabled_set(NULL, 0, placeholderInteger8));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_misc_io_analog_output_set(NULL, 0, placeholderMiscIoAnalogVoltage));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_linux_boot_enabled_get(NULL, &placeholderBool));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_linux_boot_enabled_set(NULL, false));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_external_wifi_antenna_enabled_get(NULL, &placeholderBool));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_external_wifi_antenna_enabled_set(NULL, false));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_linux_configuration_port_get(NULL, &placeholderLinuxConfigPort));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_linux_configuration_port_set(NULL, placeholderLinuxConfigPort));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_disabled_get(NULL, &placeholderBool));
|
||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_readonly_get(NULL, &placeholderBool));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue