DeviceChannel.java 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. package com.genersoft.iot.vmp.gb28181.bean;
  2. import com.genersoft.iot.vmp.gb28181.utils.MessageElementForCatalog;
  3. import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
  4. import io.swagger.v3.oas.annotations.media.Schema;
  5. import lombok.Data;
  6. import lombok.EqualsAndHashCode;
  7. import lombok.extern.slf4j.Slf4j;
  8. import org.dom4j.Element;
  9. import org.springframework.util.ObjectUtils;
  10. import java.lang.reflect.InvocationTargetException;
  11. @Data
  12. @Slf4j
  13. @Schema(description = "通道信息")
  14. @EqualsAndHashCode(callSuper = true)
  15. public class DeviceChannel extends CommonGBChannel {
  16. @Schema(description = "数据库自增ID")
  17. private int id;
  18. @Schema(description = "设备的数据库自增ID")
  19. private Integer deviceDbId;
  20. @MessageElementForCatalog("DeviceID")
  21. @Schema(description = "编码")
  22. private String deviceId;
  23. @MessageElementForCatalog("Name")
  24. @Schema(description = "名称")
  25. private String name;
  26. @MessageElementForCatalog("Manufacturer")
  27. @Schema(description = "设备厂商")
  28. private String manufacturer;
  29. @MessageElementForCatalog("Model")
  30. @Schema(description = "设备型号")
  31. private String model;
  32. // 2016
  33. @MessageElementForCatalog("Owner")
  34. @Schema(description = "设备归属")
  35. private String owner;
  36. @MessageElementForCatalog("CivilCode")
  37. @Schema(description = "行政区域")
  38. private String civilCode;
  39. @MessageElementForCatalog("Block")
  40. @Schema(description = "警区")
  41. private String block;
  42. @MessageElementForCatalog("Address")
  43. @Schema(description = "安装地址")
  44. private String address;
  45. @MessageElementForCatalog("Parental")
  46. @Schema(description = "是否有子设备(必选)1有,0没有")
  47. private Integer parental;
  48. @MessageElementForCatalog("ParentID")
  49. @Schema(description = "父节点ID")
  50. private String parentId;
  51. // 2016
  52. @MessageElementForCatalog("SafetyWay")
  53. @Schema(description = "信令安全模式")
  54. private Integer safetyWay;
  55. @MessageElementForCatalog("RegisterWay")
  56. @Schema(description = "注册方式")
  57. private Integer registerWay;
  58. // 2016
  59. @MessageElementForCatalog("CertNum")
  60. @Schema(description = "证书序列号")
  61. private String certNum;
  62. // 2016
  63. @MessageElementForCatalog("Certifiable")
  64. @Schema(description = "证书有效标识, 缺省为0;证书有效标识:0:无效 1:有效")
  65. private Integer certifiable;
  66. // 2016
  67. @MessageElementForCatalog("ErrCode")
  68. @Schema(description = "无效原因码(有证书且证书无效的设备必选)")
  69. private Integer errCode;
  70. // 2016
  71. @MessageElementForCatalog("EndTime")
  72. @Schema(description = "证书终止有效期(有证书且证书无效的设备必选)")
  73. private String endTime;
  74. @MessageElementForCatalog("Secrecy")
  75. @Schema(description = "保密属性(必选)缺省为0;0-不涉密,1-涉密")
  76. private Integer secrecy;
  77. @MessageElementForCatalog("IPAddress")
  78. @Schema(description = "设备/系统IPv4/IPv6地址")
  79. private String ipAddress;
  80. @MessageElementForCatalog("Port")
  81. @Schema(description = "设备/系统端口")
  82. private Integer port;
  83. @MessageElementForCatalog("Password")
  84. @Schema(description = "设备口令")
  85. private String password;
  86. @MessageElementForCatalog("Status")
  87. @Schema(description = "设备状态")
  88. private String status;
  89. @MessageElementForCatalog("Longitude")
  90. @Schema(description = "经度 WGS-84坐标系")
  91. private Double longitude;
  92. @MessageElementForCatalog("Latitude")
  93. @Schema(description = ",纬度 WGS-84坐标系")
  94. private Double latitude;
  95. @MessageElementForCatalog("Info.PTZType")
  96. @Schema(description = "摄像机结构类型,标识摄像机类型: 1-球机; 2-半球; 3-固定枪机; 4-遥控枪机;5-遥控半球;6-多目设备的全景/拼接通道;7-多目设备的分割通道")
  97. private Integer ptzType;
  98. @MessageElementForCatalog("Info.PositionType")
  99. @Schema(description = "摄像机位置类型扩展。1-省际检查站、2-党政机关、3-车站码头、4-中心广场、5-体育场馆、" +
  100. "6-商业中心、7-宗教场所、8-校园周边、9-治安复杂区域、10-交通干线")
  101. private Integer positionType;
  102. @MessageElementForCatalog("Info.RoomType")
  103. @Schema(description = "摄像机安装位置室外、室内属性。1-室外、2-室内。")
  104. private Integer roomType;
  105. @MessageElementForCatalog("Info.UseType")
  106. @Schema(description = "用途属性, 1-治安、2-交通、3-重点。")
  107. private Integer useType;
  108. @MessageElementForCatalog("Info.SupplyLightType")
  109. @Schema(description = "摄像机补光属性。1-无补光;2-红外补光;3-白光补光;4-激光补光;9-其他")
  110. private Integer supplyLightType;
  111. @MessageElementForCatalog("Info.DirectionType")
  112. @Schema(description = "摄像机监视方位(光轴方向)属性。1-东(西向东)、2-西(东向西)、3-南(北向南)、4-北(南向北)、" +
  113. "5-东南(西北到东南)、6-东北(西南到东北)、7-西南(东北到西南)、8-西北(东南到西北)")
  114. private Integer directionType;
  115. @MessageElementForCatalog("Info.Resolution")
  116. @Schema(description = "摄像机支持的分辨率,可多值")
  117. private String resolution;
  118. @MessageElementForCatalog({"BusinessGroupID","Info.BusinessGroupID"})
  119. @Schema(description = "虚拟组织所属的业务分组ID")
  120. private String businessGroupId;
  121. @MessageElementForCatalog("Info.DownloadSpeed")
  122. @Schema(description = "下载倍速(可选),可多值")
  123. private String downloadSpeed;
  124. @MessageElementForCatalog("Info.SVCSpaceSupportMode")
  125. @Schema(description = "空域编码能力,取值0-不支持;1-1级增强(1个增强层);2-2级增强(2个增强层);3-3级增强(3个增强层)")
  126. private Integer svcSpaceSupportMod;
  127. @MessageElementForCatalog("Info.SVCTimeSupportMode")
  128. @Schema(description = "时域编码能力,取值0-不支持;1-1级增强;2-2级增强;3-3级增强(可选)")
  129. private Integer svcTimeSupportMode;
  130. @Schema(description = "云台类型描述字符串")
  131. private String ptzTypeText;
  132. @Schema(description = "子设备数")
  133. private int subCount;
  134. @Schema(description = "流唯一编号,存在表示正在直播")
  135. private String streamId;
  136. @Schema(description = "是否含有音频")
  137. private boolean hasAudio;
  138. @Schema(description = "GPS的更新时间")
  139. private String gpsTime;
  140. @Schema(description = "码流标识,优先级高于设备中码流标识," +
  141. "用于选择码流时组成码流标识。默认为null,不设置。可选值: stream/streamnumber/streamprofile/streamMode")
  142. private String streamIdentification;
  143. @Schema(description = "通道类型, 默认0, 0: 普通通道,1 行政区划 2 业务分组/虚拟组织")
  144. private int channelType;
  145. public void setPtzType(int ptzType) {
  146. this.ptzType = ptzType;
  147. switch (ptzType) {
  148. case 0:
  149. this.ptzTypeText = "未知";
  150. break;
  151. case 1:
  152. this.ptzTypeText = "球机";
  153. break;
  154. case 2:
  155. this.ptzTypeText = "半球";
  156. break;
  157. case 3:
  158. this.ptzTypeText = "固定枪机";
  159. break;
  160. case 4:
  161. this.ptzTypeText = "遥控枪机";
  162. break;
  163. case 5:
  164. this.ptzTypeText = "遥控半球";
  165. break;
  166. case 6:
  167. this.ptzTypeText = "多目设备的全景/拼接通道";
  168. break;
  169. case 7:
  170. this.ptzTypeText = "多目设备的分割通道";
  171. break;
  172. }
  173. }
  174. public static DeviceChannel decode(Element element) throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
  175. DeviceChannel deviceChannel = XmlUtil.elementDecode(element, DeviceChannel.class);
  176. if(deviceChannel.getCivilCode() != null ) {
  177. if (ObjectUtils.isEmpty(deviceChannel.getCivilCode())
  178. || deviceChannel.getCivilCode().length() > 8 ){
  179. deviceChannel.setCivilCode(null);
  180. }
  181. // 此处对于不在wvp缓存中的行政区划,默认直接存储.保证即使出现wvp的行政区划缓存过老,也可以通过用户自主创建的方式正常使用系统
  182. }
  183. return XmlUtil.elementDecode(element, DeviceChannel.class);
  184. }
  185. public static DeviceChannel decodeWithOnlyDeviceId(Element element) {
  186. Element deviceElement = element.element("DeviceID");
  187. DeviceChannel deviceChannel = new DeviceChannel();
  188. deviceChannel.setDeviceId(deviceElement.getText());
  189. return deviceChannel;
  190. }
  191. }