kamalrsi
Posts: 8
Joined: Mon Oct 20, 2008 12:27 pm

connect to handsfree

Mon Oct 20, 2008 1:58 pm

I have developed a C# application for desktop to connect(vibrate) to bluetooth handsfree device.
Is it possible to discover only the paired bluetooth devices?

Also discovery of all handsfree BT devices is done but can't find any method to vibrate that handsfree from desktop. Is there any way which is supporting in bluetools to vibrate handsfree device from local desktop having activated USB dongle? Please help...

Kamal

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: connect to handsfree

Mon Oct 20, 2008 2:02 pm

No, you can discover any Bluetooth device that is close by if they are in discoverable mode (and are actually responding to the device discovery).

You have to know the protocol of the handsfree service to determine what message you are supposed to send to make it vibrate.
It is not something that is supported out of the box.

Regards,
Jonas

kamalrsi
Posts: 8
Joined: Mon Oct 20, 2008 12:27 pm

RE: connect to handsfree

Mon Oct 20, 2008 2:25 pm

Thanks Jonas for prompt reply.
If searching of only paired device is not possible then if after searching all discoverable BT devices, we can have some property of each BT device to know, if this device is paired or not?

Kamal

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: connect to handsfree

Mon Oct 20, 2008 3:11 pm

Each RemoteDevice should have an IsBonded property.

Regards,
Jonas

kamalrsi
Posts: 8
Joined: Mon Oct 20, 2008 12:27 pm

RE: connect to handsfree

Fri Oct 24, 2008 4:51 pm

Hi Jonas,

As per last discussion, I can now able to search a paired handsfree BT device (using device.Bonded() property) but when I was trying to discover services for the already discovered device then I got an exception error "Remote device cannot be found.". The code I used in C# to discover services:

Service[] tservices = selectedDevice.DiscoverServices(Franson.BlueTools.ServiceType.Headset);

Here selectedDevice variable holds the RemoteDevice object of already discovered device.

Please advise me where I am wrong?

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: connect to handsfree

Fri Oct 24, 2008 5:43 pm

The device isn't responding to the service discovery.

Can be a number of things:
* Is the device present? (turned on/in range)
* The device is already connected to another device (already bonded to your phone maybe?) In that case it will not respond to any other connection attempts.

Regards,
Jonas

kamalrsi
Posts: 8
Joined: Mon Oct 20, 2008 12:27 pm

RE: connect to handsfree

Wed Oct 29, 2008 4:53 pm

Hello Jonas,
Now I am able to get the services of my BT handsfree device and when I push a message (file) to that device it just give me a small sound beep. This device is a vibrating BT device and I am expecting vibration when sending a message instead of beep sound. Suggest me what I should send (file or command or anything else which can work) to vibrate this.

Note: It is giving two services (Headset and Hands-Free unit).

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: connect to handsfree

Wed Oct 29, 2008 5:37 pm

I have no idea what commands a handsfree expects. You have to find the headset profile specification and determine what command to send to it.

Regards,
Jonas

kamalrsi
Posts: 8
Joined: Mon Oct 20, 2008 12:27 pm

RE: connect to handsfree

Thu Oct 30, 2008 11:48 am

Thanks Jonas for the reply

It may be "RING" AT Command but I have no idea how I can send this command from my application to BT vibrator? I have found one of the posted topics (Topic Id - 6656) where you have suggested to send “AT command” using stream connection. Please elaborate it.

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: connect to handsfree

Fri Oct 31, 2008 3:08 am

Connect to the serial port and try sending RING.
Or download the AT-transporter code. It's buggy and only works for some devices but at least it shows the basic idea of how it works.

Regards,
Jonas

kamalrsi
Posts: 8
Joined: Mon Oct 20, 2008 12:27 pm

RE: connect to handsfree

Fri Oct 31, 2008 4:15 pm

Hello Jonas,
After discovering BT device I am trying to use ConnectService using serial port.
code of lines that I m using for getting service is :

m_serviceCurrent = selectedDevice.ConnectService(selectedDevice.Address.ServiceChannelNumber, Franson.BlueTools.ServiceType.SerialPort);

Note:
selectedDevice.Address.ServiceChannelNumber is returning "-1', and
Franson.BlueTools.ServiceType.SerialPort is returning "Serial Port".

But I am getting exception "Failed to connect remote Bluetooth service".

Please advice me where I am wrong.

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: connect to handsfree

Fri Oct 31, 2008 4:23 pm

You must specify the service channel. The device's Address won't have a service channel as thisis how it differentiate between the services. Compare with how FTP works with TCP/IP and a port number. The address is the computer, the port is the specific FTP service. It's the same thing here, the Address just points out the correct device, then you need to specify the service channel to determine which service you wish to connect too.

When you run the service discovery you can see the channel number, it's the number after the ':'

Regards,
Jonas

kamalrsi
Posts: 8
Joined: Mon Oct 20, 2008 12:27 pm

RE: connect to handsfree

Fri Nov 07, 2008 4:50 pm

I tried to make connection with "Headset" service of one of the searched BT device as per the code below:

m_serviceCurrent = selectedDevice.ConnectService(m_serviceCurrent.Address.ServiceChannelNumber, m_serviceCurrent.Name);
m_streamCurrent = m_serviceCurrent.Stream;
Byte[] cmdBytes = System.Text.ASCIIEncoding.Default.GetBytes("RING");
m_streamCurrent.Write(cmdBytes, 0, cmdBytes.Length);

Although this code is not giving any exception error but it is not able to vibrate/Ring my BT device (Jabra BT250v). Please suggest where is the problem now?

Regards,
Kamal

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: connect to handsfree

Sun Nov 09, 2008 5:33 am

Well, first I must ask why you are attempting to connect again to the same service that you are already connected to?
For your actual question; no, I don't know why it won't vibrate. Perhaps it's not enough to just send RING to make it vibrate?

Regards,
Jonas

kamalrsi
Posts: 8
Joined: Mon Oct 20, 2008 12:27 pm

RE: connect to handsfree

Tue Nov 11, 2008 3:54 pm

First I am getting list of all services supported by remote device and then connect to one of them (headset). These are all hit and trials to make vibrate my BT device.

Have you ever tested/supported the below points using Franson bluetools?

1- Sending AT command like "RING", if yes, please guide for exact code.
OR
2- Sending audio to headset profile
OR
3- Open SCO connection for headset profile.

Return to “BlueTools”