c# - Can only retrieve all Services when trying to get Paired Bluetooth Devices -
i writing windows/windows phone 8.1 bluetooth app spp end user needs select paired bluetooth device use.
problem #1:
i having trouble trying paired bluetooth devices paired device. can all services on device.
note: using windows phone 8.1 device bluetooth paired windows 7 laptop
deviceinformationcollection collectionofdeviceinfo; peerfinder.alternateidentities["bluetooth:paried"] = ""; //collectionofdeviceinfo = await deviceinformation.findallasync(rfcommdeviceservice.getdeviceselector(rfcommserviceid.serialport)); collectionofdeviceinfo = await deviceinformation.findallasync();
the findallasync() gives me services on phone, including paired bluetooth , services.
problem #2:
i don't know service need bluetooth spp. if knew service needed bluetooth filter giant list of services.
i have been looking @ bluetoothrfcommchat , bluetoothcommunicationsample msdn, not helping.
ha, got rfcommserviceid.serialport work. needed add
<capabilities> <m2:devicecapability name="bluetooth.rfcomm"> <m2:device id="any"> <m2:function type="name.serialport"/> </m2:device> </m2:devicecapability> </capabilities>
to package.appxmanifest (hint: right click->view code)
then line
collectionofdeviceinfo = await deviceinformation.findallasync(rfcommdeviceservice.getdeviceselector(rfcommserviceid.serialport));
worked great.
to solve got bluetoothrfcommchat work on windows 8.1 laptop , on winows phone 8.1 device. did need restart laptop after pairing , run app startup tile , not debugging. phone side didn't need restart , can run debugging.
Comments
Post a Comment