|
-
Jan 29th, 2015, 12:00 PM
#1
Thread Starter
Junior Member
Bluetooth Scanner
I have the following code that shows available COM Ports, allows me to write text and send it for display.
PHP Code:
Imports System
Imports System.Threading
Imports System.IO.Ports
Imports System.ComponentModel
Public Class Settings
Dim myPort As Array
Delegate Sub SetTextCallBack(ByVal [text] As String)
Private Sub Settings_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
myPort = IO.Ports.SerialPort.GetPortNames()
PortComboBox.Items.AddRange(myPort)
btn_Write.Enabled = False
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub
Private Sub btn_Init_Click(sender As Object, e As EventArgs) Handles btn_Init.Click
SerialPort1.PortName = PortComboBox.Text
SerialPort1.BaudRate = BaudComboBox.Text
SerialPort1.Open()
btn_Init.Enabled = False
btn_Write.Enabled = True
btn_Close.Enabled = True
End Sub
Private Sub btn_Write_Click(sender As Object, e As EventArgs) Handles btn_Write.Click
SerialPort1.Write(InputTextBox.Text & vbCr)
End Sub
Private Sub btn_Close_Click(sender As Object, e As EventArgs) Handles btn_Close.Click
SerialPort1.Close()
btn_Init.Enabled = True
btn_Write.Enabled = False
btn_Close.Enabled = False
End Sub
Private Sub SerialPort1_DataReceived(sender As System.Object, e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
ReceivedText(SerialPort1.ReadExisting())
End Sub
Private Sub ReceivedText(ByVal [text] As String)
If Me.OutputTextBox.InvokeRequired Then
Dim x As New SetTextCallBack(AddressOf ReceivedText)
Me.Invoke(x, New Object() {(text)})
Else
Me.OutputTextBox.Text &= [text]
End If
End Sub
I'm looking for a way to search for available Bluetooth connections and connect to a chosen Bluetooth device within the program. Any ideas?
-
Jan 31st, 2015, 12:02 AM
#2
Thread Starter
Junior Member
Re: Bluetooth Scanner
I guess a more accurate description of what I'm looking for is a bluetooth service discovery protocol
-
Sep 5th, 2015, 04:36 PM
#3
Fanatic Member
Re: Bluetooth Scanner
Have you figured anything out about this? I'm interested in this as well
If ive helped, RATE my post.
If your thread is solved, and you got your answer, mark this thread Resolved.
There is no other forum like VBFORUMS.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|