1078-存储多媒体数据检索 + 存储多媒体数据检索应答
This commit is contained in:
@@ -29,7 +29,7 @@ public class J0200 extends Re {
|
||||
|
||||
@Override
|
||||
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||
positionInfo = J0200.getPositionInfo(buf);
|
||||
positionInfo = JTPositionBaseInfo.decode(buf);
|
||||
|
||||
// 读取附加信息
|
||||
// JTPositionAdditionalInfo positionAdditionalInfo = new JTPositionAdditionalInfo();
|
||||
@@ -39,23 +39,6 @@ public class J0200 extends Re {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JTPositionBaseInfo getPositionInfo(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;
|
||||
}
|
||||
|
||||
private void getAdditionalMsg(ByteBuf buf, JTPositionAdditionalInfo additionalInfo) {
|
||||
|
||||
if (buf.isReadable()) {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class J0201 extends Re {
|
||||
|
||||
int respNo = buf.readUnsignedShort();
|
||||
|
||||
positionInfo = J0200.getPositionInfo(buf);
|
||||
positionInfo = JTPositionBaseInfo.decode(buf);
|
||||
log.info("[JT-位置信息查询应答]: {}", positionInfo.toString());
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0201", (long) respNo, positionInfo);
|
||||
return null;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class J0500 extends Re {
|
||||
@Override
|
||||
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||
int respNo = buf.readUnsignedShort();
|
||||
positionInfo = J0200.getPositionInfo(buf);
|
||||
positionInfo = JTPositionBaseInfo.decode(buf);
|
||||
log.info("[JT-车辆控制应答]: {}", positionInfo.toString());
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0500", (long) respNo, positionInfo);
|
||||
return null;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class J0704 extends Re {
|
||||
for (int i = 0; i < length; i++) {
|
||||
int dateLength = buf.readUnsignedShort();
|
||||
ByteBuf byteBuf = buf.readBytes(dateLength);
|
||||
JTPositionBaseInfo positionInfo = J0200.getPositionInfo(byteBuf);
|
||||
JTPositionBaseInfo positionInfo = JTPositionBaseInfo.decode(byteBuf);
|
||||
positionBaseInfoList.add(positionInfo);
|
||||
}
|
||||
log.info("[JT-定位数据批量上传]: 共{}条", positionBaseInfoList.size());
|
||||
|
||||
@@ -33,7 +33,7 @@ public class J0801 extends Re {
|
||||
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||
mediaEventInfo = JTMediaEventInfo.decode(buf);
|
||||
ByteBuf byteBuf = buf.readSlice(28);
|
||||
positionBaseInfo = J0200.getPositionInfo(byteBuf);
|
||||
positionBaseInfo = JTPositionBaseInfo.decode(byteBuf);
|
||||
String fileName = "mediaEvent/" + mediaEventInfo.getId() + ".";
|
||||
switch (mediaEventInfo.getCode()){
|
||||
case 0:
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||
|
||||
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTMediaDataInfo;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTMediaEventInfo;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTPositionBaseInfo;
|
||||
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 io.netty.buffer.ByteBuf;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 存储多媒体数据检索应答
|
||||
*
|
||||
*/
|
||||
@MsgId(id = "0802")
|
||||
public class J0802 extends Re {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(J0802.class);
|
||||
|
||||
private int respNo;
|
||||
private List<JTMediaDataInfo> mediaDataInfoList;
|
||||
|
||||
@Override
|
||||
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||
respNo = buf.readUnsignedShort();
|
||||
int length = buf.readUnsignedShort();
|
||||
for (int i = 0; i < length; i++) {
|
||||
mediaDataInfoList.add(JTMediaDataInfo.decode(buf));
|
||||
}
|
||||
log.info("[JT-存储多媒体数据检索应答]: {}", mediaDataInfoList.size());
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0802", (long) respNo, mediaDataInfoList);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||
J8001 j8001 = new J8001();
|
||||
j8001.setRespNo(header.getSn());
|
||||
j8001.setRespId(header.getMsgId());
|
||||
return j8001;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationEvent getEvent() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.genersoft.iot.vmp.jt1078.proc.response;
|
||||
|
||||
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTQueryMediaDataCommand;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTShootingCommand;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
/**
|
||||
* 存储多媒体数据检索
|
||||
*/
|
||||
@MsgId(id = "8802")
|
||||
public class J8802 extends Rs {
|
||||
|
||||
JTQueryMediaDataCommand command;
|
||||
|
||||
@Override
|
||||
public ByteBuf encode() {
|
||||
return command.decode();
|
||||
}
|
||||
|
||||
public JTQueryMediaDataCommand getCommand() {
|
||||
return command;
|
||||
}
|
||||
|
||||
public void setCommand(JTQueryMediaDataCommand command) {
|
||||
this.command = command;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user