1st version that works
This commit is contained in:
46
libSafeMobile/src/main/java/com/safemobile/lib/VehMSG.java
Normal file
46
libSafeMobile/src/main/java/com/safemobile/lib/VehMSG.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.safemobile.lib;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.safemobile.lib.Vehicle;
|
||||
|
||||
public class VehMSG extends TCPmsg{
|
||||
|
||||
public ArrayList<Vehicle> vehList;
|
||||
|
||||
public VehMSG(TCPmsg m) {
|
||||
super(m);
|
||||
|
||||
vehList = new ArrayList<Vehicle>();
|
||||
String date4parsing = super.data;
|
||||
SM.Debug("date4parsing:"+date4parsing);
|
||||
String[] tempArr = date4parsing.split(";");
|
||||
|
||||
SM.Debug("tempArr.length:" +tempArr.length);
|
||||
for(int i =0; i<tempArr.length;i++)
|
||||
{
|
||||
//SM.Debug("i:" + i+"Data :"+tempArr[i]);
|
||||
String[] tempVeh = tempArr[i].split("&");
|
||||
//SM.Debug("split len:"+tempVeh.length);
|
||||
|
||||
if(tempVeh.length<7)
|
||||
continue;
|
||||
int sc_id = Integer.parseInt(tempVeh[0]);
|
||||
String imei = tempVeh[1];
|
||||
//String serialNumber = tempVeh[2];
|
||||
String name = tempVeh[3];
|
||||
//String groupName = tempVeh[4];
|
||||
int lp = Integer.parseInt(tempVeh[5]);
|
||||
//String userName = tempVeh[6];
|
||||
boolean status = (Integer.parseInt(tempVeh[7])==1);
|
||||
|
||||
Vehicle veh = new Vehicle(sc_id, imei, lp, name, lp, 0, 0, 0);
|
||||
veh.status = status;
|
||||
vehList.add(veh);
|
||||
//SM.Debug("added veh to list:" +name);
|
||||
//SM.Debug("vehList new size:" +this.vehList.size());
|
||||
}
|
||||
|
||||
SM.Debug("vehList vehList:" +this.vehList.size());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user