#SD-199 - rework SDMobileActivity and check live messages
This commit is contained in:
parent
4ee6b53d97
commit
6cfdb7c221
2
.gitignore
vendored
2
.gitignore
vendored
@ -184,5 +184,3 @@ $RECYCLE.BIN/
|
||||
/.idea/misc.xml
|
||||
/.idea
|
||||
/.idea/modules.xml
|
||||
/.idea/gradle.xml
|
||||
/.idea/misc.xml
|
||||
|
@ -1,9 +1,8 @@
|
||||
package com.safemobile.activities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import android.app.TabActivity;
|
||||
import android.content.BroadcastReceiver;
|
||||
|
||||
import com.safemobile.bluetooth.BluetoothTether;
|
||||
import com.safemobile.lib.AppParams;
|
||||
import com.safemobile.lib.SM;
|
||||
import com.safemobile.lib.SuperVehicle;
|
||||
@ -11,43 +10,21 @@ import com.safemobile.lib.Vehicle;
|
||||
import com.safemobile.services.TCPhandler;
|
||||
import com.safemobile.services.TCPmsgParser;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.TabActivity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class AbstractSDParentActivity extends TabActivity {
|
||||
|
||||
/** UI Elements */
|
||||
public RelativeLayout layoutLoading;
|
||||
public ImageView imageViewLoading;
|
||||
|
||||
|
||||
/** Misc */
|
||||
public Activity activity;
|
||||
public Context context;
|
||||
public NotificationManager mNotificationManager;
|
||||
public boolean displayLogCat = true; // show logCat messages when TCP send was successful
|
||||
public String imei, mess;
|
||||
private static final boolean SHOULD_DISPLAY_LOGCAT = true; // show logCat messages when TCP send was successful
|
||||
private String imei;
|
||||
private String mess;
|
||||
public int demoPosition = 0;
|
||||
|
||||
/** Lists */
|
||||
public ArrayList<Vehicle> allVehicle = new ArrayList<Vehicle>();
|
||||
public Hashtable<Long, SuperVehicle> SuperVehHash = new Hashtable<Long, SuperVehicle>();
|
||||
public Hashtable<Long, Vehicle> VehHashbySc_id = new Hashtable<Long, Vehicle>();
|
||||
|
||||
/** Handler */
|
||||
public Handler myHandler = new Handler();
|
||||
|
||||
/** BlueTooth Tether */
|
||||
public BluetoothTether bluetoothTether = null;
|
||||
|
||||
/** Broadcast Receiver */
|
||||
public BroadcastReceiver mReceiver = null;
|
||||
private ArrayList<Vehicle> allVehicle = new ArrayList<>();
|
||||
private Hashtable<Long, SuperVehicle> superVehHash = new Hashtable<>();
|
||||
private Hashtable<Long, Vehicle> vehHashByScId = new Hashtable<>();
|
||||
|
||||
/** TCP */
|
||||
protected TCPhandler tcp = null;
|
||||
@ -66,9 +43,9 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
||||
public Object getTCPState() {
|
||||
// return true if tcp connection is on, false if not connected and null
|
||||
|
||||
if(tcp!=null && tcp.isConnectionUP)
|
||||
if (tcp != null && tcp.isConnectionUP)
|
||||
return "true";
|
||||
else if(tcp!=null && !tcp.isConnectionUP)
|
||||
else if (tcp != null)
|
||||
return "false";
|
||||
return null;
|
||||
}
|
||||
@ -84,83 +61,78 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
||||
|
||||
public abstract void updateDemoPosition();
|
||||
public abstract void updateResultsPollInUi(String type);
|
||||
public abstract double best_zoom(double LATMAX,double LATmin,double LNGMAX,double LNGmin);
|
||||
public abstract double best_zoom(double latMax,double latMin,double lngMax,double lngMin);
|
||||
|
||||
/* SafeDispatch Mobile functions */
|
||||
/** get Vehicles for an user id */
|
||||
public boolean getVehicles(int userID)
|
||||
{
|
||||
if(tcp == null)
|
||||
public boolean getVehicles(int userID) {
|
||||
if (tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#21#" + AppParams.USERID + "#");
|
||||
if(res && displayLogCat)
|
||||
|
||||
boolean res = tcp.Write("0.0", "#21#" + userID + "#");
|
||||
if (res && SHOULD_DISPLAY_LOGCAT)
|
||||
SM.Debug("Message (getVehs) sent to app server");
|
||||
else
|
||||
SM.Debug("Could not send message(getVehs)!!");
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/** get vehicles Last Positions for an user id */
|
||||
public boolean getLastPositions(int userID)
|
||||
{
|
||||
if(tcp == null)
|
||||
public boolean getLastPositions(int userID) {
|
||||
if (tcp == null)
|
||||
return false;
|
||||
|
||||
|
||||
boolean res = tcp.Write("0.0", "#25#" + userID + "#");
|
||||
if(res && displayLogCat)
|
||||
if (res && SHOULD_DISPLAY_LOGCAT)
|
||||
SM.Debug("Message (getLastPOS) sent to app server");
|
||||
else
|
||||
SM.Debug("Could not send message(getLastSMS)!!");
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/** set Enable/Disable a vehicle */
|
||||
public boolean setVehicleStatus(int radioCode, int opCode, int sc_id, int enable)
|
||||
{
|
||||
if(tcp == null)
|
||||
public boolean setVehicleStatus(int radioCode, int opCode, int sc_id, int enable) {
|
||||
if (tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#"+radioCode+"#"+opCode+"#" + sc_id+"#" + enable + "#");
|
||||
if(res && displayLogCat)
|
||||
SM.Debug("Message (Option4Unit) sent to app server radioCode:"+radioCode+ " opCode:"+opCode+ " sc_id:"+sc_id+ " value:" + enable);
|
||||
|
||||
boolean res = tcp.Write("0.0", "#" + radioCode + "#" + opCode + "#" + sc_id + "#" + enable + "#");
|
||||
if (res && SHOULD_DISPLAY_LOGCAT)
|
||||
SM.Debug("Message (Option4Unit) sent to app server radioCode:" + radioCode + " opCode:" + opCode + " sc_id:" + sc_id + " value:" + enable);
|
||||
else
|
||||
SM.Debug("Could not send message(Option4Unit)!!");
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/** get Last SMSs for an user */
|
||||
public boolean getLastSMSs(int userID)
|
||||
{
|
||||
if(tcp == null)
|
||||
public boolean getLastSMSs(int userID) {
|
||||
if (tcp == null)
|
||||
return false;
|
||||
|
||||
|
||||
boolean res = tcp.Write("0.0", "#23#" + userID + "#");
|
||||
if(res && displayLogCat)
|
||||
if (res && SHOULD_DISPLAY_LOGCAT)
|
||||
SM.Debug("#Send Request#", "Message [getLastSMSs] sent to app server");
|
||||
else
|
||||
SM.Debug("#Send Request#", "Could not send message [getLastSMSs]!!");
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/** get SMSs for an user that are recent than timeGMT
|
||||
* @param sc_id the vehicle imei for which we want the SMSs
|
||||
* @param timeGMT the unix time for the last message in the grid or messages that are newer than this time */
|
||||
public boolean getRecentSMSs(int sc_id, long timeGMT)
|
||||
{
|
||||
if(tcp == null)
|
||||
public boolean getRecentSMSs(int sc_id, long timeGMT) {
|
||||
if (tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#22#"+sc_id+"#" +timeGMT+"#");
|
||||
if(res && displayLogCat)
|
||||
|
||||
boolean res = tcp.Write("0.0", "#22#" + sc_id + "#" + timeGMT + "#");
|
||||
if (res && SHOULD_DISPLAY_LOGCAT)
|
||||
SM.Debug("#Send Request#", "Message [getRecentSMSs] sent to app server");
|
||||
else
|
||||
SM.Debug("#Send Request#", "Could not send message [getRecentSMSs]!!");
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -174,7 +146,7 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write(seqID, "#24#" + AppParams.USERID + "#" + sc_id + "#" + txt + "#");
|
||||
if(res && displayLogCat)
|
||||
if(res && SHOULD_DISPLAY_LOGCAT)
|
||||
SM.Debug("Message [sendSMS] sent to app server sc_id:"+sc_id+ " txt:"+txt);
|
||||
else
|
||||
SM.Debug("Could not send message [sendSMS]!!");
|
||||
@ -183,16 +155,16 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
||||
}
|
||||
|
||||
|
||||
public boolean sendAlarmAcknoledge(int alarm_id, int type)
|
||||
public boolean sendAlarmAcknowledge(int alarm_id, int type)
|
||||
{
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#28#" + alarm_id + "#" + type + "#");
|
||||
if(res)
|
||||
SM.Debug("Message [sendAlarmAcknoledge] sent to app server alarm_id:" + alarm_id + " type:" + type);
|
||||
SM.Debug("Message [sendAlarmAcknowledge] sent to app server alarm_id:" + alarm_id + " type:" + type);
|
||||
else
|
||||
SM.Debug("Could not send message [sendAlarmAcknoledge]!!");
|
||||
SM.Debug("Could not send message [sendAlarmAcknowledge]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -290,7 +262,7 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#27#" + userID + "#"); // = tcp.Write("0.0", "#30#99#" + gwID + "#" + rgwID + "#");
|
||||
boolean res = tcp.Write("0.0", "#27#" + userID + "#");
|
||||
if(res)
|
||||
SM.Debug("Message [GetAlarms] sent to app server");
|
||||
else
|
||||
@ -313,11 +285,45 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//public abstract void getVehiclePosition(long imei);
|
||||
/*
|
||||
public abstract void onResume();
|
||||
public abstract void onStart();
|
||||
public abstract void onPause();
|
||||
*/
|
||||
|
||||
public String getImei() {
|
||||
return imei;
|
||||
}
|
||||
|
||||
public void setImei(String imei) {
|
||||
this.imei = imei;
|
||||
}
|
||||
|
||||
public String getMess() {
|
||||
return mess;
|
||||
}
|
||||
|
||||
public void setMess(String mess) {
|
||||
this.mess = mess;
|
||||
}
|
||||
|
||||
/** Lists */
|
||||
public ArrayList<Vehicle> getAllVehicle() {
|
||||
return allVehicle;
|
||||
}
|
||||
|
||||
public void setAllVehicle(ArrayList<Vehicle> allVehicle) {
|
||||
this.allVehicle = allVehicle;
|
||||
}
|
||||
|
||||
public Hashtable<Long, SuperVehicle> getSuperVehHash() {
|
||||
return superVehHash;
|
||||
}
|
||||
|
||||
public void setSuperVehHash(Hashtable<Long, SuperVehicle> superVehHash) {
|
||||
this.superVehHash = superVehHash;
|
||||
}
|
||||
|
||||
public Hashtable<Long, Vehicle> getVehHashByScId() {
|
||||
return vehHashByScId;
|
||||
}
|
||||
|
||||
public void setVehHashByScId(Hashtable<Long, Vehicle> vehHashByScId) {
|
||||
this.vehHashByScId = vehHashByScId;
|
||||
}
|
||||
}
|
||||
|
@ -167,11 +167,11 @@ public class AlarmActivity extends Activity {
|
||||
{
|
||||
acknowledged.add((alarm.ack == 1)? true: false);
|
||||
SM.Debug("ALARM", "SC_ID> " + alarm.sc_id + " | "
|
||||
+ (parentTab.VehHashbySc_id.get(alarm.sc_id) == null ? "null" : parentTab.VehHashbySc_id.get(alarm.sc_id).name ));
|
||||
+ (parentTab.getVehHashByScId().get(alarm.sc_id) == null ? "null" : parentTab.getVehHashByScId().get(alarm.sc_id).name ));
|
||||
|
||||
|
||||
if (parentTab.VehHashbySc_id.get(alarm.sc_id)!=null)
|
||||
alarm.unitName = parentTab.VehHashbySc_id.get(alarm.sc_id).name;
|
||||
if (parentTab.getVehHashByScId().get(alarm.sc_id)!=null)
|
||||
alarm.unitName = parentTab.getVehHashByScId().get(alarm.sc_id).name;
|
||||
|
||||
|
||||
|
||||
@ -254,6 +254,6 @@ public class AlarmActivity extends Activity {
|
||||
private void setACK(int idx, int type)
|
||||
{
|
||||
parentTab.executeNetworkStuff(new String[]{OperationCodes.SendAlarmAcknoledge +"", idx + "", type + ""});
|
||||
//parentTab.sendAlarmAcknoledge(idx, type);
|
||||
//parentTab.sendAlarmAcknowledge(idx, type);
|
||||
}
|
||||
}
|
||||
|
@ -167,12 +167,12 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
||||
|
||||
if (AppParams.DEMO) {
|
||||
disabledVehicles = new ArrayList<>();
|
||||
for (Vehicle veh : getParentTab().allVehicle)
|
||||
for (Vehicle veh : getParentTab().getAllVehicle())
|
||||
disabledVehicles.add(!veh.status);
|
||||
}
|
||||
|
||||
|
||||
adapter = new VehiclesGridViewAdapter(activity, context, getParentTab().allVehicle, disabledVehicles);
|
||||
adapter = new VehiclesGridViewAdapter(activity, context, getParentTab().getAllVehicle(), disabledVehicles);
|
||||
adapter.notifyDataSetChanged();
|
||||
gridVehicle.setAdapter(adapter);
|
||||
|
||||
@ -221,9 +221,9 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
||||
else
|
||||
viewLive.imgViewChecked.setImageResource(R.drawable.unchecked);
|
||||
|
||||
Enumeration<Long> keyList = getParentTab().SuperVehHash.keys();
|
||||
Enumeration<Long> keyList = getParentTab().getSuperVehHash().keys();
|
||||
while (keyList.hasMoreElements()) {
|
||||
(Objects.requireNonNull(getParentTab().SuperVehHash.get((long) keyList.nextElement()))).needUpdate = true;
|
||||
(Objects.requireNonNull(getParentTab().getSuperVehHash().get((long) keyList.nextElement()))).needUpdate = true;
|
||||
}
|
||||
|
||||
// change button title
|
||||
@ -257,9 +257,9 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
||||
for (int i = 0; i < displayedVehicles.size(); i++)
|
||||
displayedVehicles.set(i, true);
|
||||
|
||||
Enumeration<Long> keyList = getParentTab().SuperVehHash.keys();
|
||||
Enumeration<Long> keyList = getParentTab().getSuperVehHash().keys();
|
||||
while (keyList.hasMoreElements())
|
||||
(Objects.requireNonNull(getParentTab().SuperVehHash.get((long) keyList.nextElement()))).needUpdate = true;
|
||||
(Objects.requireNonNull(getParentTab().getSuperVehHash().get((long) keyList.nextElement()))).needUpdate = true;
|
||||
|
||||
// change button title
|
||||
if (displayButton.getText().toString().equals(getString(R.string.displayAll))) {
|
||||
@ -419,7 +419,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
||||
// send change to AppServer
|
||||
optionForUnit(radioCode, MENU_POLL, liveVehicle.get(contextMenuPosition).id + "");
|
||||
if (AppParams.DEMO) {
|
||||
getParentTab().imei = liveVehicle.get(contextMenuPosition).sc_id + "";
|
||||
getParentTab().setImei(liveVehicle.get(contextMenuPosition).sc_id + "");
|
||||
getParentTab().updateDemoPosition();
|
||||
getParentTab().updateResultsPollInUi("realpha");
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ public class MessagesActivity extends Activity {
|
||||
// Create runnable for posting
|
||||
final Runnable demoReceveidSMSRUN = new Runnable() {
|
||||
public void run() {
|
||||
parentTab.imei = sc_id + "";
|
||||
parentTab.setImei(sc_id + "");
|
||||
parentTab.updateResultsInUi("realpha");
|
||||
|
||||
int timeGMT = (int) (System.currentTimeMillis() / 1000L);
|
||||
@ -354,7 +354,7 @@ public class MessagesActivity extends Activity {
|
||||
if(parentTab.getTCPState() != null){
|
||||
if(FIRST)
|
||||
{
|
||||
UpdateVehs(parentTab.allVehicle);
|
||||
UpdateVehs(parentTab.getAllVehicle());
|
||||
FIRST = false;
|
||||
if(LASTMESSAGES)
|
||||
parentTab.executeNetworkStuff(new String[] {OperationCodes.GetLastSMS + "", AppParams.USERID + ""});
|
||||
@ -704,7 +704,7 @@ public class MessagesActivity extends Activity {
|
||||
private void updateResultsInUi()
|
||||
{
|
||||
if(allVehicle == null)
|
||||
UpdateVehs(parentTab.allVehicle);
|
||||
UpdateVehs(parentTab.getAllVehicle());
|
||||
|
||||
//SM.Debug("updateResultsInUi: " + ACTION);
|
||||
if(ACTION == MSGUpdate)
|
||||
|
@ -280,9 +280,9 @@ public class RadioActivity extends Activity {
|
||||
{
|
||||
super.onResume();
|
||||
// get all vehicles from TabLayoutActivity
|
||||
if(!allVehicle.equals(parentTab.allVehicle))
|
||||
if(!allVehicle.equals(parentTab.getAllVehicle()))
|
||||
{
|
||||
allVehicle = parentTab.allVehicle;
|
||||
allVehicle = parentTab.getAllVehicle();
|
||||
UpdateVehicle();
|
||||
}
|
||||
/*
|
||||
@ -908,7 +908,7 @@ public class RadioActivity extends Activity {
|
||||
radioAll.setChecked(false);
|
||||
radioGroup.setChecked(false);
|
||||
selectedCallType = PRIVATECall;
|
||||
textViewCallType.setText(parentTab.SuperVehHash.get((long)imei).name);
|
||||
textViewCallType.setText(parentTab.getSuperVehHash().get((long)imei).name);
|
||||
layoutSpinnerCallType.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else if (calltype==103)
|
||||
@ -936,8 +936,8 @@ public class RadioActivity extends Activity {
|
||||
}
|
||||
if (callstatus==1)
|
||||
{
|
||||
if (parentTab.SuperVehHash.get((long)imei)!=null)
|
||||
textViewMessageStatus.setText(parentTab.SuperVehHash.get((long)imei).name);
|
||||
if (parentTab.getSuperVehHash().get((long)imei)!=null)
|
||||
textViewMessageStatus.setText(parentTab.getSuperVehHash().get((long)imei).name);
|
||||
else
|
||||
textViewMessageStatus.setText("Imei: "+Long.toString(imei));
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,6 @@ import java.util.Locale;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/** fix import */
|
||||
import com.safemobile.activities.AbstractEmptyActivity;
|
||||
import com.safemobile.activities.AbstractLiveActivity;
|
||||
import com.safemobile.activities.AbstractMessagesActivity;
|
||||
@ -200,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>();
|
||||
@ -219,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)
|
||||
@ -243,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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -254,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);
|
||||
@ -422,7 +420,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
||||
|
||||
if(AppParams.DEMO && messageActivity.allVehicle.size()== 0)
|
||||
{
|
||||
messageActivity.UpdateVehs(allVehicle);
|
||||
messageActivity.UpdateVehs(getAllVehicle());
|
||||
messageActivity.UpdateSMS(listSMS);
|
||||
}
|
||||
}
|
||||
@ -453,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();
|
||||
}
|
||||
}
|
||||
@ -751,7 +749,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
||||
|
||||
if(AppParams.DEMO && liveActivity != null)
|
||||
{
|
||||
liveActivity.vehiclesReceived(allVehicle);
|
||||
liveActivity.vehiclesReceived(getAllVehicle());
|
||||
demoPositionsList();
|
||||
}
|
||||
|
||||
@ -826,7 +824,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();
|
||||
|
||||
@ -1055,14 +1053,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();
|
||||
}
|
||||
}
|
||||
@ -1075,9 +1073,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();
|
||||
}
|
||||
|
||||
@ -1143,7 +1141,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);
|
||||
@ -1237,11 +1235,11 @@ 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)
|
||||
if(getSuperVehHash().get(GPSPos.gpsValue.imei) != null)
|
||||
{
|
||||
((SuperVehicle)SuperVehHash.get(GPSPos.gpsValue.imei)).SetNewPosition(GPSPos.gpsValue.lat, GPSPos.gpsValue.lng, GPSPos.gpsValue.timeGMT, GPSPos.gpsValue.speed);
|
||||
((SuperVehicle) getSuperVehHash().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(getSuperVehHash().get(GPSPos.gpsValue.imei).needUpdate)
|
||||
{
|
||||
|
||||
//list for live
|
||||
@ -1269,23 +1267,23 @@ 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)
|
||||
if(getSuperVehHash().get(GPSPos.gpsValue.imei) != null)
|
||||
{
|
||||
((SuperVehicle)SuperVehHash.get(GPSPos.gpsValue.imei)).SetNewPosition(GPSPos.gpsValue.lat, GPSPos.gpsValue.lng, GPSPos.gpsValue.timeGMT, GPSPos.gpsValue.speed);
|
||||
((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)
|
||||
if (!getSuperVehHash().get(GPSPos.gpsValue.imei).needUpdate)
|
||||
{
|
||||
SuperVehHash.get(GPSPos.gpsValue.imei).needUpdate =true;
|
||||
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
|
||||
@ -1298,7 +1296,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++;
|
||||
@ -1307,7 +1305,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);
|
||||
@ -1360,10 +1358,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)
|
||||
{
|
||||
@ -1386,7 +1384,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
||||
if(messageActivity != null)
|
||||
messageActivity.UpdateVehs(vMSG.vehList);
|
||||
}
|
||||
allVehicle = vMSG.vehList;
|
||||
setAllVehicle(vMSG.vehList);
|
||||
}
|
||||
|
||||
public void onLastSMSsReceived(TCPEvent event) {
|
||||
@ -1459,8 +1457,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
|
||||
@ -1532,8 +1530,8 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
||||
//SM.Debug("Got LastPost msg.data:" + msg.data);
|
||||
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);
|
||||
if(getSuperVehHash().get(posMsg.imei) != null)
|
||||
((SuperVehicle) getSuperVehHash().get(posMsg.imei)).SetDataFromLastPos(posMsg.lat, posMsg.lng, posMsg.timeGMT, posMsg.speed, posMsg.Address, posMsg.isON);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1890,33 +1888,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
|
||||
@ -1924,7 +1922,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++;
|
||||
@ -1933,10 +1931,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)
|
||||
@ -1963,8 +1961,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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2045,10 +2043,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);
|
||||
|
||||
@ -2085,7 +2083,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)
|
||||
@ -2094,7 +2092,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);
|
||||
|
||||
@ -2111,7 +2109,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);
|
||||
/*
|
||||
@ -2143,8 +2141,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);
|
||||
|
||||
@ -2157,11 +2155,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);
|
||||
@ -2181,31 +2179,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;
|
||||
@ -2240,7 +2238,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;
|
||||
@ -2297,20 +2295,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);
|
||||
@ -2550,7 +2548,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]));
|
||||
@ -2573,7 +2571,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:
|
||||
|
@ -1,21 +1,16 @@
|
||||
package com.safemobile.lib.sound;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import com.safemobile.lib.SM;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.safemobile.lib.SM;
|
||||
import com.safemobile.lib.TCPmsg;
|
||||
|
||||
public class TCPaudioClient implements Runnable{
|
||||
private boolean alive = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user