summaryrefslogtreecommitdiffstats
path: root/configuredivecomputerthreads.cpp
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2015-09-02 23:59:59 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-02 15:26:06 -0700
commitc69d5619cefbc05a1387f60c82a6b515b7d2b0da (patch)
tree20f0085527f2ba9cb81e60a46be26588e6947d67 /configuredivecomputerthreads.cpp
parent6944084653bc5fb88d28c88787dadb3169bbf39d (diff)
downloadsubsurface-c69d5619cefbc05a1387f60c82a6b515b7d2b0da.tar.gz
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>
Diffstat (limited to 'configuredivecomputerthreads.cpp')
-rw-r--r--configuredivecomputerthreads.cpp404
1 files changed, 202 insertions, 202 deletions
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp
index e07466018..cbd81c8d5 100644
--- a/configuredivecomputerthreads.cpp
+++ b/configuredivecomputerthreads.cpp
@@ -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();