优化GGA的判断
This commit is contained in:
parent
3df63d6410
commit
d0db10a822
@ -9,7 +9,7 @@ import java.nio.charset.Charset;
|
||||
public class Gga {
|
||||
public static int FIX_RESULT = 4;
|
||||
public static int FLOAT_RESULT = 5;
|
||||
final static byte[] GGA_FLAG = {'$', 'G'};//$xxGGA
|
||||
final static byte[] GGA_FLAG = {'$', 'X', 'X', 'G', 'G', 'A'};//$xxGGA
|
||||
|
||||
final static byte[] d331_flag = {(byte) 0xd3, (byte)0x31};
|
||||
final static byte rtcm_flag = (byte)0xd3;
|
||||
@ -50,9 +50,14 @@ public class Gga {
|
||||
while(pos<data.readableBytes()){
|
||||
byte d0 = data.getByte(pos);
|
||||
byte d1 = data.getByte(pos+1);
|
||||
if(GGA_FLAG[0] == d0 && GGA_FLAG[1] == d1){
|
||||
found = true;
|
||||
break;
|
||||
if(GGA_FLAG[0] == d0){
|
||||
if(data.readableBytes()>5 &&
|
||||
data.getByte(pos+3) == GGA_FLAG[3] &&
|
||||
data.getByte(pos+4) == GGA_FLAG[4] &&
|
||||
data.getByte(pos+5) == GGA_FLAG[5]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(d0 == rtcm_flag){
|
||||
if(d1 == 0x31) { // d331粘包
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user