Commit 0c00f03d by “liusq”

修改WIFI判断

parent 0fc5b03b
...@@ -1048,7 +1048,7 @@ int CameraHandle::resetGb28181(){ ...@@ -1048,7 +1048,7 @@ int CameraHandle::resetGb28181(){
bool result= connectedCameraHandle->changeCameraIp(device); bool result= connectedCameraHandle->changeCameraIp(device);
int newHandle=-1; int newHandle=-1;
if(!result ){ if(!result ){
result=connectedCameraHandle->wifiChangeIp(reachableIp,false,old,sSn); result=connectedCameraHandle->wifiChangeIp(reachableIp,old,sSn);
is_wifi=true; is_wifi=true;
if(result){ if(result){
QThread::sleep(1); QThread::sleep(1);
...@@ -1058,7 +1058,6 @@ int CameraHandle::resetGb28181(){ ...@@ -1058,7 +1058,6 @@ int CameraHandle::resetGb28181(){
if(sdk_handle<0){ if(sdk_handle<0){
qInfo()<<QString("SN(%1): WIFI老句柄:%2").arg(sSn).arg(old); qInfo()<<QString("SN(%1): WIFI老句柄:%2").arg(sSn).arg(old);
qInfo()<<QString("SN(%1): WIFI新句柄生成失败").arg(sSn); qInfo()<<QString("SN(%1): WIFI新句柄生成失败").arg(sSn);
this->hDevice=old; this->hDevice=old;
return -1; return -1;
}else { }else {
...@@ -1076,7 +1075,7 @@ int CameraHandle::resetGb28181(){ ...@@ -1076,7 +1075,7 @@ int CameraHandle::resetGb28181(){
MainWindow::sp_this->findSnMapIp(this->sSn,old_ip); MainWindow::sp_this->findSnMapIp(this->sSn,old_ip);
if(old_ip.length()>0){ if(old_ip.length()>0){
if(is_wifi){ if(is_wifi){
result=connectedCameraHandle->wifiChangeIp(old_ip,true,newHandle,sSn); result=connectedCameraHandle->wifiChangeIp(old_ip,newHandle,sSn);
int sdk_handle=this->sdkDevLoginSyn(old_ip,loginParam->nDevPort,loginParam->sUserName,loginParam->sPassword,3000); int sdk_handle=this->sdkDevLoginSyn(old_ip,loginParam->nDevPort,loginParam->sUserName,loginParam->sPassword,3000);
if(sdk_handle<0){ if(sdk_handle<0){
qInfo()<<QString("SN(%1): WIFI新句柄生成失败").arg(sSn); qInfo()<<QString("SN(%1): WIFI新句柄生成失败").arg(sSn);
......
...@@ -150,18 +150,18 @@ bool NonConnectedCameraHandle::changeCameraIp(vides_data::localDevice &device){ ...@@ -150,18 +150,18 @@ bool NonConnectedCameraHandle::changeCameraIp(vides_data::localDevice &device){
return true; return true;
} }
bool NonConnectedCameraHandle::wifiChangeIp(QString &Ip, bool is_connect, bool NonConnectedCameraHandle::wifiChangeIp(QString &Ip,
int h_device,QString &sSn){ int h_device,QString &sSn){
Common & instace= Common::getInstance(); Common & instace= Common::getInstance();
XSDK_CFG::NetWork_Wifi wif; XSDK_CFG::NetWork_Wifi wif;
printWifi(h_device,wif); printWifi(h_device,wif);
if(is_connect){ // if(is_connect){
if(!isWifiConnect(h_device,wif)){ // if(!isWifiConnect(h_device,wif)){
qInfo()<<QString("SN(%1): 不是wifi连接").arg(sSn); // qInfo()<<QString("SN(%1): 不是wifi连接").arg(sSn);
return false; // return false;
} // }
} // }
QString hex=instace.DecIpToHexIp(Ip); QString hex=instace.DecIpToHexIp(Ip);
QByteArray && byIp = hex.toUtf8(); QByteArray && byIp = hex.toUtf8();
...@@ -292,11 +292,11 @@ bool NonConnectedCameraHandle::distributionNetwork(QString &ip,QString &sSn,int ...@@ -292,11 +292,11 @@ bool NonConnectedCameraHandle::distributionNetwork(QString &ip,QString &sSn,int
if(old<0){ if(old<0){
qInfo()<<QString("SN(%1): WIFI修改IP,新生成句柄失败").arg(sSn); qInfo()<<QString("SN(%1): WIFI修改IP,新生成句柄失败").arg(sSn);
}else { }else {
result=wifiChangeIp(reachableIp,false,old,sSn); result=wifiChangeIp(reachableIp,old,sSn);
} }
}else { }else {
qInfo()<<QString("newIP(%1): wifiChangeIp").arg(reachableIp); qInfo()<<QString("newIP(%1): wifiChangeIp").arg(reachableIp);
result=wifiChangeIp(reachableIp,false,old,sSn); result=wifiChangeIp(reachableIp,old,sSn);
XSDK_DevLogout(old); XSDK_DevLogout(old);
} }
} }
......
...@@ -19,7 +19,7 @@ public: ...@@ -19,7 +19,7 @@ public:
//有线修改相机ip //有线修改相机ip
bool changeCameraIp(vides_data::localDevice &device); bool changeCameraIp(vides_data::localDevice &device);
//无线修改相机ip //无线修改相机ip
bool wifiChangeIp(QString &Ip, bool is_connect, int h_device,QString &sn); bool wifiChangeIp(QString &Ip,int h_device,QString &sn);
bool isWifiConnect(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg); bool isWifiConnect(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg);
......
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