|  |  | 
 |  |  | import org.slf4j.LoggerFactory; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.util.ObjectUtils; | 
 |  |  | import org.springframework.util.StringUtils; | 
 |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
 |  |  | import org.springframework.web.bind.annotation.RequestParam; | 
 |  |  | import org.springframework.web.bind.annotation.RestController; | 
 |  |  | 
 |  |  |             deviceJsonObject.put("RecvStreamIP", ""); | 
 |  |  |             deviceJsonObject.put("CatalogInterval", 3600); // 通道目录抓取周期 | 
 |  |  |             deviceJsonObject.put("SubscribeInterval", device.getSubscribeCycleForCatalog()); // 订阅周期(秒), 0 表示后台不周期订阅 | 
 |  |  |             deviceJsonObject.put("Online", device.isOnline()); | 
 |  |  |             deviceJsonObject.put("Online", device.isOnLine()); | 
 |  |  |             deviceJsonObject.put("Password", ""); | 
 |  |  |             deviceJsonObject.put("MediaTransport", device.getTransport()); | 
 |  |  |             deviceJsonObject.put("RemoteIP", device.getIp()); | 
 |  |  | 
 |  |  |                                    @RequestParam(required = false)String q, | 
 |  |  |                                    @RequestParam(required = false)Boolean online ){ | 
 |  |  |  | 
 |  |  | //        if (logger.isDebugEnabled()) { | 
 |  |  | //            logger.debug("查询所有视频设备API调用"); | 
 |  |  | //        } | 
 |  |  |  | 
 |  |  |         JSONObject result = new JSONObject(); | 
 |  |  |         // 查询设备是否存在 | 
 |  |  | //        Device device = storager.queryVideoDevice(serial); | 
 |  |  | //        if (device == null) { | 
 |  |  | //            result.put("ChannelCount", 0); | 
 |  |  | //            result.put("ChannelList", "[]"); | 
 |  |  | //            return result; | 
 |  |  | //        } | 
 |  |  |         List<DeviceChannelExtend> deviceChannels; | 
 |  |  |         List<String> channelIds = null; | 
 |  |  |         if (!StringUtils.isEmpty(code)) { | 
 |  |  |         if (!ObjectUtils.isEmpty(code)) { | 
 |  |  |             String[] split = code.trim().split(","); | 
 |  |  |             channelIds = Arrays.asList(split); | 
 |  |  |         } | 
 |  |  | 
 |  |  |             deviceJOSNChannel.put("ID", deviceChannelExtend.getChannelId()); | 
 |  |  |             deviceJOSNChannel.put("DeviceID", deviceChannelExtend.getDeviceId()); | 
 |  |  |             deviceJOSNChannel.put("DeviceName", deviceChannelExtend.getDeviceName()); | 
 |  |  |             deviceJOSNChannel.put("DeviceOnline", deviceChannelExtend.getDeviceOnline() == 1); | 
 |  |  |             deviceJOSNChannel.put("DeviceOnline", deviceChannelExtend.isDeviceOnline()); | 
 |  |  |             deviceJOSNChannel.put("Channel", 0); // TODO 自定义序号 | 
 |  |  |             deviceJOSNChannel.put("Name", deviceChannelExtend.getName()); | 
 |  |  |             deviceJOSNChannel.put("Custom", false); | 
 |  |  | 
 |  |  |             // 1-IETF RFC3261, | 
 |  |  |             // 2-基于口令的双向认证, | 
 |  |  |             // 3-基于数字证书的双向认证 | 
 |  |  |             deviceJOSNChannel.put("Status", deviceChannelExtend.getStatus() == 1 ? "ON":"OFF"); | 
 |  |  |             deviceJOSNChannel.put("Status", deviceChannelExtend.isStatus() ? "ON":"OFF"); | 
 |  |  |             deviceJOSNChannel.put("Longitude", deviceChannelExtend.getLongitude()); | 
 |  |  |             deviceJOSNChannel.put("Latitude", deviceChannelExtend.getLatitude()); | 
 |  |  |             deviceJOSNChannel.put("PTZType ", deviceChannelExtend.getPTZType()); // 云台类型, 0 - 未知, 1 - 球机, 2 - 半球, |