Compare commits
No commits in common. "dc2cb825bba20ed9e5554b412af157dabf3a385c" and "04fa7a5b2ebe5a7e55dde92e83c75edae6a57b6d" have entirely different histories.
dc2cb825bb
...
04fa7a5b2e
@ -255,12 +255,13 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getAlarms(long userID) {
|
public boolean getAlarms(long userID)
|
||||||
if (tcp == null)
|
{
|
||||||
|
if(tcp == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean res = tcp.Write("0.0", "#27#" + userID + "#");
|
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
|
||||||
SM.Debug("Could not send message [GetAlarms]!!");
|
SM.Debug("Could not send message [GetAlarms]!!");
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.safemobile.services;
|
package com.safemobile.services;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
@ -11,14 +12,16 @@ import com.safemobile.lib.SM;
|
|||||||
import com.safemobile.lib.TCPmsg;
|
import com.safemobile.lib.TCPmsg;
|
||||||
|
|
||||||
|
|
||||||
public class TCPmsgParser implements Runnable {
|
public class TCPmsgParser implements Runnable{
|
||||||
|
|
||||||
|
|
||||||
public boolean run = true;
|
public boolean run = true;
|
||||||
private TCPmsg _msg;
|
private TCPmsg _msg;
|
||||||
private static final List<ITCPListener> _listeners = new ArrayList<>();
|
private static List<ITCPListener> _listeners = new ArrayList<ITCPListener>();
|
||||||
private Thread TCPmsgParserThread;
|
private Thread TCPmsgParserThread;
|
||||||
|
|
||||||
public TCPmsgParser() {
|
public TCPmsgParser()
|
||||||
|
{
|
||||||
TCPmsgParserThread = new Thread(this, "TCPmsgParserThread");
|
TCPmsgParserThread = new Thread(this, "TCPmsgParserThread");
|
||||||
TCPmsgParserThread.start(); // (2) Start the thread.
|
TCPmsgParserThread.start(); // (2) Start the thread.
|
||||||
}
|
}
|
||||||
@ -35,151 +38,177 @@ public class TCPmsgParser implements Runnable {
|
|||||||
_listeners.clear();
|
_listeners.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getListenersSize()
|
||||||
|
{
|
||||||
|
return _listeners.size();
|
||||||
|
}
|
||||||
|
|
||||||
private synchronized void _fireLoginEvent() {
|
private synchronized void _fireLoginEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onLoginReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onLoginReceived( event );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private synchronized void _fireGPSEvent() {
|
private synchronized void _fireGPSEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onGPSReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onGPSReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private synchronized void _fireSMSEvent() {
|
private synchronized void _fireSMSEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onSMSReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onSMSReceived( event );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireLastSMSEvent() {
|
private synchronized void _fireLastSMSEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onLastSMSsReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onLastSMSsReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireVehEvent() {
|
private synchronized void _fireVehEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onVehiclesReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onVehiclesReceived( event );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireNewSMS() {
|
private synchronized void _fireNewSMS() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onNewSMSReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onNewSMSReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireSMSconfirm() {
|
private synchronized void _fireSMSconfirm() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onSMSAckReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onSMSAckReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireLastPos() {
|
private synchronized void _fireLastPos() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onLastPositionsReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onLastPositionsReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireRadioEvent() {
|
private synchronized void _fireRadioEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onRadioMsgReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onRadioMsgReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireHistPos() {
|
private synchronized void _fireHistPos() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onHistoryPositionsReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onHistoryPositionsReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireHistCount() {
|
private synchronized void _fireHistCount() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onHistoryPositionsCountReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onHistoryPositionsCountReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireAlarmList() {
|
private synchronized void _fireAlarmList() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onAlarmsReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onAlarmsReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireAlarmACK() {
|
private synchronized void _fireAlarmACK() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onAlarmAckReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).onAlarmAckReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireAlarmLive() {
|
private synchronized void _fireAlarmLive() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.alarmLiveReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next() ).alarmLiveReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireRecordList() {
|
private synchronized void _fireRecordList() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onRecordingsListReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onRecordingsListReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireRecordPlay() {
|
private synchronized void _fireRecordPlay() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onRecordingPlayReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onRecordingPlayReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _firePOLLEvent() {
|
private synchronized void _firePOLLEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onPollReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onPollReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireConnectionReplyEvent() {
|
private synchronized void _fireConnectionReplyEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onConnectionReplyReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onConnectionReplyReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireContactsReceivedEvent() {
|
private synchronized void _fireContactsReceivedEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
|
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onContactsListReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onContactsListReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireRecordingsReceivedEvent() {
|
private synchronized void _fireRecordingsReceivedEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
|
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onRecordingsListReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onRecordingsListReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void _fireTextMessagesReceivedEvent() {
|
private synchronized void _fireTextMessagesReceivedEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
|
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onTextMessagesListReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onTextMessagesListReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,56 +216,64 @@ public class TCPmsgParser implements Runnable {
|
|||||||
private synchronized void _fireRecordingPlayReceivedEvent() {
|
private synchronized void _fireRecordingPlayReceivedEvent() {
|
||||||
TCPEvent event = new TCPEvent( this, _msg );
|
TCPEvent event = new TCPEvent( this, _msg );
|
||||||
|
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onRecordingPlayReceived(event);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onRecordingPlayReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static synchronized void _fireTCPConnectionDownEvent(boolean previuosWasConnectionUp) {
|
public static synchronized void _fireTCPConnectionDownEvent(boolean previuosWasConnectionUp) {
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onTCPConnectionDown(previuosWasConnectionUp);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onTCPConnectionDown(previuosWasConnectionUp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized void _fireTCPConnectionUpEvent(boolean previuosWasConnectionUp) {
|
public static synchronized void _fireTCPConnectionUpEvent(boolean previuosWasConnectionUp) {
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onTCPConnectionUp(previuosWasConnectionUp);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onTCPConnectionUp(previuosWasConnectionUp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static synchronized void _fireonTCPConnectionStatusEvent(boolean isConnectionUp, boolean previuosWasConnectionUp) {
|
public static synchronized void _fireonTCPConnectionStatusEvent(boolean isConnectionUp, boolean previuosWasConnectionUp) {
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onTCPConnectionStatusReceived(isConnectionUp, previuosWasConnectionUp);
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onTCPConnectionStatusReceived(isConnectionUp, previuosWasConnectionUp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized void _firePONGReceivedEvent() {
|
public static synchronized void _firePONGReceivedEvent() {
|
||||||
for (ITCPListener listener : _listeners) {
|
Iterator<ITCPListener> listeners = _listeners.iterator();
|
||||||
listener.onPONGReceived();
|
while( listeners.hasNext() ) {
|
||||||
|
( (ITCPListener) listeners.next()).onPONGReceived();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run()
|
||||||
while(run) {
|
{
|
||||||
|
while(run)
|
||||||
|
{
|
||||||
|
//SM.Debug("TCPmsgParser waiting for data...");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
if (TCPhandler.msgList == null)
|
if(TCPhandler.msgList==null)
|
||||||
continue;
|
continue;
|
||||||
if(!TCPhandler.msgList.isEmpty()) {
|
if(!TCPhandler.msgList.isEmpty())
|
||||||
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
_msg = TCPhandler.msgList.poll();
|
_msg = TCPhandler.msgList.poll();
|
||||||
if(_msg == null)
|
if(_msg == null)
|
||||||
continue;
|
continue;
|
||||||
if(!_msg.OK)
|
if(_msg.OK == false)
|
||||||
continue;
|
continue;
|
||||||
//parse the rest of the message;
|
//parse the rest of the message;
|
||||||
|
|
||||||
|
|
||||||
switch(_msg.opCode)
|
switch(_msg.opCode)
|
||||||
{
|
{
|
||||||
case 40: /* login */{
|
case 40: /* login */{
|
||||||
@ -249,21 +286,22 @@ public class TCPmsgParser implements Runnable {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case 42: /* Text Message */{
|
case 42: /* Text Message */{
|
||||||
_fireSMSEvent();
|
_fireSMSEvent();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case 43: /* Last text message */ {
|
case 43: /* Last text message */ {
|
||||||
_fireLastSMSEvent();
|
_fireLastSMSEvent();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case OperationCodes.TM_ACK:{
|
||||||
|
_fireSMSconfirm();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case OperationCodes.TM_ACK:
|
case OperationCodes.TM_ACK_SD:{
|
||||||
case OperationCodes.TM_ACK_SD: {
|
|
||||||
_fireSMSconfirm();
|
_fireSMSconfirm();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -288,13 +326,12 @@ public class TCPmsgParser implements Runnable {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case 50: /* radio */ {
|
case 50: /* radio */ {
|
||||||
_fireRadioEvent();
|
_fireRadioEvent();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 46:{
|
case 46: {
|
||||||
_fireHistPos();
|
_fireHistPos();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -304,13 +341,11 @@ public class TCPmsgParser implements Runnable {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case 47: /* alert list */ {
|
case 47: /* alert list */ {
|
||||||
_fireAlarmList();
|
_fireAlarmList();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case 48: /* alert ack */ {
|
case 48: /* alert ack */ {
|
||||||
_fireAlarmACK();
|
_fireAlarmACK();
|
||||||
break;
|
break;
|
||||||
@ -368,27 +403,37 @@ public class TCPmsgParser implements Runnable {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
if(TCPhandler.msgList.size() > 0)
|
if(TCPhandler.msgList.size() > 0)
|
||||||
_msg = TCPhandler.msgList.remove(0);
|
_msg = TCPhandler.msgList.remove(0);
|
||||||
} catch(NoSuchElementException exe) {
|
}
|
||||||
|
catch(NoSuchElementException exe)
|
||||||
|
{
|
||||||
SM.Exception("TCP msg Parser", "NoSuchElementException");
|
SM.Exception("TCP msg Parser", "NoSuchElementException");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
SM.Debug("Error on fire Event:"+e.toString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
SM.Debug("TCPmsgParser listen thread stoped.");
|
SM.Debug("TCPmsgParser listen thread stoped.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sleep(int miliseconds) {
|
private void sleep(int miliseconds) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(miliseconds);
|
Thread.sleep(miliseconds);
|
||||||
} catch (InterruptedException ignored) { }
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearMsgList()
|
public void clearMsgList()
|
||||||
@ -396,14 +441,17 @@ public class TCPmsgParser implements Runnable {
|
|||||||
TCPhandler.msgList.clear();
|
TCPhandler.msgList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop() {
|
public void Stop()
|
||||||
|
{
|
||||||
run = false;
|
run = false;
|
||||||
// stop thread
|
// stop thread
|
||||||
if(TCPmsgParserThread != null) {
|
if(TCPmsgParserThread != null)
|
||||||
|
{
|
||||||
Thread moribund = TCPmsgParserThread;
|
Thread moribund = TCPmsgParserThread;
|
||||||
TCPmsgParserThread = null;
|
TCPmsgParserThread = null;
|
||||||
moribund.interrupt();
|
moribund.interrupt();
|
||||||
}
|
}
|
||||||
SM.Debug("Stoping TCPmsgParser");
|
SM.Debug("Stoping TCPmsgParser");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -78,4 +78,6 @@ dependencies {
|
|||||||
|
|
||||||
// add Gson
|
// add Gson
|
||||||
implementation 'com.google.code.gson:gson:2.8.6'
|
implementation 'com.google.code.gson:gson:2.8.6'
|
||||||
|
|
||||||
|
//retrofit
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
|
|||||||
public GoogleMapsInfoBubble(LayoutInflater layoutInflater, Context context) {
|
public GoogleMapsInfoBubble(LayoutInflater layoutInflater, Context context) {
|
||||||
isLiveTab = false;
|
isLiveTab = false;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
// this.superVehHash = vehicles;
|
||||||
mWindow = layoutInflater.inflate(R.layout.map_marker_info_bubble, null);
|
mWindow = layoutInflater.inflate(R.layout.map_marker_info_bubble, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
position = Integer.parseInt(marker.getTitle());
|
position = Integer.getInteger(marker.getTitle());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.v(TAG, "Unable to parse Google Maps Info Bubble title on History");
|
Log.v(TAG, "Unable to parse Google Maps Info Bubble title on History");
|
||||||
}
|
}
|
||||||
|
@ -100,17 +100,6 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ImageView mapType = findViewById(R.id.changeMapTypeHeader);
|
|
||||||
mapType.setOnClickListener(view -> {
|
|
||||||
if (googleMap.getMapType() != GoogleMap.MAP_TYPE_SATELLITE) {
|
|
||||||
mapType.setImageResource(R.drawable.map);
|
|
||||||
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
|
|
||||||
} else {
|
|
||||||
mapType.setImageResource(R.drawable.satellite);
|
|
||||||
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setDate();
|
setDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,11 +145,11 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
// image View for changing map type satellite or map
|
// image View for changing map type satellite or map
|
||||||
ImageView changeMapTypeImageView = findViewById(R.id.changeMapType);
|
ImageView changeMapTypeImageView = findViewById(R.id.changeMapType);
|
||||||
changeMapTypeImageView.setOnClickListener(v -> {
|
changeMapTypeImageView.setOnClickListener(v -> {
|
||||||
if (googleMap.getMapType() != GoogleMap.MAP_TYPE_SATELLITE) {
|
if (googleMap.getMapType() == GoogleMap.MAP_TYPE_SATELLITE) {
|
||||||
changeMapTypeImageView.setImageResource(R.drawable.map);
|
changeMapTypeImageView.setImageResource(R.drawable.satellite);
|
||||||
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
|
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
|
||||||
} else {
|
} else {
|
||||||
changeMapTypeImageView.setImageResource(R.drawable.satellite);
|
changeMapTypeImageView.setImageResource(R.drawable.map);
|
||||||
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -687,7 +687,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
// change check image for selected value
|
// change check image for selected value
|
||||||
VehiclesGridViewAdapter.ViewHolder viewLive = (VehiclesGridViewAdapter.ViewHolder) view.getTag();
|
VehiclesGridViewAdapter.ViewHolder viewLive = (VehiclesGridViewAdapter.ViewHolder) view.getTag();
|
||||||
|
|
||||||
if (displayedVehicles.get(position))
|
if (Boolean.TRUE.equals(displayedVehicles.get(position)))
|
||||||
viewLive.imgViewChecked.setImageResource(R.drawable.checked);
|
viewLive.imgViewChecked.setImageResource(R.drawable.checked);
|
||||||
else
|
else
|
||||||
viewLive.imgViewChecked.setImageResource(R.drawable.unchecked);
|
viewLive.imgViewChecked.setImageResource(R.drawable.unchecked);
|
||||||
@ -695,16 +695,16 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
// check if all values are identical
|
// check if all values are identical
|
||||||
boolean identical = true;
|
boolean identical = true;
|
||||||
for (Boolean displ : displayedVehicles)
|
for (Boolean displ : displayedVehicles)
|
||||||
if (displ != displayedVehicles.get(0)) {
|
if (!Objects.equals(displ, displayedVehicles.get(0))) {
|
||||||
identical = false;
|
identical = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// change image when all values are identical
|
// change image when all values are identical
|
||||||
if (identical && displayedVehicles.get(0)) {
|
if (identical && Boolean.TRUE.equals(displayedVehicles.get(0))) {
|
||||||
imageViewCheckAll.setSelected(true);
|
imageViewCheckAll.setSelected(true);
|
||||||
imageViewCheckAll.setBackgroundResource(R.drawable.check_all);
|
imageViewCheckAll.setBackgroundResource(R.drawable.check_all);
|
||||||
} else {
|
} else if (identical && Boolean.TRUE.equals(!displayedVehicles.get(0))) {
|
||||||
imageViewCheckAll.setSelected(false);
|
imageViewCheckAll.setSelected(false);
|
||||||
imageViewCheckAll.setBackgroundResource(R.drawable.uncheck_all);
|
imageViewCheckAll.setBackgroundResource(R.drawable.uncheck_all);
|
||||||
}
|
}
|
||||||
|
@ -21,16 +21,11 @@ public class NotificationActivity extends Activity{
|
|||||||
|
|
||||||
// broadcast intent
|
// broadcast intent
|
||||||
Intent i = new Intent();
|
Intent i = new Intent();
|
||||||
switch(key) {
|
switch(key)
|
||||||
case AppParams.messageNotif:
|
{
|
||||||
i.setAction(NOTIFICATION_MESSAGE_INTENT);
|
case AppParams.messageNotif: i.setAction(NOTIFICATION_MESSAGE_INTENT); break;
|
||||||
break;
|
case AppParams.alertNotif: i.setAction(NOTIFICATION_ALERT_INTENT); break;
|
||||||
case AppParams.alertNotif:
|
case AppParams.pollNotif: i.setAction(NOTIFICATION_POLL_INTENT); break;
|
||||||
i.setAction(NOTIFICATION_ALERT_INTENT);
|
|
||||||
break;
|
|
||||||
case AppParams.pollNotif:
|
|
||||||
i.setAction(NOTIFICATION_POLL_INTENT);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getBaseContext().sendBroadcast(i);
|
getBaseContext().sendBroadcast(i);
|
||||||
@ -40,4 +35,6 @@ public class NotificationActivity extends Activity{
|
|||||||
/* Finish activity and return to parent activity */
|
/* Finish activity and return to parent activity */
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +89,6 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/layoutNewMessage"
|
android:id="@+id/layoutNewMessage"
|
||||||
android:layout_width="350dp"
|
android:layout_width="350dp"
|
||||||
|
@ -166,7 +166,7 @@
|
|||||||
<GridView
|
<GridView
|
||||||
android:id="@+id/gridView1"
|
android:id="@+id/gridView1"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:background="#999999"
|
android:background="#999999"
|
||||||
android:drawSelectorOnTop="false"
|
android:drawSelectorOnTop="false"
|
||||||
android:horizontalSpacing="0dp"
|
android:horizontalSpacing="0dp"
|
||||||
|
@ -164,7 +164,7 @@
|
|||||||
<GridView
|
<GridView
|
||||||
android:id="@+id/gridView1"
|
android:id="@+id/gridView1"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:background="#999999"
|
android:background="#999999"
|
||||||
android:drawSelectorOnTop="false"
|
android:drawSelectorOnTop="false"
|
||||||
android:horizontalSpacing="0dp"
|
android:horizontalSpacing="0dp"
|
||||||
|
Loading…
Reference in New Issue
Block a user