Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
heinz85
Posts: 2
Registered: ‎09-18-2013
My Device: I'm a developer

BT connection with desktop computer.

Hello.

I'm trying to connect to the sample SPP chat application from my desktop and something goes wrong :smileysad:.

 

What I do is the following:

 

1. Run the sample app and open an SPP server (it shows that it is waiting for a connection).

2. Call the winsock connect function with the right device address, GUID, protocol family and port set to zero... (I get the device address after succesfully paring with the device).

 

3. Try to send some text to the application...

 

Well, the problem is that I always fail in step 2....

 

WSAGetLastError returns error code 10060, which means that I've reached timout or failed connecting for some other reason...

 

Can anybody tell me what am I doing wrong?

In general, anyone can post an example of how to communicate between some desktop application and a BB device using BT?

 

Thanks,

Heinrich

 

 

Please use plain text.
Retired
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

Re: BT connection with desktop computer.

Hi,

 

I haven't used the windows API to make an SPP connection like this. Can you share source code so I could have a look at what's going on?

 

Thanks!

--
Rob is no longer associated with BlackBerry.
Please use plain text.
New Contributor
heinz85
Posts: 2
Registered: ‎09-18-2013
My Device: I'm a developer

Re: BT connection with desktop computer.

Hello.

Here is the code snippet...

 

memset(&socket_addr, 0, sizeof(socket_addr));
socket_addr.addressFamily = AF_BTH;
socket_addr.btAddr = Devices[DeviceIdx].Address; // the device address is correct (I checked it manually).
socket_addr.serviceClassId = ServiceGuid; // this is actually the GUID used by the sample BT chat application...
err=connect(client_socket,(SOCKADDR *)&socket_addr,sizeof(socket_addr));

// and here I get err == SOCKET_ERROR....


err = WSAGetLastError(); // error code is 10060.

 

Thank you,

Heinrich

Please use plain text.
Retired
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

Re: BT connection with desktop computer.

Hi,

 

Can you try something for me? What happens if you use 0x1101 instead of the actual UUID?

 

Thanks!

--
Rob is no longer associated with BlackBerry.
Please use plain text.