Skip to content

Symbiangeek goes into dormant state.

13-Feb-13

Symbiangeek blog will go into a dormant state from today. As Nokia has announced, there will be no more Symbian devices and with the development teams also cut down drastically, it would not make any more sense to dedicate time to Symbian C++ app development. I have got a taste of iOS training and also did a few small projects in Android. My next mobile application development platform of choice is Android. I will be dedicating my free time to Android and Webkit equally. Let’s hope the time spent in Android and Webkit development fetches more positive results. I will probably start a new Android blog or will keep adding posts to codekata only. This decision will be taken shortly.

So in the end, RIP Symbian. Adios SymbianGeek!!!

My first open source paid app on Nokia Store : Brahma – Screen capture “reinvented”.

27-May-12

After coding on & off for around 8 months I have finally published my first paid app on Nokia Store, Brahma. Brahma is my vision of a screen shot application. I was bored of seeing the setting item list layout of most screen capture applications. So me with my wife designed & coded Brahma. Brahma makes the regular task of taking screenshot more interesting and provides a new twist with some new options. The user experience has been optimized for Symbian^3 touch screens devices.
The application is paid but at the same time it is also open-source. So any one who purchases Brahma, can request the source-code. As the application is licensed under GPLv2, the purchaser is free to modify the code.
Brahma can be purchased from here.

Also Brahma is being offered at a special early-adopter price(for first 30 days) of just Rs. 10, that’s just a price of a cup of tea. So download it and let me know your feedback at the Brahma Support Forums.

Quick Symbian Factoid #8 : Fix for USER-EXEC 3 panic.

14-May-12

USER-EXEC 3 will be caused by an unhandled exception. This exception should be trapped to figure out the type of the exception and also fix the exception-causing code.
The following code can be used as an exception handler which then logs the exception type to the file and then exits.

void AppExceptionHandler(TExcType /*aExcType*/)
{
    RFs fs;
    RFile file;
    TBuf<256> fName;
    fName.Format(_L("C:\\Data\\Excpt%d.txt"),User::TickCount());
    if(fs.Connect() == KErrNone){
        if(file.Create(fs,fName,EFileWrite) == KErrNone){
            TBuf8<256> msg;
            msg.Format(_L8("Exception type : %d"),aExcType);
            file.Write(msg);
            file.Close();        
        }
        fs.Close();
    }
    // we dont want to handle any other exceptions we are done
    User::Exit(0);
}

And to install the exception handler , add this statement. It can be added in CreateDocumentL or any function you think is executed before the exception is taking down the app.

User::SetExceptionHandler(&AppExceptionHandler, 0xffffffff);

Below I am just listing some of the common scenarios that can trigger a data abort, which may lead to an USER-EXEC 3 panic.
Recently I was getting a USER-EXEC 3 panic at application startup. The same code was working fine on the emulator. The code that was causing the issue was as Format statement

TBuf<256> msg;
// this was causing a USER-EXEC 3!!!
msg.Format(_L("%c"),TChar(RFs::GetSystemDriveChar())); 

This code was working flawlessly on the emulator, so its non-working nature on the device was a bit of a shock. This is flagged during compile time as warning. So keep a watch on the warnings as well.
The issue is that Format function will not treat non-POD types, basically non Plain Old Datatypes, very nicely. So if you are passing a class type then beware, the call will abort at runtime.
Some of the possible ways to fix it would be to avoid making the temporary TChar. Just declare a local TChar and then pass the same to Format statement.

TBuf<256> msg;
TChar cDrv = RFs::GetSystemDriveChar();
msg.Format(_L("%c"),cDrv); // this works

Or use the Append function which works with the temp TChar well.

TBuf<256> msg;
msg.Append(TChar(RFs::GetSystemDriveChar())); // this also works

A USER-EXEC 3 can also be triggered by arithmetic routine which probably work fine on the emulator but go bad on the device. Some of the possible scenarios are :

float a = atan2(double,double);  //make sure that atan2 has both the doubles
float b = 1 / 0; // divide by zero is always a red flag
float c = 0 / 0; // this will produce a NaN 

Please share any other scenarios which trigger the USER-EXEC 3 panics.

Quick Symbian Factoid #7 : Symbian pkg major, minor & build number limits.

08-May-12

The Symbian native application sis package file(.pkg) describes the installation information like app name, install path and install files. It also lets the developer specify the application version. The version is specifed as a part of the standard header. Below is one such example:

#{"Focus event Example"},(0xE0000234),0,0,0

As you must have noticed & probably know the last three numbers are the major, minor and build version numbers. Ideally there should be no reasonable limit on the version numbers, like a million or billion. This is also confirmed by the SIS File format specification. According to the specification each number has 4 bytes allocated. So max limit for each number is 2^32. This sounds good , but in reality the limits are much much less. Try giving a slightly higher version number and makesis completely ignores it. For example consider a pkg header like the one below:

#{"Focus event Example"},(0xE0000234),2000,2000,0

Makesis throw a warning for this header specifying the real world limits on the version numbers :

Warning : The valid version number ranges are : (Major: 0..127) (Minor: 0..99 ) (Build: 0..32,767).

So any developer who wants to have an app with fancy version number like v2012.12.12, cannot have the same with Symbian native apps.

This is a really silly limit to have and with Symbian nearly reaching end of its life, we cannot even hope to have this silly limit removed.

Symbian SqlDb (SQLite based) panic & error codes.

29-Apr-12

Symbian SQlite implementation panic codes are not that well documented, I am just listing the ones that are listed. I will update this list as and when they are found to be documented elsewhere.

SqlDb 1 - Not documented 

SqlDb 2 - The database object is not yet created 

SqlDb 3 - Server failed to create a handle to the blob 

SqlDb 4 - In _DEBUG mode. Bad parameter value 
 
SqlDb 4 - Invalid aPolicyType value. (In context of RSqlSecurityPolicy)

SqlDb 4 - Invalid aObjectType value (It has to be RSqlSecurityPolicy::ETable). (In context of RSqlSecurityPolicy)

SqlDb 4 - Invalid aObjectName value (Null descriptor). (In context of RSqlSecurityPolicy)

SqlDb 5 - Parameter index out of bounds. 

SqlDb 6 - Not documented

SqlDb 7 - In _DEBUG mode. NULL blob handle 

SqlDb 8 - Not documented
SqlDb 9 - Not documented
SqlDb 10 - Not documented

SqlDb 11 - Statement cursor not positioned on a row 

The error codes list is part of the header file and the list present in SDK docs does not have the corresponding numerical values. So here I have just pasted the header file section More…

Quick Symbian Factoid #6 : Browsercontrol history navigation throws “Requested object is used by another application(-14)”.

03-Mar-12

I am using the S60 Browser control to load some local html content. So while the loading was going through fine, the history navigation(returning back to previous page after link navigation) was throwing the error “Requested object is used by another application(-14)”. Searching the forums and the internet did not turn up any help More…

S60Uptime for S60 3rd, 5th edition & Symbian^3 devices.

31-Jan-12

S60Uptime had been on my list of apps to be created for quite some years. Finally a few months back I coded it and today gathered the courage to post it online. S60Uptime is available for S60 3rd, 5th edition & Symbian^3 devices. It also uses the CTimerX class which I posted yesterday. The code is also open source and hosted on GoogleCode. Following is the screenshot of the Symbian^3 version of the app.

S60Uptime Symbian^3 & S60 5th edition screenshot.

S60Uptime Symbian^3 & S60 5th edition screenshot.

There is an option to configure the uptime values to be updated per second, per minute or per hour. In the S60 5th & Symbian^3  version this can be done through menu options and in the S60 3rd edition version the same can be done by selecting the proper keys.

Download Symbian^3 or S60 5th edition S60Uptime installer.

Download S60 3rd edition S60Uptime installer.

RTimer limit and how to overcome it.

30-Jan-12

In Symbian C++, RTimer is the timer class to fire timers after specific duration or at specific time. The problem with RTimer is that there is a limit on the duration.
The in parameter for RTimer::After is TTimeIntervalMicroseconds32 which mean mean 2^31 micro seconds is the limit. This would translate to approximately 2147.483648 seconds or 35.791394133 minutes. So RTimer::After cannot be used for anything more than 35 minutes.

So now the challenge is to set a timer for an hour. Let’s see what options do we have:
More…

Quick Symbian Factoid #5 : Fix for DBMS-TABLE 14 panic.

08-Sep-11

This panic is caused by calling successive commits on a single transaction or calling a commit when no transaction has taken place.
So the offending code would look something like this :

    dbView.PutL();
    db.Commit();

The PutL function will perform the db operation like insert or update and then perform a commit as well. Hence the Commit() call is redundant.
The undocumented panic codes are listed here in the S60 wiki.
If you find information to share about other DBMS error codes, feel free to comment about it here.

Update : This has been a bit of a wrong diagnosis. The DBMS-TABLE 14 is caused by calling a RDbNamedDatabase::Commit() when no RDbNamedDatabase::Begin() has been called. So remember every Begin() has to end with a Commit().

Quick Symbian Factoid #4 : Loading local html file using S60 BrowserControl.

06-Sep-11

I had been looking around for a small code snippet to add the S60 Browser control to the app view to display a local html file. So here is the code that worked for me.

//header to include
#include <brctlinterface.h>

//add this to construct the browser control
    CBrCtlInterface* brCtl = ::CreateBrowserControlL(
            this,
            iBrCtlRect,
            TBrCtlDefs::ECapabilityDisplayScrollBar,
            TBrCtlDefs::ECommandIdBase,
            NULL,
            NULL,
            NULL);
    
    RFile htmlfile;
    htmlfile.Open(CEikonEnv::Static()->FsSession(),KHtmlFileName,EFileRead);
    brCtl->LoadFileL(htmlfile);
    brCtl->ActivateL();

//do this in the SizeChanged of the parent control
     brCtl->SetRect(newRect);

Don’t forget to add the browser control to the parent control’s ComponentControl() and CountComponentControls() functions. Also the local html file being loaded can either be in the applications private folder or in the public folders.