Sunday, 9 June 2013

argot 1.3.b4 released

Today I've released Argot v1.3.b4 (beta 4).  This has a couple of changes found while developing the Arduino MQTT Argot tutorial which went online today.  The changes include:

  • Modify the meta marshaller - During the development of the tutorial I found that a TODO in the code which related to building TypeMaps which use the MetaAbstract type.  The code originally required that the full meta dictionary be included in all user defined TypeMaps.  This has now been fixed and the new tutorial shows it nicely with having only 7 data types.
  • Update the compiler - Added the ability to use expressions in the simple definition syntax.  This was mainly so I could use the meta.abstract data type simply in the tutorial.  It was also on the TODO list, so nice to get this out of the way too.
  • Update the Argot marshaller annotation - The original annotation only allowed a select few marshallers to be used which were defined in an enumerated type.  The enumerated type is now removed and the marshaller class is now added directly.
The new tutorial demonstrates using Argot with MQTT.  The use of the Arduino was not required, however, it does nicely show an end-to-end use case of the software.  The Arduino code is currently hand crafted to process the message received from Argot.  Future releases will include an Arduino Argot library to automate the processing code.

Friday, 7 June 2013

Dummies guide to installing Mosquitto MQTT on OSX


I've been setting up to write some demos of using Argot over MQTT.  To run tests I decided to use the Mosquitto MQTT broker.  It's really quite simple to install on OSX if you follow this simple procedure.

Before you do anything ensure that you Xcode installed on your computer.  This is a pre-requisite for building and installing Mosquitto.  Go to the App store and search for and install Xcode.

After Xcode is installed open a Terminal window and install Brew.  The output should look something like:

$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press ENTER to continue or any other key to abort
==> Downloading and Installing Homebrew...
remote: Counting objects: 114731, done.
remote: Compressing objects: 100% (49072/49072), done.
remote: Total 114731 (delta 81867), reused 94660 (delta 64711)
Receiving objects: 100% (114731/114731), 16.62 MiB | 1.85 MiB/s, done.
Resolving deltas: 100% (81867/81867), done.
From https://github.com/mxcl/home-brew
 * [new branch]      master     -> origin/master
HEAD is now at 28e3657 ttytter: use Formula
Warning: Install the "Command Line Tools for Xcode": http://connect.apple.com
==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help

As directed I ran the 'brew doctor' command before installing anything.
$ brew doctor
Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools for Xcode" package provided by Apple.

Warning: Your file-system on / appears to be CaSe SeNsItIvE.
Homebrew is less tested with that - don't worry but please report issues.


Now that brew is installed it's time to install Mosquitto. Next at the command prompt type 'brew install mosquitto'. The output looks something like:
$ brew install mosquitto
==> Installing mosquitto dependency: pkg-config
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-
######################################################################## 100.0%
==> Pouring pkg-config-0.28.lion.bottle.tar.gz
 /usr/local/Cellar/pkg-config/0.28: 10 files, 636K
==> Installing mosquitto dependency: cmake
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/cmake-2.8.1
######################################################################## 100.0%
==> Pouring cmake-2.8.11.lion.bottle.tar.gz
  /usr/local/Cellar/cmake/2.8.11: 693 files, 34M
==> Installing mosquitto dependency: openssl
==> Downloading http://openssl.org/source/openssl-1.0.1e.tar.gz
######################################################################## 100.0%
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.1e --openssldir=/usr
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.1e/share/man MANSUFFIX=ssl
==> Caveats
To install updated CA certs from Mozilla.org:

    brew install curl-ca-bundle

This formula is keg-only: so it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

The OpenSSL provided by OS X is too old for some software.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include
==> Summary
  /usr/local/Cellar/openssl/1.0.1e: 435 files, 15M, built in 3.4 minutes
==> Installing mosquitto
==> Downloading http://mosquitto.org/files/source/mosquitto-1.1.3.tar.gz
######################################################################## 100.0%
==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/mosquitto/1.1.3 -DCMAKE_BUILD_TYPE=None -DCMAKE_FIND_FRAMEWORK
==> make install
==> Caveats
mosquitto has been installed with a default configuration file.
    You can make changes to the configuration by editing
    /usr/local/etc/mosquitto/mosquitto.conf

Python client bindings can be installed from the Python Package Index
    pip install mosquitto

Javascript client is available at
    http://mosquitto.org/js/

To have launchd start mosquitto at login:
    mkdir -p ~/Library/LaunchAgents
    ln -sfv /usr/local/opt/mosquitto/*.plist ~/Library/LaunchAgents

Then to load mosquitto now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist

Or, if you don't want/need launchctl, you can just run:
    mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf

Warning: /usr/local/sbin is not in your PATH
You can amend this by altering your ~/.bashrc file
==> Summary
   /usr/local/Cellar/mosquitto/1.1.3: 26 files, 564K, built in 8 seconds

An easy way to run mosquito is from the command line.
$ /usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf
1370606778: mosquitto version 1.1.3 (build date 2013-06-07 21:46:21+1000) starting
1370606778: Config loaded from /usr/local/etc/mosquitto/mosquitto.conf.
1370606778: Opening ipv4 listen socket on port 1883.
1370606778: Opening ipv6 listen socket on port 1883.

It's now setup and ready to go!