# Geo Sensors Gateway

> Receive and redistribute data from vehicle geolocation sensors.

[![Build Status](](
[![Hex pm](](

Prototyping project to receive data from remote Ercogener Genloc sensors.

Try to receive data from TCP:
* not message-based, but we can presume that one connection = one message;
* how to secure the channel and protect from fake-data?
* very light still reliable.

Try to receive data from SMTP:
* certainly can put a password;
* clearly message-based;
* still light;
* maybe difficult if we got a lot of sensors on the gateway.

Do a server prototype on Erlang, so we really begin to construct reliable
pieces of network and messaging software.

An OTP application

# Installation

## Install Erlang

Erlang Solutions provides a great Erlang builds for many platforms.

Refer to their download page:

To control the build process, you can also use [kerl](

### Example for Debian

Recommended method: install from repository.

sudo dpkg -i erlang-solutions_1.0_all.deb

Then install the complete distribution:

sudo apt-get update
sudo apt-get install esl-erlang

## Install Rebar3

See [official installation instructions](

The easiest is to download the latest binary build of Rebar3, place in a directory
and add it to your path.

# These instructions are only provided as example: please refer to official instructions.
# This is a system-wide install.
sudo wget -O /usr/bin/rebar3
sudo chmod +x /usr/bin/rebar3

# Use it

## Create a configuration file

You can use your configuration file from a sample to get started rapidly.

cp ./priv/conf/configuration.sample.json ./priv/conf/configuration.json

## Build

    $ make compile

## Test

    $ make test

Only compatible with Erlang OTP 20+.

% TODO Use error_logger:info_msg("") for logging
--> Use a logging facility and be able to configure it to stdout or file,
with a defined verbosity. (let message dump in stdout only in debug)

TODO Put examples in /doc/examples cf

TODO Add unit test for:
* Auth
    * Username does not match
    * Plain, Login, cram-md5
* FROM filtering
* Json user loading
	* Missing password, email
* Mail parsing
	* Invalid mail
	* Sensor not managed
	* Valid mail for Ercogener GenLoc
TODO Forwarder examples:
* dumping (raw and parsed);
* to a list of mails;
* to a Google Sheet;
* to
* POST to custom API endpoint
* Maybe think of another way to archive systematically any file.
	* ---> To AWS s3?
	* Create sample forwarders for that.
	* So we can recover any data when we need.
* Gateway reporting: add a statistics service
	* Report to Slack or mails the number of payloads forwarder in a day, week, etc.
	* Manage that in the application level? (Geo-service storage API?)