void InitalizeBridge() { droneBridge = DroneBridge.Create(); if (droneBridge == null) { Debug.Log("No drone bridge found for " + Application.platform); IsPlatformSupported = false; return; } IsPlatformSupported = true; droneBridge.OnRegistered += () => eventQueue.Enqueue(() => OnRegisteredEvent.Invoke()); droneBridge.OnRegisterFailed += (error) => eventQueue.Enqueue(() => OnRegisterFailedEvent.Invoke(error)); droneBridge.OnDroneConnected += (drone) => { Drone = drone; eventQueue.Enqueue(() => OnDroneConnectedEvent.Invoke(drone)); }; droneBridge.OnDroneDisconnected += () => { Drone = null; eventQueue.Enqueue(() => OnDroneDisconnectedEvent.Invoke()); }; }
public DroneConnectionCallback(DroneBridge bridge) : base($"{PLUGIN_BUNDLE_ID}.DroneBridge$DroneConnectionCallback") { this.bridge = bridge; }