HouseMon Circuits Tutorial-1.11

We have touched upon ‘tagged’ messages in an earlier tutorial.

In this tutorial, we will expand our coverage of ‘tagged’ messages.

We will be using 2 new gadgets, ‘EnvVar’ and ‘AddTag’.

Other than the two new gadgets, we are back to using the most basic circuit from tutorial 1.

Ok, lets see the circuit:

$ ./cirget circuit 11
$ ./cirget -y

#Read environment variable and make a Tagged message from it.
#warning: using env.In from a feed will close the pin - used only as a demonstra
        name: "dummy"
        type: "Pipe"
        name: "env"
        type: "EnvVar"
        name: "at"
        type: "AddTag"
        from: "env.Out"
        to: "at.In"
        data: "PATH"
        to: "env.In"
        data: "YOUR_PATH"
        to: "at.Tag"
        external: "In"
        internal: "dummy.In"
        external: "Out"
        internal: "dummy.Out"

Lets do a quick tear-down:

We add a ‘Envar’ gadget (Lines 14-15), and a ‘AddTag’ gadget (Lines 17-18). The output of ‘EnvVar’ gets sent as input to ‘AddTag’ (Lines 21-22). We provide a ‘feed’ to the input pin of ‘EnvVar.In’ and that denotes an environment variable to use (Lines 25-26). Both Windows, Linux and OS/X have this, so its a common (if lacklustre) variable to use. We then provide an input “YOUR_PATH” to the AddTag.Tag feed pin (Lines 28-29).

So, assuming your PATH contained /somepath/;/anotherpath/ then typically the output from ‘EnvVar’ would be:

Lost flow string "/somepath/;/anotherpath/"

But…we are sending it into AddTag, which takes the string data and turns it into a ‘tagged’ message using the same contents. The result is something like:

Lost flow.Tag {YOUR_PATH /somepath/;/anotherpath/}

AddTag is a simple way of turning a text message into a ‘tagged’ message that you know is needed by a downstream gadget.

You can use ‘EnvVar’ to extract data from the environment that launched housemon, perhaps a variable that defines the difference between ‘Test’ and ‘Production’ installations.

We will expand upon this circuit in the next tutorial to excert some basic control over our circuit using the ‘EnvVar’ gadget.

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: