From: Michal MalĂ˝ <madcatxster@devoid-pointer.net>
Date: Fri, 11 Jul 2014 23:24:46 +0000 (+0200)
Subject: Add support for new HPCS file types.
X-Git-Tag: 0.3a~8^2
X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=4c21316481208fda42850d889396470de9707deb;p=anyanka.git

Add support for new HPCS file types.
---

diff --git a/datamanager.cpp b/datamanager.cpp
index 4aa1618..973bc18 100644
--- a/datamanager.cpp
+++ b/datamanager.cpp
@@ -28,9 +28,12 @@
 #include <QDebug>
 
 const QString DataManager::ME_SENDER_STR("DataManager");
+const QString DataManager::UNIT_DEGREES_CELSIUS_TEXT = QString::fromLatin1((const char[]){static_cast<char>(0xB0), 0x43, 0x00});
 const QString DataManager::UNIT_KILOVOLTS_TEXT = QString::fromLatin1((const char[]){0x4B, 0x56, 0x00});
 const QString DataManager::UNIT_MICROAMPERES_TEXT = QString::fromLatin1((const char[]){static_cast<char>(0xB5), 0x41, 0x00});
+const QString DataManager::UNIT_MICROAMPERES_ALT1_TEXT = QString::fromLatin1((const char[]){0x75, 0x41, 0x00});
 const QString DataManager::UNIT_MILLIAU_TEXT = QString::fromLatin1((const char[]){0x6D, 0x41, 0x55, 0x00});
+const QString DataManager::UNIT_MILLIBARS_TEXT = QString::fromLatin1((const char[]){0x6D, 0x62, 0x61, 0x72, 0x00});
 const QString DataManager::UNIT_MILLIVOLTS_TEXT = QString::fromLatin1((const char[]){0x6D, 0x56, 0x00});
 const QString DataManager::UNIT_WATTS_TEXT = QString::fromLatin1((const char[]){0x57, 0x00});
 const QStringList DataManager::DATA_DIR_SUFFIX = QStringList() << "*.D";
@@ -177,6 +180,8 @@ Signal::Equipment DataManager::equipmentFromFiletype(HPCS_File_Type filetype)
     case HPCS_TYPE_CE_CURRENT:
     case HPCS_TYPE_CE_DAD:
     case HPCS_TYPE_CE_POWER:
+    case HPCS_TYPE_CE_PRESSURE:
+    case HPCS_TYPE_CE_TEMPERATURE:
     case HPCS_TYPE_CE_VOLTAGE:
       return Signal::Equipment::CE;
     default:
@@ -244,6 +249,10 @@ Signal::Resource DataManager::resourceFromFiletype(HPCS_File_Type filetype)
       return Signal::Resource::CE_DAD;
     case HPCS_TYPE_CE_POWER:
       return Signal::Resource::CE_POWER;
+    case HPCS_TYPE_CE_PRESSURE:
+      return Signal::Resource::CE_PRESSURE;
+    case HPCS_TYPE_CE_TEMPERATURE:
+      return Signal::Resource::CE_TEMPERATURE;
     case HPCS_TYPE_CE_VOLTAGE:
       return Signal::Resource::CE_VOLTAGE;
     default:
@@ -265,14 +274,19 @@ Signal::YUnit DataManager::yunitFromUnitStr(const char* unit_str)
 {
   QString str = m_sigNameCodec->toUnicode(unit_str);
 
-  if (QString::compare(str, UNIT_MILLIVOLTS_TEXT) == 0)
-    return Signal::YUnit::MILLIVOLTS;
+  if (QString::compare(str, UNIT_DEGREES_CELSIUS_TEXT) == 0)
+    return Signal::YUnit::DEGREES_CELSIUS;
   else if (QString::compare(str, UNIT_KILOVOLTS_TEXT) == 0)
     return Signal::YUnit::KILOVOLTS;
-  else if (QString::compare(str, UNIT_MICROAMPERES_TEXT) == 0)
+  else if (QString::compare(str, UNIT_MICROAMPERES_TEXT) == 0 ||
+           QString::compare(str, UNIT_MICROAMPERES_ALT1_TEXT) == 0)
     return Signal::YUnit::MICROAMPERES;
   else if (QString::compare(str, UNIT_MILLIAU_TEXT) == 0)
     return Signal::YUnit::MILLIAU;
+  else if (QString::compare(str, UNIT_MILLIBARS_TEXT) == 0)
+    return Signal::YUnit::MILLIBARS;
+  else if (QString::compare(str, UNIT_MILLIVOLTS_TEXT) == 0)
+    return Signal::YUnit::MILLIVOLTS;
   else if (QString::compare(str, UNIT_WATTS_TEXT) == 0)
     return Signal::YUnit::WATTS;
   else
diff --git a/datamanager.h b/datamanager.h
index 538e966..fc1a740 100644
--- a/datamanager.h
+++ b/datamanager.h
@@ -77,9 +77,12 @@ private:
   ExportGraphToImageDialog::Parameters m_oldExportToImageParams;
 
   static const QString ME_SENDER_STR;
+  static const QString UNIT_DEGREES_CELSIUS_TEXT;
   static const QString UNIT_KILOVOLTS_TEXT;
   static const QString UNIT_MICROAMPERES_TEXT;
+  static const QString UNIT_MICROAMPERES_ALT1_TEXT;
   static const QString UNIT_MILLIAU_TEXT;
+  static const QString UNIT_MILLIBARS_TEXT;
   static const QString UNIT_MILLIVOLTS_TEXT;
   static const QString UNIT_WATTS_TEXT;
 
diff --git a/signal.cpp b/signal.cpp
index d6deaf9..b520ce2 100644
--- a/signal.cpp
+++ b/signal.cpp
@@ -27,10 +27,14 @@ const QString Signal::RES_CCD("CCD");
 const QString Signal::RES_CURRENT("Current");
 const QString Signal::RES_DAD("Absorbance");
 const QString Signal::RES_POWER("Power");
+const QString Signal::RES_PRESSURE("Pressure");
+const QString Signal::RES_TEMPERATURE("Temperature");
 const QString Signal::RES_VOLTAGE("Voltage");
+const QString Signal::DEGREES_CELSIUS_SI("\u00B0C");
 const QString Signal::KILOVOTLS_SI("KV");
 const QString Signal::MICROAMPERES_SI("\u03BCA");
 const QString Signal::MILLIAU_SI("mAU");
+const QString Signal::MILLIBARS_SI("mbar");
 const QString Signal::MILLIVOLTS_SI("mV");
 const QString Signal::WATTS_SI("W");
 
@@ -87,6 +91,10 @@ QString Signal::resourceAsString() const {
       return RES_DAD;
     case Resource::CE_POWER:
       return RES_POWER;
+    case Resource::CE_PRESSURE:
+      return RES_PRESSURE;
+    case Resource::CE_TEMPERATURE:
+      return RES_TEMPERATURE;
     case Resource::CE_VOLTAGE:
       return RES_VOLTAGE;
     default:
@@ -128,12 +136,16 @@ QString Signal::xunitAsString() const
 QString Signal::yunitAsString() const
 {
   switch (m_yunit) {
+    case YUnit::DEGREES_CELSIUS:
+      return DEGREES_CELSIUS_SI;
     case YUnit::KILOVOLTS:
       return KILOVOTLS_SI;
     case YUnit::MICROAMPERES:
       return MICROAMPERES_SI;
     case YUnit::MILLIAU:
       return MILLIAU_SI;
+    case YUnit::MILLIBARS:
+      return MILLIBARS_SI;
     case YUnit::MILLIVOLTS:
       return MILLIVOLTS_SI;
     case YUnit::WATTS:
diff --git a/signal.h b/signal.h
index 2013b17..087a4fb 100644
--- a/signal.h
+++ b/signal.h
@@ -41,15 +41,19 @@ public:
     CE_CURRENT,
     CE_DAD,
     CE_POWER,
+    CE_PRESSURE,
+    CE_TEMPERATURE,
     CE_VOLTAGE
   };
   enum class XUnit {
     MINUTE
   };
   enum class YUnit {
+    DEGREES_CELSIUS,
     KILOVOLTS,
     MICROAMPERES,
     MILLIAU,
+    MILLIBARS,
     MILLIVOLTS,
     WATTS
   };
@@ -99,10 +103,14 @@ private:
   static const QString RES_CURRENT;
   static const QString RES_DAD;
   static const QString RES_POWER;
+  static const QString RES_PRESSURE;
+  static const QString RES_TEMPERATURE;
   static const QString RES_VOLTAGE;
+  static const QString DEGREES_CELSIUS_SI;
   static const QString KILOVOTLS_SI;
   static const QString MICROAMPERES_SI;
   static const QString MILLIAU_SI;
+  static const QString MILLIBARS_SI;
   static const QString MILLIVOLTS_SI;
   static const QString WATTS_SI;