Category: Uncategorized

The Burning Platform

In his letter mentioned at,, Stephen Elop, the current CEO of Nokia outlines and warns his employees that they are not only standing on a “burning platform” but are also pouring fuel onto it. For those, who have come late, the market share of nokia has been steadily dropping since 2008 and currently stands at 16%.

This, as compared to the market share of nokia in 2008 which was around 40%, indeed makes Nokia a “burning platform”.
But this brings me to the point, I’m not “very-very” much interested in the smartphone market, what caught my eye was the story that Stephen mentions, the story about the burning oil platform, a man in a really dicey situation and a “radical shift” in his behavior. “Radical Shift”, a term which means a sudden and tremendous change in the thinking process of a person arising due to some unforeseen circumstances, in the current context. We’ve been seeing radical shifts throughout history and it tells us that the person or entity that experiences these undergoes sudden fruitful transformation in comparatively minimal amount of time. Chris Gardner can be safely cited as one such example. Standing tall and pretty won’t get you very far and Nokia is a perfect example of this. To grow and to push beyond the limits, we all need these radical shifts from time to time. Nokia is just experiencing the same and the good part is that their CEO knows that.


Android SDK Tools

TraceView and mksdcard: TraceView is a very important tool bundled with the android sdk, which can let you trace various method calls present in your program. It can be of great help if you want to tweak the performance of your code.

To run traceview, you need a “.trace” file, this trace file can be created by your program code by calling,

Debug.startMethodTracing(“filename”), &,


You can call startMethodTracing(), in your onCreate() & stopMethodTracing() in onDestroy(), to record complete execution of your application code.

But, there’s a simple problem “.trace” files are created on the SD-Card of your android emulator. So before calling these methods you need to carry out 2 steps,

1. Create an SD-Card image.

2. Bind that SD-Card image to the emulator and run it from command line.

To create the SD-Card Image, the SDK has another bundled tool called as “mksdcard”,

Lets see the usage now,

1. Traverse to the tools folder of android,

2. Type in the command as, “mksdcard 100M mysdcard.img”

This will create an sd-card image file for your emulator, which will behave as a real sdcard.

3. Following command will bind the sd-card to the emulator and will launch it simultaneously.

Now your trace file is created and you need to pull it out from the android file system to your machine’s file system. For this, WITHOUT CLOSING THE EMULATOR, launch a new cmd and issue the following command from the tools folder,

adb pull /sdcard/myfile.trace myfile.trace

You can view the trace file by,

traceview myfile.trace

The BlueTruth……….

Bluetooth technology has been around for sometime now and although a lot has been developed on and around this fantastic technology the best is yet to come…………………………..I started looking into this technology as my work required me to do so but was amazed by the potential it had and so decided to dive further and will continue to do so for sometime now till i have something concrete at hand…….The basics are nearly available everywhere…..but yet it is the best place to start. Since i basically deal with j2me mobile platforms, so JSR-82 became my point of start,

Most of the java enabled cell phones(the cldc, midp soup)……have a bluetooth device. This bluetooth device can very easily be controlled through either vendor applications supplied or one can simply write some little java code of his own to tame this little beast. I would be playing with this bt device at a very higher level(java), but libraries like bluez(more at facilitate development at much lower level…………But thats a different story altogether……..lets begin by discussing what the oem vendor has allowed us to do……….I usually begin by switching the bluetooth in my n86 on and discovering the devices around me and some weird names popping up on the little screen. But wait, with java at your disposal you can have even more. Let’s try to make a similar application where one can discover a bit more about devices around him and a little more info about his own bt device.

Java refers to the bluetooth device present on your phone or user’s phone as LocalDevice and the devices that u r detecting via u r LocalDevice as RemoteDevice(s). As our PC’s have MAC addresses as unique identification,  these bluetooth devices also have some unique identifier. Java allows you to have a look at this 48 bit unique identifier of your LocalDevice by using the the api,

LocalDevice.getLocalDevice().getBluetoothAddress()—> the value returned will be an integer which will look something like—>0025cff962b9, If you are not interested please skip this part but for those who would like to delve further there’s some little information here. 0025cff962b9, can be divided into 6 segments of 8 bits each–> 00:25:cf:f9:62:b9 .

The first 3 bytes(00:25:cf) are assigned by IEEE to a specific manufacturer,and the last 3 bytes are freely allocated by the manufacturer,

i.e.,if 00:25:cf represents nokia n86 then all nokia n86 will hv same 3 bytes as their bt starting address.
But if you are looking into a commercial application then a bluetooth address is of  little use to the naive user, so for the user Java supplies you with the api,

LocalDevice.getLocalDevice().getFriendlyName()–>which will give you the user defined name of the bluetooth device, which the user can instantly recognize and connect with.

Similar simple apis exist to discover and extract valuable information about devices detected(did u say hacking??),


will start inquiring about devices in visibility range of the bluetooth. As devices a discovered a callback will be called, which is,

public void deviceDiscovered(RemoteDevice arg0, DeviceClass arg1),

Using the arg0 you can discover normal stupid things like the,

  1. Bluetooth Address of the remote device.
  2. Friendly name.
  3. Authentication info.
  4. Encryption info.

It is the arg1 that is pretty interesting, arg1 is the class of device(cod). Lets leave java aside for a second, and jump to pure binary. COD is a combination of 24 bits,

23   22   21   20   19   18   17   16   15   14   13   12   11   10   9    8    7    6    5    4    3    2    1    0

z       z       z      z       z      z      z      z      z      z      y     y      y      y   y    y    x     x    x    x    x    x    0   0

x->6 bits–>minor device class

y->6 bits–>major device class

z->10 bits–>Service class

if z(14) is set–>

if z(15) is set–>

if z(16) is set–>positioning

if z(17) is set–>rendering

if z(18) is set–>networking

if z(19) is set–>capturing

if z(20) is set–>object transfer

if z(21) is set–>audio

if z(22) is set–>telephony

if z(23) is set–>information

According to bt assigned numbers doc–>

13  12  11  10  9   8

for imaging device–> 0    0    0    1    1    0–>0x600 in hex

to convert this to decimal–> fill the remaining 0 to 7 bits with 0’s,

0 0 0 1 1 0 0 0 0 0 0 0 0 0–>2^9+2^10=512+1024=1536—>this integer is returned by java api(arg1.getMajorDeviceClass()) to indicate an imaging device.

Now let’s talk about minor device class—>

7  6  5  4  3  2

for a laptop we have–> 0  0  0  0  1  1

to convert this to decimal–>fill remaining 0 and 1 spaces by 0.

start calculating–>0 0 0 0 1 1 0 0–>2^2+2^3=12—>this integer is returned by java api(arg1.getMinorDeviceClass())  for a laptop device.

Now lets go the reverse way for the service classes,let’s say java api(arg1.getServiceClasses()) returns us something like 5898240(nokia n95 w’out simcard in offline mode)

Convert this to binary—>

23 22 21 20 19 18 17 16 15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0

0    1    0   1    1    0    1   0   0   0   0    0  0  0   0  0  0  0  0  0  0  0  0  0

For a dell laptop:

0    1    1    1    1    1    1   0   0   0   0    0   0   0  0  0  0  0  0  0  0  0  0  0

Interpret yourself.