public static IEnumerable <BluetoothDeviceInfo> GetDeviceInfos(bool returnAuthenticated, bool returnConnected, bool returnRemembered, bool returnUnknown, bool issueInquiry, byte timeoutMultiplier) { BluetoothDeviceSearchParams searchParams = new BluetoothDeviceSearchParams(); searchParams.returnAuthenticated = returnAuthenticated; searchParams.returnConnected = returnConnected; searchParams.returnRemembered = returnRemembered; searchParams.returnUnknown = returnUnknown; searchParams.issueInquiry = issueInquiry; searchParams.timeoutMultiplier = timeoutMultiplier; searchParams.size = (uint)Marshal.SizeOf(searchParams); return(GetDeviceInfos(searchParams)); }
public static IEnumerable <BluetoothDeviceInfo> GetDeviceInfos(BluetoothDeviceSearchParams searchParams) { IList <BluetoothDeviceInfo> deviceInfos = new List <BluetoothDeviceInfo>(); BluetoothDeviceInfo deviceInfo = default(BluetoothDeviceInfo); deviceInfo.size = (uint)Marshal.SizeOf(deviceInfo); IntPtr searchHandle = BluetoothFindFirstDevice(ref searchParams, ref deviceInfo); HandleError(); if (searchHandle != IntPtr.Zero) { do { deviceInfos.Add(deviceInfo); deviceInfo = default(BluetoothDeviceInfo); }while (BluetoothFindNextDevice(searchHandle, ref deviceInfo)); BluetoothFindDeviceClose(searchHandle); } return(deviceInfos); }
public static extern IntPtr BluetoothFindFirstDevice(ref BluetoothDeviceSearchParams searchParams, ref BluetoothDeviceInfo deviceInfo);
public static extern IntPtr BluetoothFindFirstDevice( ref BluetoothDeviceSearchParams pbtsp, ref BluetoothDeviceInfo pbtdi );
public static IEnumerable<BluetoothDeviceInfo> GetDeviceInfos(BluetoothDeviceSearchParams searchParams) { IList<BluetoothDeviceInfo> deviceInfos = new List<BluetoothDeviceInfo>(); BluetoothDeviceInfo deviceInfo = default(BluetoothDeviceInfo); deviceInfo.size = (uint)Marshal.SizeOf(deviceInfo); IntPtr searchHandle = BluetoothFindFirstDevice(ref searchParams, ref deviceInfo); HandleError(); if (searchHandle != IntPtr.Zero) { do { deviceInfos.Add(deviceInfo); deviceInfo = default(BluetoothDeviceInfo); } while (BluetoothFindNextDevice(searchHandle, ref deviceInfo)); BluetoothFindDeviceClose(searchHandle); } return deviceInfos; }
public static IEnumerable<BluetoothDeviceInfo> GetDeviceInfos(bool returnAuthenticated, bool returnConnected, bool returnRemembered, bool returnUnknown, bool issueInquiry, byte timeoutMultiplier) { BluetoothDeviceSearchParams searchParams = new BluetoothDeviceSearchParams(); searchParams.returnAuthenticated = returnAuthenticated; searchParams.returnConnected = returnConnected; searchParams.returnRemembered = returnRemembered; searchParams.returnUnknown = returnUnknown; searchParams.issueInquiry = issueInquiry; searchParams.timeoutMultiplier = timeoutMultiplier; searchParams.size = (uint)Marshal.SizeOf(searchParams); return GetDeviceInfos(searchParams); }