Wireless Communication Library Support Forum

Frameworks => Bluetooth Framework => Topic started by: engpaulo on April 07, 2010, 06:21:58 PM

Title: Two devices connected at the same time on Server
Post by: engpaulo on April 07, 2010, 06:21:58 PM
Hi.

Is it possible to connect two devices at the same time in a server running on the PC?

I did tests with BlueChatServer and two devices (phone) connecting but was not possible.

Only accept one at a time

How can i do?

Thanks.

Title: Re: Two devices connected at the same time on Server
Post by: Mike Petrichenko on April 07, 2010, 06:48:23 PM
Hi,

You have to use more than 1 server class on PC side. Each one must run with the same port number but different channel.
Title: Re: Two devices connected at the same time on Server
Post by: engpaulo on April 07, 2010, 07:38:15 PM
hi,

i undestand.

So, several threads with different serial channels(ex: COM1,COM2,COM3 ....). Right?

In a communication device(phone) as client and PC as server, who must create the Virtual Com Port? Who makes the request? Client or Server?

Thanks

 
Title: Re: Two devices connected at the same time on Server
Post by: Mike Petrichenko on April 07, 2010, 10:25:10 PM
Hi,

You do not need any threads as WCl is async lib. What is COM1....COMx? Are we talking about bluetooth or serial communication?
What is Virtual Port? Are we talking about bluetooth or Serial communication?
Title: Re: Two devices connected at the same time on Server
Post by: engpaulo on April 07, 2010, 11:13:46 PM
Hi,

Sorry.

COM PORT: one port created for serial communication.
VIRTUAL PORT: com port emulated after connection.

When a client connects by bluetooth (RFCOMM), one COM PORT (Virtual COM, not physics) is emulated on PC for communication between DEVICE-CLIENT and PC-SERVER.

After this, is to write and read on this port for communication between two devices. Right?

In my tests, windows that specified the com port will be used.

My doubt is how to make the device communicate with PC-Server by RFCOMM. Who specifies the channel for communication?

has to be used the parameter: GUID("{1CBF2215-9E04-40d4-9CD7-BEE54683B97D}");    ????

My application must use RFCOMM.

thanks

Title: Re: Two devices connected at the same time on Server
Post by: Mike Petrichenko on April 08, 2010, 09:21:49 AM
Who told you that RFCOMM needs any COM ports (virtual or real)? It is wrong idea.

WCL does not use any virtual ports to communicate with remote device. As I wrote use more than one server classes on PC side.

Both devices shoudl use the same channel. Server creates SDP record and provide channel number for specified service. Client reads the channel number from SDP and connects to  this channel.
Title: Re: Two devices connected at the same time on Server
Post by: engpaulo on April 08, 2010, 08:38:40 PM
I undestand.

I am studying the windows API for bluetooth and working with the WCL. I intend to register later.

So this confused me because they are several paths to follow.

I need to create application with many devices (PHONE with software written in Java using RFCOMM)  connected to a server (PC Server written in C++ Builder using WCL). The PHONE application was not written by me. I'm doing just the server.

Can you give me some idea of how to do this with the WCL?

Thanks





Title: Re: Two devices connected at the same time on Server
Post by: Mike Petrichenko on April 08, 2010, 08:44:30 PM
Hi,

Yes of course. You can use Server demo as a start fro your application. Your server must run on the same UUID as Java app needs on the phone side. It is strongly recomended to use unique UUID. However, you canuse SPP UUID - but in this case you may have some issues if PC has other app running on SPP UUID service.
Title: Re: Two devices connected at the same time on Server
Post by: engpaulo on April 09, 2010, 04:26:23 PM
Good morning.

I did tests with BlueChatServer running on my PC and client running on phone.

The application that runs on the PHONE is done in JAVA.

Result of test:

Server running ( Listen ) and wait for client connection. 

Observation: The UUID is not in any way influencing, i change the number and the same thing happens.

Then start the client application on the PHONE and find a server PC.

The client connects and show on the PC Screen the message:

"Device ClientPhone(1F:AB:34:DC:87:1D) was connected to service 'Serial Port A (COM7) in this computer'."

So, the server add on listbox this message "Connected (1F:AB:34:DC:87:1D)".

So far so good.

So, i try to send something(bytes) by BlueChatServer but nothing happens. Same thing with the Client. Nothing is sent.

What i did... opened a Hyperterminal (windows), I connected in created COM ( 7 ) and write/read. Works well.

The software that runs on phone was not written by me and the developer said that uses a RFCOMM protocol.

Where am I wrong?

Thanks








Title: Re: Two devices connected at the same time on Server
Post by: Mike Petrichenko on April 09, 2010, 05:20:21 PM
What is BT drivers you use? BlueSoleil? What version?
Can you send me the Java app - i'll test it here and fix possible issue.
Title: Re: Two devices connected at the same time on Server
Post by: Mike Petrichenko on April 09, 2010, 06:00:24 PM
Also, what is service's UUID Java app uses?
Title: Re: Two devices connected at the same time on Server
Post by: engpaulo on April 09, 2010, 08:05:29 PM
Hi!

Yes, of course.

BlueSoleil version is:

Product Version: BlueSoleil 2.6.0.8 Release 070517

Stack Version 06.03.27.20061108


I  have another option too. WIDCOMM Bluetooth 3.0.1.914 but is not what I'm using


I'm sending the app java in your e-mail account.

The UUID services in the Java application is: SSP. is that right?

Thank you very much
Title: Re: Two devices connected at the same time on Server
Post by: Mike Petrichenko on April 09, 2010, 08:40:13 PM
I have just got the Java app and will check it.

Using SPP UUID is not good idea because stack may have its own server running on SPP UUID so your application may not receive any incomming connection.
Title: Re: Two devices connected at the same time on Server
Post by: Mike Petrichenko on April 09, 2010, 09:07:57 PM
Have just tested your app with BS stack. As I told BS has own SPP services running (in my case) on COM 7 and COM 8. So you \r java connects to BS SPP service.
 
There are 2 way to avoid such issue:
 
1. Use unique UUID
2. Disable SPP service in BS
Title: Re: Two devices connected at the same time on Server
Post by: engpaulo on April 12, 2010, 09:09:05 PM
Hi, Mike.

Sorry for the delay.

The application JAVA developer, gave me a UID that he set up on your application.

I set in my application Server but his application continue using the COM PORT.

Code: [Select]
wclServer->BluetoothParams->Service = StringToGUID("{71D47FA1-87B6-4629-AB78-77B482AE5316}");

About your solutions:

1. Use unique UUID
2. Disable SPP service in BS

1 - would be the case above?
2 - how do I disable this service?

You could use the java client app with bluechatServer? Without using SPP service.

Thanks.

Title: Re: Two devices connected at the same time on Server
Post by: Mike Petrichenko on April 12, 2010, 09:15:20 PM
Hi,

Yes, it is possible to use WCL UUID (from sample).

1. Yes
2. I think it is better to refer to BS help file (in my case it is in settings->services).

You are mixing up different things. BlueChatServer and SPP are different things. You canuse SPP UUID for chat server/client or can use any other. if you use SPP UUID then it can bring some issues as you had.