summaryrefslogtreecommitdiffstats
path: root/configuredivecomputer.cpp
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-06-21 09:53:05 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-13 10:48:14 -0700
commit9c032f20c02fbb7c1e3906dbc8392539e0125327 (patch)
tree54488a541a58ce4fb7e426b96e6a7af67afc6da1 /configuredivecomputer.cpp
parent65b0b8a64b5477cd7121699eea4c951a873c7a9f (diff)
downloadsubsurface-9c032f20c02fbb7c1e3906dbc8392539e0125327.tar.gz
Add reading and writing of OSTC 3 Dil values
Implements reading, writing and backup/restore of OSTC 3 Dil Values (setting 0x15 to 0x19) Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'configuredivecomputer.cpp')
-rw-r--r--configuredivecomputer.cpp87
1 files changed, 87 insertions, 0 deletions
diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp
index 0459640ad..7b86d5bb0 100644
--- a/configuredivecomputer.cpp
+++ b/configuredivecomputer.cpp
@@ -98,6 +98,43 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
xml += addSettingToXML("Gas4", gas4);
xml += addSettingToXML("Gas5", gas5);
//
+ //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)
+ );
+ 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)
+ );
+ 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)
+ );
+ 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)
+ );
+ 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)
+ );
+ xml += addSettingToXML("Dil1", dil1);
+ xml += addSettingToXML("Dil2", dil2);
+ xml += addSettingToXML("Dil3", dil3);
+ xml += addSettingToXML("Dil4", dil4);
+ xml += addSettingToXML("Dil5", dil5);
+ //
xml += addSettingToXML("DiveMode", details->diveMode());
xml += addSettingToXML("Saturation", details->saturation());
xml += addSettingToXML("Desaturation", details->desaturation());
@@ -216,6 +253,56 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
details->setGas5(gas5);
}
+ if (settingName == "Dil1") {
+ QStringList dilData = keyString.split(",");
+ gas dil1;
+ dil1.oxygen = dilData.at(0).toInt();
+ dil1.helium = dilData.at(1).toInt();
+ dil1.type = dilData.at(2).toInt();
+ dil1.depth = dilData.at(3).toInt();
+ details->setDil1(dil1);
+ }
+
+ if (settingName == "Dil2") {
+ QStringList dilData = keyString.split(",");
+ gas dil2;
+ dil2.oxygen = dilData.at(0).toInt();
+ dil2.helium = dilData.at(1).toInt();
+ dil2.type = dilData.at(2).toInt();
+ dil2.depth = dilData.at(3).toInt();
+ details->setDil1(dil2);
+ }
+
+ if (settingName == "Dil3") {
+ QStringList dilData = keyString.split(",");
+ gas dil3;
+ dil3.oxygen = dilData.at(0).toInt();
+ dil3.helium = dilData.at(1).toInt();
+ dil3.type = dilData.at(2).toInt();
+ dil3.depth = dilData.at(3).toInt();
+ details->setDil3(dil3);
+ }
+
+ if (settingName == "Dil4") {
+ QStringList dilData = keyString.split(",");
+ gas dil4;
+ dil4.oxygen = dilData.at(0).toInt();
+ dil4.helium = dilData.at(1).toInt();
+ dil4.type = dilData.at(2).toInt();
+ dil4.depth = dilData.at(3).toInt();
+ details->setDil4(dil4);
+ }
+
+ if (settingName == "Dil5") {
+ QStringList dilData = keyString.split(",");
+ gas dil5;
+ dil5.oxygen = dilData.at(0).toInt();
+ dil5.helium = dilData.at(1).toInt();
+ dil5.type = dilData.at(2).toInt();
+ dil5.depth = dilData.at(3).toInt();
+ details->setDil5(dil5);
+ }
+
if (settingName == "Saturation")
details->setSaturation(keyString.toInt());