Commit 2bbf758b by “liusq”

当sn相同ip不相同,强制下线以前ip,按理来说修改ip,以前应该句柄抓图会失败

parent 47306f3d
...@@ -910,6 +910,9 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){ ...@@ -910,6 +910,9 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){
void CameraHandle::findIp(QString &ip){ void CameraHandle::findIp(QString &ip){
ip=QString::fromStdString(loginParam->sDevId); ip=QString::fromStdString(loginParam->sDevId);
} }
void CameraHandle::findPort(int &port){
port=loginParam->nDevPort;
}
void CameraHandle::findFirmwareVersion(QString &firmwareVersion){ void CameraHandle::findFirmwareVersion(QString &firmwareVersion){
char szOutBuffer[1024] = { 0 }; char szOutBuffer[1024] = { 0 };
......
...@@ -125,6 +125,9 @@ public: ...@@ -125,6 +125,9 @@ public:
//获取ip //获取ip
void findIp(QString &ip); void findIp(QString &ip);
void findPort(int &port);
void sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id, void sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id,
QString startTimer,QString endTime); QString startTimer,QString endTime);
void batchRegionalPushLicensePlate(QByteArray &imgs,qint64 currentTime,vides_data::requestLicensePlate &newPlate); void batchRegionalPushLicensePlate(QByteArray &imgs,qint64 currentTime,vides_data::requestLicensePlate &newPlate);
......
...@@ -531,7 +531,7 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -531,7 +531,7 @@ void MainWindow::startCamera(const QString &httpurl){
HttpService httpService(httpurl); HttpService httpService(httpurl);
vides_data::response *re= httpService.httpFindCameras(serialNumber,devices); vides_data::response *re= httpService.httpFindCameras(serialNumber,devices);
if(re->code==0 || re->code==20004){ if(re->code==0 || re->code==20004){
//本次搜索到设备列表
std::map<QString,vides_data::localDeviceStatus*> localDevices; std::map<QString,vides_data::localDeviceStatus*> localDevices;
mediaFaceImage->SdkSearchDevicesSyn(localDevices); mediaFaceImage->SdkSearchDevicesSyn(localDevices);
if(localDevices.size()<=0){ if(localDevices.size()<=0){
...@@ -574,6 +574,17 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -574,6 +574,17 @@ void MainWindow::startCamera(const QString &httpurl){
instace.deleteObj(devRes); instace.deleteObj(devRes);
//未连接的CameraHandle //未连接的CameraHandle
if(faceDetectionParkingPushs.count(key)<=0){ if(faceDetectionParkingPushs.count(key)<=0){
//ip变了 sn一样
auto old=findHandle(device.sSn);
if(old!=nullptr){
QString ipAddress;
int port;
old->findIp(ipAddress);
old->findPort(port);
qInfo()<<QString("SN(%1): 清理掉变动的老ip:%2,port:%3").arg(device.sSn)
.arg(ipAddress).arg(port);
clearOfflineCameraHandle(ipAddress,port);
}else{
vides_data::cameraParameters parameter; vides_data::cameraParameters parameter;
parameter.sDevId=ipAddress; parameter.sDevId=ipAddress;
parameter.nDevPort=localDevice->TCPPort; parameter.nDevPort=localDevice->TCPPort;
...@@ -587,6 +598,7 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -587,6 +598,7 @@ void MainWindow::startCamera(const QString &httpurl){
//parameter.rtspUrl=std::move(QString("rtsp://admin:@%1/stream1").arg(ipAddress)); //parameter.rtspUrl=std::move(QString("rtsp://admin:@%1/stream1").arg(ipAddress));
this->initCameras(parameter,devConfig,device.areas,reStatus.camera_info_list); this->initCameras(parameter,devConfig,device.areas,reStatus.camera_info_list);
} }
}
else { else {
auto it = this->faceDetectionParkingPushs.find(key); auto it = this->faceDetectionParkingPushs.find(key);
if (it != this->faceDetectionParkingPushs.end()) { if (it != this->faceDetectionParkingPushs.end()) {
...@@ -598,8 +610,6 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -598,8 +610,6 @@ void MainWindow::startCamera(const QString &httpurl){
camera_info.mac=localDevice->mac; camera_info.mac=localDevice->mac;
reStatus.camera_info_list.push_front(camera_info); reStatus.camera_info_list.push_front(camera_info);
qInfo()<<"推送mac地址"<<localDevice->mac;;
HttpService http_gb28181(httpurl); HttpService http_gb28181(httpurl);
vides_data::response *res=http_gb28181.httpFindGb28181Config(camera_info.sSn); vides_data::response *res=http_gb28181.httpFindGb28181Config(camera_info.sSn);
if(res->code!=0){ if(res->code!=0){
...@@ -659,6 +669,9 @@ bool MainWindow::isDeviceInList(const QString& deviceId, const std::list<vides_d ...@@ -659,6 +669,9 @@ bool MainWindow::isDeviceInList(const QString& deviceId, const std::list<vides_d
}); });
return it != devices.end(); // 如果迭代器不是end,说明找到了匹配项 return it != devices.end(); // 如果迭代器不是end,说明找到了匹配项
} }
//从localDevices中过滤出不在devices列表中的设备 //从localDevices中过滤出不在devices列表中的设备
void MainWindow::deleteCloudNotCamer(const std::map<QString, vides_data::localDeviceStatus*>& localDevices, void MainWindow::deleteCloudNotCamer(const std::map<QString, vides_data::localDeviceStatus*>& localDevices,
const std::list<vides_data::responseDeviceStatus>& devices) { const std::list<vides_data::responseDeviceStatus>& devices) {
......
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