Download An Ambient Computing System

Transcript
Figure 4.3: MetaOS Device Tree
adds it to a table, mapping the connection to the routing information. After this is
complete, the hub continues waiting for connections from other edges.
4.2.2 Event Handler
The event handler thread controls most of the logic in the hub. The event handler’s
job is to process events as they arrive into the event queue from the edge connections.
Initialization of the event handler thread first creates a tree data structure that contains information about all devices, events, and actions in the domain administered by
this hub. This tree, as shown in Figure 4.3, is populated by the event handler thread
in response to registration messages sent from devices. Once the tree data structure
is created, a connection to the database is created for use in handling queries for user
and preference information.
The event handler thread then waits until a message appears in the event queue.
The thread determines what type of message it is, such as an event, action, or request
for information. The different types of messages are described in further detail later
in this chapter. Using the incoming message, the event handler thread traverses the
36