Commit 47306f3d by “liusq”

修改gb28181和新增mac推送

parent 0fd25424
...@@ -1017,7 +1017,7 @@ void CameraHandle::printWifi(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg){ ...@@ -1017,7 +1017,7 @@ void CameraHandle::printWifi(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg){
需注意和定时任务对比GB28181配置冲突处理 需注意和定时任务对比GB28181配置冲突处理
需确认修改IP后抓图是否正常,如不正常需在命令开始前增加删除句柄,命令完成后增加句柄以保证抓图实时性 需确认修改IP后抓图是否正常,如不正常需在命令开始前增加删除句柄,命令完成后增加句柄以保证抓图实时性
*/ */
int CameraHandle::resetGb28181(QString &uuiq){ int CameraHandle::resetGb28181(){
NonConnectedCameraHandle *connectedCameraHandle =NonConnectedCameraHandle::getInstance(); NonConnectedCameraHandle *connectedCameraHandle =NonConnectedCameraHandle::getInstance();
int old=this->hDevice; int old=this->hDevice;
qInfo()<<QString("SN(%1): resetGb28181老句柄%2").arg(sSn).arg(old); qInfo()<<QString("SN(%1): resetGb28181老句柄%2").arg(sSn).arg(old);
...@@ -1110,6 +1110,67 @@ int CameraHandle::resetGb28181(QString &uuiq){ ...@@ -1110,6 +1110,67 @@ int CameraHandle::resetGb28181(QString &uuiq){
//this->updateSdkDevStatus(true); //this->updateSdkDevStatus(true);
return 1; return 1;
} }
void CameraHandle::initWorkSpVMn(vides_data::responseGb28181 *gb28181, QString &workSpWMn){
// 构建 toJsonObject
QJsonObject toJsonObject;
toJsonObject["szCsIP"] = gb28181->sip_ip;
toJsonObject["szServerNo"] = gb28181->serial;
toJsonObject["sCsPort"] = gb28181->sip_port;
toJsonObject["szServerDn"] = gb28181->realm;
toJsonObject["iRsAgedTime"] = gb28181->register_validity;
toJsonObject["iHsIntervalTime"] = gb28181->heartbeat_interval;
toJsonObject["szConnPass"] = gb28181->password;
toJsonObject["szDeviceNO"] = gb28181->device_id;
// 构建 AlarmLevel 数组
QJsonArray alarmLevelArray;
for (int i = 0; i < 8; ++i) {
alarmLevelArray.append(0);
}
toJsonObject["AlarmLevel"] = alarmLevelArray;
// 构建 Alarmid 数组
QJsonArray alarmidArray;
for (int i = 1; i <= 8; ++i) {
alarmidArray.append("3402000000134000000" + QString::number(i, 10).rightJustified(2, '0'));
}
toJsonObject["Alarmid"] = alarmidArray;
// 构建 CamreaLevel 数组
QJsonArray camreaLevelArray;
for (int i = 0; i < 8; ++i) {
camreaLevelArray.append(0);
}
toJsonObject["CamreaLevel"] = camreaLevelArray;
// 构建 Camreaid 数组
QJsonArray camreaidArray;
for (int i = 1; i <= 8; ++i) {
if (i == 1) {
camreaidArray.append(gb28181->channel_id);
} else {
camreaidArray.append("3402000000131000001" + QString::number(i, 10).rightJustified(2, '0'));
}
}
toJsonObject["Camreaid"] = camreaidArray;
// 添加其他字段
toJsonObject["HeartBeatCount"] = 0;
toJsonObject["bCsEnable"] = true;
toJsonObject["uiAlarmStateBlindEnable"] = "0xFFFFFFFF";
toJsonObject["uiAlarmStateConnectEnable"] = "0xFFFFFFFF";
toJsonObject["uiAlarmStateGpinEnable"] = "0xFFFFFFFF";
toJsonObject["uiAlarmStateLoseEnable"] = "0xFFFFFFFF";
toJsonObject["uiAlarmStateMotionEnable"] = "0xFFFFFFFF";
toJsonObject["uiAlarmStatePerformanceEnable"] = "0xFFFFFFFF";
toJsonObject["sUdpPort"] = 5060;
// 生成 workSpWMn
QJsonDocument doc(toJsonObject);
QByteArray jsonDataOutput = doc.toJson(QJsonDocument::Compact);
workSpWMn = QString::fromUtf8(jsonDataOutput);
}
int CameraHandle::forceWriteGb28181(){ int CameraHandle::forceWriteGb28181(){
Common & instace= Common::getInstance(); Common & instace= Common::getInstance();
...@@ -1117,63 +1178,18 @@ int CameraHandle::forceWriteGb28181(){ ...@@ -1117,63 +1178,18 @@ int CameraHandle::forceWriteGb28181(){
vides_data::response *res=http_gb28181.httpFindGb28181Config(sSn); vides_data::response *res=http_gb28181.httpFindGb28181Config(sSn);
ScopeSemaphoreExit guard([&instace,&res]() { ScopeSemaphoreExit guard([&instace,&res]() {
instace.deleteObj(res); instace.deleteObj(res);
}); });
if(res->code!=0){ if(res->code!=0){
qInfo()<<"请求摄像头gb28181配置失败"; qInfo()<<"请求摄像头gb28181配置失败";
return -1; return -1;
} }
QString stGb281;
vides_data::responseGb28181 *gb28181 = reinterpret_cast<vides_data::responseGb28181*>(res->data); vides_data::responseGb28181 *gb28181 = reinterpret_cast<vides_data::responseGb28181*>(res->data);
XSDK_CFG::NetWork_SPVMN config; initWorkSpVMn(gb28181,stGb281); QByteArray bGb =stGb281.toUtf8();
const char* pCfg=bGb.data();
config.Camreaid.InitArraySize(64); qInfo()<<"forceWriteGb28181"<<pCfg;
for (int i = 1; i <= 64; ++i) {
if (i == 1) {
QByteArray b_StrValue = gb28181->channel_id.toUtf8();
const char* str_Value = b_StrValue.constData();
JStrObj* newCameraId = &config.Camreaid[i - 1];
newCameraId->operator=(str_Value);
} else {
QString str("3402000000131000001" + QString::number(i, 10).rightJustified(2, '0'));
QByteArray b_Str = str.toUtf8();
const char* s_ct = b_Str.constData();
JStrObj* newCameraId = &config.Camreaid[i - 1];
newCameraId->operator=(s_ct);
}
}
QByteArray && bSip_ip= gb28181->sip_ip.toUtf8();
char* sip_ip = bSip_ip.data();
config.szCsIP.SetValue(sip_ip);
QByteArray && bSzServerNo=gb28181->serial.toUtf8();
char* sz_ServerNo = bSzServerNo.data();
config.szServerNo.SetValue(sz_ServerNo);
config.sCsPort.SetValue(gb28181->sip_port);
config.sUdpPort.SetValue(5060);
QByteArray && bSzServerDn=gb28181->realm.toUtf8();
char* sz_ServerDn = bSzServerDn.data();
config.szServerDn.SetValue(sz_ServerDn);
config.bCsEnable.SetValue(true);
config.iRsAgedTime.SetValue(gb28181->register_validity);
config.iHsIntervalTime.SetValue(gb28181->heartbeat_interval);
QByteArray && bSzConnPass=gb28181->password.toUtf8();
char* sz_connPass = bSzConnPass.data();
config.szConnPass.SetValue(sz_connPass);
QByteArray && bDevice_id=gb28181->device_id.toUtf8();
char* cdevice_id = bDevice_id.data();
config.szDeviceNO.SetValue(cdevice_id);
const char* pCfg = config.ToString();
sdkDevSpvMn(pCfg);
return sdkDevSpvMn(pCfg);
} }
bool CameraHandle::sdkWifi(QString &pwd,QString &ssid){ bool CameraHandle::sdkWifi(QString &pwd,QString &ssid){
......
...@@ -114,11 +114,14 @@ public: ...@@ -114,11 +114,14 @@ public:
//获取固件版本 //获取固件版本
void findFirmwareVersion(QString &firmwareVersion); void findFirmwareVersion(QString &firmwareVersion);
//复位GB28181 //复位GB28181
int resetGb28181(QString &uuiq); int resetGb28181();
//强制gb28181配置后写入摄像头 //强制gb28181配置后写入摄像头
int forceWriteGb28181(); int forceWriteGb28181();
void initWorkSpVMn(vides_data::responseGb28181 *gb28181, QString &workSpWMn);
//获取ip //获取ip
void findIp(QString &ip); void findIp(QString &ip);
...@@ -205,6 +208,7 @@ private : ...@@ -205,6 +208,7 @@ private :
int offlineCount=0; int offlineCount=0;
QSemaphore semaphore; QSemaphore semaphore;
int image_save; int image_save;
......
...@@ -201,10 +201,6 @@ bool Common::pingAddress(const QString &address) { ...@@ -201,10 +201,6 @@ bool Common::pingAddress(const QString &address) {
return true; // 成功,返回true return true; // 成功,返回true
} }
//获取本机mask //获取本机mask
bool GetLocalNetMask(const char *eth_inf,char* netmask_addr) bool GetLocalNetMask(const char *eth_inf,char* netmask_addr)
{ {
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define ICMP_HDRLEN 8 #define ICMP_HDRLEN 8
#define PAYLOAD_SIZE 56 #define PAYLOAD_SIZE 56
#define MAC_SIZE 18
// ICMP 头部结构体 // ICMP 头部结构体
struct ICMPHeader { struct ICMPHeader {
uint8_t type; // 类型 uint8_t type; // 类型
...@@ -79,6 +79,7 @@ public: ...@@ -79,6 +79,7 @@ public:
bool pingAddress(const QString &address) ; bool pingAddress(const QString &address) ;
QString getImages(); QString getImages();
void setImages(QString images); void setImages(QString images);
......
...@@ -70,7 +70,8 @@ void FaceReconitionHandle::initSourceImageMap(std::map<QString,QString>&maps,int ...@@ -70,7 +70,8 @@ void FaceReconitionHandle::initSourceImageMap(std::map<QString,QString>&maps,int
ScopeSemaphoreExit streamGuard([this]() { ScopeSemaphoreExit streamGuard([this]() {
isImageChanged.store(false, std::memory_order_release); isImageChanged.store(false, std::memory_order_release);
}); });
featureRemove(); //featureRemove();
featureRemoveMap(maps);
HResult ret; HResult ret;
// 初始化context // 初始化context
#if defined(__arm__) || defined(__ARM_ARCH) #if defined(__arm__) || defined(__ARM_ARCH)
...@@ -95,7 +96,7 @@ void FaceReconitionHandle::initSourceImageMap(std::map<QString,QString>&maps,int ...@@ -95,7 +96,7 @@ void FaceReconitionHandle::initSourceImageMap(std::map<QString,QString>&maps,int
return; return;
} }
} }
customIds.clear(); //customIds.clear();
int i = 0; int i = 0;
qInfo()<< "加载图像size: "<<maps.size(); qInfo()<< "加载图像size: "<<maps.size();
...@@ -146,7 +147,8 @@ void FaceReconitionHandle::initSourceImageMap(std::map<QString,QString>&maps,int ...@@ -146,7 +147,8 @@ void FaceReconitionHandle::initSourceImageMap(std::map<QString,QString>&maps,int
HF_FaceFeatureIdentity identity = {0}; HF_FaceFeatureIdentity identity = {0};
identity.feature = &feature; identity.feature = &feature;
identity.customId = i; identity.customId = i;
customIds.push_back( identity.customId); //customIds.push_back( identity.customId);
mapCustomId[key]=i;
identity.tag = tagName; identity.tag = tagName;
ret = HF_FeaturesGroupInsertFeature(ctxHandle, identity); ret = HF_FeaturesGroupInsertFeature(ctxHandle, identity);
...@@ -178,6 +180,30 @@ void FaceReconitionHandle::featureRemove(){ ...@@ -178,6 +180,30 @@ void FaceReconitionHandle::featureRemove(){
setImageChanged(false); setImageChanged(false);
} }
} }
void FaceReconitionHandle::featureRemoveMap(std::map<QString, QString> &maps){
if(mapCustomId.size()>0){
for (auto it = mapCustomId.begin(); it != mapCustomId.end(); ) {
// 检查当前键是否存在于 maps 中
if (maps.find(it->first) == maps.end()) {
int32_t & customId = it->second;
// 如果不存在,则从 mapCustomId 中删除该键
it = mapCustomId.erase(it);
HResult ret= HF_FeaturesGroupFeatureRemove(ctxHandle,customId);
if (ret != HSUCCEED) {
qInfo() << QString("从特征组中移除一个面部特征失败: %1").arg(ret);
continue;
}
} else {
// 如果存在,则继续下一个元素
++it;
}
}
setImageChanged(false);
}
}
cv::Mat FaceReconitionHandle::loadImageWithSTB(const QString& filename) { cv::Mat FaceReconitionHandle::loadImageWithSTB(const QString& filename) {
int width, height, channels; int width, height, channels;
QByteArray && b_filename = filename.toUtf8(); QByteArray && b_filename = filename.toUtf8();
......
...@@ -20,6 +20,8 @@ private: ...@@ -20,6 +20,8 @@ private:
std::vector<int32_t>customIds; std::vector<int32_t>customIds;
std::map<QString,int32_t>mapCustomId;
std::atomic<bool>isImageChanged{false}; std::atomic<bool>isImageChanged{false};
public: public:
FaceReconitionHandle(); FaceReconitionHandle();
...@@ -44,5 +46,8 @@ public: ...@@ -44,5 +46,8 @@ public:
void featureRemove(); void featureRemove();
void featureRemoveMap(std::map<QString,QString>&maps);
}; };
#endif // FACERECONITIONHANDLE_H #endif // FACERECONITIONHANDLE_H
...@@ -20,7 +20,9 @@ vides_data::response* HttpService::httpPostDeviceStatus(vides_data::requestDevic ...@@ -20,7 +20,9 @@ vides_data::response* HttpService::httpPostDeviceStatus(vides_data::requestDevic
QJsonObject json; QJsonObject json;
json.insert("sn", deviceStatus.sSn); json.insert("sn", deviceStatus.sSn);
json.insert("type", deviceStatus.type); json.insert("type", deviceStatus.type);
json.insert("mac", deviceStatus.mac);
json.insert("state", deviceStatus.status); json.insert("state", deviceStatus.status);
json.insert("ip_addr", deviceStatus.ip_addr); json.insert("ip_addr", deviceStatus.ip_addr);
json.insert("firmware_version", deviceStatus.firmware_version); // 将固件版本添加到主 JSON 对象中 json.insert("firmware_version", deviceStatus.firmware_version); // 将固件版本添加到主 JSON 对象中
...@@ -30,6 +32,7 @@ vides_data::response* HttpService::httpPostDeviceStatus(vides_data::requestDevic ...@@ -30,6 +32,7 @@ vides_data::response* HttpService::httpPostDeviceStatus(vides_data::requestDevic
QJsonObject cameraObject; QJsonObject cameraObject;
cameraObject.insert("sn", cameraInfo.sSn); cameraObject.insert("sn", cameraInfo.sSn);
cameraObject.insert("ip_addr", cameraInfo.ip_addr); cameraObject.insert("ip_addr", cameraInfo.ip_addr);
cameraObject.insert("mac", cameraInfo.mac);
cameraObject.insert("firmware_version", cameraInfo.firmware_version); cameraObject.insert("firmware_version", cameraInfo.firmware_version);
cameraArray.append(cameraObject); cameraArray.append(cameraObject);
} }
......
...@@ -106,6 +106,7 @@ int MediaFaceImage::SdkSearchDevicesSyn(std::map<QString, vides_data::localDevic ...@@ -106,6 +106,7 @@ int MediaFaceImage::SdkSearchDevicesSyn(std::map<QString, vides_data::localDevic
pDevice->HttpPort=pRet[i].HttpPort; pDevice->HttpPort=pRet[i].HttpPort;
pDevice->UserName= QString::fromUtf8(pRet[i].DefaultUser,sizeof(pRet[i].DefaultUser)); pDevice->UserName= QString::fromUtf8(pRet[i].DefaultUser,sizeof(pRet[i].DefaultUser));
pDevice->password= QString::fromUtf8(pRet[i].DefaultPwd,sizeof(pRet[i].DefaultPwd)); pDevice->password= QString::fromUtf8(pRet[i].DefaultPwd,sizeof(pRet[i].DefaultPwd));
pDevice->mac=QString::fromUtf8(pRet[i].sMac);
devices.insert(std::make_pair(pDevice->sSn, pDevice)); devices.insert(std::make_pair(pDevice->sSn, pDevice));
} }
......
...@@ -199,7 +199,7 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess ...@@ -199,7 +199,7 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
} else { } else {
qInfo() << "Failed to parse JSON payload"; qInfo() << "Failed to parse JSON payload";
} }
//1开 2关 3 重启 4 GB28181开 5 GB28181 关 6 一键配网 7 WIFI配留 8 复位GB28181 //1开 2关 3 重启 4 GB28181开 5 GB28181 关 6 一键配网 7 WIFI配留 8 复位GB28181 9 修改GB28181
int res = -2; int res = -2;
CameraHandle* cameraHandle = MainWindow::sp_this->findHandle(response.sn); CameraHandle* cameraHandle = MainWindow::sp_this->findHandle(response.sn);
int hDevice=0; int hDevice=0;
...@@ -228,7 +228,8 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess ...@@ -228,7 +228,8 @@ int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_mess
} }
break; break;
} }
case 8: res = cameraHandle->resetGb28181( response.uniq); break; case 8: res = cameraHandle->resetGb28181(); break;
case 9:res=cameraHandle->forceWriteGb28181();break;
default: qInfo() << "Unknown message type"; break; default: qInfo() << "Unknown message type"; break;
} }
} }
......
...@@ -31,7 +31,6 @@ public: ...@@ -31,7 +31,6 @@ public:
int sdkDevLoginSyn(QString sDevId, int nDevPort, int sdkDevLoginSyn(QString sDevId, int nDevPort,
QString sUserName, QString sPassword, int nTimeout) ; QString sUserName, QString sPassword, int nTimeout) ;
private: private:
NonConnectedCameraHandle(); // 构造函数声明为私有 NonConnectedCameraHandle(); // 构造函数声明为私有
~NonConnectedCameraHandle(); // 析构函数声明为私有 ~NonConnectedCameraHandle(); // 析构函数声明为私有
......
...@@ -36,6 +36,7 @@ struct requestCameraInfo{ ...@@ -36,6 +36,7 @@ struct requestCameraInfo{
QString ip_addr; QString ip_addr;
QString firmware_version; QString firmware_version;
QString sSn; QString sSn;
QString mac;
requestCameraInfo() {} requestCameraInfo() {}
}; };
...@@ -46,6 +47,7 @@ struct requestDeviceStatus ...@@ -46,6 +47,7 @@ struct requestDeviceStatus
int8_t status; int8_t status;
QString ip_addr; QString ip_addr;
QString firmware_version; QString firmware_version;
QString mac;
std::list<requestCameraInfo>camera_info_list; std::list<requestCameraInfo>camera_info_list;
requestDeviceStatus() {} requestDeviceStatus() {}
}; };
...@@ -106,6 +108,7 @@ struct localDeviceStatus ...@@ -106,6 +108,7 @@ struct localDeviceStatus
int ChannelNum; int ChannelNum;
QString UserName; QString UserName;
QString password; QString password;
QString mac;
localDeviceStatus() {} localDeviceStatus() {}
}; };
struct localDevice struct localDevice
...@@ -188,6 +191,7 @@ struct cameraParameters ...@@ -188,6 +191,7 @@ struct cameraParameters
QString sSn; QString sSn;
QString rtspUrl; QString rtspUrl;
QString rtmpUrl; QString rtmpUrl;
QString mac;
cameraParameters() {} cameraParameters() {}
}; };
struct NetWorkNetCommon { struct NetWorkNetCommon {
...@@ -441,6 +445,23 @@ inline bool isInSameSubnet(const QString &ip1, const QString &ip2, const QString ...@@ -441,6 +445,23 @@ inline bool isInSameSubnet(const QString &ip1, const QString &ip2, const QString
return result1 == result2; return result1 == result2;
} }
inline QString getHostMacAddress()
{
QList<QNetworkInterface> nets = QNetworkInterface::allInterfaces();// 获取所有网络接口列表
int nCnt = nets.count();
QString strMacAddr = "";
for(int i = 0; i < nCnt; i ++)
{
// 如果此网络接口被激活并且正在运行并且不是回环地址,则就是我们需要找的Mac地址
if(nets[i].flags().testFlag(QNetworkInterface::IsUp) && nets[i].flags().testFlag(QNetworkInterface::IsRunning) && !nets[i].flags().testFlag(QNetworkInterface::IsLoopBack))
{
strMacAddr = nets[i].hardwareAddress();
break;
}
}
return strMacAddr.toLower();
}
// 获取子网掩码 // 获取子网掩码
inline bool GetSubnetMask(QString &subnetMask) { inline bool GetSubnetMask(QString &subnetMask) {
QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces(); QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces();
......
...@@ -314,8 +314,7 @@ void MainWindow::handleMatNewConnection(){ ...@@ -314,8 +314,7 @@ void MainWindow::handleMatNewConnection(){
} }
}); });
} }
void MainWindow::modifyImagesAndNames(QString &modId,std::map<QString, QString> &currentImageMap){
void MainWindow::modifyImagesAndNames(QString &modId){
QString fullPathName; QString fullPathName;
Common & instace= Common::getInstance(); Common & instace= Common::getInstance();
if(cloudImageMap.count(modId) <=0 ){ if(cloudImageMap.count(modId) <=0 ){
...@@ -333,6 +332,7 @@ void MainWindow::modifyImagesAndNames(QString &modId){ ...@@ -333,6 +332,7 @@ void MainWindow::modifyImagesAndNames(QString &modId){
QString settingKey = QString("%1").arg(modId); QString settingKey = QString("%1").arg(modId);
qSetting->setValue(settingKey,fullPathName); qSetting->setValue(settingKey,fullPathName);
localImageMap[modId]=fullPathName; localImageMap[modId]=fullPathName;
currentImageMap[modId] = fullPathName; // 更新 currentImageMap
instace.deleteObj(res); instace.deleteObj(res);
} }
...@@ -361,9 +361,11 @@ void MainWindow::updateLocalFace(const QString &httpurl) { ...@@ -361,9 +361,11 @@ void MainWindow::updateLocalFace(const QString &httpurl) {
instance.deleteObj (res); // 手动释放资源 instance.deleteObj (res); // 手动释放资源
return; return;
} }
QSet<QString> dataIds; QSet<QString> dataIds;
std::map<QString, QString> currentImageMap; // 用于存储当前更新或新增的图片信息
bool isChanged=false; bool isChanged=false;
qInfo()<<"currentImageMap 之前:size"<<currentImageMap.size();
for (const auto& item : datas) { for (const auto& item : datas) {
dataIds.insert(item->img); dataIds.insert(item->img);
...@@ -377,7 +379,7 @@ void MainWindow::updateLocalFace(const QString &httpurl) { ...@@ -377,7 +379,7 @@ void MainWindow::updateLocalFace(const QString &httpurl) {
cloudImageMap[item->id] = item->img; cloudImageMap[item->id] = item->img;
removeImageFiles(item->id); removeImageFiles(item->id);
qSetting->beginGroup("localImageMap"); qSetting->beginGroup("localImageMap");
this->modifyImagesAndNames(item->id); this->modifyImagesAndNames(item->id,currentImageMap);
qSetting->endGroup(); qSetting->endGroup();
isChanged=true; isChanged=true;
} }
...@@ -390,11 +392,12 @@ void MainWindow::updateLocalFace(const QString &httpurl) { ...@@ -390,11 +392,12 @@ void MainWindow::updateLocalFace(const QString &httpurl) {
cloudImageMap[item->id] = item->img; cloudImageMap[item->id] = item->img;
qSetting->beginGroup("localImageMap"); qSetting->beginGroup("localImageMap");
this->modifyImagesAndNames(item->id); this->modifyImagesAndNames(item->id,currentImageMap);
qSetting->endGroup(); qSetting->endGroup();
isChanged=true; isChanged=true;
} }
} }
qInfo()<<"currentImageMap:size"<<currentImageMap.size();
for (auto it = cloudImageMap.begin(); it != cloudImageMap.end();) { for (auto it = cloudImageMap.begin(); it != cloudImageMap.end();) {
if (!dataIds.contains(it->second)) { if (!dataIds.contains(it->second)) {
...@@ -429,20 +432,22 @@ void MainWindow::updateLocalFace(const QString &httpurl) { ...@@ -429,20 +432,22 @@ void MainWindow::updateLocalFace(const QString &httpurl) {
int faceNumbers=config.faceConfig.faceNumbers; int faceNumbers=config.faceConfig.faceNumbers;
AlgorithmTaskManage &algorithmTaskManage= AlgorithmTaskManage::getInstance(); AlgorithmTaskManage &algorithmTaskManage= AlgorithmTaskManage::getInstance();
qInfo()<<"currentImageMap isChanged:size"<<currentImageMap.size();
if (cloudImageMap.empty()) { if (cloudImageMap.empty()) {
// 如果云端映射现在为空,移除所有特征 // 如果云端映射现在为空,移除所有特征
//faceRecognition.featureRemove(); //faceRecognition.featureRemove();
static int i11=0; static int i11=0;
qInfo()<<"algorithmTaskManage.modifyImageFeature次数"<<++i11; qInfo()<<"algorithmTaskManage.modifyImageFeature次数"<<++i11;
algorithmTaskManage.modifyImageFeature(localImageMap,faceNumbers,confidence,true); algorithmTaskManage.modifyImageFeature(currentImageMap,faceNumbers,confidence,true);
} else { } else {
//float confidence=qSetting->value("devices/confidence").toFloat(); //float confidence=qSetting->value("devices/confidence").toFloat();
//int faceNumbers=qSetting->value("devices/faceNumbers").toInt(); //int faceNumbers=qSetting->value("devices/faceNumbers").toInt();
qInfo()<<"startMap != endMap-->"; qInfo()<<"startMap != endMap-->";
// faceRecognition.initSourceImageMap(localImageMap,faceNumbers, confidence); // faceRecognition.initSourceImageMap(localImageMap,faceNumbers, confidence);
algorithmTaskManage.modifyImageFeature(localImageMap,faceNumbers,confidence,false); algorithmTaskManage.modifyImageFeature(currentImageMap,faceNumbers,confidence,false);
} }
} }
...@@ -508,7 +513,7 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -508,7 +513,7 @@ void MainWindow::startCamera(const QString &httpurl){
QString nonConstHttpUrl = std::remove_const<QString>::type(httpurl); QString nonConstHttpUrl = std::remove_const<QString>::type(httpurl);
vides_data::responseDeviceData devices; vides_data::responseDeviceData devices;
// QString serialNumber = QSysInfo::machineUniqueId(); // QString serialNumber = QSysInfo::hineUniqueId();
QString serialNumber; QString serialNumber;
findLocalSerialNumber(serialNumber); findLocalSerialNumber(serialNumber);
vides_data::requestDeviceStatus reStatus; vides_data::requestDeviceStatus reStatus;
...@@ -518,6 +523,11 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -518,6 +523,11 @@ void MainWindow::startCamera(const QString &httpurl){
reStatus.ip_addr=instace.GetLocalIp(); reStatus.ip_addr=instace.GetLocalIp();
reStatus.firmware_version=APP_VERSION; reStatus.firmware_version=APP_VERSION;
QString is_mac=vides_data::getHostMacAddress();
if(is_mac.length()<=0){
qInfo()<<"盒子获取mac失败";
}
reStatus.mac=std::move(is_mac);
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){
...@@ -562,6 +572,7 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -562,6 +572,7 @@ void MainWindow::startCamera(const QString &httpurl){
continue; continue;
} }
instace.deleteObj(devRes); instace.deleteObj(devRes);
//未连接的CameraHandle
if(faceDetectionParkingPushs.count(key)<=0){ if(faceDetectionParkingPushs.count(key)<=0){
vides_data::cameraParameters parameter; vides_data::cameraParameters parameter;
parameter.sDevId=ipAddress; parameter.sDevId=ipAddress;
...@@ -571,6 +582,7 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -571,6 +582,7 @@ void MainWindow::startCamera(const QString &httpurl){
parameter.channel=localDevice->ChannelNum; parameter.channel=localDevice->ChannelNum;
parameter.httpUrl=nonConstHttpUrl; parameter.httpUrl=nonConstHttpUrl;
parameter.sSn=device.sSn; parameter.sSn=device.sSn;
parameter.mac=localDevice->mac;
//parameter.rtspUrl="rtsp://192.168.10.131:554/user=admin&password=&channel=1&stream=1.sdp?"; //parameter.rtspUrl="rtsp://192.168.10.131:554/user=admin&password=&channel=1&stream=1.sdp?";
//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);
...@@ -583,9 +595,10 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -583,9 +595,10 @@ void MainWindow::startCamera(const QString &httpurl){
camera_info.sSn=offlineCameraHandle->getSSn(); camera_info.sSn=offlineCameraHandle->getSSn();
offlineCameraHandle->findIp(camera_info.ip_addr); offlineCameraHandle->findIp(camera_info.ip_addr);
offlineCameraHandle->findFirmwareVersion(camera_info.firmware_version); offlineCameraHandle->findFirmwareVersion(camera_info.firmware_version);
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);
...@@ -626,6 +639,7 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -626,6 +639,7 @@ void MainWindow::startCamera(const QString &httpurl){
localDevices.clear(); localDevices.clear();
} }
HttpService http_div(httpurl); HttpService http_div(httpurl);
vides_data::response *res=http_div.httpPostDeviceStatus(reStatus); vides_data::response *res=http_div.httpPostDeviceStatus(reStatus);
if(res->code!=0){ if(res->code!=0){
qInfo()<<"盒子状态上报失败 code:"<<res->code<<"msg:"<<res->msg; qInfo()<<"盒子状态上报失败 code:"<<res->code<<"msg:"<<res->msg;
...@@ -1057,6 +1071,8 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data: ...@@ -1057,6 +1071,8 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data:
vides_data::requestCameraInfo camera_info; vides_data::requestCameraInfo camera_info;
camera_info.sSn=parameter.sSn; camera_info.sSn=parameter.sSn;
camera_info.ip_addr=parameter.sDevId; camera_info.ip_addr=parameter.sDevId;
camera_info.mac=parameter.mac;
cameraHandle->findFirmwareVersion(camera_info.firmware_version); cameraHandle->findFirmwareVersion(camera_info.firmware_version);
modifySnMapIp(parameter.sSn,parameter.sDevId); modifySnMapIp(parameter.sSn,parameter.sDevId);
camera_info_list.push_front(camera_info); camera_info_list.push_front(camera_info);
......
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
void removeImageFiles(QString id); void removeImageFiles(QString id);
void modifyImagesAndNames(QString &modId); void modifyImagesAndNames(QString &modId,std::map<QString, QString> &currentImageMap);
void findLocalSerialNumber(QString &serialNumber); void findLocalSerialNumber(QString &serialNumber);
......
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