mobile
F2F Computing goes Mobile
Main contributer: Sven Kirsimäe (matrix) Other contributers: Ulrich Norbisrath (ulno), Artjom Lind (artjom85)
Contents
As F2F allows a simple construction of overlay networks, we also plan to use it for interactive applications and extend it to the area of mobile phones. Our first project will adapt the rewritten F2F Computing to Symbian and evaluate this platform with some interactive sample applications.
Sven's master thesis
Installation packages
Python application environment (install into phone memory) PyS60 3rd Ed. v1.4.5 PyS60 3rd Ed. v1.4.5 Shell
Open C for Symbian (install into phone memory) Open C F2F Mobile Computing framework (install into phone memory) F2F Mobile Mobile client for the F2F Mobile Computing framework account pc01 at jabber.cs.ut.ee account pc02 at jabber.cs.ut.ee account pc03 at jabber.cs.ut.ee F2F Computing framework compiled for the Windows XP (requires Python) F2F framework
Some random links
For getting this done, we have already collected a couple of helpful links:
http://sebsauvage.net/python/mingw.html - Python + Windows + distutils + SWIG + gcc MinGW
http://code.google.com/p/scons-for-symbian/ - scons for building projects for symbian
http://www.martin.st/symbian/ - Symbian Compile Toolchain for Linux
http://blog.redinnovation.com/2008/04/19/pys60-application-release-build-toolchain/
What you need for Symbian development (on Windows)
Install all the files on one partition and do not use directory names that have spaces in it (Perl will may not like it).
Active Perl 5.6.1 build 631 (http://downloads.activestate.com/ActivePerl/) required. NO OTHER VERSION IS SUITABLE!
-
Symbian SDK from http://www.forum.nokia.com/info/sw.nokia.com/id/4a7149a5-95a5-4726-913a-3c6f21eb65a5/S60-SDK-0616-3.0-mr.html. Currenlty, we try the 3rd edition Symbian 9.0 and onwards (Nokia E61 and others)
you need to login to get stuff from forum.nokia.com [*]
for more info on Symbian S60 platforms here http://en.wikipedia.org/wiki/S60_platform.
-
hint: define variable 'EPOCROOT' to the root of the SDK as some tools may require it to locate the SDK. Define the root without drive letter. Example:
EPOCROOT=\Install\Nokia\S60_3rd_FP1\
-
Carbide.c++ v2.0 from http://www.forum.nokia.com/info/sw.nokia.com/id/dbb8841d-832c-43a6-be13-f78119a2b4cb.htm
you need to login to get stuff from forum.nokia.com [*]
Reference for other tools if required.
[*] - reference http://www.bugmenot.com/view/forum.nokia.com or http://mailinator.com for temporary usernames
Missing libraries
-
pyexpat (from the Jabber client) - http://teemuharju.net/pys60/pys60-pyexpat_3rded.zip (read: http://discussion.forum.nokia.com/forum/showthread.php?t=97293&page=1) Notice, this needs to be installed under the different place than the resulting _f2fcore.lib ... (older version here: http://pdis.hiit.fi/pdis/download/pyexpat/)
Probably will be another .sis separate install package
-
Hashlib needs to be compiled from the Python source. Will end up with multiple libraries _hashlib.pyd, _sha.pyd, _sha256.pyd, _sha512.pyd.
Probably, need to make sure they are all installed from one .sis, if possible.
Probably dont need all of them as sha1 is actually used. Can be optimized when the "hello world" works on the mobile
Python for S60
Symbian S60 SDK is required (ref. previous)
From http://opensource.nokia.com/projects/pythonfors60/ pointed to the latest stable http://www.forum.nokia.com/python
Getting it all compiling for S60
*01.05.09: The section is deprecated. Needs to be revised!!!*
Get the tools installed (ref: previous paragraphs)
If developing under the Carbide, move the headers under 'inc' directory. Source files may require redifinition of the header #include directives.
-
Make the source C++ -compatible:
The .c files rename to .cpp as the compiler will then compile them with C++ compiler (currently I do not know how the switch the compiler to compile .c files as c++ files).
-
Include the required 'extern C' parts to the header files:
#ifdef __cplusplus extern "C" { #endif ... #ifdef __cplusplus } #endif
-
Some code changes are required (*Uli, if these make sence to the C code also, maybe these should be moved in?*).
-
mtwist/mtwist.h
'#include <iostream>' not required, comment out.
else cases of '//#ifdef _STDINT_H' are not required. Leave only 'typedef int32_t mt_u32bit_t;'
-
comment out
friend std::ostream& operator<<(std::ostream& stream, const mt_prng& rng); friend std::istream& operator>>(std::istream& stream, mt_prng& rng);
-
comment out
MT_INLINE std::ostream& operator<<( [...]
}
-
comment out
MT_INLINE std::istream& operator>>( std::istream& stream, // Stream to laod from mt_prng& rng) // PRNG to load { [...]
}
-
f2ftypes.h
replace 'typedef long F2FSize;' with 'typedef F2FWord32 F2FSize;'
-
mtwist.cpp
Currently I dont know the preprocessor for the Symbian build, so make sure that '#undef WIN32'. One moment I will know some normal processor I can play with it to change the code automatically.
-
f2fcore.cpp
comment out 'static inline size_t strnlen( const char *str, size_t max )' method.
-
in 'F2FError f2fSend()' add casting 'F2FMessageTypeEnum' as shown here:
error = fillReceiveBuffer( ntohl(msg->groupID.hi), ntohl(msg->groupID.lo), ntohl(msg->sourcePeerID.hi), ntohl(msg->sourcePeerID.lo), ntohl(msg->destPeerID.hi), ntohl(msg->destPeerID.lo), (F2FMessageTypeEnum) msg->messagetype, sendBuffer.buffer + sizeof(F2FMessageHeader), ntohl(msg->len) );
-
in 'F2FError f2fNotifyCoreWithReceived( ... )'
define 'char groupname[F2FMaxNameLength+1];' and remove it where it is defined later in the loop 'char groupname[namelen+1];'
-
in the last 'return' part add cast 'F2FMessageTypeEnum' as shown here:
return fillReceiveBuffer( group->id.hi, group->id.lo, ntohl(hdr->sourcePeerID.hi), ntohl(hdr->sourcePeerID.lo), dstPeer->id.hi, dstPeer->id.lo, (F2FMessageTypeEnum)hdr->messagetype, tmpbuffer + sizeof(F2FMessageHeader), ntohl(hdr->len) );
-
f2fgroup.cpp
-
in 'F2FError f2fGroupPeerListAdd(...)' replace:
if( searchpos < 0 ) return searchpos;
with
if( searchpos < 0 ) return F2FErrWierdError;
-
-
-
Generate the python wrapper with swig. I havent tried if the wrapper works yet but it should compile after these changes (*need to know how to automate this*). So, based on: http://discussion.forum.nokia.com/forum/showthread.php?t=57874
-
Compile
Make sure the python includes are taken from the S60 installation.
python222 library is required from the S60 installation.
-
*TODO:*
Maybe there is a way to compile so that the file extentsions do not have to be changed? The generated 'f2fcore_wrap.c' seems to not be requiring it.
As at the end (based on our last communication) i do not know if and what I could/should commit into CVS, I rather didn't. So, that is why I describe all this here.
Build all this as a library so that the python code from S60 can access it (have no idea how simple this will be
What you need for Symbian development (on Linux)
The following manuals and solutions were used
Installing The GnuPoc
SymbianOS SDK for GNU/Linux GnuPoc makes it possible to develop EPOC applications on your GNU/Linux machine. It is using GNU make, Wine and GCC crosscompiler for ARM.
Go to your home directory
Download the latest GnuPoc version (1.11)
-
Unpack it to your home directory
-
cd ~/ wget http://www.martin.st/symbian/gnupoc-package-1.11.tar.gz tar -zxvf gnupoc-package-1.11.tar.gz
-
Installing The GNU Toolchain
Gnu Toolchain ARM 2005Q1C (GCC crosscompiler for ARM) needed by the S60 3.1 SDK
Go to your home directory
Download the GNU Toolchain (ARM 2005Q1C Release)
Create the
csl-gcc
Go to the
csl-gcc
directory-
Unpack ARM to the
csl-gcc
directorycd ~/ wget http://www.martin.st/symbian/gnu-csl-arm-2005Q1C-arm-none-symbianelf-i686-pc-linux-gnu.tar.bz2 mkdir csl-gcc cd csl-gcc tar -jxvf ../gnu-csl-arm-2005Q1C-arm-none-symbianelf-i686-pc-linux-gnu.tar.bz2
Install the rest of the tools. These aren't strictly necessary if wine is available. (If omitted, the build scripts uses the exe versions in the SDK instead.)
-
cd ~/gnupoc-package-1.11/tools ./install_eka2_tools ~/csl-gcc
Install Symbian SDK
-
Download S60 SDK 3rd Edition FP1 from
-
Install SDK using GunPoc script
cd ~/gnupoc-package-1.11/sdks ./install_gnupoc_s60_26 ../../s60_2nd_fp2_sdk_msb.zip ~/symbian-sdks/s60_26
-
Set the EPOCROOT environment variable to point to your SDK
echo "export EPOCROOT=/home/user/symbian-sdks/s60_31/" >> ~/.bashrc
-
Add the toolchain directory and the
epoc32/tools
directory of the SDK to your PATH.echo "export PATH=/home/user/csl-gcc/bin:${EPOCROOT}/epoc32/tools:${PATH}" >> ~/.bashrc
-
or edit a
~/.bashrc
file and add the folowing linesexport EPOCROOT=/home/user/symbian-sdks/s60_31/ export PATH=/home/user/csl-gcc/bin:${EPOCROOT}/epoc32/tools:${PATH}
Install SCons
SCons - Open Source software construction tool
-
Download and install
-
wget http://prdownloads.sourceforge.net/scons/scons-1.1.0.tar.gz tar -zxvf scons-1.1.0.tar.gz cd scons-1.1.0 sudo python setup.py install
-
-
Copy installed SCons libs to the puthon's site-packages
-
sudo cp -rv /usr/lib/scons-1.1.0/SCons/ /usr/lib/python2.5/site-packages/
-
Install scons-for-symbian
Create
scons_symbian
folder toPython25\Lib\site-packages\
-
Check out the project to the created folder
cd /usr/lib/python2.5/site-packages mkdir scons_symbian svn checkout http://scons-for-symbian.googlecode.com/svn/trunk/ scons-symbian