문제

I'm trying to get a hold on specific devices by using the PeerFinder class in Windows 8 / Windows Phone 8.

Following the example as shown in the Build presentation: http://channel9.msdn.com/Events/Build/2012/3-047

I got the paired bluetooth devices by using these lines:

PeerFinder.AlternateIdentities["Bluetooth:PAIRED"] = "";

var devices = await PeerFinder.FindAllPeersAsync();

But now I would like to get a list of devices that are connected via bluetooth or maybe even other devices by using a different key in the:

PeerFinder.AlternateIdentities[KEY] = "";

line of code. The MSDN documentation isn't helpful in this case.

도움이 되었습니까?

해결책

Windows Phone 8 bluetooth APIs can really only be used in a few ways (and those are driven by AlternateIdentities):

1) app-to-device / WP8-to-device. This will only work for paired devices. WP8 bluetooth APIs cannot communicate with bluetooth devices that aren't paired to it. As you've discovered AlternateIdentities["Bluetooth:Paired"]="" is the right thing to use for this usecase.

2) app-to-app / WP8-to-WP8. This allows WP8 apps to communicate with the same app on different phones. You specifically need to avoid setting AlternateIdentities for app-to-app to work.

3) app-to-app / WP8-to-Win8. Using specific AlternativeIdentities on both ends it's also possible to get app-to-app to work for WP8-to-Win8. You'll need to set PeerFinder.AlternateIdentities["WindowsPhone"] on Win8 to the WP8 app GUID, and you'll need to add PeerFinder.AlternateIdentities.Add("Windows",GUID) on WP8 to the Win8 app GUID.

There are other AlternateIdentities formats we haven't shared publicly since they don't apply to 3rd party developers. When thinking about usecases for Bluetooth on WP8 focus on app-to-app and app-to-device.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top