diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java index 026b999a..fa93c53e 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java @@ -96,6 +96,11 @@ public class CommonGBChannel { @Schema(description = "国标-摄像机结构类型,标识摄像机类型: 1-球机; 2-半球; 3-固定枪机; 4-遥控枪机;5-遥控半球;6-多目设备的全景/拼接通道;7-多目设备的分割通道") private Integer gbPtzType; + // 2016 + @Schema(description = "-摄像机位置类型扩展。1-省际检查站、2-党政机关、3-车站码头、4-中心广场、5-体育场馆、6-商业中心、7-宗教场所、" + + "8-校园周边、9-治安复杂区域、10-交通干线。当目录项为摄像机时可选。") + private Integer PositionType; + @Schema(description = "国标-摄像机光电成像类型。1-可见光成像;2-热成像;3-雷达成像;4-X光成像;5-深度光场成像;9-其他。可多值,") private String gbPhotoelectricImagingTyp; @@ -203,19 +208,111 @@ public class CommonGBChannel { @Schema(description = "关联的拉流代理Id(流来源是拉流代理时有效)") private Integer streamProxyId; + public String encode(){ + return encode(null); + } public String encode(CatalogEvent event){ String content; - if (event.getType().equals(CatalogEvent.DEL) - || event.getType().equals(CatalogEvent.DEFECT) - || event.getType().equals(CatalogEvent.VLOST)) { - content = "\n" + - "" + this.getGbDeviceId() + "\n" + - "" + event + "\r\n" + - ""; + if (event == null) { + return getFullContent(null); + } + switch (event.getType()) { + case CatalogEvent.DEL: + case CatalogEvent.DEFECT: + case CatalogEvent.VLOST: + content = "\n" + + "" + this.getGbDeviceId() + "\n" + + "" + event + "\n" + + "\n"; + break; + case CatalogEvent.ON: + case CatalogEvent.OFF: + content = "\n" + + "" + this.getGbDeviceId() + "\n" + + "" + event + "\r\n" + + "\n"; + break; + case CatalogEvent.ADD: + case CatalogEvent.UPDATE: + content = getFullContent(event.getType()); + break; + default: + content = null; + break; } - - return content; } + private String getFullContent(String event) { + StringBuilder content = new StringBuilder(); + // 行政区划目录项 + content.append("\n") + .append("" + this.getGbDeviceId() + "\n") + .append("" + this.getGbName() + "\n"); + + if (this.getGbDeviceId().length() > 8) { + + String type = this.getGbDeviceId().substring(10,13); + if (type.equals("200")) { + // 业务分组目录项 + content.append("" + this.getGbManufacturer() + "\n") + .append("" + this.getGbModel() + "\n") + .append("" + this.getGbOwner() + "\n") + .append("" + this.getGbCivilCode() + "\n") + .append("
" + this.getGbAddress() + "
\n") + .append("" + this.getGbRegisterWay() + "\n") + .append("" + this.getGbSecrecy() + "\n"); + }else if (type.equals("215")) { + // 业务分组 + content.append("" + this.getGbParentId() + "\n"); + }else if (type.equals("216")) { + // 虚拟组织目录项 + content.append("" + this.getGbParentId() + "\n") + .append("" + this.getGbBusinessGroupId() + "\n"); + }else { + // 设备目录项 + content.append("" + this.getGbManufacturer() + "\n") + .append("" + this.getGbModel() + "\n") + .append("" + this.getGbOwner() + "\n") + .append("" + this.getGbCivilCode() + "\n") + .append("" + this.getGbBlock() + "\n") + .append("
" + this.getGbAddress() + "
\n") + .append("" + this.getGbParental() + "\n") + .append("" + this.getGbParentId() + "\n") + .append("" + this.getGbSafetyWay() + "\n") + .append("" + this.getGbRegisterWay() + "\n") + .append("" + this.getGbCertNum() + "\n") + .append("" + this.getGbCertifiable() + "\n") + .append("" + this.getGbErrCode() + "\n") + .append("" + this.getGbEndTime() + "\n") + .append("" + this.getGbSecrecy() + "\n") + .append("" + this.getGbIpAddress() + "\n") + .append("" + this.getGbPort() + "\n") + .append("" + this.getGbPassword() + "\n") + .append("" + this.getGbStatus() + "\n") + .append("" + this.getGbLongitude() + "\n") + .append("" + this.getGbLatitude() + "\n") + .append("\n") + .append(" " + this.getGbPtzType() + "\n") + .append(" " + this.getPositionType() + "\n") + .append(" " + this.getGbRoomType() + "\n") + .append(" " + this.getGbUseType() + "\n") + .append(" " + this.getGbSupplyLightType() + "\n") + .append(" " + this.getGbDirectionType() + "\n") + .append(" " + this.getGbResolution() + "\n") + .append(" " + this.getGbBusinessGroupId() + "\n") + .append(" " + this.getGbDownloadSpeed() + "\n") + .append(" " + this.getGbSvcSpaceSupportMod() + "\n") + .append(" " + this.getGbSvcTimeSupportMode() + "\n") + .append("") + ; + } + } + if (event != null) { + content.append("" + event + "\n"); + } + content.append("
\n"); + return content.toString(); + } + }