| | |
| | | package org.yzh.web.endpoint; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.github.yezhihao.netmc.core.HandlerInterceptor; |
| | | import io.github.yezhihao.netmc.session.Session; |
| | | import netscape.javascript.JSObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.yzh.commons.util.Byte2NumberUtils; |
| | | import org.yzh.protocol.basics.JTMessage; |
| | | import org.yzh.protocol.commons.JT808; |
| | | import org.yzh.protocol.commons.transform.AttributeKey; |
| | | import org.yzh.protocol.commons.transform.attribute.Battery; |
| | | import org.yzh.protocol.t808.T0001; |
| | | import org.yzh.protocol.t808.T0200; |
| | | import org.yzh.web.model.entity.DeviceDO; |
| | | import org.yzh.web.model.enums.SessionKey; |
| | | |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.ByteOrder; |
| | | |
| | | public class JTHandlerInterceptor implements HandlerInterceptor<JTMessage> { |
| | | |
| | |
| | | boolean transform = request.transform(); |
| | | if (messageId == JT808.位置信息汇报) { |
| | | DeviceDO device = SessionKey.getDevice(session); |
| | | if (device != null) |
| | | if (device != null){ |
| | | device.setLocation((T0200) request); |
| | | if(device.getLocation()!=null && device.getLocation().getAttributes()!=null ){ |
| | | Battery battery= (Battery) device.getLocation().getAttributes().get(AttributeKey.Battery); |
| | | if(battery !=null){ |
| | | device.setBatteryVoltage(battery.getVoltage()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return transform; |
| | | } |
| | | if (!session.isRegistered()) { |