648540858
2023-08-16 985082d33930868c3cc1723f28fd9aaae9013a8f
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java
@@ -18,7 +18,6 @@
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;
@@ -90,7 +89,7 @@
            deviceJsonObject.put("RecvStreamIP", "");
            deviceJsonObject.put("CatalogInterval", 3600); // 通道目录抓取周期
            deviceJsonObject.put("SubscribeInterval", device.getSubscribeCycleForCatalog()); // 订阅周期(秒), 0 表示后台不周期订阅
            deviceJsonObject.put("Online", device.getOnline() == 1);
            deviceJsonObject.put("Online", device.isOnLine());
            deviceJsonObject.put("Password", "");
            deviceJsonObject.put("MediaTransport", device.getTransport());
            deviceJsonObject.put("RemoteIP", device.getIp());
@@ -115,20 +114,11 @@
                                   @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);
        }
@@ -148,7 +138,7 @@
            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);
@@ -167,7 +157,7 @@
            // 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 - 半球,