Wireless Communication Library Support Forum

Frameworks => Bluetooth Framework => Topic started by: TheodorosGR on September 27, 2008, 09:30:10 PM

Title: Blank device name
Post by: TheodorosGR on September 27, 2008, 09:30:10 PM
Hello everyone.
I have noticed that sometimes when i scan for devices i am not getting the name of the device,i get a blank value.After that when i rescan,the name is visible.If i restart the application the same is happening.Any workaround for this? Maybe a call or function to get name of the device based on the address.
Thanks!
Title: Re: Blank device name
Post by: Mike Petrichenko on September 27, 2008, 11:40:12 PM
It is normal for bluetooth. I will not repeat the things I alrady posted here (use the search please). Simple, read Name property few times (let say 3 times).
Title: Re: Blank device name
Post by: ami on October 26, 2010, 10:52:47 PM
I'm getting the same results. I'm getting a blank device name when scanning.

I'm using the demo which reads the name 3 times. The name is still blank.

I have two devices and it seems i can easily repeat this problem when i power one device down, and power up the other. The first discovery always returns a blank name.

I've tried up to 10 reads of the name field. Still blank.

Any ideas?
Title: Re: Blank device name
Post by: Mike Petrichenko on October 26, 2010, 10:55:11 PM
In few words: there is no solution for that as Bluetooth has 2 different commands: one for inquering devices and other for name reading. Those commands are exlusive so when inquiring name can not be read. Immeadialy after discovering stack *on both sides) is still busy. Second time you rediscover you get names.

The same you can see with standard bluetooth util which is shipped with any stack and this is not WCL issue.
Title: Re: Blank device name
Post by: ami on October 27, 2010, 02:09:59 AM
Thanks for the quick response.

I think I follow you. I should expect to see blank friendly names on the first discovery.

I'm trying to programatically setup the connection without any user interaction. The pin of my dev is part of the friendly name.

I don't want to have to wait 2 full scans to get the names. Will calling the discovery a 2nd time with the 'fast' param set to true give me the friendly names?
Title: Re: Blank device name
Post by: Mike Petrichenko on October 27, 2010, 06:58:10 AM
Better to do second discovery with small timeout interval.
Title: Re: Blank device name
Post by: ami on October 27, 2010, 02:41:11 PM
What interval would you recommend?

Also, what's the shortest interval i could use for the first scan?

Thanks.
Title: Re: Blank device name
Post by: Mike Petrichenko on October 27, 2010, 02:52:11 PM
Unfortunately there are no recomendations as it depends on your hardware and on remote devices hardware.
Title: Re: Blank device name
Post by: ami on October 27, 2010, 03:00:28 PM
Okay, i will play around with the timeouts.

Is there a synchronous call to discover?

Currently i'm using the device list that's returned in the discovery 'complete' event handler. When i loop through the list and receive a device that doesn't have a friendly name, what's the best way to get the friendly name?

I suppose i could post a message to myself to run another discover with a smaller timeout. It gets kinda klunky... surely there must be an easier way..
Title: Re: Blank device name
Post by: Mike Petrichenko on October 27, 2010, 03:30:01 PM
No, there is no synchronouse discover method. Easy way is to wait a littl ebit and the re-read names.
Title: Re: Blank device name
Post by: ami on October 27, 2010, 03:44:39 PM
Hmmm.... i could try that. But the question is, how do i have to wait? If it's anymore than a few 100 ms, i'll have to get into threading it otherwise it'll lock the GUI up.

Is there a wait interval that will guarantee that i will receive the name?

I guess i'm not clear on what is happening here.

If making 2 calls to discovery will guarantee i will get the name back, i'll probably just do that.

1. Post a message to make a discovery call.
2. In the complete handler see if this is the first discovery, if so post another message to make a discovery call with a reduced timeout else call GetName...



What about reading the name until i get something?
Title: Re: Blank device name
Post by: Mike Petrichenko on October 27, 2010, 04:00:15 PM
There is no common solution how to read names 100%. Usualy second discovering helps. Also some delay may help. With BlueSoilei: if you didn;t get name first time you will never get it. With WidComm - it usualy returns name correctly. Toshiba - same as WidComm. Microsoft - no guarantee, but second time you may get the name.

You can implement it in your application as you think is better.

The best way for me is save found device and start timer. When timer fires you can go thought the list and re-read names. Works in 95%
Title: Re: Blank device name
Post by: ami on October 27, 2010, 04:17:11 PM
Okay... that's helpful!

I've implemented what i described above it seems to work 95% of the time. I guess the only downside is that the user has to rescan.

I'd like to give the timer method a shot, what interval do you use?
Title: Re: Blank device name
Post by: Mike Petrichenko on October 27, 2010, 04:25:28 PM
About 5 seconds (timer is set to 7 but as you know windows is not real time system so it fires in about 4-7 seconds).