mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Move non gui code from qt-ui
Moves non gui classes (configuredivecomputer, configuredivecomputerthreads and devicedetails) from qt-ui to the top level folder. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
This commit is contained in:
parent
045a6fb6b1
commit
4f37602836
7 changed files with 6 additions and 6 deletions
|
|
@ -1,209 +0,0 @@
|
|||
#include "configuredivecomputer.h"
|
||||
#include "libdivecomputer/hw.h"
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxslt/transform.h>
|
||||
#include <QStringList>
|
||||
|
||||
ConfigureDiveComputer::ConfigureDiveComputer(QObject *parent) :
|
||||
QObject(parent),
|
||||
readThread(0),
|
||||
writeThread(0)
|
||||
{
|
||||
setState(INITIAL);
|
||||
}
|
||||
|
||||
void ConfigureDiveComputer::readSettings(device_data_t *data)
|
||||
{
|
||||
setState(READING);
|
||||
|
||||
if (readThread)
|
||||
readThread->deleteLater();
|
||||
|
||||
readThread = new ReadSettingsThread(this, data);
|
||||
connect (readThread, SIGNAL(finished()),
|
||||
this, SLOT(readThreadFinished()), Qt::QueuedConnection);
|
||||
connect (readThread, SIGNAL(error(QString)), this, SLOT(setError(QString)));
|
||||
connect (readThread, SIGNAL(devicedetails(DeviceDetails*)), this,
|
||||
SIGNAL(deviceDetailsChanged(DeviceDetails*)));
|
||||
|
||||
readThread->start();
|
||||
}
|
||||
|
||||
void ConfigureDiveComputer::saveDeviceDetails(DeviceDetails *details, device_data_t *data)
|
||||
{
|
||||
setState(WRITING);
|
||||
|
||||
if (writeThread)
|
||||
writeThread->deleteLater();
|
||||
|
||||
writeThread = new WriteSettingsThread(this, data);
|
||||
connect (writeThread, SIGNAL(finished()),
|
||||
this, SLOT(writeThreadFinished()), Qt::QueuedConnection);
|
||||
connect (writeThread, SIGNAL(error(QString)), this, SLOT(setError(QString)));
|
||||
|
||||
writeThread->setDeviceDetails(details);
|
||||
writeThread->start();
|
||||
}
|
||||
|
||||
bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *details, device_data_t *data, QString errorText)
|
||||
{
|
||||
QString xml = "";
|
||||
QString vendor = data->vendor;
|
||||
QString product = data->product;
|
||||
xml += "<DiveComputerSettingsBackup>";
|
||||
xml += "\n<DiveComputer>";
|
||||
xml += addSettingToXML("Vendor", vendor);
|
||||
xml += addSettingToXML("Product", product);
|
||||
xml += "\n</DiveComputer>";
|
||||
xml += "\n<Settings>";
|
||||
xml += addSettingToXML("CustomText", details->customText());
|
||||
xml += addSettingToXML("DiveMode", details->diveMode());
|
||||
xml += addSettingToXML("Saturation", details->saturation());
|
||||
xml += addSettingToXML("Desaturation", details->desaturation());
|
||||
xml += addSettingToXML("LastDeco", details->lastDeco());
|
||||
xml += addSettingToXML("Brightness", details->brightness());
|
||||
xml += addSettingToXML("Units", details->units());
|
||||
xml += addSettingToXML("SamplingRate", details->samplingRate());
|
||||
xml += addSettingToXML("Salinity", details->salinity());
|
||||
xml += addSettingToXML("DiveModeColor", details->diveModeColor());
|
||||
xml += addSettingToXML("Language", details->language());
|
||||
xml += addSettingToXML("DateFormat", details->dateFormat());
|
||||
xml += addSettingToXML("CompassGain", details->compassGain());
|
||||
xml += "\n</Settings>";
|
||||
xml += "\n</DiveComputerSettingsBackup>";
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
errorText = tr("Could not save the backup file %1. Error Message: %2")
|
||||
.arg(fileName, file.errorString());
|
||||
return false;
|
||||
}
|
||||
//file open successful. write data and save.
|
||||
QTextStream out(&file);
|
||||
out << xml;
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *details, QString errorText)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr node;
|
||||
xmlChar *key;
|
||||
|
||||
doc = xmlParseFile(fileName.toUtf8().data());
|
||||
|
||||
if (doc == NULL) {
|
||||
errorText = tr("Could not read the backup file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
node = xmlDocGetRootElement(doc);
|
||||
if (node == NULL) {
|
||||
errorText = tr("The specified file is invalid.");
|
||||
xmlFreeDoc(doc);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (xmlStrcmp(node->name, (const xmlChar *) "DiveComputerSettingsBackup")) {
|
||||
errorText = tr("The specified file does not contain a valid backup.");
|
||||
xmlFreeDoc(doc);
|
||||
return false;
|
||||
}
|
||||
|
||||
xmlNodePtr child = node->children;
|
||||
|
||||
while (child != NULL) {
|
||||
QString nodeName = (char *)child->name;
|
||||
if (nodeName == "Settings") {
|
||||
xmlNodePtr settingNode = child->children;
|
||||
while (settingNode != NULL) {
|
||||
QString settingName = (char *)settingNode->name;
|
||||
key = xmlNodeListGetString(doc, settingNode->xmlChildrenNode, 1);
|
||||
QString keyString = (char *)key;
|
||||
if (settingName != "text") {
|
||||
if (settingName == "CustomText")
|
||||
details->setCustomText(keyString);
|
||||
|
||||
if (settingName == "Saturation")
|
||||
details->setSaturation(keyString.toInt());
|
||||
|
||||
if (settingName == "Desaturation")
|
||||
details->setDesaturation(keyString.toInt());
|
||||
|
||||
if (settingName == "DiveMode")
|
||||
details->setDiveMode(keyString.toInt());
|
||||
|
||||
if (settingName == "LastDeco")
|
||||
details->setLastDeco(keyString.toInt());
|
||||
|
||||
if (settingName == "Brightness")
|
||||
details->setBrightness(keyString.toInt());
|
||||
|
||||
if (settingName == "Units")
|
||||
details->setUnits(keyString.toInt());
|
||||
|
||||
if (settingName == "SamplingRate")
|
||||
details->setSamplingRate(keyString.toInt());
|
||||
|
||||
if (settingName == "Salinity")
|
||||
details->setSalinity(keyString.toInt());
|
||||
|
||||
if (settingName == "DiveModeColour")
|
||||
details->setDiveModeColor(keyString.toInt());
|
||||
|
||||
if (settingName == "Language")
|
||||
details->setLanguage(keyString.toInt());
|
||||
|
||||
if (settingName == "DateFormat")
|
||||
details->setDateFormat(keyString.toInt());
|
||||
|
||||
if (settingName == "CompassGain")
|
||||
details->setCompassGain(keyString.toInt());
|
||||
}
|
||||
|
||||
settingNode = settingNode->next;
|
||||
}
|
||||
}
|
||||
child = child->next;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConfigureDiveComputer::setState(ConfigureDiveComputer::states newState)
|
||||
{
|
||||
currentState = newState;
|
||||
emit stateChanged(currentState);
|
||||
}
|
||||
|
||||
|
||||
QString ConfigureDiveComputer::addSettingToXML(QString settingName, QVariant value)
|
||||
{
|
||||
return "\n<" + settingName + ">" + value.toString() + "</" + settingName + ">";
|
||||
}
|
||||
|
||||
void ConfigureDiveComputer::setError(QString err)
|
||||
{
|
||||
lastError = err;
|
||||
emit error(err);
|
||||
}
|
||||
|
||||
void ConfigureDiveComputer::readThreadFinished()
|
||||
{
|
||||
setState(DONE);
|
||||
emit readFinished();
|
||||
}
|
||||
|
||||
void ConfigureDiveComputer::writeThreadFinished()
|
||||
{
|
||||
setState(DONE);
|
||||
if (writeThread->lastError.isEmpty()) {
|
||||
//No error
|
||||
emit message(tr("Setting successfully written to device"));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
#ifndef CONFIGUREDIVECOMPUTER_H
|
||||
#define CONFIGUREDIVECOMPUTER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QVariant>
|
||||
#include "libdivecomputer.h"
|
||||
#include "configuredivecomputerthreads.h"
|
||||
#include <QDateTime>
|
||||
|
||||
#include "libxml/xmlreader.h"
|
||||
|
||||
class ConfigureDiveComputer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ConfigureDiveComputer(QObject *parent = 0);
|
||||
void readSettings(device_data_t *data);
|
||||
|
||||
enum states {
|
||||
INITIAL,
|
||||
READING,
|
||||
WRITING,
|
||||
CANCELLING,
|
||||
CANCELLED,
|
||||
ERROR,
|
||||
DONE,
|
||||
};
|
||||
|
||||
QString lastError;
|
||||
states currentState;
|
||||
device_data_t *m_data;
|
||||
void saveDeviceDetails(DeviceDetails *details, device_data_t *data);
|
||||
void fetchDeviceDetails();
|
||||
bool saveXMLBackup(QString fileName, DeviceDetails *details, device_data_t *data, QString errorText);
|
||||
bool restoreXMLBackup(QString fileName, DeviceDetails *details, QString errorText);
|
||||
signals:
|
||||
void message(QString msg);
|
||||
void error(QString err);
|
||||
void readFinished();
|
||||
void writeFinished();
|
||||
void stateChanged(states newState);
|
||||
void deviceDetailsChanged(DeviceDetails *newDetails);
|
||||
|
||||
private:
|
||||
ReadSettingsThread *readThread;
|
||||
WriteSettingsThread *writeThread;
|
||||
void setState(states newState);
|
||||
QString addSettingToXML(QString settingName, QVariant value);
|
||||
private slots:
|
||||
void readThreadFinished();
|
||||
void writeThreadFinished();
|
||||
void setError(QString err);
|
||||
};
|
||||
|
||||
#endif // CONFIGUREDIVECOMPUTER_H
|
||||
|
|
@ -1,229 +0,0 @@
|
|||
#include "configuredivecomputerthreads.h"
|
||||
#include "libdivecomputer/hw.h"
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
|
||||
ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data)
|
||||
: QThread(parent), m_data(data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ReadSettingsThread::run()
|
||||
{
|
||||
bool supported = false;
|
||||
dc_status_t rc;
|
||||
rc = rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
|
||||
if (rc == DC_STATUS_SUCCESS) {
|
||||
DeviceDetails *m_deviceDetails = new DeviceDetails(0);
|
||||
switch (dc_device_get_type(m_data->device)) {
|
||||
case DC_FAMILY_HW_OSTC3:
|
||||
supported = true;
|
||||
m_deviceDetails->setBrightness(0);
|
||||
m_deviceDetails->setCustomText("");
|
||||
m_deviceDetails->setDateFormat(0);
|
||||
m_deviceDetails->setDiveModeColor(0);
|
||||
m_deviceDetails->setFirmwareVersion("");
|
||||
m_deviceDetails->setLanguage(0);
|
||||
m_deviceDetails->setLastDeco(0);
|
||||
m_deviceDetails->setSerialNo("");
|
||||
m_deviceDetails->setCompassGain(0);
|
||||
m_deviceDetails->setSalinity(0);
|
||||
m_deviceDetails->setSamplingRate(0);
|
||||
m_deviceDetails->setUnits(0);
|
||||
|
||||
|
||||
//Gread gas mixes
|
||||
gas gas1;
|
||||
gas gas2;
|
||||
gas gas3;
|
||||
gas gas4;
|
||||
gas gas5;
|
||||
//Gas 1
|
||||
unsigned char gasData[4] = {0,0,0,0};
|
||||
rc = hw_ostc3_device_config_read(m_data->device, 0x10, gasData, sizeof(gasData));
|
||||
if (rc == DC_STATUS_SUCCESS) {
|
||||
//Gas 1 read successful
|
||||
gas gas1;
|
||||
gas1.depth = gasData[3];
|
||||
gas1.oxygen = gasData[0];
|
||||
gas1.helium = gasData[1];
|
||||
gas1.type = gasData[2];
|
||||
}
|
||||
|
||||
m_deviceDetails->setGas1(gas1);
|
||||
m_deviceDetails->setGas2(gas2);
|
||||
m_deviceDetails->setGas3(gas3);
|
||||
m_deviceDetails->setGas4(gas4);
|
||||
m_deviceDetails->setGas5(gas5);
|
||||
|
||||
//Read general settings
|
||||
unsigned char uData[1] = {0};
|
||||
//DiveMode
|
||||
rc = hw_ostc3_device_config_read(m_data->device, 0x20, uData, sizeof(uData));
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
m_deviceDetails->setDiveMode(uData[0]);
|
||||
//Saturation
|
||||
rc = hw_ostc3_device_config_read(m_data->device, 0x2A, uData, sizeof(uData));
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
m_deviceDetails->setSaturation(uData[0]);
|
||||
//LastDeco
|
||||
rc = hw_ostc3_device_config_read(m_data->device, 0x2D, uData, sizeof(uData));
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
m_deviceDetails->setLastDeco(uData[0]);
|
||||
//Brightness
|
||||
rc = hw_ostc3_device_config_read(m_data->device, 0x2D, uData, sizeof(uData));
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
m_deviceDetails->setBrightness(uData[0]);
|
||||
//Units
|
||||
rc = hw_ostc3_device_config_read(m_data->device, 0x2E, uData, sizeof(uData));
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
m_deviceDetails->setUnits(uData[0]);
|
||||
//Sampling Rate
|
||||
rc = hw_ostc3_device_config_read(m_data->device, 0x2F, uData, sizeof(uData));
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
m_deviceDetails->setSamplingRate(uData[0]);
|
||||
//Salinity
|
||||
rc = hw_ostc3_device_config_read(m_data->device, 0x30, uData, sizeof(uData));
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
m_deviceDetails->setSalinity(uData[0]);
|
||||
//Dive mode colour
|
||||
rc = hw_ostc3_device_config_read(m_data->device, 0x31, uData, sizeof(uData));
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
m_deviceDetails->setDiveModeColor(uData[0]);
|
||||
//Language
|
||||
rc = hw_ostc3_device_config_read(m_data->device, 0x32, uData, sizeof(uData));
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
m_deviceDetails->setLanguage(uData[0]);
|
||||
//Date Format
|
||||
rc = hw_ostc3_device_config_read(m_data->device, 0x33, uData, sizeof(uData));
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
m_deviceDetails->setDateFormat(uData[0]);
|
||||
|
||||
|
||||
//read firmware settings
|
||||
unsigned char fData[64] = {0};
|
||||
rc = hw_ostc3_device_version (m_data->device, fData, sizeof (fData));
|
||||
if (rc == DC_STATUS_SUCCESS) {
|
||||
int serial = fData[0] + (fData[1] << 8);
|
||||
m_deviceDetails->setSerialNo(QString::number(serial));
|
||||
int fw = (fData[2] << 8) + fData[3];
|
||||
m_deviceDetails->setFirmwareVersion(QString::number(fw));
|
||||
QByteArray ar((char *)fData + 4, 60);
|
||||
m_deviceDetails->setCustomText(ar.trimmed());
|
||||
}
|
||||
|
||||
emit devicedetails(m_deviceDetails);
|
||||
break;
|
||||
|
||||
}
|
||||
dc_device_close(m_data->device);
|
||||
|
||||
if (!supported) {
|
||||
lastError = tr("This feature is not yet available for the selected dive computer.");
|
||||
emit error(lastError);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lastError = tr("Could not a establish connection to the dive computer.");
|
||||
emit error(lastError);
|
||||
}
|
||||
}
|
||||
|
||||
WriteSettingsThread::WriteSettingsThread(QObject *parent, device_data_t *data)
|
||||
: QThread(parent), m_data(data) {
|
||||
|
||||
}
|
||||
|
||||
void WriteSettingsThread::setDeviceDetails(DeviceDetails *details)
|
||||
{
|
||||
m_deviceDetails = details;
|
||||
}
|
||||
|
||||
void WriteSettingsThread::run()
|
||||
{
|
||||
bool supported = false;
|
||||
dc_status_t rc;
|
||||
rc = rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
|
||||
if (rc == DC_STATUS_SUCCESS) {
|
||||
switch (dc_device_get_type(m_data->device)) {
|
||||
case DC_FAMILY_HW_OSTC3:
|
||||
supported = true;
|
||||
//write general settings
|
||||
|
||||
//custom text
|
||||
hw_ostc3_device_customtext(m_data->device, m_deviceDetails->customText().toUtf8().data());
|
||||
unsigned char data[1] = {0};
|
||||
|
||||
//dive mode
|
||||
data[0] = m_deviceDetails->diveMode();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x20, data, sizeof(data));
|
||||
|
||||
//saturation
|
||||
data[0] = m_deviceDetails->saturation();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x2A, data, sizeof(data));
|
||||
|
||||
//last deco
|
||||
data[0] = m_deviceDetails->lastDeco();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x2C, data, sizeof(data));
|
||||
|
||||
//brightness
|
||||
data[0] = m_deviceDetails->brightness();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x2D, data, sizeof(data));
|
||||
|
||||
//units
|
||||
data[0] = m_deviceDetails->units();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x2E, data, sizeof(data));
|
||||
|
||||
//sampling rate
|
||||
data[0] = m_deviceDetails->samplingRate();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x2F, data, sizeof(data));
|
||||
|
||||
//salinity
|
||||
data[0] = m_deviceDetails->salinity();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x30, data, sizeof(data));
|
||||
|
||||
//dive mode colour
|
||||
data[0] = m_deviceDetails->diveModeColor();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x31, data, sizeof(data));
|
||||
|
||||
//language
|
||||
data[0] = m_deviceDetails->language();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x32, data, sizeof(data));
|
||||
|
||||
//date format
|
||||
data[0] = m_deviceDetails->dateFormat();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x33, data, sizeof(data));
|
||||
|
||||
//compass gain
|
||||
data[0] = m_deviceDetails->compassGain();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x34, data, sizeof(data));
|
||||
|
||||
//sync date and time
|
||||
if (m_deviceDetails->syncTime()) {
|
||||
QDateTime timeToSet = QDateTime::currentDateTime();
|
||||
dc_datetime_t time;
|
||||
time.year = timeToSet.date().year();
|
||||
time.month = timeToSet.date().month();
|
||||
time.day = timeToSet.date().day();
|
||||
time.hour = timeToSet.time().hour();
|
||||
time.minute = timeToSet.time().minute();
|
||||
time.second = timeToSet.time().second();
|
||||
hw_ostc3_device_clock(m_data->device, &time);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
dc_device_close(m_data->device);
|
||||
|
||||
if (!supported) {
|
||||
lastError = tr("This feature is not yet available for the selected dive computer.");
|
||||
emit error(lastError);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lastError = tr("Could not a establish connection to the dive computer.");
|
||||
emit error(lastError);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
#ifndef CONFIGUREDIVECOMPUTERTHREADS_H
|
||||
#define CONFIGUREDIVECOMPUTERTHREADS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QVariant>
|
||||
#include "libdivecomputer.h"
|
||||
#include <QDateTime>
|
||||
#include "devicedetails.h"
|
||||
|
||||
class ReadSettingsThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ReadSettingsThread(QObject *parent, device_data_t *data);
|
||||
virtual void run();
|
||||
QString result;
|
||||
QString lastError;
|
||||
signals:
|
||||
void error(QString err);
|
||||
void devicedetails(DeviceDetails *newDeviceDetails);
|
||||
private:
|
||||
device_data_t *m_data;
|
||||
};
|
||||
|
||||
class WriteSettingsThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
WriteSettingsThread(QObject *parent, device_data_t *data);
|
||||
void setDeviceDetails(DeviceDetails *details);
|
||||
virtual void run();
|
||||
QString result;
|
||||
QString lastError;
|
||||
signals:
|
||||
void error(QString err);
|
||||
private:
|
||||
device_data_t *m_data;
|
||||
DeviceDetails *m_deviceDetails;
|
||||
};
|
||||
|
||||
#endif // CONFIGUREDIVECOMPUTERTHREADS_H
|
||||
|
|
@ -1,487 +0,0 @@
|
|||
#include "devicedetails.h"
|
||||
|
||||
DeviceDetails::DeviceDetails(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int DeviceDetails::ccrMode() const
|
||||
{
|
||||
return m_ccrMode;
|
||||
}
|
||||
|
||||
void DeviceDetails::setCcrMode(int ccrMode)
|
||||
{
|
||||
m_ccrMode = ccrMode;
|
||||
}
|
||||
|
||||
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::pp02Max() const
|
||||
{
|
||||
return m_pp02Max;
|
||||
}
|
||||
|
||||
void DeviceDetails::setPp02Max(int pp02Max)
|
||||
{
|
||||
m_pp02Max = pp02Max;
|
||||
}
|
||||
|
||||
int DeviceDetails::pp02Min() const
|
||||
{
|
||||
return m_pp02Min;
|
||||
}
|
||||
|
||||
void DeviceDetails::setPp02Min(int pp02Min)
|
||||
{
|
||||
m_pp02Min = pp02Min;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,202 +0,0 @@
|
|||
#ifndef DEVICEDETAILS_H
|
||||
#define DEVICEDETAILS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
#include "libdivecomputer.h"
|
||||
|
||||
struct gas {
|
||||
int oxygen;
|
||||
int helium;
|
||||
int type;
|
||||
int depth;
|
||||
};
|
||||
|
||||
struct setpoint {
|
||||
int sp;
|
||||
int depth;
|
||||
};
|
||||
|
||||
class DeviceDetails : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
int ccrMode() const;
|
||||
void setCcrMode(int ccrMode);
|
||||
|
||||
int diveMode() const;
|
||||
void setDiveMode(int diveMode);
|
||||
|
||||
int decoType() const;
|
||||
void setDecoType(int decoType);
|
||||
|
||||
int pp02Max() const;
|
||||
void setPp02Max(int pp02Max);
|
||||
|
||||
int pp02Min() const;
|
||||
void setPp02Min(int pp02Min);
|
||||
|
||||
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);
|
||||
|
||||
private:
|
||||
device_data_t *m_data;
|
||||
QString m_serialNo;
|
||||
QString m_firmwareVersion;
|
||||
QString m_customText;
|
||||
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;
|
||||
int m_ccrMode;
|
||||
int m_diveMode;
|
||||
int m_decoType;
|
||||
int m_pp02Max;
|
||||
int m_pp02Min;
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
#endif // DEVICEDETAILS_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue