1078-解析位置汇报
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||
|
||||
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTPositionInfo;
|
||||
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;
|
||||
@@ -18,9 +19,42 @@ import org.springframework.context.ApplicationEvent;
|
||||
*/
|
||||
@MsgId(id = "0200")
|
||||
public class J0200 extends Re {
|
||||
|
||||
private JTPositionInfo positionInfo;
|
||||
|
||||
@Override
|
||||
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||
positionInfo = new JTPositionInfo();
|
||||
int alarmSignInt = buf.readInt();
|
||||
int statusInt = buf.readInt();
|
||||
int latitudeInt = buf.readInt();
|
||||
int longitudeInt = buf.readInt();
|
||||
int altitudeInt = buf.readUnsignedShort();
|
||||
int speedInt = buf.readUnsignedShort();
|
||||
int directionInt = buf.readUnsignedShort();
|
||||
byte[] timeBytes = new byte[6];
|
||||
buf.readBytes(timeBytes);
|
||||
System.out.println(alarmSignInt);
|
||||
System.out.println(statusInt);
|
||||
System.out.println(latitudeInt);
|
||||
System.out.println(longitudeInt);
|
||||
System.out.println(altitudeInt);
|
||||
System.out.println(speedInt);
|
||||
System.out.println(directionInt);
|
||||
// TODO 解析时间
|
||||
// for (byte timeByte : timeBytes) {
|
||||
// for (int i = 0; i < 8; i++) {
|
||||
// System.out.print(timeByte>>i & 1);
|
||||
// }
|
||||
// }
|
||||
StringBuffer temp = new StringBuffer(timeBytes.length * 2);
|
||||
for (int i = 0; i < timeBytes.length; i++) {
|
||||
temp.append((byte) ((timeBytes[i] & 0xf0) >>> 4));
|
||||
temp.append((byte) (timeBytes[i] & 0x0f));
|
||||
}
|
||||
|
||||
System.out.println(temp.toString().substring(0, 1).equalsIgnoreCase("0") ? temp
|
||||
.toString().substring(1) : temp.toString());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user