Sub AfterAircraftConnected
If aircraft.CameraReady = False Or aircraft.BatteryReady = False Then
Log("Camera / battery not ready")
Sleep(500)
If aircraft.Connected Then AfterAircraftConnected
Return
End If
aircraft.RegisterBatteryStateEvent
controller.Initialize("controller", aircraft)
Log($"simulator: ${controller.SimulatorStarted)}"$
camera.Initialize("camera", aircraft)
pnlCamera.AddView(camera.CreateVideoView, 0, 0, pnlCamera.Width, pnlCamera.Height)
timer1.Enabled = True
WaypointOperator.Initialize("WaypointOperator")
aircraftName = "N/A"
Wait for (aircraft.GetName) Aircraft_ResultWithValue (Success As Boolean, ErrorMessage As String, Value As Object)
If Success Then
aircraftName = Value
End If
'new code ***************************
Dim jo As JavaObject = aircraft
Dim airlink As JavaObject = jo.RunMethod("getAirLink", Null)
Dim event As Object = airlink.CreateEventFromUI("dji.common.airlink.SignalQualityCallback", "DownloadSignalChanged", Null)
airlink.RunMethod("setDownlinkSignalQualityCallback", Array(event))
End Sub
Sub DownloadSignalChanged_Event (MethodName As String, Args() As Object) As Object
Dim strength As Int = Args(0)
Log(strength)
Return Null
End Sub