- 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
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>

View File

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

View File

@ -1,7 +1,7 @@
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

View File

@ -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() {

View File

@ -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() {