コード例 #1
0
 public void findBluetoothTolist()
 {
     BluetoothRadio.PrimaryRadio.Mode = RadioMode.Discoverable;
     BluetoothClient bluetoothClient = new BluetoothClient();
     BluetoothDeviceInfo[] bluetoothDeviceInfo = bluetoothClient.DiscoverDevices(10);
     ArrayList deviceCollection = new ArrayList();
     foreach (BluetoothDeviceInfo device_info in bluetoothDeviceInfo)
     {
         string device_name = device_info.DeviceName;
         string device_address = device_info.DeviceAddress.ToString();
         BluetoothDeviceManager manager = new BluetoothDeviceManager(device_name,device_address);
         deviceCollection.Add(manager);
     }
     System.Management.ManagementObjectSearcher Searcher = new System.Management.ManagementObjectSearcher("Select * from WIN32_SerialPort");
     foreach (System.Management.ManagementObject Port in Searcher.Get())
     {
         string PNPDeviceID = Port.GetPropertyValue("PNPDeviceID").ToString();
         string DeviceID = Port.GetPropertyValue("DeviceID").ToString();
         for (int i = 0; i < deviceCollection.Count; i++)
         {
             BluetoothDeviceManager manager = (BluetoothDeviceManager)deviceCollection[i];
             string device_address = manager.getDeviceAddress();
             int index = PNPDeviceID.IndexOf(device_address);
             if (index > 0)
             {
                 manager.addCOM(DeviceID);
                 bluetoothList.Add(manager);
             }
         }
     }
 }
コード例 #2
0
ファイル: testerForm.cs プロジェクト: sh932111/BrainProject
 public TesterForm(BluetoothDeviceManager manager , string path , int index)
 {
     InitializeComponent();
     this.bluetoothDeviceManager = manager;
     this.outputPath = path;
     this.devIndex = index;
 }
コード例 #3
0
 public ConfigManager(string id, string path, int run, BluetoothDeviceManager device, Boolean is_test, Boolean is_client, string n, string y)
 {
     this.orderID = id;
     this.outPath = path;
     this.deviceManager = device;
     if (is_test)
     {
         this.runTime = run ;
     }
     else
     {
         this.runTime = run + 10;
     }
     this.isTest = is_test;
     this.isClient = is_client;
     this.year = y;
     this.name = n;
 }
コード例 #4
0
 public ConfigManager(string id, string path, int run, BluetoothDeviceManager device, Boolean is_test, Boolean is_client, string n, string y)
 {
     this.orderID       = id;
     this.outPath       = path;
     this.deviceManager = device;
     if (is_test)
     {
         this.runTime = run;
     }
     else
     {
         this.runTime = run + 10;
     }
     this.isTest   = is_test;
     this.isClient = is_client;
     this.year     = y;
     this.name     = n;
 }