Publishing and Receiving Data

In the following example we will publish data to an event node and receive the publications in a separate terminal.

Listening for Incoming Publications

We will continue using the node we created in the Creating and Subscribing to an Event Node tutorial. Note that we are already subscribed to the node my_node_address. First we will start up a listener process which will display any data that is published to nodes that we are subscribed to:

cd mio/tools/cmd-line/c/bin
./mio_subscribe_listener -u -p password

Publishing Data to an Event Node

Let's imagine that the event node my_node_address should receive publications from a wireless sensor node, which contains a thermometer. The thermometer is referred to as a transducer. We can publish temperature values from the thermometer by using the mio_publish_data tool. Execute the following commands in another terminal:

./mio_publish_data -event my_node -id Thermometer -value 23 -rawvalue 23 -u -p password

Request Successful

We should see the data we just published in the other terminal running the listener:

MIO Data Packet:
    Event Node: my_node_address
            Name: Thermometer
            Raw Value: 23
            Typed Value: 23
            Timestamp: 2014-11-12T00:34:00-0500