简体   繁体   中英

Reading data from the device?

Am developing a Netty application. In that am reading the data packets from the client. But there is one device called Teltonika. This device first sends the IMEI number and once we acknowledge, it sends the TrackPacket .

But the problem here is that it sends the correct IMEI number but the TarckPacket being sent remains in an unreadable format. Please help me .

'IMEI NO: [0, 15, 51, 53, 50, 56, 52, 56, 48, 50, 50, 55, 57, 49, 55, 49, 53]'

The device sending IMEI number, is in correct format but the below tracking packet is not int the correct format.

Tracking Packet:

[0, 0, 0, 0, 0, 0, 0, -61, 8, 4, 0, 0, 1, 53, -117, 86, 80, -56, 0, 46, 60, 22, -128, 7, -60, -27, 40, 3, -118, 1, 92, 10, 0, 0, 0, 6, 2, 1, 1, 2, 0, 3, 9, 0, 23, 10, 0, 13, 24, 0, 0, 1, -57, 0, 0, 0, 0, 0, 0, 0, 1, 53, -117, 85, 101, -18, 0, 46, 60, 22, -128, 7, -60, -27, -112, 3, -119, 1, 92, 9, 0, 0, 0, 6, 2, 1, 1, 2, 0, 3, 9, 0, 27, 10, 0, 10, 24, 0, 0, 1, -57, 0, 0, 0, 0, 0, 0, 0, 1, 53, -117, 84, 123, 21, 0, 46, 60, 22, -128, 7, -60, -27, -112, 3, -121, 1, 92, 8, 0, 0, 0, 6, 2, 1, 1, 2, 0, 3, 9, 0, 27, 10, 0, 12, 24, 0, 0, 1, -57, 0, 0, 0, 0, 0, 0, 0, 1, 53, -117, 83, -115, -78, 0, 46, 60, 22, -128, 7, -60, -27, -48, 3, -121, 1, 92, 11 ]

What I have done:

StringBuffer sbs = new StringBuffer(); 
buf = (ChannelBuffer) e.getMessage();
while(buf.readable()) 
{
sbs.append((char) buf.readByte()); 
} 
msg = sbs.toString();
System.out.println(msg);
byte[] request = new byte[] { 0x01 };    
e.getChannel().write(ChannelBuffers.wrappedBuffer(request)); 
System.out.flush();

如果是移动gsm或cdma设备,则搜索“ AT命令”以触发这些命令COM端口,这将为触发的命令返回所需的结果。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM