diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 6eec0e61..a42b68db 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1739,7 +1739,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< time_t ts = time(NULL); if(!pThis->GetPTZSensorsStatus() && !pThis->GetCameraStatus()) { - XYLOG(XYLOG_SEVERITY_INFO, "Camera is SeltTesting, selfTestingtime = %d", localPhotoInfo.selfTestingTime); + XYLOG(XYLOG_SEVERITY_INFO, "Camera is SeltTesting, selfTestingtime=%u", (uint32_t)localPhotoInfo.selfTestingTime); pThis->OpenPTZSensors(localPhotoInfo.selfTestingTime); } CameraPhotoCmd(ts, localPhotoInfo.channel, 0, localPhotoInfo.resolution, 0, param.serfile, param.baud, param.addr); @@ -3514,6 +3514,7 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT iceInfo->equal_icethickness = 0xff; iceInfo->tension = 0xff; iceInfo->tension_difference = 0xff; + bool status = 1; int pullno = 0; int angleno = 0; @@ -3522,32 +3523,34 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT if(sensorParam[num].SensorsType == RALLY_PROTOCOL) { GetPullValue(num, &airt); -// if(airt.AiState == 2) -// { - iceInfo->t_sensor_data[pullno].original_tension = airt.EuValue; - XYLOG(XYLOG_SEVERITY_INFO,"地址%d, 采样状态 = %d, 拉力 = %f", sensorParam[num].devaddr, airt.AiState, iceInfo->t_sensor_data[pullno].original_tension); -// } -// else -// iceInfo->t_sensor_data[pullno].original_tension = 0xff; + iceInfo->t_sensor_data[pullno].original_tension = airt.EuValue; + XYLOG(XYLOG_SEVERITY_INFO,"地址%d,采样状态 = %d,拉力 = %f", sensorParam[num].devaddr, airt.AiState, iceInfo->t_sensor_data[pullno].original_tension); + if(airt.AiState != 2 && iceInfo->t_sensor_data[pullno].original_tension == 0) + { + XYLOG(XYLOG_SEVERITY_INFO,"地址%d,采样状态 = %d,拉力未采集到数据,重新采样", sensorParam[num].devaddr, airt.AiState); + status = 0; + } pullno++; } else if(sensorParam[num].SensorsType == SLANT_PROTOCOL) { GetAngleValue(num, &airt, 0); -// if(airt.AiState == 2) -// { - iceInfo->t_sensor_data[angleno].deflection_angle = airt.EuValue; - XYLOG(XYLOG_SEVERITY_INFO,"地址%d, 采样状态 = %d, x = %f", sensorParam[num].devaddr, airt.AiState, iceInfo->t_sensor_data[angleno].deflection_angle); -// } -// else -// iceInfo->t_sensor_data[angleno].deflection_angle = 0xff; + iceInfo->t_sensor_data[angleno].deflection_angle = airt.EuValue; + XYLOG(XYLOG_SEVERITY_INFO,"地址%d,采样状态 = %d,x = %f", sensorParam[num].devaddr, airt.AiState, iceInfo->t_sensor_data[angleno].deflection_angle); + if(airt.AiState != 2 && iceInfo->t_sensor_data[angleno].deflection_angle == 0) + { + XYLOG(XYLOG_SEVERITY_INFO,"地址%d,采样状态 = %d,倾角x未采集到数据,重新采样", sensorParam[num].devaddr, airt.AiState); + status = 0; + } + GetAngleValue(num, &airt, 1); -// if(airt.AiState == 2) -// { - iceInfo->t_sensor_data[angleno].windage_yaw_angle = airt.EuValue; - XYLOG(XYLOG_SEVERITY_INFO,"地址%d, 采样状态 = %d, y = %f", sensorParam[num].devaddr, airt.AiState, iceInfo->t_sensor_data[angleno].windage_yaw_angle); -// } -// else -// iceInfo->t_sensor_data[angleno].windage_yaw_angle =0xff; + iceInfo->t_sensor_data[angleno].windage_yaw_angle = airt.EuValue; + XYLOG(XYLOG_SEVERITY_INFO,"地址%d,采样状态 = %d,y = %f", sensorParam[num].devaddr, airt.AiState, iceInfo->t_sensor_data[angleno].windage_yaw_angle); + if(airt.AiState != 2 && iceInfo->t_sensor_data[angleno].windage_yaw_angle == 0) + { + XYLOG(XYLOG_SEVERITY_INFO,"地址%d,采样状态 = %d,倾角y未采集到数据,重新采样", sensorParam[num].devaddr, airt.AiState); + status = 0; + } + angleno++; } } @@ -3555,48 +3558,55 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT { std::lock_guard lock(m_dataLocker); GetWindSpeedData(&airt); - if(airt.AiState == 2) + iceTail->instantaneous_windspeed = airt.EuValue; + if(airt.AiState != 2 && iceTail->instantaneous_windspeed == 0 && m_tempData.instantaneous_windspeed == 0xff) { - iceTail->instantaneous_windspeed = airt.EuValue; - m_tempData.instantaneous_windspeed = iceTail->instantaneous_windspeed; - } else + XYLOG(XYLOG_SEVERITY_INFO,"采样状态 = %d,覆冰风速未采集到数据,重新采样",airt.AiState); + status = 0; + }else { - iceTail->instantaneous_windspeed = m_tempData.instantaneous_windspeed; - m_tempData.instantaneous_windspeed = 0xff; + m_tempData.instantaneous_windspeed = iceTail->instantaneous_windspeed; } + GetWindDirectionData(&airt); - if(airt.AiState == 2) + iceTail->instantaneous_winddirection = airt.EuValue; + if(airt.AiState != 2 && iceTail->instantaneous_winddirection == 0 && m_tempData.instantaneous_winddirection == 0xff) { - iceTail->instantaneous_winddirection = airt.EuValue; - m_tempData.instantaneous_winddirection = iceTail->instantaneous_winddirection; - } else + XYLOG(XYLOG_SEVERITY_INFO,"采样状态 = %d,覆冰风向未采集到数据,重新采样",airt.AiState); + status = 0; + }else { - iceTail->instantaneous_winddirection = m_tempData.instantaneous_winddirection; - m_tempData.instantaneous_winddirection = 0xff; + m_tempData.instantaneous_winddirection = iceTail->instantaneous_winddirection; } + GetAirTempData(&airt); - if(airt.AiState == 2) { - iceTail->air_temperature = airt.EuValue; - m_tempData.air_temperature = iceTail->air_temperature; - } else + iceTail->air_temperature = airt.EuValue; + if(airt.AiState != 2 && iceTail->air_temperature == 0 && m_tempData.air_temperature == 0xff) + { + XYLOG(XYLOG_SEVERITY_INFO,"采样状态 = %d,覆冰温度未采集到数据,重新采样",airt.AiState); + status = 0; + }else { - iceTail->air_temperature = m_tempData.air_temperature; - m_tempData.air_temperature = 0xff; + m_tempData.air_temperature = iceTail->air_temperature; } + GetHumidityData(&airt); - if(airt.AiState == 2) + iceTail->humidity = airt.EuValue; + if(airt.AiState != 2 && iceTail->humidity == 0 && m_tempData.humidity == 0xff) { - iceTail->humidity = airt.EuValue; - m_tempData.humidity = iceTail->humidity; - } else + XYLOG(XYLOG_SEVERITY_INFO,"采样状态 = %d,覆冰湿度未采集到数据,重新采样",airt.AiState); + status = 0; + }else { - iceTail->humidity = m_tempData.humidity; - m_tempData.humidity = 0xff; + m_tempData.humidity = iceTail->humidity; } } - return true; + if(status) + return true; + else + return false; } int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo) @@ -3605,6 +3615,7 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo) m_tempData.air_temperature = 0xff; m_tempData.instantaneous_winddirection = 0xff; m_tempData.humidity = 0xff; + bool status = 1; Collect_sensor_data(); //15s @@ -3612,62 +3623,74 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo) { std::lock_guard lock(m_dataLocker); GetWeatherData(&airt, 2); - if(airt.AiState == 2) - { - weatherInfo->avg_windspeed_10min = airt.EuValue; - weatherInfo->extreme_windspeed = airt.EuValue; - weatherInfo->standard_windspeed = airt.EuValue; + weatherInfo->avg_windspeed_10min = airt.EuValue; + weatherInfo->extreme_windspeed = airt.EuValue; + weatherInfo->standard_windspeed = airt.EuValue; + if (airt.AiState != 2 && weatherInfo->avg_windspeed_10min == 0 && + m_tempData.instantaneous_windspeed == 0xff) { + XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气象风速未采集到数据,重新采样", airt.AiState); + status = 0; + } else { m_tempData.instantaneous_windspeed = weatherInfo->avg_windspeed_10min; - } else - { - weatherInfo->avg_windspeed_10min = m_tempData.instantaneous_windspeed; - weatherInfo->extreme_windspeed = m_tempData.instantaneous_windspeed; - weatherInfo->standard_windspeed = m_tempData.instantaneous_windspeed; - m_tempData.instantaneous_windspeed = 0xff; } + GetWeatherData(&airt, 3); - if(airt.AiState == 2) - { - weatherInfo->avg_winddirection_10min = airt.EuValue; + weatherInfo->avg_winddirection_10min = airt.EuValue; + if (airt.AiState != 2 && weatherInfo->avg_winddirection_10min == 0 && + m_tempData.instantaneous_winddirection == 0xff) { + XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气象风向未采集到数据,重新采样", airt.AiState); + status = 0; + } else { m_tempData.instantaneous_winddirection = weatherInfo->avg_winddirection_10min; - } else - { - weatherInfo->avg_winddirection_10min = m_tempData.instantaneous_winddirection; - m_tempData.instantaneous_winddirection = 0xff; } + GetWeatherData(&airt, 0); - if(airt.AiState == 2) - { - weatherInfo->air_temperature = airt.EuValue; + weatherInfo->air_temperature = airt.EuValue; + if (airt.AiState != 2 && weatherInfo->air_temperature == 0 && + m_tempData.air_temperature == 0xff) { + XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气象温度未采集到数据,重新采样", airt.AiState); + status = 0; + } else { m_tempData.air_temperature = weatherInfo->air_temperature; - } else - { - weatherInfo->air_temperature = m_tempData.air_temperature; - m_tempData.air_temperature = 0xff; } + GetWeatherData(&airt, 1); - if(airt.AiState == 2) - { - weatherInfo->humidity = airt.EuValue; + weatherInfo->humidity = airt.EuValue; + if (airt.AiState != 2 && weatherInfo->humidity == 0 && m_tempData.humidity == 0xff) { + XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气象湿度未采集到数据,重新采样", airt.AiState); + status = 0; + } else { m_tempData.humidity = weatherInfo->humidity; - } else - { - weatherInfo->humidity = m_tempData.humidity; - m_tempData.humidity = 0xff; } + GetWeatherData(&airt, 4); - if(airt.AiState == 2) - weatherInfo->precipitation = airt.EuValue; + weatherInfo->precipitation = airt.EuValue; +// if (airt.AiState != 2 && weatherInfo->precipitation == 0) { +// XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,降雨量未采集到数据,重新采样", +// weatherInfo->precipitation, airt.AiState); +// status = 0; +// } + GetWeatherData(&airt, 5); - if(airt.AiState == 2) - weatherInfo->air_pressure = airt.EuValue; + weatherInfo->air_pressure = airt.EuValue; +// if (airt.AiState != 2 && weatherInfo->air_pressure == 0) { +// XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气压未采集到数据,重新采样", +// weatherInfo->air_pressure, airt.AiState); +// status = 0; +// } + GetWeatherData(&airt, 6); - if(airt.AiState == 2) - weatherInfo->radiation_intensity = airt.EuValue; + weatherInfo->radiation_intensity = airt.EuValue; +// if (airt.AiState != 2 && weatherInfo->radiation_intensity == 0) { +// XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,光照强度未采集到数据,重新采样", +// weatherInfo->radiation_intensity, airt.AiState); +// status = 0; +// } + if (status) + return true; + else + return false; } - - return true; - } bool CPhoneDevice::OpenSensors(int sensortype)