Remove getters and setters in DeviceDetails

The DeviceDetails class is just a storage container for passing values
back and forth between backend and ui code. The different names between
the setters and getters just made it a pain to write nice macros and
keeping the two ends in sync, so this just removes the setters and
getters in favor of having the members public.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2015-09-02 23:59:59 +02:00 committed by Dirk Hohndel
parent 6944084653
commit c69d5619ce
5 changed files with 720 additions and 1501 deletions

View file

@ -67,33 +67,33 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
writer.writeTextElement("Product", product);
writer.writeEndElement();
writer.writeStartElement("Settings");
writer.writeTextElement("CustomText", details->customText());
writer.writeTextElement("CustomText", details->customText);
//Add gasses
QString gas1 = QString("%1,%2,%3,%4")
.arg(QString::number(details->gas1().oxygen),
QString::number(details->gas1().helium),
QString::number(details->gas1().type),
QString::number(details->gas1().depth));
.arg(QString::number(details->gas1.oxygen),
QString::number(details->gas1.helium),
QString::number(details->gas1.type),
QString::number(details->gas1.depth));
QString gas2 = QString("%1,%2,%3,%4")
.arg(QString::number(details->gas2().oxygen),
QString::number(details->gas2().helium),
QString::number(details->gas2().type),
QString::number(details->gas2().depth));
.arg(QString::number(details->gas2.oxygen),
QString::number(details->gas2.helium),
QString::number(details->gas2.type),
QString::number(details->gas2.depth));
QString gas3 = QString("%1,%2,%3,%4")
.arg(QString::number(details->gas3().oxygen),
QString::number(details->gas3().helium),
QString::number(details->gas3().type),
QString::number(details->gas3().depth));
.arg(QString::number(details->gas3.oxygen),
QString::number(details->gas3.helium),
QString::number(details->gas3.type),
QString::number(details->gas3.depth));
QString gas4 = QString("%1,%2,%3,%4")
.arg(QString::number(details->gas4().oxygen),
QString::number(details->gas4().helium),
QString::number(details->gas4().type),
QString::number(details->gas4().depth));
.arg(QString::number(details->gas4.oxygen),
QString::number(details->gas4.helium),
QString::number(details->gas4.type),
QString::number(details->gas4.depth));
QString gas5 = QString("%1,%2,%3,%4")
.arg(QString::number(details->gas5().oxygen),
QString::number(details->gas5().helium),
QString::number(details->gas5().type),
QString::number(details->gas5().depth));
.arg(QString::number(details->gas5.oxygen),
QString::number(details->gas5.helium),
QString::number(details->gas5.type),
QString::number(details->gas5.depth));
writer.writeTextElement("Gas1", gas1);
writer.writeTextElement("Gas2", gas2);
writer.writeTextElement("Gas3", gas3);
@ -102,30 +102,30 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
//
//Add dil values
QString dil1 = QString("%1,%2,%3,%4")
.arg(QString::number(details->dil1().oxygen),
QString::number(details->dil1().helium),
QString::number(details->dil1().type),
QString::number(details->dil1().depth));
.arg(QString::number(details->dil1.oxygen),
QString::number(details->dil1.helium),
QString::number(details->dil1.type),
QString::number(details->dil1.depth));
QString dil2 = QString("%1,%2,%3,%4")
.arg(QString::number(details->dil2().oxygen),
QString::number(details->dil2().helium),
QString::number(details->dil2().type),
QString::number(details->dil2().depth));
.arg(QString::number(details->dil2.oxygen),
QString::number(details->dil2.helium),
QString::number(details->dil2.type),
QString::number(details->dil2.depth));
QString dil3 = QString("%1,%2,%3,%4")
.arg(QString::number(details->dil3().oxygen),
QString::number(details->dil3().helium),
QString::number(details->dil3().type),
QString::number(details->dil3().depth));
.arg(QString::number(details->dil3.oxygen),
QString::number(details->dil3.helium),
QString::number(details->dil3.type),
QString::number(details->dil3.depth));
QString dil4 = QString("%1,%2,%3,%4")
.arg(QString::number(details->dil4().oxygen),
QString::number(details->dil4().helium),
QString::number(details->dil4().type),
QString::number(details->dil4().depth));
.arg(QString::number(details->dil4.oxygen),
QString::number(details->dil4.helium),
QString::number(details->dil4.type),
QString::number(details->dil4.depth));
QString dil5 = QString("%1,%2,%3,%4")
.arg(QString::number(details->dil5().oxygen),
QString::number(details->dil5().helium),
QString::number(details->dil5().type),
QString::number(details->dil5().depth));
.arg(QString::number(details->dil5.oxygen),
QString::number(details->dil5.helium),
QString::number(details->dil5.type),
QString::number(details->dil5.depth));
writer.writeTextElement("Dil1", dil1);
writer.writeTextElement("Dil2", dil2);
writer.writeTextElement("Dil3", dil3);
@ -134,20 +134,20 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
//
//Add set point values
QString sp1 = QString("%1,%2")
.arg(QString::number(details->sp1().sp),
QString::number(details->sp1().depth));
.arg(QString::number(details->sp1.sp),
QString::number(details->sp1.depth));
QString sp2 = QString("%1,%2")
.arg(QString::number(details->sp2().sp),
QString::number(details->sp2().depth));
.arg(QString::number(details->sp2.sp),
QString::number(details->sp2.depth));
QString sp3 = QString("%1,%2")
.arg(QString::number(details->sp3().sp),
QString::number(details->sp3().depth));
.arg(QString::number(details->sp3.sp),
QString::number(details->sp3.depth));
QString sp4 = QString("%1,%2")
.arg(QString::number(details->sp4().sp),
QString::number(details->sp4().depth));
.arg(QString::number(details->sp4.sp),
QString::number(details->sp4.depth));
QString sp5 = QString("%1,%2")
.arg(QString::number(details->sp5().sp),
QString::number(details->sp5().depth));
.arg(QString::number(details->sp5.sp),
QString::number(details->sp5.depth));
writer.writeTextElement("SetPoint1", sp1);
writer.writeTextElement("SetPoint2", sp2);
writer.writeTextElement("SetPoint3", sp3);
@ -155,52 +155,52 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
writer.writeTextElement("SetPoint5", sp5);
//Other Settings
writer.writeTextElement("DiveMode", QString::number(details->diveMode()));
writer.writeTextElement("Saturation", QString::number(details->saturation()));
writer.writeTextElement("Desaturation", QString::number(details->desaturation()));
writer.writeTextElement("LastDeco", QString::number(details->lastDeco()));
writer.writeTextElement("Brightness", QString::number(details->brightness()));
writer.writeTextElement("Units", QString::number(details->units()));
writer.writeTextElement("SamplingRate", QString::number(details->samplingRate()));
writer.writeTextElement("Salinity", QString::number(details->salinity()));
writer.writeTextElement("DiveModeColor", QString::number(details->diveModeColor()));
writer.writeTextElement("Language", QString::number(details->language()));
writer.writeTextElement("DateFormat", QString::number(details->dateFormat()));
writer.writeTextElement("CompassGain", QString::number(details->compassGain()));
writer.writeTextElement("SafetyStop", QString::number(details->safetyStop()));
writer.writeTextElement("GfHigh", QString::number(details->gfHigh()));
writer.writeTextElement("GfLow", QString::number(details->gfLow()));
writer.writeTextElement("PressureSensorOffset", QString::number(details->pressureSensorOffset()));
writer.writeTextElement("PpO2Min", QString::number(details->ppO2Min()));
writer.writeTextElement("PpO2Max", QString::number(details->ppO2Max()));
writer.writeTextElement("FutureTTS", QString::number(details->futureTTS()));
writer.writeTextElement("CcrMode", QString::number(details->ccrMode()));
writer.writeTextElement("DecoType", QString::number(details->decoType()));
writer.writeTextElement("AGFSelectable", QString::number(details->aGFSelectable()));
writer.writeTextElement("AGFHigh", QString::number(details->aGFHigh()));
writer.writeTextElement("AGFLow", QString::number(details->aGFLow()));
writer.writeTextElement("CalibrationGas", QString::number(details->calibrationGas()));
writer.writeTextElement("FlipScreen", QString::number(details->flipScreen()));
writer.writeTextElement("SetPointFallback", QString::number(details->setPointFallback()));
writer.writeTextElement("DiveMode", QString::number(details->diveMode));
writer.writeTextElement("Saturation", QString::number(details->saturation));
writer.writeTextElement("Desaturation", QString::number(details->desaturation));
writer.writeTextElement("LastDeco", QString::number(details->lastDeco));
writer.writeTextElement("Brightness", QString::number(details->brightness));
writer.writeTextElement("Units", QString::number(details->units));
writer.writeTextElement("SamplingRate", QString::number(details->samplingRate));
writer.writeTextElement("Salinity", QString::number(details->salinity));
writer.writeTextElement("DiveModeColor", QString::number(details->diveModeColor));
writer.writeTextElement("Language", QString::number(details->language));
writer.writeTextElement("DateFormat", QString::number(details->dateFormat));
writer.writeTextElement("CompassGain", QString::number(details->compassGain));
writer.writeTextElement("SafetyStop", QString::number(details->safetyStop));
writer.writeTextElement("GfHigh", QString::number(details->gfHigh));
writer.writeTextElement("GfLow", QString::number(details->gfLow));
writer.writeTextElement("PressureSensorOffset", QString::number(details->pressureSensorOffset));
writer.writeTextElement("PpO2Min", QString::number(details->ppO2Min));
writer.writeTextElement("PpO2Max", QString::number(details->ppO2Max));
writer.writeTextElement("FutureTTS", QString::number(details->futureTTS));
writer.writeTextElement("CcrMode", QString::number(details->ccrMode));
writer.writeTextElement("DecoType", QString::number(details->decoType));
writer.writeTextElement("AGFSelectable", QString::number(details->aGFSelectable));
writer.writeTextElement("AGFHigh", QString::number(details->aGFHigh));
writer.writeTextElement("AGFLow", QString::number(details->aGFLow));
writer.writeTextElement("CalibrationGas", QString::number(details->calibrationGas));
writer.writeTextElement("FlipScreen", QString::number(details->flipScreen));
writer.writeTextElement("SetPointFallback", QString::number(details->setPointFallback));
// Suunto vyper settings.
writer.writeTextElement("Altitude", QString::number(details->altitude()));
writer.writeTextElement("PersonalSafety", QString::number(details->personalSafety()));
writer.writeTextElement("TimeFormat", QString::number(details->timeFormat()));
writer.writeTextElement("Altitude", QString::number(details->altitude));
writer.writeTextElement("PersonalSafety", QString::number(details->personalSafety));
writer.writeTextElement("TimeFormat", QString::number(details->timeFormat));
writer.writeStartElement("Light");
writer.writeAttribute("enabled", QString::number(details->lightEnabled()));
writer.writeCharacters(QString::number(details->light()));
writer.writeAttribute("enabled", QString::number(details->lightEnabled));
writer.writeCharacters(QString::number(details->light));
writer.writeEndElement();
writer.writeStartElement("AlarmTime");
writer.writeAttribute("enabled", QString::number(details->alarmTimeEnabled()));
writer.writeCharacters(QString::number(details->alarmTime()));
writer.writeAttribute("enabled", QString::number(details->alarmTimeEnabled));
writer.writeCharacters(QString::number(details->alarmTime));
writer.writeEndElement();
writer.writeStartElement("AlarmDepth");
writer.writeAttribute("enabled", QString::number(details->alarmDepthEnabled()));
writer.writeCharacters(QString::number(details->alarmDepth()));
writer.writeAttribute("enabled", QString::number(details->alarmDepthEnabled));
writer.writeCharacters(QString::number(details->alarmDepth));
writer.writeEndElement();
writer.writeEndElement();
@ -240,7 +240,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
QString keyString = reader.text().toString();
if (settingName == "CustomText")
details->setCustomText(keyString);
details->customText = keyString;
if (settingName == "Gas1") {
QStringList gasData = keyString.split(",");
@ -249,7 +249,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
gas1.helium = gasData.at(1).toInt();
gas1.type = gasData.at(2).toInt();
gas1.depth = gasData.at(3).toInt();
details->setGas1(gas1);
details->gas1 = gas1;
}
if (settingName == "Gas2") {
@ -259,7 +259,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
gas2.helium = gasData.at(1).toInt();
gas2.type = gasData.at(2).toInt();
gas2.depth = gasData.at(3).toInt();
details->setGas2(gas2);
details->gas2 = gas2;
}
if (settingName == "Gas3") {
@ -269,7 +269,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
gas3.helium = gasData.at(1).toInt();
gas3.type = gasData.at(2).toInt();
gas3.depth = gasData.at(3).toInt();
details->setGas3(gas3);
details->gas3 = gas3;
}
if (settingName == "Gas4") {
@ -279,7 +279,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
gas4.helium = gasData.at(1).toInt();
gas4.type = gasData.at(2).toInt();
gas4.depth = gasData.at(3).toInt();
details->setGas4(gas4);
details->gas4 = gas4;
}
if (settingName == "Gas5") {
@ -289,7 +289,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
gas5.helium = gasData.at(1).toInt();
gas5.type = gasData.at(2).toInt();
gas5.depth = gasData.at(3).toInt();
details->setGas5(gas5);
details->gas5 = gas5;
}
if (settingName == "Dil1") {
@ -299,7 +299,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
dil1.helium = dilData.at(1).toInt();
dil1.type = dilData.at(2).toInt();
dil1.depth = dilData.at(3).toInt();
details->setDil1(dil1);
details->dil1 = dil1;
}
if (settingName == "Dil2") {
@ -309,7 +309,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
dil2.helium = dilData.at(1).toInt();
dil2.type = dilData.at(2).toInt();
dil2.depth = dilData.at(3).toInt();
details->setDil1(dil2);
details->dil1 = dil2;
}
if (settingName == "Dil3") {
@ -319,7 +319,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
dil3.helium = dilData.at(1).toInt();
dil3.type = dilData.at(2).toInt();
dil3.depth = dilData.at(3).toInt();
details->setDil3(dil3);
details->dil3 = dil3;
}
if (settingName == "Dil4") {
@ -329,7 +329,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
dil4.helium = dilData.at(1).toInt();
dil4.type = dilData.at(2).toInt();
dil4.depth = dilData.at(3).toInt();
details->setDil4(dil4);
details->dil4 = dil4;
}
if (settingName == "Dil5") {
@ -339,7 +339,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
dil5.helium = dilData.at(1).toInt();
dil5.type = dilData.at(2).toInt();
dil5.depth = dilData.at(3).toInt();
details->setDil5(dil5);
details->dil5 = dil5;
}
if (settingName == "SetPoint1") {
@ -347,7 +347,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
setpoint sp1;
sp1.sp = spData.at(0).toInt();
sp1.depth = spData.at(1).toInt();
details->setSp1(sp1);
details->sp1 = sp1;
}
if (settingName == "SetPoint2") {
@ -355,7 +355,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
setpoint sp2;
sp2.sp = spData.at(0).toInt();
sp2.depth = spData.at(1).toInt();
details->setSp2(sp2);
details->sp2 = sp2;
}
if (settingName == "SetPoint3") {
@ -363,7 +363,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
setpoint sp3;
sp3.sp = spData.at(0).toInt();
sp3.depth = spData.at(1).toInt();
details->setSp3(sp3);
details->sp3 = sp3;
}
if (settingName == "SetPoint4") {
@ -371,7 +371,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
setpoint sp4;
sp4.sp = spData.at(0).toInt();
sp4.depth = spData.at(1).toInt();
details->setSp4(sp4);
details->sp4 = sp4;
}
if (settingName == "SetPoint5") {
@ -379,115 +379,115 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
setpoint sp5;
sp5.sp = spData.at(0).toInt();
sp5.depth = spData.at(1).toInt();
details->setSp5(sp5);
details->sp5 = sp5;
}
if (settingName == "Saturation")
details->setSaturation(keyString.toInt());
details->saturation = keyString.toInt();
if (settingName == "Desaturation")
details->setDesaturation(keyString.toInt());
details->desaturation = keyString.toInt();
if (settingName == "DiveMode")
details->setDiveMode(keyString.toInt());
details->diveMode = keyString.toInt();
if (settingName == "LastDeco")
details->setLastDeco(keyString.toInt());
details->lastDeco = keyString.toInt();
if (settingName == "Brightness")
details->setBrightness(keyString.toInt());
details->brightness = keyString.toInt();
if (settingName == "Units")
details->setUnits(keyString.toInt());
details->units = keyString.toInt();
if (settingName == "SamplingRate")
details->setSamplingRate(keyString.toInt());
details->samplingRate = keyString.toInt();
if (settingName == "Salinity")
details->setSalinity(keyString.toInt());
details->salinity = keyString.toInt();
if (settingName == "DiveModeColour")
details->setDiveModeColor(keyString.toInt());
details->diveModeColor = keyString.toInt();
if (settingName == "Language")
details->setLanguage(keyString.toInt());
details->language = keyString.toInt();
if (settingName == "DateFormat")
details->setDateFormat(keyString.toInt());
details->dateFormat = keyString.toInt();
if (settingName == "CompassGain")
details->setCompassGain(keyString.toInt());
details->compassGain = keyString.toInt();
if (settingName == "SafetyStop")
details->setSafetyStop(keyString.toInt());
details->safetyStop = keyString.toInt();
if (settingName == "GfHigh")
details->setGfHigh(keyString.toInt());
details->gfHigh = keyString.toInt();
if (settingName == "GfLow")
details->setGfLow(keyString.toInt());
details->gfLow = keyString.toInt();
if (settingName == "PressureSensorOffset")
details->setPressureSensorOffset(keyString.toInt());
details->pressureSensorOffset = keyString.toInt();
if (settingName == "PpO2Min")
details->setPpO2Min(keyString.toInt());
details->ppO2Min = keyString.toInt();
if (settingName == "PpO2Max")
details->setPpO2Max(keyString.toInt());
details->ppO2Max = keyString.toInt();
if (settingName == "FutureTTS")
details->setFutureTTS(keyString.toInt());
details->futureTTS = keyString.toInt();
if (settingName == "CcrMode")
details->setCcrMode(keyString.toInt());
details->ccrMode = keyString.toInt();
if (settingName == "DecoType")
details->setDecoType(keyString.toInt());
details->decoType = keyString.toInt();
if (settingName == "AGFSelectable")
details->setAGFSelectable(keyString.toInt());
details->aGFSelectable = keyString.toInt();
if (settingName == "AGFHigh")
details->setAGFHigh(keyString.toInt());
details->aGFHigh = keyString.toInt();
if (settingName == "AGFLow")
details->setAGFLow(keyString.toInt());
details->aGFLow = keyString.toInt();
if (settingName == "CalibrationGas")
details->setCalibrationGas(keyString.toInt());
details->calibrationGas = keyString.toInt();
if (settingName == "FlipScreen")
details->setFlipScreen(keyString.toInt());
details->flipScreen = keyString.toInt();
if (settingName == "SetPointFallback")
details->setSetPointFallback(keyString.toInt());
details->setPointFallback = keyString.toInt();
if (settingName == "Altitude")
details->setAltitude(keyString.toInt());
details->altitude = keyString.toInt();
if (settingName == "PersonalSafety")
details->setPersonalSafety(keyString.toInt());
details->personalSafety = keyString.toInt();
if (settingName == "TimeFormat")
details->setTimeFormat(keyString.toInt());
details->timeFormat = keyString.toInt();
if (settingName == "Light") {
if (attributes.hasAttribute("enabled"))
details->setLightEnabled(attributes.value("enabled").toString().toInt());
details->setLight(keyString.toInt());
details->lightEnabled = attributes.value("enabled").toString().toInt();
details->light = keyString.toInt();
}
if (settingName == "AlarmDepth") {
if (attributes.hasAttribute("enabled"))
details->setAlarmDepthEnabled(attributes.value("enabled").toString().toInt());
details->setAlarmDepth(keyString.toInt());
details->alarmDepthEnabled = attributes.value("enabled").toString().toInt();
details->alarmDepth = keyString.toInt();
}
if (settingName == "AlarmTime") {
if (attributes.hasAttribute("enabled"))
details->setAlarmTimeEnabled(attributes.value("enabled").toString().toInt());
details->setAlarmTime(keyString.toInt());
details->alarmTimeEnabled = attributes.value("enabled").toString().toInt();
details->alarmTime = keyString.toInt();
}
}
reader.readNext();

View file

@ -193,7 +193,7 @@ static dc_status_t read_suunto_vyper_settings(dc_device_t *device, DeviceDetails
}
// We found a supported device
// we can safely proceed with reading/writing to this device.
m_deviceDetails->setModel(model);
m_deviceDetails->model = model;
}
EMIT_PROGRESS();
@ -202,86 +202,86 @@ static dc_status_t read_suunto_vyper_settings(dc_device_t *device, DeviceDetails
return rc;
// in ft * 128.0
int depth = feet_to_mm(data[0] << 8 ^ data[1]) / 128;
m_deviceDetails->setMaxDepth(depth);
m_deviceDetails->maxDepth = depth;
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_TOTAL_TIME, data, 2);
if (rc != DC_STATUS_SUCCESS)
return rc;
int total_time = data[0] << 8 ^ data[1];
m_deviceDetails->setTotalTime(total_time);
m_deviceDetails->totalTime = total_time;
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_NUMBEROFDIVES, data, 2);
if (rc != DC_STATUS_SUCCESS)
return rc;
int number_of_dives = data[0] << 8 ^ data[1];
m_deviceDetails->setNumberOfDives(number_of_dives);
m_deviceDetails->numberOfDives = number_of_dives;
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_FIRMWARE, data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
m_deviceDetails->setFirmwareVersion(QString::number(data[0]) + ".0.0");
m_deviceDetails->firmwareVersion = QString::number(data[0]) + ".0.0";
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_SERIALNUMBER, data, 4);
if (rc != DC_STATUS_SUCCESS)
return rc;
int serial_number = data[0] * 1000000 + data[1] * 10000 + data[2] * 100 + data[3];
m_deviceDetails->setSerialNo(QString::number(serial_number));
m_deviceDetails->serialNo = QString::number(serial_number);
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_CUSTOM_TEXT, data, SUUNTO_VYPER_CUSTOM_TEXT_LENGHT);
if (rc != DC_STATUS_SUCCESS)
return rc;
data[SUUNTO_VYPER_CUSTOM_TEXT_LENGHT] = 0;
m_deviceDetails->setCustomText((const char *)data);
m_deviceDetails->customText = (const char *)data;
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_SAMPLING_RATE, data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
m_deviceDetails->setSamplingRate((int)data[0]);
m_deviceDetails->samplingRate = (int)data[0];
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_ALTITUDE_SAFETY, data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
m_deviceDetails->setAltitude(data[0] & 0x03);
m_deviceDetails->setPersonalSafety(data[0] >> 2 & 0x03);
m_deviceDetails->altitude = data[0] & 0x03;
m_deviceDetails->personalSafety = data[0] >> 2 & 0x03;
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_TIMEFORMAT, data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
m_deviceDetails->setTimeFormat(data[0] & 0x01);
m_deviceDetails->timeFormat = data[0] & 0x01;
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_UNITS, data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
m_deviceDetails->setUnits(data[0] & 0x01);
m_deviceDetails->units = data[0] & 0x01;
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_MODEL, data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
m_deviceDetails->setDiveMode(data[0] & 0x03);
m_deviceDetails->diveMode = data[0] & 0x03;
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_LIGHT, data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
m_deviceDetails->setLightEnabled(data[0] >> 7);
m_deviceDetails->setLight(data[0] & 0x7F);
m_deviceDetails->lightEnabled = data[0] >> 7;
m_deviceDetails->light = data[0] & 0x7F;
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_ALARM_DEPTH_TIME, data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
m_deviceDetails->setAlarmTimeEnabled(data[0] & 0x01);
m_deviceDetails->setAlarmDepthEnabled(data[0] >> 1 & 0x01);
m_deviceDetails->alarmTimeEnabled = data[0] & 0x01;
m_deviceDetails->alarmDepthEnabled = data[0] >> 1 & 0x01;
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_ALARM_TIME, data, 2);
@ -289,16 +289,16 @@ static dc_status_t read_suunto_vyper_settings(dc_device_t *device, DeviceDetails
return rc;
int time = data[0] << 8 ^ data[1];
// The stinger stores alarm time in seconds instead of minutes.
if (m_deviceDetails->model() == "Stinger")
if (m_deviceDetails->model == "Stinger")
time /= 60;
m_deviceDetails->setAlarmTime(time);
m_deviceDetails->alarmTime = time;
EMIT_PROGRESS();
rc = dc_device_read(device, SUUNTO_VYPER_ALARM_DEPTH, data, 2);
if (rc != DC_STATUS_SUCCESS)
return rc;
depth = feet_to_mm(data[0] << 8 ^ data[1]) / 128;
m_deviceDetails->setAlarmDepth(depth);
m_deviceDetails->alarmDepth = depth;
EMIT_PROGRESS();
return DC_STATUS_SUCCESS;
@ -316,62 +316,62 @@ static dc_status_t write_suunto_vyper_settings(dc_device_t *device, DeviceDetail
// Maybee we should read the model from the device to sanity check it here too..
// For now we just check that we actually read a device before writing to one.
if (m_deviceDetails->model() == "")
if (m_deviceDetails->model == "")
return DC_STATUS_UNSUPPORTED;
rc = dc_device_write(device, SUUNTO_VYPER_CUSTOM_TEXT,
// Convert the customText to a 30 char wide padded with " "
(const unsigned char *)QString("%1").arg(m_deviceDetails->customText(), -30, QChar(' ')).toUtf8().data(),
(const unsigned char *)QString("%1").arg(m_deviceDetails->customText, -30, QChar(' ')).toUtf8().data(),
SUUNTO_VYPER_CUSTOM_TEXT_LENGHT);
if (rc != DC_STATUS_SUCCESS)
return rc;
EMIT_PROGRESS();
data = m_deviceDetails->samplingRate();
data = m_deviceDetails->samplingRate;
rc = dc_device_write(device, SUUNTO_VYPER_SAMPLING_RATE, &data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
EMIT_PROGRESS();
data = m_deviceDetails->personalSafety() << 2 ^ m_deviceDetails->altitude();
data = m_deviceDetails->personalSafety << 2 ^ m_deviceDetails->altitude;
rc = dc_device_write(device, SUUNTO_VYPER_ALTITUDE_SAFETY, &data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
EMIT_PROGRESS();
data = m_deviceDetails->timeFormat();
data = m_deviceDetails->timeFormat;
rc = dc_device_write(device, SUUNTO_VYPER_TIMEFORMAT, &data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
EMIT_PROGRESS();
data = m_deviceDetails->units();
data = m_deviceDetails->units;
rc = dc_device_write(device, SUUNTO_VYPER_UNITS, &data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
EMIT_PROGRESS();
data = m_deviceDetails->diveMode();
data = m_deviceDetails->diveMode;
rc = dc_device_write(device, SUUNTO_VYPER_MODEL, &data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
EMIT_PROGRESS();
data = m_deviceDetails->lightEnabled() << 7 ^ (m_deviceDetails->light() & 0x7F);
data = m_deviceDetails->lightEnabled << 7 ^ (m_deviceDetails->light & 0x7F);
rc = dc_device_write(device, SUUNTO_VYPER_LIGHT, &data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
EMIT_PROGRESS();
data = m_deviceDetails->alarmDepthEnabled() << 1 ^ m_deviceDetails->alarmTimeEnabled();
data = m_deviceDetails->alarmDepthEnabled << 1 ^ m_deviceDetails->alarmTimeEnabled;
rc = dc_device_write(device, SUUNTO_VYPER_ALARM_DEPTH_TIME, &data, 1);
if (rc != DC_STATUS_SUCCESS)
return rc;
EMIT_PROGRESS();
// The stinger stores alarm time in seconds instead of minutes.
time = m_deviceDetails->alarmTime();
if (m_deviceDetails->model() == "Stinger")
time = m_deviceDetails->alarmTime;
if (m_deviceDetails->model == "Stinger")
time *= 60;
data2[0] = time >> 8;
data2[1] = time & 0xFF;
@ -380,8 +380,8 @@ static dc_status_t write_suunto_vyper_settings(dc_device_t *device, DeviceDetail
return rc;
EMIT_PROGRESS();
data2[0] = (int)(mm_to_feet(m_deviceDetails->alarmDepth()) * 128) >> 8;
data2[1] = (int)(mm_to_feet(m_deviceDetails->alarmDepth()) * 128) & 0x0FF;
data2[0] = (int)(mm_to_feet(m_deviceDetails->alarmDepth) * 128) >> 8;
data2[1] = (int)(mm_to_feet(m_deviceDetails->alarmDepth) * 128) & 0x0FF;
rc = dc_device_write(device, SUUNTO_VYPER_ALARM_DEPTH, data2, 2);
EMIT_PROGRESS();
return rc;
@ -441,11 +441,11 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
gas5.type = gasData[2];
gas5.depth = gasData[3];
m_deviceDetails->setGas1(gas1);
m_deviceDetails->setGas2(gas2);
m_deviceDetails->setGas3(gas3);
m_deviceDetails->setGas4(gas4);
m_deviceDetails->setGas5(gas5);
m_deviceDetails->gas1 = gas1;
m_deviceDetails->gas2 = gas2;
m_deviceDetails->gas3 = gas3;
m_deviceDetails->gas4 = gas4;
m_deviceDetails->gas5 = gas5;
//Read Dil Values
gas dil1;
@ -495,11 +495,11 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
dil5.type = dilData[2];
dil5.depth = dilData[3];
m_deviceDetails->setDil1(dil1);
m_deviceDetails->setDil2(dil2);
m_deviceDetails->setDil3(dil3);
m_deviceDetails->setDil4(dil4);
m_deviceDetails->setDil5(dil5);
m_deviceDetails->dil1 = dil1;
m_deviceDetails->dil2 = dil2;
m_deviceDetails->dil3 = dil3;
m_deviceDetails->dil4 = dil4;
m_deviceDetails->dil5 = dil5;
//Read set point Values
setpoint sp1;
@ -539,11 +539,11 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
sp5.sp = spData[0];
sp5.depth = spData[1];
m_deviceDetails->setSp1(sp1);
m_deviceDetails->setSp2(sp2);
m_deviceDetails->setSp3(sp3);
m_deviceDetails->setSp4(sp4);
m_deviceDetails->setSp5(sp5);
m_deviceDetails->sp1 = sp1;
m_deviceDetails->sp2 = sp2;
m_deviceDetails->sp3 = sp3;
m_deviceDetails->sp4 = sp4;
m_deviceDetails->sp5 = sp5;
//Read other settings
unsigned char uData[1] = { 0 };
@ -553,35 +553,35 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
rc = hw_ostc3_device_config_read(device, _OSTC3_SETTING, uData, sizeof(uData)); \
if (rc != DC_STATUS_SUCCESS) \
return rc; \
m_deviceDetails->_DEVICE_DETAIL(uData[0]); \
m_deviceDetails->_DEVICE_DETAIL = uData[0]; \
} while (0)
READ_SETTING(OSTC3_DIVE_MODE, setDiveMode);
READ_SETTING(OSTC3_SATURATION, setSaturation);
READ_SETTING(OSTC3_DESATURATION, setDesaturation);
READ_SETTING(OSTC3_LAST_DECO, setLastDeco);
READ_SETTING(OSTC3_BRIGHTNESS, setBrightness);
READ_SETTING(OSTC3_UNITS, setUnits);
READ_SETTING(OSTC3_SAMPLING_RATE, setSamplingRate);
READ_SETTING(OSTC3_SALINITY, setSalinity);
READ_SETTING(OSTC3_DIVEMODE_COLOR, setDiveModeColor);
READ_SETTING(OSTC3_LANGUAGE, setLanguage);
READ_SETTING(OSTC3_DATE_FORMAT, setDateFormat);
READ_SETTING(OSTC3_COMPASS_GAIN, setCompassGain);
READ_SETTING(OSTC3_SAFETY_STOP, setSafetyStop);
READ_SETTING(OSTC3_GF_HIGH, setGfHigh);
READ_SETTING(OSTC3_GF_LOW, setGfLow);
READ_SETTING(OSTC3_PPO2_MIN, setPpO2Min);
READ_SETTING(OSTC3_PPO2_MAX, setPpO2Max);
READ_SETTING(OSTC3_FUTURE_TTS, setFutureTTS);
READ_SETTING(OSTC3_CCR_MODE, setCcrMode);
READ_SETTING(OSTC3_DECO_TYPE, setDecoType);
READ_SETTING(OSTC3_AGF_SELECTABLE, setAGFSelectable);
READ_SETTING(OSTC3_AGF_HIGH, setAGFHigh);
READ_SETTING(OSTC3_AGF_LOW, setAGFLow);
READ_SETTING(OSTC3_CALIBRATION_GAS_O2, setCalibrationGas);
READ_SETTING(OSTC3_FLIP_SCREEN, setFlipScreen);
READ_SETTING(OSTC3_SETPOINT_FALLBACK, setSetPointFallback);
READ_SETTING(OSTC3_DIVE_MODE, diveMode);
READ_SETTING(OSTC3_SATURATION, saturation);
READ_SETTING(OSTC3_DESATURATION, desaturation);
READ_SETTING(OSTC3_LAST_DECO, lastDeco);
READ_SETTING(OSTC3_BRIGHTNESS, brightness);
READ_SETTING(OSTC3_UNITS, units);
READ_SETTING(OSTC3_SAMPLING_RATE, samplingRate);
READ_SETTING(OSTC3_SALINITY, salinity);
READ_SETTING(OSTC3_DIVEMODE_COLOR, diveModeColor);
READ_SETTING(OSTC3_LANGUAGE, language);
READ_SETTING(OSTC3_DATE_FORMAT, dateFormat);
READ_SETTING(OSTC3_COMPASS_GAIN, compassGain);
READ_SETTING(OSTC3_SAFETY_STOP, safetyStop);
READ_SETTING(OSTC3_GF_HIGH, gfHigh);
READ_SETTING(OSTC3_GF_LOW, gfLow);
READ_SETTING(OSTC3_PPO2_MIN, ppO2Min);
READ_SETTING(OSTC3_PPO2_MAX, ppO2Max);
READ_SETTING(OSTC3_FUTURE_TTS, futureTTS);
READ_SETTING(OSTC3_CCR_MODE, ccrMode);
READ_SETTING(OSTC3_DECO_TYPE, decoType);
READ_SETTING(OSTC3_AGF_SELECTABLE, aGFSelectable);
READ_SETTING(OSTC3_AGF_HIGH, aGFHigh);
READ_SETTING(OSTC3_AGF_LOW, aGFLow);
READ_SETTING(OSTC3_CALIBRATION_GAS_O2, calibrationGas);
READ_SETTING(OSTC3_FLIP_SCREEN, flipScreen);
READ_SETTING(OSTC3_SETPOINT_FALLBACK, setPointFallback);
#undef READ_SETTING
@ -589,7 +589,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
if (rc != DC_STATUS_SUCCESS)
return rc;
// OSTC3 stores the pressureSensorOffset in two-complement
m_deviceDetails->setPressureSensorOffset((signed char)uData[0]);
m_deviceDetails->pressureSensorOffset = (signed char)uData[0];
//read firmware settings
unsigned char fData[64] = { 0 };
@ -597,10 +597,10 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
if (rc != DC_STATUS_SUCCESS)
return rc;
int serial = fData[0] + (fData[1] << 8);
m_deviceDetails->setSerialNo(QString::number(serial));
m_deviceDetails->setFirmwareVersion(QString::number(fData[2]) + "." + QString::number(fData[3]));
m_deviceDetails->serialNo = QString::number(serial);
m_deviceDetails->firmwareVersion = QString::number(fData[2]) + "." + QString::number(fData[3]);
QByteArray ar((char *)fData + 4, 60);
m_deviceDetails->setCustomText(ar.trimmed());
m_deviceDetails->customText = ar.trimmed();
return rc;
}
@ -610,38 +610,38 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
dc_status_t rc;
//write gas values
unsigned char gas1Data[4] = {
m_deviceDetails->gas1().oxygen,
m_deviceDetails->gas1().helium,
m_deviceDetails->gas1().type,
m_deviceDetails->gas1().depth
m_deviceDetails->gas1.oxygen,
m_deviceDetails->gas1.helium,
m_deviceDetails->gas1.type,
m_deviceDetails->gas1.depth
};
unsigned char gas2Data[4] = {
m_deviceDetails->gas2().oxygen,
m_deviceDetails->gas2().helium,
m_deviceDetails->gas2().type,
m_deviceDetails->gas2().depth
m_deviceDetails->gas2.oxygen,
m_deviceDetails->gas2.helium,
m_deviceDetails->gas2.type,
m_deviceDetails->gas2.depth
};
unsigned char gas3Data[4] = {
m_deviceDetails->gas3().oxygen,
m_deviceDetails->gas3().helium,
m_deviceDetails->gas3().type,
m_deviceDetails->gas3().depth
m_deviceDetails->gas3.oxygen,
m_deviceDetails->gas3.helium,
m_deviceDetails->gas3.type,
m_deviceDetails->gas3.depth
};
unsigned char gas4Data[4] = {
m_deviceDetails->gas4().oxygen,
m_deviceDetails->gas4().helium,
m_deviceDetails->gas4().type,
m_deviceDetails->gas4().depth
m_deviceDetails->gas4.oxygen,
m_deviceDetails->gas4.helium,
m_deviceDetails->gas4.type,
m_deviceDetails->gas4.depth
};
unsigned char gas5Data[4] = {
m_deviceDetails->gas5().oxygen,
m_deviceDetails->gas5().helium,
m_deviceDetails->gas5().type,
m_deviceDetails->gas5().depth
m_deviceDetails->gas5.oxygen,
m_deviceDetails->gas5.helium,
m_deviceDetails->gas5.type,
m_deviceDetails->gas5.depth
};
//gas 1
rc = hw_ostc3_device_config_write(device, OSTC3_GAS1, gas1Data, sizeof(gas1Data));
@ -666,28 +666,28 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
//write set point values
unsigned char sp1Data[2] = {
m_deviceDetails->sp1().sp,
m_deviceDetails->sp1().depth
m_deviceDetails->sp1.sp,
m_deviceDetails->sp1.depth
};
unsigned char sp2Data[2] = {
m_deviceDetails->sp2().sp,
m_deviceDetails->sp2().depth
m_deviceDetails->sp2.sp,
m_deviceDetails->sp2.depth
};
unsigned char sp3Data[2] = {
m_deviceDetails->sp3().sp,
m_deviceDetails->sp3().depth
m_deviceDetails->sp3.sp,
m_deviceDetails->sp3.depth
};
unsigned char sp4Data[2] = {
m_deviceDetails->sp4().sp,
m_deviceDetails->sp4().depth
m_deviceDetails->sp4.sp,
m_deviceDetails->sp4.depth
};
unsigned char sp5Data[2] = {
m_deviceDetails->sp5().sp,
m_deviceDetails->sp5().depth
m_deviceDetails->sp5.sp,
m_deviceDetails->sp5.depth
};
//sp 1
@ -713,38 +713,38 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
//write dil values
unsigned char dil1Data[4] = {
m_deviceDetails->dil1().oxygen,
m_deviceDetails->dil1().helium,
m_deviceDetails->dil1().type,
m_deviceDetails->dil1().depth
m_deviceDetails->dil1.oxygen,
m_deviceDetails->dil1.helium,
m_deviceDetails->dil1.type,
m_deviceDetails->dil1.depth
};
unsigned char dil2Data[4] = {
m_deviceDetails->dil2().oxygen,
m_deviceDetails->dil2().helium,
m_deviceDetails->dil2().type,
m_deviceDetails->dil2().depth
m_deviceDetails->dil2.oxygen,
m_deviceDetails->dil2.helium,
m_deviceDetails->dil2.type,
m_deviceDetails->dil2.depth
};
unsigned char dil3Data[4] = {
m_deviceDetails->dil3().oxygen,
m_deviceDetails->dil3().helium,
m_deviceDetails->dil3().type,
m_deviceDetails->dil3().depth
m_deviceDetails->dil3.oxygen,
m_deviceDetails->dil3.helium,
m_deviceDetails->dil3.type,
m_deviceDetails->dil3.depth
};
unsigned char dil4Data[4] = {
m_deviceDetails->dil4().oxygen,
m_deviceDetails->dil4().helium,
m_deviceDetails->dil4().type,
m_deviceDetails->dil4().depth
m_deviceDetails->dil4.oxygen,
m_deviceDetails->dil4.helium,
m_deviceDetails->dil4.type,
m_deviceDetails->dil4.depth
};
unsigned char dil5Data[4] = {
m_deviceDetails->dil5().oxygen,
m_deviceDetails->dil5().helium,
m_deviceDetails->dil5().type,
m_deviceDetails->dil5().depth
m_deviceDetails->dil5.oxygen,
m_deviceDetails->dil5.helium,
m_deviceDetails->dil5.type,
m_deviceDetails->dil5.depth
};
//dil 1
rc = hw_ostc3_device_config_write(device, OSTC3_DIL1, dil1Data, sizeof(gas1Data));
@ -769,14 +769,14 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
//write general settings
//custom text
rc = hw_ostc3_device_customtext(device, m_deviceDetails->customText().toUtf8().data());
rc = hw_ostc3_device_customtext(device, m_deviceDetails->customText.toUtf8().data());
if (rc != DC_STATUS_SUCCESS)
return rc;
unsigned char data[1] = { 0 };
#define WRITE_SETTING(_OSTC3_SETTING, _DEVICE_DETAIL) \
do { \
data[0] = m_deviceDetails->_DEVICE_DETAIL(); \
data[0] = m_deviceDetails->_DEVICE_DETAIL; \
rc = hw_ostc3_device_config_write(device, _OSTC3_SETTING, data, sizeof(data)); \
if (rc != DC_STATUS_SUCCESS) \
return rc; \
@ -812,13 +812,13 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
#undef WRITE_SETTING
// OSTC3 stores the pressureSensorOffset in two-complement
data[0] = (unsigned char)m_deviceDetails->pressureSensorOffset();
data[0] = (unsigned char)m_deviceDetails->pressureSensorOffset;
rc = hw_ostc3_device_config_write(device, OSTC3_PRESSURE_SENSOR_OFFSET, data, sizeof(data));
if (rc != DC_STATUS_SUCCESS)
return rc;
//sync date and time
if (m_deviceDetails->syncTime()) {
if (m_deviceDetails->syncTime) {
QDateTime timeToSet = QDateTime::currentDateTime();
dc_datetime_t time;
time.year = timeToSet.date().year();
@ -845,8 +845,8 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
rc = hw_ostc_device_eeprom_read(device, 0, data, sizeof(data));
if (rc != DC_STATUS_SUCCESS)
return rc;
m_deviceDetails->setSerialNo(QString::number(data[1] << 8 ^ data[0]));
m_deviceDetails->setNumberOfDives(data[3] << 8 ^ data[2]);
m_deviceDetails->serialNo = QString::number(data[1] << 8 ^ data[0]);
m_deviceDetails->numberOfDives = data[3] << 8 ^ data[2];
//Byte5-6:
//Gas 1 default (%O2=21, %He=0)
gas gas1;
@ -874,7 +874,7 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
gas5.helium = data[23];
//Byte25-26:
//Gas 6 current (%O2, %He)
m_deviceDetails->setSalinity(data[26]);
m_deviceDetails->salinity = data[26];
// Active Gas Flag Register
gas1.type = data[27] & 0x01;
gas2.type = (data[27] & 0x02) >> 1;
@ -910,15 +910,15 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
break;
}
// Data filled up, set the gases.
m_deviceDetails->setGas1(gas1);
m_deviceDetails->setGas2(gas2);
m_deviceDetails->setGas3(gas3);
m_deviceDetails->setGas4(gas4);
m_deviceDetails->setGas5(gas5);
m_deviceDetails->setDecoType(data[34]);
m_deviceDetails->gas1 = gas1;
m_deviceDetails->gas2 = gas2;
m_deviceDetails->gas3 = gas3;
m_deviceDetails->gas4 = gas4;
m_deviceDetails->gas5 = gas5;
m_deviceDetails->decoType = data[34];
//Byte36:
//Use O2 Sensor Module in CC Modes (0= OFF, 1= ON) (Only available in old OSTC1 - unused for OSTC Mk.2/2N)
//m_deviceDetails->setCcrMode(data[35]);
//m_deviceDetails->ccrMode = data[35];
setpoint sp1;
sp1.sp = data[36];
sp1.depth = 0;
@ -928,9 +928,9 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
setpoint sp3;
sp3.sp = data[38];
sp3.depth = 0;
m_deviceDetails->setSp1(sp1);
m_deviceDetails->setSp2(sp2);
m_deviceDetails->setSp3(sp3);
m_deviceDetails->sp1 = sp1;
m_deviceDetails->sp2 = sp2;
m_deviceDetails->sp3 = sp3;
// Byte41-42:
// Lowest Battery voltage seen (in mV)
// Byte43:
@ -980,7 +980,7 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
char *term = strchr((char *)data + 65, (int)'}');
if (term)
*term = 0;
m_deviceDetails->setCustomText((const char *)data + 65);
m_deviceDetails->customText = (const char *)data + 65;
}
// Byte91:
// Dim OLED in Divemode (>0), Normal mode (=0)
@ -989,7 +989,7 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
// =0: MM/DD/YY
// =1: DD/MM/YY
// =2: YY/MM/DD
m_deviceDetails->setDateFormat(data[91]);
m_deviceDetails->dateFormat = data[91];
// Byte93:
// Total number of CF used in installed firmware
#ifdef DEBUG_OSTC_CF
@ -1056,11 +1056,11 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
//Error?
break;
}
m_deviceDetails->setDil1(dil1);
m_deviceDetails->setDil2(dil2);
m_deviceDetails->setDil3(dil3);
m_deviceDetails->setDil4(dil4);
m_deviceDetails->setDil5(dil5);
m_deviceDetails->dil1 = dil1;
m_deviceDetails->dil2 = dil2;
m_deviceDetails->dil3 = dil3;
m_deviceDetails->dil4 = dil4;
m_deviceDetails->dil5 = dil5;
// Byte117-128:
// not used/reserved
// Byte129-256:
@ -1068,17 +1068,17 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
// Decode the relevant ones
// CF11: Factor for saturation processes
m_deviceDetails->setSaturation(read_ostc_cf(data, 11));
m_deviceDetails->saturation = read_ostc_cf(data, 11);
// CF12: Factor for desaturation processes
m_deviceDetails->setDesaturation(read_ostc_cf(data, 12));
m_deviceDetails->desaturation = read_ostc_cf(data, 12);
// CF17: Lower threshold for ppO2 warning
m_deviceDetails->setPpO2Min(read_ostc_cf(data, 17));
m_deviceDetails->ppO2Min = read_ostc_cf(data, 17);
// CF18: Upper threshold for ppO2 warning
m_deviceDetails->setPpO2Max(read_ostc_cf(data, 18));
m_deviceDetails->ppO2Max = read_ostc_cf(data, 18);
// CF20: Depth sampling rate for Profile storage
m_deviceDetails->setSamplingRate(read_ostc_cf(data, 20));
m_deviceDetails->samplingRate = read_ostc_cf(data, 20);
// CF29: Depth of last decompression stop
m_deviceDetails->setLastDeco(read_ostc_cf(data, 29));
m_deviceDetails->lastDeco = read_ostc_cf(data, 29);
#ifdef DEBUG_OSTC_CF
for (int cf = 0; cf <= 31 && cf <= max_CF; cf++)
@ -1092,7 +1092,7 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
// Logbook version indicator (Not writable!)
// Byte2-3:
// Last Firmware installed, 1st Byte.2nd Byte (e.g. „1.90“) (Not writable!)
m_deviceDetails->setFirmwareVersion(QString::number(data[1]) + "." + QString::number(data[2]));
m_deviceDetails->firmwareVersion = QString::number(data[1]) + "." + QString::number(data[2]);
// Byte4:
// OLED brightness (=0: Eco, =1 High) (Not writable!)
// Byte5-11:
@ -1104,11 +1104,11 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
// Decode the relevant ones
// CF32: Gradient Factor low
m_deviceDetails->setGfLow(read_ostc_cf(data, 32));
m_deviceDetails->gfLow = read_ostc_cf(data, 32);
// CF33: Gradient Factor high
m_deviceDetails->setGfHigh(read_ostc_cf(data, 33));
m_deviceDetails->gfHigh = read_ostc_cf(data, 33);
// CF58: Future time to surface setFutureTTS
m_deviceDetails->setFutureTTS(read_ostc_cf(data, 58));
m_deviceDetails->futureTTS = read_ostc_cf(data, 58);
#ifdef DEBUG_OSTC_CF
for (int cf = 32; cf <= 63 && cf <= max_CF; cf++)
@ -1127,13 +1127,13 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
// Decode the relevant ones
// CF65: Show safety stop
m_deviceDetails->setSafetyStop(read_ostc_cf(data, 65));
m_deviceDetails->safetyStop = read_ostc_cf(data, 65);
// CF67: Alternaitve Gradient Factor low
m_deviceDetails->setAGFLow(read_ostc_cf(data, 67));
m_deviceDetails->aGFLow = read_ostc_cf(data, 67);
// CF68: Alternative Gradient Factor high
m_deviceDetails->setAGFHigh(read_ostc_cf(data, 68));
m_deviceDetails->aGFHigh = read_ostc_cf(data, 68);
// CF69: Allow Gradient Factor change
m_deviceDetails->setAGFSelectable(read_ostc_cf(data, 69));
m_deviceDetails->aGFSelectable = read_ostc_cf(data, 69);
#ifdef DEBUG_OSTC_CF
for (int cf = 64; cf <= 95 && cf <= max_CF; cf++)
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
@ -1155,32 +1155,32 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
return rc;
//Byte5-6:
//Gas 1 default (%O2=21, %He=0)
gas gas1 = m_deviceDetails->gas1();
gas gas1 = m_deviceDetails->gas1;
data[6] = gas1.oxygen;
data[7] = gas1.helium;
//Byte9-10:
//Gas 2 default (%O2=21, %He=0)
gas gas2 = m_deviceDetails->gas2();
gas gas2 = m_deviceDetails->gas2;
data[10] = gas2.oxygen;
data[11] = gas2.helium;
//Byte13-14:
//Gas 3 default (%O2=21, %He=0)
gas gas3 = m_deviceDetails->gas3();
gas gas3 = m_deviceDetails->gas3;
data[14] = gas3.oxygen;
data[15] = gas3.helium;
//Byte17-18:
//Gas 4 default (%O2=21, %He=0)
gas gas4 = m_deviceDetails->gas4();
gas gas4 = m_deviceDetails->gas4;
data[18] = gas4.oxygen;
data[19] = gas4.helium;
//Byte21-22:
//Gas 5 default (%O2=21, %He=0)
gas gas5 = m_deviceDetails->gas5();
gas gas5 = m_deviceDetails->gas5;
data[22] = gas5.oxygen;
data[23] = gas5.helium;
//Byte25-26:
//Gas 6 current (%O2, %He)
data[26] = m_deviceDetails->salinity();
data[26] = m_deviceDetails->salinity;
// Gas types, 0=Disabled, 1=Active, 2=Fist
// Active Gas Flag Register
data[27] = 0;
@ -1217,13 +1217,13 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
// Set gas 1 to first
data[33] = 1;
data[34] = m_deviceDetails->decoType();
data[34] = m_deviceDetails->decoType;
//Byte36:
//Use O2 Sensor Module in CC Modes (0= OFF, 1= ON) (Only available in old OSTC1 - unused for OSTC Mk.2/2N)
//m_deviceDetails->setCcrMode(data[35]);
data[36] = m_deviceDetails->sp1().sp;
data[37] = m_deviceDetails->sp2().sp;
data[38] = m_deviceDetails->sp3().sp;
//m_deviceDetails->ccrMode = data[35];
data[36] = m_deviceDetails->sp1.sp;
data[37] = m_deviceDetails->sp2.sp;
data[38] = m_deviceDetails->sp3.sp;
// Byte41-42:
// Lowest Battery voltage seen (in mV)
// Byte43:
@ -1265,15 +1265,15 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
// Byte66-90:
// (25Bytes): Custom Text for Surfacemode (Real text must end with "}")
// Example: "OSTC Dive Computer}" (19 Characters incl. "}") Bytes 85-90 will be ignored.
if (m_deviceDetails->customText() == "") {
if (m_deviceDetails->customText == "") {
data[64] = 0;
} else {
data[64] = 1;
// Copy the string to the right place in the memory, padded with 0x20 (" ")
strncpy((char *)data + 65, QString("%1").arg(m_deviceDetails->customText(), -23, QChar(' ')).toUtf8().data(), 23);
strncpy((char *)data + 65, QString("%1").arg(m_deviceDetails->customText, -23, QChar(' ')).toUtf8().data(), 23);
// And terminate the string.
if (m_deviceDetails->customText().length() <= 23)
data[65 + m_deviceDetails->customText().length()] = '}';
if (m_deviceDetails->customText.length() <= 23)
data[65 + m_deviceDetails->customText.length()] = '}';
else
data[90] = '}';
}
@ -1284,7 +1284,7 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
// =0: MM/DD/YY
// =1: DD/MM/YY
// =2: YY/MM/DD
data[91] = m_deviceDetails->dateFormat();
data[91] = m_deviceDetails->dateFormat;
// Byte93:
// Total number of CF used in installed firmware
max_CF = data[92];
@ -1296,35 +1296,35 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
// Diluent 1 Default (%O2,%He)
// Byte98-99:
// Diluent 1 Current (%O2,%He)
gas dil1 = m_deviceDetails->dil1();
gas dil1 = m_deviceDetails->dil1;
data[97] = dil1.oxygen;
data[98] = dil1.helium;
// Byte100-101:
// Gasuent 2 Default (%O2,%He)
// Byte102-103:
// Gasuent 2 Current (%O2,%He)
gas dil2 = m_deviceDetails->dil2();
gas dil2 = m_deviceDetails->dil2;
data[101] = dil2.oxygen;
data[102] = dil2.helium;
// Byte104-105:
// Gasuent 3 Default (%O2,%He)
// Byte106-107:
// Gasuent 3 Current (%O2,%He)
gas dil3 = m_deviceDetails->dil3();
gas dil3 = m_deviceDetails->dil3;
data[105] = dil3.oxygen;
data[106] = dil3.helium;
// Byte108-109:
// Gasuent 4 Default (%O2,%He)
// Byte110-111:
// Gasuent 4 Current (%O2,%He)
gas dil4 = m_deviceDetails->dil4();
gas dil4 = m_deviceDetails->dil4;
data[109] = dil4.oxygen;
data[110] = dil4.helium;
// Byte112-113:
// Gasuent 5 Default (%O2,%He)
// Byte114-115:
// Gasuent 5 Current (%O2,%He)
gas dil5 = m_deviceDetails->dil5();
gas dil5 = m_deviceDetails->dil5;
data[113] = dil5.oxygen;
data[114] = dil5.helium;
// Byte116:
@ -1351,17 +1351,17 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
// Write the relevant ones
// CF11: Factor for saturation processes
write_ostc_cf(data, 11, max_CF, m_deviceDetails->saturation());
write_ostc_cf(data, 11, max_CF, m_deviceDetails->saturation);
// CF12: Factor for desaturation processes
write_ostc_cf(data, 12, max_CF, m_deviceDetails->desaturation());
write_ostc_cf(data, 12, max_CF, m_deviceDetails->desaturation);
// CF17: Lower threshold for ppO2 warning
write_ostc_cf(data, 17, max_CF, m_deviceDetails->ppO2Min());
write_ostc_cf(data, 17, max_CF, m_deviceDetails->ppO2Min);
// CF18: Upper threshold for ppO2 warning
write_ostc_cf(data, 18, max_CF, m_deviceDetails->ppO2Max());
write_ostc_cf(data, 18, max_CF, m_deviceDetails->ppO2Max);
// CF20: Depth sampling rate for Profile storage
write_ostc_cf(data, 20, max_CF, m_deviceDetails->samplingRate());
write_ostc_cf(data, 20, max_CF, m_deviceDetails->samplingRate);
// CF29: Depth of last decompression stop
write_ostc_cf(data, 29, max_CF, m_deviceDetails->lastDeco());
write_ostc_cf(data, 29, max_CF, m_deviceDetails->lastDeco);
#ifdef DEBUG_OSTC_CF
for (int cf = 0; cf <= 31 && cf <= max_CF; cf++)
@ -1389,11 +1389,11 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
// Decode the relevant ones
// CF32: Gradient Factor low
write_ostc_cf(data, 32, max_CF, m_deviceDetails->gfLow());
write_ostc_cf(data, 32, max_CF, m_deviceDetails->gfLow);
// CF33: Gradient Factor high
write_ostc_cf(data, 33, max_CF, m_deviceDetails->gfHigh());
write_ostc_cf(data, 33, max_CF, m_deviceDetails->gfHigh);
// CF58: Future time to surface setFutureTTS
write_ostc_cf(data, 58, max_CF, m_deviceDetails->futureTTS());
write_ostc_cf(data, 58, max_CF, m_deviceDetails->futureTTS);
#ifdef DEBUG_OSTC_CF
for (int cf = 32; cf <= 63 && cf <= max_CF; cf++)
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
@ -1414,13 +1414,13 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
// Decode the relevant ones
// CF65: Show safety stop
write_ostc_cf(data, 65, max_CF, m_deviceDetails->safetyStop());
write_ostc_cf(data, 65, max_CF, m_deviceDetails->safetyStop);
// CF67: Alternaitve Gradient Factor low
write_ostc_cf(data, 67, max_CF, m_deviceDetails->aGFLow());
write_ostc_cf(data, 67, max_CF, m_deviceDetails->aGFLow);
// CF68: Alternative Gradient Factor high
write_ostc_cf(data, 68, max_CF, m_deviceDetails->aGFHigh());
write_ostc_cf(data, 68, max_CF, m_deviceDetails->aGFHigh);
// CF69: Allow Gradient Factor change
write_ostc_cf(data, 69, max_CF, m_deviceDetails->aGFSelectable());
write_ostc_cf(data, 69, max_CF, m_deviceDetails->aGFSelectable);
#ifdef DEBUG_OSTC_CF
for (int cf = 64; cf <= 95 && cf <= max_CF; cf++)
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
@ -1430,7 +1430,7 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
return rc;
//sync date and time
if (m_deviceDetails->syncTime()) {
if (m_deviceDetails->syncTime) {
QDateTime timeToSet = QDateTime::currentDateTime();
dc_datetime_t time;
time.year = timeToSet.date().year();

View file

@ -6,665 +6,65 @@ const struct setpoint zero_setpoint = {0};
DeviceDetails::DeviceDetails(QObject *parent) :
QObject(parent),
m_data(0),
m_serialNo(""),
m_firmwareVersion(""),
m_customText(""),
m_model(""),
m_syncTime(false),
m_gas1(zero_gas),
m_gas2(zero_gas),
m_gas3(zero_gas),
m_gas4(zero_gas),
m_gas5(zero_gas),
m_dil1(zero_gas),
m_dil2(zero_gas),
m_dil3(zero_gas),
m_dil4(zero_gas),
m_dil5(zero_gas),
m_sp1(zero_setpoint),
m_sp2(zero_setpoint),
m_sp3(zero_setpoint),
m_sp4(zero_setpoint),
m_sp5(zero_setpoint),
m_setPointFallback(0),
m_ccrMode(0),
m_calibrationGas(0),
m_diveMode(0),
m_decoType(0),
m_ppO2Max(0),
m_ppO2Min(0),
m_futureTTS(0),
m_gfLow(0),
m_gfHigh(0),
m_aGFLow(0),
m_aGFHigh(0),
m_aGFSelectable(0),
m_saturation(0),
m_desaturation(0),
m_lastDeco(0),
m_brightness(0),
m_units(0),
m_samplingRate(0),
m_salinity(0),
m_diveModeColor(0),
m_language(0),
m_dateFormat(0),
m_compassGain(0),
m_pressureSensorOffset(0),
m_flipScreen(0),
m_safetyStop(0),
m_maxDepth(0),
m_totalTime(0),
m_numberOfDives(0),
m_altitude(0),
m_personalSafety(0),
m_timeFormat(0),
m_lightEnabled(false),
m_light(0),
m_alarmTimeEnabled(false),
m_alarmTime(0),
m_alarmDepthEnabled(false),
m_alarmDepth(0)
data(0),
serialNo(""),
firmwareVersion(""),
customText(""),
model(""),
syncTime(false),
gas1(zero_gas),
gas2(zero_gas),
gas3(zero_gas),
gas4(zero_gas),
gas5(zero_gas),
dil1(zero_gas),
dil2(zero_gas),
dil3(zero_gas),
dil4(zero_gas),
dil5(zero_gas),
sp1(zero_setpoint),
sp2(zero_setpoint),
sp3(zero_setpoint),
sp4(zero_setpoint),
sp5(zero_setpoint),
setPointFallback(0),
ccrMode(0),
calibrationGas(0),
diveMode(0),
decoType(0),
ppO2Max(0),
ppO2Min(0),
futureTTS(0),
gfLow(0),
gfHigh(0),
aGFLow(0),
aGFHigh(0),
aGFSelectable(0),
saturation(0),
desaturation(0),
lastDeco(0),
brightness(0),
units(0),
samplingRate(0),
salinity(0),
diveModeColor(0),
language(0),
dateFormat(0),
compassGain(0),
pressureSensorOffset(0),
flipScreen(0),
safetyStop(0),
maxDepth(0),
totalTime(0),
numberOfDives(0),
altitude(0),
personalSafety(0),
timeFormat(0),
lightEnabled(false),
light(0),
alarmTimeEnabled(false),
alarmTime(0),
alarmDepthEnabled(false),
alarmDepth(0)
{
}
device_data_t *DeviceDetails::data() const
{
return m_data;
}
void DeviceDetails::setData(device_data_t *data)
{
m_data = data;
}
QString DeviceDetails::serialNo() const
{
return m_serialNo;
}
void DeviceDetails::setSerialNo(const QString &serialNo)
{
m_serialNo = serialNo;
}
QString DeviceDetails::firmwareVersion() const
{
return m_firmwareVersion;
}
void DeviceDetails::setFirmwareVersion(const QString &firmwareVersion)
{
m_firmwareVersion = firmwareVersion;
}
QString DeviceDetails::customText() const
{
return m_customText;
}
void DeviceDetails::setCustomText(const QString &customText)
{
m_customText = customText;
}
QString DeviceDetails::model() const
{
return m_model;
}
void DeviceDetails::setModel(const QString &model)
{
m_model = model;
}
int DeviceDetails::brightness() const
{
return m_brightness;
}
void DeviceDetails::setBrightness(int brightness)
{
m_brightness = brightness;
}
int DeviceDetails::diveModeColor() const
{
return m_diveModeColor;
}
void DeviceDetails::setDiveModeColor(int diveModeColor)
{
m_diveModeColor = diveModeColor;
}
int DeviceDetails::language() const
{
return m_language;
}
void DeviceDetails::setLanguage(int language)
{
m_language = language;
}
int DeviceDetails::dateFormat() const
{
return m_dateFormat;
}
void DeviceDetails::setDateFormat(int dateFormat)
{
m_dateFormat = dateFormat;
}
int DeviceDetails::lastDeco() const
{
return m_lastDeco;
}
void DeviceDetails::setLastDeco(int lastDeco)
{
m_lastDeco = lastDeco;
}
bool DeviceDetails::syncTime() const
{
return m_syncTime;
}
void DeviceDetails::setSyncTime(bool syncTime)
{
m_syncTime = syncTime;
}
gas DeviceDetails::gas1() const
{
return m_gas1;
}
void DeviceDetails::setGas1(const gas &gas1)
{
m_gas1 = gas1;
}
gas DeviceDetails::gas2() const
{
return m_gas2;
}
void DeviceDetails::setGas2(const gas &gas2)
{
m_gas2 = gas2;
}
gas DeviceDetails::gas3() const
{
return m_gas3;
}
void DeviceDetails::setGas3(const gas &gas3)
{
m_gas3 = gas3;
}
gas DeviceDetails::gas4() const
{
return m_gas4;
}
void DeviceDetails::setGas4(const gas &gas4)
{
m_gas4 = gas4;
}
gas DeviceDetails::gas5() const
{
return m_gas5;
}
void DeviceDetails::setGas5(const gas &gas5)
{
m_gas5 = gas5;
}
gas DeviceDetails::dil1() const
{
return m_dil1;
}
void DeviceDetails::setDil1(const gas &dil1)
{
m_dil1 = dil1;
}
gas DeviceDetails::dil2() const
{
return m_dil2;
}
void DeviceDetails::setDil2(const gas &dil2)
{
m_dil2 = dil2;
}
gas DeviceDetails::dil3() const
{
return m_dil3;
}
void DeviceDetails::setDil3(const gas &dil3)
{
m_dil3 = dil3;
}
gas DeviceDetails::dil4() const
{
return m_dil4;
}
void DeviceDetails::setDil4(const gas &dil4)
{
m_dil4 = dil4;
}
gas DeviceDetails::dil5() const
{
return m_dil5;
}
void DeviceDetails::setDil5(const gas &dil5)
{
m_dil5 = dil5;
}
setpoint DeviceDetails::sp1() const
{
return m_sp1;
}
void DeviceDetails::setSp1(const setpoint &sp1)
{
m_sp1 = sp1;
}
setpoint DeviceDetails::sp2() const
{
return m_sp2;
}
void DeviceDetails::setSp2(const setpoint &sp2)
{
m_sp2 = sp2;
}
setpoint DeviceDetails::sp3() const
{
return m_sp3;
}
void DeviceDetails::setSp3(const setpoint &sp3)
{
m_sp3 = sp3;
}
setpoint DeviceDetails::sp4() const
{
return m_sp4;
}
void DeviceDetails::setSp4(const setpoint &sp4)
{
m_sp4 = sp4;
}
setpoint DeviceDetails::sp5() const
{
return m_sp5;
}
void DeviceDetails::setSp5(const setpoint &sp5)
{
m_sp5 = sp5;
}
bool DeviceDetails::setPointFallback() const
{
return m_setPointFallback;
}
void DeviceDetails::setSetPointFallback(bool setSetPointFallback)
{
m_setPointFallback = setSetPointFallback;
}
int DeviceDetails::ccrMode() const
{
return m_ccrMode;
}
void DeviceDetails::setCcrMode(int ccrMode)
{
m_ccrMode = ccrMode;
}
int DeviceDetails::calibrationGas() const
{
return m_calibrationGas;
}
void DeviceDetails::setCalibrationGas(int calibrationGas)
{
m_calibrationGas = calibrationGas;
}
int DeviceDetails::diveMode() const
{
return m_diveMode;
}
void DeviceDetails::setDiveMode(int diveMode)
{
m_diveMode = diveMode;
}
int DeviceDetails::decoType() const
{
return m_decoType;
}
void DeviceDetails::setDecoType(int decoType)
{
m_decoType = decoType;
}
int DeviceDetails::ppO2Max() const
{
return m_ppO2Max;
}
void DeviceDetails::setPpO2Max(int ppO2Max)
{
m_ppO2Max = ppO2Max;
}
int DeviceDetails::ppO2Min() const
{
return m_ppO2Min;
}
void DeviceDetails::setPpO2Min(int ppO2Min)
{
m_ppO2Min = ppO2Min;
}
int DeviceDetails::futureTTS() const
{
return m_futureTTS;
}
void DeviceDetails::setFutureTTS(int futureTTS)
{
m_futureTTS = futureTTS;
}
int DeviceDetails::gfLow() const
{
return m_gfLow;
}
void DeviceDetails::setGfLow(int gfLow)
{
m_gfLow = gfLow;
}
int DeviceDetails::gfHigh() const
{
return m_gfHigh;
}
void DeviceDetails::setGfHigh(int gfHigh)
{
m_gfHigh = gfHigh;
}
int DeviceDetails::aGFLow() const
{
return m_aGFLow;
}
void DeviceDetails::setAGFLow(int aGFLow)
{
m_aGFLow = aGFLow;
}
int DeviceDetails::aGFHigh() const
{
return m_aGFHigh;
}
void DeviceDetails::setAGFHigh(int aGFHigh)
{
m_aGFHigh = aGFHigh;
}
int DeviceDetails::aGFSelectable() const
{
return m_aGFSelectable;
}
void DeviceDetails::setAGFSelectable(int aGFSelectable)
{
m_aGFSelectable = aGFSelectable;
}
int DeviceDetails::saturation() const
{
return m_saturation;
}
void DeviceDetails::setSaturation(int saturation)
{
m_saturation = saturation;
}
int DeviceDetails::desaturation() const
{
return m_desaturation;
}
void DeviceDetails::setDesaturation(int desaturation)
{
m_desaturation = desaturation;
}
int DeviceDetails::units() const
{
return m_units;
}
void DeviceDetails::setUnits(int units)
{
m_units = units;
}
int DeviceDetails::samplingRate() const
{
return m_samplingRate;
}
void DeviceDetails::setSamplingRate(int samplingRate)
{
m_samplingRate = samplingRate;
}
int DeviceDetails::salinity() const
{
return m_salinity;
}
void DeviceDetails::setSalinity(int salinity)
{
m_salinity = salinity;
}
int DeviceDetails::compassGain() const
{
return m_compassGain;
}
void DeviceDetails::setCompassGain(int compassGain)
{
m_compassGain = compassGain;
}
int DeviceDetails::pressureSensorOffset() const
{
return m_pressureSensorOffset;
}
void DeviceDetails::setPressureSensorOffset(int pressureSensorOffset)
{
m_pressureSensorOffset = pressureSensorOffset;
}
bool DeviceDetails::flipScreen() const
{
return m_flipScreen;
}
void DeviceDetails::setFlipScreen(bool flipScreen)
{
m_flipScreen = flipScreen;
}
bool DeviceDetails::safetyStop() const
{
return m_safetyStop;
}
void DeviceDetails::setSafetyStop(bool safetyStop)
{
m_safetyStop = safetyStop;
}
int DeviceDetails::maxDepth() const
{
return m_maxDepth;
}
void DeviceDetails::setMaxDepth(int maxDepth)
{
m_maxDepth = maxDepth;
}
int DeviceDetails::totalTime() const
{
return m_totalTime;
}
void DeviceDetails::setTotalTime(int totalTime)
{
m_totalTime = totalTime;
}
int DeviceDetails::numberOfDives() const
{
return m_numberOfDives;
}
void DeviceDetails::setNumberOfDives(int numberOfDives)
{
m_numberOfDives = numberOfDives;
}
int DeviceDetails::altitude() const
{
return m_altitude;
}
void DeviceDetails::setAltitude(int altitude)
{
m_altitude = altitude;
}
int DeviceDetails::personalSafety() const
{
return m_personalSafety;
}
void DeviceDetails::setPersonalSafety(int personalSafety)
{
m_personalSafety = personalSafety;
}
int DeviceDetails::timeFormat() const
{
return m_timeFormat;
}
void DeviceDetails::setTimeFormat(int timeFormat)
{
m_timeFormat = timeFormat;
}
bool DeviceDetails::lightEnabled() const
{
return m_lightEnabled;
}
void DeviceDetails::setLightEnabled(bool lightEnabled)
{
m_lightEnabled = lightEnabled;
}
int DeviceDetails::light() const
{
return m_light;
}
void DeviceDetails::setLight(int light)
{
m_light = light;
}
bool DeviceDetails::alarmTimeEnabled() const
{
return m_alarmTimeEnabled;
}
void DeviceDetails::setAlarmTimeEnabled(bool alarmTimeEnabled)
{
m_alarmTimeEnabled = alarmTimeEnabled;
}
int DeviceDetails::alarmTime() const
{
return m_alarmTime;
}
void DeviceDetails::setAlarmTime(int alarmTime)
{
m_alarmTime = alarmTime;
}
bool DeviceDetails::alarmDepthEnabled() const
{
return m_alarmDepthEnabled;
}
void DeviceDetails::setAlarmDepthEnabled(bool alarmDepthEnabled)
{
m_alarmDepthEnabled = alarmDepthEnabled;
}
int DeviceDetails::alarmDepth() const
{
return m_alarmDepth;
}
void DeviceDetails::setAlarmDepth(int alarmDepth)
{
m_alarmDepth = alarmDepth;
}

View file

@ -23,247 +23,66 @@ class DeviceDetails : public QObject
public:
explicit DeviceDetails(QObject *parent = 0);
device_data_t *data() const;
void setData(device_data_t *data);
QString serialNo() const;
void setSerialNo(const QString &serialNo);
QString firmwareVersion() const;
void setFirmwareVersion(const QString &firmwareVersion);
QString customText() const;
void setCustomText(const QString &customText);
QString model() const;
void setModel(const QString &model);
int brightness() const;
void setBrightness(int brightness);
int diveModeColor() const;
void setDiveModeColor(int diveModeColor);
int language() const;
void setLanguage(int language);
int dateFormat() const;
void setDateFormat(int dateFormat);
int lastDeco() const;
void setLastDeco(int lastDeco);
bool syncTime() const;
void setSyncTime(bool syncTime);
gas gas1() const;
void setGas1(const gas &gas1);
gas gas2() const;
void setGas2(const gas &gas2);
gas gas3() const;
void setGas3(const gas &gas3);
gas gas4() const;
void setGas4(const gas &gas4);
gas gas5() const;
void setGas5(const gas &gas5);
gas dil1() const;
void setDil1(const gas &dil1);
gas dil2() const;
void setDil2(const gas &dil2);
gas dil3() const;
void setDil3(const gas &dil3);
gas dil4() const;
void setDil4(const gas &dil4);
gas dil5() const;
void setDil5(const gas &dil5);
setpoint sp1() const;
void setSp1(const setpoint &sp1);
setpoint sp2() const;
void setSp2(const setpoint &sp2);
setpoint sp3() const;
void setSp3(const setpoint &sp3);
setpoint sp4() const;
void setSp4(const setpoint &sp4);
setpoint sp5() const;
void setSp5(const setpoint &sp5);
bool setPointFallback() const;
void setSetPointFallback(bool setSetPointFallback);
int ccrMode() const;
void setCcrMode(int ccrMode);
int calibrationGas() const;
void setCalibrationGas(int calibrationGas);
int diveMode() const;
void setDiveMode(int diveMode);
int decoType() const;
void setDecoType(int decoType);
int ppO2Max() const;
void setPpO2Max(int ppO2Max);
int ppO2Min() const;
void setPpO2Min(int ppO2Min);
int futureTTS() const;
void setFutureTTS(int futureTTS);
int gfLow() const;
void setGfLow(int gfLow);
int gfHigh() const;
void setGfHigh(int gfHigh);
int aGFLow() const;
void setAGFLow(int aGFLow);
int aGFHigh() const;
void setAGFHigh(int aGFHigh);
int aGFSelectable() const;
void setAGFSelectable(int aGFSelectable);
int saturation() const;
void setSaturation(int saturation);
int desaturation() const;
void setDesaturation(int desaturation);
int units() const;
void setUnits(int units);
int samplingRate() const;
void setSamplingRate(int samplingRate);
int salinity() const;
void setSalinity(int salinity);
int compassGain() const;
void setCompassGain(int compassGain);
int pressureSensorOffset() const;
void setPressureSensorOffset(int pressureSensorOffset);
bool flipScreen() const;
void setFlipScreen(bool flipScreen);
bool safetyStop() const;
void setSafetyStop(bool safetyStop);
int maxDepth() const;
void setMaxDepth(int maxDepth);
int totalTime() const;
void setTotalTime(int totalTime);
int numberOfDives() const;
void setNumberOfDives(int numberOfDives);
int altitude() const;
void setAltitude(int altitude);
int personalSafety() const;
void setPersonalSafety(int personalSafety);
int timeFormat() const;
void setTimeFormat(int timeFormat);
bool lightEnabled() const;
void setLightEnabled(bool lightEnabled);
int light() const;
void setLight(int light);
bool alarmTimeEnabled() const;
void setAlarmTimeEnabled(bool alarmTimeEnabled);
int alarmTime() const;
void setAlarmTime(int alarmTime);
bool alarmDepthEnabled() const;
void setAlarmDepthEnabled(bool alarmDepthEnabled);
int alarmDepth() const;
void setAlarmDepth(int alarmDepth);
private:
device_data_t *m_data;
QString m_serialNo;
QString m_firmwareVersion;
QString m_customText;
QString m_model;
bool m_syncTime;
gas m_gas1;
gas m_gas2;
gas m_gas3;
gas m_gas4;
gas m_gas5;
gas m_dil1;
gas m_dil2;
gas m_dil3;
gas m_dil4;
gas m_dil5;
setpoint m_sp1;
setpoint m_sp2;
setpoint m_sp3;
setpoint m_sp4;
setpoint m_sp5;
bool m_setPointFallback;
int m_ccrMode;
int m_calibrationGas;
int m_diveMode;
int m_decoType;
int m_ppO2Max;
int m_ppO2Min;
int m_futureTTS;
int m_gfLow;
int m_gfHigh;
int m_aGFLow;
int m_aGFHigh;
int m_aGFSelectable;
int m_saturation;
int m_desaturation;
int m_lastDeco;
int m_brightness;
int m_units;
int m_samplingRate;
int m_salinity;
int m_diveModeColor;
int m_language;
int m_dateFormat;
int m_compassGain;
int m_pressureSensorOffset;
bool m_flipScreen;
bool m_safetyStop;
int m_maxDepth;
int m_totalTime;
int m_numberOfDives;
int m_altitude;
int m_personalSafety;
int m_timeFormat;
bool m_lightEnabled;
int m_light;
bool m_alarmTimeEnabled;
int m_alarmTime;
bool m_alarmDepthEnabled;
int m_alarmDepth;
device_data_t *data;
QString serialNo;
QString firmwareVersion;
QString customText;
QString model;
bool syncTime;
gas gas1;
gas gas2;
gas gas3;
gas gas4;
gas gas5;
gas dil1;
gas dil2;
gas dil3;
gas dil4;
gas dil5;
setpoint sp1;
setpoint sp2;
setpoint sp3;
setpoint sp4;
setpoint sp5;
bool setPointFallback;
int ccrMode;
int calibrationGas;
int diveMode;
int decoType;
int ppO2Max;
int ppO2Min;
int futureTTS;
int gfLow;
int gfHigh;
int aGFLow;
int aGFHigh;
int aGFSelectable;
int saturation;
int desaturation;
int lastDeco;
int brightness;
int units;
int samplingRate;
int salinity;
int diveModeColor;
int language;
int dateFormat;
int compassGain;
int pressureSensorOffset;
bool flipScreen;
bool safetyStop;
int maxDepth;
int totalTime;
int numberOfDives;
int altitude;
int personalSafety;
int timeFormat;
bool lightEnabled;
int light;
bool alarmTimeEnabled;
int alarmTime;
bool alarmDepthEnabled;
int alarmDepth;
};

View file

@ -403,35 +403,35 @@ void ConfigureDiveComputerDialog::populateDeviceDetails()
void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3()
{
deviceDetails->setCustomText(ui.customTextLlineEdit->text());
deviceDetails->setDiveMode(ui.diveModeComboBox->currentIndex());
deviceDetails->setSaturation(ui.saturationSpinBox->value());
deviceDetails->setDesaturation(ui.desaturationSpinBox->value());
deviceDetails->setLastDeco(ui.lastDecoSpinBox->value());
deviceDetails->setBrightness(ui.brightnessComboBox->currentIndex());
deviceDetails->setUnits(ui.unitsComboBox->currentIndex());
deviceDetails->setSamplingRate(ui.samplingRateComboBox->currentIndex());
deviceDetails->setSalinity(ui.salinitySpinBox->value());
deviceDetails->setDiveModeColor(ui.diveModeColour->currentIndex());
deviceDetails->setLanguage(ui.languageComboBox->currentIndex());
deviceDetails->setDateFormat(ui.dateFormatComboBox->currentIndex());
deviceDetails->setCompassGain(ui.compassGainComboBox->currentIndex());
deviceDetails->setSyncTime(ui.dateTimeSyncCheckBox->isChecked());
deviceDetails->setSafetyStop(ui.safetyStopCheckBox->isChecked());
deviceDetails->setGfHigh(ui.gfHighSpinBox->value());
deviceDetails->setGfLow(ui.gfLowSpinBox->value());
deviceDetails->setPressureSensorOffset(ui.pressureSensorOffsetSpinBox->value());
deviceDetails->setPpO2Min(ui.ppO2MinSpinBox->value());
deviceDetails->setPpO2Max(ui.ppO2MaxSpinBox->value());
deviceDetails->setFutureTTS(ui.futureTTSSpinBox->value());
deviceDetails->setCcrMode(ui.ccrModeComboBox->currentIndex());
deviceDetails->setDecoType(ui.decoTypeComboBox->currentIndex());
deviceDetails->setAGFSelectable(ui.aGFSelectableCheckBox->isChecked());
deviceDetails->setAGFHigh(ui.aGFHighSpinBox->value());
deviceDetails->setAGFLow(ui.aGFLowSpinBox->value());
deviceDetails->setCalibrationGas(ui.calibrationGasSpinBox->value());
deviceDetails->setFlipScreen(ui.flipScreenCheckBox->isChecked());
deviceDetails->setSetPointFallback(ui.setPointFallbackCheckBox->isChecked());
deviceDetails->customText = ui.customTextLlineEdit->text();
deviceDetails->diveMode = ui.diveModeComboBox->currentIndex();
deviceDetails->saturation = ui.saturationSpinBox->value();
deviceDetails->desaturation = ui.desaturationSpinBox->value();
deviceDetails->lastDeco = ui.lastDecoSpinBox->value();
deviceDetails->brightness = ui.brightnessComboBox->currentIndex();
deviceDetails->units = ui.unitsComboBox->currentIndex();
deviceDetails->samplingRate = ui.samplingRateComboBox->currentIndex();
deviceDetails->salinity = ui.salinitySpinBox->value();
deviceDetails->diveModeColor = ui.diveModeColour->currentIndex();
deviceDetails->language = ui.languageComboBox->currentIndex();
deviceDetails->dateFormat = ui.dateFormatComboBox->currentIndex();
deviceDetails->compassGain = ui.compassGainComboBox->currentIndex();
deviceDetails->syncTime = ui.dateTimeSyncCheckBox->isChecked();
deviceDetails->safetyStop = ui.safetyStopCheckBox->isChecked();
deviceDetails->gfHigh = ui.gfHighSpinBox->value();
deviceDetails->gfLow = ui.gfLowSpinBox->value();
deviceDetails->pressureSensorOffset = ui.pressureSensorOffsetSpinBox->value();
deviceDetails->ppO2Min = ui.ppO2MinSpinBox->value();
deviceDetails->ppO2Max = ui.ppO2MaxSpinBox->value();
deviceDetails->futureTTS = ui.futureTTSSpinBox->value();
deviceDetails->ccrMode = ui.ccrModeComboBox->currentIndex();
deviceDetails->decoType = ui.decoTypeComboBox->currentIndex();
deviceDetails->aGFSelectable = ui.aGFSelectableCheckBox->isChecked();
deviceDetails->aGFHigh = ui.aGFHighSpinBox->value();
deviceDetails->aGFLow = ui.aGFLowSpinBox->value();
deviceDetails->calibrationGas = ui.calibrationGasSpinBox->value();
deviceDetails->flipScreen = ui.flipScreenCheckBox->isChecked();
deviceDetails->setPointFallback = ui.setPointFallbackCheckBox->isChecked();
//set gas values
gas gas1;
@ -465,11 +465,11 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3()
gas5.type = GET_INT_FROM(ui.ostc3GasTable->item(4, 3), 0);
gas5.depth = GET_INT_FROM(ui.ostc3GasTable->item(4, 4), 0);
deviceDetails->setGas1(gas1);
deviceDetails->setGas2(gas2);
deviceDetails->setGas3(gas3);
deviceDetails->setGas4(gas4);
deviceDetails->setGas5(gas5);
deviceDetails->gas1 = gas1;
deviceDetails->gas2 = gas2;
deviceDetails->gas3 = gas3;
deviceDetails->gas4 = gas4;
deviceDetails->gas5 = gas5;
//set dil values
gas dil1;
@ -503,11 +503,11 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3()
dil5.type = GET_INT_FROM(ui.ostc3DilTable->item(4, 3), 0);
dil5.depth = GET_INT_FROM(ui.ostc3DilTable->item(4, 4), 0);
deviceDetails->setDil1(dil1);
deviceDetails->setDil2(dil2);
deviceDetails->setDil3(dil3);
deviceDetails->setDil4(dil4);
deviceDetails->setDil5(dil5);
deviceDetails->dil1 = dil1;
deviceDetails->dil2 = dil2;
deviceDetails->dil3 = dil3;
deviceDetails->dil4 = dil4;
deviceDetails->dil5 = dil5;
//set set point details
setpoint sp1;
@ -531,33 +531,33 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3()
sp5.sp = GET_INT_FROM(ui.ostc3SetPointTable->item(4, 1), 140);
sp5.depth = GET_INT_FROM(ui.ostc3SetPointTable->item(4, 2), 70);
deviceDetails->setSp1(sp1);
deviceDetails->setSp2(sp2);
deviceDetails->setSp3(sp3);
deviceDetails->setSp4(sp4);
deviceDetails->setSp5(sp5);
deviceDetails->sp1 = sp1;
deviceDetails->sp2 = sp2;
deviceDetails->sp3 = sp3;
deviceDetails->sp4 = sp4;
deviceDetails->sp5 = sp5;
}
void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC()
{
deviceDetails->setCustomText(ui.customTextLlineEdit_3->text());
deviceDetails->setSaturation(ui.saturationSpinBox_3->value());
deviceDetails->setDesaturation(ui.desaturationSpinBox_3->value());
deviceDetails->setLastDeco(ui.lastDecoSpinBox_3->value());
deviceDetails->setSamplingRate(ui.samplingRateSpinBox_3->value());
deviceDetails->setSalinity(ui.salinityDoubleSpinBox_3->value() * 100);
deviceDetails->setDateFormat(ui.dateFormatComboBox_3->currentIndex());
deviceDetails->setSyncTime(ui.dateTimeSyncCheckBox_3->isChecked());
deviceDetails->setSafetyStop(ui.safetyStopCheckBox_3->isChecked());
deviceDetails->setGfHigh(ui.gfHighSpinBox_3->value());
deviceDetails->setGfLow(ui.gfLowSpinBox_3->value());
deviceDetails->setPpO2Min(ui.ppO2MinSpinBox_3->value());
deviceDetails->setPpO2Max(ui.ppO2MaxSpinBox_3->value());
deviceDetails->setFutureTTS(ui.futureTTSSpinBox_3->value());
deviceDetails->setDecoType(ui.decoTypeComboBox_3->currentIndex());
deviceDetails->setAGFSelectable(ui.aGFSelectableCheckBox_3->isChecked());
deviceDetails->setAGFHigh(ui.aGFHighSpinBox_3->value());
deviceDetails->setAGFLow(ui.aGFLowSpinBox_3->value());
deviceDetails->customText = ui.customTextLlineEdit_3->text();
deviceDetails->saturation = ui.saturationSpinBox_3->value();
deviceDetails->desaturation = ui.desaturationSpinBox_3->value();
deviceDetails->lastDeco = ui.lastDecoSpinBox_3->value();
deviceDetails->samplingRate = ui.samplingRateSpinBox_3->value();
deviceDetails->salinity = ui.salinityDoubleSpinBox_3->value() * 100;
deviceDetails->dateFormat = ui.dateFormatComboBox_3->currentIndex();
deviceDetails->syncTime = ui.dateTimeSyncCheckBox_3->isChecked();
deviceDetails->safetyStop = ui.safetyStopCheckBox_3->isChecked();
deviceDetails->gfHigh = ui.gfHighSpinBox_3->value();
deviceDetails->gfLow = ui.gfLowSpinBox_3->value();
deviceDetails->ppO2Min = ui.ppO2MinSpinBox_3->value();
deviceDetails->ppO2Max = ui.ppO2MaxSpinBox_3->value();
deviceDetails->futureTTS = ui.futureTTSSpinBox_3->value();
deviceDetails->decoType = ui.decoTypeComboBox_3->currentIndex();
deviceDetails->aGFSelectable = ui.aGFSelectableCheckBox_3->isChecked();
deviceDetails->aGFHigh = ui.aGFHighSpinBox_3->value();
deviceDetails->aGFLow = ui.aGFLowSpinBox_3->value();
//set gas values
gas gas1;
@ -591,11 +591,11 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC()
gas5.type = GET_INT_FROM(ui.ostcGasTable->item(4, 3), 0);
gas5.depth = GET_INT_FROM(ui.ostcGasTable->item(4, 4), 0);
deviceDetails->setGas1(gas1);
deviceDetails->setGas2(gas2);
deviceDetails->setGas3(gas3);
deviceDetails->setGas4(gas4);
deviceDetails->setGas5(gas5);
deviceDetails->gas1 = gas1;
deviceDetails->gas2 = gas2;
deviceDetails->gas3 = gas3;
deviceDetails->gas4 = gas4;
deviceDetails->gas5 = gas5;
//set dil values
gas dil1;
@ -629,11 +629,11 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC()
dil5.type = GET_INT_FROM(ui.ostcDilTable->item(4, 3), 0);
dil5.depth = GET_INT_FROM(ui.ostcDilTable->item(4, 4), 0);
deviceDetails->setDil1(dil1);
deviceDetails->setDil2(dil2);
deviceDetails->setDil3(dil3);
deviceDetails->setDil4(dil4);
deviceDetails->setDil5(dil5);
deviceDetails->dil1 = dil1;
deviceDetails->dil2 = dil2;
deviceDetails->dil3 = dil3;
deviceDetails->dil4 = dil4;
deviceDetails->dil5 = dil5;
//set set point details
setpoint sp1;
@ -657,28 +657,28 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC()
sp5.sp = GET_INT_FROM(ui.ostcSetPointTable->item(4, 1), 140);
sp5.depth = GET_INT_FROM(ui.ostcSetPointTable->item(4, 2), 70);
deviceDetails->setSp1(sp1);
deviceDetails->setSp2(sp2);
deviceDetails->setSp3(sp3);
deviceDetails->setSp4(sp4);
deviceDetails->setSp5(sp5);
deviceDetails->sp1 = sp1;
deviceDetails->sp2 = sp2;
deviceDetails->sp3 = sp3;
deviceDetails->sp4 = sp4;
deviceDetails->sp5 = sp5;
}
void ConfigureDiveComputerDialog::populateDeviceDetailsSuuntoVyper()
{
deviceDetails->setCustomText(ui.customTextLlineEdit_1->text());
deviceDetails->setSamplingRate(ui.samplingRateComboBox_1->currentIndex() == 3 ? 60 : (ui.samplingRateComboBox_1->currentIndex() + 1) * 10);
deviceDetails->setAltitude(ui.altitudeRangeComboBox->currentIndex());
deviceDetails->setPersonalSafety(ui.personalSafetyComboBox->currentIndex());
deviceDetails->setTimeFormat(ui.timeFormatComboBox->currentIndex());
deviceDetails->setUnits(ui.unitsComboBox_1->currentIndex());
deviceDetails->setDiveMode(ui.diveModeComboBox_1->currentIndex());
deviceDetails->setLightEnabled(ui.lightCheckBox->isChecked());
deviceDetails->setLight(ui.lightSpinBox->value());
deviceDetails->setAlarmDepthEnabled(ui.alarmDepthCheckBox->isChecked());
deviceDetails->setAlarmDepth(units_to_depth(ui.alarmDepthDoubleSpinBox->value()));
deviceDetails->setAlarmTimeEnabled(ui.alarmTimeCheckBox->isChecked());
deviceDetails->setAlarmTime(ui.alarmTimeSpinBox->value());
deviceDetails->customText = ui.customTextLlineEdit_1->text();
deviceDetails->samplingRate = ui.samplingRateComboBox_1->currentIndex() == 3 ? 60 : (ui.samplingRateComboBox_1->currentIndex() + 1) * 10;
deviceDetails->altitude = ui.altitudeRangeComboBox->currentIndex();
deviceDetails->personalSafety = ui.personalSafetyComboBox->currentIndex();
deviceDetails->timeFormat = ui.timeFormatComboBox->currentIndex();
deviceDetails->units = ui.unitsComboBox_1->currentIndex();
deviceDetails->diveMode = ui.diveModeComboBox_1->currentIndex();
deviceDetails->lightEnabled = ui.lightCheckBox->isChecked();
deviceDetails->light = ui.lightSpinBox->value();
deviceDetails->alarmDepthEnabled = ui.alarmDepthCheckBox->isChecked();
deviceDetails->alarmDepth = units_to_depth(ui.alarmDepthDoubleSpinBox->value());
deviceDetails->alarmTimeEnabled = ui.alarmTimeCheckBox->isChecked();
deviceDetails->alarmTime = ui.alarmTimeSpinBox->value();
}
void ConfigureDiveComputerDialog::readSettings()
@ -766,116 +766,116 @@ void ConfigureDiveComputerDialog::reloadValues()
void ConfigureDiveComputerDialog::reloadValuesOSTC3()
{
ui.serialNoLineEdit->setText(deviceDetails->serialNo());
ui.firmwareVersionLineEdit->setText(deviceDetails->firmwareVersion());
ui.customTextLlineEdit->setText(deviceDetails->customText());
ui.diveModeComboBox->setCurrentIndex(deviceDetails->diveMode());
ui.saturationSpinBox->setValue(deviceDetails->saturation());
ui.desaturationSpinBox->setValue(deviceDetails->desaturation());
ui.lastDecoSpinBox->setValue(deviceDetails->lastDeco());
ui.brightnessComboBox->setCurrentIndex(deviceDetails->brightness());
ui.unitsComboBox->setCurrentIndex(deviceDetails->units());
ui.samplingRateComboBox->setCurrentIndex(deviceDetails->samplingRate());
ui.salinitySpinBox->setValue(deviceDetails->salinity());
ui.diveModeColour->setCurrentIndex(deviceDetails->diveModeColor());
ui.languageComboBox->setCurrentIndex(deviceDetails->language());
ui.dateFormatComboBox->setCurrentIndex(deviceDetails->dateFormat());
ui.compassGainComboBox->setCurrentIndex(deviceDetails->compassGain());
ui.safetyStopCheckBox->setChecked(deviceDetails->safetyStop());
ui.gfHighSpinBox->setValue(deviceDetails->gfHigh());
ui.gfLowSpinBox->setValue(deviceDetails->gfLow());
ui.pressureSensorOffsetSpinBox->setValue(deviceDetails->pressureSensorOffset());
ui.ppO2MinSpinBox->setValue(deviceDetails->ppO2Min());
ui.ppO2MaxSpinBox->setValue(deviceDetails->ppO2Max());
ui.futureTTSSpinBox->setValue(deviceDetails->futureTTS());
ui.ccrModeComboBox->setCurrentIndex(deviceDetails->ccrMode());
ui.decoTypeComboBox->setCurrentIndex(deviceDetails->decoType());
ui.aGFSelectableCheckBox->setChecked(deviceDetails->aGFSelectable());
ui.aGFHighSpinBox->setValue(deviceDetails->aGFHigh());
ui.aGFLowSpinBox->setValue(deviceDetails->aGFLow());
ui.calibrationGasSpinBox->setValue(deviceDetails->calibrationGas());
ui.flipScreenCheckBox->setChecked(deviceDetails->flipScreen());
ui.setPointFallbackCheckBox->setChecked(deviceDetails->setPointFallback());
ui.serialNoLineEdit->setText(deviceDetails->serialNo);
ui.firmwareVersionLineEdit->setText(deviceDetails->firmwareVersion);
ui.customTextLlineEdit->setText(deviceDetails->customText);
ui.diveModeComboBox->setCurrentIndex(deviceDetails->diveMode);
ui.saturationSpinBox->setValue(deviceDetails->saturation);
ui.desaturationSpinBox->setValue(deviceDetails->desaturation);
ui.lastDecoSpinBox->setValue(deviceDetails->lastDeco);
ui.brightnessComboBox->setCurrentIndex(deviceDetails->brightness);
ui.unitsComboBox->setCurrentIndex(deviceDetails->units);
ui.samplingRateComboBox->setCurrentIndex(deviceDetails->samplingRate);
ui.salinitySpinBox->setValue(deviceDetails->salinity);
ui.diveModeColour->setCurrentIndex(deviceDetails->diveModeColor);
ui.languageComboBox->setCurrentIndex(deviceDetails->language);
ui.dateFormatComboBox->setCurrentIndex(deviceDetails->dateFormat);
ui.compassGainComboBox->setCurrentIndex(deviceDetails->compassGain);
ui.safetyStopCheckBox->setChecked(deviceDetails->safetyStop);
ui.gfHighSpinBox->setValue(deviceDetails->gfHigh);
ui.gfLowSpinBox->setValue(deviceDetails->gfLow);
ui.pressureSensorOffsetSpinBox->setValue(deviceDetails->pressureSensorOffset);
ui.ppO2MinSpinBox->setValue(deviceDetails->ppO2Min);
ui.ppO2MaxSpinBox->setValue(deviceDetails->ppO2Max);
ui.futureTTSSpinBox->setValue(deviceDetails->futureTTS);
ui.ccrModeComboBox->setCurrentIndex(deviceDetails->ccrMode);
ui.decoTypeComboBox->setCurrentIndex(deviceDetails->decoType);
ui.aGFSelectableCheckBox->setChecked(deviceDetails->aGFSelectable);
ui.aGFHighSpinBox->setValue(deviceDetails->aGFHigh);
ui.aGFLowSpinBox->setValue(deviceDetails->aGFLow);
ui.calibrationGasSpinBox->setValue(deviceDetails->calibrationGas);
ui.flipScreenCheckBox->setChecked(deviceDetails->flipScreen);
ui.setPointFallbackCheckBox->setChecked(deviceDetails->setPointFallback);
//load gas 1 values
ui.ostc3GasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1().oxygen)));
ui.ostc3GasTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->gas1().helium)));
ui.ostc3GasTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->gas1().type)));
ui.ostc3GasTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->gas1().depth)));
ui.ostc3GasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1.oxygen)));
ui.ostc3GasTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->gas1.helium)));
ui.ostc3GasTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->gas1.type)));
ui.ostc3GasTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->gas1.depth)));
//load gas 2 values
ui.ostc3GasTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->gas2().oxygen)));
ui.ostc3GasTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->gas2().helium)));
ui.ostc3GasTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->gas2().type)));
ui.ostc3GasTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->gas2().depth)));
ui.ostc3GasTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->gas2.oxygen)));
ui.ostc3GasTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->gas2.helium)));
ui.ostc3GasTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->gas2.type)));
ui.ostc3GasTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->gas2.depth)));
//load gas 3 values
ui.ostc3GasTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->gas3().oxygen)));
ui.ostc3GasTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->gas3().helium)));
ui.ostc3GasTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->gas3().type)));
ui.ostc3GasTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->gas3().depth)));
ui.ostc3GasTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->gas3.oxygen)));
ui.ostc3GasTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->gas3.helium)));
ui.ostc3GasTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->gas3.type)));
ui.ostc3GasTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->gas3.depth)));
//load gas 4 values
ui.ostc3GasTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->gas4().oxygen)));
ui.ostc3GasTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->gas4().helium)));
ui.ostc3GasTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->gas4().type)));
ui.ostc3GasTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->gas4().depth)));
ui.ostc3GasTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->gas4.oxygen)));
ui.ostc3GasTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->gas4.helium)));
ui.ostc3GasTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->gas4.type)));
ui.ostc3GasTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->gas4.depth)));
//load gas 5 values
ui.ostc3GasTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->gas5().oxygen)));
ui.ostc3GasTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->gas5().helium)));
ui.ostc3GasTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->gas5().type)));
ui.ostc3GasTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->gas5().depth)));
ui.ostc3GasTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->gas5.oxygen)));
ui.ostc3GasTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->gas5.helium)));
ui.ostc3GasTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->gas5.type)));
ui.ostc3GasTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->gas5.depth)));
//load dil 1 values
ui.ostc3DilTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->dil1().oxygen)));
ui.ostc3DilTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->dil1().helium)));
ui.ostc3DilTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->dil1().type)));
ui.ostc3DilTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->dil1().depth)));
ui.ostc3DilTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->dil1.oxygen)));
ui.ostc3DilTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->dil1.helium)));
ui.ostc3DilTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->dil1.type)));
ui.ostc3DilTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->dil1.depth)));
//load dil 2 values
ui.ostc3DilTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->dil2().oxygen)));
ui.ostc3DilTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->dil2().helium)));
ui.ostc3DilTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->dil2().type)));
ui.ostc3DilTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->dil2().depth)));
ui.ostc3DilTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->dil2.oxygen)));
ui.ostc3DilTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->dil2.helium)));
ui.ostc3DilTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->dil2.type)));
ui.ostc3DilTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->dil2.depth)));
//load dil 3 values
ui.ostc3DilTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->dil3().oxygen)));
ui.ostc3DilTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->dil3().helium)));
ui.ostc3DilTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->dil3().type)));
ui.ostc3DilTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->dil3().depth)));
ui.ostc3DilTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->dil3.oxygen)));
ui.ostc3DilTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->dil3.helium)));
ui.ostc3DilTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->dil3.type)));
ui.ostc3DilTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->dil3.depth)));
//load dil 4 values
ui.ostc3DilTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->dil4().oxygen)));
ui.ostc3DilTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->dil4().helium)));
ui.ostc3DilTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->dil4().type)));
ui.ostc3DilTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->dil4().depth)));
ui.ostc3DilTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->dil4.oxygen)));
ui.ostc3DilTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->dil4.helium)));
ui.ostc3DilTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->dil4.type)));
ui.ostc3DilTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->dil4.depth)));
//load dil 5 values
ui.ostc3DilTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->dil5().oxygen)));
ui.ostc3DilTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->dil5().helium)));
ui.ostc3DilTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->dil5().type)));
ui.ostc3DilTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->dil5().depth)));
ui.ostc3DilTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->dil5.oxygen)));
ui.ostc3DilTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->dil5.helium)));
ui.ostc3DilTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->dil5.type)));
ui.ostc3DilTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->dil5.depth)));
//load set point 1 values
ui.ostc3SetPointTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->sp1().sp)));
ui.ostc3SetPointTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->sp1().depth)));
ui.ostc3SetPointTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->sp1.sp)));
ui.ostc3SetPointTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->sp1.depth)));
//load set point 2 values
ui.ostc3SetPointTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->sp2().sp)));
ui.ostc3SetPointTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->sp2().depth)));
ui.ostc3SetPointTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->sp2.sp)));
ui.ostc3SetPointTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->sp2.depth)));
//load set point 3 values
ui.ostc3SetPointTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->sp3().sp)));
ui.ostc3SetPointTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->sp3().depth)));
ui.ostc3SetPointTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->sp3.sp)));
ui.ostc3SetPointTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->sp3.depth)));
//load set point 4 values
ui.ostc3SetPointTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->sp4().sp)));
ui.ostc3SetPointTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->sp4().depth)));
ui.ostc3SetPointTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->sp4.sp)));
ui.ostc3SetPointTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->sp4.depth)));
//load set point 5 values
ui.ostc3SetPointTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->sp5().sp)));
ui.ostc3SetPointTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->sp5().depth)));
ui.ostc3SetPointTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->sp5.sp)));
ui.ostc3SetPointTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->sp5.depth)));
}
void ConfigureDiveComputerDialog::reloadValuesOSTC()
@ -896,132 +896,132 @@ setCcrMode
# Not in OSTC3
setNumberOfDives
*/
ui.serialNoLineEdit_3->setText(deviceDetails->serialNo());
ui.firmwareVersionLineEdit_3->setText(deviceDetails->firmwareVersion());
ui.customTextLlineEdit_3->setText(deviceDetails->customText());
ui.saturationSpinBox_3->setValue(deviceDetails->saturation());
ui.desaturationSpinBox_3->setValue(deviceDetails->desaturation());
ui.lastDecoSpinBox_3->setValue(deviceDetails->lastDeco());
ui.samplingRateSpinBox_3->setValue(deviceDetails->samplingRate());
ui.salinityDoubleSpinBox_3->setValue((double)deviceDetails->salinity() / 100.0);
ui.dateFormatComboBox_3->setCurrentIndex(deviceDetails->dateFormat());
ui.safetyStopCheckBox_3->setChecked(deviceDetails->safetyStop());
ui.gfHighSpinBox_3->setValue(deviceDetails->gfHigh());
ui.gfLowSpinBox_3->setValue(deviceDetails->gfLow());
ui.ppO2MinSpinBox_3->setValue(deviceDetails->ppO2Min());
ui.ppO2MaxSpinBox_3->setValue(deviceDetails->ppO2Max());
ui.futureTTSSpinBox_3->setValue(deviceDetails->futureTTS());
ui.decoTypeComboBox_3->setCurrentIndex(deviceDetails->decoType());
ui.aGFSelectableCheckBox_3->setChecked(deviceDetails->aGFSelectable());
ui.aGFHighSpinBox_3->setValue(deviceDetails->aGFHigh());
ui.aGFLowSpinBox_3->setValue(deviceDetails->aGFLow());
ui.numberOfDivesSpinBox_3->setValue(deviceDetails->numberOfDives());
ui.serialNoLineEdit_3->setText(deviceDetails->serialNo);
ui.firmwareVersionLineEdit_3->setText(deviceDetails->firmwareVersion);
ui.customTextLlineEdit_3->setText(deviceDetails->customText);
ui.saturationSpinBox_3->setValue(deviceDetails->saturation);
ui.desaturationSpinBox_3->setValue(deviceDetails->desaturation);
ui.lastDecoSpinBox_3->setValue(deviceDetails->lastDeco);
ui.samplingRateSpinBox_3->setValue(deviceDetails->samplingRate);
ui.salinityDoubleSpinBox_3->setValue((double)deviceDetails->salinity / 100.0);
ui.dateFormatComboBox_3->setCurrentIndex(deviceDetails->dateFormat);
ui.safetyStopCheckBox_3->setChecked(deviceDetails->safetyStop);
ui.gfHighSpinBox_3->setValue(deviceDetails->gfHigh);
ui.gfLowSpinBox_3->setValue(deviceDetails->gfLow);
ui.ppO2MinSpinBox_3->setValue(deviceDetails->ppO2Min);
ui.ppO2MaxSpinBox_3->setValue(deviceDetails->ppO2Max);
ui.futureTTSSpinBox_3->setValue(deviceDetails->futureTTS);
ui.decoTypeComboBox_3->setCurrentIndex(deviceDetails->decoType);
ui.aGFSelectableCheckBox_3->setChecked(deviceDetails->aGFSelectable);
ui.aGFHighSpinBox_3->setValue(deviceDetails->aGFHigh);
ui.aGFLowSpinBox_3->setValue(deviceDetails->aGFLow);
ui.numberOfDivesSpinBox_3->setValue(deviceDetails->numberOfDives);
//load gas 1 values
ui.ostcGasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1().oxygen)));
ui.ostcGasTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->gas1().helium)));
ui.ostcGasTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->gas1().type)));
ui.ostcGasTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->gas1().depth)));
ui.ostcGasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1.oxygen)));
ui.ostcGasTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->gas1.helium)));
ui.ostcGasTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->gas1.type)));
ui.ostcGasTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->gas1.depth)));
//load gas 2 values
ui.ostcGasTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->gas2().oxygen)));
ui.ostcGasTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->gas2().helium)));
ui.ostcGasTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->gas2().type)));
ui.ostcGasTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->gas2().depth)));
ui.ostcGasTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->gas2.oxygen)));
ui.ostcGasTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->gas2.helium)));
ui.ostcGasTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->gas2.type)));
ui.ostcGasTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->gas2.depth)));
//load gas 3 values
ui.ostcGasTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->gas3().oxygen)));
ui.ostcGasTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->gas3().helium)));
ui.ostcGasTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->gas3().type)));
ui.ostcGasTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->gas3().depth)));
ui.ostcGasTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->gas3.oxygen)));
ui.ostcGasTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->gas3.helium)));
ui.ostcGasTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->gas3.type)));
ui.ostcGasTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->gas3.depth)));
//load gas 4 values
ui.ostcGasTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->gas4().oxygen)));
ui.ostcGasTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->gas4().helium)));
ui.ostcGasTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->gas4().type)));
ui.ostcGasTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->gas4().depth)));
ui.ostcGasTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->gas4.oxygen)));
ui.ostcGasTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->gas4.helium)));
ui.ostcGasTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->gas4.type)));
ui.ostcGasTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->gas4.depth)));
//load gas 5 values
ui.ostcGasTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->gas5().oxygen)));
ui.ostcGasTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->gas5().helium)));
ui.ostcGasTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->gas5().type)));
ui.ostcGasTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->gas5().depth)));
ui.ostcGasTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->gas5.oxygen)));
ui.ostcGasTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->gas5.helium)));
ui.ostcGasTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->gas5.type)));
ui.ostcGasTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->gas5.depth)));
//load dil 1 values
ui.ostcDilTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->dil1().oxygen)));
ui.ostcDilTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->dil1().helium)));
ui.ostcDilTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->dil1().type)));
ui.ostcDilTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->dil1().depth)));
ui.ostcDilTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->dil1.oxygen)));
ui.ostcDilTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->dil1.helium)));
ui.ostcDilTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->dil1.type)));
ui.ostcDilTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->dil1.depth)));
//load dil 2 values
ui.ostcDilTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->dil2().oxygen)));
ui.ostcDilTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->dil2().helium)));
ui.ostcDilTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->dil2().type)));
ui.ostcDilTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->dil2().depth)));
ui.ostcDilTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->dil2.oxygen)));
ui.ostcDilTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->dil2.helium)));
ui.ostcDilTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->dil2.type)));
ui.ostcDilTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->dil2.depth)));
//load dil 3 values
ui.ostcDilTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->dil3().oxygen)));
ui.ostcDilTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->dil3().helium)));
ui.ostcDilTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->dil3().type)));
ui.ostcDilTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->dil3().depth)));
ui.ostcDilTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->dil3.oxygen)));
ui.ostcDilTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->dil3.helium)));
ui.ostcDilTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->dil3.type)));
ui.ostcDilTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->dil3.depth)));
//load dil 4 values
ui.ostcDilTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->dil4().oxygen)));
ui.ostcDilTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->dil4().helium)));
ui.ostcDilTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->dil4().type)));
ui.ostcDilTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->dil4().depth)));
ui.ostcDilTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->dil4.oxygen)));
ui.ostcDilTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->dil4.helium)));
ui.ostcDilTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->dil4.type)));
ui.ostcDilTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->dil4.depth)));
//load dil 5 values
ui.ostcDilTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->dil5().oxygen)));
ui.ostcDilTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->dil5().helium)));
ui.ostcDilTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->dil5().type)));
ui.ostcDilTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->dil5().depth)));
ui.ostcDilTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->dil5.oxygen)));
ui.ostcDilTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->dil5.helium)));
ui.ostcDilTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->dil5.type)));
ui.ostcDilTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->dil5.depth)));
//load set point 1 values
ui.ostcSetPointTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->sp1().sp)));
ui.ostcSetPointTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->sp1().depth)));
ui.ostcSetPointTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->sp1.sp)));
ui.ostcSetPointTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->sp1.depth)));
//load set point 2 values
ui.ostcSetPointTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->sp2().sp)));
ui.ostcSetPointTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->sp2().depth)));
ui.ostcSetPointTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->sp2.sp)));
ui.ostcSetPointTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->sp2.depth)));
//load set point 3 values
ui.ostcSetPointTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->sp3().sp)));
ui.ostcSetPointTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->sp3().depth)));
ui.ostcSetPointTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->sp3.sp)));
ui.ostcSetPointTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->sp3.depth)));
//load set point 4 values
ui.ostcSetPointTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->sp4().sp)));
ui.ostcSetPointTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->sp4().depth)));
ui.ostcSetPointTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->sp4.sp)));
ui.ostcSetPointTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->sp4.depth)));
//load set point 5 values
ui.ostcSetPointTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->sp5().sp)));
ui.ostcSetPointTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->sp5().depth)));
ui.ostcSetPointTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->sp5.sp)));
ui.ostcSetPointTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->sp5.depth)));
}
void ConfigureDiveComputerDialog::reloadValuesSuuntoVyper()
{
const char *depth_unit;
ui.maxDepthDoubleSpinBox->setValue(get_depth_units(deviceDetails->maxDepth(), NULL, &depth_unit));
ui.maxDepthDoubleSpinBox->setValue(get_depth_units(deviceDetails->maxDepth, NULL, &depth_unit));
ui.maxDepthDoubleSpinBox->setSuffix(depth_unit);
ui.totalTimeSpinBox->setValue(deviceDetails->totalTime());
ui.numberOfDivesSpinBox->setValue(deviceDetails->numberOfDives());
ui.modelLineEdit->setText(deviceDetails->model());
ui.firmwareVersionLineEdit_1->setText(deviceDetails->firmwareVersion());
ui.serialNoLineEdit_1->setText(deviceDetails->serialNo());
ui.customTextLlineEdit_1->setText(deviceDetails->customText());
ui.samplingRateComboBox_1->setCurrentIndex(deviceDetails->samplingRate() == 60 ? 3 : (deviceDetails->samplingRate() / 10) - 1);
ui.altitudeRangeComboBox->setCurrentIndex(deviceDetails->altitude());
ui.personalSafetyComboBox->setCurrentIndex(deviceDetails->personalSafety());
ui.timeFormatComboBox->setCurrentIndex(deviceDetails->timeFormat());
ui.unitsComboBox_1->setCurrentIndex(deviceDetails->units());
ui.diveModeComboBox_1->setCurrentIndex(deviceDetails->diveMode());
ui.lightCheckBox->setChecked(deviceDetails->lightEnabled());
ui.lightSpinBox->setValue(deviceDetails->light());
ui.alarmDepthCheckBox->setChecked(deviceDetails->alarmDepthEnabled());
ui.alarmDepthDoubleSpinBox->setValue(get_depth_units(deviceDetails->alarmDepth(), NULL, &depth_unit));
ui.totalTimeSpinBox->setValue(deviceDetails->totalTime);
ui.numberOfDivesSpinBox->setValue(deviceDetails->numberOfDives);
ui.modelLineEdit->setText(deviceDetails->model);
ui.firmwareVersionLineEdit_1->setText(deviceDetails->firmwareVersion);
ui.serialNoLineEdit_1->setText(deviceDetails->serialNo);
ui.customTextLlineEdit_1->setText(deviceDetails->customText);
ui.samplingRateComboBox_1->setCurrentIndex(deviceDetails->samplingRate == 60 ? 3 : (deviceDetails->samplingRate / 10) - 1);
ui.altitudeRangeComboBox->setCurrentIndex(deviceDetails->altitude);
ui.personalSafetyComboBox->setCurrentIndex(deviceDetails->personalSafety);
ui.timeFormatComboBox->setCurrentIndex(deviceDetails->timeFormat);
ui.unitsComboBox_1->setCurrentIndex(deviceDetails->units);
ui.diveModeComboBox_1->setCurrentIndex(deviceDetails->diveMode);
ui.lightCheckBox->setChecked(deviceDetails->lightEnabled);
ui.lightSpinBox->setValue(deviceDetails->light);
ui.alarmDepthCheckBox->setChecked(deviceDetails->alarmDepthEnabled);
ui.alarmDepthDoubleSpinBox->setValue(get_depth_units(deviceDetails->alarmDepth, NULL, &depth_unit));
ui.alarmDepthDoubleSpinBox->setSuffix(depth_unit);
ui.alarmTimeCheckBox->setChecked(deviceDetails->alarmTimeEnabled());
ui.alarmTimeSpinBox->setValue(deviceDetails->alarmTime());
ui.alarmTimeCheckBox->setChecked(deviceDetails->alarmTimeEnabled);
ui.alarmTimeSpinBox->setValue(deviceDetails->alarmTime);
}
void ConfigureDiveComputerDialog::on_backupButton_clicked()