|
|
|
@ -199,16 +199,16 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
|
|
|
|
|
if(AppParams.DEMO)
|
|
|
|
|
{
|
|
|
|
|
allVehicle.add(new Vehicle(101, "101", 101, "101", 101, 101, 101, 0));
|
|
|
|
|
allVehicle.add(new Vehicle(102, "102", 102, "102", 102, 102, 102, 0));
|
|
|
|
|
allVehicle.add(new Vehicle(103, "103", 103, "Ambulance", 78, 103, 103, 0));
|
|
|
|
|
allVehicle.add(new Vehicle(104, "104", 104, "104", 104, 104, 104, 0));
|
|
|
|
|
allVehicle.add(new Vehicle(105, "105", 105, "Police", 105, 105, 105, 0));
|
|
|
|
|
allVehicle.add(new Vehicle(106, "106", 106, "Mike", 106, 106, 106, 0));
|
|
|
|
|
allVehicle.add(new Vehicle(107, "107", 107, "Rob", 107, 107, 107, 0));
|
|
|
|
|
allVehicle.add(new Vehicle(108, "108", 108, "Ben", 108, 108, 108, 0));
|
|
|
|
|
allVehicle.add(new Vehicle(109, "109", 109, "Taxi_3", 109, 109, 109, 0));
|
|
|
|
|
allVehicle.add(new Vehicle(110, "110", 110, "Pam", 110, 110, 110, 0));
|
|
|
|
|
getAllVehicle().add(new Vehicle(101, "101", 101, "101", 101, 101, 101, 0));
|
|
|
|
|
getAllVehicle().add(new Vehicle(102, "102", 102, "102", 102, 102, 102, 0));
|
|
|
|
|
getAllVehicle().add(new Vehicle(103, "103", 103, "Ambulance", 78, 103, 103, 0));
|
|
|
|
|
getAllVehicle().add(new Vehicle(104, "104", 104, "104", 104, 104, 104, 0));
|
|
|
|
|
getAllVehicle().add(new Vehicle(105, "105", 105, "Police", 105, 105, 105, 0));
|
|
|
|
|
getAllVehicle().add(new Vehicle(106, "106", 106, "Mike", 106, 106, 106, 0));
|
|
|
|
|
getAllVehicle().add(new Vehicle(107, "107", 107, "Rob", 107, 107, 107, 0));
|
|
|
|
|
getAllVehicle().add(new Vehicle(108, "108", 108, "Ben", 108, 108, 108, 0));
|
|
|
|
|
getAllVehicle().add(new Vehicle(109, "109", 109, "Taxi_3", 109, 109, 109, 0));
|
|
|
|
|
getAllVehicle().add(new Vehicle(110, "110", 110, "Pam", 110, 110, 110, 0));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listSMS = new ArrayList<SMS>();
|
|
|
|
@ -218,7 +218,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
listSMS.add(new SMS(3, 1, 1328060100, "i'm at the train station", 0, 102));
|
|
|
|
|
listSMS.add(new SMS(4, 1, 1121016818, "I'll be right there", 0, 103));
|
|
|
|
|
|
|
|
|
|
for(Vehicle veh:allVehicle)
|
|
|
|
|
for(Vehicle veh: getAllVehicle())
|
|
|
|
|
{
|
|
|
|
|
SuperVehicle tmpSuper = new SuperVehicle(veh.sc_id,veh.imei,veh.lp, veh.name, veh.driver_id, veh.time_route, veh.GPS_reporting_interval, veh.is_stolen);
|
|
|
|
|
if (veh.sc_id == 101)
|
|
|
|
@ -242,8 +242,8 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
else if (veh.sc_id == 110)
|
|
|
|
|
tmpSuper.SetDataFromLastPos(41.748391,-87.933497, Calendar.getInstance().getTimeInMillis(), 47, "Historic U.S. 66, Burr Ridge, IL 60527 , USA", true);
|
|
|
|
|
|
|
|
|
|
SuperVehHash.put(Long.valueOf(veh.imei), tmpSuper);
|
|
|
|
|
VehHashbySc_id.put(veh.sc_id, veh);
|
|
|
|
|
getSuperVehHash().put(Long.valueOf(veh.imei), tmpSuper);
|
|
|
|
|
getVehHashByScId().put(veh.sc_id, veh);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -253,7 +253,6 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
// do not dim the display
|
|
|
|
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// get NewMessage Visual Element
|
|
|
|
|
layoutNewMessage = (RelativeLayout) findViewById(R.id.layoutNewMessage);
|
|
|
|
|
textViewNMMessage = (TextView) findViewById(R.id.textViewNMMessage);
|
|
|
|
@ -406,10 +405,24 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
tabHost.setCurrentTabByTag("Text");
|
|
|
|
|
AppParams.crtTab = AppParams.Tabs.message;
|
|
|
|
|
|
|
|
|
|
if(AppParams.DEMO && messageActivity.allVehicle.size()== 0)
|
|
|
|
|
{
|
|
|
|
|
messageActivity.UpdateVehs(allVehicle);
|
|
|
|
|
messageActivity.UpdateSMS(listSMS);
|
|
|
|
|
if (AppParams.DEMO && messageActivity.allVehicle.size()== 0) {
|
|
|
|
|
// select button
|
|
|
|
|
buttonText.setSelected(true);
|
|
|
|
|
// deselect other buttons
|
|
|
|
|
buttonAlarms.setSelected(false);
|
|
|
|
|
buttonLive.setSelected(false);
|
|
|
|
|
buttonRadio.setSelected(false);
|
|
|
|
|
buttonRecordings.setSelected(false);
|
|
|
|
|
buttonSetup.setSelected(false);
|
|
|
|
|
buttonHistory.setSelected(false);
|
|
|
|
|
// select tab
|
|
|
|
|
tabHost.setCurrentTabByTag("Text");
|
|
|
|
|
AppParams.crtTab = AppParams.Tabs.message;
|
|
|
|
|
|
|
|
|
|
if (AppParams.DEMO && messageActivity.allVehicle.size()== 0) {
|
|
|
|
|
messageActivity.UpdateVehs(getAllVehicle());
|
|
|
|
|
messageActivity.UpdateSMS(listSMS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -438,7 +451,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
|
|
|
|
|
if(radioActivity!= null && radioActivity.allVehicle!= null && radioActivity.allVehicle.size()==0)
|
|
|
|
|
{
|
|
|
|
|
radioActivity.allVehicle = allVehicle;
|
|
|
|
|
radioActivity.allVehicle = getAllVehicle();
|
|
|
|
|
radioActivity.UpdateVehicle();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -733,7 +746,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
|
|
|
|
|
if(AppParams.DEMO && liveActivity != null)
|
|
|
|
|
{
|
|
|
|
|
liveActivity.vehiclesReceived(allVehicle);
|
|
|
|
|
liveActivity.vehiclesReceived(getAllVehicle());
|
|
|
|
|
demoPositionsList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -808,7 +821,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
tabHost.setCurrentTabByTag("Text");
|
|
|
|
|
AppParams.crtTab = AppParams.Tabs.message;
|
|
|
|
|
|
|
|
|
|
messageActivity.sc_id = getVehicle4Imei(imei).sc_id;
|
|
|
|
|
messageActivity.sc_id = getVehicle4Imei(getImei()).sc_id;
|
|
|
|
|
messageActivity.LASTMESSAGES = false;
|
|
|
|
|
messageActivity.GetLastSMS();
|
|
|
|
|
|
|
|
|
@ -1037,14 +1050,14 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
public void run() {
|
|
|
|
|
if(AppParams.crtTab == AppParams.Tabs.live)
|
|
|
|
|
{
|
|
|
|
|
if(SuperVehHash.containsKey((long)101))
|
|
|
|
|
if(getSuperVehHash().containsKey((long)101))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
HistPos crtPos = demoPositions.get(demoPosition++ % demoPositions.size());
|
|
|
|
|
|
|
|
|
|
SM.Debug("########### UPDATE");
|
|
|
|
|
int sc_id = demoPosition%3 == 0 ? 101:102;
|
|
|
|
|
((SuperVehicle)SuperVehHash.get((long)sc_id)).SetNewPosition(crtPos.lat, crtPos.lng, Calendar.getInstance().getTime().getTime(), crtPos.speed);
|
|
|
|
|
((SuperVehicle) getSuperVehHash().get((long)sc_id)).SetNewPosition(crtPos.lat, crtPos.lng, Calendar.getInstance().getTime().getTime(), crtPos.speed);
|
|
|
|
|
liveActivity.refreshMap();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1057,9 +1070,9 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
HistPos crtPos = demoPositions.get(demoPosition++ % demoPositions.size());
|
|
|
|
|
|
|
|
|
|
SM.Debug("########### UPDATE");
|
|
|
|
|
int sc_id = Integer.parseInt(imei);
|
|
|
|
|
((SuperVehicle)SuperVehHash.get((long)sc_id)).SetNewPosition(crtPos.lat + 0.0002, crtPos.lng + 0.0002, Calendar.getInstance().getTime().getTime(), crtPos.speed+2);
|
|
|
|
|
mess = "Lat:" + String.format("%5f", crtPos.lat + 0.0002) + ", Lng:" + String.format("%5f", crtPos.lng + 0.0002);
|
|
|
|
|
int sc_id = Integer.parseInt(getImei());
|
|
|
|
|
((SuperVehicle) getSuperVehHash().get((long)sc_id)).SetNewPosition(crtPos.lat + 0.0002, crtPos.lng + 0.0002, Calendar.getInstance().getTime().getTime(), crtPos.speed+2);
|
|
|
|
|
setMess("Lat:" + String.format("%5f", crtPos.lat + 0.0002) + ", Lng:" + String.format("%5f", crtPos.lng + 0.0002));
|
|
|
|
|
liveActivity.refreshMap();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1125,7 +1138,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
// when connection becomes true after it was false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(allVehicle.size() == 0)
|
|
|
|
|
if(getAllVehicle().size() == 0)
|
|
|
|
|
//connectTask.doIn(OperationCodes.GetVehicles, new Object[] {AppParams.USERID});
|
|
|
|
|
new ConnectTask().execute(new String[] {OperationCodes.GetVehicles + "", AppParams.USERID + ""});
|
|
|
|
|
//getVehicles(AppParams.USERID);
|
|
|
|
@ -1218,20 +1231,23 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
|
|
|
|
|
GPSmsg GPSPos= new GPSmsg(msg);
|
|
|
|
|
//SM.Debug("Got new GPS pos data:" + GPSPos.data);
|
|
|
|
|
|
|
|
|
|
if (SuperVehHash.get(GPSPos.gpsValue.imei) != null) {
|
|
|
|
|
((SuperVehicle)SuperVehHash.get(GPSPos.gpsValue.imei)).SetNewPosition(GPSPos.gpsValue.lat, GPSPos.gpsValue.lng, GPSPos.gpsValue.timeGMT, GPSPos.gpsValue.speed);
|
|
|
|
|
// if (SuperVehHash.get(GPSPos.gpsValue.imei).needUpdate) {
|
|
|
|
|
if (AppParams.crtTab == AppParams.Tabs.live) {
|
|
|
|
|
SM.Debug("currentActivity instanceof LiveActivity");
|
|
|
|
|
try {
|
|
|
|
|
if (liveActivity != null)
|
|
|
|
|
liveActivity.refreshMap();
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
SM.Debug("Error load hash: "+ ex);
|
|
|
|
|
|
|
|
|
|
if (getSuperVehHash().get(GPSPos.gpsValue.imei) != null) {
|
|
|
|
|
getSuperVehHash().get(GPSPos.gpsValue.imei).SetNewPosition(GPSPos.gpsValue.lat, GPSPos.gpsValue.lng, GPSPos.gpsValue.timeGMT, GPSPos.gpsValue.speed);
|
|
|
|
|
|
|
|
|
|
if (getSuperVehHash().get(GPSPos.gpsValue.imei).needUpdate) {
|
|
|
|
|
//list for live
|
|
|
|
|
if (AppParams.crtTab == AppParams.Tabs.live) {
|
|
|
|
|
//SM.Debug("+++++ duda +++++");
|
|
|
|
|
SM.Debug("currentActivity instanceof LiveActivity");
|
|
|
|
|
try {
|
|
|
|
|
if(liveActivity != null)
|
|
|
|
|
liveActivity.refreshMap();
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
SM.Debug("Error load hash:"+ex.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1240,21 +1256,22 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
SM.Debug("Got POLL GPS message");
|
|
|
|
|
TCPmsg msg= event.msg();
|
|
|
|
|
GPSmsg GPSPos= new GPSmsg(msg);
|
|
|
|
|
imei = Long.toString(GPSPos.gpsValue.imei);
|
|
|
|
|
mess = "LAT:"+Double.toString(GPSPos.gpsValue.lat)+" LNG:"+Double.toString(GPSPos.gpsValue.lng);
|
|
|
|
|
setImei(Long.toString(GPSPos.gpsValue.imei));
|
|
|
|
|
setMess("LAT:"+Double.toString(GPSPos.gpsValue.lat)+" LNG:"+Double.toString(GPSPos.gpsValue.lng));
|
|
|
|
|
SM.Debug("Got new Poll pos data:" + GPSPos.data);
|
|
|
|
|
|
|
|
|
|
if (SuperVehHash.get(GPSPos.gpsValue.imei) != null) {
|
|
|
|
|
((SuperVehicle)SuperVehHash.get(GPSPos.gpsValue.imei)).SetNewPosition(GPSPos.gpsValue.lat, GPSPos.gpsValue.lng, GPSPos.gpsValue.timeGMT, GPSPos.gpsValue.speed);
|
|
|
|
|
|
|
|
|
|
if(getSuperVehHash().get(GPSPos.gpsValue.imei) != null) {
|
|
|
|
|
((SuperVehicle) getSuperVehHash().get(GPSPos.gpsValue.imei)).SetNewPosition(GPSPos.gpsValue.lat, GPSPos.gpsValue.lng, GPSPos.gpsValue.timeGMT, GPSPos.gpsValue.speed);
|
|
|
|
|
//if is not check i need to force check to put on the map
|
|
|
|
|
Boolean forceChecked =false;
|
|
|
|
|
if (!SuperVehHash.get(GPSPos.gpsValue.imei).needUpdate) {
|
|
|
|
|
SuperVehHash.get(GPSPos.gpsValue.imei).needUpdate =true;
|
|
|
|
|
if (!getSuperVehHash().get(GPSPos.gpsValue.imei).needUpdate) {
|
|
|
|
|
getSuperVehHash().get(GPSPos.gpsValue.imei).needUpdate =true;
|
|
|
|
|
forceChecked =true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//back to standard procedures to put on the map
|
|
|
|
|
if(SuperVehHash.get(GPSPos.gpsValue.imei).needUpdate)
|
|
|
|
|
if(getSuperVehHash().get(GPSPos.gpsValue.imei).needUpdate)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//list for live
|
|
|
|
@ -1267,7 +1284,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
int x = 0;
|
|
|
|
|
if (forceChecked)
|
|
|
|
|
{
|
|
|
|
|
for (Vehicle veh : allVehicle)
|
|
|
|
|
for (Vehicle veh : getAllVehicle())
|
|
|
|
|
{
|
|
|
|
|
if (veh.imei.compareTo(Long.toString(GPSPos.gpsValue.imei))==0) break;
|
|
|
|
|
x++;
|
|
|
|
@ -1276,7 +1293,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
else x = -1;
|
|
|
|
|
if(liveActivity!=null)
|
|
|
|
|
{
|
|
|
|
|
if (x!=allVehicle.size())
|
|
|
|
|
if (x!= getAllVehicle().size())
|
|
|
|
|
liveActivity.pollReceived(x ,GPSPos.gpsValue.lat,GPSPos.gpsValue.lng);
|
|
|
|
|
else
|
|
|
|
|
liveActivity.pollReceived(-1 ,GPSPos.gpsValue.lat,GPSPos.gpsValue.lng);
|
|
|
|
@ -1329,10 +1346,10 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
for(Vehicle veh:vMSG.vehList)
|
|
|
|
|
{
|
|
|
|
|
SuperVehicle tmpSuper = new SuperVehicle(veh.sc_id,veh.imei,veh.lp, veh.name, veh.driver_id, veh.time_route, veh.GPS_reporting_interval, veh.is_stolen);
|
|
|
|
|
SuperVehHash.put(Long.valueOf(veh.imei), tmpSuper);
|
|
|
|
|
VehHashbySc_id.put(veh.sc_id, veh);
|
|
|
|
|
getSuperVehHash().put(Long.valueOf(veh.imei), tmpSuper);
|
|
|
|
|
getVehHashByScId().put(veh.sc_id, veh);
|
|
|
|
|
}
|
|
|
|
|
SM.Debug(" #$############# " + SuperVehHash.size() + " \nVEH " + vMSG.vehList.size());
|
|
|
|
|
SM.Debug(" #$############# " + getSuperVehHash().size() + " \nVEH " + vMSG.vehList.size());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
@ -1355,7 +1372,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
if(messageActivity != null)
|
|
|
|
|
messageActivity.UpdateVehs(vMSG.vehList);
|
|
|
|
|
}
|
|
|
|
|
allVehicle = vMSG.vehList;
|
|
|
|
|
setAllVehicle(vMSG.vehList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onLastSMSsReceived(TCPEvent event) {
|
|
|
|
@ -1428,8 +1445,8 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
SM.Debug("Message:" + tempArr[1]);
|
|
|
|
|
|
|
|
|
|
// change Visual Elements
|
|
|
|
|
imei = tempArr[0];
|
|
|
|
|
mess = tempArr[1];
|
|
|
|
|
setImei(tempArr[0]);
|
|
|
|
|
setMess(tempArr[1]);
|
|
|
|
|
long time = Calendar.getInstance().getTimeInMillis() / 1000;
|
|
|
|
|
try {
|
|
|
|
|
// get time from the last received sms and divide it to 1000 to convert it to seconds
|
|
|
|
@ -1488,9 +1505,10 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
SM.Debug("Got last pos");
|
|
|
|
|
|
|
|
|
|
LastPosmsg lastPos= new LastPosmsg(msg);
|
|
|
|
|
for (LastPos posMsg: lastPos.PosList) {
|
|
|
|
|
if (SuperVehHash.get(posMsg.imei) != null)
|
|
|
|
|
((SuperVehicle) SuperVehHash.get(posMsg.imei)).SetDataFromLastPos(posMsg.lat, posMsg.lng, posMsg.timeGMT, posMsg.speed, posMsg.Address, posMsg.isON);
|
|
|
|
|
//SM.Debug("Got LastPost msg.data:" + msg.data);
|
|
|
|
|
for(LastPos posMsg: lastPos.PosList) {
|
|
|
|
|
if(getSuperVehHash().get(posMsg.imei) != null)
|
|
|
|
|
getSuperVehHash().get(posMsg.imei).SetDataFromLastPos(posMsg.lat, posMsg.lng, posMsg.timeGMT, posMsg.speed, posMsg.Address, posMsg.isON);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1847,33 +1865,33 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
if(tabHost.getCurrentTab() != 5)
|
|
|
|
|
{
|
|
|
|
|
// change Visual Elements
|
|
|
|
|
imei = UnitIMEI;
|
|
|
|
|
setImei(UnitIMEI);
|
|
|
|
|
switch (msg.opCode)
|
|
|
|
|
{
|
|
|
|
|
case 135: mess = "speed "+tempArr[1];
|
|
|
|
|
case 135: setMess("speed "+tempArr[1]);
|
|
|
|
|
break;
|
|
|
|
|
case 136: mess = "landmark "+tempArr[1];
|
|
|
|
|
case 136: setMess("landmark "+tempArr[1]);
|
|
|
|
|
break;
|
|
|
|
|
case 137: mess = "zone "+tempArr[1];
|
|
|
|
|
case 137: setMess("zone "+tempArr[1]);
|
|
|
|
|
break;
|
|
|
|
|
case 138: mess = "emergency";
|
|
|
|
|
case 138: setMess("emergency");
|
|
|
|
|
break;
|
|
|
|
|
case 140: mess = "telemetry "+ tempArr[1];
|
|
|
|
|
case 140: setMess("telemetry "+ tempArr[1]);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
mess = "emergency";
|
|
|
|
|
setMess("emergency");
|
|
|
|
|
}
|
|
|
|
|
myHandler.post(UpdateResultsAlarm);
|
|
|
|
|
|
|
|
|
|
if ((msg.opCode==138)&&(AppParams.crtTab == AppParams.Tabs.live))
|
|
|
|
|
{
|
|
|
|
|
if(SuperVehHash.get(Long.parseLong(UnitIMEI)) != null)
|
|
|
|
|
if(getSuperVehHash().get(Long.parseLong(UnitIMEI)) != null)
|
|
|
|
|
{
|
|
|
|
|
//if is not check i need to force check to put on the map
|
|
|
|
|
Boolean forceChecked =false;
|
|
|
|
|
if (!SuperVehHash.get(Long.parseLong(UnitIMEI)).needUpdate)
|
|
|
|
|
if (!getSuperVehHash().get(Long.parseLong(UnitIMEI)).needUpdate)
|
|
|
|
|
{
|
|
|
|
|
SuperVehHash.get(Long.parseLong(UnitIMEI)).needUpdate =true;
|
|
|
|
|
getSuperVehHash().get(Long.parseLong(UnitIMEI)).needUpdate =true;
|
|
|
|
|
forceChecked =true;
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
@ -1881,7 +1899,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
int x = 0;
|
|
|
|
|
if (forceChecked)
|
|
|
|
|
{
|
|
|
|
|
for (Vehicle veh : allVehicle)
|
|
|
|
|
for (Vehicle veh : getAllVehicle())
|
|
|
|
|
{
|
|
|
|
|
if (veh.imei.compareTo(UnitIMEI)==0) break;
|
|
|
|
|
x++;
|
|
|
|
@ -1890,10 +1908,10 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
else x = -1;
|
|
|
|
|
if(liveActivity != null)
|
|
|
|
|
{
|
|
|
|
|
if (x!=allVehicle.size())
|
|
|
|
|
liveActivity.emergencyAlarmReceived(x ,SuperVehHash.get(Long.parseLong(UnitIMEI)).lat,SuperVehHash.get(Long.parseLong(UnitIMEI)).lng);
|
|
|
|
|
if (x!= getAllVehicle().size())
|
|
|
|
|
liveActivity.emergencyAlarmReceived(x , getSuperVehHash().get(Long.parseLong(UnitIMEI)).lat, getSuperVehHash().get(Long.parseLong(UnitIMEI)).lng);
|
|
|
|
|
else
|
|
|
|
|
liveActivity.emergencyAlarmReceived(-1, SuperVehHash.get(Long.parseLong(UnitIMEI)).lat,SuperVehHash.get(Long.parseLong(UnitIMEI)).lng);
|
|
|
|
|
liveActivity.emergencyAlarmReceived(-1, getSuperVehHash().get(Long.parseLong(UnitIMEI)).lat, getSuperVehHash().get(Long.parseLong(UnitIMEI)).lng);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
@ -1920,8 +1938,8 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
if (rec.typeID==1)
|
|
|
|
|
rec.NameForDisplay = AppParams.USERNAME;
|
|
|
|
|
else {
|
|
|
|
|
if (SuperVehHash.get((long)rec.subID)!=null)
|
|
|
|
|
rec.NameForDisplay = SuperVehHash.get((long)rec.subID).name;
|
|
|
|
|
if (getSuperVehHash().get((long)rec.subID)!=null)
|
|
|
|
|
rec.NameForDisplay = getSuperVehHash().get((long)rec.subID).name;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2002,10 +2020,10 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
activePopupType= MsgType.ALARM;
|
|
|
|
|
imageViewPopUp.setImageResource(R.drawable.siren_on);
|
|
|
|
|
slideTabsText.setText(getString(R.string.newAlarm));
|
|
|
|
|
if (getVehicle4Imei(imei)!=null)
|
|
|
|
|
textViewNMFrom.setText(getString(R.string.from) + ": " + getVehicle4Imei(imei).name);
|
|
|
|
|
else textViewNMFrom.setText(getString(R.string.from) + ": " + imei);
|
|
|
|
|
textViewNMMessage.setText("TYPE: " + mess);
|
|
|
|
|
if (getVehicle4Imei(getImei())!=null)
|
|
|
|
|
textViewNMFrom.setText(getString(R.string.from) + ": " + getVehicle4Imei(getImei()).name);
|
|
|
|
|
else textViewNMFrom.setText(getString(R.string.from) + ": " + getImei());
|
|
|
|
|
textViewNMMessage.setText("TYPE: " + getMess());
|
|
|
|
|
// show layout
|
|
|
|
|
layoutNewMessage.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
|
@ -2042,7 +2060,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
// set TextViews
|
|
|
|
|
String from = "";
|
|
|
|
|
Vehicle fromVehicle = null;
|
|
|
|
|
if((fromVehicle = getVehicle4Imei(imei)) != null)
|
|
|
|
|
if((fromVehicle = getVehicle4Imei(getImei())) != null)
|
|
|
|
|
from = fromVehicle.name;
|
|
|
|
|
|
|
|
|
|
if(tcp!=null && !AppParams.DEMO)
|
|
|
|
@ -2051,7 +2069,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
imageViewPopUp.setImageResource(R.drawable.poll);
|
|
|
|
|
slideTabsText.setText("Poll Reply");
|
|
|
|
|
textViewNMFrom.setText("From: " + from);
|
|
|
|
|
textViewNMMessage.setText(mess);
|
|
|
|
|
textViewNMMessage.setText(getMess());
|
|
|
|
|
// show layout
|
|
|
|
|
layoutNewMessage.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
|
@ -2068,7 +2086,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
imageViewPopUp.setImageResource(R.drawable.poll);
|
|
|
|
|
slideTabsText.setText("Poll Reply");
|
|
|
|
|
textViewNMFrom.setText("From: " + from);
|
|
|
|
|
textViewNMMessage.setText(mess);
|
|
|
|
|
textViewNMMessage.setText(getMess());
|
|
|
|
|
// show layout
|
|
|
|
|
layoutNewMessage.setVisibility(View.VISIBLE);
|
|
|
|
|
/*
|
|
|
|
@ -2100,8 +2118,8 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
activePopupType = MsgType.SMS;
|
|
|
|
|
imageViewPopUp.setImageResource(R.drawable.message);
|
|
|
|
|
slideTabsText.setText("New Message");
|
|
|
|
|
textViewNMFrom.setText("From: " + getVehicle4Imei(imei).name);
|
|
|
|
|
textViewNMMessage.setText("MSG: " + mess);
|
|
|
|
|
textViewNMFrom.setText("From: " + getVehicle4Imei(getImei()).name);
|
|
|
|
|
textViewNMMessage.setText("MSG: " + getMess());
|
|
|
|
|
// show layout
|
|
|
|
|
layoutNewMessage.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
|
@ -2114,11 +2132,11 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
}
|
|
|
|
|
else if(AppParams.DEMO)
|
|
|
|
|
{
|
|
|
|
|
mess = "i got your sms";
|
|
|
|
|
setMess("i got your sms");
|
|
|
|
|
activePopupType = MsgType.SMS;
|
|
|
|
|
imageViewPopUp.setImageResource(R.drawable.message);
|
|
|
|
|
slideTabsText.setText("New Message");
|
|
|
|
|
textViewNMFrom.setText("From: " + getVehicle4Imei(imei).name);
|
|
|
|
|
textViewNMFrom.setText("From: " + getVehicle4Imei(getImei()).name);
|
|
|
|
|
textViewNMMessage.setText("MSG: " + "i got your sms");
|
|
|
|
|
// show layout
|
|
|
|
|
layoutNewMessage.setVisibility(View.VISIBLE);
|
|
|
|
@ -2138,31 +2156,31 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
|
|
|
|
|
public void createNotification(int icon) {
|
|
|
|
|
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
|
|
|
|
String tickerText = "SafeMobile Dispatch: New Message from " + imei;
|
|
|
|
|
String contentTitle = "New Message from " + imei;
|
|
|
|
|
String contentText = "\"" + mess + "\"";
|
|
|
|
|
String tickerText = "SafeMobile Dispatch: New Message from " + getImei();
|
|
|
|
|
String contentTitle = "New Message from " + getImei();
|
|
|
|
|
String contentText = "\"" + getMess() + "\"";
|
|
|
|
|
|
|
|
|
|
Vehicle veh = getVehicle4Imei(imei);
|
|
|
|
|
Vehicle veh = getVehicle4Imei(getImei());
|
|
|
|
|
|
|
|
|
|
int icon_value = icon;
|
|
|
|
|
switch(icon)
|
|
|
|
|
{
|
|
|
|
|
case AppParams.messageNotif:
|
|
|
|
|
contentText = "\"" + mess + "\"";
|
|
|
|
|
contentTitle = "New Message from " + imei;
|
|
|
|
|
contentText = "\"" + getMess() + "\"";
|
|
|
|
|
contentTitle = "New Message from " + getImei();
|
|
|
|
|
icon = R.drawable.message;
|
|
|
|
|
break;
|
|
|
|
|
case AppParams.pollNotif:
|
|
|
|
|
contentText = "\"" + mess + "\"" ;
|
|
|
|
|
contentTitle = "Poll Reply from " + (veh !=null ? getVehicle4Imei(imei).name : imei);
|
|
|
|
|
tickerText = "SafeMobile Dispatch: Poll Reply from " + (veh !=null ? getVehicle4Imei(imei).name : imei);
|
|
|
|
|
contentText = "\"" + getMess() + "\"" ;
|
|
|
|
|
contentTitle = "Poll Reply from " + (veh !=null ? getVehicle4Imei(getImei()).name : getImei());
|
|
|
|
|
tickerText = "SafeMobile Dispatch: Poll Reply from " + (veh !=null ? getVehicle4Imei(getImei()).name : getImei());
|
|
|
|
|
icon = R.drawable.poll;
|
|
|
|
|
break;
|
|
|
|
|
case AppParams.alertNotif:
|
|
|
|
|
String vehName = getString(R.string.from) + ": " + imei;
|
|
|
|
|
String vehName = getString(R.string.from) + ": " + getImei();
|
|
|
|
|
if(veh!=null)
|
|
|
|
|
vehName = getString(R.string.from) + ": " + (veh !=null ? getVehicle4Imei(imei).name : imei);
|
|
|
|
|
contentText ="\"" + mess + "\"";
|
|
|
|
|
vehName = getString(R.string.from) + ": " + (veh !=null ? getVehicle4Imei(getImei()).name : getImei());
|
|
|
|
|
contentText ="\"" + getMess() + "\"";
|
|
|
|
|
contentTitle = getString(R.string.newAlarm) + vehName;
|
|
|
|
|
tickerText = "SafeMobile Dispatch: " + getString(R.string.newAlarm) + vehName;
|
|
|
|
|
icon = R.drawable.alert;
|
|
|
|
@ -2197,7 +2215,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
private Vehicle getVehicle4Imei(String imei)
|
|
|
|
|
{
|
|
|
|
|
Vehicle veh = null;
|
|
|
|
|
for(Vehicle vehicle: allVehicle)
|
|
|
|
|
for(Vehicle vehicle: getAllVehicle())
|
|
|
|
|
//SM.Debug("Vehicle name:"+vehicle.name+" IMEI:"+vehicle.imei);
|
|
|
|
|
if(vehicle.imei.equals(imei))
|
|
|
|
|
veh = vehicle;
|
|
|
|
@ -2254,20 +2272,20 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public double best_zoom(double LATMAX,double LATmin,double LNGMAX,double LNGmin)
|
|
|
|
|
public double best_zoom(double latMax, double latMin, double lngMax, double lngMin)
|
|
|
|
|
{
|
|
|
|
|
double height =400;
|
|
|
|
|
double width =400;
|
|
|
|
|
double dlat = Math.abs(LATMAX - LATmin);
|
|
|
|
|
double dlon = Math.abs(LNGMAX - LNGmin);
|
|
|
|
|
double dlat = Math.abs(latMax - latMin);
|
|
|
|
|
double dlon = Math.abs(lngMax - lngMin);
|
|
|
|
|
if(dlat == 0 && dlon == 0)
|
|
|
|
|
{
|
|
|
|
|
if ((LATMAX==LATmin)&&(LATMAX==0)&&(LNGMAX==LNGmin)&&(LNGMAX==0)) return 2;
|
|
|
|
|
if ((latMax == latMin)&&(latMax ==0)&&(lngMax == lngMin)&&(lngMax ==0)) return 2;
|
|
|
|
|
//return 17;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Center latitude in radians
|
|
|
|
|
double clat = Math.PI*(LATmin + LATMAX)/360.;
|
|
|
|
|
double clat = Math.PI*(latMin + latMax)/360.;
|
|
|
|
|
|
|
|
|
|
double C = 0.0000107288;
|
|
|
|
|
double z0 = Math.ceil(Math.log(dlat/(C*height))/0.693);
|
|
|
|
@ -2507,7 +2525,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
{
|
|
|
|
|
Long.parseLong(params[2]);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
catch (Exception ignored) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
getRecentSMSs(Integer.parseInt(params[1]), Long.parseLong(params[2]));
|
|
|
|
@ -2530,7 +2548,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OperationCodes.SendAlarmAcknoledge:
|
|
|
|
|
sendAlarmAcknoledge(Integer.parseInt(params[1]), Integer.parseInt(params[2]));
|
|
|
|
|
sendAlarmAcknowledge(Integer.parseInt(params[1]), Integer.parseInt(params[2]));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OperationCodes.GetHistoryPositions:
|
|
|
|
|