Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void CommandExecute(){
- BluetoothAdapter adapter = BluetoothAdapter.DefaultAdapter;
- BluetoothDevice device = (from bd in adapter.BondedDevices
- where bd.Name == "devicename"
- select bd).FirstOrDefault();
- BluetoothSocket bluetoothSocket = device.CreateRfcommSocketToServiceRecord(UUID.FromString("00001101-0000-1000-8000-00805f9b34fb"));
- ConnectAsync(BluetoothSocket bluetoothSocket).Wait();
- }
- public async Task ConnectAndWriteAsync(BluetoothSocket bluetoothSocket)
- {
- try
- {
- await bluetoothSocket.ConnectAsync();
- }catch(Exception ex)
- {
- }
- }
Add Comment
Please, Sign In to add comment