|
|
|
@ -441,6 +441,7 @@ CPhoneDevice::CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPa
|
|
|
|
|
m_cameraStatus = false;
|
|
|
|
|
m_sensorsStatus = false;
|
|
|
|
|
m_lastTime = 0;
|
|
|
|
|
m_shouldStopWaiting = false;
|
|
|
|
|
|
|
|
|
|
RegisterHandlerForSignal(SIGUSR2);
|
|
|
|
|
|
|
|
|
@ -1690,9 +1691,11 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
|
|
|
|
|
}
|
|
|
|
|
else if (mPhotoInfo.mediaType == 0 && (mPhotoInfo.cameraType == CAM_TYPE_SERIAL))
|
|
|
|
|
{
|
|
|
|
|
// if (photoInfo.mediaType == 0) {
|
|
|
|
|
// CameraPhotoCmd(time(NULL), channel, MOVE_PRESETNO, 0, type);
|
|
|
|
|
// std::this_thread::sleep_for(std::chrono::seconds(2));
|
|
|
|
|
if (photoInfo.preset != 0 && photoInfo.preset != 0xFF)
|
|
|
|
|
{
|
|
|
|
|
CameraPhotoCmd(time(NULL), photoInfo.channel, MOVE_PRESETNO, 0, photoInfo.preset);
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::seconds(2));
|
|
|
|
|
}
|
|
|
|
|
time_t ts = time(NULL);
|
|
|
|
|
CameraPhotoCmd(ts, photoInfo.channel, 0, 6, 0);
|
|
|
|
|
TakePTZPhotoCb(3, photoInfo);
|
|
|
|
@ -1783,7 +1786,9 @@ bool CPhoneDevice::OpenPTZSensors(int sec)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(m_cameraLocker);
|
|
|
|
|
if (!m_cameraStatus && !m_sensorsStatus) {
|
|
|
|
|
// std::unique_lock<std::mutex> lock(m_cameraLocker);
|
|
|
|
|
if (!m_cameraStatus && !m_sensorsStatus)
|
|
|
|
|
{
|
|
|
|
|
m_sensorsStatus = true;
|
|
|
|
|
OpenSensors(MAIN_POWER_OPEN);
|
|
|
|
|
OpenSensors(CAMERA_SENSOR_OPEN);
|
|
|
|
@ -1792,25 +1797,55 @@ bool CPhoneDevice::OpenPTZSensors(int sec)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(m_sensorsStatus && !m_cameraStatus)
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::seconds(sec));
|
|
|
|
|
{
|
|
|
|
|
auto start = std::chrono::steady_clock::now();
|
|
|
|
|
while (std::chrono::steady_clock::now() - start < std::chrono::seconds(sec))
|
|
|
|
|
{
|
|
|
|
|
if (m_shouldStopWaiting.load())
|
|
|
|
|
{
|
|
|
|
|
CloseSensors(CAMERA_SENSOR_OPEN);
|
|
|
|
|
CloseSensors(MAIN_POWER_OPEN);
|
|
|
|
|
m_cameraStatus = false;
|
|
|
|
|
m_sensorsStatus = false;
|
|
|
|
|
m_shouldStopWaiting.store(false);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if(m_sensorsStatus && !m_cameraStatus)
|
|
|
|
|
// std::this_thread::sleep_for(std::chrono::seconds(sec));
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(m_cameraLocker);
|
|
|
|
|
if (!m_cameraStatus && m_sensorsStatus) {
|
|
|
|
|
// std::unique_lock<std::mutex> lock(m_cameraLocker);
|
|
|
|
|
if (!m_cameraStatus && m_sensorsStatus)
|
|
|
|
|
{
|
|
|
|
|
m_cameraStatus = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return m_cameraStatus;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CPhoneDevice::ClosePTZSensors()
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(m_cameraLocker);
|
|
|
|
|
CloseSensors(CAMERA_SENSOR_OPEN);
|
|
|
|
|
CloseSensors(MAIN_POWER_OPEN);
|
|
|
|
|
m_cameraStatus = false;
|
|
|
|
|
m_sensorsStatus = false;
|
|
|
|
|
if(m_sensorsStatus && !m_cameraStatus)
|
|
|
|
|
{
|
|
|
|
|
m_shouldStopWaiting.store(true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(m_cameraLocker);
|
|
|
|
|
// std::unique_lock<std::mutex> lock(m_cameraLocker);
|
|
|
|
|
CloseSensors(CAMERA_SENSOR_OPEN);
|
|
|
|
|
CloseSensors(MAIN_POWER_OPEN);
|
|
|
|
|
m_cameraStatus = false;
|
|
|
|
|
m_sensorsStatus = false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3444,6 +3479,11 @@ void CPhoneDevice::SetStaticIp(const std::string& iface, const std::string& ip,
|
|
|
|
|
|
|
|
|
|
int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceTail, SENSOR_PARAM *sensorParam)
|
|
|
|
|
{
|
|
|
|
|
m_tempData.instantaneous_windspeed = 0;
|
|
|
|
|
m_tempData.air_temperature = 0;
|
|
|
|
|
m_tempData.instantaneous_winddirection = 0;
|
|
|
|
|
m_tempData.humidity = 0;
|
|
|
|
|
|
|
|
|
|
Collect_sensor_data(); //15s
|
|
|
|
|
Data_DEF airt;
|
|
|
|
|
//++等值覆冰厚度, 综合悬挂载荷, 不均衡张力差 置0
|
|
|
|
@ -3458,54 +3498,135 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT
|
|
|
|
|
if(sensorParam[num].SensorsType == RALLY_PROTOCOL)
|
|
|
|
|
{
|
|
|
|
|
GetPullValue(num, &airt);
|
|
|
|
|
iceInfo->t_sensor_data[pullno].original_tension = airt.EuValue;
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
iceInfo->t_sensor_data[pullno].original_tension = airt.EuValue;
|
|
|
|
|
pullno++;
|
|
|
|
|
} else if(sensorParam[num].SensorsType == SLANT_PROTOCOL)
|
|
|
|
|
{
|
|
|
|
|
GetAngleValue(num, &airt, 0);
|
|
|
|
|
iceInfo->t_sensor_data[angleno].deflection_angle = airt.EuValue;
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
iceInfo->t_sensor_data[angleno].deflection_angle = airt.EuValue;
|
|
|
|
|
GetAngleValue(num, &airt, 1);
|
|
|
|
|
iceInfo->t_sensor_data[angleno].windage_yaw_angle = airt.EuValue;
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
iceInfo->t_sensor_data[angleno].windage_yaw_angle = airt.EuValue;
|
|
|
|
|
angleno++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetWindSpeedData(&airt);
|
|
|
|
|
iceTail->instantaneous_windspeed = airt.EuValue;
|
|
|
|
|
GetWindDirectionData(&airt);
|
|
|
|
|
iceTail->instantaneous_winddirection = airt.EuValue;//需求无符号整数给出浮点数
|
|
|
|
|
GetAirTempData(&airt);
|
|
|
|
|
iceTail->air_temperature = airt.EuValue;
|
|
|
|
|
GetHumidityData(&airt);
|
|
|
|
|
iceTail->humidity = airt.EuValue;//需求无符号整数给出浮点数
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(m_dataLocker);
|
|
|
|
|
GetWindSpeedData(&airt);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
{
|
|
|
|
|
iceTail->instantaneous_windspeed = airt.EuValue;
|
|
|
|
|
m_tempData.instantaneous_windspeed = iceTail->instantaneous_windspeed;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
iceTail->instantaneous_windspeed = m_tempData.instantaneous_windspeed;
|
|
|
|
|
m_tempData.instantaneous_windspeed = 0;
|
|
|
|
|
}
|
|
|
|
|
GetWindDirectionData(&airt);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
{
|
|
|
|
|
iceTail->instantaneous_winddirection = airt.EuValue;
|
|
|
|
|
m_tempData.instantaneous_winddirection = iceTail->instantaneous_winddirection;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
iceTail->instantaneous_winddirection = m_tempData.instantaneous_winddirection;
|
|
|
|
|
m_tempData.instantaneous_winddirection = 0;
|
|
|
|
|
}
|
|
|
|
|
GetAirTempData(&airt);
|
|
|
|
|
if(airt.AiState == 2) {
|
|
|
|
|
iceTail->air_temperature = airt.EuValue;
|
|
|
|
|
m_tempData.air_temperature = iceTail->air_temperature;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
iceTail->air_temperature = m_tempData.air_temperature;
|
|
|
|
|
m_tempData.air_temperature = 0;
|
|
|
|
|
}
|
|
|
|
|
GetHumidityData(&airt);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
{
|
|
|
|
|
iceTail->humidity = airt.EuValue;
|
|
|
|
|
m_tempData.humidity = iceTail->humidity;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
iceTail->humidity = m_tempData.humidity;
|
|
|
|
|
m_tempData.humidity = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo)
|
|
|
|
|
{
|
|
|
|
|
m_tempData.instantaneous_windspeed = 0;
|
|
|
|
|
m_tempData.air_temperature = 0;
|
|
|
|
|
m_tempData.instantaneous_winddirection = 0;
|
|
|
|
|
m_tempData.humidity = 0;
|
|
|
|
|
|
|
|
|
|
Collect_sensor_data(); //15s
|
|
|
|
|
|
|
|
|
|
Data_DEF airt;
|
|
|
|
|
GetWeatherData(&airt, 0);
|
|
|
|
|
weatherInfo->air_temperature = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 1);
|
|
|
|
|
weatherInfo->humidity = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 2);
|
|
|
|
|
weatherInfo->avg_windspeed_10min = airt.EuValue;
|
|
|
|
|
weatherInfo->extreme_windspeed = airt.EuValue;
|
|
|
|
|
weatherInfo->standard_windspeed = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 3);
|
|
|
|
|
weatherInfo->avg_winddirection_10min = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 4);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->precipitation = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 5);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->air_pressure = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 6);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->radiation_intensity = airt.EuValue;
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> 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;
|
|
|
|
|
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 = 0;
|
|
|
|
|
}
|
|
|
|
|
GetWeatherData(&airt, 3);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->avg_winddirection_10min = airt.EuValue;
|
|
|
|
|
m_tempData.instantaneous_winddirection = weatherInfo->avg_winddirection_10min;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->avg_winddirection_10min = m_tempData.instantaneous_winddirection;
|
|
|
|
|
m_tempData.instantaneous_winddirection = 0;
|
|
|
|
|
}
|
|
|
|
|
GetWeatherData(&airt, 0);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->air_temperature = airt.EuValue;
|
|
|
|
|
m_tempData.air_temperature = weatherInfo->air_temperature;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->air_temperature = m_tempData.air_temperature;
|
|
|
|
|
m_tempData.air_temperature = 0;
|
|
|
|
|
}
|
|
|
|
|
GetWeatherData(&airt, 1);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->humidity = airt.EuValue;
|
|
|
|
|
m_tempData.humidity = weatherInfo->humidity;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->humidity = m_tempData.humidity;
|
|
|
|
|
m_tempData.humidity = 0;
|
|
|
|
|
}
|
|
|
|
|
GetWeatherData(&airt, 4);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->precipitation = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 5);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->air_pressure = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 6);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->radiation_intensity = airt.EuValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|