1st version that works
This commit is contained in:
@ -0,0 +1,15 @@
|
||||
package com.safemobile.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class AbstractEmptyActivity extends Activity {
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.safemobile.activities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.safemobile.lib.Vehicle;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public abstract class AbstractLiveActivity extends AppCompatActivity {
|
||||
|
||||
private AbstractSDParentActivity parentTab;
|
||||
private Activity activity;
|
||||
private Context context;
|
||||
|
||||
private Bundle savedInstanceState;
|
||||
|
||||
public abstract void refreshMap(); // --> updateMap
|
||||
public abstract void vehiclesReceived(ArrayList<Vehicle> vehiclesList); // --> SaveVehicleInfo
|
||||
public abstract void pollReceived(int position, double lat, double lng); // --> UpdatePoll
|
||||
public abstract void vehicleStatusReceived(long imei, int opCode, int status); // --> UpdateOptions
|
||||
public abstract void emergencyAlarmReceived(int position, double lat, double lng); // --> UpdateEmergencyAlarm
|
||||
|
||||
|
||||
/** Misc */
|
||||
public AbstractSDParentActivity getParentTab() {
|
||||
return parentTab;
|
||||
}
|
||||
|
||||
public void setParentTab(AbstractSDParentActivity parentTab) {
|
||||
this.parentTab = parentTab;
|
||||
}
|
||||
|
||||
public Activity getActivity() {
|
||||
return activity;
|
||||
}
|
||||
|
||||
public void setActivity(Activity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public Bundle getSavedInstanceState() {
|
||||
return savedInstanceState;
|
||||
}
|
||||
|
||||
public void setSavedInstanceState(Bundle savedInstanceState) {
|
||||
this.savedInstanceState = savedInstanceState;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.safemobile.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
public abstract class AbstractMessagesActivity extends Activity {
|
||||
|
||||
/** Misc */
|
||||
public AbstractParentActivity parentTab;
|
||||
public Activity activity;
|
||||
public Context context;
|
||||
|
||||
// GridView Type
|
||||
public boolean LASTMESSAGES = true;
|
||||
|
||||
/*
|
||||
public abstract void UpdateSMS(ArrayList<SMS> list);
|
||||
public abstract void updateResultsInUi();
|
||||
public abstract void selectVehicle4Sc_id(long sc_id);
|
||||
public abstract void updateTCPConnection(boolean connected);
|
||||
public abstract void ConfirmSMS(String data);
|
||||
public abstract void NewSMS(String imei, String message);
|
||||
public abstract void onContactsUpdate();
|
||||
*/
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package com.safemobile.activities;
|
||||
|
||||
import com.safemobile.bluetooth.BluetoothTether;
|
||||
import com.safemobile.lib.AppParams;
|
||||
import com.safemobile.lib.Contact;
|
||||
import com.safemobile.lib.R;
|
||||
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.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class AbstractParentActivity extends TabActivity {
|
||||
|
||||
/** UI Elements */
|
||||
public RelativeLayout layoutLoading, relativeLayoutMenu;
|
||||
public ImageView imageViewLoading;
|
||||
|
||||
/** Misc */
|
||||
public Activity activity;
|
||||
public Context context;
|
||||
public NotificationManager mNotificationManager;
|
||||
public boolean displayLogCat = false; // show logCat messages when TCP send was successful
|
||||
|
||||
/** Handler */
|
||||
public Handler myHandler = new Handler();
|
||||
|
||||
/** BlueTooth Tether */
|
||||
public BluetoothTether bluetoothTether = null;
|
||||
|
||||
/** Broadcast Receiver */
|
||||
public BroadcastReceiver mReceiver = null;
|
||||
|
||||
/** TCP */
|
||||
protected TCPhandler tcp = null;
|
||||
protected TCPmsgParser tcpParser = null;
|
||||
|
||||
/** Methods */
|
||||
//public void onCreate(Bundle savedInstanceState) { };
|
||||
public abstract void startAudioHandler();
|
||||
public abstract void getSetZoneAndChannel(int gwID, int rgwID, int zoneNR, int channelNR);
|
||||
public abstract void getRadioStatus(int gwID, int rgwID);
|
||||
public abstract void sendPTT(int callType, long id);
|
||||
public abstract void sendCallType(int callType, long id);
|
||||
public abstract void sendDekey();
|
||||
public abstract void sendReset();
|
||||
public abstract void sendEmergency(int onOFF);
|
||||
public abstract void sendEmergency(int onOFF, long group_id);
|
||||
public abstract void sendSMS(String seqId, long sc_id, String txt);
|
||||
public abstract void displayToast(final String msg);
|
||||
public abstract void whenBackPressed(AppParams.ActivityResult result);
|
||||
public abstract void whenMenuPressed();
|
||||
public abstract void changeLanguage();
|
||||
public abstract Contact getVehicleById(long imei);
|
||||
|
||||
/** enable the menu buttons placed on the right side of the screen
|
||||
* @param enable if set to true, the buttons will be enabled, else they will be disabled */
|
||||
public abstract void enableMenuButtons(boolean enable);
|
||||
|
||||
public abstract void setRadioActivity(AbstractRadioActivity radioActivity);
|
||||
public abstract void setMessagesActivity(AbstractMessagesActivity messageActivity);
|
||||
|
||||
/** Send a TCP Command using Async Tasks
|
||||
* @param params Here you will add parameters for commands, and params[0] will be the Operation Code
|
||||
* followed by others parameters accordingly to the command*/
|
||||
public abstract void executeNetworkStuff(String[] params);
|
||||
|
||||
|
||||
/** get if TCP is connected or disconnected or null */
|
||||
public Object getTCPState() {
|
||||
// return true if tcp connection is on, false if not connected and null
|
||||
|
||||
if(tcp!=null && tcp.isConnectionUP)
|
||||
return "true";
|
||||
else if(tcp!=null && !tcp.isConnectionUP)
|
||||
return "false";
|
||||
return null;
|
||||
}
|
||||
|
||||
public void showMenu(boolean show)
|
||||
{
|
||||
if(relativeLayoutMenu != null)
|
||||
{
|
||||
// do not performe animation if already shown or already hidden
|
||||
if((relativeLayoutMenu.isShown() && show) || (!relativeLayoutMenu.isShown() && !show))
|
||||
;
|
||||
else {
|
||||
Animation anim = AnimationUtils.loadAnimation(this, R.anim.slide_out_bottom);
|
||||
if(show)
|
||||
anim = AnimationUtils.loadAnimation(this, R.anim.slide_in_bottom);
|
||||
relativeLayoutMenu.clearAnimation();
|
||||
relativeLayoutMenu.startAnimation(anim);
|
||||
relativeLayoutMenu.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMenuVisibile()
|
||||
{
|
||||
if(relativeLayoutMenu!= null && relativeLayoutMenu.getVisibility() == View.VISIBLE)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract void unregisterReceivers(BroadcastReceiver receiver);
|
||||
public abstract void cancelNotification(int drawable);
|
||||
public abstract void stopTethering();
|
||||
public abstract void stopAudio();
|
||||
public abstract void stopTCP();
|
||||
public abstract void recreateTCPConnection();
|
||||
public abstract void removeITCPListener();
|
||||
|
||||
/*
|
||||
public abstract void onResume();
|
||||
public abstract void onStart();
|
||||
public abstract void onPause();
|
||||
*/
|
||||
}
|
@ -0,0 +1,264 @@
|
||||
package com.safemobile.activities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Timer;
|
||||
|
||||
import com.safemobile.lib.AppParams;
|
||||
import com.safemobile.lib.Contact;
|
||||
import com.safemobile.lib.radio.Channel;
|
||||
import com.safemobile.lib.radio.Emerg;
|
||||
import com.safemobile.lib.radio.IncCall;
|
||||
import com.safemobile.lib.radio.Zone;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
public abstract class AbstractRadioActivity extends Activity {
|
||||
|
||||
|
||||
/** Misc */
|
||||
public AbstractParentActivity parentTab;
|
||||
public Activity activity;
|
||||
public Context context;
|
||||
public boolean emergencyOn = false;
|
||||
public boolean pttONoff = false;
|
||||
public IncCall incCall;
|
||||
public String chMsg = "";
|
||||
public Emerg emerg;
|
||||
public Dialog dialogExternal;
|
||||
// only in PadRadio
|
||||
//public int radioID, GWID, zoneNR, chNR;
|
||||
|
||||
/** Handler */
|
||||
public Handler myHandler = new Handler();
|
||||
public Timer timerInCall, timerPTTOn, timerCallType;
|
||||
|
||||
/** Lists */
|
||||
//public ArrayList<String> allContactsNames = new ArrayList<String>();
|
||||
//public ArrayList<String> allGroupsNames = new ArrayList<String>();
|
||||
//public ArrayList<Integer> allContactsIDs = new ArrayList<Integer>();
|
||||
//public ArrayList<Integer> allGroupsIDs = new ArrayList<Integer>();
|
||||
//public ArrayList<Zone> crtZones = new ArrayList<Zone>();
|
||||
//public ArrayList<Channel> crtChannels = new ArrayList<Channel>();
|
||||
public ArrayAdapter<String> adapter;
|
||||
|
||||
|
||||
/** Methods */
|
||||
//public void onCreate(Bundle savedInstanceState) { };
|
||||
public abstract void startAudioHandler();
|
||||
public void PTTclick(int type) { };
|
||||
/*
|
||||
public abstract void updateRadioTCPdown();
|
||||
public abstract void UpdateRadios(ArrayList<RadioGW> radios);
|
||||
public abstract void UpdateCallTypeChanged(IncCall response);
|
||||
public abstract void UpdateZoneCH(int _radioID, int _GWID, int _zoneNR, int _chNR);
|
||||
public abstract void UpdateRadioStatus(int status);
|
||||
public abstract void UpdateIncCall (IncCall iCall);
|
||||
public abstract String updateUI(EnumCallState radioStatus);
|
||||
public abstract void UpdateEmerg (Emerg emerg);
|
||||
public abstract void onContactsUpdate();
|
||||
*/
|
||||
public abstract void sendPTTFromBlueTooth(boolean on);
|
||||
public abstract void ShowDialog(String title, String errorMsg);
|
||||
public abstract void stopAudioHandler();
|
||||
public abstract Object getAudioHandlerState();
|
||||
public abstract void initUDP();
|
||||
|
||||
|
||||
|
||||
/** Stop the timer that ends call after one minute */
|
||||
public void stopTimerInCall()
|
||||
{
|
||||
timerInCall.cancel();
|
||||
timerInCall.purge();
|
||||
timerInCall = null;
|
||||
}
|
||||
|
||||
|
||||
/** get Group Contact ID from Name */
|
||||
public long getGroupID4Name_old(String name)
|
||||
{
|
||||
try {
|
||||
ListIterator<Contact> it = AppParams.listContacts.listIterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
Contact ctc = it.next();
|
||||
// if searched name - return corresponding id
|
||||
if(ctc.name.equals(name) && ctc.contactType == Contact.GROUP)
|
||||
return ctc.id;
|
||||
}
|
||||
|
||||
long id = -1;
|
||||
|
||||
// try to get id from name because the id was manual dialed
|
||||
try {
|
||||
id = Long.parseLong(name);
|
||||
}
|
||||
catch(Exception ex) {
|
||||
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
catch (ConcurrentModificationException ex) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/** get Private Contact ID from Name */
|
||||
public long getPrivateID4Name_old(String name)
|
||||
{
|
||||
try {
|
||||
ListIterator<Contact> it = AppParams.listContacts.listIterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
Contact ctc = it.next();
|
||||
// if searched name - return corresponding id
|
||||
if(ctc.name.equals(name) && ctc.contactType == Contact.PRIVATE)
|
||||
return ctc.id;
|
||||
}
|
||||
|
||||
long id = -1;
|
||||
|
||||
// try to get id from name because the id was manual dialed
|
||||
try {
|
||||
id = Long.parseLong(name);
|
||||
}
|
||||
catch(Exception ex) {
|
||||
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
catch (ConcurrentModificationException ex) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** get Private Contact ID from Name */
|
||||
public String getName4PrivateID(long id)
|
||||
{
|
||||
try {
|
||||
ListIterator<Contact> it = AppParams.listContacts.listIterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
Contact ctc = it.next();
|
||||
// if searched name - return corresponding id
|
||||
if(ctc.id == id && ctc.contactType == Contact.PRIVATE)
|
||||
return ctc.name;
|
||||
}
|
||||
|
||||
return id+"";
|
||||
}
|
||||
catch (ConcurrentModificationException ex) {
|
||||
return id+"";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** get Group Contact ID from Name */
|
||||
public String getName4GroupID(long id)
|
||||
{
|
||||
try {
|
||||
ListIterator<Contact> it = AppParams.listContacts.listIterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
Contact ctc = it.next();
|
||||
// if searched name - return corresponding id
|
||||
if(ctc.id == id && ctc.contactType == Contact.GROUP)
|
||||
return ctc.name;
|
||||
}
|
||||
|
||||
return id+"";
|
||||
}
|
||||
catch (ConcurrentModificationException ex) {
|
||||
return id+"";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** get zone number from spinner zoneName */
|
||||
public int getNR4Zone_old(String zoneName)
|
||||
{
|
||||
for(Zone zone: AppParams.listZones)
|
||||
if(zone.ZoneName.equals(zoneName))
|
||||
return zone.id;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** get channel number from spinner chName */
|
||||
public int getNR4CH_old(String chName)
|
||||
{
|
||||
for(Channel ch: AppParams.crtZone.channelList)
|
||||
if(ch.chName.equals(chName))
|
||||
return ch.id;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/** get All Contacts Names */
|
||||
public static ArrayList<String> getAllContactsName(String type, ArrayList<Contact> listContacts)
|
||||
{
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
try {
|
||||
ListIterator<Contact> it = listContacts.listIterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
Contact contact = it.next();
|
||||
|
||||
if(type.equals("Call"))
|
||||
list.add(contact.name);
|
||||
else {
|
||||
if((type.equalsIgnoreCase("Private Call") && contact.contactType == Contact.PRIVATE) ||
|
||||
(type.equalsIgnoreCase("Group Call") && contact.contactType == Contact.GROUP))
|
||||
list.add(contact.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ConcurrentModificationException ex) {
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/** get All Contacts Names */
|
||||
public static ArrayList<Long> getAllContactsIDs(String type, ArrayList<Contact> listContacts)
|
||||
{
|
||||
ArrayList<Long> list = new ArrayList<Long>();
|
||||
|
||||
try
|
||||
{
|
||||
ListIterator<Contact> it = listContacts.listIterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
Contact contact = it.next();
|
||||
|
||||
if(type.equals("Call"))
|
||||
list.add((long)contact.id);
|
||||
|
||||
if((type.equalsIgnoreCase("Private Call") && contact.contactType == Contact.PRIVATE) ||
|
||||
(type.equalsIgnoreCase("Group Call") && contact.contactType == Contact.GROUP))
|
||||
list.add((long)contact.id);
|
||||
}
|
||||
|
||||
}
|
||||
catch (ConcurrentModificationException ex) {
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/** Display a toast Message */
|
||||
public void displayToast(String msg)
|
||||
{
|
||||
parentTab.displayToast(msg);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.safemobile.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
public abstract class AbstractRecordingsActivity extends Activity {
|
||||
|
||||
/** Misc */
|
||||
public AbstractParentActivity parentTab;
|
||||
public Activity activity;
|
||||
public Context context;
|
||||
|
||||
public abstract void deleteSelected(final int position);
|
||||
|
||||
}
|
@ -0,0 +1,323 @@
|
||||
package com.safemobile.activities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import com.safemobile.bluetooth.BluetoothTether;
|
||||
import com.safemobile.lib.AppParams;
|
||||
import com.safemobile.lib.SM;
|
||||
import com.safemobile.lib.SuperVehicle;
|
||||
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;
|
||||
|
||||
@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;
|
||||
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;
|
||||
|
||||
/** TCP */
|
||||
protected TCPhandler tcp = null;
|
||||
protected TCPmsgParser tcpParser = null;
|
||||
|
||||
/** Methods */
|
||||
public abstract void displayToast(final String msg);
|
||||
public abstract void whenBackPressed(AppParams.ActivityResult result);
|
||||
public abstract void changeLanguage();
|
||||
public abstract void enableMenuButtons(boolean enable);
|
||||
public abstract void setRadioActivity(AbstractRadioActivity radioActivity);
|
||||
public abstract void setLiveActivity(AbstractLiveActivity liveActivity);
|
||||
public abstract void setMessagesActivity(AbstractMessagesActivity messageActivity);
|
||||
|
||||
/** get if TCP is connected or disconnected or null */
|
||||
public Object getTCPState() {
|
||||
// return true if tcp connection is on, false if not connected and null
|
||||
|
||||
if(tcp!=null && tcp.isConnectionUP)
|
||||
return "true";
|
||||
else if(tcp!=null && !tcp.isConnectionUP)
|
||||
return "false";
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract void unregisterReceivers(BroadcastReceiver receiver);
|
||||
public abstract void cancelNotification(int drawable);
|
||||
public abstract void stopTCP();
|
||||
public abstract void stopTCPParser();
|
||||
public abstract void executeNetworkStuff(String[] params);
|
||||
public abstract void recreateTCPConnection();
|
||||
public abstract void removeITCPListener();
|
||||
|
||||
|
||||
public abstract void updateDemoPosition();
|
||||
public abstract void updateResultsPollInUi(String type);
|
||||
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)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#21#" + AppParams.USERID + "#");
|
||||
if(res && displayLogCat)
|
||||
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)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#25#" + userID + "#");
|
||||
if(res && displayLogCat)
|
||||
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)
|
||||
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);
|
||||
else
|
||||
SM.Debug("Could not send message(Option4Unit)!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/** get Last SMSs for an user */
|
||||
public boolean getLastSMSs(int userID)
|
||||
{
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#23#" + userID + "#");
|
||||
if(res && displayLogCat)
|
||||
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)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#22#"+sc_id+"#" +timeGMT+"#");
|
||||
if(res && displayLogCat)
|
||||
SM.Debug("#Send Request#", "Message [getRecentSMSs] sent to app server");
|
||||
else
|
||||
SM.Debug("#Send Request#", "Could not send message [getRecentSMSs]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/** send a SMS to a vehicle
|
||||
* @param seqID is a unique identifier for the SMS
|
||||
* @param sc_id vehicle imei to which you want to send the SMS
|
||||
* @param txt the message to be send */
|
||||
public boolean sendSMS(String seqID, int sc_id, String txt)
|
||||
{
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write(seqID, "#24#" + AppParams.USERID + "#" + sc_id + "#" + txt + "#");
|
||||
if(res && displayLogCat)
|
||||
SM.Debug("Message [sendSMS] sent to app server sc_id:"+sc_id+ " txt:"+txt);
|
||||
else
|
||||
SM.Debug("Could not send message [sendSMS]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public boolean sendAlarmAcknoledge(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);
|
||||
else
|
||||
SM.Debug("Could not send message [sendAlarmAcknoledge]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public boolean sendPlayRecordingRequest(long record_id)
|
||||
{
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#18#" + record_id + "#");
|
||||
if(res)
|
||||
SM.Debug("Message [sendPlayRecordingRequest] sent to app server record_id:"+record_id);
|
||||
else
|
||||
SM.Debug("Could not send message [sendPlayRecordingRequest]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public boolean sendDekey(int gwID, int radioID)
|
||||
{
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#30#160#" + gwID + "." + radioID + "#");
|
||||
if(res)
|
||||
SM.Debug("Message [sendDekey] sent to app server record_id");
|
||||
else
|
||||
SM.Debug("Could not send message [sendDeKey]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public boolean getHistoryPositions(int sc_id, long timeGMTStart, long timeGMTStop)
|
||||
{
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
String histSeqID = "1."+Integer.toString((int) (System.currentTimeMillis() / 1000L));
|
||||
boolean res = tcp.Write(histSeqID,"#26#"+sc_id+"#"+timeGMTStart+"#"+timeGMTStop+"#");
|
||||
if(res)
|
||||
SM.Debug("Message [getHistoryPositions] sent to app server");
|
||||
else
|
||||
SM.Debug("Could not send message [getHistoryPositions]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public boolean getRadiosList()
|
||||
{
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#30#100#");
|
||||
if(res)
|
||||
SM.Debug("Message [getRadiosList] sent to app server");
|
||||
else
|
||||
SM.Debug("Could not send message [getRadiosList]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// if zoneNr=0 and channelNR =0 then function acts as GET
|
||||
public boolean getSetZoneAndChannel(int gwID, int rgwID, int zoneNR, int channelNR)
|
||||
{
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#30#104#" + gwID + "#" + rgwID + "#" + zoneNR + "#" +channelNR +"#");
|
||||
if(res)
|
||||
SM.Debug("Message [GetSetZoneAndChannel] sent to app server zoneNR:"+zoneNR+ " channelNR:"+channelNR);
|
||||
else
|
||||
SM.Debug("Could not send message [GetSetZoneAndChannel]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public boolean getRadioStatus(int gwID, int rgwID)
|
||||
{
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#30#99#" + gwID + "#" + rgwID + "#");
|
||||
if(res)
|
||||
SM.Debug("Message [RadioGetRadioList] sent to app server || gwID: " + gwID + " | rgwID: " + rgwID);
|
||||
else
|
||||
SM.Debug("Could not send message [getLastSMS]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public boolean getAlarms(long userID)
|
||||
{
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#27#" + userID + "#"); // = tcp.Write("0.0", "#30#99#" + gwID + "#" + rgwID + "#");
|
||||
if(res)
|
||||
SM.Debug("Message [GetAlarms] sent to app server");
|
||||
else
|
||||
SM.Debug("Could not send message [GetAlarms]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public boolean getRecordings(int gwID, int radioID)
|
||||
{
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#29#"+AppParams.USERID+"#"+ gwID +"#"+ radioID +"#");
|
||||
if(res)
|
||||
SM.Debug("Message [GetRecordings] sent to app server");
|
||||
else
|
||||
SM.Debug("Could not send message [GetRecordings]!!");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//public abstract void getVehiclePosition(long imei);
|
||||
/*
|
||||
public abstract void onResume();
|
||||
public abstract void onStart();
|
||||
public abstract void onPause();
|
||||
*/
|
||||
}
|
Reference in New Issue
Block a user