• void add(xxx i) Adds an integer or a double to the
values sent to the daemon.
• void add(xxx[] array) Adds an array of integers
or doubles to the values sent to the daemon.
• xxx getXXX() Retrieves an integer or double from
the return values.
• xxx[] getXXXArray() Retrieves an array of inte-
gers or doubles from the return values.
• void setCommand(int cmd) Sets the identifier of
the command to be called on the daemon’s side.
• boolean communicate() Opens the network con-
nection, sends the parameters, reads return values,
and closes the connection.
The following functions can be used during C++
skeleton implementation:
• TXXX CSRemoteFunctions::getXXX()
Reads an integer or double value from the input
stream that was received from the Java Stub.
• CArrayFixFlat<TXXX>* CSRemoteFunc-
tions::getXXXArray()
Reads an array of integers or doubles from the in-
put stream that was received from the Java Stub.
• void CSRemoteFunctions::addXXX (TXXX x)
Writes an integer/double to the output stream that
will be sent to the Java Stub.
• void CSRemoteFunctions::addXXXArray
(CArrayFixFlat<TXXX>* array)
Writes an integer/double array to the output
stream that will be sent to the Java Stub.
5 MEASUREMENTS
Tests were conducted to measure the overhead of the
function call in the framework between the Java stub
and C++ skeleton. For the test the add function intro-
duced above was used. It was called 1000 times from
a J2ME midlet. The function was also implemented
in Java for control purposes. The smartphone used in
the tests was a Nokia N90.
The results show that the average execution time
was 78.53ms when the connection was not opened for
each call, 105.33ms when for each call a new con-
nection was established, and 0.014ms when the Java
implementation of the function was called.
The measurements show that the overhead of the
network communication is considerable. Still, au-
thors are convinced that for numerous problems the
idea proposed offers the only solution.
6 SUMMARY AND FURTHER
WORK
Authors proposed a simple framework in order to help
smartphone developers gain both from the advantages
of J2ME and C++ in Symbian OS. The idea is that
while JNI is not supported by J2ME, with the help of
the built-in networking support a daemon written in
C++ can serve as a function-provider in cases when
problems with pure J2ME features can not be solved.
The results described in the paper are preliminary.
Authors consider the following the major focal points
in further development.
Adding more parameter types. The current set of
parameter types (int, double, and their arrays) is insuf-
ficient. Authors plan to support more primitive types
(boolean, char, byte), as well as compound types (like
structs in IDL).
Automated skeleton and stub generation. Cur-
rently all code is written by the developer. In the near
future authors will develop an simplified IDL-like lan-
guage for specifying the functions, and a simple com-
piler that generates both C++ skeleton code and Java
stub code.
Protocol revision. The protocol currently used has
to be revised regarding efficiency and fault-tolerance.
Performance measurements. It has to be mea-
sured how the framework performs in different cir-
cumstances.
REFERENCES
J2ME (2002). Java 2 Micro Edition. http://www.jcp.org/en/
jsr/detail?id=68.
JNI (2003). Java Native Interface Specification.
http://java.sun.com/javase/6/docs/technotes/guides/
jni/spec/jniTOC.html.
Liang, S. (1999). The Java Native Interface Programmer’s
Guide and Specification. Prentice Hall PTR.
m:metrics (2007). Mobile market measures.
http://images.servicesmobiles.fr/press/passport-
sping2007.pdf.
Symbian (2005). Symbian OS. http://www.symbian.com/.
Telephia (2006). Americans lag behind europeans in smart-
phone adoption.
Wallace, B. (2006). 30 countries passed 100% mobile
phone penetration in q1. Telecommunications Online.
WINSYS 2008 - International Conference on Wireless Information Networks and Systems
244