Skip to content

Commit

Permalink
Fix relogin and getAllLastPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
hygkui committed Oct 16, 2015
1 parent 2749113 commit e21050e
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 217 deletions.
26 changes: 15 additions & 11 deletions src/main/java/com/cloudbean/model/CarState.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,21 @@ public void setGprmc(GPRMC gprmc){
}

public CarState(String orgString){
String[] org = orgString.split("\\|");
this.gprmc = new GPRMC(org[0]);
this.posAccuracy = org[1];
this.height = org[2];
this.portState = ByteHexUtil.hexStringToBytes(org[3].trim());
this.analogInput = org[4];
this.temperature = ""+decodeTemp(this.analogInput);
this.baseStation = org[5];
this.gsmStrength = org[6];
this.distant = decodeDistant(org[7]);
this.voltage = decodeVoltage(org[8]);
try{
String[] org = orgString.split("\\|");
this.gprmc = new GPRMC(org[0]);
this.posAccuracy = org[1];
this.height = org[2];
this.portState = ByteHexUtil.hexStringToBytes(org[3].trim());
this.analogInput = org[4];
this.temperature = ""+decodeTemp(this.analogInput);
this.baseStation = org[5];
this.gsmStrength = org[6];
this.distant = decodeDistant(org[7]);
this.voltage = decodeVoltage(org[8]);
} catch (ArrayIndexOutOfBoundsException e){
System.out.println("[CNA-POSITON-DATA-WARN] CarState Parse, ArrayIndexOutOfBoundsException ");
}

}

Expand Down
Loading

2 comments on commit e21050e

@hygkui
Copy link
Member Author

@hygkui hygkui commented on e21050e Oct 16, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cna- login and getalllastposition

@hygkui
Copy link
Member Author

@hygkui hygkui commented on e21050e Oct 16, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the position data that the client socket received form the server may be wrong formatted.

add try/catch to skip it.

Please sign in to comment.