Sunday, December 2, 2007

5th seminar 30.11

Last week we have started writing a Java application for mobile phone, which will communicate with NXT device. I tried to write a simple library for bluetooth utilization on mobile phones, so that my colleagues could continue with developing a remote control application. My goal was to make my Nokia phone connect to the NXT and send some data to it. I've used BTReceive program from LeJos examples for our NXT device. This application simply waits for connection and then prints all received signals to the NXT's display.

I have made a simple interface for device searching, investigated, what bluetooth services NXT has and tried to establish connection with it. So my progress so far is the following: I can find NXT devices in range and establish connection with them. But still my code doesn't works well, because sometimes phone complains that he wants to pair with NXT device first befor connecting. I still did not find how to do this. The second problem is that BTReceive application installed at our NXT device doesn't show correctly numbers that I'm sending to it. Further investigation of Bluetooth settings is required.

At the seminar we told about all our progress and problems. Actually we already did a lot, because setup of Bluetooth is the unpredictable part of our work: if could not manage it then we would not be able to do anything.

Also we told about limitations which we discovered in LeJOS after deeper digging into it. For instance, there is no "swicth" operator at all, there can be only 64 fields in a class, there are problems with big numbers (arithmetic operations with long data type are not supported) and the 4th sensor port doesn't work with some types of sensors. The main limitation of LeJOS which should be always kept in mind is there is no garbage collector in it. So you should not create any object instances repeatedly (in loops or in listener methods), otherwise you will get an out of memory. But still LeJOS seems to be powerfull tool because of threads and synchronization support, which makes it usual for Java-programmers.

It is a last seminar before the final one so we have a lot of work to do during holidays...

No comments: