- now supports sending the command 5002 to pair usb extensions

- updating the time of the basestation is now supported
This commit is contained in:
dorian 2019-11-09 23:10:17 +01:00
parent 3ca49358d1
commit b895b48030
5 changed files with 38 additions and 7 deletions

View file

@ -15,7 +15,7 @@
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
<manifest package="com.itsblue.speedclimbing_stopwatch" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.1" android:versionCode="12" android:installLocation="auto"> <manifest package="com.itsblue.speedclimbing_stopwatchtest" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.1" android:versionCode="12" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="speedclimbing stw" android:icon="@drawable/icon"> <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="speedclimbing stw" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="com.itsblue.speedclimbing_stopwatch.MainActivity" android:label="speedclimbing stw" android:screenOrientation="unspecified" android:launchMode="singleTop"> <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="com.itsblue.speedclimbing_stopwatch.MainActivity" android:label="speedclimbing stw" android:screenOrientation="unspecified" android:launchMode="singleTop">
<intent-filter> <intent-filter>

View file

@ -86,6 +86,7 @@ public slots:
// base station sync // base station sync
void handleBaseStationUpdate(QVariant data); void handleBaseStationUpdate(QVariant data);
Q_INVOKABLE bool pairConnectedUsbExtensions();
// functions for qml // functions for qml
Q_INVOKABLE int getState(); Q_INVOKABLE int getState();

View file

@ -1,7 +1,7 @@
import QtQuick 2.9 import QtQuick 2.9
import QtMultimedia 5.8 import QtMultimedia 5.8
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQuick.Controls 2.2 import QtQuick.Controls 2.12
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
@ -173,7 +173,7 @@ Column {
id: baseStationConnectedOptionsComp id: baseStationConnectedOptionsComp
ScrollView{ ScrollView{
id: flickable
contentHeight: baseStationConnectedOptions.childrenRect.height contentHeight: baseStationConnectedOptions.childrenRect.height
contentWidth: -1 contentWidth: -1
width: parentComp.width width: parentComp.width
@ -185,7 +185,14 @@ Column {
scale: 0.95 scale: 0.95
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AlwaysOff ScrollBar.vertical: ScrollBar {
parent: flickable.parent
anchors.top: flickable.top
anchors.left: flickable.right
anchors.bottom: flickable.bottom
policy: ScrollBar.AlwaysOn
interactive: false
}
Column { Column {
id: baseStationConnectedOptions id: baseStationConnectedOptions
@ -229,6 +236,21 @@ Column {
} }
} }
SmoothItemDelegate {
id: connectUsbExtensionsDel
width: parent.width
height: parentObj.delegateHeight
text: "pair extensions"
onClicked: {
busyDl.open()
var ret = speedBackend.pairConnectedUsbExtensions()
busyDl.displayMessageAndClose(ret ? "OK":"error", ret ? "#6bd43b":"#e03b2f" )
}
}
SmoothItemDelegate { SmoothItemDelegate {
id: baseStationUpdateDel id: baseStationUpdateDel

View file

@ -72,6 +72,7 @@ bool BaseConn::init() {
void BaseConn::deInit() { void BaseConn::deInit() {
this->connections.clear(); this->connections.clear();
emit this->connectionsChanged();
this->setState("disconnected"); this->setState("disconnected");
} }
@ -326,14 +327,15 @@ void BaseConn::socketReplyRecieved(QString reply) {
// ------------------------- // -------------------------
bool BaseConn::updateTime() { bool BaseConn::updateTime() {
if(abs(this->timeOffset) < 10000000) { if(abs(this->timeOffset) < 10000) {
// the time is already up-to-date // the time is already up-to-date
return true; return true;
} }
// NOT IMPLEMENTED YET QVariantMap ret = this->sendCommand(5001, this->date->currentSecsSinceEpoch());
return false; qDebug() << ret;
return ret["status"].toInt() == 200;
} }
bool BaseConn::updateFirmware() { bool BaseConn::updateFirmware() {

View file

@ -470,6 +470,12 @@ void ClimbingRace::refreshTimerText() {
this->timerTextRefreshTimer->start(); this->timerTextRefreshTimer->start();
} }
bool ClimbingRace::pairConnectedUsbExtensions() {
QVariantMap ret = this->baseConn->sendCommand(5002, "", 10000);
qDebug() << ret;
return ret["status"] == 200;
}
// - athlete management - // - athlete management -
QVariant ClimbingRace::getAthletes() { QVariant ClimbingRace::getAthletes() {