Commit b895b480 authored by Dorian Zedler's avatar Dorian Zedler

- now supports sending the command 5002 to pair usb extensions

- updating the time of the basestation is now supported
parent 3ca49358
......@@ -15,7 +15,7 @@
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/>.
-->
<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">
<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>
......
......@@ -86,6 +86,7 @@ public slots:
// base station sync
void handleBaseStationUpdate(QVariant data);
Q_INVOKABLE bool pairConnectedUsbExtensions();
// functions for qml
Q_INVOKABLE int getState();
......
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
......@@ -173,7 +173,7 @@ Column {
id: baseStationConnectedOptionsComp
ScrollView{
id: flickable
contentHeight: baseStationConnectedOptions.childrenRect.height
contentWidth: -1
width: parentComp.width
......@@ -185,7 +185,14 @@ Column {
scale: 0.95
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 {
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 {
id: baseStationUpdateDel
......
......@@ -72,6 +72,7 @@ bool BaseConn::init() {
void BaseConn::deInit() {
this->connections.clear();
emit this->connectionsChanged();
this->setState("disconnected");
}
......@@ -326,14 +327,15 @@ void BaseConn::socketReplyRecieved(QString reply) {
// -------------------------
bool BaseConn::updateTime() {
if(abs(this->timeOffset) < 10000000) {
if(abs(this->timeOffset) < 10000) {
// the time is already up-to-date
return true;
}
// NOT IMPLEMENTED YET
return false;
QVariantMap ret = this->sendCommand(5001, this->date->currentSecsSinceEpoch());
qDebug() << ret;
return ret["status"].toInt() == 200;
}
bool BaseConn::updateFirmware() {
......
......@@ -470,6 +470,12 @@ void ClimbingRace::refreshTimerText() {
this->timerTextRefreshTimer->start();
}
bool ClimbingRace::pairConnectedUsbExtensions() {
QVariantMap ret = this->baseConn->sendCommand(5002, "", 10000);
qDebug() << ret;
return ret["status"] == 200;
}
// - athlete management -
QVariant ClimbingRace::getAthletes() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment