mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-24 22:17:49 +08:00
1078-查询终端属性...
This commit is contained in:
parent
5b489d7c26
commit
76580d8fdc
@ -0,0 +1,109 @@
|
|||||||
|
package com.genersoft.iot.vmp.jt1078.bean;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JT 通信模块属性
|
||||||
|
*/
|
||||||
|
@Schema(description = "JT通信模块属性")
|
||||||
|
public class JCommunicationModuleAttribute {
|
||||||
|
|
||||||
|
private boolean gprs ;
|
||||||
|
private boolean cdma ;
|
||||||
|
private boolean tdScdma ;
|
||||||
|
private boolean wcdma ;
|
||||||
|
private boolean cdma2000 ;
|
||||||
|
private boolean tdLte ;
|
||||||
|
private boolean other ;
|
||||||
|
|
||||||
|
|
||||||
|
public static JCommunicationModuleAttribute getInstance(short content) {
|
||||||
|
boolean gprs = (content & 1) == 1;
|
||||||
|
boolean cdma = (content >>> 1 & 1) == 1;
|
||||||
|
boolean tdScdma = (content >>> 2 & 1) == 1;
|
||||||
|
boolean wcdma = (content >>> 3 & 1) == 1;
|
||||||
|
boolean cdma2000 = (content >>> 4 & 1) == 1;
|
||||||
|
boolean tdLte = (content >>> 5 & 1) == 1;
|
||||||
|
boolean other = (content >>> 7 & 1) == 1;
|
||||||
|
return new JCommunicationModuleAttribute(gprs, cdma, tdScdma, wcdma, cdma2000, tdLte, other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JCommunicationModuleAttribute(boolean gprs, boolean cdma, boolean tdScdma, boolean wcdma, boolean cdma2000, boolean tdLte, boolean other) {
|
||||||
|
this.gprs = gprs;
|
||||||
|
this.cdma = cdma;
|
||||||
|
this.tdScdma = tdScdma;
|
||||||
|
this.wcdma = wcdma;
|
||||||
|
this.cdma2000 = cdma2000;
|
||||||
|
this.tdLte = tdLte;
|
||||||
|
this.other = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGprs() {
|
||||||
|
return gprs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGprs(boolean gprs) {
|
||||||
|
this.gprs = gprs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCdma() {
|
||||||
|
return cdma;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCdma(boolean cdma) {
|
||||||
|
this.cdma = cdma;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTdScdma() {
|
||||||
|
return tdScdma;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTdScdma(boolean tdScdma) {
|
||||||
|
this.tdScdma = tdScdma;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWcdma() {
|
||||||
|
return wcdma;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWcdma(boolean wcdma) {
|
||||||
|
this.wcdma = wcdma;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCdma2000() {
|
||||||
|
return cdma2000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCdma2000(boolean cdma2000) {
|
||||||
|
this.cdma2000 = cdma2000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTdLte() {
|
||||||
|
return tdLte;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTdLte(boolean tdLte) {
|
||||||
|
this.tdLte = tdLte;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOther() {
|
||||||
|
return other;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOther(boolean other) {
|
||||||
|
this.other = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "JCommunicationModuleAttribute{" +
|
||||||
|
"gprs=" + gprs +
|
||||||
|
", cdma=" + cdma +
|
||||||
|
", tdScdma=" + tdScdma +
|
||||||
|
", wcdma=" + wcdma +
|
||||||
|
", cdma2000=" + cdma2000 +
|
||||||
|
", tdLte=" + tdLte +
|
||||||
|
", other=" + other +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
package com.genersoft.iot.vmp.jt1078.bean;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JT GNSS 模块属性
|
||||||
|
*/
|
||||||
|
@Schema(description = "JTGNSS 模块属性")
|
||||||
|
public class JGnssAttribute {
|
||||||
|
|
||||||
|
private boolean gps;
|
||||||
|
|
||||||
|
private boolean beidou;
|
||||||
|
|
||||||
|
private boolean glonass ;
|
||||||
|
|
||||||
|
private boolean gaLiLeo;
|
||||||
|
|
||||||
|
public static JGnssAttribute getInstance(short content) {
|
||||||
|
boolean gps = (content & 1) == 1;
|
||||||
|
boolean beidou = (content >>> 1 & 1) == 1;
|
||||||
|
boolean glonass = (content >>> 2 & 1) == 1;
|
||||||
|
boolean gaLiLeo = (content >>> 3 & 1) == 1;
|
||||||
|
return new JGnssAttribute(gps, beidou, glonass, gaLiLeo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JGnssAttribute(boolean gps, boolean beidou, boolean glonass, boolean gaLiLeo) {
|
||||||
|
this.gps = gps;
|
||||||
|
this.beidou = beidou;
|
||||||
|
this.glonass = glonass;
|
||||||
|
this.gaLiLeo = gaLiLeo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGps() {
|
||||||
|
return gps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGps(boolean gps) {
|
||||||
|
this.gps = gps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBeidou() {
|
||||||
|
return beidou;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBeidou(boolean beidou) {
|
||||||
|
this.beidou = beidou;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGlonass() {
|
||||||
|
return glonass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGlonass(boolean glonass) {
|
||||||
|
this.glonass = glonass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGaLiLeo() {
|
||||||
|
return gaLiLeo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGaLiLeo(boolean gaLiLeo) {
|
||||||
|
this.gaLiLeo = gaLiLeo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "JGnssAttribute{" +
|
||||||
|
"gps=" + gps +
|
||||||
|
", beidou=" + beidou +
|
||||||
|
", glonass=" + glonass +
|
||||||
|
", gaLiLeo=" + gaLiLeo +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,129 @@
|
|||||||
|
package com.genersoft.iot.vmp.jt1078.bean;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.config.CameraTimer;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.config.CollisionAlarmParams;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.config.GnssPositioningMode;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.config.IllegalDrivingPeriods;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JT 终端属性
|
||||||
|
*/
|
||||||
|
@Schema(description = "JT终端属性")
|
||||||
|
public class JTDeviceAttribute {
|
||||||
|
|
||||||
|
@Schema(description = "终端类型")
|
||||||
|
private JTDeviceType type;
|
||||||
|
|
||||||
|
@Schema(description = "制造商 ID")
|
||||||
|
private String makerId;
|
||||||
|
|
||||||
|
@Schema(description = "终端型号")
|
||||||
|
private String deviceModel;
|
||||||
|
|
||||||
|
@Schema(description = "终端 ID")
|
||||||
|
private String terminalId;
|
||||||
|
|
||||||
|
@Schema(description = "终端 SIM卡 ICCID")
|
||||||
|
private String iccId;
|
||||||
|
|
||||||
|
@Schema(description = "终端硬件版本号")
|
||||||
|
private String hardwareVersion;
|
||||||
|
|
||||||
|
@Schema(description = "固件版本号")
|
||||||
|
private String firmwareVersion ;
|
||||||
|
|
||||||
|
@Schema(description = "GNSS 模块属性")
|
||||||
|
private JGnssAttribute gnssAttribute ;
|
||||||
|
|
||||||
|
@Schema(description = "通信模块属性")
|
||||||
|
private JCommunicationModuleAttribute communicationModuleAttribute ;
|
||||||
|
|
||||||
|
public JTDeviceType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(JTDeviceType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMakerId() {
|
||||||
|
return makerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMakerId(String makerId) {
|
||||||
|
this.makerId = makerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceModel() {
|
||||||
|
return deviceModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceModel(String deviceModel) {
|
||||||
|
this.deviceModel = deviceModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTerminalId() {
|
||||||
|
return terminalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalId(String terminalId) {
|
||||||
|
this.terminalId = terminalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIccId() {
|
||||||
|
return iccId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIccId(String iccId) {
|
||||||
|
this.iccId = iccId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHardwareVersion() {
|
||||||
|
return hardwareVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHardwareVersion(String hardwareVersion) {
|
||||||
|
this.hardwareVersion = hardwareVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirmwareVersion() {
|
||||||
|
return firmwareVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirmwareVersion(String firmwareVersion) {
|
||||||
|
this.firmwareVersion = firmwareVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JGnssAttribute getGnssAttribute() {
|
||||||
|
return gnssAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGnssAttribute(JGnssAttribute gnssAttribute) {
|
||||||
|
this.gnssAttribute = gnssAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JCommunicationModuleAttribute getCommunicationModuleAttribute() {
|
||||||
|
return communicationModuleAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommunicationModuleAttribute(JCommunicationModuleAttribute communicationModuleAttribute) {
|
||||||
|
this.communicationModuleAttribute = communicationModuleAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "JTDeviceAttribute{" +
|
||||||
|
"type=" + type +
|
||||||
|
", makerId='" + makerId + '\'' +
|
||||||
|
", deviceModel='" + deviceModel + '\'' +
|
||||||
|
", terminalId='" + terminalId + '\'' +
|
||||||
|
", iccId='" + iccId + '\'' +
|
||||||
|
", hardwareVersion='" + hardwareVersion + '\'' +
|
||||||
|
", firmwareVersion='" + firmwareVersion + '\'' +
|
||||||
|
", gnssAttribute=" + gnssAttribute +
|
||||||
|
", communicationModuleAttribute=" + communicationModuleAttribute +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,135 @@
|
|||||||
|
package com.genersoft.iot.vmp.jt1078.bean;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JT 终端类型
|
||||||
|
*/
|
||||||
|
@Schema(description = "JT终端参数设置")
|
||||||
|
public class JTDeviceType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 适用客运车辆
|
||||||
|
*/
|
||||||
|
private boolean passengerVehicles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 适用危险品车辆
|
||||||
|
*/
|
||||||
|
private boolean dangerousGoodsVehicles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通货运车辆
|
||||||
|
*/
|
||||||
|
private boolean freightVehicles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出租车辆
|
||||||
|
*/
|
||||||
|
private boolean rentalVehicles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支持硬盘录像
|
||||||
|
*/
|
||||||
|
private boolean hardDiskRecording;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* false:一体机 ,true:分体机
|
||||||
|
*/
|
||||||
|
private boolean splittingMachine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 适用挂车
|
||||||
|
*/
|
||||||
|
private boolean trailer;
|
||||||
|
|
||||||
|
public static JTDeviceType getInstance(int content) {
|
||||||
|
boolean passengerVehicles = (content & 1) == 1;
|
||||||
|
boolean dangerousGoodsVehicles = (content >>> 1 & 1) == 1;
|
||||||
|
boolean freightVehicles = (content >>> 2 & 1) == 1;
|
||||||
|
boolean rentalVehicles = (content >>> 3 & 1) == 1;
|
||||||
|
boolean hardDiskRecording = (content >>> 6 & 1) == 1;
|
||||||
|
boolean splittingMachine = (content >>> 7 & 1) == 1;
|
||||||
|
boolean trailer = (content >>> 8 & 1) == 1;
|
||||||
|
return new JTDeviceType(passengerVehicles, dangerousGoodsVehicles, freightVehicles, rentalVehicles, hardDiskRecording, splittingMachine, trailer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JTDeviceType(boolean passengerVehicles, boolean dangerousGoodsVehicles, boolean freightVehicles, boolean rentalVehicles, boolean hardDiskRecording, boolean splittingMachine, boolean trailer) {
|
||||||
|
this.passengerVehicles = passengerVehicles;
|
||||||
|
this.dangerousGoodsVehicles = dangerousGoodsVehicles;
|
||||||
|
this.freightVehicles = freightVehicles;
|
||||||
|
this.rentalVehicles = rentalVehicles;
|
||||||
|
this.hardDiskRecording = hardDiskRecording;
|
||||||
|
this.splittingMachine = splittingMachine;
|
||||||
|
this.trailer = trailer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPassengerVehicles() {
|
||||||
|
return passengerVehicles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassengerVehicles(boolean passengerVehicles) {
|
||||||
|
this.passengerVehicles = passengerVehicles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDangerousGoodsVehicles() {
|
||||||
|
return dangerousGoodsVehicles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDangerousGoodsVehicles(boolean dangerousGoodsVehicles) {
|
||||||
|
this.dangerousGoodsVehicles = dangerousGoodsVehicles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFreightVehicles() {
|
||||||
|
return freightVehicles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFreightVehicles(boolean freightVehicles) {
|
||||||
|
this.freightVehicles = freightVehicles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRentalVehicles() {
|
||||||
|
return rentalVehicles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRentalVehicles(boolean rentalVehicles) {
|
||||||
|
this.rentalVehicles = rentalVehicles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHardDiskRecording() {
|
||||||
|
return hardDiskRecording;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHardDiskRecording(boolean hardDiskRecording) {
|
||||||
|
this.hardDiskRecording = hardDiskRecording;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSplittingMachine() {
|
||||||
|
return splittingMachine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSplittingMachine(boolean splittingMachine) {
|
||||||
|
this.splittingMachine = splittingMachine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTrailer() {
|
||||||
|
return trailer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrailer(boolean trailer) {
|
||||||
|
this.trailer = trailer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "JTDeviceType{" +
|
||||||
|
"passengerVehicles=" + passengerVehicles +
|
||||||
|
", dangerousGoodsVehicles=" + dangerousGoodsVehicles +
|
||||||
|
", freightVehicles=" + freightVehicles +
|
||||||
|
", rentalVehicles=" + rentalVehicles +
|
||||||
|
", hardDiskRecording=" + hardDiskRecording +
|
||||||
|
", splittingMachine=" + splittingMachine +
|
||||||
|
", trailer=" + trailer +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.jt1078.cmd;
|
package com.genersoft.iot.vmp.jt1078.cmd;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceAttribute;
|
||||||
import com.genersoft.iot.vmp.jt1078.proc.entity.Cmd;
|
import com.genersoft.iot.vmp.jt1078.proc.entity.Cmd;
|
||||||
import com.genersoft.iot.vmp.jt1078.proc.response.*;
|
import com.genersoft.iot.vmp.jt1078.proc.response.*;
|
||||||
import com.genersoft.iot.vmp.jt1078.session.SessionManager;
|
import com.genersoft.iot.vmp.jt1078.session.SessionManager;
|
||||||
@ -21,6 +22,7 @@ public class JT1078Template {
|
|||||||
private static final String H8104 = "8104";
|
private static final String H8104 = "8104";
|
||||||
private static final String H8105 = "8105";
|
private static final String H8105 = "8105";
|
||||||
private static final String H8106 = "8106";
|
private static final String H8106 = "8106";
|
||||||
|
private static final String H8107 = "8107";
|
||||||
private static final String H9101 = "9101";
|
private static final String H9101 = "9101";
|
||||||
private static final String H9102 = "9102";
|
private static final String H9102 = "9102";
|
||||||
private static final String H9201 = "9201";
|
private static final String H9201 = "9201";
|
||||||
@ -37,6 +39,7 @@ public class JT1078Template {
|
|||||||
|
|
||||||
private static final String H0001 = "0001";
|
private static final String H0001 = "0001";
|
||||||
private static final String H0104 = "0104";
|
private static final String H0104 = "0104";
|
||||||
|
private static final String H0107 = "0107";
|
||||||
private static final String H1205 = "1205";
|
private static final String H1205 = "1205";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -325,4 +328,15 @@ public class JT1078Template {
|
|||||||
.build();
|
.build();
|
||||||
return SessionManager.INSTANCE.request(cmd, timeOut);
|
return SessionManager.INSTANCE.request(cmd, timeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object deviceAttribute(String devId, J8107 j8107, int timeOut) {
|
||||||
|
Cmd cmd = new Cmd.Builder()
|
||||||
|
.setDevId(devId)
|
||||||
|
.setPackageNo(randomInt())
|
||||||
|
.setMsgId(H8107)
|
||||||
|
.setRespId(H0107)
|
||||||
|
.setRs(j8107)
|
||||||
|
.build();
|
||||||
|
return SessionManager.INSTANCE.request(cmd, timeOut);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
|||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceAttribute;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConfig;
|
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConfig;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConnectionControl;
|
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConnectionControl;
|
||||||
import com.genersoft.iot.vmp.jt1078.proc.request.J1205;
|
import com.genersoft.iot.vmp.jt1078.proc.request.J1205;
|
||||||
@ -359,5 +360,14 @@ public class JT1078Controller {
|
|||||||
service.factoryResetControl(deviceId);
|
service.factoryResetControl(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "查询终端属性", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@Parameter(name = "control", description = "终端控制参数", required = true)
|
||||||
|
@GetMapping("/attribute")
|
||||||
|
public JTDeviceAttribute attribute(String deviceId){
|
||||||
|
|
||||||
|
logger.info("[1078-查询终端属性] deviceId: {}", deviceId);
|
||||||
|
return service.attribute(deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,109 @@
|
|||||||
|
package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.*;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.config.CameraTimer;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.config.CollisionAlarmParams;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.config.GnssPositioningMode;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.config.IllegalDrivingPeriods;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.controller.JT1078Controller;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.proc.Header;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.proc.response.J8001;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.session.Session;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.session.SessionManager;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.util.BCDUtil;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询终端属性应答
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@MsgId(id = "0107")
|
||||||
|
public class J0107 extends Re {
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(J0107.class);
|
||||||
|
|
||||||
|
Integer respNo;
|
||||||
|
Integer paramLength;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||||
|
respNo = buf.readUnsignedShort();
|
||||||
|
paramLength = (int) buf.readUnsignedByte();
|
||||||
|
if (paramLength <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
JTDeviceAttribute deviceAttribute = new JTDeviceAttribute();
|
||||||
|
|
||||||
|
deviceAttribute.setType(JTDeviceType.getInstance(buf.getUnsignedShort(0)));
|
||||||
|
|
||||||
|
byte[] bytes5 = new byte[5];
|
||||||
|
buf.getBytes(2, bytes5);
|
||||||
|
deviceAttribute.setMakerId(new String(bytes5).trim());
|
||||||
|
|
||||||
|
byte[] bytes20 = new byte[20];
|
||||||
|
buf.getBytes(7, bytes20);
|
||||||
|
deviceAttribute.setDeviceModel(new String(bytes20).trim());
|
||||||
|
|
||||||
|
byte[] bytes7 = new byte[7];
|
||||||
|
buf.getBytes(37, bytes7);
|
||||||
|
deviceAttribute.setTerminalId(new String(bytes7).trim());
|
||||||
|
|
||||||
|
byte[] iccIdBytes = new byte[10];
|
||||||
|
buf.getBytes(67, iccIdBytes);
|
||||||
|
deviceAttribute.setIccId(BCDUtil.transform(iccIdBytes));
|
||||||
|
|
||||||
|
int n = buf.getUnsignedByte(77);
|
||||||
|
byte[] hardwareVersionBytes = new byte[n];
|
||||||
|
buf.getBytes(78, hardwareVersionBytes);
|
||||||
|
try {
|
||||||
|
deviceAttribute.setHardwareVersion(new String(hardwareVersionBytes, "GBK").trim());
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
logger.error("[查询终端属性应答] 读取硬件版本失败" , e);
|
||||||
|
}
|
||||||
|
|
||||||
|
int m = buf.getUnsignedByte(78 + n);
|
||||||
|
byte[] firmwareVersionBytes = new byte[m];
|
||||||
|
buf.getBytes(79 + n, firmwareVersionBytes);
|
||||||
|
try {
|
||||||
|
deviceAttribute.setFirmwareVersion(new String(firmwareVersionBytes, "GBK").trim());
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
logger.error("[查询终端属性应答] 读取固件版本失败" , e);
|
||||||
|
}
|
||||||
|
|
||||||
|
deviceAttribute.setGnssAttribute(JGnssAttribute.getInstance(buf.getUnsignedByte(79 + n + m)));
|
||||||
|
deviceAttribute.setCommunicationModuleAttribute(JCommunicationModuleAttribute.getInstance(buf.getUnsignedByte(80 + n + m)));
|
||||||
|
System.out.println(deviceAttribute);
|
||||||
|
SessionManager.INSTANCE.response(header.getTerminalId(), "0107", (long) respNo, deviceAttribute);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||||
|
J8001 j8001 = new J8001();
|
||||||
|
j8001.setRespNo(header.getSn());
|
||||||
|
j8001.setRespId(header.getMsgId());
|
||||||
|
j8001.setResult(J8001.SUCCESS);
|
||||||
|
return j8001;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApplicationEvent getEvent() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.jt1078.service;
|
|||||||
import com.genersoft.iot.vmp.common.GeneralCallback;
|
import com.genersoft.iot.vmp.common.GeneralCallback;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceAttribute;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConfig;
|
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConfig;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConnectionControl;
|
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConnectionControl;
|
||||||
import com.genersoft.iot.vmp.jt1078.proc.request.J1205;
|
import com.genersoft.iot.vmp.jt1078.proc.request.J1205;
|
||||||
@ -52,4 +53,6 @@ public interface Ijt1078Service {
|
|||||||
void resetControl(String deviceId);
|
void resetControl(String deviceId);
|
||||||
|
|
||||||
void factoryResetControl(String deviceId);
|
void factoryResetControl(String deviceId);
|
||||||
|
|
||||||
|
JTDeviceAttribute attribute(String deviceId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
|||||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceAttribute;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConfig;
|
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConfig;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConnectionControl;
|
import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConnectionControl;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute;
|
import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute;
|
||||||
@ -548,4 +549,10 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
j8105.setFactoryReset(true);
|
j8105.setFactoryReset(true);
|
||||||
jt1078Template.deviceControl(deviceId, j8105, 6);
|
jt1078Template.deviceControl(deviceId, j8105, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JTDeviceAttribute attribute(String deviceId) {
|
||||||
|
J8107 j8107 = new J8107();
|
||||||
|
return (JTDeviceAttribute)jt1078Template.deviceAttribute(deviceId, j8107, 20);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user