|
|
|
@ -57,11 +57,11 @@ public class CameraService {
|
|
|
|
|
|
|
|
|
|
|
|
private CameraControlLoginModule cameraControlLoginModule;
|
|
|
|
private CameraControlLoginModule cameraControlLoginModule;
|
|
|
|
|
|
|
|
|
|
|
|
public void setCameraControlModule(CameraControlModule cameraControlModule){
|
|
|
|
public void setCameraControlModule(CameraControlModule cameraControlModule) {
|
|
|
|
this.cameraControlModule = cameraControlModule;
|
|
|
|
this.cameraControlModule = cameraControlModule;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setCameraLoginModule(CameraControlLoginModule cameraControlLoginModule){
|
|
|
|
public void setCameraLoginModule(CameraControlLoginModule cameraControlLoginModule) {
|
|
|
|
this.cameraControlLoginModule = cameraControlLoginModule;
|
|
|
|
this.cameraControlLoginModule = cameraControlLoginModule;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -69,15 +69,15 @@ public class CameraService {
|
|
|
|
camera.setUser(configProperties.getCameraConfig().getCameraUser());
|
|
|
|
camera.setUser(configProperties.getCameraConfig().getCameraUser());
|
|
|
|
camera.setPassword(configProperties.getCameraConfig().getCameraPassword());
|
|
|
|
camera.setPassword(configProperties.getCameraConfig().getCameraPassword());
|
|
|
|
camera.setUpdateTime(LocalDateTime.now());
|
|
|
|
camera.setUpdateTime(LocalDateTime.now());
|
|
|
|
camera.setRtsp("rtsp://"+configProperties.getCameraConfig().getCameraUser()+":"+configProperties.getCameraConfig().getCameraPassword()+"@"+camera.getIp()+":"+camera.getRtspPort()+"/h264/ch1/sub/avstream");
|
|
|
|
camera.setRtsp("rtsp://" + configProperties.getCameraConfig().getCameraUser() + ":" + configProperties.getCameraConfig().getCameraPassword() + "@" + camera.getIp() + ":" + camera.getRtspPort() + "/h264/ch1/sub/avstream");
|
|
|
|
if(StringUtils.isEmpty(camera.getRtcServer())){
|
|
|
|
if (StringUtils.isEmpty(camera.getRtcServer())) {
|
|
|
|
camera.setRtcServer("127.0.0.1");
|
|
|
|
camera.setRtcServer("127.0.0.1");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
camera.setRtcServerPort(8083);
|
|
|
|
camera.setRtcServerPort(8083);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if(camera.getId() == null || cameraMapper.selectCount(new QueryWrapper<Camera>().eq("id", camera.getId())) == 0) {
|
|
|
|
if (camera.getId() == null || cameraMapper.selectCount(new QueryWrapper<Camera>().eq("id", camera.getId())) == 0) {
|
|
|
|
cameraMapper.insert(camera);
|
|
|
|
cameraMapper.insert(camera);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
int update = cameraMapper.updateById(camera);
|
|
|
|
int update = cameraMapper.updateById(camera);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (DuplicateKeyException e) {
|
|
|
|
} catch (DuplicateKeyException e) {
|
|
|
|
@ -90,11 +90,11 @@ public class CameraService {
|
|
|
|
public void edit(Camera camera) {
|
|
|
|
public void edit(Camera camera) {
|
|
|
|
camera.setUpdateTime(LocalDateTime.now());
|
|
|
|
camera.setUpdateTime(LocalDateTime.now());
|
|
|
|
camera.setPtzId(null);
|
|
|
|
camera.setPtzId(null);
|
|
|
|
if(StringUtils.isEmpty(camera.getRtcServer())){
|
|
|
|
if (StringUtils.isEmpty(camera.getRtcServer())) {
|
|
|
|
camera.setRtcServer("127.0.0.1");
|
|
|
|
camera.setRtcServer("127.0.0.1");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
camera.setUser(configProperties.getCameraConfig().getCameraUser());
|
|
|
|
camera.setUser(configProperties.getCameraConfig().getCameraUser());
|
|
|
|
camera.setRtsp("rtsp://"+configProperties.getCameraConfig().getCameraUser()+":"+configProperties.getCameraConfig().getCameraPassword()+"@"+camera.getIp()+":"+camera.getRtspPort()+"/h264/ch1/sub/avstream");
|
|
|
|
camera.setRtsp("rtsp://" + configProperties.getCameraConfig().getCameraUser() + ":" + configProperties.getCameraConfig().getCameraPassword() + "@" + camera.getIp() + ":" + camera.getRtspPort() + "/h264/ch1/sub/avstream");
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
cameraMapper.updateById(camera);
|
|
|
|
cameraMapper.updateById(camera);
|
|
|
|
} catch (DuplicateKeyException e) {
|
|
|
|
} catch (DuplicateKeyException e) {
|
|
|
|
@ -111,10 +111,10 @@ public class CameraService {
|
|
|
|
public PageInfo<Camera> cameras(StreetSearch streetSearch) {
|
|
|
|
public PageInfo<Camera> cameras(StreetSearch streetSearch) {
|
|
|
|
PageHelper.startPage(streetSearch.getPageNum(), streetSearch.getPageSize());
|
|
|
|
PageHelper.startPage(streetSearch.getPageNum(), streetSearch.getPageSize());
|
|
|
|
List<Camera> cameras = cameraMapper.selectByMap(new HashMap<>(0));
|
|
|
|
List<Camera> cameras = cameraMapper.selectByMap(new HashMap<>(0));
|
|
|
|
if(cameras.size() > 0){
|
|
|
|
if (cameras.size() > 0) {
|
|
|
|
CountDownLatch latch = new CountDownLatch(cameras.size());
|
|
|
|
CountDownLatch latch = new CountDownLatch(cameras.size());
|
|
|
|
cameras.forEach(camera -> {
|
|
|
|
cameras.forEach(camera -> {
|
|
|
|
StatusThread statusThread = new StatusThread(camera,latch);
|
|
|
|
StatusThread statusThread = new StatusThread(camera, latch);
|
|
|
|
statusThread.start();
|
|
|
|
statusThread.start();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
@ -127,57 +127,61 @@ public class CameraService {
|
|
|
|
return new PageInfo<>(cameras);
|
|
|
|
return new PageInfo<>(cameras);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class StatusThread extends Thread{
|
|
|
|
public class StatusThread extends Thread {
|
|
|
|
private Camera camera;
|
|
|
|
private Camera camera;
|
|
|
|
private CountDownLatch latch;
|
|
|
|
private CountDownLatch latch;
|
|
|
|
public StatusThread(Camera camera,CountDownLatch latch){
|
|
|
|
|
|
|
|
|
|
|
|
public StatusThread(Camera camera, CountDownLatch latch) {
|
|
|
|
this.camera = camera;
|
|
|
|
this.camera = camera;
|
|
|
|
this.latch = latch;
|
|
|
|
this.latch = latch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Boolean ok = false;
|
|
|
|
Boolean ok = false;
|
|
|
|
if(configProperties.getCameraConfig().getCameraType() == ConfigProperties.HIK_CAMERA){
|
|
|
|
if (configProperties.getCameraConfig().getCameraType() == ConfigProperties.HIK_CAMERA) {
|
|
|
|
ok = HikLoginModuleImpl.connectStatus(CameraConnMap.getConnId(camera.getId()).intValue());
|
|
|
|
ok = HikLoginModuleImpl.connectStatus(CameraConnMap.getConnId(camera.getId()).intValue());
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
ok = JoywareLoginModuleImpl.connectStatus(CameraConnMap.getConnId(camera.getId()));
|
|
|
|
ok = JoywareLoginModuleImpl.connectStatus(CameraConnMap.getConnId(camera.getId()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(ok){
|
|
|
|
if (ok) {
|
|
|
|
camera.setStatus("连接正常");
|
|
|
|
camera.setStatus("连接正常");
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
CameraConnMap.disConn(camera.getId());
|
|
|
|
CameraConnMap.disConn(camera.getId());
|
|
|
|
camera.setStatus("未连接");
|
|
|
|
camera.setStatus("未连接");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch (Exception e){
|
|
|
|
} catch (Exception e) {
|
|
|
|
CameraConnMap.disConn(camera.getId());
|
|
|
|
CameraConnMap.disConn(camera.getId());
|
|
|
|
camera.setStatus("未连接");
|
|
|
|
camera.setStatus("未连接");
|
|
|
|
}finally {
|
|
|
|
} finally {
|
|
|
|
latch.countDown();
|
|
|
|
latch.countDown();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Camera detail(Integer id){
|
|
|
|
public Camera detail(Integer id) {
|
|
|
|
return cameraMapper.selectById(id);
|
|
|
|
return cameraMapper.selectById(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Camera> allCameras(){
|
|
|
|
public List<Camera> allCameras() {
|
|
|
|
return cameraMapper.selectByMap(new HashMap<>());
|
|
|
|
return cameraMapper.selectByMap(new HashMap<>());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Camera> allCameras(int page){
|
|
|
|
public List<Camera> allCameras(int page) {
|
|
|
|
int pageNum =configProperties.getVideoStyleConfig().getVideoStyleRow() * configProperties.getVideoStyleConfig().getVideoStyleColumn();
|
|
|
|
int pageNum = configProperties.getVideoStyleConfig().getVideoStyleRow() * configProperties.getVideoStyleConfig().getVideoStyleColumn();
|
|
|
|
List<Camera> cameras = cameraMapper.selectList(new QueryWrapper<Camera>().last("limit "+ (page-1)*pageNum +","+pageNum));
|
|
|
|
List<Camera> cameras = cameraMapper.selectList(new QueryWrapper<Camera>().last("limit " + (page - 1) * pageNum + "," + pageNum));
|
|
|
|
return cameras;
|
|
|
|
return cameras;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* HD01 - HD05
|
|
|
|
* HD01 - HD05
|
|
|
|
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public List<Camera> allCameras1(){
|
|
|
|
public List<Camera> allCameras1() {
|
|
|
|
|
|
|
|
|
|
|
|
List<Camera> cameras = cameraMapper.selectByMap(new HashMap<>());
|
|
|
|
List<Camera> cameras = cameraMapper.selectByMap(new HashMap<>());
|
|
|
|
return cameras.stream().filter(camera -> {
|
|
|
|
return cameras.stream().filter(camera -> {
|
|
|
|
@ -187,7 +191,7 @@ public class CameraService {
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Camera> allCameras2(){
|
|
|
|
public List<Camera> allCameras2() {
|
|
|
|
|
|
|
|
|
|
|
|
List<Camera> cameras = cameraMapper.selectByMap(new HashMap<>());
|
|
|
|
List<Camera> cameras = cameraMapper.selectByMap(new HashMap<>());
|
|
|
|
return cameras.stream().filter(camera -> {
|
|
|
|
return cameras.stream().filter(camera -> {
|
|
|
|
@ -197,7 +201,7 @@ public class CameraService {
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Camera> allCameras3(){
|
|
|
|
public List<Camera> allCameras3() {
|
|
|
|
|
|
|
|
|
|
|
|
List<Camera> cameras = cameraMapper.selectByMap(new HashMap<>());
|
|
|
|
List<Camera> cameras = cameraMapper.selectByMap(new HashMap<>());
|
|
|
|
return cameras.stream().filter(camera -> {
|
|
|
|
return cameras.stream().filter(camera -> {
|
|
|
|
@ -207,15 +211,16 @@ public class CameraService {
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Camera> getCamerasByRtcServer(String rtcServer){
|
|
|
|
public List<Camera> getCamerasByRtcServer(String rtcServer) {
|
|
|
|
if(StringUtils.isEmpty(rtcServer)){
|
|
|
|
if (StringUtils.isEmpty(rtcServer)) {
|
|
|
|
rtcServer = "127.0.0.1";
|
|
|
|
rtcServer = "127.0.0.1";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return cameraMapper.selectList(new QueryWrapper<Camera>().eq("rtc_server",rtcServer));
|
|
|
|
return cameraMapper.selectList(new QueryWrapper<Camera>().eq("rtc_server", rtcServer));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 导入IO配置
|
|
|
|
* 导入IO配置
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param file
|
|
|
|
* @param file
|
|
|
|
* @throws IOException
|
|
|
|
* @throws IOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -266,22 +271,42 @@ public class CameraService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* io列表
|
|
|
|
* io列表
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param cameraId
|
|
|
|
* @param cameraId
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public List<CameraIO> ioList(Integer cameraId) {
|
|
|
|
public List<CameraIO> ioList(Integer cameraId) {
|
|
|
|
List<CameraIO> list = ioMapper.cameraIOs(cameraId);
|
|
|
|
List<CameraIOConfig> configs = configMapper.selectList(new QueryWrapper<CameraIOConfig>());
|
|
|
|
|
|
|
|
List<CameraIO> list = ioMapper.selectList(new QueryWrapper<CameraIO>().eq("camera_id", cameraId));
|
|
|
|
|
|
|
|
configs = configs.stream()
|
|
|
|
|
|
|
|
.filter(c -> {
|
|
|
|
|
|
|
|
for (CameraIO cameraIO : list) {
|
|
|
|
|
|
|
|
if (c.getCode().equals(cameraIO.getCode())) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
for (CameraIOConfig config : configs){
|
|
|
|
|
|
|
|
CameraIO cameraIo = new CameraIO();
|
|
|
|
|
|
|
|
cameraIo.setName(config.getName());
|
|
|
|
|
|
|
|
cameraIo.setCode(config.getCode());
|
|
|
|
|
|
|
|
list.add(cameraIo);
|
|
|
|
|
|
|
|
}
|
|
|
|
return list;
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 球机新增、或修改预置点
|
|
|
|
* 球机新增、或修改预置点
|
|
|
|
* synchronized 设置为同步方法,防止出现同一个ptzId在同一个球机上
|
|
|
|
* synchronized 设置为同步方法,防止出现同一个ptzId在同一个球机上
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param IOId 存在修改,不存在 新增
|
|
|
|
* @param IOId 存在修改,不存在 新增
|
|
|
|
* @param cameraId
|
|
|
|
* @param cameraId
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@CacheEvict(value = "ptz",key = "#cameraId+'-'+#code")
|
|
|
|
@CacheEvict(value = "ptz", key = "#cameraId+'-'+#code")
|
|
|
|
public synchronized Integer ptz(Integer IOId, Integer cameraId, String name,Integer type,String code) {
|
|
|
|
public synchronized Integer ptz(Integer IOId, Integer cameraId, String name, Integer type, String code) {
|
|
|
|
Camera camera = cameraMapper.selectById(cameraId);
|
|
|
|
Camera camera = cameraMapper.selectById(cameraId);
|
|
|
|
Assert.notNull(camera, "球机不存在");
|
|
|
|
Assert.notNull(camera, "球机不存在");
|
|
|
|
CameraIO cameraIO = null;
|
|
|
|
CameraIO cameraIO = null;
|
|
|
|
@ -297,11 +322,11 @@ public class CameraService {
|
|
|
|
cameraIO.setName(name);
|
|
|
|
cameraIO.setName(name);
|
|
|
|
cameraIO.setPtzId(ptzId);
|
|
|
|
cameraIO.setPtzId(ptzId);
|
|
|
|
cameraIO.setCode(code);
|
|
|
|
cameraIO.setCode(code);
|
|
|
|
conver(cameraIO,0);
|
|
|
|
conver(cameraIO, 0);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ioMapper.insert(cameraIO);
|
|
|
|
ioMapper.insert(cameraIO);
|
|
|
|
}catch (DuplicateKeyException e){
|
|
|
|
} catch (DuplicateKeyException e) {
|
|
|
|
Assert.isTrue(false,"code已存在:"+code);
|
|
|
|
Assert.isTrue(false, "code已存在:" + code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
camera.setPtzId(ptzId);
|
|
|
|
camera.setPtzId(ptzId);
|
|
|
|
cameraMapper.updateById(camera);
|
|
|
|
cameraMapper.updateById(camera);
|
|
|
|
@ -314,65 +339,66 @@ public class CameraService {
|
|
|
|
cameraIO.setName(name);
|
|
|
|
cameraIO.setName(name);
|
|
|
|
cameraIO.setCode(code);
|
|
|
|
cameraIO.setCode(code);
|
|
|
|
cameraIO.setUpdateTime(LocalDateTime.now());
|
|
|
|
cameraIO.setUpdateTime(LocalDateTime.now());
|
|
|
|
conver(cameraIO,type);
|
|
|
|
conver(cameraIO, type);
|
|
|
|
ioMapper.updateById(cameraIO);
|
|
|
|
ioMapper.updateById(cameraIO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boolean ok = cameraControlModule.connectStatus(cameraId);
|
|
|
|
boolean ok = cameraControlModule.connectStatus(cameraId);
|
|
|
|
if(!ok){
|
|
|
|
if (!ok) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cameraControlModule.ptz(ptzId,cameraIO.getName(),cameraId);
|
|
|
|
cameraControlModule.ptz(ptzId, cameraIO.getName(), cameraId);
|
|
|
|
log.info("设置 预置点 球机ID:{},预置点ID:{}", cameraId, ptzId);
|
|
|
|
log.info("设置 预置点 球机ID:{},预置点ID:{}", cameraId, ptzId);
|
|
|
|
return cameraIO.getId();
|
|
|
|
return cameraIO.getId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 所有的根据code和caameraId获取预置点都使用此方法,有缓存
|
|
|
|
* 所有的根据code和caameraId获取预置点都使用此方法,有缓存
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param code
|
|
|
|
* @param code
|
|
|
|
* @param cameraId
|
|
|
|
* @param cameraId
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Cacheable(value = "ptz",key = "#cameraId+'-'+#code")
|
|
|
|
@Cacheable(value = "ptz", key = "#cameraId+'-'+#code")
|
|
|
|
public Integer getPtzIdByCodeAndCameraId(String code,Integer cameraId){
|
|
|
|
public Integer getPtzIdByCodeAndCameraId(String code, Integer cameraId) {
|
|
|
|
CameraIO cameraIO = ioMapper.getByCodeAndCameraId(code,cameraId);
|
|
|
|
CameraIO cameraIO = ioMapper.getByCodeAndCameraId(code, cameraId);
|
|
|
|
if(cameraIO != null){
|
|
|
|
if (cameraIO != null) {
|
|
|
|
return cameraIO.getPtzId();
|
|
|
|
return cameraIO.getPtzId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Integer getPtzId(Integer ioId){
|
|
|
|
public Integer getPtzId(Integer ioId) {
|
|
|
|
CameraIO cameraIO = ioMapper.selectById(ioId);
|
|
|
|
CameraIO cameraIO = ioMapper.selectById(ioId);
|
|
|
|
Assert.notNull(cameraIO,"IO配置不存在");
|
|
|
|
Assert.notNull(cameraIO, "IO配置不存在");
|
|
|
|
return cameraIO.getPtzId();
|
|
|
|
return cameraIO.getPtzId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void conver(CameraIO cameraIO,Integer type){
|
|
|
|
private void conver(CameraIO cameraIO, Integer type) {
|
|
|
|
if(type == 0){
|
|
|
|
if (type == 0) {
|
|
|
|
cameraIO.setPosition("OK");
|
|
|
|
cameraIO.setPosition("OK");
|
|
|
|
}else if(type == 1){
|
|
|
|
} else if (type == 1) {
|
|
|
|
cameraIO.setFocusing("OK");
|
|
|
|
cameraIO.setFocusing("OK");
|
|
|
|
}else if(type == 2){
|
|
|
|
} else if (type == 2) {
|
|
|
|
cameraIO.setMultiple("OK");
|
|
|
|
cameraIO.setMultiple("OK");
|
|
|
|
}else if(type == 3){
|
|
|
|
} else if (type == 3) {
|
|
|
|
cameraIO.setAperture("OK");
|
|
|
|
cameraIO.setAperture("OK");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void cameraConnectStatus(Integer cameraId){
|
|
|
|
public void cameraConnectStatus(Integer cameraId) {
|
|
|
|
Boolean ok = cameraControlModule.connectStatus(cameraId);
|
|
|
|
Boolean ok = cameraControlModule.connectStatus(cameraId);
|
|
|
|
if(!ok){
|
|
|
|
if (!ok) {
|
|
|
|
log.error("camera unconnected,cameraId:{}",cameraId);
|
|
|
|
log.error("camera unconnected,cameraId:{}", cameraId);
|
|
|
|
Camera camera = cameraMapper.selectById(cameraId);
|
|
|
|
Camera camera = cameraMapper.selectById(cameraId);
|
|
|
|
cameraLogin(camera);
|
|
|
|
cameraLogin(camera);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void cameraLogin(Camera camera){
|
|
|
|
public void cameraLogin(Camera camera) {
|
|
|
|
NetSDKLib.LLong lLong = cameraControlLoginModule.login(camera.getIp(),camera.getPort(),camera.getUser(),camera.getPassword());
|
|
|
|
NetSDKLib.LLong lLong = cameraControlLoginModule.login(camera.getIp(), camera.getPort(), camera.getUser(), camera.getPassword());
|
|
|
|
if(lLong != null){
|
|
|
|
if (lLong != null) {
|
|
|
|
log.info("camera login success,cameraId:{},ip:{}",camera.getId(),camera.getIp());
|
|
|
|
log.info("camera login success,cameraId:{},ip:{}", camera.getId(), camera.getIp());
|
|
|
|
CameraConnMap.conn(camera.getId(),lLong);
|
|
|
|
CameraConnMap.conn(camera.getId(), lLong);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|