public MainPage() { this.InitializeComponent(); BluetoothManager bluetoothManager = BluetoothManager.Instance; var bluetoothServerConnection = bluetoothManager.CreateRfcommServerConnection(new Guid("14c5449a-6267-4c7e-bd10-63dd79740e50")); bluetoothServerConnection.StartServer(); }
//这个站且用来测试鼠标移动,以下就是他妈的移动方法。 private void Button_BluetoothInitialize_Click(object sender, RoutedEventArgs e) { /* * BTTaskManager btTaskManager = BTTaskManager.instance; * btTask = btTaskManager.newTask(); * btTask.onReceiveMessage += onReceiveData; * Debug.WriteLine("UI::" + Thread.CurrentThread.ManagedThreadId); * btTask.startAdvertising(); * ControllerManager controllerManager = new ControllerManager(); * * ImageSource is_QRCode = BitmapToBitmapImage(btTask.QRCode); * img_QRCode.Source = is_QRCode; * controllerManager = new ControllerManager();*/ ControllerManager controllerManager = new ControllerManager(); BluetoothManager bluetoothManager = BluetoothManager.Instance; var bluetoothServerConnection = bluetoothManager.CreateRfcommServerConnection(Guid.Parse("14c5449a-6267-4c7e-bd10-63dd79740e5" + 0)); bluetoothServerConnection.OnConnectionEstalblishResult += OnConnectionEstalblishResult; bluetoothServerConnection.OnReceiveMessage += _OnReceiveMessage; bluetoothServerConnection.StartServer(); controllerManagers.Add(bluetoothServerConnection, controllerManager); }
public MainWindow() { InitializeComponent(); ConnectionManager.Instance.onControllerConnectionEstalblishResult += OnControllerConnectionEstablishResult; ConnectionManager.Instance.onControllerConnectionReceiveMessage += OnControllerConnectionReceiveMessage; DebugBackend.DebugBackend.Instance.OnServerFailed += OnDebugServerFailed; DebugBackend.DebugBackend.Instance.OnServerStart += OnDebugServerStart; DebugBackend.DebugBackend.Instance.OnReceiveSendRequest += OnReceiveSendRequest; BluetoothManager bluetoothManager = BluetoothManager.Instance; bluetoothServerConnection = bluetoothManager.CreateRfcommServerConnection(Guid.Parse("14c5449a-6267-4c7e-bd10-63dd79740e5" + 0)); ConnectionManager.Instance.ControllerConnection = bluetoothServerConnection; Timer startServerTimer = new Timer(5000); startServerTimer.Elapsed += OnStartTimerElapsed; startServerTimer.Start(); DebugBackend.DebugBackend.Instance.StartBackend(8083); img_QR.Source = bluetoothServerConnection.GetQRCode().ToBitmapImage(); tb_Mac.Text = bluetoothServerConnection.ConnectCode; }