| Reply | « Previous Thread | Next Thread » |
|
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 |
|
Have you asked the developers of drivers for the Bluetooth adapters (Microsoft, Widcomm, Toshiba or whomever)?
|
|
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 |
| jimgilmour1 |
| View Public Profile |
| Find all posts by jimgilmour1 |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| 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 |