我正在使用TheHand库(32feet.NET) .

我有一个启用蓝牙的设备,我想将设备连接到我的计算机,然后将数据从设备发送到计算机 . 然后我想用我的程序捕获这些信息并进行处理 . 设备将发送3个变量(全部3个浮点数) .

我如何用蓝牙捕获这些信息?我之前从未在电脑上使用蓝牙 .

我试过这样的帖子说:Pair bluetooth devices to a computer with 32feet .NET Bluetooth library

但是不知道我在做什么,所以我不能让它发挥作用 .

我正在使用Visual Studio 2017和Windows 10.我听说Windows 10存在问题并对蓝牙设备进行身份验证 .

感谢您的帮助!

更新:

static string domaciaddress = "MY_ADDRESS";
        static string tujadress = "DEVICE_ADDRESS";
        //reciever
        private static BluetoothEndPoint EP = new BluetoothEndPoint(BluetoothAddress.Parse(domaciaddress), BluetoothService.BluetoothBase);
        private static BluetoothClient BC = new BluetoothClient(EP);

        //sender
        private static BluetoothDeviceInfo BTDevice = new BluetoothDeviceInfo(BluetoothAddress.Parse(tujadress));

        private static NetworkStream stream = null;

        static void neke231(string[] args)
        {
            string paircode = "paircode";
            if (BluetoothSecurity.PairRequest(BTDevice.DeviceAddress, paircode))
            {
                Console.WriteLine("PairRequest: OK");

                if (BTDevice.Authenticated)
                {
                    Console.WriteLine("Authenticated: OK");

                    BC.SetPin(paircode);

                    BC.BeginConnect(BTDevice.DeviceAddress, BluetoothService.SerialPort, new AsyncCallback(Connect), BTDevice);
                }
                else
                {
                    Console.WriteLine("Authenticated: No");
                }
            }
            else
            {
                Console.WriteLine("PairRequest: No");
            }

            Console.ReadLine();
        }

我现在就像这样连接到我的蓝牙 . 但是我仍然不知道如何获得我的设备发送的那3个浮点数,并将它保存在浮点数中,所以我以后可以在程序中使用它们 .

编辑:这段代码实际上并不知道为什么,但它不会连接到Android手机 . 当我运行程序而不是得到我写入控制台的内容时,我只得到 BluetoothGetDeviceInfo returned: 0x80070057