实现安全帽阈值下发控制。
This commit is contained in:
parent
559867bd31
commit
dbe7c1a64e
@ -240,7 +240,7 @@ void DeviceConnection::updateAntiClipAreaPoints(bool enabled, const QList<QPoint
|
|||||||
m_requests.push(task);
|
m_requests.push(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceConnection::updateHelmetThreshold(int threshold) {
|
QFuture<bool> DeviceConnection::updateHelmetThreshold(int threshold) {
|
||||||
constexpr auto command = "thresholdwithhat_setdata";
|
constexpr auto command = "thresholdwithhat_setdata";
|
||||||
Task task;
|
Task task;
|
||||||
task.command = command;
|
task.command = command;
|
||||||
@ -254,10 +254,13 @@ void DeviceConnection::updateHelmetThreshold(int threshold) {
|
|||||||
auto text = boost::json::serialize(request);
|
auto text = boost::json::serialize(request);
|
||||||
m_commandSocket->write(text.data(), text.size());
|
m_commandSocket->write(text.data(), text.size());
|
||||||
};
|
};
|
||||||
|
task.future = std::make_shared<QFutureInterface<bool>>();
|
||||||
if (m_requests.empty()) {
|
if (m_requests.empty()) {
|
||||||
task.task();
|
task.task();
|
||||||
}
|
}
|
||||||
|
auto ret = task.future->future();
|
||||||
m_requests.push(task);
|
m_requests.push(task);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceConnection::requestHelmetThreshold() {
|
void DeviceConnection::requestHelmetThreshold() {
|
||||||
@ -741,6 +744,16 @@ QString DeviceConnection::handleCommand(const std::string_view &replyText, const
|
|||||||
auto &value = data.at("value").as_int64();
|
auto &value = data.at("value").as_int64();
|
||||||
m_infomation.helmetThreshold = value;
|
m_infomation.helmetThreshold = value;
|
||||||
emit helmetThresholdChanged(m_infomation.helmetThreshold);
|
emit helmetThresholdChanged(m_infomation.helmetThreshold);
|
||||||
|
} else if (function == "thresholdwithhat_setdata") {
|
||||||
|
if ((task != nullptr) && (task->command.toStdString() == function)) {
|
||||||
|
if (task->timeoutTimer) {
|
||||||
|
task->timeoutTimer->stop();
|
||||||
|
}
|
||||||
|
bool status = true;
|
||||||
|
if (task->future) {
|
||||||
|
task->future->reportFinished(&status);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG(warning) << "unknown reply: " << replyText;
|
LOG(warning) << "unknown reply: " << replyText;
|
||||||
}
|
}
|
||||||
@ -756,6 +769,7 @@ void DeviceConnection::onConnected() {
|
|||||||
requestAntiClipArea();
|
requestAntiClipArea();
|
||||||
requestNetworkInfomation();
|
requestNetworkInfomation();
|
||||||
requestVideoInformation();
|
requestVideoInformation();
|
||||||
|
requestHelmetThreshold();
|
||||||
emit connected();
|
emit connected();
|
||||||
m_heartbeatTimerId = startTimer(2500);
|
m_heartbeatTimerId = startTimer(2500);
|
||||||
if (m_otaProgress == 99) {
|
if (m_otaProgress == 99) {
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
void updateAntiClipAreaPoints(bool enabled, const QList<QPointF> &points, int sensitivity);
|
void updateAntiClipAreaPoints(bool enabled, const QList<QPointF> &points, int sensitivity);
|
||||||
void requestResolution(Resolution resolution);
|
void requestResolution(Resolution resolution);
|
||||||
void requestNetworkInfomation();
|
void requestNetworkInfomation();
|
||||||
void updateHelmetThreshold(int threshold);
|
QFuture<bool> updateHelmetThreshold(int threshold);
|
||||||
void requestHelmetThreshold();
|
void requestHelmetThreshold();
|
||||||
QFuture<bool> updateNetworkInfomation(bool dhcp, const QString &ip, const QString &netmask, const QString &gateway,
|
QFuture<bool> updateNetworkInfomation(bool dhcp, const QString &ip, const QString &netmask, const QString &gateway,
|
||||||
const QString &dns);
|
const QString &dns);
|
||||||
|
@ -17,6 +17,7 @@ Item {
|
|||||||
property var antiClipAreaPoints: []
|
property var antiClipAreaPoints: []
|
||||||
property bool antiClipAreaEnabled: false
|
property bool antiClipAreaEnabled: false
|
||||||
property int antiClipSensitivity: 1
|
property int antiClipSensitivity: 1
|
||||||
|
property alias helmetThreshold: helmetInput.text
|
||||||
property alias flip: flipSwitch.checked
|
property alias flip: flipSwitch.checked
|
||||||
property alias videoRotation: rotateComboBox.currentIndex
|
property alias videoRotation: rotateComboBox.currentIndex
|
||||||
|
|
||||||
@ -335,6 +336,7 @@ Item {
|
|||||||
ComboBox {
|
ComboBox {
|
||||||
id: antiClipSensitivityComboBox
|
id: antiClipSensitivityComboBox
|
||||||
enabled: root.enabled
|
enabled: root.enabled
|
||||||
|
implicitWidth: 60
|
||||||
Layout.alignment: Qt.AlignLeft
|
Layout.alignment: Qt.AlignLeft
|
||||||
model: [1,2,3,4,5]
|
model: [1,2,3,4,5]
|
||||||
currentIndex: root.antiClipSensitivity-1
|
currentIndex: root.antiClipSensitivity-1
|
||||||
@ -343,12 +345,24 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { text: qsTr("安全帽灵敏度: ")
|
Label { text: qsTr("安全帽阈值: ")
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
}
|
}
|
||||||
TextField {
|
TextField {
|
||||||
|
id: helmetInput
|
||||||
enabled: root.enabled
|
enabled: root.enabled
|
||||||
|
implicitWidth: 60
|
||||||
Layout.alignment: Qt.AlignLeft
|
Layout.alignment: Qt.AlignLeft
|
||||||
|
validator: IntValidator {
|
||||||
|
bottom: 0
|
||||||
|
top: 300
|
||||||
|
}
|
||||||
|
onAccepted: {
|
||||||
|
if(App.currentHelmetThreshold !== parseInt(helmetInput.text)){
|
||||||
|
App.currentHelmetThreshold= parseInt(helmetInput.text)
|
||||||
|
window.showSuccess("设置成功",2500)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {text: qsTr("屏蔽区域: ")}
|
Label {text: qsTr("屏蔽区域: ")}
|
||||||
|
@ -48,7 +48,8 @@ ApplicationWindow {
|
|||||||
id: emptyHint
|
id: emptyHint
|
||||||
visible: false
|
visible: false
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: qsTr("未搜索到设备")
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: qsTr("未搜索到设备\n请尝试关闭Windows防火墙后再重试")
|
||||||
}
|
}
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
width: deviceList.width
|
width: deviceList.width
|
||||||
@ -120,6 +121,7 @@ ApplicationWindow {
|
|||||||
antiClipAreaEnabled: App.currentAntiClipAreaEnabled
|
antiClipAreaEnabled: App.currentAntiClipAreaEnabled
|
||||||
antiClipSensitivity: App.currentAntiClipSensitivity
|
antiClipSensitivity: App.currentAntiClipSensitivity
|
||||||
antiClipAreaPoints: App.currentAntiClipAreaPoints
|
antiClipAreaPoints: App.currentAntiClipAreaPoints
|
||||||
|
helmetThreshold: App.currentHelmetThreshold
|
||||||
flip: App.currentDeviceFlip
|
flip: App.currentDeviceFlip
|
||||||
videoRotation: App.currentDeviceRotation
|
videoRotation: App.currentDeviceRotation
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user