Old blogs

How the Capability Scanner Works

Product features - March 31st, 2008 - Written by Tim Kelly

Mike Trujillo just posted a demo of how to use the capability scanner. If you’ve not used this feature before this is a pretty good (and short) video tutorial to check out. The Capability Scanner is currently supported on all S60 3rd edition SDKs. If you want to know how it works behind the scenes read on…

cap_scanner_screen_cast_screenshot.JPG


There are two critical pieces to capability scanner to function properly:

1) A fully built source index for your Carbide project.
2) The capability scanner definition files.

Here’s how the capability scanner works behind the scenes when it is writing out its status to the build console.

1) Get Capability Definition Files - First the capability scanner looks for the capability scanner definition files. These are XML files that contain all the API documentation for all functions that use capabilities and what capabilities they use. The default location is under “\epoc32\data\capabilities\”. However, for S60rd Ed. SDKs, the capability scanner plug-in has these files Carbide itself.

2) Get Possible APIs Used - The capability scanner then collects all the system headers used by your source files. The source files are those defined in the MMP file you selected.A table is built from the Capability Definition files that have definitions that are declared in any headers you are using.

Now the capability scanner has a list of all the possible functions you could use in your project and needs to find which ones you are actually using.

3) Get Functions from Index - Each source file is scanned individually. You will get a message in the console like:

Scanning sources for function calls: MySource.cpp

or

Skipping sources without headers with known capabilities: MyOtherSource.cpp

This is simply checking to see if any of the headers collected in step 2) were used by the current source file. If not, it doesn’t require any capabilities.

4) Collect Function-Level Capabilities - Now for sources that do have headers with known capabilities, each function use is resolved to it’s class scope and is searched for in the possible APIs from step 2. If there’s a match, the function requires a capability.

5) Report All Function Used - The last step is to simply populate the Capability Scanner view with each function and it’s known capability.

Now that you have this information you can get a pretty good estimate of what capabilities your project MMP needs, but it’s not perfect. For the most accurate results you do need a fully functioning source index and perfect documentation in the capability scanner definition files. As well, some functions may have “DEPENDENT” capabilities, which isn’t actually a capability but rather depends on what parameters you pass in the function.
To figure these out you can perform runtime checks with the emulator and use the epocwind.out tool in Carbide. How to set this up is in the Carbide.c++ documentation.

NOTE: If you are using S60 3rd FP2, make sure you read this too.

About the author Tim Kelly

  • Number of posts: 14

Comments are closed.