代码拉取完成,页面将自动刷新
同步操作将从 lingxcom/JT808-完整的车辆定位监控系统-支持一键启动 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
需要功能定制或分布式JT808,联系QQ:283853318
该项目由商业版简化而来,所以是成熟代码,放心使用;商业版地址:http://gps.lingx.com
流媒体服务源码引用于 https://gitee.com/matrixy/jtt1078-video-server ;这里只是为方便整合,商业版流媒体服务虽然也是Java开发,设计思路不一样
链接:https://pan.baidu.com/s/19rT2zS3EecXkYnNfGAKO6g
提取码:mowk
该压缩包含:jt808网关、jt1078网关、web后台、mysql数据库;一键启动,立刻享用。限windows 64 bit,启动如有问题可以免费咨询:283853318
我的开发环境是:win7(64位)+eclipse jee+JDK 1.8+Tomcat 8.0+ MySQL8.0
@Override
protected void channelRead0(ChannelHandlerContext ctx, byte[] msg) throws Exception {
//System.out.println(Utils.bytesToHex(msg));
try {
MyByteBuf buff = new MyByteBuf(JT808Utils.decode(msg));
buff.readByte();
int msgId = buff.readUnsignedShort();
int length = buff.readUnsignedShort();
String tid = "";
boolean isFB = (length & 0b0010000000000000) > 0;// 是否分包
boolean isVersion = (length & 0b0100000000000000) > 0;// 是否版本标识
if (isVersion) {
buff.readByte();
tid = buff.readStringBCD(10);
} else {
tid = buff.readStringBCD(6);
}
if(ctx!=null)IJT808Cache.SESSIONS.put(tid, ctx);
int msgSn = buff.readUnsignedShort();// 消息流水号
if(!nores8001.contains(msgId)) {//不回复
Cmd8001 cmd=new Cmd8001(tid,msgId,msgSn);
if(ctx!=null)ctx.writeAndFlush(cmd.toMessageByteBuf());
}
length = length & 0x3ff;
ByteBuf content = null;
if (isFB) {//分包处理
int max = buff.readUnsignedShort();
int ind = buff.readUnsignedShort();
content = buff.readByteBuf(length);
String key = tid + "_" + msgId;
if (ind == 1) {
ByteBuf bigBuff=Unpooled.buffer(1024, 1024*1000);//最大1M
bigBuff.writeBytes(content);
IJT808Cache.FB_CACHE.put(key, bigBuff);
return;
} else if (ind == max) {
IJT808Cache.FB_CACHE.getIfPresent(key).writeBytes(content);
content = IJT808Cache.FB_CACHE.getIfPresent(key);
IJT808Cache.FB_CACHE.invalidate(key);
} else {
IJT808Cache.FB_CACHE.getIfPresent(key).writeBytes(content);
return;
}
} else {
content = buff.readByteBuf(length);
}
byte check = buff.readByte();
buff.readByte();
if (JT808Utils.check(msg, check, length, isFB, isVersion)) {
IJT808MsgHandler msgHandler=null;
for(IJT808MsgHandler tmp:this.listMsgHandler) {
if(tmp.getMsgId()==msgId) {
msgHandler=tmp;
}
}
if(msgHandler!=null) {
try {
msgHandler.handle(content, tid, msgId, msgSn, ctx,isVersion);
} catch (Exception e) {
e.printStackTrace();
}
}else {
System.out.println(String.format("没有对应的处理器:%04X,%s,%s",msgId,tid,Utils.bytesToHex(msg)));
}
}else {
System.out.println("验证码有误:"+Utils.bytesToHex(msg));
}
} catch (Exception e) {
System.out.println(System.currentTimeMillis()+":"+Utils.bytesToHex(msg));
e.printStackTrace();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。