inline void OAPIServer::SlotSearchReceiveData(const QHash<QString, QString> &data) { astring ip = "192.168.0.1"; astring port = "80"; astring hdModel = "unknown"; astring OnvifAddr = "/onvif/device_service"; astring type = data["types"].toStdString(); astring strFilter = data["device_ip"].toStdString(); transform(type.begin(), type.end(),type.begin(),(int(*)(int))tolower); transform(strFilter.begin(), strFilter.end(),strFilter.begin(),(int(*)(int))tolower); if (strFilter.find("network_video_storage") != string::npos) { VDC_DEBUG("[ONVIF]: it is a NVS device\n"); return; } size_t pos1 = type.find("networkvideotransmitter"); VDC_DEBUG( "[ONVIF]: Searched ip %s\n", data["device_service_address"].toStdString().c_str()); if (pos1 == string::npos) { return; } astring strServerAddr = data["device_service_address"].toStdString(); GetIPAndPort(strServerAddr, ip, port, OnvifAddr); astring strDeviceIp = data["device_ip"].toStdString(); GetHardwareModel(strDeviceIp, hdModel); oapi::OAPICamSearchedNotify cam; cam.strIP = ip; cam.strPort = port; cam.strModel = hdModel; cam.strONVIFAddress = OnvifAddr; std::string strJson = autojsoncxx::to_pretty_json_string(cam); s32 nJsonLen = strJson.length(); if (nJsonLen <= 0) { return; } OAPIHeader header; header.cmd = htonl(OAPI_CMD_CAM_SAERCH_PUSH); header.length = htonl(nJsonLen + 1); m_pSocket->Send((void *)&header, sizeof(header)); m_pSocket->Send((void *)strJson.c_str(), nJsonLen + 1); return; }
void VSCSearch::SearchReceiveData(const QHash<QString, QString> &data) { astring ip = "192.168.0.1"; astring port = "80"; astring hdModel = "unknown"; astring OnvifAddr = "/onvif/device_service"; astring Manufacturer = ""; astring FirmwareVersion = ""; astring type = data["types"].toStdString(); transform( type.begin(), type.end(),type.begin(),(int(*)(int))tolower); size_t pos1 = type.find("networkvideotransmitter"); VDC_DEBUG( "[ONVIF]: Searched ip %s\n", data["device_service_address"].toStdString().c_str()); if (pos1 == string::npos) { return; } GetIPAndPort(data["device_service_address"].toStdString(), ip, port, OnvifAddr); GetHardwareModel(data["device_ip"].toStdString(), hdModel); astring OnvifDeviceService = "http://" + ip + ":" + port + OnvifAddr; #if 0 DeviceManagement *pDm = new DeviceManagement(OnvifDeviceService.c_str(), "admin", "12345"); if (pDm) { QHash<QString, QString> deviceInfo = pDm->getDeviceInformation(); Manufacturer = deviceInfo["mf"].toStdString(); FirmwareVersion = deviceInfo["firmware_version"].toStdString(); } #endif AddItem(ip, port, Manufacturer, hdModel, FirmwareVersion, OnvifAddr); m_nSearchProcess += 2; if (m_nSearchProcess == 100) { m_nSearchProcess = 0; } ui.progressBar->setValue(m_nSearchProcess); }