Commit 6c388318 by “liusq”

修复ping命令进程生命周期问题

parent 402424fb
......@@ -436,7 +436,9 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
QString ip=QString::fromUtf8(loginParam->sDevId);
bool is_ping=vides_data::pingAddress(ip);
if(!is_ping){
qInfo() << "ping 的结果"<<is_ping;
if(is_ping){
deviceReboot();
}else {
QString ip=QString::fromUtf8(loginParam->sDevId);
......@@ -932,9 +934,10 @@ void CameraHandle::licensePlateRecognitionResults(vides_data::requestLicensePlat
for (auto& plate : location.plates) {
plate.img.clear();
}
httpService.setHttpUrl(httpUrl);
vides_data::response* img_resp = httpService.httpLicensePlateRecognition(location, result);
if (img_resp->code != 0) {
qInfo()<<"不加图片上次失败";
qInfo()<<"车牌不加图片上传失败";
}
instace.deleteObj(img_resp);
}else{
......
......@@ -114,7 +114,7 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
qInfo() << "Failed to parse JSON payload";
}
int res=-2;
//1开 2关 3 重启
//1开 2关 3 重启 4 GB28181开 5 GB28181关
CameraHandle*cameraHandle= MainWindow::sp_this->findHandle(response.sn);
if(cameraHandle==nullptr){
qInfo() << "不存在该相机";
......@@ -126,10 +126,14 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
if(response.msg_type==3){
res= cameraHandle->deviceReboot();
}
if(response.msg_type==4){
res=cameraHandle->updateSdkDevStatus(true);
}
if(response.msg_type==5){
res= cameraHandle->updateSdkDevStatus(false);
}
}
vides_data::requestMqttData request;
qInfo() << "res"<<res;
vides_data::requestMqttData request;
request.code =res>=0?0:0x01;
request.uniq = response.uniq;
request.sn=response.sn ;
......@@ -146,7 +150,7 @@ void MqttSubscriber::sendSubscriptionConfirmation(const vides_data::requestMqttD
QByteArray bResponseTopic = responseTopic.toUtf8();
char* cResponseTopic = bResponseTopic.data();
qInfo() << "sendSubscriptionConfirmation"<<cResponseTopic;
// 将 struct 转换成 JSON 格式
QJsonObject json;
json["code"] = response.code;
......@@ -154,7 +158,7 @@ void MqttSubscriber::sendSubscriptionConfirmation(const vides_data::requestMqttD
QJsonDocument jsonDoc(json);
QByteArray payload = jsonDoc.toJson(QJsonDocument::Compact);
MQTTAsync_message pubmsg = MQTTAsync_message_initializer;
pubmsg.payload = const_cast<char*>(payload.data());
pubmsg.payloadlen = payload.size();
pubmsg.qos = config.qos;
......
......@@ -134,5 +134,5 @@ qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
BG.qrc
#RESOURCES += \
# BG.qrc
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