Registering Devices

In Mortar.io, meta information that describes event nodes is stored in a meta item associated with each node. This contains information like the names of transducers, their units, their ranges and information like the location of the device.

Once a node is created, a user would typically want to insert that node into a collection of nodes defining a view within the system. For example, the web interface shows a tree of devices setup by the server administrator that is typically organized hierarchically by location.

There are a few ways to register devices. The meta_tool and the meta_copy tool are two command line tools that can be used to generate devices and add meta information. To learn more about the way Mortar.io represents devices visit MIO Schema. An easy to use web interface is also available.

Register Tools

You can find tools associated with registration in the mio_meta repository. After you have compiled the libMIO C library, you can build the meta_tool and meta_copy tool using the same auto tools process.

git clone 
./bootstrap.sh
./configure
make && sudo make install

Meta Tool

The meta_tool program can generate meta information for various common hardcoded devices support by MIO. The tool can be eventually be extended to include your own devices if they are frequently generated. This is a good template for how to write your own tool to generate custom meta information. The tool sets up the specific mio_properties and transducers associated with a device. It also provides control over where to add the device in a reference tree that defines a particular view or collection of devices, see MIO Schema. Often the parent of the device is a reference node that consolidates all of the devices for an Adapter. For example, if an adapter is responsible for handling all of the nodes in a wireless sensor network it might have a head reference node that contains a tree of all of its sensors. One could also imagine inserting any subset of these nodes into something like the root location tree.


Usage: ../meta_tool -n [device name] -type [device type] -event [node_id] -u [username] -p [password] -parent [parent uuid in tree] -a [add reference to child] -acm [access control model: whiltelist ,blacklist, etc.]
Usage: ./mio_tool -help
    -event event_node = name of event node to publish to
    -n device name = name contianed in the device meta stanza
    -u username = JID (give the full JID, i.e. user@domain)
    -p password = JID user password
    -event event node id
    -parent parent event node to add created device to as a child
    -a include to add a reference from the created node to the -parent node.
    -acm access control model to manage the device with. whitelist or blacklist
        -t type = firefly_sensor, firefly_plug, hue_bridge, hue_bulb, enfuse_branch, enfuse_gateway, 

Meta Copy

The meta copy tool is a little more versatile than the meta tool in that it doesn't have hard coded parameters. Instead, it allows the user to copy the meta information from a specific event node or from a valid XML file into a new or existing event node. So if you want to share meta information with another user, you can simply provide them a configuration file or a pointer to a valid UUID that they can use as a template for their own devices. The configuration files for devices can be found in [path_to_config]/devices.


Usage: ./meta_copy -event [node_id] -u [username] -p [password] -path [path to xml file] -node [node to copy from] -propery_name [comma separated property names] -property_value [comma separated property values] -parent [parent event to add new device as a child] -acm access control model: whitelist or blacklist. 

Configuration

Configuration files can be found in the config. This directory holds the configuration of devices and communication protocols supported by Mortar.io. For more information on these files visit MIO Schema, Adapter, and Gateway