Saturday, June 06, 2009


Updated about me, ohloh, links, blog layout and so on... Because if you don't do it now, you'll never do!

Thursday, June 04, 2009

Eupnp event bus and new deps

Since UPnP is event-driven itself, I have implemented a Event Bus. It is a channel onto publishers can publish events and into which subscribers can subscribe for a specific type of event (one-to-many).

The goodies about this bus is that it centralizes all eventing in one point, so, gets simpler to implement, debug, optimize and also use. The API got very simple and short, an example can be found on my example-test program.

One thing I'm still thinking about adding in this stage is multiple events subscription. I'm defining the events with independent constants (powers of 2), so it's possible to subscribe to a set of events by combining them with bitwise OR. One thing that I'm still wondering about is the frequency users would use this.

Apart from that, I have chosen two new dependencies:
  • libcurl: will be used to fetch XML's, perform soap POST's
  • libxml2: I'll use a SAX XML parser for "read-as-you-go" parsing, harder to implement but benefits in almost every way comparing to DOM.
I want to give the fetch result directly to the SAX parser, but I'm still studying the APIs to learn how to do it properly. While the XML doc is received and parsed, it'll be mounting the DeviceInfo object, without requiring a memory-expensive DOM tree.