Sunday, October 28, 2007

From 28M to 2.7M

As some of you already know, I've been working on a simple AV-specific control-point as part of gupnp-tools. While at it, I've been trying to keep the UPnP AV parts as separate and generic as possible so that they could be move to a separate library later on. One of the first things that everyone wanted to create a nice wrapper for is the ugly DIDL-Lite. Jorn tried his best to convince me and others to not create a GObject for representing each DIDL-Lite object but I didn't listen and ended-up writing a very resource hungry API. To see what i mean, please look at memory usage of gupnp-av-cp after populating it's treeview with the content hierarchy exported by coherence:



I was quite sure that most of this 28M is taken by xmlDoc and I was right. Now that I have got rid of xmlDoc usage and replaced the gobjects with an API to deal with xmlNodes, here is how the memory usage looks like:




For people who are curious on how this simple AV control-point would look like, here is a screenshot:



One reason why the development of GUPnP might seem much slower compared to that of other UPnP projects out there is that we (especially Jorn) are trying our best to provide a nice and simple API while making sure that no part of the project is resource hungry as we are targeting embedded systems where saving bytes is more impotant than providing lots of features. Jorn already have a plan and some half-baked code for the handling of DIDL-Lite xml and contents on the server-side (ContentDirectory implementation) without wasting lots of memory and CPU.

Tuesday, October 16, 2007

I give-up!

Finally! I found a person who claims that Mango Lassi and Milk-shake taste different to him: Daf. So I see no choice but to change my claim to:

Mango-Lassi is the name of a typical 'western' drink that consists of two extremely delicious items: Lassi and Mango. However, the drink is completely unknown to people who are born and raised in a particular town in the south-eastern part of Sindh which is famous for it's production of Mangoes and a particular Lassi shop all around Pakistan. IMHO, those people should not be blamed for their ignorance since they are quite far from the western world to know about such new inventions.

Monday, October 15, 2007

My first LEGO rover





For some reason, I am unable to connect the mindstorm IDE to communicate with the mindstorm using bluetooth so I use USB for downloading my programs to NXT. Didn't get a lot of time to play with it but the first thing I would want to build is a rover that move in a straight line but turns left (or right) if something comes in front of it (already done) unless if it's a red ball in front of it and pick it up instead and keep going.

Tuesday, October 9, 2007

Mango and Lassi, two separate objects

There is no such thing as Mango Lassi. There is Lassi and then there is Mango, both very delicious but separate objects and both lose their taste as soon as you combine them. Unfortunately, many Indian/Nepalese restaurants in europe are spreading the wrong message just to simply their task of selling both on the same ignorant (of Indian cuisine) customer. I was already annoyed enough by the Waiter bringing me a Mango Lassi each time I order a Lassi in Nepalese restaurant and now I'll be seeing (maybe also using) a nice free software project by the same name. :(

GUPnPResourceFactory

As soon as I started to write gupnp-av-cp, I realized that I need to subclass resource (device and service) proxy classes but the resource proxies are created by the control point object on discovery and there was no way of telling control point to create objects of your subclass instead. The obvious solution that comes to mind is to add an API to control point for registering your subclass' gtype against a UPnP resource type. Unfortunately, that won't work since device proxies also create device proxies for embedded proxies and services.

So the final solution, which is already implemented and committed to svn is a separate class, GUPnPResourceFactory whose sole responsibility is to create resource and resource proxy objects and to provide an API for registering and unregistering UPnP resource type to gtype assignments. Each GUPnPControlPoint and GUPnPDeviceInfo-derived object is assigned a GUPnPResourceFactory object on creation. You can get a pointer to the factory used by the control point or root device by using the appropriate getter function. Once you have the factory, you can simply register and unregister your subclasses to it.

Monday, October 1, 2007

I hate Philip Van Hoof

What was he thinking when he mentioned this cool toy on planet gnome? Didn't he know that a few of p.g.o readers can't possibly resist it. Believe me i tried very hard but failed miserably to convince myself that I can't afford it yet. So I placed the order today. I should get it in a week or two. If I get lost in this toy, please send lots of hate mails to Philip, subscribe him to lots of porn websites etc etc.

Seems I'll be flashing the brick with brickOS at some point but I guess in the beginning I'll keep it's 'mind' running on my laptop, controlling it's body over bluetooth.