One of the goal of this project was to modify an existing program that was included with the Bluetooth demo boards from Ericsson to stream video instead of text messages.
Our system model
As a first step, we were intent to start with the Ericsson chat application as our foundation but modify it to suit our needs.This strategy made the most sense since the chat program took care of discovering other Bluetooth enabled devices, discovering what services they had to offer, and establishing a link. All we had to do was send packets of video in a timely manor instead of strings of text sent very sporadically.
The next step was synchronize the Server with the Video Encoder, since our group had little to no Windows programming experience going into this project, this problem seemed fairly big. Finally, we decided that since we were encoding a pre-recoded file anyways that we might as well just compress the video off-line and then just transmit the results. Though this did not reflect what we wanted in the end, it was a good simplification of the system so that we could concentrate on the Bluetooth link.
The rest of the Server creation went well. A timer was utilized to periodically read data from the file and pass that data to the Bluetooth protocol stack via a COM_DataSend method used in the chat application.
Developing the Client
The development of the client followed the same path as the server in that we started with the chat application as a foundation.
In order to link the H.263 decoder to the Bluetooth client, we need to convert the decoder from reading from a file to getting the data from standard IO. The only issue during this was the need to set the IO properties to binary instead of the default of ASCII.
And then creating a pipe (similar to what is used in UNIX to direct output and input from the command line) to allow the client to direct the data to the decoder. To do this we use the CreatePipe system call, and linked the client to the decoder that was spawned once the connection was made. By doing this, the OS took care of the buffering that was needed between the two processes.