mobile

F2F Computing goes Mobile

Main contributer: Sven Kirsimäe (matrix) Other contributers: Ulrich Norbisrath (ulno), Artjom Lind (artjom85)

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

Read Sven's master thesis here!

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

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).

[*] - reference http://www.bugmenot.com/view/forum.nokia.com or http://mailinator.com for temporary usernames >:>

Missing libraries

Python for S60

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

    • Replace all 'PyObject_NEW' macros with 'PyObject_New' direct calls.

    • Replace all 'PyMem_DEL' macros with 'PyMem_Free' direct calls

    • Replace all 'PyObject_DEL' macros with 'PyObject_Free' direct calls

    • *Again, need to run and check all this if they are correct, but at least it compiles.*

  • 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 directory

    cd ~/
    
    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 lines

    export 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 to Python25\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