Mercurial > public > ostc_companion
comparison OSTCSportOperations.cpp @ 8:21ce6187d32e
Minor changes done by automatic style checker
| author | Ideenmodellierer |
|---|---|
| date | Mon, 12 Jan 2026 13:51:17 +0000 |
| parents | 0b3630a29ad8 |
| children |
comparison
equal
deleted
inserted
replaced
| 7:0969ef86c42d | 8:21ce6187d32e |
|---|---|
| 36 | 36 |
| 37 #include "OSTCSportOperations.h" | 37 #include "OSTCSportOperations.h" |
| 38 | 38 |
| 39 #include "Utils/Log.h" | 39 #include "Utils/Log.h" |
| 40 | 40 |
| 41 #include <QRegularExpression> | |
| 41 #include <QStringList> | 42 #include <QStringList> |
| 42 #include <QRegularExpression> | |
| 43 | 43 |
| 44 ////////////////////////////////////////////////////////////////////////////// | 44 ////////////////////////////////////////////////////////////////////////////// |
| 45 | 45 |
| 46 OSTCSportOperations::OSTCSportOperations() | 46 OSTCSportOperations::OSTCSportOperations() |
| 47 { | 47 { |
| 65 } | 65 } |
| 66 #endif | 66 #endif |
| 67 QRegularExpression OSTCSportOperations::portTemplate() const | 67 QRegularExpression OSTCSportOperations::portTemplate() const |
| 68 { | 68 { |
| 69 #if defined(Q_OS_MAC) | 69 #if defined(Q_OS_MAC) |
| 70 return QRegularExpression("tty.OSTCs.*", | 70 return QRegularExpression("tty.OSTCs.*", QRegularExpression::CaseInsensitiveOption); |
| 71 QRegularExpression::CaseInsensitiveOption); | |
| 72 #elif defined(Q_OS_LINUX) | 71 #elif defined(Q_OS_LINUX) |
| 73 // Debian, Ubuntu, SUSE, benötigt rfcomm-Paket | 72 // Debian, Ubuntu, SUSE, benötigt rfcomm-Paket |
| 74 return QRegularExpression("rfcomm.*", | 73 return QRegularExpression("rfcomm.*", QRegularExpression::CaseInsensitiveOption); |
| 75 QRegularExpression::CaseInsensitiveOption); | |
| 76 #elif defined(Q_OS_WIN) | 74 #elif defined(Q_OS_WIN) |
| 77 return QRegularExpression("COM.*"); // default: case-sensitive | 75 return QRegularExpression("COM.*"); // default: case-sensitive |
| 78 #endif | 76 #endif |
| 79 } | 77 } |
| 80 ////////////////////////////////////////////////////////////////////////////// | 78 ////////////////////////////////////////////////////////////////////////////// |
| 83 { | 81 { |
| 84 descriptionString.clear(); | 82 descriptionString.clear(); |
| 85 | 83 |
| 86 LOG_TRACE("Getting model..."); | 84 LOG_TRACE("Getting model..."); |
| 87 HardwareDescriptor hw = hardwareDescriptor(); | 85 HardwareDescriptor hw = hardwareDescriptor(); |
| 88 if( hw != HW_UNKNOWN_OSTC && hw != HW_OSTCSport_a && hw != HW_OSTCSport_b ) | 86 if (hw != HW_UNKNOWN_OSTC && hw != HW_OSTCSport_a && hw != HW_OSTCSport_b) |
| 89 LOG_THROW( "Not an OSTC Sport." ); | 87 LOG_THROW("Not an OSTC Sport."); |
| 90 | 88 |
| 91 LOG_TRACE("Getting identity..."); | 89 LOG_TRACE("Getting identity..."); |
| 92 getCommonIdentity(); | 90 getCommonIdentity(); |
| 93 | 91 |
| 94 // OTC Sport fw is between 10.00 and 19.99 (coded 100x Hi + Lo) | 92 // OTC Sport fw is between 10.00 and 19.99 (coded 100x Hi + Lo) |
| 95 // and serial is between 10.000 and 19.999 | 93 // and serial is between 10.000 and 19.999 |
| 96 if( hw == HW_UNKNOWN_OSTC | 94 if (hw == HW_UNKNOWN_OSTC |
| 97 && ( firmware() < 1000 || firmware() > 1999 | 95 && (firmware() < 1000 || firmware() > 1999 || serialNumber() < 10000 |
| 98 || serialNumber() < 10000 || serialNumber() > 20000) ) | 96 || serialNumber() > 20000)) |
| 99 LOG_THROW( "Not an OSTC Sport (fw " | 97 LOG_THROW("Not an OSTC Sport (fw " << (firmware() / 100) << "." |
| 100 << (firmware()/100) << "." << QString::asprintf("%02d", firmware()%100) << ", #" | 98 << QString::asprintf("%02d", firmware() % 100) << ", #" |
| 101 << serialNumber() << ")."); | 99 << serialNumber() << ")."); |
| 102 hw = HW_OSTCSport_a; | 100 hw = HW_OSTCSport_a; |
| 103 | 101 |
| 104 LOG_TRACE("Found " << descriptionString); | 102 LOG_TRACE("Found " << descriptionString); |
| 105 } | 103 } |
| 106 | 104 |
| 129 } | 127 } |
| 130 | 128 |
| 131 HardwareOperations::CompanionFeatures OSTCSportOperations::supported() const | 129 HardwareOperations::CompanionFeatures OSTCSportOperations::supported() const |
| 132 { | 130 { |
| 133 // No ICON, no DUMPSCREEN, no HELIUM, no CCR | 131 // No ICON, no DUMPSCREEN, no HELIUM, no CCR |
| 134 return CompanionFeatures(PARAMETERS|DATE|NAME|FIRMWARE | 132 return CompanionFeatures(PARAMETERS | DATE | NAME | FIRMWARE | BLUETOOTH); |
| 135 |BLUETOOTH); | |
| 136 } | 133 } |
