Reputation: 691
I've got a background task registered that will handle a (rfcomm) bluetooth connection as soon as my bluetooth device connects. Now, what I want to do is make a "Connect" button, just like the one in the Gadgets app. It should force the device to connect to my bluetooth device without opening a socket, so that the background task can handle it.
How do I do this?
Upvotes: 1
Views: 517
Reputation: 4327
The BlueTooth should use the StreamSocket and it should use the socket.
async void send(string str)
{
StreamSocket socket = await PeerFinder.ConnectAsync(peer);
DataWriter data_writer=new DataWriter(socket.OutputStream);
data_writer.WriteString(str);
await data_writer.StoreAsync();
}
Upvotes: 1