1st version that works
This commit is contained in:
@ -0,0 +1,42 @@
|
||||
package com.safemobile.lib;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class LastPosmsg extends TCPmsg {
|
||||
|
||||
public ArrayList<LastPos> PosList;
|
||||
public static int count=0;
|
||||
public LastPosmsg(TCPmsg tcp) {
|
||||
super(tcp);
|
||||
PosList = new ArrayList<LastPos>();
|
||||
String date4parsing = super.data;
|
||||
//SM.Debug("SMS date4parsing:"+date4parsing);
|
||||
String[] tempArr = date4parsing.split(";");
|
||||
//SM.Debug("SMS tempArr.length:" +tempArr.length);
|
||||
for(int i =0; i<tempArr.length;i++)
|
||||
{
|
||||
String[] tempVeh = tempArr[i].split("&");
|
||||
|
||||
if(tempVeh.length<6)
|
||||
continue;
|
||||
LastPos tmpLast = new LastPos();
|
||||
tmpLast.imei = Long.parseLong(tempVeh[0]);
|
||||
tmpLast.lat = Double.parseDouble(tempVeh[1]);
|
||||
tmpLast.lng = Double.parseDouble(tempVeh[2]);
|
||||
tmpLast.speed = Integer.parseInt(tempVeh[3]);
|
||||
if (Integer.parseInt(tempVeh[4])==0) tmpLast.isON =true;
|
||||
else tmpLast.isON = false;
|
||||
tmpLast.timeGMT = Long.parseLong(tempVeh[5]);
|
||||
|
||||
//tmpLast.Address = tempVeh[6];
|
||||
tmpLast.Address = "";
|
||||
PosList.add(tmpLast);
|
||||
//SM.Debug("duda",tmpLast.toString());
|
||||
|
||||
}
|
||||
count +=this.PosList.size();
|
||||
SM.Debug("duda","LastList size:" +this.PosList.size() + " total:" +count);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user