hhegde
Posts: 17
Joined: Fri Oct 12, 2007 12:58 am
Location: USA

COD filter

Mon Nov 05, 2007 11:35 pm

Hi,
I am trying to connect to a bluetooth device through a computer, But the data sheet of the device says that, it tries to connect to the device with matched COD filter and service name..
If I know the values of the COD filter, how do I set, and discover device with a given cod filter and address... ?

regards

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

RE: COD filter

Mon Nov 05, 2007 11:57 pm

COD is "Class of Device" and will be available in the next BlueTools version.
It's not really required if you want to just connect to a device though, but it can be useful to distinguish the devices in your bluetooth neighbourhood.

Regards,
Jonas

hhegde
Posts: 17
Joined: Fri Oct 12, 2007 12:58 am
Location: USA

RE: COD filter

Tue Nov 06, 2007 12:14 am

I want to get the data from a weighing scale to my computer through bluetooth. here, the weighing scale acts as a master and initiates connection. it directly transmits to a previously paired device or checks for a device with a matching COD filter...
So, I guess,I need to set the COD filter on my computer the the value specified in the data sheet of the device. Is there a workaround ? can i directly connect to the device ?

regards

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

RE: COD filter

Tue Nov 06, 2007 12:52 am

Aha, you want to set the COD. I am not aware that is possible.
Class of device of your computer would typically be "Computer".
I think it's hard-coded in the bluetooth stack of the device to ensure that no devices report invalid results.

Regards,
Jonas

hhegde
Posts: 17
Joined: Fri Oct 12, 2007 12:58 am
Location: USA

RE: COD filter

Wed Nov 07, 2007 10:13 pm

Could you help me by telling how to write a code for a slave bluetooth device ? Apparently the weighing scale is programmed as a master device and it initiates connection, I cannot use remotedevice.connectdevice, because then the device wont respond...
so, could you tell me what modules to use and how to connect to a master ?

regards,

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

RE: COD filter

Thu Nov 08, 2007 2:28 am

If you want to create a "slave" you need to create a service yourself that the device can connect too I guess?
Look at the SimpleService application. That shows how to create a slave-type of application.

Regards,
Jonas

hhegde
Posts: 17
Joined: Fri Oct 12, 2007 12:58 am
Location: USA

RE: COD filter

Thu Nov 15, 2007 1:28 am

Hi,
I used the sample service program to advertise the service, the device is not uploading the data...i.e. the device connects to the computer, but the program control does not come to the function "m_service_ClientConnected(object sender, BlueToolsEventArgs eventArgs) "

Since I am not initiating connection, I dont need to give device address right ? Once the device connects to the computer the control should come to the above method...but its not happening...any insights ?

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

RE: COD filter

Thu Nov 15, 2007 9:38 am

What service do you advertise? If your computer's bluetooth stack natively offers this service the device will connect to this service instead of the BlueTools offered service since it was registered before. In that case you have to first shut the native service down.

Regards,
Jonas

hhegde
Posts: 17
Joined: Fri Oct 12, 2007 12:58 am
Location: USA

RE: COD filter

Fri Nov 16, 2007 12:42 am

Hi,
The device requires the service name to be " PWAccessP ". So, in the sample service application i changed the service name from "sampleservice" to "PWAccessP". It is not a service that the computer natively offers i guess...and how do i turn off the native service so that the device connetc to this service ?

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

RE: COD filter

Fri Nov 16, 2007 9:46 am

The service name is probably irrelevant though, what _kind_ of service is it? A serial port service?
I'm not even sure your computer is offering it natively, but if it is it's shutdown differently depending on the stack.

Regards,
Jonas

hhegde
Posts: 17
Joined: Fri Oct 12, 2007 12:58 am
Location: USA

RE: COD filter

Fri Nov 16, 2007 11:45 pm

The service type is SerialPort.
when I create a new service like this :
m_service = new LocalService(ServiceType.SerialPort, "PWAccessP", "Weight");
isn't the service name advertised to any external devices trying to connect ?
the device is getting connected to the computer. I know this from the status of the bluetooth icon on the desktop. But the devioce is unable to load data into the computer because as soon as the device is connected, the program control is not coming to the routine where i have established a stream and get the data from the device.

the routine is declared like this :
m_service.ClientConnected += new BlueToolsEventHandler(m_service_ClientConnected);

so, as soon as the device is connected to the computer the control should come to the routine :
private void m_service_ClientConnected(object sender, BlueToolsEventArgs eventArgs)

but, this is not happening ?
do I have to declare anything else for this to happen ?

It would help me a lot if you could solve this problem of mine..

hhegde
Posts: 17
Joined: Fri Oct 12, 2007 12:58 am
Location: USA

RE: COD filter

Sat Nov 17, 2007 12:13 am

Hi,
in addition to the above question i have one more question to ask...
When I am acting as a slave. How do I keep searching for the device and connect to the service as soon as the device becomes active... ?

thanks

Adil Amjad
Posts: 6
Joined: Fri Jan 23, 2009 11:41 am

RE: COD filter

Mon Mar 23, 2009 6:30 pm

Hello hhedge and Jonas.

I am trying a similar experiment as hhedge. I have a bluetooth-enabled blood pressure that acts as a bluetooth master. After measuring the bleed pressure, it searches for an advertised service called "PWAccessP" with COD filter "00000000".

I downloaded the BlueTools SDK. I am using Microsoft Visual Studio 2008 on Windows XP SP2. I am using SimpleService sample application found in dotNet, dotNet200. The only modification that I made are the trial license key and changing the service name to "PWAccessP" in the following line

m_service = new LocalService(ServiceType.SerialPort, "PWAccessP", "PWAccessP");

When I run SimpleApplication on my laptop, I get the following exception:
[10038] Franson.BlueTools.BlueToolsException: Failed to bind to bluetooth socket
at Franson.BlueTools.Toolkit.PullException(IntPtr obj)
at Franson.BlueTools.Server.Advertise(Service service, Int32 SCN)
at SimpleService.Form1.bAdvertise_Click(Object sender, EventArgs e) in C:\Program Files\Franson\BlueTools SDK v1.21\dotNet\C#\SimpleService\Form1.cs:line 509

I get the same exception when I use SimpleService in dotNet200.

Then I installed the BlueTools.arm.CAB on my i-mate Jasjar (HTC UNIVERSAL). I have Windows Mobile 6.1 on it. I compiled the SimpleService sample application in dotNetCF and dotNetCF200 folder. When I run the application on the PDA and click Advertise, the status changes to Service Advertised. However the blood pressure monitor does not connect with the PDA. I placed breakpoints in the m_service_ClientConnected(). This function is never excuted.

Can you explain what would I be missing?

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

RE: COD filter

Mon Mar 23, 2009 7:14 pm

Can you detect it with another device?

Regards,
Jonas

Adil Amjad
Posts: 6
Joined: Fri Jan 23, 2009 11:41 am

RE: COD filter

Mon Mar 23, 2009 9:54 pm

The blood pressure meter came with a java software. This software is successful in detecting the blood pressure meter as well as downloading the measurements.

Return to “BlueTools”