v0.0.4
This commit is contained in:
parent
a934520cd9
commit
aaccb27f22
3 changed files with 35 additions and 23 deletions
50
Main.qml
50
Main.qml
|
|
@ -6,7 +6,7 @@ import QtQuick.Controls.Material
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
width: 640
|
width: 640
|
||||||
height: 480
|
height: 1080
|
||||||
visible: true
|
visible: true
|
||||||
title: qsTr("Hello World")
|
title: qsTr("Hello World")
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -19,6 +19,11 @@ Window {
|
||||||
property double distance: 0
|
property double distance: 0
|
||||||
property int distance_count: 0
|
property int distance_count: 0
|
||||||
// visibility: Window.FullScreen
|
// visibility: Window.FullScreen
|
||||||
|
Component.onCompleted: {
|
||||||
|
if(Qt.platform.os !== "android") {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
id: background
|
id: background
|
||||||
|
|
@ -176,6 +181,7 @@ Window {
|
||||||
topMargin: 20
|
topMargin: 20
|
||||||
top: settings_label.bottom
|
top: settings_label.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
verticalCenter: max_thres_input.verticalCenter
|
||||||
}
|
}
|
||||||
height: max_thres_input.height
|
height: max_thres_input.height
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
@ -187,8 +193,8 @@ Window {
|
||||||
id: max_thres_input
|
id: max_thres_input
|
||||||
text: config.max
|
text: config.max
|
||||||
anchors {
|
anchors {
|
||||||
left: max_thres_label.right
|
right: parent.right
|
||||||
leftMargin: 5
|
rightMargin: 5
|
||||||
top: settings_label.bottom
|
top: settings_label.bottom
|
||||||
topMargin: 20
|
topMargin: 20
|
||||||
}
|
}
|
||||||
|
|
@ -205,6 +211,7 @@ Window {
|
||||||
topMargin: 20
|
topMargin: 20
|
||||||
top: max_thres_label.bottom
|
top: max_thres_label.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
verticalCenter: min_thres_input.verticalCenter
|
||||||
}
|
}
|
||||||
height: min_thres_input.height
|
height: min_thres_input.height
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
@ -216,8 +223,8 @@ Window {
|
||||||
id: min_thres_input
|
id: min_thres_input
|
||||||
text: config.min
|
text: config.min
|
||||||
anchors {
|
anchors {
|
||||||
left: min_thres_label.right
|
right: parent.right
|
||||||
leftMargin: 5
|
rightMargin: 5
|
||||||
top: max_thres_label.bottom
|
top: max_thres_label.bottom
|
||||||
topMargin: 20
|
topMargin: 20
|
||||||
}
|
}
|
||||||
|
|
@ -234,6 +241,7 @@ Window {
|
||||||
topMargin: 20
|
topMargin: 20
|
||||||
top: min_thres_label.bottom
|
top: min_thres_label.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
verticalCenter: alert_thres_input.verticalCenter
|
||||||
}
|
}
|
||||||
height: alert_thres_input.height
|
height: alert_thres_input.height
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
@ -245,8 +253,8 @@ Window {
|
||||||
id: alert_thres_input
|
id: alert_thres_input
|
||||||
text: config.alert
|
text: config.alert
|
||||||
anchors {
|
anchors {
|
||||||
left: alert_thres_label.right
|
right: parent.right
|
||||||
leftMargin: 5
|
rightMargin: 5
|
||||||
top: min_thres_label.bottom
|
top: min_thres_label.bottom
|
||||||
topMargin: 20
|
topMargin: 20
|
||||||
}
|
}
|
||||||
|
|
@ -261,9 +269,8 @@ Window {
|
||||||
anchors {
|
anchors {
|
||||||
topMargin: 20
|
topMargin: 20
|
||||||
top: alert_thres_label.bottom
|
top: alert_thres_label.bottom
|
||||||
left: parent.left
|
horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
width: parent.width - 20
|
|
||||||
contentItem: Text {
|
contentItem: Text {
|
||||||
text: flip_bits_box.text
|
text: flip_bits_box.text
|
||||||
font.pointSize: root.font_normal_text_size
|
font.pointSize: root.font_normal_text_size
|
||||||
|
|
@ -297,10 +304,11 @@ Window {
|
||||||
anchors {
|
anchors {
|
||||||
topMargin: 10
|
topMargin: 10
|
||||||
bottom: save_config.top
|
bottom: save_config.top
|
||||||
|
bottomMargin: 10
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
color: "#F0121212"
|
color: "#F0121212"
|
||||||
width: parent.width / 2.5
|
width: parent.width / 1.3
|
||||||
height: 60
|
height: 60
|
||||||
border {
|
border {
|
||||||
width: 1
|
width: 1
|
||||||
|
|
@ -320,20 +328,19 @@ Window {
|
||||||
property color settings_rect_pressed_prev: "#00000000"
|
property color settings_rect_pressed_prev: "#00000000"
|
||||||
property color settings_rect_entered_prev: "#00000000"
|
property color settings_rect_entered_prev: "#00000000"
|
||||||
onEntered: {
|
onEntered: {
|
||||||
settings_rect_entered_prev = save_config.color
|
settings_rect_entered_prev = reset_averages.color
|
||||||
save_config.color = "#5A1F1F1F"
|
reset_averages.color = "#5A1F1F1F"
|
||||||
}
|
}
|
||||||
onExited: {
|
onExited: {
|
||||||
save_config.color = settings_rect_entered_prev
|
reset_averages.color = settings_rect_entered_prev
|
||||||
}
|
}
|
||||||
onPressed: {
|
onPressed: {
|
||||||
settings_rect_pressed_prev = save_config.color
|
settings_rect_pressed_prev = reset_averages.color
|
||||||
save_config.color = "#5A1F4F1F"
|
reset_averages.color = "#5A1F4F1F"
|
||||||
settings_popup.close();
|
|
||||||
listener.resetAverages();
|
listener.resetAverages();
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
save_config.color = settings_rect_pressed_prev
|
reset_averages.color = settings_rect_pressed_prev
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -347,7 +354,7 @@ Window {
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
color: "#F0121212"
|
color: "#F0121212"
|
||||||
width: parent.width / 2.5
|
width: parent.width / 1.3
|
||||||
height: 60
|
height: 60
|
||||||
border {
|
border {
|
||||||
width: 1
|
width: 1
|
||||||
|
|
@ -423,7 +430,7 @@ Window {
|
||||||
id: tank_base
|
id: tank_base
|
||||||
color: "#0FFFFFFF"
|
color: "#0FFFFFFF"
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: parent.width / 2.5
|
width: parent.width / 2
|
||||||
height: parent.height / 2
|
height: parent.height / 2
|
||||||
border.color: "#F0121212"
|
border.color: "#F0121212"
|
||||||
border.width: 5
|
border.width: 5
|
||||||
|
|
@ -593,7 +600,10 @@ Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
function dataBlink() {
|
function dataBlink() {
|
||||||
let old_color = status_indicator.color;
|
if(status_indicator_timer.running) {
|
||||||
|
status_indicator_timer.stop();
|
||||||
|
}
|
||||||
|
let old_color = "#F05F5F0F";
|
||||||
let new_color = "#F04FAF5F";
|
let new_color = "#F04FAF5F";
|
||||||
status_indicator.color = new_color;
|
status_indicator.color = new_color;
|
||||||
status_indicator.old_color = old_color;
|
status_indicator.old_color = old_color;
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ public class WaterLevelService extends Service {
|
||||||
else {
|
else {
|
||||||
Instant currentTimestamp = Instant.now();
|
Instant currentTimestamp = Instant.now();
|
||||||
Duration duration = Duration.between(prevAlertTimestamp, currentTimestamp);
|
Duration duration = Duration.between(prevAlertTimestamp, currentTimestamp);
|
||||||
if(duration.toMinutes() > 30) {
|
if(duration.toMinutes() > 60) {
|
||||||
duration_passed = true;
|
duration_passed = true;
|
||||||
}
|
}
|
||||||
prevAlertTimestamp = currentTimestamp;
|
prevAlertTimestamp = currentTimestamp;
|
||||||
|
|
@ -113,9 +113,12 @@ public class WaterLevelService extends Service {
|
||||||
.setSmallIcon(android.R.drawable.ic_dialog_alert)
|
.setSmallIcon(android.R.drawable.ic_dialog_alert)
|
||||||
.setContentTitle("Water Level Sensor")
|
.setContentTitle("Water Level Sensor")
|
||||||
.setContentText("Water Level is below alert threshold")
|
.setContentText("Water Level is below alert threshold")
|
||||||
.setPriority(Notification.PRIORITY_HIGH);
|
.setPriority(Notification.PRIORITY_LOW);
|
||||||
manager.notify(2, builder.build());
|
manager.notify(2, builder.build());
|
||||||
Log.d("UDP Service", "Notification sent");
|
Log.d("UDP Service", "Notification sent");
|
||||||
|
if(!started) {
|
||||||
|
started = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DatagramPacket send_packet = new DatagramPacket(buffer, buffer.length, InetAddress.getByName("localhost"), 8180);
|
DatagramPacket send_packet = new DatagramPacket(buffer, buffer.length, InetAddress.getByName("localhost"), 8180);
|
||||||
socket_send.send(send_packet);
|
socket_send.send(send_packet);
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ public:
|
||||||
curr = curr->next;
|
curr = curr->next;
|
||||||
delete now;
|
delete now;
|
||||||
}
|
}
|
||||||
qDebug() << "Clearing";
|
|
||||||
curr = nullptr;
|
curr = nullptr;
|
||||||
head = nullptr;
|
head = nullptr;
|
||||||
tail = nullptr;
|
tail = nullptr;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue