Android Question DJI Ocusync get/set channel

madru

Active Member
Licensed User
Longtime User
good morning,

I try get & set the channel of Ocusync, with no success. Can somebody explain how to do it correctly?

error: java.lang.RuntimeException: Method: OcuSyncLink not found in: dji.sdk.airlink.AirLink

B4X:
    Dim jo As JavaObject = aircraft
    Dim airlink As JavaObject = jo.RunMethod("getAirLink", Null)
...

   If airlink.RunMethod("isOcuSyncLinkSupported", Null) = True Then
        'this is Ocusync
        If airlink.RunMethod("getOcuSyncLink", Null) <> Null Then
            'do something
            Dim jo As JavaObject = ????????
            Dim OcuSyncLink As JavaObject = jo.RunMethod("OcuSyncLink", Null)
            Dim channel As JavaObject = OcuSyncLink.RunMethod("getChannelNumber", Null)
            Log(channel)'object
        End If
    End If
 
Last edited:

madru

Active Member
Licensed User
Longtime User
I get a number back.... e.g 2470, but not sure if ChannelNumber = Frequency (2470 = 2,47 GHz)?


B4X:
Sub getChannelNumber
    If aircraft.Connected Then
    Dim airlink As JavaObject = aircraft
    airlink = airlink.RunMethod("getAirLink", Null)
    If airlink.IsInitialized Then
        Dim OcuSyncLink As JavaObject = airlink.RunMethod("getOcuSyncLink", Null)
        If OcuSyncLink.IsInitialized Then
            Dim cc As Object = OcuSyncLink.CreateEventFromUI("dji.common.util.CommonCallbacks$CompletionCallbackWith", "callback", Null)
                OcuSyncLink.RunMethod("getChannelNumber", Array(cc))
            Wait For (OcuSyncLink) Callback_Event (MethodName As String, Args() As Object)
            Log(MethodName)
            Log(Args(0))
            Dim numbers() As Object = Args(0)
            Dim a As List
            a.Initialize
            a.Add(numbers)
            For i = 0 To a.Size-1
                    ChannelNumber = "ChannelNumber "&(a.Get(i))
            Next
        End If
    End If
    Else
        frequency = MethodName &" not connected"
    End If
End Sub
 
Upvote 0

madru

Active Member
Licensed User
Longtime User
I completely overlooked it.....

1587134583356.png
 
Upvote 0

Similar Threads

Top