1078-存储多媒体数据检索 + 存储多媒体数据检索应答

This commit is contained in:
648540858
2024-05-14 13:13:58 +08:00
parent aaa1d3a46f
commit e02a047eb2
10 changed files with 284 additions and 22 deletions

View File

@@ -0,0 +1,84 @@
package com.genersoft.iot.vmp.jt1078.bean;
import io.netty.buffer.ByteBuf;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "多媒体检索项数据")
public class JTMediaDataInfo {
@Schema(description = "多媒体数据 ID")
private long id;
@Schema(description = "多媒体类型, 0图像1音频2视频")
private int type;
@Schema(description = "事件项编码: 0平台下发指令1定时动作2抢劫报警触发3碰 撞侧翻报警触发4门开拍照5门关拍照6车门由开 变关 ,车速从小于20km到超过20km7定距拍照")
private int eventCode;
@Schema(description = "通道 ID")
private int channelId;
@Schema(description = "表示拍摄或录制的起始时刻的汇报消息")
private JTPositionBaseInfo positionBaseInfo;
public static JTMediaDataInfo decode(ByteBuf buf) {
JTMediaDataInfo jtMediaEventInfo = new JTMediaDataInfo();
jtMediaEventInfo.setId(buf.readUnsignedInt());
jtMediaEventInfo.setType(buf.readUnsignedByte());
jtMediaEventInfo.setChannelId(buf.readUnsignedByte());
jtMediaEventInfo.setEventCode(buf.readUnsignedByte());
jtMediaEventInfo.setPositionBaseInfo(JTPositionBaseInfo.decode(buf));
return jtMediaEventInfo;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getEventCode() {
return eventCode;
}
public void setEventCode(int eventCode) {
this.eventCode = eventCode;
}
public int getChannelId() {
return channelId;
}
public void setChannelId(int channelId) {
this.channelId = channelId;
}
public JTPositionBaseInfo getPositionBaseInfo() {
return positionBaseInfo;
}
public void setPositionBaseInfo(JTPositionBaseInfo positionBaseInfo) {
this.positionBaseInfo = positionBaseInfo;
}
@Override
public String toString() {
return "JTMediaDataInfo{" +
"id=" + id +
", type=" + type +
", eventCode=" + eventCode +
", channelId=" + channelId +
", positionBaseInfo=" + positionBaseInfo +
'}';
}
}

View File

@@ -1,7 +1,11 @@
package com.genersoft.iot.vmp.jt1078.bean;
import com.genersoft.iot.vmp.jt1078.util.BCDUtil;
import io.netty.buffer.ByteBuf;
import io.swagger.v3.oas.annotations.media.Schema;
import java.nio.ByteBuffer;
@Schema(description = "位置基本信息")
public class JTPositionBaseInfo {
@@ -59,6 +63,23 @@ public class JTPositionBaseInfo {
@Schema(description = "视频报警")
private JTVideoAlarm videoAlarm;
public static JTPositionBaseInfo decode(ByteBuf buf) {
JTPositionBaseInfo positionInfo = new JTPositionBaseInfo();
positionInfo.setAlarmSign(new JTAlarmSign(buf.readInt()));
positionInfo.setStatus(new JTStatus(buf.readInt()));
positionInfo.setLatitude(buf.readInt() * 0.000001D);
positionInfo.setLongitude(buf.readInt() * 0.000001D);
positionInfo.setAltitude(buf.readUnsignedShort());
positionInfo.setSpeed(buf.readUnsignedShort());
positionInfo.setDirection(buf.readUnsignedShort());
byte[] timeBytes = new byte[6];
buf.readBytes(timeBytes);
positionInfo.setTime(BCDUtil.transform(timeBytes));
return positionInfo;
}
public JTAlarmSign getAlarmSign() {
return alarmSign;
}

View File

@@ -0,0 +1,88 @@
package com.genersoft.iot.vmp.jt1078.bean;
import com.genersoft.iot.vmp.jt1078.util.BCDUtil;
import com.genersoft.iot.vmp.utils.DateUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "存储多媒体数据")
public class JTQueryMediaDataCommand {
@Schema(description = "多媒体类型: 0图像1音频2视频")
private int type;
@Schema(description = "通道 ID, 0 表示检索该媒体类型的所有通道")
private int chanelId;
@Schema(description = "事件项编码: 0平台下发指令1定时动作2抢劫报警触发3碰 撞侧翻报警触发;其他保留")
private int event;
@Schema(description = "开始时间")
private String startTime;
@Schema(description = "结束时间")
private String endTime;
public ByteBuf decode() {
ByteBuf byteBuf = Unpooled.buffer();
byteBuf.writeByte(type);
byteBuf.writeByte(chanelId);
byteBuf.writeByte(event);
byteBuf.writeBytes(BCDUtil.strToBcd(DateUtil.yyyy_MM_dd_HH_mm_ssTo1078(startTime)));
byteBuf.writeBytes(BCDUtil.strToBcd(DateUtil.yyyy_MM_dd_HH_mm_ssTo1078(endTime)));
return byteBuf;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getChanelId() {
return chanelId;
}
public void setChanelId(int chanelId) {
this.chanelId = chanelId;
}
public int getEvent() {
return event;
}
public void setEvent(int event) {
this.event = event;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
@Override
public String toString() {
return "JTQueryMediaDataCommand{" +
"type=" + type +
", chanelId=" + chanelId +
", event=" + event +
", startTime='" + startTime + '\'' +
", endTime='" + endTime + '\'' +
'}';
}
}