Showing posts with label symbian. Show all posts
Showing posts with label symbian. Show all posts

Tuesday, February 23, 2010

Qt and Symbian

After Nokia took over Trolltech in 2008, it has been foreseen that Qt would come to be part of mobile phone development very soon. Symbian and Maemo (now also known as MeeGo) developers are moving quickly to Qt for GUI application. Yesterday, I managed to start off my first Qt app before bid farewell to Symbian end of this month and the following info is my quick glance of Qt resources from Symbian developer perspective.

- Qt for the Symbian Platform (Product Overview)
- Using Qt and Symbian C++ Together from developer.symbian.org. This will guide Symbian developer to integrate Symbian to Qt more smoothly. The info in the page conveys the information e.g., Converting Active Objects to Signals & Slots, Converting between QString and Descriptor,Exceptions & Error Handling, et cetera.
- Qt Carbide.c++ IDE. To configure Carbide.c++ for Qt if it is prefered to QtCreator.
- Qt Creator with the Symbian Platform. Its build-in Help is superb.
- qmake Manual. Knowing of qmake to handle the project file (.pro) is mandatory. You need to know few extra specific parameters for Symbian, the manual will help you out.

-----------------------
We only part to meet again. ~John Gay~

Thursday, November 12, 2009

HookLogger - Symbian debugger tool

Do you have memory leak or leave problem? Let's try this tool, HookLogger!

References:
http://developer.symbian.com/main/tools_and_sdks/developer_tools/supported/hook_logger/index.jsp

Wednesday, November 4, 2009

Setup Symbian environment

Symbian C++
1. Perl (e.g.ActiveState Perl 5.x)
2. Symbian SDK (S60 3rd Edition, S60 5th Edition)
3. OpenC/C++ plugin (for S60)
4. Carbide (Carbide.c++ v2.02) IDE for Symbian platform development.

Note
- The SDK and your source files must be located at the same drive
PyS60
References
http://wiki.opensource.nokia.com/projects/Installing_PyS60
http://developer.symbian.org/wiki/index.php/Python_Technical_Overview#Table1

Friday, October 2, 2009

Variadic Macros

I ran into a problem of variadic macro __VA_ARGS__, the code porting from Windows when compling in Symbian. It issued the error "badly punctuated parameter list in `#define'" and caused "cpp.EXE" to stop with failure.

Google a bit and the solution was found under NewLC:
http://www.newlc.com/forum/variadic-macro-problem

An information about variadic macro for GCC was to be found here:
http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html

Monday, August 17, 2009

Simple Symbian Makefile

Symbian requires makefile for gcce build.
Here is the sample of my makefile, let's call it myproject.mk


# myproject.mk
#
TARGETDIR=.
CERTDIR=../../../../Certificates
TARGETSISFILE=$(TARGETDIR)/myproject.sis
TARGETSISXFILE=$(TARGETDIR)/myprojects.sisx
TARGETPKGFILE=$(TARGETDIR)/myprojects.target.pkg
SOURCEPKGFILE=$(TARGETDIR)/myprojects.pkg

SOURCECERFILE=$(CERTDIR)/dev.cer
SOURCEKEYFILE=$(CERTDIR)/dev.key
PASSWORD=mypassword

BLD : do_nothing

CLEAN : do_nothing

LIB : do_nothing

ifeq (GCCE,$(findstring GCCE, $(PLATFORM)))
FINAL :

$(SOURCECERFILE)
@echo EPOCROOT=$(EPOCROOT)
@echo $(PLATFORM)
#Delete existing sis file
@echo del $(TARGETSISFILE)
@echo del $(TARGETSISXFILE)
# we use command here, please note that we need the double quotes here
del "$(TARGETSISFILE)"
del "$(TARGETSISXFILE)"

#Pass the PKG through the CPP precompiler
# @echo cpp -P $(SOURCEPKGFILE) $(TARGETPKGFILE)
# cpp -P $(SOURCEPKGFILE) $(TARGETPKGFILE)
@echo perl -e "print `makesis -d%EPOCROOT% $(SOURCEPKGFILE) $(TARGETSISFILE)`"
# we can execute this with perl as well
perl -e "print `makesis -d%EPOCROOT% $(SOURCEPKGFILE) $(TARGETSISFILE)`"
#Sign the SIS file
@echo signsis -v -s $(TARGETSISFILE) $(TARGETSISXFILE) $(SOURCECERFILE) $(SOURCEKEYFILE) $(PASSWORD)
signsis -v -s $(TARGETSISFILE) $(TARGETSISXFILE) $(SOURCECERFILE) $(SOURCEKEYFILE) $(PASSWORD)
else
FINAL : do_nothing
endif


Now, if we want to execute the makefile without calling "abld" command, you need firstly set $PLATFORM=GCCE at your shell. Next we can call the make from here:

c:\...sis\>make -f myproject.mk


If anything goes wrong, you can try with "make -d" to debug.

Some pitfalls from make:

- *** missing separator *** => You use the "space" instead of "tab"
- Invalid switch when trying to execute the command from (dos) shell => you missing double quote around the argument passing to the command.

Friday, July 24, 2009

Create Symbian Installation File


1. Edit pkg file in your sis directory. Carbide.C++ will generate default pkg file when you comply the source code with it. The format of pkg file can be found : http://mobile.actionscript.it/Lib/Doc/44/how%20to%20create%20a%20sis%20file.pdf
2. Create sis file and sign file
Either using Carbide.C++ or calling the makesis and signsis from command prompt.

2.1 Using Carbide.C++. Go to "Project"->"Properties"->"Carbide.C++"->"Build Configuration". Select the "Configuration" you want, in "SIS Builder" click "add".
SIS Properties will pop-up. Now, what we need here is only "PKG File", Using "Self sign sis file" would be enough if you don't use any capability. Then when you build the GCCE configuration, the sisx file will be automatic generated.

2.2 Calling makesis and signsis from the command prompt:

c:\sis>makesis myproject.pkg
c:\sis>signsis -?
c:\sis>signsis myproject.sis myproject.sisx ..\cer\mysymbian.cer ..\cer\mysymbian.key myphasepass


3. If you get any error when trying to install your sis file on the device, check out the error from "Interpreting Platform Security Error Messages in S60 3rd Edition" or Forum Nokia.com's "S60 SW Installer Troubleshooting" or from Symbian Foundation's Troubleshooting Installation Errors.

Friday, April 17, 2009

Template Specialization and GCCE compiler

An interesting point about template specialization on Symbian.
GCCE does not follow §13.5.1 rule of C++ standard, the order of specializations.

Look at the follow code:

template< class T > class MyComplex { T i, j; };

template< class T > T MySqrt( T );
template< class T > MyComplex< T > MySqrt( MyComplex< T > );
double MySqrt( double );

template< class T > void MySimpleFoo ( T& );
template< class T > void MySimpleFoo ( const T& );

template< class T1, class T > void MyFoo2 ( T1 t1, T& );
template< class T1, class T > void MyFoo2 ( T1 t1, const T& );

// The problem is lying at the following 2 templates
template< class T1, class T > T1 MyFoo ( T& );
template< class T1, class T > T1 MyFoo ( const T& );

void f ( MyComplex< double > z )
{

int i = 0;
const int ci = 3;

MySqrt( 2 );
MySqrt( 2.0 );
MySqrt( z );

MySimpleFoo( 2 );
MySimpleFoo( i );
MySimpleFoo( ci );

char ch;

MyFoo2( ch, 2 );
MyFoo2( ch, i );
MyFoo2( ch, ci );

MyFoo2< char >( ch, 2 );
MyFoo2< char >( ch, i );
MyFoo2< char >( ch, ci ); // MyFoo2(..) does not alert the compiler
// for ambiguious. Now look at MyFoo(..)

MyFoo< char >( 2 );
MyFoo< char >( i );
MyFoo< char,int >( ci ); // This is ok.
// But the call below will not work

// MyFoo< char >( ci ); // doesn't work with Symbian GCCE
// the compiler will complain that the functions ambiguious,
// it cannot decide whether it should take MyFoo ( T& ) or
// MyFoo ( const T& )
}


---------------
"Trying to outsmart a compiler defeats much of the purpose of using one." Kernighan & Plauger, The Elements of Programming Style

Wednesday, April 15, 2009

Friday, April 3, 2009

Problem in wchar.h in Open C (Symbian)

The following errors encountered in OpenC:

/EPOC32/include/stdapis/wchar.h:92: error: `__mbstate_t' does not name a type
/EPOC32/include/stdapis/wchar.h:97: error: `__size_t' does not name a type
...


Googled and I found similar problem posted in forum.nokia.com (http://discussion.forum.nokia.com/forum/showthread.php?t=137500) but no relevant answer how to solve the problem. How I solved it is posted in comment#6.


---------------
"Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter" Eric Raymond

Tuesday, January 27, 2009

Carbide.c++ 2.0 and P4 synchronization

Carbide.c++ 2.0 has been launched on NewLC for quite a while since around December and with new license. It is now available for free for OEM, Developer and Professional edition! Recently, I read stories about Nokia 5800 XpressMusic which based on S60 5th edition for Touch UI. (I think, touch screen becomes trendy since iPhone...everyone goes touch screen now. However, I personally enjoy using the softkey doing things. Perhaps, because my first experience with touch screen for mobile phone, Sony Ericsson P800 - based on UIQ, was not so good.) This new XpressMusic looks very promising, it is thiner than N95. (One thing I dislike about N95 8GB - the phone's thickness.) My idea is just try to build my S60 based on 3rd Edition application to 5th Edition in the future. Although I don't have any 5th Edition in hand...but make the application running with emulator is also fun.

Perhaps, this is a good time to prepare new development environment for our project.

1. Install Carbide.c++ 2.0.
Grasp Carbide.c++ 2.0 from here.

2. Install SCM Plugin for Carbide.
After finishing with Carbide installation, we need P4WSAD, the Perforce Plug-in for Eclipse.
- Go to Help -> Software Updates -> Find and Install
- Enter http://www.perforce.com/downloads/http/p4-wsad/install/ as a new site. Follow the instruction.
- After the installation ready, you can see 2 jar files: com.perforce.p4api_xxxx.jar and com.perforce.team.core_xxxx.jar in plugins directory under your carbide installation directory.

3. Synchronize Carbide.c++ with our SCM.
- Go to Project Explorer, right click at the project and select Team->Share Project.
- From the repository list, you can see list of available repositories, select Perforce.
- Perforce setting parameters can be taken from your P4 client.

Now, we have our environment ready. (I rebuilt my project with Carbide.c++ 2.0 with my old S60 3rd Edition, there was no problem).

4. Install S60 5th Edition SDK
- Here is the link to Nokia's forum to download the 5th Edition SDK

5. Install the SDK plugin.
- Right now, I still have not found any plugin for 5th Edition of S60.

You need to edit your Carbide's project to have a configuration for 5th Edition and the rest depends on your application.


Lately, I have been so busy in the office. Therefore, I have no time to continue on my package updating story but I will try to finish the second part as soon as I can.


---------------
"I spend almost as much time figuring out what's wrong with my computer as I do actually using it." Clifford Stoll, Silicon Snake Oil

Tuesday, December 16, 2008

File browser application for S60 developer: "Y Browser"

It is designed for S60 3rd edition devices (Symbian OS 9.x) similar to FileBrowser in RnD Tools from mobile phone manufacture, which you can change files in private directory on C drive.

You can get it directly from Dr.Jukka's website: http://www.drjukka.com/YBrowser.html

Friday, December 12, 2008

A sample to employ "epocrc" for automatic resource file creation

Example of using "epocrc" from SDK 3rd Edition FP1

> epocrc -I\symbian\epoc32\include\ -u ex.rss -oex.rsc -hex.rsg

What we want to do here is to generate any "oemid" any time when requested without recompiling the whole resources.

In the example, I have default setting of oemid 1000 and I will replace 1000 with any new id for the resource file which passed to the makeResource function, whereas the output has the same name appended with its new id.

sub makeResource {

my $baseRssFile = "oempid_0x2000AAAA";

chdir($rssPath);

my $pid = $_[0];
my $rssFile = $baseRssFile . ".rss";
my $newRssFile = $baseRssFile . "_" . $pid . ".rss";
open(RSSFILE, $rssFile) or die "Error: Cannot open $1 : $!\n";

my @file = ;
close(RSSFILE);

open(NEWRSSFILE, ">$newRssFile") or die "Error: Cannot open $1 : $!\n";
foreach $_ (@file) {
if ( $_ =~ m/1000/ && $_ =~ /buf/) {
$_ =~ s/1000/$pid/g;

}
print NEWRSSFILE $_;
}
close(NEWRSSFILE);

my $rscFile = $baseRssFile . "_" . $pid . ".rsc";
system("epocrc -I$symbPath -u $newRssFile -o$rscFile");
system("del $newRssFile");
print "$rscFile is done\n";
}

The following part is to read the arguments which may be passed as range of integer or non range integer seperated each entries by comma.

my @num = split(/,/, $args{i});

foreach $_ (@num) { // Input may look like 1,4,7-10,200
my $pid = "";
if ( $_ =~ /(.+)-(.+)/ ) { //search if the input is in range
foreach( $1 .. $2 ) {
&makeResource( $_ );
}
}

else { // non-range argument
&makeResource( $_ );
}

---------------------------


Friday, November 28, 2008

Symbian application panic with ucmp 0

In my case, this problem had encountered when I tried to read the data stream to the buffer. The error was occured after second iteration of passing data stream. So how could it be?
Of course, data stream is about data to/from disk. So, I removed the file which previously written to the disk and it solved the problem.

Friday, October 31, 2008

Symbian S60 emulator: ncnlist KERN-EXEC 3

Yesterday I installed new 3rd FP1 SDK and after the simulation started, I got this "ncnlist KERN-EXEC 3". Googled, strange enough, I found only one answer on NewLc (http://www.newlc.com/forum/ncnlist-kern-exec-3-error) which gave the link to Nokia forum about this kernel panic, however the link has been broken!

Searched on Nokia forum and I finally got this :
http://wiki.forum.nokia.com/index.php/TSS000651_-_NCNList_KERN-EXEC_3_panic_when_starting_the_S60_3rd_Edition,_FP1_emulator

There is a link to get the patch file to fix this problem.

Yippie!