连接蓝牙设备到Windows Phone 8应用程序 [英] Connecting bluetooth device to windows phone 8 application

查看:190
本文介绍了连接蓝牙设备到Windows Phone 8应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发哪些应该连接到蓝牙设备(由ID /名称)在Windows 8手机OS应用程序。

I'm developing a Windows phone 8 OS application which should connect to the Bluetooth device (by id/ name).

我试图通过 PeerFinder.FindAllPeersAsync()来找到所有的有源器件和我得到了以下错误的使用方法:

I tried to use by PeerFinder.FindAllPeersAsync() to find all the active devices and I got the following error:

A方法被调用在一个意想不到的时间。 (异常来自HRESULT:0x8000000E)。

我怎样才能连接到蓝牙?我需要做什么呢?

How can I connect to Bluetooth? What do I need to do?

这可能吗?

我需要的答案尽快

感谢很多

推荐答案

有同样的问题,但没有找到一个解决办法的人。经过一个小时左右的试验和错误我想出了以下内容:

Had the same problem and couldn't find anyone with a solution. After an hour or so of trial and error I have come up with the following:


  1. 您需要调用PeerFinder.FindAllPeersAsync之前PeerFinder.Start()(),否则你会得到错误的方法被称为在一个意想不到的时间(这是陷入了微软的示例应用程序的蓝牙应用到应用样本 - ERR_NOT_ADVERTISING = 0x8000000E)

  1. You need to call PeerFinder.Start() before PeerFinder.FindAllPeersAsync() or you will get the error "A method was called at an unexpected time" (which is caught in Microsoft's sample application "Bluetooth app to app sample" - ERR_NOT_ADVERTISING = 0x8000000E).

但说的一切,我找不到任何蓝牙设备之后。只有我摸索出了如何连接到蓝牙设备的方法是使用控制面板配对,然后用
PeerFinder.AlternateIdentities [蓝牙:配对] =的String.Empty;
现在,这似乎并没有要求PeerFinder.Start()返回的结果,但如果你不这样做,你会得到以后例外。

But after saying all that I couldn't find any Bluetooth devices. The only way I worked out how to connect to a Bluetooth device was to pair using the control panel and then use PeerFinder.AlternateIdentities["Bluetooth:Paired"] = string.Empty; Now this didn't seem to require PeerFinder.Start() to return results but if you don't do it you will get exceptions later on.

我找不到这个对微软API的信息 - 它看起来像这些API的是未经雕琢

I couldn't find information about this on the Microsoft API's - it seems like these API's are unpolished.

这篇关于连接蓝牙设备到Windows Phone 8应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆