package com.merosee.bustrack.driver;


import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.objects.ServiceHelper;
import anywheresoftware.b4a.debug.*;

public class trackingservice extends android.app.Service{
	public static class trackingservice_BR extends android.content.BroadcastReceiver {

		@Override
		public void onReceive(android.content.Context context, android.content.Intent intent) {
            BA.LogInfo("** Receiver (trackingservice) OnReceive **");
			android.content.Intent in = new android.content.Intent(context, trackingservice.class);
			if (intent != null)
				in.putExtra("b4a_internal_intent", intent);
            ServiceHelper.StarterHelper.startServiceFromReceiver (context, in, false, BA.class);
		}

	}
    static trackingservice mostCurrent;
	public static BA processBA;
    private ServiceHelper _service;
    public static Class<?> getObject() {
		return trackingservice.class;
	}
	@Override
	public void onCreate() {
        super.onCreate();
        mostCurrent = this;
        if (processBA == null) {
		    processBA = new BA(this, null, null, "com.merosee.bustrack.driver", "com.merosee.bustrack.driver.trackingservice");
            if (BA.isShellModeRuntimeCheck(processBA)) {
                processBA.raiseEvent2(null, true, "SHELL", false);
		    }
            try {
                Class.forName(BA.applicationContext.getPackageName() + ".main").getMethod("initializeProcessGlobals").invoke(null, null);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            processBA.loadHtSubs(this.getClass());
            ServiceHelper.init();
        }
        _service = new ServiceHelper(this);
        processBA.service = this;
        
        if (BA.isShellModeRuntimeCheck(processBA)) {
			processBA.raiseEvent2(null, true, "CREATE", true, "com.merosee.bustrack.driver.trackingservice", processBA, _service, anywheresoftware.b4a.keywords.Common.Density);
		}
        if (!false && ServiceHelper.StarterHelper.startFromServiceCreate(processBA, false) == false) {
				
		}
		else {
            processBA.setActivityPaused(false);
            BA.LogInfo("*** Service (trackingservice) Create ***");
            processBA.raiseEvent(null, "service_create");
        }
        processBA.runHook("oncreate", this, null);
        if (false) {
			if (ServiceHelper.StarterHelper.runWaitForLayouts() == false) {
                BA.LogInfo("stopping spontaneous created service");
                stopSelf();
            }
		}
    }
		@Override
	public void onStart(android.content.Intent intent, int startId) {
		onStartCommand(intent, 0, 0);
    }
    @Override
    public int onStartCommand(final android.content.Intent intent, int flags, int startId) {
    	if (ServiceHelper.StarterHelper.onStartCommand(processBA, new Runnable() {
            public void run() {
                handleStart(intent);
            }}))
			;
		else {
			ServiceHelper.StarterHelper.addWaitForLayout (new Runnable() {
				public void run() {
                    processBA.setActivityPaused(false);
                    BA.LogInfo("** Service (trackingservice) Create **");
                    processBA.raiseEvent(null, "service_create");
					handleStart(intent);
                    ServiceHelper.StarterHelper.removeWaitForLayout();
				}
			});
		}
        processBA.runHook("onstartcommand", this, new Object[] {intent, flags, startId});
		return android.app.Service.START_NOT_STICKY;
    }
    public void onTaskRemoved(android.content.Intent rootIntent) {
        super.onTaskRemoved(rootIntent);
        if (false)
            processBA.raiseEvent(null, "service_taskremoved");
            
    }
    private void handleStart(android.content.Intent intent) {
    	BA.LogInfo("** Service (trackingservice) Start **");
    	java.lang.reflect.Method startEvent = processBA.htSubs.get("service_start");
    	if (startEvent != null) {
    		if (startEvent.getParameterTypes().length > 0) {
    			anywheresoftware.b4a.objects.IntentWrapper iw = ServiceHelper.StarterHelper.handleStartIntent(intent, _service, processBA);
    			processBA.raiseEvent(null, "service_start", iw);
    		}
    		else {
    			processBA.raiseEvent(null, "service_start");
    		}
    	}
    }

	public void onTimeout(int startId) {
        BA.LogInfo("** Service (trackingservice) Timeout **");
        anywheresoftware.b4a.objects.collections.Map params = new anywheresoftware.b4a.objects.collections.Map();
        params.Initialize();
        params.Put("StartId", startId);
        processBA.raiseEvent(null, "service_timeout", params);
            
    }
	@Override
	public void onDestroy() {
        super.onDestroy();
        if (false) {
            BA.LogInfo("** Service (trackingservice) Destroy (ignored)**");
        }
        else {
            BA.LogInfo("** Service (trackingservice) Destroy **");
		    processBA.raiseEvent(null, "service_destroy");
            processBA.service = null;
		    mostCurrent = null;
		    processBA.setActivityPaused(true);
            processBA.runHook("ondestroy", this, null);
        }
	}

@Override
	public android.os.IBinder onBind(android.content.Intent intent) {
		return null;
	}public anywheresoftware.b4a.keywords.Common __c = null;
public static anywheresoftware.b4a.gps.GPS _gps1 = null;
public static anywheresoftware.b4a.objects.Timer _trackingtimer = null;
public static boolean _istracking = false;
public static long _lastupdatetimestamp = 0L;
public static long _minupdateinterval = 0L;
public static double _lastlat = 0;
public static double _lastlon = 0;
public static anywheresoftware.b4a.phone.Phone.PhoneWakeState _pw = null;
public com.merosee.bustrack.driver.main _main = null;
public com.merosee.bustrack.driver.starter _starter = null;
public com.merosee.bustrack.driver.apimodule _apimodule = null;
public com.merosee.bustrack.driver.httputils2service _httputils2service = null;
public static anywheresoftware.b4a.objects.NotificationWrapper  _createnotification(String _title,String _body) throws Exception{
anywheresoftware.b4a.objects.NotificationWrapper _n = null;
 //BA.debugLineNum = 155;BA.debugLine="Sub CreateNotification(title As String, body As St";
 //BA.debugLineNum = 156;BA.debugLine="Dim n As Notification";
_n = new anywheresoftware.b4a.objects.NotificationWrapper();
 //BA.debugLineNum = 159;BA.debugLine="n.Initialize2(3)";
_n.Initialize2((int) (3));
 //BA.debugLineNum = 160;BA.debugLine="n.Icon = \"icon\"";
_n.setIcon("icon");
 //BA.debugLineNum = 161;BA.debugLine="n.SetInfo(title, body, Main)";
_n.SetInfoNew(processBA,BA.ObjectToCharSequence(_title),BA.ObjectToCharSequence(_body),(Object)(mostCurrent._main.getObject()));
 //BA.debugLineNum = 163;BA.debugLine="Return n";
if (true) return _n;
 //BA.debugLineNum = 164;BA.debugLine="End Sub";
return null;
}
public static int  _getbatterylevel() throws Exception{
anywheresoftware.b4j.object.JavaObject _jo = null;
anywheresoftware.b4j.object.JavaObject _filter = null;
anywheresoftware.b4a.objects.IntentWrapper _intent1 = null;
int _level = 0;
int _scale = 0;
 //BA.debugLineNum = 139;BA.debugLine="Sub GetBatteryLevel As Int";
 //BA.debugLineNum = 140;BA.debugLine="Try";
try { //BA.debugLineNum = 141;BA.debugLine="Dim jo As JavaObject";
_jo = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 142;BA.debugLine="jo.InitializeContext";
_jo.InitializeContext(processBA);
 //BA.debugLineNum = 143;BA.debugLine="Dim filter As JavaObject";
_filter = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 144;BA.debugLine="filter.InitializeNewInstance(\"android.content.In";
_filter.InitializeNewInstance("android.content.IntentFilter",new Object[]{(Object)("android.intent.action.BATTERY_CHANGED")});
 //BA.debugLineNum = 145;BA.debugLine="Dim intent1 As Intent = jo.RunMethod(\"registerRe";
_intent1 = new anywheresoftware.b4a.objects.IntentWrapper();
_intent1 = (anywheresoftware.b4a.objects.IntentWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.IntentWrapper(), (android.content.Intent)(_jo.RunMethod("registerReceiver",new Object[]{anywheresoftware.b4a.keywords.Common.Null,(Object)(_filter.getObject())})));
 //BA.debugLineNum = 146;BA.debugLine="Dim level As Int = intent1.GetExtra(\"level\")";
_level = (int)(BA.ObjectToNumber(_intent1.GetExtra("level")));
 //BA.debugLineNum = 147;BA.debugLine="Dim scale As Int = intent1.GetExtra(\"scale\")";
_scale = (int)(BA.ObjectToNumber(_intent1.GetExtra("scale")));
 //BA.debugLineNum = 148;BA.debugLine="Return (level / scale) * 100";
if (true) return (int) ((_level/(double)_scale)*100);
 } 
       catch (Exception e11) {
			processBA.setLastException(e11); //BA.debugLineNum = 150;BA.debugLine="Log(\"Error getting battery level: \" & LastExcept";
anywheresoftware.b4a.keywords.Common.LogImpl("22752523","Error getting battery level: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(processBA)),0);
 //BA.debugLineNum = 151;BA.debugLine="Return 100";
if (true) return (int) (100);
 };
 //BA.debugLineNum = 153;BA.debugLine="End Sub";
return 0;
}
public static String  _gps_locationchanged(anywheresoftware.b4a.gps.LocationWrapper _location1) throws Exception{
 //BA.debugLineNum = 60;BA.debugLine="Sub GPS_LocationChanged (Location1 As Location)";
 //BA.debugLineNum = 61;BA.debugLine="LastLat = Location1.Latitude";
_lastlat = _location1.getLatitude();
 //BA.debugLineNum = 62;BA.debugLine="LastLon = Location1.Longitude";
_lastlon = _location1.getLongitude();
 //BA.debugLineNum = 64;BA.debugLine="If IsTracking Then";
if (_istracking) { 
 //BA.debugLineNum = 65;BA.debugLine="SendLocation(LastLat, LastLon)";
_sendlocation(_lastlat,_lastlon);
 };
 //BA.debugLineNum = 67;BA.debugLine="End Sub";
return "";
}
public static String  _jobdone(com.merosee.bustrack.driver.httpjob _job) throws Exception{
anywheresoftware.b4a.objects.collections.JSONParser _parser = null;
anywheresoftware.b4a.objects.collections.Map _root = null;
String _sstatus = "";
 //BA.debugLineNum = 115;BA.debugLine="Sub JobDone(Job As HttpJob)";
 //BA.debugLineNum = 116;BA.debugLine="If Job.Success Then";
if (_job._success /*boolean*/ ) { 
 //BA.debugLineNum = 117;BA.debugLine="Log(\"Server received update successfully\")";
anywheresoftware.b4a.keywords.Common.LogImpl("22686978","Server received update successfully",0);
 //BA.debugLineNum = 119;BA.debugLine="Try";
try { //BA.debugLineNum = 120;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 121;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 122;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 123;BA.debugLine="Dim sStatus As String = root.GetDefault(\"tracki";
_sstatus = BA.ObjectToString(_root.GetDefault((Object)("tracking_status"),(Object)("active")));
 //BA.debugLineNum = 124;BA.debugLine="If sStatus = \"stop\" Then";
if ((_sstatus).equals("stop")) { 
 //BA.debugLineNum = 125;BA.debugLine="Log(\"Remote stop command received\")";
anywheresoftware.b4a.keywords.Common.LogImpl("22686986","Remote stop command received",0);
 //BA.debugLineNum = 126;BA.debugLine="StopTracking";
_stoptracking();
 };
 } 
       catch (Exception e13) {
			processBA.setLastException(e13); //BA.debugLineNum = 129;BA.debugLine="Log(\"Error parsing server response: \" & LastExc";
anywheresoftware.b4a.keywords.Common.LogImpl("22686990","Error parsing server response: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(processBA)),0);
 };
 }else {
 //BA.debugLineNum = 132;BA.debugLine="Log(\"Update failed: \" & Job.ErrorMessage)";
anywheresoftware.b4a.keywords.Common.LogImpl("22686993","Update failed: "+_job._errormessage /*String*/ ,0);
 };
 //BA.debugLineNum = 134;BA.debugLine="Job.Release";
_job._release /*String*/ ();
 //BA.debugLineNum = 135;BA.debugLine="End Sub";
return "";
}
public static String  _process_globals() throws Exception{
 //BA.debugLineNum = 7;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 8;BA.debugLine="Private GPS1 As GPS";
_gps1 = new anywheresoftware.b4a.gps.GPS();
 //BA.debugLineNum = 9;BA.debugLine="Private TrackingTimer As Timer";
_trackingtimer = new anywheresoftware.b4a.objects.Timer();
 //BA.debugLineNum = 10;BA.debugLine="Public IsTracking As Boolean = False";
_istracking = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 11;BA.debugLine="Private LastUpdateTimestamp As Long = 0";
_lastupdatetimestamp = (long) (0);
 //BA.debugLineNum = 12;BA.debugLine="Private MinUpdateInterval As Long = 10000 ' 10 se";
_minupdateinterval = (long) (10000);
 //BA.debugLineNum = 13;BA.debugLine="Private LastLat, LastLon As Double";
_lastlat = 0;
_lastlon = 0;
 //BA.debugLineNum = 14;BA.debugLine="Private pw As PhoneWakeState";
_pw = new anywheresoftware.b4a.phone.Phone.PhoneWakeState();
 //BA.debugLineNum = 15;BA.debugLine="End Sub";
return "";
}
public static String  _sendlocation(double _lat,double _lon) throws Exception{
long _now = 0L;
int _batt = 0;
anywheresoftware.b4a.objects.collections.Map _data = null;
anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator _json = null;
com.merosee.bustrack.driver.httpjob _job = null;
anywheresoftware.b4j.object.JavaObject _jo = null;
 //BA.debugLineNum = 79;BA.debugLine="Sub SendLocation(lat As Double, lon As Double)";
 //BA.debugLineNum = 81;BA.debugLine="Dim now As Long = DateTime.Now";
_now = anywheresoftware.b4a.keywords.Common.DateTime.getNow();
 //BA.debugLineNum = 82;BA.debugLine="If now < LastUpdateTimestamp + MinUpdateInterval";
if (_now<_lastupdatetimestamp+_minupdateinterval) { 
 //BA.debugLineNum = 83;BA.debugLine="Return";
if (true) return "";
 };
 //BA.debugLineNum = 86;BA.debugLine="LastUpdateTimestamp = now";
_lastupdatetimestamp = _now;
 //BA.debugLineNum = 87;BA.debugLine="Dim batt As Int = GetBatteryLevel";
_batt = _getbatterylevel();
 //BA.debugLineNum = 89;BA.debugLine="Log(\"Sending update: \" & lat & \", \" & lon & \" (Ba";
anywheresoftware.b4a.keywords.Common.LogImpl("22621450","Sending update: "+BA.NumberToString(_lat)+", "+BA.NumberToString(_lon)+" (Batt: "+BA.NumberToString(_batt)+"%)",0);
 //BA.debugLineNum = 91;BA.debugLine="Dim data As Map";
_data = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 92;BA.debugLine="data.Initialize";
_data.Initialize();
 //BA.debugLineNum = 93;BA.debugLine="data.Put(\"latitude\", lat)";
_data.Put((Object)("latitude"),(Object)(_lat));
 //BA.debugLineNum = 94;BA.debugLine="data.Put(\"longitude\", lon)";
_data.Put((Object)("longitude"),(Object)(_lon));
 //BA.debugLineNum = 95;BA.debugLine="data.Put(\"battery_level\", GetBatteryLevel)";
_data.Put((Object)("battery_level"),(Object)(_getbatterylevel()));
 //BA.debugLineNum = 97;BA.debugLine="Dim json As JSONGenerator";
_json = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 98;BA.debugLine="json.Initialize(data)";
_json.Initialize(_data);
 //BA.debugLineNum = 100;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 101;BA.debugLine="job.Initialize(\"status\", Me)";
_job._initialize /*String*/ (processBA,"status",trackingservice.getObject());
 //BA.debugLineNum = 102;BA.debugLine="job.PostString(APIModule.ServerURL & \"/status.php";
_job._poststring /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/status.php",_json.ToString());
 //BA.debugLineNum = 105;BA.debugLine="APIModule.SetAuthHeader(job, APIModule.GetToken)";
mostCurrent._apimodule._setauthheader /*String*/ (processBA,_job,mostCurrent._apimodule._gettoken /*String*/ (processBA));
 //BA.debugLineNum = 106;BA.debugLine="Try";
try { //BA.debugLineNum = 108;BA.debugLine="Dim jo As JavaObject = job.GetRequest";
_jo = new anywheresoftware.b4j.object.JavaObject();
_jo = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_job._getrequest /*anywheresoftware.b4h.okhttp.OkHttpClientWrapper.OkHttpRequest*/ ()));
 //BA.debugLineNum = 109;BA.debugLine="jo.RunMethod(\"setTimeout\", Array(30000))";
_jo.RunMethod("setTimeout",new Object[]{(Object)(30000)});
 } 
       catch (Exception e23) {
			processBA.setLastException(e23); //BA.debugLineNum = 111;BA.debugLine="Log(\"Error setting timeout: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("22621472","Error setting timeout: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(processBA)),0);
 };
 //BA.debugLineNum = 113;BA.debugLine="End Sub";
return "";
}
public static String  _service_create() throws Exception{
 //BA.debugLineNum = 17;BA.debugLine="Sub Service_Create";
 //BA.debugLineNum = 18;BA.debugLine="GPS1.Initialize(\"GPS\")";
_gps1.Initialize("GPS");
 //BA.debugLineNum = 19;BA.debugLine="TrackingTimer.Initialize(\"TrackingTimer\", 15000)";
_trackingtimer.Initialize(processBA,"TrackingTimer",(long) (15000));
 //BA.debugLineNum = 20;BA.debugLine="End Sub";
return "";
}
public static String  _service_destroy() throws Exception{
 //BA.debugLineNum = 27;BA.debugLine="Sub Service_Destroy";
 //BA.debugLineNum = 28;BA.debugLine="StopTracking";
_stoptracking();
 //BA.debugLineNum = 29;BA.debugLine="End Sub";
return "";
}
public static String  _service_start(anywheresoftware.b4a.objects.IntentWrapper _startingintent) throws Exception{
 //BA.debugLineNum = 22;BA.debugLine="Sub Service_Start (StartingIntent As Intent)";
 //BA.debugLineNum = 24;BA.debugLine="Service.StartForeground(1, CreateNotification(\"Bu";
mostCurrent._service.StartForeground((int) (1),(android.app.Notification)(_createnotification("Bus Tracking Active","Updating location in real-time...").getObject()));
 //BA.debugLineNum = 25;BA.debugLine="End Sub";
return "";
}
public static String  _starttracking() throws Exception{
 //BA.debugLineNum = 31;BA.debugLine="Public Sub StartTracking";
 //BA.debugLineNum = 32;BA.debugLine="Try";
try { //BA.debugLineNum = 33;BA.debugLine="If Not(GPS1.GPSEnabled) Then";
if (anywheresoftware.b4a.keywords.Common.Not(_gps1.getGPSEnabled())) { 
 //BA.debugLineNum = 34;BA.debugLine="ToastMessageShow(\"Please enable GPS on your dev";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Please enable GPS on your device"),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 35;BA.debugLine="Return";
if (true) return "";
 };
 //BA.debugLineNum = 39;BA.debugLine="pw.PartialLock";
_pw.PartialLock(processBA);
 //BA.debugLineNum = 41;BA.debugLine="GPS1.Start(0, 0)";
_gps1.Start(processBA,(long) (0),(float) (0));
 //BA.debugLineNum = 42;BA.debugLine="TrackingTimer.Enabled = True";
_trackingtimer.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 43;BA.debugLine="IsTracking = True";
_istracking = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 44;BA.debugLine="Log(\"Tracking started successfully\")";
anywheresoftware.b4a.keywords.Common.LogImpl("22359309","Tracking started successfully",0);
 } 
       catch (Exception e12) {
			processBA.setLastException(e12); //BA.debugLineNum = 46;BA.debugLine="Log(\"Error in StartTracking: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("22359311","Error in StartTracking: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(processBA)),0);
 //BA.debugLineNum = 47;BA.debugLine="ToastMessageShow(\"Error starting GPS\", True)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Error starting GPS"),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 48;BA.debugLine="IsTracking = False";
_istracking = anywheresoftware.b4a.keywords.Common.False;
 };
 //BA.debugLineNum = 50;BA.debugLine="End Sub";
return "";
}
public static String  _stoptracking() throws Exception{
 //BA.debugLineNum = 52;BA.debugLine="Public Sub StopTracking";
 //BA.debugLineNum = 53;BA.debugLine="GPS1.Stop";
_gps1.Stop();
 //BA.debugLineNum = 54;BA.debugLine="TrackingTimer.Enabled = False";
_trackingtimer.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 55;BA.debugLine="IsTracking = False";
_istracking = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 56;BA.debugLine="pw.ReleaseKeepAlive ' Corrected B4A method";
_pw.ReleaseKeepAlive();
 //BA.debugLineNum = 57;BA.debugLine="Log(\"Tracking stopped\")";
anywheresoftware.b4a.keywords.Common.LogImpl("22424837","Tracking stopped",0);
 //BA.debugLineNum = 58;BA.debugLine="End Sub";
return "";
}
public static String  _trackingtimer_tick() throws Exception{
 //BA.debugLineNum = 69;BA.debugLine="Sub TrackingTimer_Tick";
 //BA.debugLineNum = 70;BA.debugLine="If Not(IsTracking) Then Return";
if (anywheresoftware.b4a.keywords.Common.Not(_istracking)) { 
if (true) return "";};
 //BA.debugLineNum = 73;BA.debugLine="Log(\"Tracking heartbeat check...\")";
anywheresoftware.b4a.keywords.Common.LogImpl("22555908","Tracking heartbeat check...",0);
 //BA.debugLineNum = 74;BA.debugLine="If LastLat <> 0 And LastLon <> 0 Then";
if (_lastlat!=0 && _lastlon!=0) { 
 //BA.debugLineNum = 75;BA.debugLine="SendLocation(LastLat, LastLon)";
_sendlocation(_lastlat,_lastlon);
 };
 //BA.debugLineNum = 77;BA.debugLine="End Sub";
return "";
}
}
