/// <summary> /// Used internally to get the latest list of discovered devices from /// the native SDK. /// </summary> private Device[] GetDiscoveredDevices() { Device[] devices = WearableConstants.EmptyDeviceList; #if UNITY_IOS && !UNITY_EDITOR unsafe { BridgeDevice *nativeDevices = null; int count = 0; WearableGetDiscoveredDevices(&nativeDevices, &count); if (count > 0) { devices = new Device[count]; for (int i = 0; i < count; i++) { devices[i] = (Device)Marshal.PtrToStructure(new IntPtr(nativeDevices + i), typeof(Device)); } } } #elif UNITY_ANDROID && !UNITY_EDITOR devices = AndroidPlugin.GetDevices(); #endif return(devices); }
public Device[] GetDiscoveredDevicesInternal() { Device[] devices = WearableConstants.EmptyDeviceList; unsafe { BridgeDevice *nativeDevices = null; int count = 0; WearableGetDiscoveredDevices(&nativeDevices, &count); if (count > 0) { devices = new Device[count]; for (int i = 0; i < count; i++) { devices[i] = (Device)Marshal.PtrToStructure(new IntPtr(nativeDevices + i), typeof(Device)); } } } return(devices); }
public Device[] GetDiscoveredDevicesInternal() { Device[] devices = WearableConstants.EMPTY_DEVICE_LIST; unsafe { BridgeDevice *nativeDevicesPtr = null; int count = 0; WearableGetDiscoveredDevices(&nativeDevicesPtr, &count); if (count > 0) { devices = new Device[count]; for (int i = 0; i < count; i++) { var bridgeDevice = (BridgeDevice)Marshal.PtrToStructure(new IntPtr(nativeDevicesPtr + i), typeof(BridgeDevice)); devices[i] = CreateDevice(bridgeDevice); } } } return(devices); }