本文介绍了蓝牙连接按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个按钮来搜索蓝牙设备并显示在表面列表框中

i have a button to search for bluetooth device and display in a surface listbox

private void btn_FindDevice_Click(object sender, RoutedEventArgs e)
 {
           InTheHand.Net.Sockets.BluetoothClient bc = new InTheHand.Net.Sockets.BluetoothClient();
           InTheHand.Net.Sockets.BluetoothDeviceInfo[] array = bc.DiscoverDevices();
           for (int i = 0; i < array.Length; i++)
           {
               this.address_array[i] = array[i].DeviceAddress;
               this.surfaceListBox1.Items.Add(array[i].DeviceName);
           }
       }


这是获取macsap,nap地址的另一个按钮


This is another button of getting the macsap,nap address

private void btn_GetMacAdd_Click(object sender, RoutedEventArgs e)
       {
           if (this.surfaceListBox1.SelectedIndex == -1)
           {
               MessageBox.Show("Please select a device.");
               return;
           }

           int index = this.surfaceListBox1.SelectedIndex;
           string mac = this.address_array[index].ToString();
           string nap = this.address_array[index].Nap.ToString();
           string sap = this.address_array[index].Sap.ToString();
           lblmac.Content = "MAC : " + mac.ToString();
           lblnap.Content = "NAP :" + nap.ToString();
           lblsap.Content= "SAP :" + sap.ToString();
       }





How do i connect the phone device and go to the phone image folder where i have another connect button?

推荐答案


这篇关于蓝牙连接按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 12:24