Bluetooth app

M

Maxim

Hello, everyone!

I'm trying to create a simple test app to connect PDA to Desktop through
bluetooth. But I cannot accomplish even this simple thing.

First, I tried to use 32feet.net bluetooth component. But
BluetoothRadio.PrimaryRadio returns null. Also BluetoothRadio.IsSupported
returns false.

Then I tried to discover bluetooth device (desktop computer) using WinCE
native calls. Following is my code for this:

// Get Winsock-related data

WSADATA wsd;
WSAStartup (MAKEWORD(1,0), &wsd);


// Specify search parameters

WSAQUERYSET wsaq;
ZeroMemory(&wsaq, sizeof(wsaq));
wsaq.dwSize = sizeof(wsaq);
wsaq.dwNameSpace = NS_BTH;
wsaq.lpcsaBuffer = NULL;


// Start look up

HANDLE hLookup;

int iRet = WSALookupServiceBegin (&wsaq, LUP_CONTAINERS, &hLookup);


// Enumerate devices that were scanned


// Configure a WSAQUERYSET structure to store device data returned by
WSALookupServiceNext

CHAR buf[4096];
LPWSAQUERYSET pwsaResults = (LPWSAQUERYSET) buf;
ZeroMemory(pwsaResults, sizeof(WSAQUERYSET));
pwsaResults->dwSize = sizeof(WSAQUERYSET);
pwsaResults->dwNameSpace = NS_BTH;
pwsaResults->lpBlob = NULL;


DWORD dwSize = sizeof(buf);
iRet = WSALookupServiceNext (hLookup, LUP_RETURN_NAME | LUP_RETURN_ADDR,
&dwSize, pwsaResults);


After last call I get SOCKET_ERROR, and WSAGetLastError() returns error code
WSANETDOWN.

I've tried to restart both systems (Desktop & PDA) - nothing helps.

I saw several comments about protocol stack. That it must be compatible with
microsoft standard. Not sure what it really means.

In the test I used the folowing devices:
PDA:
hp iPAQ PPC h4100 series, Model H4150
with Microsoft Pocket PC Version 4.20.0 (Build 13252)
Desktop:
USB Bluetooth ORIENT B303
WinXP SP2
BlueSoleil 1.6.1.4 Release 050606, Stack version 05.04.05.20050408

Need to say that I've established PDA-Desktop bluetooth connection using
ActiveSync. It works fine.

Could anybody help me. Any advices/suggestions/links are very appreciated.

Thanks in advance
 
G

Guest

Sounds like it uses the Widcomm stack. You'll need to get their SDK or
another third party one to programmatically access it.

-Chris
 
M

Maxim

Sounds like it uses the Widcomm stack. You'll need to get their SDK or
another third party one to programmatically access it.

But why ActiveSync works without any SDKs?
 
G

Guest

You're assuming that whoever wrote the driver ActiveSync is using (HP)
didn't have the SDK. That's a bad assumption - I bet they did (it would
have been tough to write it without).

-Chris
 
M

Maxim

Does it mean that I have to do some settings manually? I'd like to discover
other devices and connect to them programmatically.

"John J. Novak" <[email protected]> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ ×
ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
 
G

Guest

You cannot discover devices using the Serial Port Protocol. For that you'll
need to purchase an SDK that supports the installed Bluetooth stack. You
have one port for client connections (i.e., PPC initiates) and one port for
server (i.e., desktop PC initiates) connections. The PPC Bluetooth Manager
will provide the assigned port numbers. These ports work like normal COM
ports. There's an equivalent pair on the desktop PC side. Plus, you can
usually add client and server COM ports on the desktop side using its
Bluetooth Manager.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top