| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | if (loginSn.get(sn) != null && loginSn.get(sn)) { |
| | | if (loginSn.get(sn) != null && loginSn.get(sn) && loginType == 0) { |
| | | return new StatusVO(0); |
| | | } |
| | | if (loginInfo == null) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 生成节目 |
| | | * |
| | |
| | | //节目 |
| | | sendProgramFilePaths.setProgramPath(filePathConfig.getOutPutPath() + "/program" + pageInfo.getProgramID()); |
| | | //文件 |
| | | // Map<String, String> mediasPath = new HashMap(); |
| | | // mediasPath.put("C:/Users/Administrator/Desktop/novaWin/demo/java/test.png", "test.png"); |
| | | // sendProgramFilePaths.setMediasPath(mediasPath); |
| | | sendProgramFilePaths.setMediasPath(pageInfo.getFileMap()); |
| | | |
| | | transfromProgramVO.setSendProgramFilePaths(sendProgramFilePaths); |
| | |
| | | List<TrasfromStatusVO> svoList = new ArrayList<>(); |
| | | System.out.println("ViplexCore Demo nvStartTransferProgramAsync(发送节目) begin... "); |
| | | // System.out.println(trasfromProgram); |
| | | // instance.nvStartTransferProgramAsync(trasfromProgram, callBack); |
| | | // String trasfromProgram = String.format( |
| | | // "{\"sn\": \"%s\",\"iconPath\": \"\",\"iconName\": \"\",\"sendProgramFilePaths\": {\"programPath\": \"%s/program13\",\"mediasPath\": {\"C:/Users/Administrator/Desktop/novaWin/demo/java/test.png\": \"test.png\"}},\"programName\": \"jiemu1\",\"deviceIdentifier\": \"Demo\",\"startPlayAfterTransferred\": true,\"insertPlay\": true}", |
| | | // g_sn, |
| | | // rootDir); |
| | | CountDownLatch countDownLatch = new CountDownLatch(pageInfo.getSnList().size()); |
| | | pageInfo.getSnList().forEach(sn -> { |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | |
| | | if (transfromProgramVO == null) { |
| | | return; |
| | | } |
| | |
| | | if (login.getStatusCode() != 0) { |
| | | trasfromStatusVO.setStatusCode(login.getStatusCode()); |
| | | trasfromStatusVO.setStatusData(login.getStatusData()); |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | System.out.println("program: " + JSON.toJSONString(transfromProgramVO)); |
| | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }).start(); |
| | | |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | |
| | | return svoList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | public List<NewNovaLed> getOnlineStatus(List<NewNovaLed> newNovaListBos, boolean onlineStatus) { |
| | | List<NewNovaLed> online = new ArrayList<>(); |
| | | CountDownLatch countDownLatch = new CountDownLatch(newNovaListBos.size()); |
| | | //设置开关屏状态 |
| | | newNovaListBos.forEach(led -> { |
| | | //获取信息之前先登录 |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | StatusVO login = login(led.getSn(), 0); |
| | | if (login.getStatusCode() == 0) { |
| | | //登陆成功 设置为在线 |
| | |
| | | led.setIsOnline(0); |
| | | } |
| | | countDownLatch.countDown(); |
| | | } |
| | | }).start(); |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | if (onlineStatus) { |
| | | return online; |
| | | } |
| | |
| | | StatusVO login = login(led.getSn(), 0); |
| | | |
| | | StatusVO result = new StatusVO(); |
| | | if (login.getStatusCode() == 0) { |
| | | |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (login.getStatusCode() == 0) { |
| | | //推送结果 |
| | | TrasfromStatusVO trasfromStatusVO = new TrasfromStatusVO(); |
| | | trasfromStatusVO.setSn(led.getSn()); |
| | |
| | | countDownLatch.countDown(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }).start(); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MICROSECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } else { |
| | | } /*else { |
| | | throw new BusinessException("设备登录失败,经检查设备是否连接"); |
| | | } |
| | | }*/ |
| | | if (result.getStatusCode() == 0) { |
| | | NewNovaInfoBo newNovaInfoBo = JSON.parseObject(result.getStatusData(), NewNovaInfoBo.class); |
| | | led.setInfo(newNovaInfoBo); |
| | | } /*else { |
| | | throw new BusinessException("设备登录失败,经检查设备是否连接"); |
| | | }*/ |
| | | return led; |
| | | } |
| | | |
| | |
| | | |
| | | System.out.println("ViplexCore Demo nvGetScreenPowerStateAsync(获取屏幕开关) begin... "); |
| | | |
| | | CountDownLatch countDownLatch = new CountDownLatch(newNovaLsit.size()); |
| | | newNovaLsit.forEach(newNova -> { |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | StatusVO login = login(newNova.getSn(), 0); |
| | | if (login.getStatusCode() != 0) { |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | //推送结果 |
| | | instance.nvGetScreenPowerStateAsync("{\n" + |
| | | " \"sn\":\"" + newNova.getSn() + "\"\n" + |
| | |
| | | countDownLatch.countDown(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }).start(); |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | return newNovaLsit; |
| | | } |
| | |
| | | |
| | | System.out.println("ViplexCore Demo nvGetVolumeAsync(获取音量) begin... "); |
| | | |
| | | CountDownLatch countDownLatch = new CountDownLatch(newNovaLsit.size()); |
| | | newNovaLsit.forEach(newNova -> { |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | StatusVO login = login(newNova.getSn(), 0); |
| | | if (login.getStatusCode() != 0) { |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | //推送结果 |
| | | instance.nvGetVolumeAsync("{\n" + |
| | | " \"sn\":\"" + newNova.getSn() + "\"\n" + |
| | |
| | | countDownLatch.countDown(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }).start(); |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | return newNovaLsit; |
| | | } |
| | |
| | | System.out.println("ViplexCore Demo nvGetScreenBrightnessAsync(获取亮度) begin... "); |
| | | |
| | | |
| | | CountDownLatch countDownLatch = new CountDownLatch(newNovaLsit.size()); |
| | | newNovaLsit.forEach(newNova -> { |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | StatusVO login = login(newNova.getSn(), 0); |
| | | if (login.getStatusCode() != 0) { |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | //推送结果 |
| | | instance.nvGetScreenBrightnessAsync("{\n" + |
| | | " \"sn\":\"" + newNova.getSn() + "\"\n" + |
| | |
| | | countDownLatch.countDown(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }).start(); |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | return newNovaLsit; |
| | | } |
| | |
| | | |
| | | System.out.println("ViplexCore Demo nvGetSyncPlayAsync(获取同步) begin... "); |
| | | |
| | | CountDownLatch countDownLatch = new CountDownLatch(newNovaLsit.size()); |
| | | newNovaLsit.forEach(newNova -> { |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | StatusVO login = login(newNova.getSn(), 0); |
| | | if (login.getStatusCode() != 0) { |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | //推送结果 |
| | | instance.nvGetSyncPlayAsync("{\n" + |
| | | " \"sn\":\"" + newNova.getSn() + "\"\n" + |
| | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }).start(); |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | return newNovaLsit; |
| | | } |
| | | |
| | |
| | | if (param.getNovaList() == null || param.getNovaList().size() == 0) { |
| | | throw new BusinessException("同步设备不能为空 !"); |
| | | } |
| | | CountDownLatch countDownLatch = new CountDownLatch(param.getNovaList().size()); |
| | | param.getNovaList().forEach(newNova -> { |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | login(newNova.getSn(), 0); |
| | | |
| | | StatusVO login = login(newNova.getSn(), 0); |
| | | if (login.getStatusCode() != 0) { |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | String str = "{\n" + |
| | | " \"sn\":\"" + newNova.getSn() + "\",\n" + |
| | | " \"enable\":" + param.isSync() + "\n" + |
| | |
| | | countDownLatch.countDown(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }).start(); |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | return param.getNovaList(); |
| | | } |
| | |
| | | if (param.getNovaList() == null || param.getNovaList().size() == 0) { |
| | | throw new BusinessException("重启设备不能为空 !"); |
| | | } |
| | | param.getNovaList().forEach(newNova -> { |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | param.getNovaList().forEach(newNova -> { |
| | | logout(newNova.getSn(), 0); |
| | | StatusVO login = login(newNova.getSn(), 1); |
| | | if (login.getStatusCode() != 0) { |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | //推送结果 |
| | | instance.nvSetReBootTaskAsync("{\n" + |
| | | |
| | | String rebootStr = "{\n" + |
| | | " \"sn\":\"" + newNova.getSn() + "\",\n" + |
| | | " \"taskInfo\":{\n" + |
| | | " \"type\":\"REBOOT\",\n" + |
| | | " \"source\":{\n" + |
| | | " \"type\":0,\n" + |
| | | " \"platform\":4\n" + |
| | | " \"platform\":1\n" + |
| | | " },\n" + |
| | | " \"executionType\":\"IMMEDIATELY\",\n" + |
| | | " \"reason\":\"Just to reboot\",\n" + |
| | | " \"reason\":\"Just to test\",\n" + |
| | | " \"conditions\":[\n" + |
| | | " {\n" + |
| | | " \"cron\":[\n" + |
| | |
| | | " }\n" + |
| | | " ]\n" + |
| | | " }\n" + |
| | | "}", new ViplexCore.CallBack() { |
| | | "}"; |
| | | System.out.println("rebootStr : " + rebootStr); |
| | | //推送结果 |
| | | instance.nvSetReBootTaskAsync(rebootStr, new ViplexCore.CallBack() { |
| | | @Override |
| | | public void dataCallBack(int code, String data) { |
| | | |
| | |
| | | countDownLatch.countDown(); |
| | | } |
| | | }); |
| | | |
| | | // StatusVO logout = logout(newNova.getSn(), 1); |
| | | // if (logout.getStatusCode() == 0) { |
| | | // login(newNova.getSn(), 0); |
| | | // } |
| | | } |
| | | }).start(); |
| | | ); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | login(newNova.getSn(), 0); |
| | | } |
| | | ); |
| | | |
| | | return param.getNovaList(); |
| | | } |
| | |
| | | if (param.getNovaList() == null || param.getNovaList().size() == 0) { |
| | | throw new BusinessException("对时设备不能为空 !"); |
| | | } |
| | | |
| | | CountDownLatch countDownLatch = new CountDownLatch(param.getNovaList().size()); |
| | | param.getNovaList().forEach(newNova -> { |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // login(newNova.getSn(), 0); |
| | | StatusVO login = login(newNova.getSn(), 0); |
| | | if (login.getStatusCode() != 0) { |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | String ntpStr="{\n" + |
| | | " \"sn\":\""+newNova.getSn()+"\",\n" + |
| | | " \"TimingInfo\":{\n" + |
| | |
| | | " \"action\":4,\n" + |
| | | " \"data\":{\n" + |
| | | " \"enable\":"+param.isNtp()+",\n" + |
| | | " \"server\":\"http://ntp1.aliyun.com\"\n" + |
| | | " \"server\":\"ntp1.aliyun.com\"\n" + |
| | | " }\n" + |
| | | " }\n" + |
| | | " ]\n" + |
| | |
| | | countDownLatch.countDown(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }).start(); |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | countDownLatch.await(20000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | return param.getNovaList(); |
| | | } |
| | | |
| | |
| | | System.out.println("ViplexCore Demo nvDownLoadScreenshotAsync(截屏) begin... "); |
| | | NovaFileConfig config = SpringContextHolder.getBean(NovaFileConfig.class); |
| | | String shotPath = config.getScreenShotPath(); |
| | | CountDownLatch countDownLatch = new CountDownLatch(param.getScreenShotList().size()); |
| | | param.getScreenShotList().forEach(newNova -> { |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | new Thread(new Runnable() { |
| | | |
| | | @Override |
| | | public void run() { |
| | | login(newNova.getSn(), 0); |
| | | StatusVO login = login(newNova.getSn(), 0); |
| | | if (login.getStatusCode() != 0) { |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | String pictureName = newNova.getSn() + ".png"; |
| | | String str = "{\n" + |
| | | " \"sn\":\"" + newNova.getSn() + "\",\n" + |
| | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }).start(); |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | return param.getScreenShotList(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取屏幕尺寸 |
| | | */ |
| | | public List<NewNovaLed> getDisplayInfoAsync(List<NewNovaLed> newNovaLsit) { |
| | | |
| | | System.out.println("ViplexCore Demo nvGetDisplayInfoAsync(获取分辨率) begin... "); |
| | | //PlayerInfoVO |
| | | CountDownLatch countDownLatch = new CountDownLatch(newNovaLsit.size()); |
| | | newNovaLsit.forEach(newNova -> { |
| | | StatusVO login = login(newNova.getSn(), 0); |
| | | if (login.getStatusCode() != 0) { |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | //推送结果 |
| | | instance.nvGetDisplayInfoAsync("{\n" + |
| | | " \"sn\":\"" + newNova.getSn() + "\"\n" + |
| | | "}", new ViplexCore.CallBack() { |
| | | @Override |
| | | public void dataCallBack(int code, String data) { |
| | | |
| | | System.out.println("\nViplexCore 获取分辨率 code:" + code); |
| | | System.out.println("\nViplexCore 获取分辨率 data:" + data); |
| | | if (code == 0) { |
| | | PlayerInfoVO playerInfoVO = JSON.parseObject(data, PlayerInfoVO.class); |
| | | PlayerInfoVO.TaskArrayDTO.DataDTO dataDTO = playerInfoVO.getTaskArray().get(0).getData(); |
| | | newNova.setWidth(dataDTO.getWidth()); |
| | | newNova.setHeight(dataDTO.getHeight()); |
| | | newNova.setRotation(dataDTO.getRotation()); |
| | | } |
| | | countDownLatch.countDown(); |
| | | } |
| | | }); |
| | | |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return newNovaLsit; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取视频源 |
| | | */ |
| | | public List<NewNovaLed> getVideoInfoAsync(List<NewNovaLed> newNovaLsit) { |
| | | |
| | | System.out.println("ViplexCore Demo nvGetVideoControlInfoAsync(获取视频源) begin... "); |
| | | |
| | | CountDownLatch countDownLatch = new CountDownLatch(newNovaLsit.size()); |
| | | newNovaLsit.forEach(newNova -> { |
| | | StatusVO login = login(newNova.getSn(), 0); |
| | | if (login.getStatusCode() != 0) { |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | //推送结果 |
| | | instance.nvGetVideoControlInfoAsync("{\n" + |
| | | " \"sn\":\"" + newNova.getSn() + "\"\n" + |
| | | "}", new ViplexCore.CallBack() { |
| | | @Override |
| | | public void dataCallBack(int code, String data) { |
| | | |
| | | System.out.println("\nViplexCore 获取视频源 code:" + code); |
| | | System.out.println("\nViplexCore 获取视频源 data:" + data); |
| | | if (code == 0) { |
| | | VideoInfoVO videoInfoVO = JSON.parseObject(data, VideoInfoVO.class); |
| | | newNova.setVideoControlInfo(videoInfoVO.getVideoSource()); |
| | | } |
| | | countDownLatch.countDown(); |
| | | } |
| | | }); |
| | | |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return newNovaLsit; |
| | | } |
| | | |
| | | /** |
| | | * 获取时区 |
| | | */ |
| | | public List<NewNovaLed> getTimezone(List<NewNovaLed> newNovaLsit) { |
| | | |
| | | System.out.println("ViplexCore Demo nvGetCurrentTimeAndZoneAsync(获取时区) begin... "); |
| | | |
| | | CountDownLatch countDownLatch = new CountDownLatch(newNovaLsit.size()); |
| | | newNovaLsit.forEach(newNova -> { |
| | | StatusVO login = login(newNova.getSn(), 0); |
| | | if (login.getStatusCode() != 0) { |
| | | countDownLatch.countDown(); |
| | | return; |
| | | } |
| | | //推送结果 |
| | | instance.nvGetCurrentTimeAndZoneAsync("{\n" + |
| | | " \"sn\":\"" + newNova.getSn() + "\"\n" + |
| | | "}", new ViplexCore.CallBack() { |
| | | @Override |
| | | public void dataCallBack(int code, String data) { |
| | | |
| | | System.out.println("\nViplexCore 获取时区 code:" + code); |
| | | System.out.println("\nViplexCore 获取时区 data:" + data); |
| | | if (code == 0) { |
| | | Map map = JSON.parseObject(data, Map.class); |
| | | newNova.setTimeZone(map.get("timeZone").toString()); |
| | | newNova.setCurrentTime(map.get("currentTime").toString()); |
| | | } |
| | | countDownLatch.countDown(); |
| | | } |
| | | }); |
| | | |
| | | }); |
| | | try { |
| | | countDownLatch.await(30000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return newNovaLsit; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 退出登录 |
| | | */ |
| | | public StatusVO logout(String sn, Integer type) { |
| | | |
| | | System.out.println("ViplexCore Demo nvLogoutAsync(退出登录) begin... "); |
| | | CountDownLatch countDownLatch = new CountDownLatch(1); |
| | | |
| | | StatusVO logout = new StatusVO(); |
| | | //推送结果 |
| | | instance.nvLogoutAsync("{\n" + |
| | | " \"sn\":\"" + sn + "\",\n" + |
| | | " \"loginType\":" + type + "\n" + |
| | | "}", new ViplexCore.CallBack() { |
| | | @Override |
| | | public void dataCallBack(int code, String data) { |
| | | |
| | | System.out.println("\nViplexCore 退出登录 code:" + code); |
| | | System.out.println("\nViplexCore 退出登录 data:" + data); |
| | | logout.setStatusCode(code); |
| | | logout.setStatusData(data); |
| | | countDownLatch.countDown(); |
| | | } |
| | | }); |
| | | |
| | | try { |
| | | countDownLatch.await(10000, TimeUnit.MILLISECONDS); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return logout; |
| | | } |
| | | } |