diff --git a/app/build.gradle b/app/build.gradle index d533898d..1eb51d1a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ plugins { // 10,00,000 major-minor-build def AppMajorVersion = 1 def AppMinorVersion = 1 -def AppBuildNumber = 38 +def AppBuildNumber = 40 def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index e6f7965d..6af7fc80 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1592,6 +1592,8 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c if (netCaptureResult) { time_t takingTime = ts; + if(localPhotoInfo.scheduleTime != 0) + takingTime = localPhotoInfo.scheduleTime; if (localPhotoInfo.remedy != 0) { if ((takingTime - localPhotoInfo.scheduleTime) > 30) @@ -1681,11 +1683,17 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< } else if (photoInfo.cameraType == CAM_TYPE_NET) { - powerCtrlPtr = std::shared_ptr(new NetCameraPowerCtrl(mPhotoInfo.closeDelayTime)); + if(mPhotoInfo.scheduleTime == 0) + powerCtrlPtr = std::shared_ptr(new NetCameraPowerCtrl(mPhotoInfo.closeDelayTime)); + else + powerCtrlPtr = std::shared_ptr(new NetCameraPowerCtrl(2)); } else if (photoInfo.cameraType == CAM_TYPE_PLZ) { - powerCtrlPtr = std::shared_ptr(new PlzCameraPowerCtrl(mPhotoInfo.closeDelayTime)); + if(mPhotoInfo.scheduleTime == 0) + powerCtrlPtr = std::shared_ptr(new PlzCameraPowerCtrl(mPhotoInfo.closeDelayTime)); + else + powerCtrlPtr = std::shared_ptr(new PlzCameraPowerCtrl(2)); } res = true; @@ -1799,6 +1807,8 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< std::thread t([localPhotoInfo, param, pThis, path, osds, wid_serial]() mutable { time_t ts = time(NULL); + if(localPhotoInfo.scheduleTime != 0) + ts = localPhotoInfo.scheduleTime; pThis->OpenPTZSensors(localPhotoInfo.selfTestingTime); if (localPhotoInfo.preset != 0 && localPhotoInfo.preset != 0xFF) @@ -1813,11 +1823,9 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< if(localPhotoInfo.scheduleTime == 0) { pThis->ClosePTZSensors(localPhotoInfo.closeDelayTime); - GpioControl::setCam3V3Enable(false, localPhotoInfo.closeDelayTime); } else { pThis->ClosePTZSensors(2); - GpioControl::setCam3V3Enable(false, 2); } @@ -1867,9 +1875,6 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< std::thread t([localPhotoInfo, param, pThis, path, osds, wid_serial, powerCtrlPtr]() mutable { - time_t ts = time(NULL); - pThis->OpenPTZSensors(localPhotoInfo.selfTestingTime); - if (localPhotoInfo.preset != 0 && localPhotoInfo.preset != 0xFF) { XYLOG(XYLOG_SEVERITY_INFO,"Recv CameraCtrl Command, action= MOVE_PRESETNO, preset = %u", localPhotoInfo.preset); @@ -3904,8 +3909,8 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT iceTail->instantaneous_winddirection = 0xff; XYLOG(XYLOG_SEVERITY_INFO, "地址%d,风速风向传感器未启用", sensorParam[num].devaddr); - break; - } else if (sensorParam[num].SensorsType == WIND_PROTOCOL && + continue; + } else if ((sensorParam[num].SensorsType == WIND_PROTOCOL || sensorParam[num].SensorsType == MUTIWEATHER_PROTOCOL) && sensorParam[num].IsNoInsta == 1) { GetWindSpeedData(&airt); if (airt.AiState == 255 || airt.AiState == -1) { @@ -3973,8 +3978,8 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT iceTail->humidity = 0xff; XYLOG(XYLOG_SEVERITY_INFO, "地址%d,温湿度传感器未启用", sensorParam[num].devaddr); - break; - } else if (sensorParam[num].SensorsType == WEATHER_PROTOCOL && sensorParam[num].IsNoInsta == 1) { + continue; + } else if ((sensorParam[num].SensorsType == WEATHER_PROTOCOL || sensorParam[num].SensorsType == MUTIWEATHER_PROTOCOL) && sensorParam[num].IsNoInsta == 1) { GetAirTempData(&airt); if (airt.AiState == 255 || airt.AiState == -1) { iceTail->air_temperature = 0xff; @@ -4073,10 +4078,10 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo, D_SENSOR_PARAM *s weatherInfo->avg_winddirection_10min = 0xff; XYLOG(XYLOG_SEVERITY_INFO, "地址%d,风速风向传感器未启用", sensorParam[num].devaddr); - break; - } else if (sensorParam[num].SensorsType == WIND_PROTOCOL && sensorParam[num].IsNoInsta == 1) + continue; + } else if ((sensorParam[num].SensorsType == WIND_PROTOCOL || sensorParam[num].SensorsType == MUTIWEATHER_PROTOCOL) && sensorParam[num].IsNoInsta == 1) { - GetWeatherData(&airt, 2); + GetWindSpeedData(&airt); if (airt.AiState == 255 || airt.AiState == -1) { weatherInfo->avg_windspeed_10min = 0xff; @@ -4119,7 +4124,7 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo, D_SENSOR_PARAM *s } } - GetWeatherData(&airt, 3); + GetWindDirectionData(&airt); if (airt.AiState == 255 || airt.AiState == -1) { weatherInfo->avg_winddirection_10min = 0xff; @@ -4144,7 +4149,7 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo, D_SENSOR_PARAM *s } } - GetWeatherData(&airt, 4); + GetRainfallData(&airt); weatherInfo->precipitation = airt.EuValue; if(airt.AiState == 255 || airt.AiState == -1) { @@ -4163,7 +4168,7 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo, D_SENSOR_PARAM *s weatherInfo->precipitation = weatherInfo->precipitation + sensorParam[num].offset; } - GetWeatherData(&airt, 5); + GetAtmosData(&airt); weatherInfo->air_pressure = airt.EuValue; if(airt.AiState == 255 || airt.AiState == -1) { @@ -4181,7 +4186,7 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo, D_SENSOR_PARAM *s weatherInfo->air_pressure = weatherInfo->air_pressure + sensorParam[num].offset; } - GetWeatherData(&airt, 6); + GetOpticalRadiationData(&airt); weatherInfo->radiation_intensity = airt.EuValue; if(airt.AiState == 255 || airt.AiState == -1) { @@ -4202,6 +4207,7 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo, D_SENSOR_PARAM *s } } + for (int num = 0; num < MAX_SERIAL_DEV_NUM; num++) { if (sensorParam[num].SensorsType == WEATHER_PROTOCOL && sensorParam[num].IsNoInsta == 0) { @@ -4209,11 +4215,11 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo, D_SENSOR_PARAM *s weatherInfo->humidity = 0xff; XYLOG(XYLOG_SEVERITY_INFO, "地址%d,温湿度传感器未启用", sensorParam[num].devaddr); - break; - } else if (sensorParam[num].SensorsType == WEATHER_PROTOCOL && + continue; + } else if ((sensorParam[num].SensorsType == WEATHER_PROTOCOL || sensorParam[num].SensorsType == MUTIWEATHER_PROTOCOL) && sensorParam[num].IsNoInsta == 1) { - GetWeatherData(&airt, 0); + GetAirTempData(&airt); if (airt.AiState == 255 || airt.AiState == -1) { weatherInfo->air_temperature = 0xff; @@ -4243,7 +4249,7 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo, D_SENSOR_PARAM *s } } - GetWeatherData(&airt, 1); + GetHumidityData(&airt); if (airt.AiState == 255 || airt.AiState == -1) { weatherInfo->humidity = 0xff; diff --git a/app/src/main/cpp/SensorsProtocol.cpp b/app/src/main/cpp/SensorsProtocol.cpp index 2ad2e7e6..c57bff12 100644 --- a/app/src/main/cpp/SensorsProtocol.cpp +++ b/app/src/main/cpp/SensorsProtocol.cpp @@ -1020,6 +1020,9 @@ void Gm_InitSerialComm(SENSOR_PARAM *sensorParam, char *filedir) case RESERVE5_PROTOCOL: sprintf(szbuf, "传感器%d接的是加密芯片", i + 1); break; + case MUTIWEATHER_PROTOCOL: + sprintf(szbuf, "传感器%d接的是多合一气象传感器", i + 1); + break; default: sprintf(szbuf, "传感器%d没有接!", i + 1); break; @@ -1180,6 +1183,7 @@ void FindDevUseSerialCommNo() { case WEATHER_PROTOCOL: case WIND_PROTOCOL: + case MUTIWEATHER_PROTOCOL: //memset(devparam[i].pathname, 0, sizeof(devparam[i].pathname)); /* 目前还不确定具体串口分配,暂时默认使用串口1*/ //sprintf(devparam[i].pathname, "/dev/swk3"); @@ -1271,6 +1275,7 @@ void GM_StartSerialComm() switch (devparam[i].ProtocolIdx) { case WEATHER_PROTOCOL: // 气象 + case MUTIWEATHER_PROTOCOL: memset(weatherpntmsg, 0, sizeof(AI_DEF)*WEATHER_DATA_NUM); memset(szbuf, 0, sizeof(szbuf)); sprintf(szbuf, "%s", "气象"); @@ -1433,6 +1438,7 @@ void Gm_FindAllSensorsCommand() case RALLY_PROTOCOL: /* 拉力*/ case WIND_PROTOCOL: /* 风速风向*/ case SLANT_PROTOCOL: /* 倾角*/ + case MUTIWEATHER_PROTOCOL: flag = FindNextShxyProtocolCommand(curidx); break; case RESERVE2_PROTOCOL: @@ -1480,6 +1486,7 @@ void GM_IsCloseSensors() case RALLY_PROTOCOL: /* 拉力*/ case WIND_PROTOCOL: /* 风速风向*/ case SLANT_PROTOCOL: /* 倾角*/ + case MUTIWEATHER_PROTOCOL: if ((lctime - srdt.ms_dev[i].FirstCmdTimeCnt > 50 * 1000) || (lctime - srdt.ms_dev[i].FirstCmdTimeCnt < 0)) { srdt.ms_dev[i].FirstCmdTimeCnt = lctime; @@ -1498,7 +1505,7 @@ void GM_IsCloseSensors() else if (SER_SAMPLE == srdt.ms_dev[i].aiValue[j].AiState) srdt.ms_dev[i].aiValue[j].AiState = SAMPLINGSUCCESS; } - if((devparam[i].ProtocolIdx == WIND_PROTOCOL) || (WEATHER_PROTOCOL == devparam[i].ProtocolIdx)) + if((devparam[i].ProtocolIdx == WIND_PROTOCOL) || (WEATHER_PROTOCOL == devparam[i].ProtocolIdx)|| (MUTIWEATHER_PROTOCOL == devparam[i].ProtocolIdx)) { for (j = 0; j < WEATHER_DATA_NUM; j++) { @@ -1606,6 +1613,7 @@ void SerialDataProcess(int devidx, u_char *buf, int len) case RALLY_PROTOCOL: /* 拉力*/ case WIND_PROTOCOL: /* 风速风向*/ case SLANT_PROTOCOL: /* 倾角*/ + case MUTIWEATHER_PROTOCOL: ShxyProtocolRecvData(devidx, buf, len); break; case RESERVE2_PROTOCOL: /* 意科电池电量读取协议*/ diff --git a/app/src/main/cpp/SensorsProtocol.h b/app/src/main/cpp/SensorsProtocol.h index 5d265089..4618dcca 100644 --- a/app/src/main/cpp/SensorsProtocol.h +++ b/app/src/main/cpp/SensorsProtocol.h @@ -38,6 +38,7 @@ #define PELCO_P_PROTOCOL 5 /* 摄像机Pelco_P协议序号*/ #define PELCO_D_PROTOCOL 6 /* 摄像机Pelco_D协议序号*/ #define SERIALCAMERA_PROTOCOL 8 /* 串口摄像机协议序号*/ +#define MUTIWEATHER_PROTOCOL 9 /*多合一气象*/ #define RESERVE2_PROTOCOL 17 /* 备用2协议序号*/ #define RESERVE4_PROTOCOL 19 /* 备用4协议序号*/ #define RESERVE5_PROTOCOL 20 /* 备用5协议序号*/