Author Topic: Implementing Device Discovery in VB2008.NEt  (Read 12657 times)

TcomGregg

  • Guest
Implementing Device Discovery in VB2008.NEt
« on: December 01, 2008, 01:56:26 PM »

We would like to use the same adapter (Radio) each ad every time and discover a single device and get its information.
Will the VB sub routine below accomplish this?
 
Private Sub DeviceDiscovery()
Dim RAddress AS String = "(00:11:E0:03:15:8B)"                                '***Adapter MAC Address
Dim RName AS String = "TrendNet Adapter"                                      '***Adapter Name
Dim Radio AS wclnet.wclBluetoothRadio = RName &  ","  &  RAddress   '***Builds Radio String
'****Start of Device Discovery
Try
     wclBluetoothDiscovery.Discovery(Radio)
Finally
End Try
Dim DName AS String = ""             '***Device Name
'****Get Device Information
Try
     DName = Device.Name(Radio)
Catch ex As Exception
     DName = ex.Message
End Try
Dim DAddress AS String = ""           '***Device Address
Try
     DAddress = Device.Address(Radio)
Catch ex AS Exception
     DAddress = ex.Message
End Try
End Sub

Thank You
Gregg

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Implementing Device Discovery in VB2008.NEt
« Reply #1 on: December 01, 2008, 06:19:55 PM »
You should read device's information (line Name and other things) inside OnDiscoveryComplete event handler (when you have devices discovered).

If you need to use the same adapter always you need to know the API used by it. Then you can create the Radio object and use it in your application.

But the better way is to enumerate radios and the check is required radio exists in the list. Also it is good idea to monitor AfterLoad/AfterUnload/OnChanged events of the wclAPI component becasue dongle can be removed or turned off.

 

Sitemap 1 2 3 4 5 6 7