package b4a.bbb;

import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.pc.*;

public class starter_subs_0 {


public static RemoteObject  _application_error(RemoteObject _error,RemoteObject _stacktrace) throws Exception{
try {
		Debug.PushSubsStack("Application_Error (starter) ","starter",1,starter.processBA,starter.mostCurrent,99);
if (RapidSub.canDelegate("application_error")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","application_error", _error, _stacktrace);}
Debug.locals.put("Error", _error);
Debug.locals.put("StackTrace", _stacktrace);
 BA.debugLineNum = 99;BA.debugLine="Sub Application_Error (Error As Exception, StackTr";
Debug.ShouldStop(4);
 BA.debugLineNum = 100;BA.debugLine="Return True";
Debug.ShouldStop(8);
if (true) return starter.mostCurrent.__c.getField(true,"True");
 BA.debugLineNum = 101;BA.debugLine="End Sub";
Debug.ShouldStop(16);
return RemoteObject.createImmutable(false);
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _disconnect() throws Exception{
try {
		Debug.PushSubsStack("Disconnect (starter) ","starter",1,starter.processBA,starter.mostCurrent,33);
if (RapidSub.canDelegate("disconnect")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","disconnect");}
 BA.debugLineNum = 33;BA.debugLine="Public Sub Disconnect";
Debug.ShouldStop(1);
 BA.debugLineNum = 34;BA.debugLine="manager.Disconnect";
Debug.ShouldStop(2);
starter._manager.runVoidMethod ("Disconnect");
 BA.debugLineNum = 35;BA.debugLine="Manager_Disconnected";
Debug.ShouldStop(4);
_manager_disconnected();
 BA.debugLineNum = 36;BA.debugLine="End Sub";
Debug.ShouldStop(8);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _manager_connected(RemoteObject _services) throws Exception{
try {
		Debug.PushSubsStack("Manager_Connected (starter) ","starter",1,starter.processBA,starter.mostCurrent,91);
if (RapidSub.canDelegate("manager_connected")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","manager_connected", _services);}
Debug.locals.put("services", _services);
 BA.debugLineNum = 91;BA.debugLine="Sub Manager_Connected (services As List)";
Debug.ShouldStop(67108864);
 BA.debugLineNum = 92;BA.debugLine="Log(\"Connected\")";
Debug.ShouldStop(134217728);
starter.mostCurrent.__c.runVoidMethod ("LogImpl","61703937",RemoteObject.createImmutable("Connected"),0);
 BA.debugLineNum = 93;BA.debugLine="connected = True";
Debug.ShouldStop(268435456);
starter._connected = starter.mostCurrent.__c.getField(true,"True");
 BA.debugLineNum = 94;BA.debugLine="ConnectedServices = services";
Debug.ShouldStop(536870912);
starter._connectedservices = _services;
 BA.debugLineNum = 95;BA.debugLine="CallSub(Main, \"StateChanged\")";
Debug.ShouldStop(1073741824);
starter.mostCurrent.__c.runMethodAndSync(false,"CallSubNew",starter.processBA,(Object)((starter.mostCurrent._main.getObject())),(Object)(RemoteObject.createImmutable("StateChanged")));
 BA.debugLineNum = 96;BA.debugLine="End Sub";
Debug.ShouldStop(-2147483648);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _manager_dataavailable(RemoteObject _serviceid,RemoteObject _characteristics) throws Exception{
try {
		Debug.PushSubsStack("Manager_DataAvailable (starter) ","starter",1,starter.processBA,starter.mostCurrent,81);
if (RapidSub.canDelegate("manager_dataavailable")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","manager_dataavailable", _serviceid, _characteristics);}
Debug.locals.put("ServiceId", _serviceid);
Debug.locals.put("Characteristics", _characteristics);
 BA.debugLineNum = 81;BA.debugLine="Sub Manager_DataAvailable (ServiceId As String, Ch";
Debug.ShouldStop(65536);
 BA.debugLineNum = 82;BA.debugLine="CallSub3(Main, \"DataAvailable\", ServiceId, Charac";
Debug.ShouldStop(131072);
starter.mostCurrent.__c.runMethodAndSync(false,"CallSubNew3",starter.processBA,(Object)((starter.mostCurrent._main.getObject())),(Object)(BA.ObjectToString("DataAvailable")),(Object)((_serviceid)),(Object)((_characteristics)));
 BA.debugLineNum = 83;BA.debugLine="End Sub";
Debug.ShouldStop(262144);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _manager_devicefound(RemoteObject _name,RemoteObject _id,RemoteObject _advertisingdata,RemoteObject _rssi) throws Exception{
try {
		Debug.PushSubsStack("Manager_DeviceFound (starter) ","starter",1,starter.processBA,starter.mostCurrent,51);
if (RapidSub.canDelegate("manager_devicefound")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","manager_devicefound", _name, _id, _advertisingdata, _rssi);}
Debug.locals.put("Name", _name);
Debug.locals.put("Id", _id);
Debug.locals.put("AdvertisingData", _advertisingdata);
Debug.locals.put("RSSI", _rssi);
 BA.debugLineNum = 51;BA.debugLine="Sub Manager_DeviceFound (Name As String, Id As Str";
Debug.ShouldStop(262144);
 BA.debugLineNum = 52;BA.debugLine="Log(\"Found: \" & Name & \", \" & Id & \", RSSI = \" &";
Debug.ShouldStop(524288);
starter.mostCurrent.__c.runVoidMethod ("LogImpl","61441793",RemoteObject.concat(RemoteObject.createImmutable("Found: "),_name,RemoteObject.createImmutable(", "),_id,RemoteObject.createImmutable(", RSSI = "),_rssi,RemoteObject.createImmutable(", "),_advertisingdata),0);
 BA.debugLineNum = 54;BA.debugLine="If Name=\"MJ_HT_V1\" Then 'filtre sur le model de s";
Debug.ShouldStop(2097152);
if (RemoteObject.solveBoolean("=",_name,BA.ObjectToString("MJ_HT_V1"))) { 
 BA.debugLineNum = 56;BA.debugLine="CallSub3(Setup,\"add_list_service\",Name,Id & \";\"";
Debug.ShouldStop(8388608);
starter.mostCurrent.__c.runMethodAndSync(false,"CallSubNew3",starter.processBA,(Object)((starter.mostCurrent._setup.getObject())),(Object)(BA.ObjectToString("add_list_service")),(Object)((_name)),(Object)((RemoteObject.concat(_id,RemoteObject.createImmutable(";"),_rssi))));
 };
 BA.debugLineNum = 69;BA.debugLine="End Sub";
Debug.ShouldStop(16);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _manager_disconnected() throws Exception{
try {
		Debug.PushSubsStack("Manager_Disconnected (starter) ","starter",1,starter.processBA,starter.mostCurrent,85);
if (RapidSub.canDelegate("manager_disconnected")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","manager_disconnected");}
 BA.debugLineNum = 85;BA.debugLine="Sub Manager_Disconnected";
Debug.ShouldStop(1048576);
 BA.debugLineNum = 86;BA.debugLine="Log(\"Disconnected\")";
Debug.ShouldStop(2097152);
starter.mostCurrent.__c.runVoidMethod ("LogImpl","61638401",RemoteObject.createImmutable("Disconnected"),0);
 BA.debugLineNum = 87;BA.debugLine="connected = False";
Debug.ShouldStop(4194304);
starter._connected = starter.mostCurrent.__c.getField(true,"False");
 BA.debugLineNum = 88;BA.debugLine="CallSub(Main, \"StateChanged\")";
Debug.ShouldStop(8388608);
starter.mostCurrent.__c.runMethodAndSync(false,"CallSubNew",starter.processBA,(Object)((starter.mostCurrent._main.getObject())),(Object)(RemoteObject.createImmutable("StateChanged")));
 BA.debugLineNum = 89;BA.debugLine="End Sub";
Debug.ShouldStop(16777216);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _manager_statechanged(RemoteObject _state) throws Exception{
try {
		Debug.PushSubsStack("Manager_StateChanged (starter) ","starter",1,starter.processBA,starter.mostCurrent,38);
if (RapidSub.canDelegate("manager_statechanged")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","manager_statechanged", _state);}
Debug.locals.put("State", _state);
 BA.debugLineNum = 38;BA.debugLine="Sub Manager_StateChanged (State As Int)";
Debug.ShouldStop(32);
 BA.debugLineNum = 39;BA.debugLine="Select State";
Debug.ShouldStop(64);
switch (BA.switchObjectToInt(_state,starter._manager.getField(true,"STATE_POWERED_OFF"),starter._manager.getField(true,"STATE_POWERED_ON"),starter._manager.getField(true,"STATE_UNSUPPORTED"))) {
case 0: {
 BA.debugLineNum = 41;BA.debugLine="currentStateText = \"POWERED OFF\"";
Debug.ShouldStop(256);
starter._currentstatetext = BA.ObjectToString("POWERED OFF");
 break; }
case 1: {
 BA.debugLineNum = 43;BA.debugLine="currentStateText = \"POWERED ON\"";
Debug.ShouldStop(1024);
starter._currentstatetext = BA.ObjectToString("POWERED ON");
 break; }
case 2: {
 BA.debugLineNum = 45;BA.debugLine="currentStateText = \"UNSUPPORTED\"";
Debug.ShouldStop(4096);
starter._currentstatetext = BA.ObjectToString("UNSUPPORTED");
 break; }
}
;
 BA.debugLineNum = 47;BA.debugLine="currentState = State";
Debug.ShouldStop(16384);
starter._currentstate = _state;
 BA.debugLineNum = 48;BA.debugLine="CallSub(Setup, \"StateChanged\")";
Debug.ShouldStop(32768);
starter.mostCurrent.__c.runMethodAndSync(false,"CallSubNew",starter.processBA,(Object)((starter.mostCurrent._setup.getObject())),(Object)(RemoteObject.createImmutable("StateChanged")));
 BA.debugLineNum = 49;BA.debugLine="End Sub";
Debug.ShouldStop(65536);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _process_globals() throws Exception{
 //BA.debugLineNum = 6;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 7;BA.debugLine="Public manager As BleManager2";
starter._manager = RemoteObject.createNew ("anywheresoftware.b4a.objects.BleManager2");
 //BA.debugLineNum = 8;BA.debugLine="Public currentStateText As String = \"UNKNOWN\"";
starter._currentstatetext = BA.ObjectToString("UNKNOWN");
 //BA.debugLineNum = 9;BA.debugLine="Public currentState As Int";
starter._currentstate = RemoteObject.createImmutable(0);
 //BA.debugLineNum = 10;BA.debugLine="Public connected As Boolean = False";
starter._connected = starter.mostCurrent.__c.getField(true,"False");
 //BA.debugLineNum = 11;BA.debugLine="Public ConnectedName As String";
starter._connectedname = RemoteObject.createImmutable("");
 //BA.debugLineNum = 12;BA.debugLine="Private ConnectedServices As List";
starter._connectedservices = RemoteObject.createNew ("anywheresoftware.b4a.objects.collections.List");
 //BA.debugLineNum = 13;BA.debugLine="Public rp As RuntimePermissions";
starter._rp = RemoteObject.createNew ("anywheresoftware.b4a.objects.RuntimePermissions");
 //BA.debugLineNum = 14;BA.debugLine="Public bc As ByteConverter";
starter._bc = RemoteObject.createNew ("anywheresoftware.b4a.agraham.byteconverter.ByteConverter");
 //BA.debugLineNum = 16;BA.debugLine="End Sub";
return RemoteObject.createImmutable("");
}
public static RemoteObject  _readdata() throws Exception{
try {
		Debug.PushSubsStack("ReadData (starter) ","starter",1,starter.processBA,starter.mostCurrent,27);
if (RapidSub.canDelegate("readdata")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","readdata");}
RemoteObject _s = RemoteObject.createImmutable("");
 BA.debugLineNum = 27;BA.debugLine="Public Sub ReadData";
Debug.ShouldStop(67108864);
 BA.debugLineNum = 28;BA.debugLine="For Each s As String In ConnectedServices";
Debug.ShouldStop(134217728);
{
final RemoteObject group1 = starter._connectedservices;
final int groupLen1 = group1.runMethod(true,"getSize").<Integer>get()
;int index1 = 0;
;
for (; index1 < groupLen1;index1++){
_s = BA.ObjectToString(group1.runMethod(false,"Get",index1));Debug.locals.put("s", _s);
Debug.locals.put("s", _s);
 BA.debugLineNum = 29;BA.debugLine="manager.ReadData(s)";
Debug.ShouldStop(268435456);
starter._manager.runVoidMethod ("ReadData",(Object)(_s));
 }
}Debug.locals.put("s", _s);
;
 BA.debugLineNum = 31;BA.debugLine="End Sub";
Debug.ShouldStop(1073741824);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _service_create() throws Exception{
try {
		Debug.PushSubsStack("Service_Create (starter) ","starter",1,starter.processBA,starter.mostCurrent,18);
if (RapidSub.canDelegate("service_create")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","service_create");}
 BA.debugLineNum = 18;BA.debugLine="Sub Service_Create";
Debug.ShouldStop(131072);
 BA.debugLineNum = 19;BA.debugLine="manager.Initialize(\"manager\")";
Debug.ShouldStop(262144);
starter._manager.runVoidMethod ("Initialize",starter.processBA,(Object)(RemoteObject.createImmutable("manager")));
 BA.debugLineNum = 20;BA.debugLine="StartService(Collecte_data_sensor)";
Debug.ShouldStop(524288);
starter.mostCurrent.__c.runVoidMethod ("StartService",starter.processBA,(Object)((starter.mostCurrent._collecte_data_sensor.getObject())));
 BA.debugLineNum = 21;BA.debugLine="End Sub";
Debug.ShouldStop(1048576);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _service_destroy() throws Exception{
try {
		Debug.PushSubsStack("Service_Destroy (starter) ","starter",1,starter.processBA,starter.mostCurrent,103);
if (RapidSub.canDelegate("service_destroy")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","service_destroy");}
 BA.debugLineNum = 103;BA.debugLine="Sub Service_Destroy";
Debug.ShouldStop(64);
 BA.debugLineNum = 105;BA.debugLine="End Sub";
Debug.ShouldStop(256);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _service_start(RemoteObject _startingintent) throws Exception{
try {
		Debug.PushSubsStack("Service_Start (starter) ","starter",1,starter.processBA,starter.mostCurrent,23);
if (RapidSub.canDelegate("service_start")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","service_start", _startingintent);}
Debug.locals.put("StartingIntent", _startingintent);
 BA.debugLineNum = 23;BA.debugLine="Sub Service_Start (StartingIntent As Intent)";
Debug.ShouldStop(4194304);
 BA.debugLineNum = 25;BA.debugLine="End Sub";
Debug.ShouldStop(16777216);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _startscan() throws Exception{
try {
		Debug.PushSubsStack("StartScan (starter) ","starter",1,starter.processBA,starter.mostCurrent,71);
if (RapidSub.canDelegate("startscan")) { return b4a.bbb.starter.remoteMe.runUserSub(false, "starter","startscan");}
 BA.debugLineNum = 71;BA.debugLine="Public Sub StartScan";
Debug.ShouldStop(64);
 BA.debugLineNum = 72;BA.debugLine="If manager.State <> manager.STATE_POWERED_ON Then";
Debug.ShouldStop(128);
if (RemoteObject.solveBoolean("!",starter._manager.runMethod(true,"getState"),BA.numberCast(double.class, starter._manager.getField(true,"STATE_POWERED_ON")))) { 
 BA.debugLineNum = 73;BA.debugLine="Log(\"Not powered on.\")";
Debug.ShouldStop(256);
starter.mostCurrent.__c.runVoidMethod ("LogImpl","61507330",RemoteObject.createImmutable("Not powered on."),0);
 }else 
{ BA.debugLineNum = 74;BA.debugLine="Else If rp.Check(rp.PERMISSION_ACCESS_COARSE_LOCA";
Debug.ShouldStop(512);
if (RemoteObject.solveBoolean("=",starter._rp.runMethod(true,"Check",(Object)(starter._rp.getField(true,"PERMISSION_ACCESS_COARSE_LOCATION"))),starter.mostCurrent.__c.getField(true,"False"))) { 
 BA.debugLineNum = 75;BA.debugLine="Log(\"No location permission.\")";
Debug.ShouldStop(1024);
starter.mostCurrent.__c.runVoidMethod ("LogImpl","61507332",RemoteObject.createImmutable("No location permission."),0);
 }else {
 BA.debugLineNum = 77;BA.debugLine="manager.Scan2(Null, False)";
Debug.ShouldStop(4096);
starter._manager.runVoidMethod ("Scan2",RemoteObject.declareNull("anywheresoftware.b4a.AbsObjectWrapper").runMethod(false, "ConvertToWrapper", RemoteObject.createNew("anywheresoftware.b4a.objects.collections.List"), starter.mostCurrent.__c.getField(false,"Null")),(Object)(starter.mostCurrent.__c.getField(true,"False")));
 }}
;
 BA.debugLineNum = 79;BA.debugLine="End Sub";
Debug.ShouldStop(16384);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
}