void DeviceEditWidget::UpdateVisibilities() { const DeviceConfig::PortType type = GetPortType(GetDataField(Port)); const bool maybe_bluetooth = DeviceConfig::MaybeBluetooth(type, GetDataField(Port).GetAsString()); const bool k6bt = maybe_bluetooth && GetValueBoolean(K6Bt); const bool uses_speed = DeviceConfig::UsesSpeed(type) || k6bt; SetRowAvailable(BaudRate, uses_speed); SetRowAvailable(BulkBaudRate, uses_speed && DeviceConfig::UsesDriver(type)); SetRowVisible(BulkBaudRate, uses_speed && DeviceConfig::UsesDriver(type) && SupportsBulkBaudRate(GetDataField(Driver))); SetRowAvailable(IP_ADDRESS, DeviceConfig::UsesIPAddress(type)); SetRowAvailable(TCPPort, DeviceConfig::UsesTCPPort(type)); SetRowAvailable(I2CBus, DeviceConfig::UsesI2C(type)); SetRowAvailable(I2CAddr, DeviceConfig::UsesI2C(type) && type != DeviceConfig::PortType::NUNCHUCK); SetRowAvailable(PressureUsage, DeviceConfig::IsPressureSensor(type)); SetRowVisible(Driver, DeviceConfig::UsesDriver(type)); SetRowVisible(SyncFromDevice, DeviceConfig::UsesDriver(type) && CanReceiveSettings(GetDataField(Driver))); SetRowVisible(SyncToDevice, DeviceConfig::UsesDriver(type) && CanSendSettings(GetDataField(Driver))); SetRowAvailable(K6Bt, maybe_bluetooth); }
bool DeviceEditWidget::Save(bool &_changed, bool &require_restart) { bool changed = false; changed |= FinishPortField(config, (const DataFieldEnum &)GetDataField(Port)); if (config.UsesSpeed()) { changed |= SaveValue(BaudRate, config.baud_rate); changed |= SaveValue(BulkBaudRate, config.bulk_baud_rate); } if (config.UsesTCPPort()) changed |= SaveValue(TCPPort, config.tcp_port); if (config.UsesDriver()) { changed |= SaveValue(Driver, config.driver_name.buffer(), config.driver_name.MAX_SIZE); if (CanReceiveSettings(GetDataField(Driver))) changed |= SaveValue(SyncFromDevice, config.sync_from_device); if (CanSendSettings(GetDataField(Driver))) changed |= SaveValue(SyncToDevice, config.sync_to_device); changed |= SaveValue(IgnoreCheckSum, config.ignore_checksum); } _changed |= changed; return true; }
bool DeviceEditWidget::Save(bool &_changed) { bool changed = false; changed |= FinishPortField(config, (const DataFieldEnum &)GetDataField(Port)); if (config.MaybeBluetooth()) changed |= SaveValue(K6Bt, config.k6bt); if (config.UsesSpeed()) { changed |= SaveValue(BaudRate, config.baud_rate); changed |= SaveValue(BulkBaudRate, config.bulk_baud_rate); } if (config.UsesIPAddress()) changed |= SaveValue(IP_ADDRESS, config.ip_address); if (config.UsesTCPPort()) changed |= SaveValue(TCPPort, config.tcp_port); if (config.UsesI2C()) { changed |= SaveValue(I2CBus, config.i2c_bus); changed |= SaveValue(I2CAddr, config.i2c_addr); changed |= SaveValueEnum(PressureUsage, config.press_use); } if (config.UsesDriver()) { changed |= SaveValue(Driver, config.driver_name); if (CanReceiveSettings(GetDataField(Driver))) changed |= SaveValue(SyncFromDevice, config.sync_from_device); if (CanSendSettings(GetDataField(Driver))) changed |= SaveValue(SyncToDevice, config.sync_to_device); if (CanPassThrough(GetDataField(Driver))) { changed |= SaveValue(UseSecondDriver, config.use_second_device); changed |= SaveValue(SecondDriver, config.driver2_name.buffer(), config.driver2_name.CAPACITY); } } if (CommonInterface::Basic().sensor_calibration_available) changed = true; _changed |= changed; return true; }
bool DeviceEditWidget::Save(bool &_changed, bool &require_restart) { bool changed = false; changed |= FinishPortField(config, (const DataFieldEnum &)GetDataField(Port)); if (config.MaybeBluetooth()) changed |= SaveValue(K6Bt, config.k6bt); if (config.UsesSpeed() || (config.MaybeBluetooth() && config.k6bt)) { changed |= SaveValue(BaudRate, config.baud_rate); changed |= SaveValue(BulkBaudRate, config.bulk_baud_rate); } if (config.UsesTCPPort()) changed |= SaveValue(TCPPort, config.tcp_port); if (config.UsesI2C()) { changed |= SaveValue(I2CBus, config.i2c_bus); changed |= SaveValue(I2CAddr, config.i2c_addr); changed |= SaveValueEnum(PressureUsage, config.press_use); } if (config.UsesDriver()) { changed |= SaveValue(Driver, config.driver_name.buffer(), config.driver_name.MAX_SIZE); if (CanReceiveSettings(GetDataField(Driver))) changed |= SaveValue(SyncFromDevice, config.sync_from_device); if (CanSendSettings(GetDataField(Driver))) changed |= SaveValue(SyncToDevice, config.sync_to_device); changed |= SaveValue(IgnoreCheckSum, config.ignore_checksum); } if (CommonInterface::Basic().sensor_calibration_available) changed = true; #ifndef NDEBUG if (config.UsesPort()) changed |= SaveValue(DumpPort, config.dump_port); #endif _changed |= changed; return true; }
void DeviceEditWidget::UpdateVisibilities() { const DeviceConfig::PortType type = GetPortType(GetDataField(Port)); SetRowAvailable(BaudRate, DeviceConfig::UsesSpeed(type)); SetRowAvailable(BulkBaudRate, DeviceConfig::UsesSpeed(type) && DeviceConfig::UsesDriver(type)); SetRowVisible(BulkBaudRate, DeviceConfig::UsesSpeed(type) && DeviceConfig::UsesDriver(type) && SupportsBulkBaudRate(GetDataField(Driver))); SetRowAvailable(TCPPort, DeviceConfig::UsesTCPPort(type)); SetRowVisible(Driver, DeviceConfig::UsesDriver(type)); SetRowVisible(SyncFromDevice, DeviceConfig::UsesDriver(type) && CanReceiveSettings(GetDataField(Driver))); SetRowVisible(SyncToDevice, DeviceConfig::UsesDriver(type) && CanSendSettings(GetDataField(Driver))); SetRowVisible(IgnoreCheckSum, DeviceConfig::UsesDriver(type)); }