We are writing a streaming data service using C# on Windows Vista, with the latest BlueTools API 1.21. This service is effectively a Serial Port Service that allows a client to connect over Bluetooth. Once the client has connected the service streams out data as fast as it can. The client is another Vista machine. Both machines are using a Broadcomm USB BT Dongle, and the standard Microsoft BT Stack as supplied for Vista Serive Pack 1.
When we use BlueTools API to perform the streaming server work we are getting maximum data rates of approximately 40 Kbytes/sec.
When we change our code to use a virtual serial port as supplied by the Windows Bluetooth Stack, and stream data out over the correct serial port we are achieving rates as high as 250Kbytes/sec.
In both cases the Client connecting in and receiving the data is the same Vista box.
We know that Bluetooth 2.0 EDR has a maximum theoretical throughput of 3MBits/s, and with the overhead of packetizing, guaranteed delivery etc… we typically expect 2MBits/s of data transfer. 2MBit/s corresponds to 250Kbytes/sec. So with a virtual com port we are seeing the maximum throughput as we’d expect it.
But in using your tools we get much lower data rates. Are we doing something wrong or its there a problem with your libraries?
Here’s the pseudo code for what we are doing:
Case 1: using virtual serial port via MS Bluetooth Stack
Bluetooth pairing is done with client machine, PINs are exchanged and MS reports that outgoing data can be sent to COM3.
<font face="Courier New"><font color="green">SerialPort serialPort = new SerialPort();
inside separate thread:
byte buffer = new byte;
serialPort.Write(buffer, 0, buffer.Length); //Returns when data has been sent
}while(!exit);</font id="green"></font id="Courier New">
Case 2: Using BlueTools API
<font face="Courier New"><font color="green">localService = new LocalService(ServiceType.SerialPort, “MySerialPortService”, "");
localService.ClientConnected += new BlueToolsEventHandler(ClientConnected);
private void ClientConnected(object sender, BlueToolsEventArgs eventArgs)
ConnectionEventArgs connectionEvent = (ConnectionEventArgs) eventArgs;
connectedSession = connectionEvent.Session;
stream = connectedSession.Stream;
byte buffer = new byte;
stream.Write(buffer, 0, buffer.Length);
</font id="green"> </font id="Courier New">
Does anyone have similar experience. Has anyone gots BlueTools streaming data out faster than 40KBytes/sec.
What are we doing wrong?