#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/misc.xml
|
||||||
/.idea
|
/.idea
|
||||||
/.idea/modules.xml
|
/.idea/modules.xml
|
||||||
/.idea/gradle.xml
|
|
||||||
/.idea/misc.xml
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package com.safemobile.activities;
|
package com.safemobile.activities;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import android.app.TabActivity;
|
||||||
import java.util.Hashtable;
|
import android.content.BroadcastReceiver;
|
||||||
|
|
||||||
import com.safemobile.bluetooth.BluetoothTether;
|
|
||||||
import com.safemobile.lib.AppParams;
|
import com.safemobile.lib.AppParams;
|
||||||
import com.safemobile.lib.SM;
|
import com.safemobile.lib.SM;
|
||||||
import com.safemobile.lib.SuperVehicle;
|
import com.safemobile.lib.SuperVehicle;
|
||||||
@ -11,43 +10,21 @@ import com.safemobile.lib.Vehicle;
|
|||||||
import com.safemobile.services.TCPhandler;
|
import com.safemobile.services.TCPhandler;
|
||||||
import com.safemobile.services.TCPmsgParser;
|
import com.safemobile.services.TCPmsgParser;
|
||||||
|
|
||||||
import android.app.Activity;
|
import java.util.ArrayList;
|
||||||
import android.app.NotificationManager;
|
import java.util.Hashtable;
|
||||||
import android.app.TabActivity;
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public abstract class AbstractSDParentActivity extends TabActivity {
|
public abstract class AbstractSDParentActivity extends TabActivity {
|
||||||
|
|
||||||
/** UI Elements */
|
|
||||||
public RelativeLayout layoutLoading;
|
|
||||||
public ImageView imageViewLoading;
|
|
||||||
|
|
||||||
/** Misc */
|
/** Misc */
|
||||||
public Activity activity;
|
private static final boolean SHOULD_DISPLAY_LOGCAT = true; // show logCat messages when TCP send was successful
|
||||||
public Context context;
|
private String imei;
|
||||||
public NotificationManager mNotificationManager;
|
private String mess;
|
||||||
public boolean displayLogCat = true; // show logCat messages when TCP send was successful
|
|
||||||
public String imei, mess;
|
|
||||||
public int demoPosition = 0;
|
public int demoPosition = 0;
|
||||||
|
|
||||||
/** Lists */
|
private ArrayList<Vehicle> allVehicle = new ArrayList<>();
|
||||||
public ArrayList<Vehicle> allVehicle = new ArrayList<Vehicle>();
|
private Hashtable<Long, SuperVehicle> superVehHash = new Hashtable<>();
|
||||||
public Hashtable<Long, SuperVehicle> SuperVehHash = new Hashtable<Long, SuperVehicle>();
|
private Hashtable<Long, Vehicle> vehHashByScId = new Hashtable<>();
|
||||||
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;
|
|
||||||
|
|
||||||
/** TCP */
|
/** TCP */
|
||||||
protected TCPhandler tcp = null;
|
protected TCPhandler tcp = null;
|
||||||
@ -66,9 +43,9 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
|||||||
public Object getTCPState() {
|
public Object getTCPState() {
|
||||||
// return true if tcp connection is on, false if not connected and null
|
// 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";
|
return "true";
|
||||||
else if(tcp!=null && !tcp.isConnectionUP)
|
else if (tcp != null)
|
||||||
return "false";
|
return "false";
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -84,17 +61,16 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
|||||||
|
|
||||||
public abstract void updateDemoPosition();
|
public abstract void updateDemoPosition();
|
||||||
public abstract void updateResultsPollInUi(String type);
|
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 */
|
/* SafeDispatch Mobile functions */
|
||||||
/** get Vehicles for an user id */
|
/** get Vehicles for an user id */
|
||||||
public boolean getVehicles(int userID)
|
public boolean getVehicles(int userID) {
|
||||||
{
|
if (tcp == null)
|
||||||
if(tcp == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean res = tcp.Write("0.0", "#21#" + AppParams.USERID + "#");
|
boolean res = tcp.Write("0.0", "#21#" + userID + "#");
|
||||||
if(res && displayLogCat)
|
if (res && SHOULD_DISPLAY_LOGCAT)
|
||||||
SM.Debug("Message (getVehs) sent to app server");
|
SM.Debug("Message (getVehs) sent to app server");
|
||||||
else
|
else
|
||||||
SM.Debug("Could not send message(getVehs)!!");
|
SM.Debug("Could not send message(getVehs)!!");
|
||||||
@ -103,13 +79,12 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** get vehicles Last Positions for an user id */
|
/** get vehicles Last Positions for an user id */
|
||||||
public boolean getLastPositions(int userID)
|
public boolean getLastPositions(int userID) {
|
||||||
{
|
if (tcp == null)
|
||||||
if(tcp == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean res = tcp.Write("0.0", "#25#" + userID + "#");
|
boolean res = tcp.Write("0.0", "#25#" + userID + "#");
|
||||||
if(res && displayLogCat)
|
if (res && SHOULD_DISPLAY_LOGCAT)
|
||||||
SM.Debug("Message (getLastPOS) sent to app server");
|
SM.Debug("Message (getLastPOS) sent to app server");
|
||||||
else
|
else
|
||||||
SM.Debug("Could not send message(getLastSMS)!!");
|
SM.Debug("Could not send message(getLastSMS)!!");
|
||||||
@ -118,14 +93,13 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** set Enable/Disable a vehicle */
|
/** set Enable/Disable a vehicle */
|
||||||
public boolean setVehicleStatus(int radioCode, int opCode, int sc_id, int enable)
|
public boolean setVehicleStatus(int radioCode, int opCode, int sc_id, int enable) {
|
||||||
{
|
if (tcp == null)
|
||||||
if(tcp == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean res = tcp.Write("0.0", "#"+radioCode+"#"+opCode+"#" + sc_id+"#" + enable + "#");
|
boolean res = tcp.Write("0.0", "#" + radioCode + "#" + opCode + "#" + sc_id + "#" + enable + "#");
|
||||||
if(res && displayLogCat)
|
if (res && SHOULD_DISPLAY_LOGCAT)
|
||||||
SM.Debug("Message (Option4Unit) sent to app server radioCode:"+radioCode+ " opCode:"+opCode+ " sc_id:"+sc_id+ " value:" + enable);
|
SM.Debug("Message (Option4Unit) sent to app server radioCode:" + radioCode + " opCode:" + opCode + " sc_id:" + sc_id + " value:" + enable);
|
||||||
else
|
else
|
||||||
SM.Debug("Could not send message(Option4Unit)!!");
|
SM.Debug("Could not send message(Option4Unit)!!");
|
||||||
|
|
||||||
@ -133,13 +107,12 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** get Last SMSs for an user */
|
/** get Last SMSs for an user */
|
||||||
public boolean getLastSMSs(int userID)
|
public boolean getLastSMSs(int userID) {
|
||||||
{
|
if (tcp == null)
|
||||||
if(tcp == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean res = tcp.Write("0.0", "#23#" + userID + "#");
|
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");
|
SM.Debug("#Send Request#", "Message [getLastSMSs] sent to app server");
|
||||||
else
|
else
|
||||||
SM.Debug("#Send Request#", "Could not send message [getLastSMSs]!!");
|
SM.Debug("#Send Request#", "Could not send message [getLastSMSs]!!");
|
||||||
@ -150,13 +123,12 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
|||||||
/** get SMSs for an user that are recent than timeGMT
|
/** get SMSs for an user that are recent than timeGMT
|
||||||
* @param sc_id the vehicle imei for which we want the SMSs
|
* @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 */
|
* @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)
|
public boolean getRecentSMSs(int sc_id, long timeGMT) {
|
||||||
{
|
if (tcp == null)
|
||||||
if(tcp == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean res = tcp.Write("0.0", "#22#"+sc_id+"#" +timeGMT+"#");
|
boolean res = tcp.Write("0.0", "#22#" + sc_id + "#" + timeGMT + "#");
|
||||||
if(res && displayLogCat)
|
if (res && SHOULD_DISPLAY_LOGCAT)
|
||||||
SM.Debug("#Send Request#", "Message [getRecentSMSs] sent to app server");
|
SM.Debug("#Send Request#", "Message [getRecentSMSs] sent to app server");
|
||||||
else
|
else
|
||||||
SM.Debug("#Send Request#", "Could not send message [getRecentSMSs]!!");
|
SM.Debug("#Send Request#", "Could not send message [getRecentSMSs]!!");
|
||||||
@ -174,7 +146,7 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean res = tcp.Write(seqID, "#24#" + AppParams.USERID + "#" + sc_id + "#" + txt + "#");
|
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);
|
SM.Debug("Message [sendSMS] sent to app server sc_id:"+sc_id+ " txt:"+txt);
|
||||||
else
|
else
|
||||||
SM.Debug("Could not send message [sendSMS]!!");
|
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)
|
if(tcp == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean res = tcp.Write("0.0", "#28#" + alarm_id + "#" + type + "#");
|
boolean res = tcp.Write("0.0", "#28#" + alarm_id + "#" + type + "#");
|
||||||
if(res)
|
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
|
else
|
||||||
SM.Debug("Could not send message [sendAlarmAcknoledge]!!");
|
SM.Debug("Could not send message [sendAlarmAcknowledge]!!");
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -290,7 +262,7 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
|||||||
if(tcp == null)
|
if(tcp == null)
|
||||||
return false;
|
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)
|
if(res)
|
||||||
SM.Debug("Message [GetAlarms] sent to app server");
|
SM.Debug("Message [GetAlarms] sent to app server");
|
||||||
else
|
else
|
||||||
@ -314,10 +286,44 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
//public abstract void getVehiclePosition(long imei);
|
public String getImei() {
|
||||||
/*
|
return imei;
|
||||||
public abstract void onResume();
|
}
|
||||||
public abstract void onStart();
|
|
||||||
public abstract void onPause();
|
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);
|
acknowledged.add((alarm.ack == 1)? true: false);
|
||||||
SM.Debug("ALARM", "SC_ID> " + alarm.sc_id + " | "
|
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)
|
if (parentTab.getVehHashByScId().get(alarm.sc_id)!=null)
|
||||||
alarm.unitName = parentTab.VehHashbySc_id.get(alarm.sc_id).name;
|
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)
|
private void setACK(int idx, int type)
|
||||||
{
|
{
|
||||||
parentTab.executeNetworkStuff(new String[]{OperationCodes.SendAlarmAcknoledge +"", idx + "", 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) {
|
if (AppParams.DEMO) {
|
||||||
disabledVehicles = new ArrayList<>();
|
disabledVehicles = new ArrayList<>();
|
||||||
for (Vehicle veh : getParentTab().allVehicle)
|
for (Vehicle veh : getParentTab().getAllVehicle())
|
||||||
disabledVehicles.add(!veh.status);
|
disabledVehicles.add(!veh.status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
adapter = new VehiclesGridViewAdapter(activity, context, getParentTab().allVehicle, disabledVehicles);
|
adapter = new VehiclesGridViewAdapter(activity, context, getParentTab().getAllVehicle(), disabledVehicles);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
gridVehicle.setAdapter(adapter);
|
gridVehicle.setAdapter(adapter);
|
||||||
|
|
||||||
@ -221,9 +221,9 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
else
|
else
|
||||||
viewLive.imgViewChecked.setImageResource(R.drawable.unchecked);
|
viewLive.imgViewChecked.setImageResource(R.drawable.unchecked);
|
||||||
|
|
||||||
Enumeration<Long> keyList = getParentTab().SuperVehHash.keys();
|
Enumeration<Long> keyList = getParentTab().getSuperVehHash().keys();
|
||||||
while (keyList.hasMoreElements()) {
|
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
|
// change button title
|
||||||
@ -257,9 +257,9 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
for (int i = 0; i < displayedVehicles.size(); i++)
|
for (int i = 0; i < displayedVehicles.size(); i++)
|
||||||
displayedVehicles.set(i, true);
|
displayedVehicles.set(i, true);
|
||||||
|
|
||||||
Enumeration<Long> keyList = getParentTab().SuperVehHash.keys();
|
Enumeration<Long> keyList = getParentTab().getSuperVehHash().keys();
|
||||||
while (keyList.hasMoreElements())
|
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
|
// change button title
|
||||||
if (displayButton.getText().toString().equals(getString(R.string.displayAll))) {
|
if (displayButton.getText().toString().equals(getString(R.string.displayAll))) {
|
||||||
@ -419,7 +419,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
// send change to AppServer
|
// send change to AppServer
|
||||||
optionForUnit(radioCode, MENU_POLL, liveVehicle.get(contextMenuPosition).id + "");
|
optionForUnit(radioCode, MENU_POLL, liveVehicle.get(contextMenuPosition).id + "");
|
||||||
if (AppParams.DEMO) {
|
if (AppParams.DEMO) {
|
||||||
getParentTab().imei = liveVehicle.get(contextMenuPosition).sc_id + "";
|
getParentTab().setImei(liveVehicle.get(contextMenuPosition).sc_id + "");
|
||||||
getParentTab().updateDemoPosition();
|
getParentTab().updateDemoPosition();
|
||||||
getParentTab().updateResultsPollInUi("realpha");
|
getParentTab().updateResultsPollInUi("realpha");
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ public class MessagesActivity extends Activity {
|
|||||||
// Create runnable for posting
|
// Create runnable for posting
|
||||||
final Runnable demoReceveidSMSRUN = new Runnable() {
|
final Runnable demoReceveidSMSRUN = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
parentTab.imei = sc_id + "";
|
parentTab.setImei(sc_id + "");
|
||||||
parentTab.updateResultsInUi("realpha");
|
parentTab.updateResultsInUi("realpha");
|
||||||
|
|
||||||
int timeGMT = (int) (System.currentTimeMillis() / 1000L);
|
int timeGMT = (int) (System.currentTimeMillis() / 1000L);
|
||||||
@ -354,7 +354,7 @@ public class MessagesActivity extends Activity {
|
|||||||
if(parentTab.getTCPState() != null){
|
if(parentTab.getTCPState() != null){
|
||||||
if(FIRST)
|
if(FIRST)
|
||||||
{
|
{
|
||||||
UpdateVehs(parentTab.allVehicle);
|
UpdateVehs(parentTab.getAllVehicle());
|
||||||
FIRST = false;
|
FIRST = false;
|
||||||
if(LASTMESSAGES)
|
if(LASTMESSAGES)
|
||||||
parentTab.executeNetworkStuff(new String[] {OperationCodes.GetLastSMS + "", AppParams.USERID + ""});
|
parentTab.executeNetworkStuff(new String[] {OperationCodes.GetLastSMS + "", AppParams.USERID + ""});
|
||||||
@ -704,7 +704,7 @@ public class MessagesActivity extends Activity {
|
|||||||
private void updateResultsInUi()
|
private void updateResultsInUi()
|
||||||
{
|
{
|
||||||
if(allVehicle == null)
|
if(allVehicle == null)
|
||||||
UpdateVehs(parentTab.allVehicle);
|
UpdateVehs(parentTab.getAllVehicle());
|
||||||
|
|
||||||
//SM.Debug("updateResultsInUi: " + ACTION);
|
//SM.Debug("updateResultsInUi: " + ACTION);
|
||||||
if(ACTION == MSGUpdate)
|
if(ACTION == MSGUpdate)
|
||||||
|
@ -280,9 +280,9 @@ public class RadioActivity extends Activity {
|
|||||||
{
|
{
|
||||||
super.onResume();
|
super.onResume();
|
||||||
// get all vehicles from TabLayoutActivity
|
// get all vehicles from TabLayoutActivity
|
||||||
if(!allVehicle.equals(parentTab.allVehicle))
|
if(!allVehicle.equals(parentTab.getAllVehicle()))
|
||||||
{
|
{
|
||||||
allVehicle = parentTab.allVehicle;
|
allVehicle = parentTab.getAllVehicle();
|
||||||
UpdateVehicle();
|
UpdateVehicle();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -908,7 +908,7 @@ public class RadioActivity extends Activity {
|
|||||||
radioAll.setChecked(false);
|
radioAll.setChecked(false);
|
||||||
radioGroup.setChecked(false);
|
radioGroup.setChecked(false);
|
||||||
selectedCallType = PRIVATECall;
|
selectedCallType = PRIVATECall;
|
||||||
textViewCallType.setText(parentTab.SuperVehHash.get((long)imei).name);
|
textViewCallType.setText(parentTab.getSuperVehHash().get((long)imei).name);
|
||||||
layoutSpinnerCallType.setVisibility(View.VISIBLE);
|
layoutSpinnerCallType.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
else if (calltype==103)
|
else if (calltype==103)
|
||||||
@ -936,8 +936,8 @@ public class RadioActivity extends Activity {
|
|||||||
}
|
}
|
||||||
if (callstatus==1)
|
if (callstatus==1)
|
||||||
{
|
{
|
||||||
if (parentTab.SuperVehHash.get((long)imei)!=null)
|
if (parentTab.getSuperVehHash().get((long)imei)!=null)
|
||||||
textViewMessageStatus.setText(parentTab.SuperVehHash.get((long)imei).name);
|
textViewMessageStatus.setText(parentTab.getSuperVehHash().get((long)imei).name);
|
||||||
else
|
else
|
||||||
textViewMessageStatus.setText("Imei: "+Long.toString(imei));
|
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.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
/** fix import */
|
|
||||||
import com.safemobile.activities.AbstractEmptyActivity;
|
import com.safemobile.activities.AbstractEmptyActivity;
|
||||||
import com.safemobile.activities.AbstractLiveActivity;
|
import com.safemobile.activities.AbstractLiveActivity;
|
||||||
import com.safemobile.activities.AbstractMessagesActivity;
|
import com.safemobile.activities.AbstractMessagesActivity;
|
||||||
@ -200,16 +199,16 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
|
|
||||||
if(AppParams.DEMO)
|
if(AppParams.DEMO)
|
||||||
{
|
{
|
||||||
allVehicle.add(new Vehicle(101, "101", 101, "101", 101, 101, 101, 0));
|
getAllVehicle().add(new Vehicle(101, "101", 101, "101", 101, 101, 101, 0));
|
||||||
allVehicle.add(new Vehicle(102, "102", 102, "102", 102, 102, 102, 0));
|
getAllVehicle().add(new Vehicle(102, "102", 102, "102", 102, 102, 102, 0));
|
||||||
allVehicle.add(new Vehicle(103, "103", 103, "Ambulance", 78, 103, 103, 0));
|
getAllVehicle().add(new Vehicle(103, "103", 103, "Ambulance", 78, 103, 103, 0));
|
||||||
allVehicle.add(new Vehicle(104, "104", 104, "104", 104, 104, 104, 0));
|
getAllVehicle().add(new Vehicle(104, "104", 104, "104", 104, 104, 104, 0));
|
||||||
allVehicle.add(new Vehicle(105, "105", 105, "Police", 105, 105, 105, 0));
|
getAllVehicle().add(new Vehicle(105, "105", 105, "Police", 105, 105, 105, 0));
|
||||||
allVehicle.add(new Vehicle(106, "106", 106, "Mike", 106, 106, 106, 0));
|
getAllVehicle().add(new Vehicle(106, "106", 106, "Mike", 106, 106, 106, 0));
|
||||||
allVehicle.add(new Vehicle(107, "107", 107, "Rob", 107, 107, 107, 0));
|
getAllVehicle().add(new Vehicle(107, "107", 107, "Rob", 107, 107, 107, 0));
|
||||||
allVehicle.add(new Vehicle(108, "108", 108, "Ben", 108, 108, 108, 0));
|
getAllVehicle().add(new Vehicle(108, "108", 108, "Ben", 108, 108, 108, 0));
|
||||||
allVehicle.add(new Vehicle(109, "109", 109, "Taxi_3", 109, 109, 109, 0));
|
getAllVehicle().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(110, "110", 110, "Pam", 110, 110, 110, 0));
|
||||||
|
|
||||||
|
|
||||||
listSMS = new ArrayList<SMS>();
|
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(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));
|
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);
|
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)
|
if (veh.sc_id == 101)
|
||||||
@ -243,8 +242,8 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
else if (veh.sc_id == 110)
|
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);
|
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);
|
getSuperVehHash().put(Long.valueOf(veh.imei), tmpSuper);
|
||||||
VehHashbySc_id.put(veh.sc_id, veh);
|
getVehHashByScId().put(veh.sc_id, veh);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -254,7 +253,6 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
// do not dim the display
|
// do not dim the display
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
|
||||||
|
|
||||||
// get NewMessage Visual Element
|
// get NewMessage Visual Element
|
||||||
layoutNewMessage = (RelativeLayout) findViewById(R.id.layoutNewMessage);
|
layoutNewMessage = (RelativeLayout) findViewById(R.id.layoutNewMessage);
|
||||||
textViewNMMessage = (TextView) findViewById(R.id.textViewNMMessage);
|
textViewNMMessage = (TextView) findViewById(R.id.textViewNMMessage);
|
||||||
@ -422,7 +420,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
|
|
||||||
if(AppParams.DEMO && messageActivity.allVehicle.size()== 0)
|
if(AppParams.DEMO && messageActivity.allVehicle.size()== 0)
|
||||||
{
|
{
|
||||||
messageActivity.UpdateVehs(allVehicle);
|
messageActivity.UpdateVehs(getAllVehicle());
|
||||||
messageActivity.UpdateSMS(listSMS);
|
messageActivity.UpdateSMS(listSMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -453,7 +451,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
|
|
||||||
if(radioActivity!= null && radioActivity.allVehicle!= null && radioActivity.allVehicle.size()==0)
|
if(radioActivity!= null && radioActivity.allVehicle!= null && radioActivity.allVehicle.size()==0)
|
||||||
{
|
{
|
||||||
radioActivity.allVehicle = allVehicle;
|
radioActivity.allVehicle = getAllVehicle();
|
||||||
radioActivity.UpdateVehicle();
|
radioActivity.UpdateVehicle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -751,7 +749,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
|
|
||||||
if(AppParams.DEMO && liveActivity != null)
|
if(AppParams.DEMO && liveActivity != null)
|
||||||
{
|
{
|
||||||
liveActivity.vehiclesReceived(allVehicle);
|
liveActivity.vehiclesReceived(getAllVehicle());
|
||||||
demoPositionsList();
|
demoPositionsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,7 +824,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
tabHost.setCurrentTabByTag("Text");
|
tabHost.setCurrentTabByTag("Text");
|
||||||
AppParams.crtTab = AppParams.Tabs.message;
|
AppParams.crtTab = AppParams.Tabs.message;
|
||||||
|
|
||||||
messageActivity.sc_id = getVehicle4Imei(imei).sc_id;
|
messageActivity.sc_id = getVehicle4Imei(getImei()).sc_id;
|
||||||
messageActivity.LASTMESSAGES = false;
|
messageActivity.LASTMESSAGES = false;
|
||||||
messageActivity.GetLastSMS();
|
messageActivity.GetLastSMS();
|
||||||
|
|
||||||
@ -1055,14 +1053,14 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
public void run() {
|
public void run() {
|
||||||
if(AppParams.crtTab == AppParams.Tabs.live)
|
if(AppParams.crtTab == AppParams.Tabs.live)
|
||||||
{
|
{
|
||||||
if(SuperVehHash.containsKey((long)101))
|
if(getSuperVehHash().containsKey((long)101))
|
||||||
{
|
{
|
||||||
|
|
||||||
HistPos crtPos = demoPositions.get(demoPosition++ % demoPositions.size());
|
HistPos crtPos = demoPositions.get(demoPosition++ % demoPositions.size());
|
||||||
|
|
||||||
SM.Debug("########### UPDATE");
|
SM.Debug("########### UPDATE");
|
||||||
int sc_id = demoPosition%3 == 0 ? 101:102;
|
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();
|
liveActivity.refreshMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1075,9 +1073,9 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
HistPos crtPos = demoPositions.get(demoPosition++ % demoPositions.size());
|
HistPos crtPos = demoPositions.get(demoPosition++ % demoPositions.size());
|
||||||
|
|
||||||
SM.Debug("########### UPDATE");
|
SM.Debug("########### UPDATE");
|
||||||
int sc_id = Integer.parseInt(imei);
|
int sc_id = Integer.parseInt(getImei());
|
||||||
((SuperVehicle)SuperVehHash.get((long)sc_id)).SetNewPosition(crtPos.lat + 0.0002, crtPos.lng + 0.0002, Calendar.getInstance().getTime().getTime(), crtPos.speed+2);
|
((SuperVehicle) getSuperVehHash().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);
|
setMess("Lat:" + String.format("%5f", crtPos.lat + 0.0002) + ", Lng:" + String.format("%5f", crtPos.lng + 0.0002));
|
||||||
liveActivity.refreshMap();
|
liveActivity.refreshMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1143,7 +1141,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
// when connection becomes true after it was false
|
// when connection becomes true after it was false
|
||||||
|
|
||||||
|
|
||||||
if(allVehicle.size() == 0)
|
if(getAllVehicle().size() == 0)
|
||||||
//connectTask.doIn(OperationCodes.GetVehicles, new Object[] {AppParams.USERID});
|
//connectTask.doIn(OperationCodes.GetVehicles, new Object[] {AppParams.USERID});
|
||||||
new ConnectTask().execute(new String[] {OperationCodes.GetVehicles + "", AppParams.USERID + ""});
|
new ConnectTask().execute(new String[] {OperationCodes.GetVehicles + "", AppParams.USERID + ""});
|
||||||
//getVehicles(AppParams.USERID);
|
//getVehicles(AppParams.USERID);
|
||||||
@ -1237,11 +1235,11 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
GPSmsg GPSPos= new GPSmsg(msg);
|
GPSmsg GPSPos= new GPSmsg(msg);
|
||||||
//SM.Debug("Got new GPS pos data:" + GPSPos.data);
|
//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
|
//list for live
|
||||||
@ -1269,23 +1267,23 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
SM.Debug("Got POLL GPS message");
|
SM.Debug("Got POLL GPS message");
|
||||||
TCPmsg msg= event.msg();
|
TCPmsg msg= event.msg();
|
||||||
GPSmsg GPSPos= new GPSmsg(msg);
|
GPSmsg GPSPos= new GPSmsg(msg);
|
||||||
imei = Long.toString(GPSPos.gpsValue.imei);
|
setImei(Long.toString(GPSPos.gpsValue.imei));
|
||||||
mess = "LAT:"+Double.toString(GPSPos.gpsValue.lat)+" LNG:"+Double.toString(GPSPos.gpsValue.lng);
|
setMess("LAT:"+Double.toString(GPSPos.gpsValue.lat)+" LNG:"+Double.toString(GPSPos.gpsValue.lng));
|
||||||
SM.Debug("Got new Poll pos data:" + GPSPos.data);
|
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
|
//if is not check i need to force check to put on the map
|
||||||
Boolean forceChecked =false;
|
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;
|
forceChecked =true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//back to standard procedures to put on the map
|
//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
|
//list for live
|
||||||
@ -1298,7 +1296,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
int x = 0;
|
int x = 0;
|
||||||
if (forceChecked)
|
if (forceChecked)
|
||||||
{
|
{
|
||||||
for (Vehicle veh : allVehicle)
|
for (Vehicle veh : getAllVehicle())
|
||||||
{
|
{
|
||||||
if (veh.imei.compareTo(Long.toString(GPSPos.gpsValue.imei))==0) break;
|
if (veh.imei.compareTo(Long.toString(GPSPos.gpsValue.imei))==0) break;
|
||||||
x++;
|
x++;
|
||||||
@ -1307,7 +1305,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
else x = -1;
|
else x = -1;
|
||||||
if(liveActivity!=null)
|
if(liveActivity!=null)
|
||||||
{
|
{
|
||||||
if (x!=allVehicle.size())
|
if (x!= getAllVehicle().size())
|
||||||
liveActivity.pollReceived(x ,GPSPos.gpsValue.lat,GPSPos.gpsValue.lng);
|
liveActivity.pollReceived(x ,GPSPos.gpsValue.lat,GPSPos.gpsValue.lng);
|
||||||
else
|
else
|
||||||
liveActivity.pollReceived(-1 ,GPSPos.gpsValue.lat,GPSPos.gpsValue.lng);
|
liveActivity.pollReceived(-1 ,GPSPos.gpsValue.lat,GPSPos.gpsValue.lng);
|
||||||
@ -1360,10 +1358,10 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
for(Vehicle veh:vMSG.vehList)
|
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);
|
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);
|
getSuperVehHash().put(Long.valueOf(veh.imei), tmpSuper);
|
||||||
VehHashbySc_id.put(veh.sc_id, veh);
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -1386,7 +1384,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
if(messageActivity != null)
|
if(messageActivity != null)
|
||||||
messageActivity.UpdateVehs(vMSG.vehList);
|
messageActivity.UpdateVehs(vMSG.vehList);
|
||||||
}
|
}
|
||||||
allVehicle = vMSG.vehList;
|
setAllVehicle(vMSG.vehList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLastSMSsReceived(TCPEvent event) {
|
public void onLastSMSsReceived(TCPEvent event) {
|
||||||
@ -1459,8 +1457,8 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
SM.Debug("Message:" + tempArr[1]);
|
SM.Debug("Message:" + tempArr[1]);
|
||||||
|
|
||||||
// change Visual Elements
|
// change Visual Elements
|
||||||
imei = tempArr[0];
|
setImei(tempArr[0]);
|
||||||
mess = tempArr[1];
|
setMess(tempArr[1]);
|
||||||
long time = Calendar.getInstance().getTimeInMillis() / 1000;
|
long time = Calendar.getInstance().getTimeInMillis() / 1000;
|
||||||
try {
|
try {
|
||||||
// get time from the last received sms and divide it to 1000 to convert it to seconds
|
// 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);
|
//SM.Debug("Got LastPost msg.data:" + msg.data);
|
||||||
for(LastPos posMsg: lastPos.PosList)
|
for(LastPos posMsg: lastPos.PosList)
|
||||||
{
|
{
|
||||||
if(SuperVehHash.get(posMsg.imei) != null)
|
if(getSuperVehHash().get(posMsg.imei) != null)
|
||||||
((SuperVehicle)SuperVehHash.get(posMsg.imei)).SetDataFromLastPos(posMsg.lat, posMsg.lng, posMsg.timeGMT, posMsg.speed, posMsg.Address, posMsg.isON);
|
((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)
|
if(tabHost.getCurrentTab() != 5)
|
||||||
{
|
{
|
||||||
// change Visual Elements
|
// change Visual Elements
|
||||||
imei = UnitIMEI;
|
setImei(UnitIMEI);
|
||||||
switch (msg.opCode)
|
switch (msg.opCode)
|
||||||
{
|
{
|
||||||
case 135: mess = "speed "+tempArr[1];
|
case 135: setMess("speed "+tempArr[1]);
|
||||||
break;
|
break;
|
||||||
case 136: mess = "landmark "+tempArr[1];
|
case 136: setMess("landmark "+tempArr[1]);
|
||||||
break;
|
break;
|
||||||
case 137: mess = "zone "+tempArr[1];
|
case 137: setMess("zone "+tempArr[1]);
|
||||||
break;
|
break;
|
||||||
case 138: mess = "emergency";
|
case 138: setMess("emergency");
|
||||||
break;
|
break;
|
||||||
case 140: mess = "telemetry "+ tempArr[1];
|
case 140: setMess("telemetry "+ tempArr[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mess = "emergency";
|
setMess("emergency");
|
||||||
}
|
}
|
||||||
myHandler.post(UpdateResultsAlarm);
|
myHandler.post(UpdateResultsAlarm);
|
||||||
|
|
||||||
if ((msg.opCode==138)&&(AppParams.crtTab == AppParams.Tabs.live))
|
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
|
//if is not check i need to force check to put on the map
|
||||||
Boolean forceChecked =false;
|
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;
|
forceChecked =true;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
@ -1924,7 +1922,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
int x = 0;
|
int x = 0;
|
||||||
if (forceChecked)
|
if (forceChecked)
|
||||||
{
|
{
|
||||||
for (Vehicle veh : allVehicle)
|
for (Vehicle veh : getAllVehicle())
|
||||||
{
|
{
|
||||||
if (veh.imei.compareTo(UnitIMEI)==0) break;
|
if (veh.imei.compareTo(UnitIMEI)==0) break;
|
||||||
x++;
|
x++;
|
||||||
@ -1933,10 +1931,10 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
else x = -1;
|
else x = -1;
|
||||||
if(liveActivity != null)
|
if(liveActivity != null)
|
||||||
{
|
{
|
||||||
if (x!=allVehicle.size())
|
if (x!= getAllVehicle().size())
|
||||||
liveActivity.emergencyAlarmReceived(x ,SuperVehHash.get(Long.parseLong(UnitIMEI)).lat,SuperVehHash.get(Long.parseLong(UnitIMEI)).lng);
|
liveActivity.emergencyAlarmReceived(x , getSuperVehHash().get(Long.parseLong(UnitIMEI)).lat, getSuperVehHash().get(Long.parseLong(UnitIMEI)).lng);
|
||||||
else
|
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)
|
catch (Exception ex)
|
||||||
@ -1963,8 +1961,8 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
if (rec.typeID==1)
|
if (rec.typeID==1)
|
||||||
rec.NameForDisplay = AppParams.USERNAME;
|
rec.NameForDisplay = AppParams.USERNAME;
|
||||||
else {
|
else {
|
||||||
if (SuperVehHash.get((long)rec.subID)!=null)
|
if (getSuperVehHash().get((long)rec.subID)!=null)
|
||||||
rec.NameForDisplay = SuperVehHash.get((long)rec.subID).name;
|
rec.NameForDisplay = getSuperVehHash().get((long)rec.subID).name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2045,10 +2043,10 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
activePopupType= MsgType.ALARM;
|
activePopupType= MsgType.ALARM;
|
||||||
imageViewPopUp.setImageResource(R.drawable.siren_on);
|
imageViewPopUp.setImageResource(R.drawable.siren_on);
|
||||||
slideTabsText.setText(getString(R.string.newAlarm));
|
slideTabsText.setText(getString(R.string.newAlarm));
|
||||||
if (getVehicle4Imei(imei)!=null)
|
if (getVehicle4Imei(getImei())!=null)
|
||||||
textViewNMFrom.setText(getString(R.string.from) + ": " + getVehicle4Imei(imei).name);
|
textViewNMFrom.setText(getString(R.string.from) + ": " + getVehicle4Imei(getImei()).name);
|
||||||
else textViewNMFrom.setText(getString(R.string.from) + ": " + imei);
|
else textViewNMFrom.setText(getString(R.string.from) + ": " + getImei());
|
||||||
textViewNMMessage.setText("TYPE: " + mess);
|
textViewNMMessage.setText("TYPE: " + getMess());
|
||||||
// show layout
|
// show layout
|
||||||
layoutNewMessage.setVisibility(View.VISIBLE);
|
layoutNewMessage.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
@ -2085,7 +2083,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
// set TextViews
|
// set TextViews
|
||||||
String from = "";
|
String from = "";
|
||||||
Vehicle fromVehicle = null;
|
Vehicle fromVehicle = null;
|
||||||
if((fromVehicle = getVehicle4Imei(imei)) != null)
|
if((fromVehicle = getVehicle4Imei(getImei())) != null)
|
||||||
from = fromVehicle.name;
|
from = fromVehicle.name;
|
||||||
|
|
||||||
if(tcp!=null && !AppParams.DEMO)
|
if(tcp!=null && !AppParams.DEMO)
|
||||||
@ -2094,7 +2092,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
imageViewPopUp.setImageResource(R.drawable.poll);
|
imageViewPopUp.setImageResource(R.drawable.poll);
|
||||||
slideTabsText.setText("Poll Reply");
|
slideTabsText.setText("Poll Reply");
|
||||||
textViewNMFrom.setText("From: " + from);
|
textViewNMFrom.setText("From: " + from);
|
||||||
textViewNMMessage.setText(mess);
|
textViewNMMessage.setText(getMess());
|
||||||
// show layout
|
// show layout
|
||||||
layoutNewMessage.setVisibility(View.VISIBLE);
|
layoutNewMessage.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
@ -2111,7 +2109,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
imageViewPopUp.setImageResource(R.drawable.poll);
|
imageViewPopUp.setImageResource(R.drawable.poll);
|
||||||
slideTabsText.setText("Poll Reply");
|
slideTabsText.setText("Poll Reply");
|
||||||
textViewNMFrom.setText("From: " + from);
|
textViewNMFrom.setText("From: " + from);
|
||||||
textViewNMMessage.setText(mess);
|
textViewNMMessage.setText(getMess());
|
||||||
// show layout
|
// show layout
|
||||||
layoutNewMessage.setVisibility(View.VISIBLE);
|
layoutNewMessage.setVisibility(View.VISIBLE);
|
||||||
/*
|
/*
|
||||||
@ -2143,8 +2141,8 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
activePopupType = MsgType.SMS;
|
activePopupType = MsgType.SMS;
|
||||||
imageViewPopUp.setImageResource(R.drawable.message);
|
imageViewPopUp.setImageResource(R.drawable.message);
|
||||||
slideTabsText.setText("New Message");
|
slideTabsText.setText("New Message");
|
||||||
textViewNMFrom.setText("From: " + getVehicle4Imei(imei).name);
|
textViewNMFrom.setText("From: " + getVehicle4Imei(getImei()).name);
|
||||||
textViewNMMessage.setText("MSG: " + mess);
|
textViewNMMessage.setText("MSG: " + getMess());
|
||||||
// show layout
|
// show layout
|
||||||
layoutNewMessage.setVisibility(View.VISIBLE);
|
layoutNewMessage.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
@ -2157,11 +2155,11 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
}
|
}
|
||||||
else if(AppParams.DEMO)
|
else if(AppParams.DEMO)
|
||||||
{
|
{
|
||||||
mess = "i got your sms";
|
setMess("i got your sms");
|
||||||
activePopupType = MsgType.SMS;
|
activePopupType = MsgType.SMS;
|
||||||
imageViewPopUp.setImageResource(R.drawable.message);
|
imageViewPopUp.setImageResource(R.drawable.message);
|
||||||
slideTabsText.setText("New Message");
|
slideTabsText.setText("New Message");
|
||||||
textViewNMFrom.setText("From: " + getVehicle4Imei(imei).name);
|
textViewNMFrom.setText("From: " + getVehicle4Imei(getImei()).name);
|
||||||
textViewNMMessage.setText("MSG: " + "i got your sms");
|
textViewNMMessage.setText("MSG: " + "i got your sms");
|
||||||
// show layout
|
// show layout
|
||||||
layoutNewMessage.setVisibility(View.VISIBLE);
|
layoutNewMessage.setVisibility(View.VISIBLE);
|
||||||
@ -2181,31 +2179,31 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
|
|
||||||
public void createNotification(int icon) {
|
public void createNotification(int icon) {
|
||||||
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
String tickerText = "SafeMobile Dispatch: New Message from " + imei;
|
String tickerText = "SafeMobile Dispatch: New Message from " + getImei();
|
||||||
String contentTitle = "New Message from " + imei;
|
String contentTitle = "New Message from " + getImei();
|
||||||
String contentText = "\"" + mess + "\"";
|
String contentText = "\"" + getMess() + "\"";
|
||||||
|
|
||||||
Vehicle veh = getVehicle4Imei(imei);
|
Vehicle veh = getVehicle4Imei(getImei());
|
||||||
|
|
||||||
int icon_value = icon;
|
int icon_value = icon;
|
||||||
switch(icon)
|
switch(icon)
|
||||||
{
|
{
|
||||||
case AppParams.messageNotif:
|
case AppParams.messageNotif:
|
||||||
contentText = "\"" + mess + "\"";
|
contentText = "\"" + getMess() + "\"";
|
||||||
contentTitle = "New Message from " + imei;
|
contentTitle = "New Message from " + getImei();
|
||||||
icon = R.drawable.message;
|
icon = R.drawable.message;
|
||||||
break;
|
break;
|
||||||
case AppParams.pollNotif:
|
case AppParams.pollNotif:
|
||||||
contentText = "\"" + mess + "\"" ;
|
contentText = "\"" + getMess() + "\"" ;
|
||||||
contentTitle = "Poll Reply from " + (veh !=null ? getVehicle4Imei(imei).name : imei);
|
contentTitle = "Poll Reply from " + (veh !=null ? getVehicle4Imei(getImei()).name : getImei());
|
||||||
tickerText = "SafeMobile Dispatch: Poll Reply from " + (veh !=null ? getVehicle4Imei(imei).name : imei);
|
tickerText = "SafeMobile Dispatch: Poll Reply from " + (veh !=null ? getVehicle4Imei(getImei()).name : getImei());
|
||||||
icon = R.drawable.poll;
|
icon = R.drawable.poll;
|
||||||
break;
|
break;
|
||||||
case AppParams.alertNotif:
|
case AppParams.alertNotif:
|
||||||
String vehName = getString(R.string.from) + ": " + imei;
|
String vehName = getString(R.string.from) + ": " + getImei();
|
||||||
if(veh!=null)
|
if(veh!=null)
|
||||||
vehName = getString(R.string.from) + ": " + (veh !=null ? getVehicle4Imei(imei).name : imei);
|
vehName = getString(R.string.from) + ": " + (veh !=null ? getVehicle4Imei(getImei()).name : getImei());
|
||||||
contentText ="\"" + mess + "\"";
|
contentText ="\"" + getMess() + "\"";
|
||||||
contentTitle = getString(R.string.newAlarm) + vehName;
|
contentTitle = getString(R.string.newAlarm) + vehName;
|
||||||
tickerText = "SafeMobile Dispatch: " + getString(R.string.newAlarm) + vehName;
|
tickerText = "SafeMobile Dispatch: " + getString(R.string.newAlarm) + vehName;
|
||||||
icon = R.drawable.alert;
|
icon = R.drawable.alert;
|
||||||
@ -2240,7 +2238,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
private Vehicle getVehicle4Imei(String imei)
|
private Vehicle getVehicle4Imei(String imei)
|
||||||
{
|
{
|
||||||
Vehicle veh = null;
|
Vehicle veh = null;
|
||||||
for(Vehicle vehicle: allVehicle)
|
for(Vehicle vehicle: getAllVehicle())
|
||||||
//SM.Debug("Vehicle name:"+vehicle.name+" IMEI:"+vehicle.imei);
|
//SM.Debug("Vehicle name:"+vehicle.name+" IMEI:"+vehicle.imei);
|
||||||
if(vehicle.imei.equals(imei))
|
if(vehicle.imei.equals(imei))
|
||||||
veh = vehicle;
|
veh = vehicle;
|
||||||
@ -2297,20 +2295,20 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 height =400;
|
||||||
double width =400;
|
double width =400;
|
||||||
double dlat = Math.abs(LATMAX - LATmin);
|
double dlat = Math.abs(latMax - latMin);
|
||||||
double dlon = Math.abs(LNGMAX - LNGmin);
|
double dlon = Math.abs(lngMax - lngMin);
|
||||||
if(dlat == 0 && dlon == 0)
|
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;
|
//return 17;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center latitude in radians
|
// Center latitude in radians
|
||||||
double clat = Math.PI*(LATmin + LATMAX)/360.;
|
double clat = Math.PI*(latMin + latMax)/360.;
|
||||||
|
|
||||||
double C = 0.0000107288;
|
double C = 0.0000107288;
|
||||||
double z0 = Math.ceil(Math.log(dlat/(C*height))/0.693);
|
double z0 = Math.ceil(Math.log(dlat/(C*height))/0.693);
|
||||||
@ -2550,7 +2548,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
{
|
{
|
||||||
Long.parseLong(params[2]);
|
Long.parseLong(params[2]);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
getRecentSMSs(Integer.parseInt(params[1]), Long.parseLong(params[2]));
|
getRecentSMSs(Integer.parseInt(params[1]), Long.parseLong(params[2]));
|
||||||
@ -2573,7 +2571,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OperationCodes.SendAlarmAcknoledge:
|
case OperationCodes.SendAlarmAcknoledge:
|
||||||
sendAlarmAcknoledge(Integer.parseInt(params[1]), Integer.parseInt(params[2]));
|
sendAlarmAcknowledge(Integer.parseInt(params[1]), Integer.parseInt(params[2]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OperationCodes.GetHistoryPositions:
|
case OperationCodes.GetHistoryPositions:
|
||||||
|
@ -1,21 +1,16 @@
|
|||||||
package com.safemobile.lib.sound;
|
package com.safemobile.lib.sound;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import com.safemobile.lib.SM;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.safemobile.lib.SM;
|
|
||||||
import com.safemobile.lib.TCPmsg;
|
|
||||||
|
|
||||||
public class TCPaudioClient implements Runnable{
|
public class TCPaudioClient implements Runnable{
|
||||||
private boolean alive = true;
|
private boolean alive = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user