package b4a.bbb;


import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.objects.ServiceHelper;
import anywheresoftware.b4a.debug.*;

public class collecte_data_sensor extends  android.app.Service{
	public static class collecte_data_sensor_BR extends android.content.BroadcastReceiver {

		@Override
		public void onReceive(android.content.Context context, android.content.Intent intent) {
            BA.LogInfo("** Receiver (collecte_data_sensor) OnReceive **");
			android.content.Intent in = new android.content.Intent(context, collecte_data_sensor.class);
			if (intent != null)
				in.putExtra("b4a_internal_intent", intent);
            ServiceHelper.StarterHelper.startServiceFromReceiver (context, in, false, anywheresoftware.b4a.ShellBA.class);
		}

	}
    static collecte_data_sensor mostCurrent;
	public static BA processBA;
    private ServiceHelper _service;
    public static Class<?> getObject() {
		return collecte_data_sensor.class;
	}
	@Override
	public void onCreate() {
        super.onCreate();
        mostCurrent = this;
        if (processBA == null) {
		    processBA = new anywheresoftware.b4a.ShellBA(this, null, null, "b4a.bbb", "b4a.bbb.collecte_data_sensor");
            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, "b4a.bbb.collecte_data_sensor", processBA, _service, anywheresoftware.b4a.keywords.Common.Density);
		}
        if (!false && ServiceHelper.StarterHelper.startFromServiceCreate(processBA, false) == false) {
				
		}
		else {
            processBA.setActivityPaused(false);
            BA.LogInfo("*** Service (collecte_data_sensor) Create ***");
            processBA.raiseEvent(null, "service_create");
        }
        processBA.runHook("oncreate", this, null);
        if (false) {
			ServiceHelper.StarterHelper.runWaitForLayouts();
		}
    }
		@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 (collecte_data_sensor) 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 (collecte_data_sensor) 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");
    		}
    	}
    }
	
	@Override
	public void onDestroy() {
        super.onDestroy();
        if (false) {
            BA.LogInfo("** Service (collecte_data_sensor) Destroy (ignored)**");
        }
        else {
            BA.LogInfo("** Service (collecte_data_sensor) 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.objects.BleManager2 _manager = null;
public static String _currentstatetext = "";
public static int _currentstate = 0;
public static boolean _connected = false;
public static String _connectedname = "";
public static anywheresoftware.b4a.objects.collections.List _connectedservices = null;
public static anywheresoftware.b4a.objects.RuntimePermissions _rp = null;
public static anywheresoftware.b4a.agraham.byteconverter.ByteConverter _bc = null;
public static int _delai_collecte = 0;
public static String _service_battery = "";
public static String _level_battery = "";
public static String _service_temperature = "";
public static String _temperature = "";
public static String _temp_sensor = "";
public static String _hydro_sensor = "";
public static anywheresoftware.b4a.phone.Phone _phone1 = null;
public static b4a.bbb.nb6 _notif_mess = null;
public static anywheresoftware.b4a.objects.NotificationWrapper _notif_sensor = null;
public static anywheresoftware.b4a.objects.collections.List _list_data_temp = null;
public static String _id_sensor = "";
public static String _local_sensor = "";
public static String _mac_adress_sensor = "";
public static String _offset_temp = "";
public static int _oompteur_sensor = 0;
public static boolean _endofmesure = false;
public static String _local_home = "";
public static String _ident_sensor = "";
public static anywheresoftware.b4a.objects.Timer _timer1 = null;
public static int _delay = 0;
public static b4a.bbb.httpjob _process_http = null;
public b4a.bbb.main _main = null;
public b4a.bbb.starter _starter = null;
public b4a.bbb.param _param = null;
public b4a.bbb.setup _setup = null;
public b4a.bbb.cockpit _cockpit = null;
public b4a.bbb.httputils2service _httputils2service = null;
public static String  _disconnect() throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "disconnect", false))
	 {return ((String) Debug.delegate(processBA, "disconnect", null));}
RDebugUtils.currentLine=4456448;
 //BA.debugLineNum = 4456448;BA.debugLine="Public Sub Disconnect";
RDebugUtils.currentLine=4456449;
 //BA.debugLineNum = 4456449;BA.debugLine="manager.Disconnect";
_manager.Disconnect();
RDebugUtils.currentLine=4456450;
 //BA.debugLineNum = 4456450;BA.debugLine="Manager_Disconnected";
_manager_disconnected();
RDebugUtils.currentLine=4456451;
 //BA.debugLineNum = 4456451;BA.debugLine="End Sub";
return "";
}
public static String  _readdata() throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "readdata", false))
	 {return ((String) Debug.delegate(processBA, "readdata", null));}
String _s = "";
RDebugUtils.currentLine=4390912;
 //BA.debugLineNum = 4390912;BA.debugLine="Public Sub ReadData";
RDebugUtils.currentLine=4390913;
 //BA.debugLineNum = 4390913;BA.debugLine="For Each s As String In ConnectedServices";
{
final anywheresoftware.b4a.BA.IterableList group1 = _connectedservices;
final int groupLen1 = group1.getSize()
;int index1 = 0;
;
for (; index1 < groupLen1;index1++){
_s = BA.ObjectToString(group1.Get(index1));
RDebugUtils.currentLine=4390914;
 //BA.debugLineNum = 4390914;BA.debugLine="manager.ReadData(s)";
_manager.ReadData(_s);
 }
};
RDebugUtils.currentLine=4390916;
 //BA.debugLineNum = 4390916;BA.debugLine="End Sub";
return "";
}
public static boolean  _application_error(anywheresoftware.b4a.objects.B4AException _error,String _stacktrace) throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "application_error", false))
	 {return ((Boolean) Debug.delegate(processBA, "application_error", new Object[] {_error,_stacktrace}));}
RDebugUtils.currentLine=4849664;
 //BA.debugLineNum = 4849664;BA.debugLine="Sub Application_Error (Error As Exception, StackTr";
RDebugUtils.currentLine=4849665;
 //BA.debugLineNum = 4849665;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=4849666;
 //BA.debugLineNum = 4849666;BA.debugLine="End Sub";
return false;
}
public static Object  _createfileprovideruri(String _dir,String _filename) throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "createfileprovideruri", false))
	 {return ((Object) Debug.delegate(processBA, "createfileprovideruri", new Object[] {_dir,_filename}));}
anywheresoftware.b4j.object.JavaObject _fileprovider = null;
anywheresoftware.b4j.object.JavaObject _context = null;
anywheresoftware.b4j.object.JavaObject _f = null;
RDebugUtils.currentLine=4063232;
 //BA.debugLineNum = 4063232;BA.debugLine="Sub CreateFileProviderUri (Dir As String, FileName";
RDebugUtils.currentLine=4063233;
 //BA.debugLineNum = 4063233;BA.debugLine="Dim FileProvider As JavaObject";
_fileprovider = new anywheresoftware.b4j.object.JavaObject();
RDebugUtils.currentLine=4063234;
 //BA.debugLineNum = 4063234;BA.debugLine="Dim context As JavaObject";
_context = new anywheresoftware.b4j.object.JavaObject();
RDebugUtils.currentLine=4063235;
 //BA.debugLineNum = 4063235;BA.debugLine="context.InitializeContext";
_context.InitializeContext(processBA);
RDebugUtils.currentLine=4063236;
 //BA.debugLineNum = 4063236;BA.debugLine="FileProvider.InitializeStatic(\"android.support.v4";
_fileprovider.InitializeStatic("android.support.v4.content.FileProvider");
RDebugUtils.currentLine=4063237;
 //BA.debugLineNum = 4063237;BA.debugLine="Dim f As JavaObject";
_f = new anywheresoftware.b4j.object.JavaObject();
RDebugUtils.currentLine=4063238;
 //BA.debugLineNum = 4063238;BA.debugLine="f.InitializeNewInstance(\"java.io.File\", Array(Dir";
_f.InitializeNewInstance("java.io.File",new Object[]{(Object)(_dir),(Object)(_filename)});
RDebugUtils.currentLine=4063239;
 //BA.debugLineNum = 4063239;BA.debugLine="Return FileProvider.RunMethod(\"getUriForFile\", Ar";
if (true) return _fileprovider.RunMethod("getUriForFile",new Object[]{(Object)(_context.getObject()),(Object)(anywheresoftware.b4a.keywords.Common.Application.getPackageName()+".provider"),(Object)(_f.getObject())});
RDebugUtils.currentLine=4063240;
 //BA.debugLineNum = 4063240;BA.debugLine="End Sub";
return null;
}
public static String  _manager_disconnected() throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "manager_disconnected", false))
	 {return ((String) Debug.delegate(processBA, "manager_disconnected", null));}
RDebugUtils.currentLine=4653056;
 //BA.debugLineNum = 4653056;BA.debugLine="Sub Manager_Disconnected";
RDebugUtils.currentLine=4653057;
 //BA.debugLineNum = 4653057;BA.debugLine="Log(\"Disconnected\")";
anywheresoftware.b4a.keywords.Common.LogImpl("64653057","Disconnected",0);
RDebugUtils.currentLine=4653058;
 //BA.debugLineNum = 4653058;BA.debugLine="connected = False";
_connected = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=4653059;
 //BA.debugLineNum = 4653059;BA.debugLine="notif_sensor = notif_mess.Build(\"Sensor Salle\" ,T";
_notif_sensor = _notif_mess._build /*anywheresoftware.b4a.objects.NotificationWrapper*/ (null,(Object)("Sensor Salle"),(Object)(_temp_sensor),"Mess_off",(Object)(mostCurrent._main.getObject()));
RDebugUtils.currentLine=4653060;
 //BA.debugLineNum = 4653060;BA.debugLine="notif_sensor.Notify(1)";
_notif_sensor.Notify((int) (1));
RDebugUtils.currentLine=4653061;
 //BA.debugLineNum = 4653061;BA.debugLine="list_data_temp.Add(Id_sensor & \";\" & Local_sensor";
_list_data_temp.Add((Object)(_id_sensor+";"+_local_sensor+";"+_mac_adress_sensor+";"+_temp_sensor+";"+_hydro_sensor+";"+_offset_temp));
RDebugUtils.currentLine=4653068;
 //BA.debugLineNum = 4653068;BA.debugLine="If endofmesure=True Then";
if (_endofmesure==anywheresoftware.b4a.keywords.Common.True) { 
RDebugUtils.currentLine=4653069;
 //BA.debugLineNum = 4653069;BA.debugLine="Upload_file";
_upload_file();
RDebugUtils.currentLine=4653070;
 //BA.debugLineNum = 4653070;BA.debugLine="End_service";
_end_service();
 };
RDebugUtils.currentLine=4653073;
 //BA.debugLineNum = 4653073;BA.debugLine="End Sub";
return "";
}
public static String  _end_service() throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "end_service", false))
	 {return ((String) Debug.delegate(processBA, "end_service", null));}
RDebugUtils.currentLine=4915200;
 //BA.debugLineNum = 4915200;BA.debugLine="Sub End_service";
RDebugUtils.currentLine=4915202;
 //BA.debugLineNum = 4915202;BA.debugLine="StartServiceAt(Me,DateTime.Now + delai_collecte*6";
anywheresoftware.b4a.keywords.Common.StartServiceAt(processBA,collecte_data_sensor.getObject(),(long) (anywheresoftware.b4a.keywords.Common.DateTime.getNow()+_delai_collecte*60000),anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=4915204;
 //BA.debugLineNum = 4915204;BA.debugLine="If phone1.SdkVersion>=26 Then";
if (_phone1.getSdkVersion()>=26) { 
RDebugUtils.currentLine=4915205;
 //BA.debugLineNum = 4915205;BA.debugLine="Service.StopAutomaticForeground 'Call this when";
mostCurrent._service.StopAutomaticForeground();
 }else {
RDebugUtils.currentLine=4915207;
 //BA.debugLineNum = 4915207;BA.debugLine="StopService(Me)";
anywheresoftware.b4a.keywords.Common.StopService(processBA,collecte_data_sensor.getObject());
 };
RDebugUtils.currentLine=4915209;
 //BA.debugLineNum = 4915209;BA.debugLine="End Sub";
return "";
}
public static String  _manager_connected(anywheresoftware.b4a.objects.collections.List _services) throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "manager_connected", false))
	 {return ((String) Debug.delegate(processBA, "manager_connected", new Object[] {_services}));}
RDebugUtils.currentLine=4784128;
 //BA.debugLineNum = 4784128;BA.debugLine="Sub Manager_Connected (services As List)";
RDebugUtils.currentLine=4784129;
 //BA.debugLineNum = 4784129;BA.debugLine="Log(\"Connected\")";
anywheresoftware.b4a.keywords.Common.LogImpl("64784129","Connected",0);
RDebugUtils.currentLine=4784130;
 //BA.debugLineNum = 4784130;BA.debugLine="connected = True";
_connected = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=4784131;
 //BA.debugLineNum = 4784131;BA.debugLine="ConnectedServices = services";
_connectedservices = _services;
RDebugUtils.currentLine=4784133;
 //BA.debugLineNum = 4784133;BA.debugLine="manager.SetNotify(service_Temperature,Temperature";
_manager.SetNotify(_service_temperature,_temperature,anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=4784135;
 //BA.debugLineNum = 4784135;BA.debugLine="End Sub";
return "";
}
public static String  _manager_dataavailable(String _serviceid,anywheresoftware.b4a.objects.collections.Map _characteristics) throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "manager_dataavailable", false))
	 {return ((String) Debug.delegate(processBA, "manager_dataavailable", new Object[] {_serviceid,_characteristics}));}
String _id = "";
byte[] _value = null;
String[] _data_sensor = null;
RDebugUtils.currentLine=4587520;
 //BA.debugLineNum = 4587520;BA.debugLine="Sub Manager_DataAvailable (ServiceId As String, Ch";
RDebugUtils.currentLine=4587521;
 //BA.debugLineNum = 4587521;BA.debugLine="For Each id As String In Characteristics.Keys";
{
final anywheresoftware.b4a.BA.IterableList group1 = _characteristics.Keys();
final int groupLen1 = group1.getSize()
;int index1 = 0;
;
for (; index1 < groupLen1;index1++){
_id = BA.ObjectToString(group1.Get(index1));
RDebugUtils.currentLine=4587522;
 //BA.debugLineNum = 4587522;BA.debugLine="Dim value() As Byte=Characteristics.Get(id)";
_value = (byte[])(_characteristics.Get((Object)(_id)));
RDebugUtils.currentLine=4587523;
 //BA.debugLineNum = 4587523;BA.debugLine="If ServiceId=service_battery Then";
if ((_serviceid).equals(_service_battery)) { 
RDebugUtils.currentLine=4587525;
 //BA.debugLineNum = 4587525;BA.debugLine="Log(\"Level Battery : \" & value(0) & \"%\")";
anywheresoftware.b4a.keywords.Common.LogImpl("64587525","Level Battery : "+BA.NumberToString(_value[(int) (0)])+"%",0);
 }else {
RDebugUtils.currentLine=4587527;
 //BA.debugLineNum = 4587527;BA.debugLine="Log(BytesToString(value, 0, value.Length, \"UTF8";
anywheresoftware.b4a.keywords.Common.LogImpl("64587527",anywheresoftware.b4a.keywords.Common.BytesToString(_value,(int) (0),_value.length,"UTF8"),0);
RDebugUtils.currentLine=4587528;
 //BA.debugLineNum = 4587528;BA.debugLine="Dim data_sensor() As String= Regex.Split(\" \", B";
_data_sensor = anywheresoftware.b4a.keywords.Common.Regex.Split(" ",anywheresoftware.b4a.keywords.Common.BytesToString(_value,(int) (0),_value.length,"UTF8"));
RDebugUtils.currentLine=4587529;
 //BA.debugLineNum = 4587529;BA.debugLine="Temp_sensor=data_sensor(0)";
_temp_sensor = _data_sensor[(int) (0)];
RDebugUtils.currentLine=4587530;
 //BA.debugLineNum = 4587530;BA.debugLine="Hydro_sensor=data_sensor(1)";
_hydro_sensor = _data_sensor[(int) (1)];
 };
 }
};
RDebugUtils.currentLine=4587533;
 //BA.debugLineNum = 4587533;BA.debugLine="End Sub";
return "";
}
public static String  _manager_devicefound(String _name,String _id,anywheresoftware.b4a.objects.collections.Map _advertisingdata,double _rssi) throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "manager_devicefound", false))
	 {return ((String) Debug.delegate(processBA, "manager_devicefound", new Object[] {_name,_id,_advertisingdata,_rssi}));}
String _sensors_list = "";
String[] _sensors_list1 = null;
RDebugUtils.currentLine=4325376;
 //BA.debugLineNum = 4325376;BA.debugLine="Sub Manager_DeviceFound (Name As String, Id As Str";
RDebugUtils.currentLine=4325377;
 //BA.debugLineNum = 4325377;BA.debugLine="Log(\"Found: \" & Name & \", \" & Id & \", RSSI = \" &";
anywheresoftware.b4a.keywords.Common.LogImpl("64325377","Found: "+_name+", "+_id+", RSSI = "+BA.NumberToString(_rssi)+", "+BA.ObjectToString(_advertisingdata),0);
RDebugUtils.currentLine=4325390;
 //BA.debugLineNum = 4325390;BA.debugLine="If  Name=\"MJ_HT_V1\"  Then 'Filtrage sur le modèle";
if ((_name).equals("MJ_HT_V1")) { 
RDebugUtils.currentLine=4325391;
 //BA.debugLineNum = 4325391;BA.debugLine="delay=0 'Remise à zéro du timeout";
_delay = (int) (0);
RDebugUtils.currentLine=4325392;
 //BA.debugLineNum = 4325392;BA.debugLine="For Each sensors_list As String In Param.list_Re";
{
final anywheresoftware.b4a.BA.IterableList group4 = mostCurrent._param._list_read /*anywheresoftware.b4a.objects.collections.List*/ ;
final int groupLen4 = group4.getSize()
;int index4 = 0;
;
for (; index4 < groupLen4;index4++){
_sensors_list = BA.ObjectToString(group4.Get(index4));
RDebugUtils.currentLine=4325393;
 //BA.debugLineNum = 4325393;BA.debugLine="Dim sensors_list1() As String= Regex.Split(\";\",";
_sensors_list1 = anywheresoftware.b4a.keywords.Common.Regex.Split(";",_sensors_list);
RDebugUtils.currentLine=4325395;
 //BA.debugLineNum = 4325395;BA.debugLine="If sensors_list1.Length=4 Then";
if (_sensors_list1.length==4) { 
RDebugUtils.currentLine=4325396;
 //BA.debugLineNum = 4325396;BA.debugLine="If Id=sensors_list1(2) Then 'recherche l'adres";
if ((_id).equals(_sensors_list1[(int) (2)])) { 
RDebugUtils.currentLine=4325397;
 //BA.debugLineNum = 4325397;BA.debugLine="oompteur_sensor=oompteur_sensor+1";
_oompteur_sensor = (int) (_oompteur_sensor+1);
RDebugUtils.currentLine=4325398;
 //BA.debugLineNum = 4325398;BA.debugLine="manager.Connect2(Id,False) 'disabling auto co";
_manager.Connect2(_id,anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=4325399;
 //BA.debugLineNum = 4325399;BA.debugLine="Id_sensor =sensors_list1(0)";
_id_sensor = _sensors_list1[(int) (0)];
RDebugUtils.currentLine=4325400;
 //BA.debugLineNum = 4325400;BA.debugLine="Local_sensor= sensors_list1(1)";
_local_sensor = _sensors_list1[(int) (1)];
RDebugUtils.currentLine=4325401;
 //BA.debugLineNum = 4325401;BA.debugLine="Mac_Adress_Sensor=sensors_list1(2)";
_mac_adress_sensor = _sensors_list1[(int) (2)];
RDebugUtils.currentLine=4325402;
 //BA.debugLineNum = 4325402;BA.debugLine="Offset_temp=sensors_list1(3)";
_offset_temp = _sensors_list1[(int) (3)];
 };
 };
RDebugUtils.currentLine=4325406;
 //BA.debugLineNum = 4325406;BA.debugLine="If sensors_list1.Length=1 Then 'récupère le lie";
if (_sensors_list1.length==1) { 
RDebugUtils.currentLine=4325407;
 //BA.debugLineNum = 4325407;BA.debugLine="If sensors_list1(0).Contains(\"[\") Then";
if (_sensors_list1[(int) (0)].contains("[")) { 
RDebugUtils.currentLine=4325408;
 //BA.debugLineNum = 4325408;BA.debugLine="local_Home=sensors_list1(0)";
_local_home = _sensors_list1[(int) (0)];
 };
 };
 }
};
RDebugUtils.currentLine=4325415;
 //BA.debugLineNum = 4325415;BA.debugLine="If oompteur_sensor = Param.list_Read.Size-1 Then";
if (_oompteur_sensor==mostCurrent._param._list_read /*anywheresoftware.b4a.objects.collections.List*/ .getSize()-1) { 
RDebugUtils.currentLine=4325416;
 //BA.debugLineNum = 4325416;BA.debugLine="endofmesure=True";
_endofmesure = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=4325417;
 //BA.debugLineNum = 4325417;BA.debugLine="manager.StopScan";
_manager.StopScan();
 };
 };
RDebugUtils.currentLine=4325422;
 //BA.debugLineNum = 4325422;BA.debugLine="End Sub";
return "";
}
public static String  _upload_file() throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "upload_file", false))
	 {return ((String) Debug.delegate(processBA, "upload_file", null));}
RDebugUtils.currentLine=4718592;
 //BA.debugLineNum = 4718592;BA.debugLine="Sub Upload_file";
RDebugUtils.currentLine=4718594;
 //BA.debugLineNum = 4718594;BA.debugLine="End Sub";
return "";
}
public static String  _manager_statechanged(int _state) throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "manager_statechanged", false))
	 {return ((String) Debug.delegate(processBA, "manager_statechanged", new Object[] {_state}));}
RDebugUtils.currentLine=4521984;
 //BA.debugLineNum = 4521984;BA.debugLine="Sub Manager_StateChanged (State As Int)";
RDebugUtils.currentLine=4521985;
 //BA.debugLineNum = 4521985;BA.debugLine="Select State";
switch (BA.switchObjectToInt(_state,_manager.STATE_POWERED_OFF,_manager.STATE_POWERED_ON,_manager.STATE_UNSUPPORTED)) {
case 0: {
RDebugUtils.currentLine=4521987;
 //BA.debugLineNum = 4521987;BA.debugLine="currentStateText = \"POWERED OFF\"";
_currentstatetext = "POWERED OFF";
 break; }
case 1: {
RDebugUtils.currentLine=4521989;
 //BA.debugLineNum = 4521989;BA.debugLine="currentStateText = \"POWERED ON\"";
_currentstatetext = "POWERED ON";
 break; }
case 2: {
RDebugUtils.currentLine=4521991;
 //BA.debugLineNum = 4521991;BA.debugLine="currentStateText = \"UNSUPPORTED\"";
_currentstatetext = "UNSUPPORTED";
 break; }
}
;
RDebugUtils.currentLine=4521993;
 //BA.debugLineNum = 4521993;BA.debugLine="currentState = State";
_currentstate = _state;
RDebugUtils.currentLine=4521995;
 //BA.debugLineNum = 4521995;BA.debugLine="End Sub";
return "";
}
public static String  _scan_sensor() throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "scan_sensor", false))
	 {return ((String) Debug.delegate(processBA, "scan_sensor", null));}
RDebugUtils.currentLine=4194304;
 //BA.debugLineNum = 4194304;BA.debugLine="Sub scan_Sensor";
RDebugUtils.currentLine=4194305;
 //BA.debugLineNum = 4194305;BA.debugLine="manager.scan2(Null,False)";
_manager.Scan2((anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(anywheresoftware.b4a.keywords.Common.Null)),anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=4194306;
 //BA.debugLineNum = 4194306;BA.debugLine="End Sub";
return "";
}
public static String  _service_create() throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "service_create", false))
	 {return ((String) Debug.delegate(processBA, "service_create", null));}
String _folder = "";
anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper _show_icon = null;
RDebugUtils.currentLine=3997696;
 //BA.debugLineNum = 3997696;BA.debugLine="Sub Service_Create";
RDebugUtils.currentLine=3997698;
 //BA.debugLineNum = 3997698;BA.debugLine="manager.Initialize(\"manager\")";
_manager.Initialize(processBA,"manager");
RDebugUtils.currentLine=3997700;
 //BA.debugLineNum = 3997700;BA.debugLine="list_data_temp.Initialize";
_list_data_temp.Initialize();
RDebugUtils.currentLine=3997701;
 //BA.debugLineNum = 3997701;BA.debugLine="process_http.Initialize(\"\",Me)";
_process_http._initialize /*String*/ (null,processBA,"",collecte_data_sensor.getObject());
RDebugUtils.currentLine=3997702;
 //BA.debugLineNum = 3997702;BA.debugLine="endofmesure=False";
_endofmesure = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=3997704;
 //BA.debugLineNum = 3997704;BA.debugLine="Timer1.Initialize(\"timer1\", 1000)";
_timer1.Initialize(processBA,"timer1",(long) (1000));
RDebugUtils.currentLine=3997709;
 //BA.debugLineNum = 3997709;BA.debugLine="Dim folder As String = rp.GetSafeDirDefaultExtern";
_folder = _rp.GetSafeDirDefaultExternal("shared");
RDebugUtils.currentLine=3997712;
 //BA.debugLineNum = 3997712;BA.debugLine="Dim show_icon As Bitmap";
_show_icon = new anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper();
RDebugUtils.currentLine=3997713;
 //BA.debugLineNum = 3997713;BA.debugLine="show_icon= LoadBitmapResize(File.DirAssets, \"Logo";
_show_icon = anywheresoftware.b4a.keywords.Common.LoadBitmapResize(anywheresoftware.b4a.keywords.Common.File.getDirAssets(),"Logo_MM.png",anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (32)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (32)),anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=3997714;
 //BA.debugLineNum = 3997714;BA.debugLine="notif_mess.Initialize(\"custom sound1\", Applicatio";
_notif_mess._initialize /*b4a.bbb.nb6*/ (null,processBA,"custom sound1",(Object)(anywheresoftware.b4a.keywords.Common.Application.getLabelName()),"DEFAULT")._autocancel /*b4a.bbb.nb6*/ (null,anywheresoftware.b4a.keywords.Common.True)._badgeicontype /*b4a.bbb.nb6*/ (null,"LARGE");
RDebugUtils.currentLine=3997715;
 //BA.debugLineNum = 3997715;BA.debugLine="notif_mess.SmallIcon(show_icon)";
_notif_mess._smallicon /*b4a.bbb.nb6*/ (null,_show_icon);
RDebugUtils.currentLine=3997716;
 //BA.debugLineNum = 3997716;BA.debugLine="notif_mess.SetDefaults(True, True, False)";
_notif_mess._setdefaults /*b4a.bbb.nb6*/ (null,anywheresoftware.b4a.keywords.Common.True,anywheresoftware.b4a.keywords.Common.True,anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=3997721;
 //BA.debugLineNum = 3997721;BA.debugLine="If phone1.SdkVersion>=26 Then";
if (_phone1.getSdkVersion()>=26) { 
RDebugUtils.currentLine=3997722;
 //BA.debugLineNum = 3997722;BA.debugLine="Service.AutomaticForegroundMode =  Service.AUTOM";
mostCurrent._service.AutomaticForegroundMode = mostCurrent._service.AUTOMATIC_FOREGROUND_ALWAYS;
 };
RDebugUtils.currentLine=3997725;
 //BA.debugLineNum = 3997725;BA.debugLine="End Sub";
return "";
}
public static String  _service_destroy() throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "service_destroy", false))
	 {return ((String) Debug.delegate(processBA, "service_destroy", null));}
RDebugUtils.currentLine=4980736;
 //BA.debugLineNum = 4980736;BA.debugLine="Sub Service_Destroy";
RDebugUtils.currentLine=4980738;
 //BA.debugLineNum = 4980738;BA.debugLine="End Sub";
return "";
}
public static String  _service_start(anywheresoftware.b4a.objects.IntentWrapper _startingintent) throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "service_start", false))
	 {return ((String) Debug.delegate(processBA, "service_start", new Object[] {_startingintent}));}
RDebugUtils.currentLine=4128768;
 //BA.debugLineNum = 4128768;BA.debugLine="Sub Service_Start (StartingIntent As Intent)";
RDebugUtils.currentLine=4128772;
 //BA.debugLineNum = 4128772;BA.debugLine="If manager.State <> manager.STATE_POWERED_ON Then";
if (_manager.getState()!=_manager.STATE_POWERED_ON) { 
RDebugUtils.currentLine=4128773;
 //BA.debugLineNum = 4128773;BA.debugLine="Log(\"Not powered on.\")";
anywheresoftware.b4a.keywords.Common.LogImpl("64128773","Not powered on.",0);
 }else 
{RDebugUtils.currentLine=4128774;
 //BA.debugLineNum = 4128774;BA.debugLine="Else If rp.Check(rp.PERMISSION_ACCESS_COARSE_LOCA";
if (_rp.Check(_rp.PERMISSION_ACCESS_COARSE_LOCATION)==anywheresoftware.b4a.keywords.Common.False) { 
RDebugUtils.currentLine=4128775;
 //BA.debugLineNum = 4128775;BA.debugLine="Log(\"No location permission.\")";
anywheresoftware.b4a.keywords.Common.LogImpl("64128775","No location permission.",0);
 }else {
RDebugUtils.currentLine=4128780;
 //BA.debugLineNum = 4128780;BA.debugLine="Param.read_file_setup(\"setup.txt\")";
mostCurrent._param._read_file_setup /*String*/ (processBA,"setup.txt");
RDebugUtils.currentLine=4128781;
 //BA.debugLineNum = 4128781;BA.debugLine="Timer1.Enabled = True";
_timer1.setEnabled(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=4128782;
 //BA.debugLineNum = 4128782;BA.debugLine="manager.scan(Null)";
_manager.Scan((anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(anywheresoftware.b4a.keywords.Common.Null)));
 }}
;
RDebugUtils.currentLine=4128786;
 //BA.debugLineNum = 4128786;BA.debugLine="End Sub";
return "";
}
public static String  _timer1_tick() throws Exception{
RDebugUtils.currentModule="collecte_data_sensor";
if (Debug.shouldDelegate(processBA, "timer1_tick", false))
	 {return ((String) Debug.delegate(processBA, "timer1_tick", null));}
RDebugUtils.currentLine=4259840;
 //BA.debugLineNum = 4259840;BA.debugLine="Sub Timer1_Tick";
RDebugUtils.currentLine=4259842;
 //BA.debugLineNum = 4259842;BA.debugLine="delay=delay+1";
_delay = (int) (_delay+1);
RDebugUtils.currentLine=4259844;
 //BA.debugLineNum = 4259844;BA.debugLine="If delay > 30 Then 'Si le délai d'attente de scan";
if (_delay>30) { 
RDebugUtils.currentLine=4259846;
 //BA.debugLineNum = 4259846;BA.debugLine="delay=0";
_delay = (int) (0);
RDebugUtils.currentLine=4259847;
 //BA.debugLineNum = 4259847;BA.debugLine="endofmesure=True";
_endofmesure = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=4259848;
 //BA.debugLineNum = 4259848;BA.debugLine="manager.StopScan";
_manager.StopScan();
RDebugUtils.currentLine=4259849;
 //BA.debugLineNum = 4259849;BA.debugLine="Upload_file";
_upload_file();
RDebugUtils.currentLine=4259850;
 //BA.debugLineNum = 4259850;BA.debugLine="End_service";
_end_service();
 };
RDebugUtils.currentLine=4259853;
 //BA.debugLineNum = 4259853;BA.debugLine="End Sub";
return "";
}
}