|
|
|
@ -3075,6 +3075,9 @@ void CPhoneDevice::UpdateSimcard(const std::string& simcard)
|
|
|
|
|
m_simcard = simcard;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef USING_N938
|
|
|
|
|
int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceTail, SENSOR_PARAM *sensorParam)
|
|
|
|
|
{
|
|
|
|
|
Collect_sensor_data(); //15s
|
|
|
|
@ -3104,17 +3107,13 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetWindSpeedData(&airt);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
iceTail->instantaneous_windspeed = airt.EuValue;
|
|
|
|
|
iceTail->instantaneous_windspeed = airt.EuValue;
|
|
|
|
|
GetWindDirectionData(&airt);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
iceTail->instantaneous_winddirection = airt.EuValue;//需求无符号整数给出浮点数
|
|
|
|
|
iceTail->instantaneous_winddirection = airt.EuValue;//需求无符号整数给出浮点数
|
|
|
|
|
GetAirTempData(&airt);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
iceTail->air_temperature = airt.EuValue;
|
|
|
|
|
iceTail->air_temperature = airt.EuValue;
|
|
|
|
|
GetHumidityData(&airt);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
iceTail->humidity = airt.EuValue;//需求无符号整数给出浮点数
|
|
|
|
|
iceTail->humidity = airt.EuValue;//需求无符号整数给出浮点数
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -3127,40 +3126,33 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo)
|
|
|
|
|
|
|
|
|
|
Data_DEF airt;
|
|
|
|
|
GetWeatherData(&airt, 0);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->air_temperature = airt.EuValue;
|
|
|
|
|
|
|
|
|
|
if (airt.AiState == -1) return false;
|
|
|
|
|
|
|
|
|
|
GetWeatherData(&airt, 1);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->humidity = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 2);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->avg_windspeed_10min = airt.EuValue;
|
|
|
|
|
weatherInfo->extreme_windspeed = airt.EuValue;
|
|
|
|
|
weatherInfo->standard_windspeed = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 3);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->avg_winddirection_10min = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 4);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->precipitation = airt.EuValue;
|
|
|
|
|
weatherInfo->precipitation = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 5);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->air_pressure = airt.EuValue;
|
|
|
|
|
weatherInfo->air_pressure = airt.EuValue;
|
|
|
|
|
GetWeatherData(&airt, 6);
|
|
|
|
|
if(airt.AiState == 2)
|
|
|
|
|
weatherInfo->radiation_intensity = airt.EuValue;
|
|
|
|
|
weatherInfo->radiation_intensity = airt.EuValue;
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef USING_N938
|
|
|
|
|
bool CPhoneDevice::OpenSensors(int sensortype)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::setInt(CMD_SET_CAM_3V3_EN_STATE, true ? 1 : 0);
|
|
|
|
|
GpioControl::setInt(CMD_SET_485_EN_STATE, true ? 1 : 0);
|
|
|
|
|
#if 1
|
|
|
|
|
GpioControl::setInt(CMD_SET_CAM_3V3_EN_STATE, 1);
|
|
|
|
|
GpioControl::setInt(CMD_SET_485_EN_STATE, 1);
|
|
|
|
|
int igpio;
|
|
|
|
|
|
|
|
|
|
if(sensortype == CAMERA_SENSOR_OPEN)
|
|
|
|
@ -3195,15 +3187,54 @@ bool CPhoneDevice::OpenSensors(int sensortype)
|
|
|
|
|
GpioControl::setInt(CMD_SET_485_en3, 1);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_SET_SPI_POWER);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_SET_485_en3);
|
|
|
|
|
#else
|
|
|
|
|
GpioControl::setInt(CMD_SET_CAM_3V3_EN_STATE1, 1);
|
|
|
|
|
GpioControl::setInt(CMD_SET_485_EN_STATE, 1);
|
|
|
|
|
int igpio;
|
|
|
|
|
|
|
|
|
|
if(sensortype == CAMERA_SENSOR_OPEN)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::setInt(CMD_PIC1_EN, 1);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_PIC1_EN);
|
|
|
|
|
GpioControl::setInt(CMD_485_4_PWR_EN, 1);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_485_4_PWR_EN);
|
|
|
|
|
}else if(sensortype == WEATHER_SENSOR_OPEN || sensortype == ICETHICK_SENSOR_OPEN)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::setInt(CMD_WEATHER_EN, 1);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_WEATHER_EN);
|
|
|
|
|
GpioControl::setInt(CMD_485_0_PWR_EN, 1);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_485_0_PWR_EN);
|
|
|
|
|
}
|
|
|
|
|
if(sensortype == ICETHICK_SENSOR_OPEN)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::setInt(CMD_PULL_EN, 1);
|
|
|
|
|
GpioControl::setInt(CMD_ANGLE_EN, 1);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_PULL_EN);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_ANGLE_EN);
|
|
|
|
|
GpioControl::setInt(CMD_485_1_PWR_EN, 1);
|
|
|
|
|
GpioControl::setInt(CMD_485_2_PWR_EN, 1);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_485_1_PWR_EN);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_485_2_PWR_EN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GpioControl::setInt(CMD_OTHER_EN, 1);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_OTHER_EN);
|
|
|
|
|
GpioControl::setInt(CMD_SET_SPI_POWER, 1);
|
|
|
|
|
GpioControl::setInt(CMD_485_3_PWR_EN, 1);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_SET_SPI_POWER);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_485_3_PWR_EN);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
bool CPhoneDevice::CloseSensors(int sensortype)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::setInt(CMD_SET_12V_EN_STATE, false ? 1 : 0);
|
|
|
|
|
GpioControl::setInt(CMD_SET_CAM_3V3_EN_STATE, false ? 1 : 0);
|
|
|
|
|
GpioControl::setInt(CMD_SET_485_EN_STATE, false ? 1 : 0);
|
|
|
|
|
#if 1
|
|
|
|
|
GpioControl::setInt(CMD_SET_12V_EN_STATE, 0);
|
|
|
|
|
GpioControl::setInt(CMD_SET_CAM_3V3_EN_STATE, 0);
|
|
|
|
|
GpioControl::setInt(CMD_SET_485_EN_STATE, 0);
|
|
|
|
|
int igpio;
|
|
|
|
|
if(sensortype == CAMERA_SENSOR_OPEN)
|
|
|
|
|
{
|
|
|
|
@ -3237,7 +3268,44 @@ bool CPhoneDevice::CloseSensors(int sensortype)
|
|
|
|
|
GpioControl::setInt(CMD_SET_485_en3, 0);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_SET_SPI_POWER);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_SET_485_en3);
|
|
|
|
|
#else
|
|
|
|
|
GpioControl::setInt(CMD_SET_CAM_3V3_EN_STATE1, 0);
|
|
|
|
|
GpioControl::setInt(CMD_SET_485_EN_STATE, 0);
|
|
|
|
|
int igpio;
|
|
|
|
|
|
|
|
|
|
if(sensortype == CAMERA_SENSOR_OPEN)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::setInt(CMD_PIC1_EN, 0);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_PIC1_EN);
|
|
|
|
|
GpioControl::setInt(CMD_485_4_PWR_EN, 0);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_485_4_PWR_EN);
|
|
|
|
|
}else if(sensortype == WEATHER_SENSOR_OPEN || sensortype == ICETHICK_SENSOR_OPEN)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::setInt(CMD_WEATHER_EN, 0);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_WEATHER_EN);
|
|
|
|
|
GpioControl::setInt(CMD_485_0_PWR_EN, 0);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_485_0_PWR_EN);
|
|
|
|
|
}
|
|
|
|
|
if(sensortype == ICETHICK_SENSOR_OPEN)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::setInt(CMD_PULL_EN, 0);
|
|
|
|
|
GpioControl::setInt(CMD_ANGLE_EN, 0);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_PULL_EN);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_ANGLE_EN);
|
|
|
|
|
GpioControl::setInt(CMD_485_1_PWR_EN, 0);
|
|
|
|
|
GpioControl::setInt(CMD_485_2_PWR_EN, 0);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_485_1_PWR_EN);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_485_2_PWR_EN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GpioControl::setInt(CMD_OTHER_EN, 0);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_OTHER_EN);
|
|
|
|
|
GpioControl::setInt(CMD_SET_SPI_POWER, 0);
|
|
|
|
|
GpioControl::setInt(CMD_485_3_PWR_EN, 0);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_SET_SPI_POWER);
|
|
|
|
|
igpio = GpioControl::getInt(CMD_485_3_PWR_EN);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|