.NET Components for Mobility

RFCOMM JABRA

Last post 10-19-2009 5:22 AM by yl5923. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 10-08-2009 5:16 AM

    RFCOMM JABRA

     

    Public Class Form1
        Dim Client As New InTheHand.Net.Sockets.BluetoothClient
        Dim Client2 As New InTheHand.Net.Sockets.BluetoothClient

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

            'Dim addr As InTheHand.Net.BluetoothAddress = InTheHand.Net.BluetoothAddress.Parse("001DF66F876E")
            Dim addr As InTheHand.Net.BluetoothAddress = InTheHand.Net.BluetoothAddress.Parse("001a4551333b")

            'Dim ep As New InTheHand.Net.BluetoothEndPoint(addr, InTheHand.Net.Bluetooth.BluetoothService.Headset)
            Dim ep As New InTheHand.Net.BluetoothEndPoint(addr, InTheHand.Net.Bluetooth.BluetoothService.RFCommProtocol)
            'Dim ep As New InTheHand.Net.BluetoothEndPoint(addr, InTheHand.Net.Bluetooth.BluetoothService.HandsfreeAudioGateway)
            'Dim ep As New InTheHand.Net.BluetoothEndPoint(addr, InTheHand.Net.Bluetooth.BluetoothService.L2CapProtocol)

            InTheHand.Net.Bluetooth.BluetoothSecurity.PairRequest(addr, "0000")

            Client.Authenticate = True
            'Client.Encrypt = True
            Client.SetPin(addr, "0000")

            Client.Connect(ep)

            Client2.SetPin("0000")
            'Client2.Connect(ep2)
            'Debug.Write("Connected Linkkey: " & cli.LinkKey.ToString)

            Dim peerStream As System.IO.Stream = Client.GetStream()
            Dim MyBytes() As Byte = System.Text.ASCIIEncoding.ASCII.GetBytes("RING" & vbCrLf)
            peerStream.Write(MyBytes, 0, MyBytes.Length)

            Dim MyRETBytes(128) As Byte
            peerStream.Read(MyRETBytes, 0, 128)

            MyBytes = System.Text.ASCIIEncoding.ASCII.GetBytes("AT+VGS=15" & vbCr)
            peerStream.Write(MyBytes, 0, MyBytes.Length)
            MyBytes = System.Text.ASCIIEncoding.ASCII.GetBytes("AT+VGM=15" & vbCr)
            peerStream.Write(MyBytes, 0, MyBytes.Length)
            MyBytes = System.Text.ASCIIEncoding.ASCII.GetBytes("RING" & vbCr)
            peerStream.Write(MyBytes, 0, MyBytes.Length)
            Debug.WriteLine("RING")
        End Sub

        Private Sub DiscoverBT()
            Debug.WriteLine("Discovering Devices")
            Dim BTDevices() As InTheHand.Net.Sockets.BluetoothDeviceInfo = Client.DiscoverDevices

            For Each device As InTheHand.Net.Sockets.BluetoothDeviceInfo In BTDevices
                'device.GetServiceRecords()
                Debug.WriteLine("Device Name: " & device.DeviceName)
                Debug.WriteLine("Device MAC: " & device.DeviceAddress.ToString)
                Debug.WriteLine("Connected: " & device.Connected)
                Debug.WriteLine("Class: " & device.ClassOfDevice.ToString)
                Debug.WriteLine("Authenticated: " & device.Authenticated)
                Debug.WriteLine("Last Seen: " & device.LastSeen)
                Debug.WriteLine("Last Used: " & device.LastUsed)
                Debug.WriteLine("Remembered: " & device.Remembered)
                Debug.WriteLine("rssi: " & device.Rssi)

                For Each MyGuid As System.Guid In device.InstalledServices
                    Debug.Write("Installed Services: " & MyGuid.ToString & vbCrLf)
                Next

                device.ShowDialog()
            Next

            Debug.WriteLine("Discovering Devices Done")
        End Sub
    End Class

     

    Alright Ive gotten this far, Does Jabra only allow RING from a CELLPHONE Class? 

  • 10-11-2009 2:46 PM In reply to

    Re: RFCOMM JABRA

    You want to connect to BluetoothService.Headset (or Handsfree).  The problem might be then that the headset will probably only allow connections from the one device (or some might support two or three) that it knows as the phone.  So tell the headset that your PC is the phone.  Also you can write a server program on the PC that listens on BluetoothService.HeadsetAudioGateway (etc) the headset will connect to that instead of you connecting to it.

    As you note you might need to have the PC look more like a phone.  With BluetoothListener for the server set the suitable ClassOfDevice flag.

    I keep meaning to try all this myself, but time time time!  Have you seen http://www.alanjmcf.me.uk/comms/bluetooth/Bluetooth%20Profiles%20and%2032feet.NET.html#_Toc200246865 so getting the audio is hard but the RING should be accessible.

  • 10-11-2009 9:19 PM In reply to

    • yl5923
    • Top 150 Contributor
    • Joined on 10-03-2009
    • China
    • Posts 9

    Re: RFCOMM JABRA

    im form china,my english is poorer,but i like make progress,

    what write a server program on the PC that listens on BluetoothService.HeadsetAudioGateway ,i dont konwn,Confused

  • 10-13-2009 5:25 AM In reply to

    Re: RFCOMM JABRA

     Thanks For All The Replys and support I did it with WIDCOMM MFC.

  • 10-13-2009 11:26 AM In reply to

    Re: RFCOMM JABRA

    So Widcomm can be installed on Windows Vista?  The full thing -- not their mapping over MSFT (which presumably couldn't supply RSSI info).

  • 10-13-2009 8:34 PM In reply to

    Re: RFCOMM JABRA

     Ummm After I struggled to get WIDCOMM on vista, it turns out with working code proted from XP SP3 to Vista everything but the RSSI came through, Ummm Back to the Drawing Boards? =(

     

    Anyone know how the hell to get RSSI in vista !?!?!?!

  • 10-19-2009 5:22 AM In reply to

    • yl5923
    • Top 150 Contributor
    • Joined on 10-03-2009
    • China
    • Posts 9

    Re: RFCOMM JABRA

    how to get audio stream form headset?im cant get it using 32feet.are you give a sample for me ?thanks !Crying
  • 10-19-2009 5:22 AM In reply to

    • yl5923
    • Top 150 Contributor
    • Joined on 10-03-2009
    • China
    • Posts 9

    Re: RFCOMM JABRA

    how to get audio stream form headset?im cant get it using 32feet.are you give a sample for me ?thanks !Crying
Page 1 of 1 (8 items)
Copyright © 2001-2012 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy. OrcsWeb's Windows Cloud Server Hosting