You Are Here:

Community: Developer Discussion Boards

#1 Old Problem with Windows BluetoothAPIs - 2006-08-31, 12:53

Join Date: Aug 2006
Posts: 1
AdamRogoz
Offline
Registered User
Hello

My aim is to write function that gets MAC address of the every machine that is close to my Bluetooth Adapter(for system that works on Windows XP)
This is a part of my code, that I use:

#include <winsock2.h>
#include <Ws2bth.h>
#include <BluetoothAPIs.h>


int CFindBTAddressDlg::BT_radio_find_radios()
{
int i = 0;
CString strTemp;
HBLUETOOTH_RADIO_FIND hFind;
BLUETOOTH_FIND_RADIO_PARAMS btfrp = { sizeof(btfrp) };

hFind = BluetoothFindFirstRadio( &btfrp, &(m_hRadio[i]) );
if( NULL != hFind )
{
i++;
while(TRUE == BluetoothFindNextRadio(hFind, &m_hRadio[i]))
{
i++;
if (i >= MAX_RADIOS)
{
CString strTemp;
strTemp.Format(IDS_BT_MAX_REACHED, MAX_RADIOS);
AfxMessageBox((LPCTSTR)strTemp);
return MAX_RADIOS;
}
}

if (FALSE == BluetoothFindRadioClose(hFind))
{
strTemp.Format("%s\n", GetLastErrorMessage(GetLastError()));
TRACE((LPCTSTR)strTemp);
}
}
else
{
strTemp.Format("%s\n", GetLastErrorMessage(GetLastError()));
TRACE((LPCTSTR)strTemp);
}
return i;
}



The problem is that this code doen't work with some Bluetooth adapters (for example with EpoX BT-DG06 Bluetooth USB Adapter).
The function "BluetoothFindFirstRadio" returns NULL. In my opinion it is due to fact that something blocks this function (for example Bluetooth Manager application) or BluetoothFindFirstRadio doesn't work with some kind of bluetooth adapters.

If someone knows how to resolve this problem I will be very grateful for help.

AdamRogoz
Reply With Quote

#2 Old Re: Problem with Windows BluetoothAPIs - 2006-08-31, 15:57

Join Date: Mar 2003
Posts: 6,211
petrib
Offline
Forum Nokia Champion
Have you asked the developers of drivers for the Bluetooth adapters (Microsoft, Widcomm, Toshiba or whomever)?
Reply With Quote

#3 Old Re: Problem with Windows BluetoothAPIs - 2006-08-31, 18:10

Join Date: Dec 2005
Posts: 1,159
Location: England,UK
jimgilmour1's Avatar
jimgilmour1
Offline
Forum Nokia Champion
Hi AdamRogoz
I am not quite sure that C++ has the same problem as Java but there needs to be a delay to allow the bluetooth adapter to respond. Some adapters take longer because they perform more radio channel hops than others.
In Java the code executes a Thread.sleep(1000).Delay over 1 second. Experiments with my Nokia 6230i show that the program takes over ten seconds to find all the addresses in an area where 200 people and 19 phones were found.

When you try to get the friendly name you will need to wait even longer as you are now trying to pick one phone from many.

My BTDiscover S60 2nd ed takes 10 seconds each on the epoc emulator.

Sorry I cannot understand the dialect of you C++ library.

Jim
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem MMC+USB Connection Fede81 General Symbian C++ 1 2007-06-14 07:13
Problem MMC+USB Connection Fede81 General Discussion 3 2006-07-19 16:21
MirrorProtocolParser.invokeMethod(Method, Object[]): Failure! Problem Pl Help me out montooshah Mobile Java Media (Graphics & Sounds) 1 2003-10-20 16:17
PJava runtime problem within Nokia 9210, Hrlp~! Nokia_Archive PersonalJava 1 2002-05-28 14:15
Nokia 6210, Windows 2000 ifd001 PC Suite API and PC Connectivity SDK 1 1970-01-01 02:00

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia