Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pundik Dmitry & Blekhman Alexandr 2001/02 Final Presentation Semester B הטכניון - מכון טכנולוגי לישראל המעבדה למערכות ספרתיות מהירות הפקולטה להנדסת חשמל.

Similar presentations


Presentation on theme: "Pundik Dmitry & Blekhman Alexandr 2001/02 Final Presentation Semester B הטכניון - מכון טכנולוגי לישראל המעבדה למערכות ספרתיות מהירות הפקולטה להנדסת חשמל."— Presentation transcript:

1

2 Pundik Dmitry & Blekhman Alexandr 2001/02 Final Presentation Semester B הטכניון - מכון טכנולוגי לישראל המעבדה למערכות ספרתיות מהירות הפקולטה להנדסת חשמל Pundik Dmitry & Blekhman Alexandr Instructor: Konstanin Sinyuk

3 Pundik Dmitry & Blekhman Alexandr 2001/02 Project Goals In our project we build communication infrastructure that will be used in another projects in CE Lab (Just ™ and Bluetooth game). Our goal is to come out with a reliable and easy to use multipoint BlueTooth stack and design a complete API in Java for common communication tasks. Our stack will be working both on Pc and on iPaq. The server will be able to split the work between two Bluetooth units.

4 Pundik Dmitry & Blekhman Alexandr 2001/02 BlueTooth Overview Short range wireless technology. Network solution for handheld devices.

5 Pundik Dmitry & Blekhman Alexandr 2001/02 System Overview LAN Client 1Client 2Client 7 BT PC LAN Access Point

6 Pundik Dmitry & Blekhman Alexandr 2001/02 Software Final Architecture In the end of the first part of the project, we have released two objects: 1. RFSocket / RFSocketCE – an object that is responsible for BT data transfer through a virtual socket. 2. RFServerSocket / RFServerSocketCE – an object that is responsible for the server side of BT connection. These objects allow transparent use of client/server architecture over Bluetooth network.

7 Pundik Dmitry & Blekhman Alexandr 2001/02 RFServerSocket API Main methods: Connect : initializes the connection, performs inquiry, builds the database of clients and services, creates the connections to all the clients found. Accept : returns a reference to one RFSocket of all active connections at a time. Close : closes all connections, destroys databases, and exits.

8 Pundik Dmitry & Blekhman Alexandr 2001/02 RFServerSocket API Diagram RFServerSocket: a data structure of connected RFSockets, one RFSocket for every connected device: Connect Accept Close Connected socket

9 Pundik Dmitry & Blekhman Alexandr 2001/02 RFSocket API Main methods: GetInputStream : returns the stream, that reads the data. The stream implements Java’s inputStream interface. GetOutputStream : returns the stream, that sends the data. The stream implements Java’s outputStream interface. Disconnect : disconnects the client the object refers to, and notifies the server about the socket termination.

10 Pundik Dmitry & Blekhman Alexandr 2001/02 RFSocket API Diagram GetInputStream RFInputStream Read GetOutputStream RFOutputStream Write Disconnect Call the server for disconnection RFSocket

11 Pundik Dmitry & Blekhman Alexandr 2001/02 JNI The Java Native Interface (JNI) allows Java code to operate with applications written in other languages. You can call functions and methods implemented in other languages, such as C or C++. This can be used in integrating an already existing (legacy) application into a Java application.

12 Pundik Dmitry & Blekhman Alexandr 2001/02 Porting to Java We wrote the classes in C/C++, and compiled them into a Dynamic Link Library (DLL). We created shell classes in Java and listed there all methods of the C++ classes. We connected between Java side and C++ side with the aid of JNI. Upon the creation of Java object, a corresponding C++ object was created in the DLL, and when a method was called from Java, the call was redirected to the object in DLL and performed there.

13 Pundik Dmitry & Blekhman Alexandr 2001/02 Complement with Java standard Java specifies a standard for communication SW. Our classes (RFInputStream and RFOutputStream) extend standard Java InputStream and OutputStream interfaces, so they can be used and exchanged automatically, as if they were intrinsic Java classes. We put them into Java mutually synchronized objects and this makes easy the transfer of any serializable Java object.

14 Pundik Dmitry & Blekhman Alexandr 2001/02 Integration We adjusted the classes and the operation scheme to the needs of our companion project. We added many new features and modes to our classes:  Synchronization (stability)  Blocking mode for reading  Buffers (performance)

15 Pundik Dmitry & Blekhman Alexandr 2001/02 Stack hierarchy We added several levels of abstraction on top of standard BlueTooth layers. BlueTooth stack API RFServices package (C++) RFSocket + RFServerSocket (Java) JNI RFInputStream + RFOutputStream (Java)

16 Pundik Dmitry & Blekhman Alexandr 2001/02 Server – connection Server initializes Server does not proceed until there is at least one client around Server performs inquiry and device discovery Server checks if there is any connected device around RFServerSocket serverSocket = new RFServerSocket(); int clientNum = 0; serverSocket.Connect(); while (clientNum == 0) { clientNum=serverSocket.GetC onnectionsNumber(); }

17 Pundik Dmitry & Blekhman Alexandr 2001/02 Server – stream setup If any device found, we proceed: We get the socket that is connected to the first device We extract Input stream from the socket and build Java standard ObjectInputStream upon it. The same with OutputStream Transfer of objects through the connection is trivial RFSocket socket = serverSocket.Accept(); obj_in = new ObjectInputStream(socket.getInputStrea m()); obj_out = new ObjectOutputStream(socket.getOutputStr eam()); obj_out.writeObject(new String("String from server"));

18 Pundik Dmitry & Blekhman Alexandr 2001/02 Client – connection Client prepares initial socket object Client gets ready for connection We wait for server to bind a connection RFSocketCE socket = new RFSocketCE(); socket.Init(); while (!socket.IsConnected()) { synchronized (this) { try { wait(1000); } catch (Exception ee) {} }

19 Pundik Dmitry & Blekhman Alexandr 2001/02 Client – stream setup Once the connection is established, we extract Input stream from the socket and build Java standard ObjectInputStream upon it. The same with OutputStream Transfer of objects through the connection is trivial obj_out = new ObjectOutputStream(socket.getOutputStr eam()); obj_in = new ObjectInputStream(socket.getInputStrea m()); obj_out.writeObject(new String("String from client"));

20 Pundik Dmitry & Blekhman Alexandr 2001/02 Original Design According to the original design, our classes were based upon DigiAnswer API, that was supplied with the DigiAnswer BT device. This made easy the handling of data structures for clients, serial port profiles and virtual COM ports. We established a complete operational stack in Java over DigiAnswer API and tested its work with Jini system. We managed to run Jini’s image service with considerable ease and good performance.

21 Pundik Dmitry & Blekhman Alexandr 2001/02 Lacks of DigiAnswer API At tests, it appeared that DigiAnswer stack is unstable. We saw that sometimes we were loosing small amounts of data. This is unacceptable in new operation scheme, in particular since stream synchronization demands exact transfer of data during handshake process. We were forced to change our BlueTooth devices and base our API on another stack implementation.

22 Pundik Dmitry & Blekhman Alexandr 2001/02 A solution We moved to Philips Bluetooth cards. We made changes to SW that Oren wrote in C++ for Philips devices and adjusted it to our operation concept. Then, we established once again Java shell over the C++ code. At the end of this process, we have good reliable BlueTooth stack that is accessed through the same API as the previous one (DigiAnswer)

23 Pundik Dmitry & Blekhman Alexandr 2001/02 Philips Bluetooth devices Compared to DigiAnswer devices, Philips units have low-level interface. Philips units are attached to the computer through a COM port. The code for Philips stack came to us as a heritage from Oren. Since the units require control on a very low level, there are lots of functions that are responsible for event handling, for wrapping around packets of data or code according to their type.

24 Pundik Dmitry & Blekhman Alexandr 2001/02 Operative difficulties With both stacks, search for new clients was taking about 10 seconds, at this time no data could be transferred. Since device discovery has to be done rather frequently at LAP, this setup could not be satisfactory. Our solution is to separate the work between 2 BlueTooth units working together on the LAP. Discovery will be done with DigiAnswer unit, and data transfer – with Philips unit. Philips unit is reliable on data transfer, while discovery is data loss safe.

25 Pundik Dmitry & Blekhman Alexandr 2001/02 Two units Connection and data transfer with open sockets (RFSockets) Discovered device New device comes into range Device is discovered Empty connection slot Read/Write data Connected socket 3 Connected socket 4 DigiAnswer unitPhilips unit Device discovery (RFServerSocket) Connect

26 Pundik Dmitry & Blekhman Alexandr 2001/02 Enhancements Our stack is universal and can be used either on PC or on iPaq. On PC, the system is built with Visual Studio 6 and relies on JDK 1.2. On iPaq, the system is built with Embedded Studio 3 and relies on Jeode Personal Java 1.2 (eq. to JDK 1.1.8) Since our API is ported to Java, it is generic and can be used on any system with Java version of 1.2 and higher.

27 Pundik Dmitry & Blekhman Alexandr 2001/02 Server on iPaq We help another team at the lab with their work on BlueTooth game. To assist them, we developed a variation of our software where the server is located on iPaq. Possible usage of iPaq as LAP. Usage scheme and API remains.

28 Pundik Dmitry & Blekhman Alexandr 2001/02 Summary Complete multipoint API on DigiAnswer and Philips devices. Enhancements and additions. Two units. Server on iPaq.

29 Pundik Dmitry & Blekhman Alexandr 2001/02


Download ppt "Pundik Dmitry & Blekhman Alexandr 2001/02 Final Presentation Semester B הטכניון - מכון טכנולוגי לישראל המעבדה למערכות ספרתיות מהירות הפקולטה להנדסת חשמל."

Similar presentations


Ads by Google