简体   繁体   English

“不兼容的地址”创建BluetoothListener

[英]“Incompatible Address” creating BluetoothListener

I'm trying to use Bluetooth on Windows 7. It's a Dell laptop with integrated bluetooth and the Dell drivers, and I'm using the 32feet library in a C# project in VS2012. 我正在尝试在Windows 7上使用蓝牙。这是一台集成了蓝牙和戴尔驱动程序的戴尔笔记本电脑,并且我正在VS2012中的C#项目中使用32feet库。

I've simplified things to this function, called at program start; 我已经将此功能简化为在程序启动时调用的功能;

    public static void Test()
    {
        Guid service = new Guid("{7A51FDC2-FDDF-4c9b-AFFC-98BCD91BF93B}");
        BluetoothListener bl = new BluetoothListener(service);
        bl.Start();
        BluetoothClient bc = bl.AcceptBluetoothClient();

    }

When I create the listener, I get the error "An address incompatible with the requested protocol was used." 创建侦听器时,出现错误“使用了与请求的协议不兼容的地址”。

The stack trace downstream from this call is; 该调用下游的堆栈跟踪为;

  at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)   
  at InTheHand.Net.Bluetooth.Msft.WindowsBluetoothListener.CreateSocket()
  at InTheHand.Net.Bluetooth.Msft.WindowsBluetoothListener.Construct(Guid service)
  at InTheHand.Net.Sockets.BluetoothListener..ctor(BluetoothFactory factory, Guid service)
  at InTheHand.Net.Sockets.BluetoothListener..ctor(Guid service)

The BluetoothRadio.IsSupported property returns TRUE . BluetoothRadio.IsSupported属性返回TRUE

I've done a bit of Googling around and not found very much of relevance. 我做了一些谷歌搜索,没有发现很多相关性。 Can anyone suggest where to go from here? 谁能建议从这里去哪里?

After spending a fair chunk of time on this, and trying to get the commercial alternative Wireless Communication Library to work I went back to basics and tried using Bluetooth to stream audio from my phone, use a Bluetooth mouse etc- previously I'd confirmed I could see devices and pair with them and assumed this meant all was well but hadn't had a need to actually use those devices. 在花了相当长的时间后,尝试使商业替代无线通信库正常工作,我回到基础知识,尝试使用蓝牙从手机中传输音频,使用蓝牙鼠标等-之前我已经确认过可以看到设备并与之配对,并认为这一切都很好,但实际上并不需要使用这些设备。

Turned out that although detection and pairing worked, nothing else did. 事实证明,尽管检测和配对有效,但没有其他作用。 Tried another Windows 7 machine and the devices did work. 尝试了另一台Windows 7计算机,并且设备正常运行。 Tried reinstalling drivers, the only thing that actually solved it was to get a new HD (since I didn't want to trash my system if it proved unnecessary) and do a fresh install of Windows 7. 尝试重新安装驱动程序,实际上唯一解决的方法是获得新的HD(因为如果不需要,我不想废弃我的系统)并重新安装Windows 7。

So I don't know the root cause, but if anyone else finds this for the same reason it may save a few days :) 所以我不知道根本原因,但是如果其他人出于同样的原因找到它,可能会节省几天的时间:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM