Commit 6c388318 by “liusq”

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

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