Skip to content

Latest commit

 

History

History
120 lines (70 loc) · 2.94 KB

Max.pod

File metadata and controls

120 lines (70 loc) · 2.94 KB

NAME

Max - Perl interface for "eQ-3 MAX! Cube LAN Gateway"

SYNOPSIS

use Max;

my $host = Max->discover or die;
my $max = Max->connect($host);

my $max = Max->connect("192.168.1.9");

for my $device ($max->devices) { ... }
for my $room ($max->rooms) { ... }

my $device = $max->pair;
$device->set_room(42);

$max->room(42)->set_temperature(21.5);

DESCRIPTION

This library is a very simple and incomplete interface for the Max! system. It implements a minimal set of features and does not depend on other Perl modules.

The distribution comes with a binary, max, which implements a simple shell interface.

Class methods

Max->connect($host[, $port])

Connects to the Cube and returns a new Max object.

Max->discover

Attempts to discover the Cube's IP address on the network. Naively believes that the first device to respond is a Max! Cube with no further checks.

Instance methods

device($id)

Returns the Max::Device object for the given device address, provided either in binary or as a 6-digit hexadecimal string. Returns undef if no such device is registered.

devices

Returns a list of discovered devices as Max::Device objects. The order is not guaranteed.

In scalar context, returns the number of devices.

disconnect

Disconnects gracefully. No methods involving communication with the Cube should be called after disconnecting.

forget($dev)

Given a Max::Device or a 6-digit hexadecimal address, removes the indicated device from the Cube. Does not (yet) remove the device from the internal cache, so even after forget(), it will still be listed.

pair

Initiates device pairing on the Cube. If successful, returns a Max::Device object that represents the newly paired device. Dies on recognised errors.

reboot

Sends a UDP command to immediately reboot the Cube. After this, the object should not be reused because the TCP connection will have died.

room($id)

Returns the Max::Room object for the given room ID. Creates a new object (but doesn't register a new room with the Cub) if the given ID is new.

rooms

Returns a list of discovered rooms as Max::Room objects, ordered by ID.

In scalar context, returns the number of rooms.

write_metadata

Writes the metadata (such as room and device names) back to the Cube. Will overwrite the existing metadata on the device with the current client-side state.

SECURITY CONSIDERATIONS

The Max! Cube is completely insecure. It's probably wise to run it on a separate network without any internet connection.

CAVEATS

  • The Max! Cube cannot handle concurrent connections and this library does not try to work around that issue.

  • Connection errors are not handled properly.

LICENSE

Pick your favourite OSI approved license :)

http://www.opensource.org/licenses/alphabetical

AUTHOR

Juerd Waalboer <#####@juerd.nl> <http://juerd.nl/>