Hi Mike,
I apologise for wasting your time on vb/c# translation. I have now found a good translation program on the web (at last).
We are really pleased wiith the way my program now discovers and connects with SPP clients.
However perhaps you would be able to help clear up some last remaining problems.
1. Recieving data from device. For my data event handler I have translated your code as-
Private Sub wclClient_Data(ByVal sender As System.Object, ByVal e As wclnet.wclDataEventArgs) Handles WclClient1.Data
TextBox4.Text = "recieved data"
Dim Coder As Encoding = Encoding.ASCII
Dim Str As String = Coder.GetString(e.Data)
TextBox4.Text = TextBox4.Text + Str
End Sub
Very rarely I get "recieved data" but nothing I have sent from my bluettoth device is recieved (serial bluetooth module conn to hyperterminal)- I am definitely connected (signal level 24).
2. Sending data to device
Private Sub btSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSend.Click
Try
Dim str As String
Dim Coder As Encoding = Encoding.ASCII
str = TextBox5.Text + vbCrLf
Dim Buf() As Byte = Coder.GetBytes(str)
WclClient1.Write(Buf)
Buf = Nothing
Coder = Nothing
Catch Ex As Exception
End Try
End Sub
I can only send a string occasionally and quite often the connection breaks down. Maybe all this is due to the fact I am experimenting using a cheap BlueSoleil dongle.
3. Selecting Bluetooth Addresses saved in 'string' format previously discovered and saved in a .text file
I use
Private Sub Lbaddresses_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Lbaddresses.SelectedIndexChanged
Dim AddIndex As Integer
AddIndex = Lbaddresses.SelectedIndex
Device.Address = Lbaddresses.Items(AddIndex)
End Sub
WhenI open the text file the saved address appears in LbAddress.listbox but obviously there is a type cast error when I try to select address.(when I open the previously saved text file in puts the bt addresses in LbAddresses in text format)
I would like line to be
Device.Address = new address Lbaddresses.Items(AddIndex) but unfortunately 'address' is not a type and I have tried wcl--addresstype ect but get an error.
Is there a way around this do you think?
4. Disconnection is quite slow with Bluesoliel and some times to disconnect I have to click 'disconnect' several times. I think I tried 'Widcomm' dongle with your demo last week and it was quite fast. But we would like our customers to have a choice of bluetooth transport , not be limited.
We would really appreciate your input on this Mike and wish to offer you our thanks for your great support so far.
Best regards
Nick Hunter Blair.
ps I have attached my zip program for you to see the whole picture.