private void AdvWatcher_Received(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args) { if (args.Advertisement.LocalName == "") { return; } Console.WriteLine(tag, "Advertisement recieved! LocalName:" + args.Advertisement.LocalName); if (args.Advertisement.LocalName == Constants.DeviceName && !gotchaConnected) { Console.WriteLine(tag, "Found a " + Constants.DeviceName); Gotcha.StartCommunication(args.BluetoothAddress); gotchaConnected = true; } else if (args.Advertisement.LocalName == Constants.DeviceNameDebug && !upgraderConnected) { Console.WriteLine(tag, "Found a " + Constants.DeviceNameDebug); Upgrader.StartCommunication(args.BluetoothAddress); upgraderConnected = true; } }
public static void StartCommunication(ulong deviceAddress) { handle = new Upgrader(deviceAddress); }