示例#1
0
        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));
        }
示例#2
0
        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);
        }
示例#3
0
 public static extern IntPtr BluetoothFindFirstDevice(ref BluetoothDeviceSearchParams searchParams, ref BluetoothDeviceInfo deviceInfo);
示例#4
0
 public static extern IntPtr BluetoothFindFirstDevice(
     ref BluetoothDeviceSearchParams pbtsp,
     ref BluetoothDeviceInfo pbtdi
     );
示例#5
0
 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;
 }
示例#6
0
 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);
 }
示例#7
0
 public static extern IntPtr BluetoothFindFirstDevice(
     ref BluetoothDeviceSearchParams pbtsp,
     ref BluetoothDeviceInfo pbtdi
     );