diff --git a/README.md b/README.md
index ab093d1..abae8b3 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,19 @@
# Introducton
-This is the condbase of our Lego sorting robot for an educational setup as OST.
+This is the codebase of our Lego sorting robot for an educational setup as OST.
While there is another experimental implementaiton of this robot in the rep SmartFactory_SorticRoboter, this is the current stable code that is used in production. For installation, please use the "production" branch to get stable code with the latest bugfixes.
+# structure
+
+Sortic150 consists of several modules located in the sw-# Introducton
+
+This is the codebase of our Lego sorting robot for an educational setup as OST.
+While there is another experimental implementaiton of this robot in the rep SmartFactory_SorticRoboter, this is the current stable code that is used in production. For installation, please use the "production" branch to get stable code with the latest bugfixes.
+
+This branch designed to use with a PLC compact CPU 1512C-1 PN
+to resemble an real decentralized factory.
+
# structure
Sortic150 consists of several modules located in the sw-modules directory.
@@ -17,37 +27,114 @@ The individual modules are presented below:
## Build
-Build&Upload
-`python -m platformio run -t upload`
## API chassis
-IN
-Run action with index 0 with params 100.
-`a0[100]`
+Write into memory of the PLC (DB100) with OPCua or RFC1006-communication protocol
+
+OPCua ns=3;s="Data_Block1"."BoxAt"
+
+IN type Offset
+
+done Bool 0
+distanz Int16 6
+BoxAt Int16 8
+getPackage Bool 10
-Out
-Sends all the sensor values as shown below:
-`[s0,s1,...,sn]`
+OUT type Offset
+
+sollPos Int16 2
## API roboter-arm
+gets Data with OPCua
+
### IN
-Pickup 0: left, 1: right
-`pickup(0)`
-`pickup(1)`
+sollPos (Int)
+'1 pickup back'
+'2 put down back'
+'3 pickup front'
+'4 put down front'
+
+### Out
+
+done (Bool)
+
+## API package-reader
+
+Sends Data with MQTT
+
+### IN
-Drop 0: left, 1:right
-`drop(0)`
-`drop(1)`
+-
### Out
-Success:
-`success(1)`
-Fail:
-`success(0)`
+getPackage Bool
+
+
+# module-raspbi
+
+## Requirements
+
+- RaspberryPi(Model 3B+)
+- SD-Card(16Gb)
+- Touch-Screen
+
+## Setup Instructions
+
+### Before you begin
+
+1. [Download Raspbian Buster with desktop](https://downloads.raspberrypi.org/raspbian_latest)
+2. Follow Installing instructions [installing-images](https://www.raspberrypi.org/documentation/installation/installing-images/README.md)
+3. Insert the sd-card and put the device together(plug-in the usb cables etc.)
+
+### Set Up The RaspberryPi
+
+1. Connect the RaspberryPi with the Internet
+2. Install latest the Node-Red [follow instructions](https://nodered.org/docs/getting-started/raspberrypi)
+3. [Autostart Chromium in Kioskmode](https://itrig.de/index.php?/archives/2309-Raspberry-Pi-3-Kiosk-Chromium-Autostart-im-Vollbildmodus-einrichten.html)
+
+### Configure Node-Red
+
+1. Copy/paste the node-red.json into running node-red
+2. Install node-red-dashboard
+3. Autostart node-red on boot: sudo systemctl enable nodered.service
+
+## Testing
+
+ip_raspbi:1880/ui
+
+Show connected devices
+`python -m platformio device list`
+
+Show API OUT from device(needs sudo)
+`python -m platformio device monitor`
+
+# module-iot2050
+
+Image from SIEMENS website. (https://support.industry.siemens.com/cs/document/109780231/simatic-iot2050-sd-card-beispielimage?dti=0&lc=de-CH)
+
+Setup like module-raspbi. Node-red is pre-installed
+
+differents to Raspberry Pi:
+- Nodes for Hardware-Pins (for Arduino Shields)
+- in python scipts you'll need the mraa-Library to connect to GPIO's
+- ...
+modules directory.
+The individual modules are presented below:
+
+# module-chassis and module-roboter-arm
+
+## Requirements
+
+- [platformio](http://docs.platformio.org/en/v0.6.0/installation.html)
+
+## Build
+
+Build&Upload
+`python -m platformio run -t upload`
# module-raspbi
diff --git a/sw-modules/bluetooth-communication/master/.gitignore b/sw-modules/bluetooth-communication/master/.gitignore
deleted file mode 100644
index 6a01030..0000000
--- a/sw-modules/bluetooth-communication/master/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-.pioenvs
-.piolibdeps
-.vscode/.browse.c_cpp.db*
-.vscode/c_cpp_properties.json
-.vscode/launch.json
diff --git a/sw-modules/bluetooth-communication/master/.travis.yml b/sw-modules/bluetooth-communication/master/.travis.yml
deleted file mode 100644
index 9443843..0000000
--- a/sw-modules/bluetooth-communication/master/.travis.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-# Continuous Integration (CI) is the practice, in software
-# engineering, of merging all developer working copies with a shared mainline
-# several times a day < http://docs.platformio.org/page/ci/index.html >
-#
-# Documentation:
-#
-# * Travis CI Embedded Builds with PlatformIO
-# < https://docs.travis-ci.com/user/integration/platformio/ >
-#
-# * PlatformIO integration with Travis CI
-# < http://docs.platformio.org/page/ci/travis.html >
-#
-# * User Guide for `platformio ci` command
-# < http://docs.platformio.org/page/userguide/cmd_ci.html >
-#
-#
-# Please choice one of the following templates (proposed below) and uncomment
-# it (remove "# " before each line) or use own configuration according to the
-# Travis CI documentation (see above).
-#
-
-
-#
-# Template #1: General project. Test it using existing `platformio.ini`.
-#
-
-# language: python
-# python:
-# - "2.7"
-#
-# sudo: false
-# cache:
-# directories:
-# - "~/.platformio"
-#
-# install:
-# - pip install -U platformio
-# - platformio update
-#
-# script:
-# - platformio run
-
-
-#
-# Template #2: The project is intended to by used as a library with examples
-#
-
-# language: python
-# python:
-# - "2.7"
-#
-# sudo: false
-# cache:
-# directories:
-# - "~/.platformio"
-#
-# env:
-# - PLATFORMIO_CI_SRC=path/to/test/file.c
-# - PLATFORMIO_CI_SRC=examples/file.ino
-# - PLATFORMIO_CI_SRC=path/to/test/directory
-#
-# install:
-# - pip install -U platformio
-# - platformio update
-#
-# script:
-# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
diff --git a/sw-modules/bluetooth-communication/master/doc/pin_layout.jpg b/sw-modules/bluetooth-communication/master/doc/pin_layout.jpg
deleted file mode 100644
index a0e188d..0000000
Binary files a/sw-modules/bluetooth-communication/master/doc/pin_layout.jpg and /dev/null differ
diff --git a/sw-modules/bluetooth-communication/master/lib/readme.txt b/sw-modules/bluetooth-communication/master/lib/readme.txt
deleted file mode 100644
index 131f1bf..0000000
--- a/sw-modules/bluetooth-communication/master/lib/readme.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-
-This directory is intended for the project specific (private) libraries.
-PlatformIO will compile them to static libraries and link to executable file.
-
-The source code of each library should be placed in separate directory, like
-"lib/private_lib/[here are source files]".
-
-For example, see how can be organized `Foo` and `Bar` libraries:
-
-|--lib
-| |
-| |--Bar
-| | |--docs
-| | |--examples
-| | |--src
-| | |- Bar.c
-| | |- Bar.h
-| | |- library.json (optional, custom build options, etc) http://docs.platformio.org/page/librarymanager/config.html
-| |
-| |--Foo
-| | |- Foo.c
-| | |- Foo.h
-| |
-| |- readme.txt --> THIS FILE
-|
-|- platformio.ini
-|--src
- |- main.c
-
-Then in `src/main.c` you should use:
-
-#include
-#include
-
-// rest H/C/CPP code
-
-PlatformIO will find your libraries automatically, configure preprocessor's
-include paths and build them.
-
-More information about PlatformIO Library Dependency Finder
-- http://docs.platformio.org/page/librarymanager/ldf.html
diff --git a/sw-modules/bluetooth-communication/master/platformio.ini b/sw-modules/bluetooth-communication/master/platformio.ini
deleted file mode 100644
index 113e696..0000000
--- a/sw-modules/bluetooth-communication/master/platformio.ini
+++ /dev/null
@@ -1,29 +0,0 @@
-; PlatformIO Project Configuration File
-;
-; Build options: build flags, source filter
-; Upload options: custom upload port, speed and extra flags
-; Library options: dependencies, extra library storages
-; Advanced options: extra scripting
-;
-; Please visit documentation for the other options and examples
-; http://docs.platformio.org/page/projectconf.html
-
-
-; PlatformIO Project Configuration File
-;
-; Build options: build flags, source filter
-; Upload options: custom upload port, speed and extra flags
-; Library options: dependencies, extra library storages
-; Advanced options: extra scripting
-;
-; Please visit documentation for the other options and examples
-; http://docs.platformio.org/page/projectconf.html
-
-[env:uno]
-platform=atmelavr
-board=uno
-framework=arduino
-lib_deps = SoftwareSerial
-
-[platformio]
-src_dir=src
diff --git a/sw-modules/bluetooth-communication/master/src/Master.ino b/sw-modules/bluetooth-communication/master/src/Master.ino
deleted file mode 100644
index 058b834..0000000
--- a/sw-modules/bluetooth-communication/master/src/Master.ino
+++ /dev/null
@@ -1,24 +0,0 @@
-#include
-#include
-
-#define BLUETOOTH_TX 2
-#define BLUETOOTH_RX 3
-
-static SoftwareSerial bluetooth{BLUETOOTH_RX, BLUETOOTH_TX};
-
-void setup()
-{
- Serial.begin(9600);
- bluetooth.begin(9600);
- bluetooth.println("master ready!");
-}
-
-void loop()
-{
- if (bluetooth.available()){
- String message = bluetooth.readStringUntil('\n');
- Serial.println(message);
- }
- bluetooth.println("message from master");
- delay(3000);
-}
diff --git a/sw-modules/bluetooth-communication/slave/.gitignore b/sw-modules/bluetooth-communication/slave/.gitignore
deleted file mode 100644
index 6c69f4c..0000000
--- a/sw-modules/bluetooth-communication/slave/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.pioenvs
-.piolibdeps
diff --git a/sw-modules/bluetooth-communication/slave/.travis.yml b/sw-modules/bluetooth-communication/slave/.travis.yml
deleted file mode 100644
index 9443843..0000000
--- a/sw-modules/bluetooth-communication/slave/.travis.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-# Continuous Integration (CI) is the practice, in software
-# engineering, of merging all developer working copies with a shared mainline
-# several times a day < http://docs.platformio.org/page/ci/index.html >
-#
-# Documentation:
-#
-# * Travis CI Embedded Builds with PlatformIO
-# < https://docs.travis-ci.com/user/integration/platformio/ >
-#
-# * PlatformIO integration with Travis CI
-# < http://docs.platformio.org/page/ci/travis.html >
-#
-# * User Guide for `platformio ci` command
-# < http://docs.platformio.org/page/userguide/cmd_ci.html >
-#
-#
-# Please choice one of the following templates (proposed below) and uncomment
-# it (remove "# " before each line) or use own configuration according to the
-# Travis CI documentation (see above).
-#
-
-
-#
-# Template #1: General project. Test it using existing `platformio.ini`.
-#
-
-# language: python
-# python:
-# - "2.7"
-#
-# sudo: false
-# cache:
-# directories:
-# - "~/.platformio"
-#
-# install:
-# - pip install -U platformio
-# - platformio update
-#
-# script:
-# - platformio run
-
-
-#
-# Template #2: The project is intended to by used as a library with examples
-#
-
-# language: python
-# python:
-# - "2.7"
-#
-# sudo: false
-# cache:
-# directories:
-# - "~/.platformio"
-#
-# env:
-# - PLATFORMIO_CI_SRC=path/to/test/file.c
-# - PLATFORMIO_CI_SRC=examples/file.ino
-# - PLATFORMIO_CI_SRC=path/to/test/directory
-#
-# install:
-# - pip install -U platformio
-# - platformio update
-#
-# script:
-# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
diff --git a/sw-modules/bluetooth-communication/slave/doc/pin_layout.jpg b/sw-modules/bluetooth-communication/slave/doc/pin_layout.jpg
deleted file mode 100644
index a0e188d..0000000
Binary files a/sw-modules/bluetooth-communication/slave/doc/pin_layout.jpg and /dev/null differ
diff --git a/sw-modules/bluetooth-communication/slave/lib/readme.txt b/sw-modules/bluetooth-communication/slave/lib/readme.txt
deleted file mode 100644
index 131f1bf..0000000
--- a/sw-modules/bluetooth-communication/slave/lib/readme.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-
-This directory is intended for the project specific (private) libraries.
-PlatformIO will compile them to static libraries and link to executable file.
-
-The source code of each library should be placed in separate directory, like
-"lib/private_lib/[here are source files]".
-
-For example, see how can be organized `Foo` and `Bar` libraries:
-
-|--lib
-| |
-| |--Bar
-| | |--docs
-| | |--examples
-| | |--src
-| | |- Bar.c
-| | |- Bar.h
-| | |- library.json (optional, custom build options, etc) http://docs.platformio.org/page/librarymanager/config.html
-| |
-| |--Foo
-| | |- Foo.c
-| | |- Foo.h
-| |
-| |- readme.txt --> THIS FILE
-|
-|- platformio.ini
-|--src
- |- main.c
-
-Then in `src/main.c` you should use:
-
-#include
-#include
-
-// rest H/C/CPP code
-
-PlatformIO will find your libraries automatically, configure preprocessor's
-include paths and build them.
-
-More information about PlatformIO Library Dependency Finder
-- http://docs.platformio.org/page/librarymanager/ldf.html
diff --git a/sw-modules/bluetooth-communication/slave/platformio.ini b/sw-modules/bluetooth-communication/slave/platformio.ini
deleted file mode 100644
index 113e696..0000000
--- a/sw-modules/bluetooth-communication/slave/platformio.ini
+++ /dev/null
@@ -1,29 +0,0 @@
-; PlatformIO Project Configuration File
-;
-; Build options: build flags, source filter
-; Upload options: custom upload port, speed and extra flags
-; Library options: dependencies, extra library storages
-; Advanced options: extra scripting
-;
-; Please visit documentation for the other options and examples
-; http://docs.platformio.org/page/projectconf.html
-
-
-; PlatformIO Project Configuration File
-;
-; Build options: build flags, source filter
-; Upload options: custom upload port, speed and extra flags
-; Library options: dependencies, extra library storages
-; Advanced options: extra scripting
-;
-; Please visit documentation for the other options and examples
-; http://docs.platformio.org/page/projectconf.html
-
-[env:uno]
-platform=atmelavr
-board=uno
-framework=arduino
-lib_deps = SoftwareSerial
-
-[platformio]
-src_dir=src
diff --git a/sw-modules/bluetooth-communication/slave/src/Slave.ino b/sw-modules/bluetooth-communication/slave/src/Slave.ino
deleted file mode 100644
index d194a0b..0000000
--- a/sw-modules/bluetooth-communication/slave/src/Slave.ino
+++ /dev/null
@@ -1,25 +0,0 @@
-#include
-#include
-
-#define BLUETOOTH_TX 2
-#define BLUETOOTH_RX 3
-
-static SoftwareSerial bluetooth{BLUETOOTH_RX, BLUETOOTH_TX};
-
-void setup()
-{
- Serial.begin(9600);
- bluetooth.begin(9600);
- bluetooth.println("slave ready!");
-}
-
-void loop()
-{
- if (bluetooth.available()){
-
- String message = bluetooth.readStringUntil('\n');
- Serial.println(message);
- }
- bluetooth.println("message from slave");
- delay(3000);
-}
diff --git a/sw-modules/module-chassis/.gitignore b/sw-modules/module-chassis/.gitignore
deleted file mode 100644
index 03e9fdb..0000000
--- a/sw-modules/module-chassis/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.pioenvs/**
-.piolibdeps/**
-.clang_complete/**
-.gcc-flags.json
-.vscode/**
-.pioenvs
-.piolibdeps
-.vscode/.browse.c_cpp.db*
-.vscode/c_cpp_properties.json
-.vscode/launch.json
-.clang_complete
diff --git a/sw-modules/module-chassis/.travis.yml b/sw-modules/module-chassis/.travis.yml
deleted file mode 100644
index 2c4ff5c..0000000
--- a/sw-modules/module-chassis/.travis.yml
+++ /dev/null
@@ -1,65 +0,0 @@
-# Continuous Integration (CI) is the practice, in software
-# engineering, of merging all developer working copies with a shared mainline
-# several times a day < http://docs.platformio.org/page/ci/index.html >
-#
-# Documentation:
-#
-# * Travis CI Embedded Builds with PlatformIO
-# < https://docs.travis-ci.com/user/integration/platformio/ >
-#
-# * PlatformIO integration with Travis CI
-# < http://docs.platformio.org/page/ci/travis.html >
-#
-# * User Guide for `platformio ci` command
-# < http://docs.platformio.org/page/userguide/cmd_ci.html >
-#
-#
-# Please choice one of the following templates (proposed below) and uncomment
-# it (remove "# " before each line) or use own configuration according to the
-# Travis CI documentation (see above).
-#
-
-
-#
-# Template #1: General project. Test it using existing `platformio.ini`.
-#
-
-# language: python
-# python:
-# - "2.7"
-#
-# sudo: false
-# cache:
-# directories:
-# - "~/.platformio"
-#
-# install:
-# - pip install -U platformio
-#
-# script:
-# - platformio run
-
-
-#
-# Template #2: The project is intended to by used as a library with examples
-#
-
-# language: python
-# python:
-# - "2.7"
-#
-# sudo: false
-# cache:
-# directories:
-# - "~/.platformio"
-#
-# env:
-# - PLATFORMIO_CI_SRC=path/to/test/file.c
-# - PLATFORMIO_CI_SRC=examples/file.ino
-# - PLATFORMIO_CI_SRC=path/to/test/directory
-#
-# install:
-# - pip install -U platformio
-#
-# script:
-# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
diff --git a/sw-modules/module-chassis/lib/readme.txt b/sw-modules/module-chassis/lib/readme.txt
deleted file mode 100644
index de6daf5..0000000
--- a/sw-modules/module-chassis/lib/readme.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-
-This directory is intended for the project specific (private) libraries.
-PlatformIO will compile them to static libraries and link to executable file.
-
-The source code of each library should be placed in separate directory, like
-"lib/private_lib/[here are source files]".
-
-For example, see how can be organized `Foo` and `Bar` libraries:
-
-|--lib
-| |--Bar
-| | |--docs
-| | |--examples
-| | |--src
-| | |- Bar.c
-| | |- Bar.h
-| |--Foo
-| | |- Foo.c
-| | |- Foo.h
-| |- readme.txt --> THIS FILE
-|- platformio.ini
-|--src
- |- main.c
-
-Then in `src/main.c` you should use:
-
-#include
-#include
-
-// rest H/C/CPP code
-
-PlatformIO will find your libraries automatically, configure preprocessor's
-include paths and build them.
-
-More information about PlatformIO Library Dependency Finder
-- http://docs.platformio.org/page/librarymanager/ldf.html
-
-Include submodule:
-git submodule add {reponame}
-https://github.com/HSRLCLab/modular.git
-
-git config push.recurseSubmodule on-demand
diff --git a/sw-modules/module-chassis/src/Action.h b/sw-modules/module-chassis/src/Action.h
deleted file mode 100644
index 51cb8ce..0000000
--- a/sw-modules/module-chassis/src/Action.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#pragma once
-
-class Action
-{
-public:
- virtual void start(int params) = 0;
-};
diff --git a/sw-modules/module-chassis/src/Config.h b/sw-modules/module-chassis/src/Config.h
deleted file mode 100644
index aa92fcf..0000000
--- a/sw-modules/module-chassis/src/Config.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-#define RFIDDETECTOR_SDA 7
-#define RFIDDETECTOR_RST_PIN 6
-#define CHASSIS_DIGITAL_TRIG_PIN 4
-#define CHASSIS_DIGITAL_ECHO_PIN 5
-#define MOTOR_NR 4
-#define CHASIS_POS_MAX 60
-#define NofActions 3
-#define NofSensors 2
-#define RFID_LENGTH 7
diff --git a/sw-modules/module-chassis/src/Distance.h b/sw-modules/module-chassis/src/Distance.h
deleted file mode 100644
index 238fbee..0000000
--- a/sw-modules/module-chassis/src/Distance.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma once
-
-#include
-#include
-#include
-
-class Distance : public Sensor
-{
-public:
- Distance(NewPing *sensor) : sensor{sensor} {}
- Stream &get(Stream &obj)
- {
- obj << String(sensor->ping_cm());
- return obj;
- }
-
-private:
- NewPing *sensor;
-};
diff --git a/sw-modules/module-chassis/src/Motor.h b/sw-modules/module-chassis/src/Motor.h
deleted file mode 100644
index 6ae0bcf..0000000
--- a/sw-modules/module-chassis/src/Motor.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma once
-
-#include
-#include
-
-class Motor : public Action
-{
-public:
- Motor(Adafruit_DCMotor *motor, byte direction) : motor{motor}, direction{direction}
- {
- }
-
- void start(int speed)
- {
- if (speed == 0)
- {
- motor->run(RELEASE);
- }
- motor->run(direction);
- motor->setSpeed(speed);
- }
-
-private:
- Adafruit_DCMotor *motor;
- byte direction;
-};
diff --git a/sw-modules/module-chassis/src/RfidDetector.h b/sw-modules/module-chassis/src/RfidDetector.h
deleted file mode 100644
index e7d0837..0000000
--- a/sw-modules/module-chassis/src/RfidDetector.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma once
-
-#include
-#include
-
-class RfidDetector : public Sensor
-{
-public:
- RfidDetector(MFRC522 *rfidReader) : rfidReader{rfidReader} {}
-
- Stream &get(Stream &obj)
- {
- if (rfidReader->PICC_IsNewCardPresent() && rfidReader->PICC_ReadCardSerial() && rfidReader->uid.size != 0)
- {
- for (auto index = 0; index < RFID_LENGTH; index++)
- {
- obj << rfidReader->uid.uidByte[index];
- }
- }
-
- return obj;
- }
-
-private:
- MFRC522 *rfidReader;
-};
diff --git a/sw-modules/module-chassis/src/Sensor.h b/sw-modules/module-chassis/src/Sensor.h
deleted file mode 100644
index 5cfffaa..0000000
--- a/sw-modules/module-chassis/src/Sensor.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-#include
-
-template
-inline Stream &operator<<(Stream &obj, T arg)
-{
- obj.print(arg);
- return obj;
-}
-
-class Sensor
-{
-public:
- virtual Stream &get(Stream &obj) = 0;
-};
diff --git a/sw-modules/module-chassis/src/Sortic.ino b/sw-modules/module-chassis/src/Sortic.ino
deleted file mode 100644
index bd12636..0000000
--- a/sw-modules/module-chassis/src/Sortic.ino
+++ /dev/null
@@ -1,44 +0,0 @@
-#include
-#include
-#include
-
-#include "Action.h"
-#include "Sensor.h"
-#include "Config.h"
-#include "Distance.h"
-#include "Motor.h"
-#include "RfidDetector.h"
-
-static Adafruit_MotorShield currentMotorShield{};
-static Adafruit_DCMotor *driverMotor = currentMotorShield.getMotor(MOTOR_NR);
-static MFRC522 partDetector{RFIDDETECTOR_SDA, RFIDDETECTOR_RST_PIN};
-static NewPing *newPing = new NewPing{CHASSIS_DIGITAL_TRIG_PIN, CHASSIS_DIGITAL_ECHO_PIN, CHASIS_POS_MAX};
-
-static Sensor *sensors[NofSensors]{
- new RfidDetector{&partDetector},
- new Distance{newPing}};
-static Action *actions[NofActions]{
- new Motor{driverMotor, FORWARD},
- new Motor{driverMotor, BACKWARD}};
-
-void setup()
-{
- Serial.begin(9600);
- currentMotorShield.begin();
- SPI.begin();
- partDetector.PCD_Init();
-}
-
-void loop()
-{
- if (Serial.available())
- {
- Action *action = actions[Serial.parseInt()];
- action->start(Serial.parseInt());
- }
- Serial << '[';
- for (auto index = 0; index < NofSensors; index++)
- {
- sensors[index]->get(Serial) << (index == NofSensors - 1 ? ']' : ',');
- }
-}
diff --git a/sw-modules/module-iot2050/node-red.json b/sw-modules/module-iot2050/node-red.json
new file mode 100644
index 0000000..dd78bf7
--- /dev/null
+++ b/sw-modules/module-iot2050/node-red.json
@@ -0,0 +1 @@
+[{"id":"cb4b202.e621f6","type":"tab","label":"IOT2050","disabled":false,"info":""},{"id":"af7f3b2f.adcdf8","type":"mraa-gpio-led","z":"cb4b202.e621f6","name":"ledred","pin":"4","x":590,"y":500,"wires":[]},{"id":"5702a42f.297164","type":"mqtt in","z":"cb4b202.e621f6","name":"","topic":"rfid/package","qos":"2","datatype":"auto","broker":"bcd06034.e998","x":170,"y":340,"wires":[["fda3de4b.897198","6bf9cf8b.f79188","2190c0b1.a9973"]]},{"id":"2190c0b1.a9973","type":"debug","z":"cb4b202.e621f6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":610,"y":340,"wires":[]},{"id":"b30a429c.68647","type":"mqtt out","z":"cb4b202.e621f6","name":"","topic":"rfid/package","qos":"1","retain":"false","broker":"bcd06034.e998","x":610,"y":220,"wires":[]},{"id":"d866d71b.cc8a9","type":"inject","z":"cb4b202.e621f6","name":"","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":200,"wires":[["b30a429c.68647"]]},{"id":"eb673545.e8e7f","type":"inject","z":"cb4b202.e621f6","name":"","topic":"","payload":"2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":240,"wires":[["b30a429c.68647"]]},{"id":"91a44a89.a42c38","type":"inject","z":"cb4b202.e621f6","name":"","topic":"","payload":"3","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":280,"wires":[["b30a429c.68647"]]},{"id":"4c87728.4cdc80c","type":"mraa-gpio-led","z":"cb4b202.e621f6","name":"ledorange","pin":"5","x":600,"y":460,"wires":[]},{"id":"267d0b39.d5cb54","type":"mraa-gpio-led","z":"cb4b202.e621f6","name":"ledgreen","pin":"0","x":600,"y":420,"wires":[]},{"id":"c0b4b99e.4b5668","type":"function","z":"cb4b202.e621f6","name":"is1","func":"if(msg.payload === \"1\"){\n msg.payload = true;\n}\nelse {\n msg.payload = false;\n}\nreturn msg; ","outputs":1,"noerr":0,"x":430,"y":420,"wires":[["267d0b39.d5cb54"]]},{"id":"fda3de4b.897198","type":"delay","z":"cb4b202.e621f6","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":240,"y":460,"wires":[["c0b4b99e.4b5668","76541856.d34728","2812b795.ca1288"]]},{"id":"6bf9cf8b.f79188","type":"function","z":"cb4b202.e621f6","name":"false","func":"msg.payload = false;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":380,"wires":[["267d0b39.d5cb54","4c87728.4cdc80c","af7f3b2f.adcdf8"]]},{"id":"9748d002.47732","type":"debug","z":"cb4b202.e621f6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":760,"wires":[]},{"id":"c8d48d9e.2d3ce","type":"OpcUa-Item","z":"cb4b202.e621f6","item":"ns=3;s=\"Data_Block_1\".\"istPos\"","datatype":"Int16","value":"","name":"istPos","x":270,"y":760,"wires":[["378f51a3.243afe"]]},{"id":"632f6edb.2a65b","type":"OpcUa-Item","z":"cb4b202.e621f6","item":"ns=3;s=\"Data_Block_1\".\"sollPos\"","datatype":"Int16","value":"","name":"sollPos","x":280,"y":800,"wires":[["378f51a3.243afe"]]},{"id":"76541856.d34728","type":"function","z":"cb4b202.e621f6","name":"is2","func":"if(msg.payload === \"2\"){\n msg.payload = true;\n}\nelse {\n msg.payload = false;\n}\nreturn msg; ","outputs":1,"noerr":0,"x":430,"y":460,"wires":[["4c87728.4cdc80c"]]},{"id":"2812b795.ca1288","type":"function","z":"cb4b202.e621f6","name":"is3","func":"if(msg.payload === \"3\"){\n msg.payload = true;\n}\nelse {\n msg.payload = false;\n}\nreturn msg; ","outputs":1,"noerr":0,"x":430,"y":500,"wires":[["af7f3b2f.adcdf8"]]},{"id":"5559382c.831cf","type":"comment","z":"cb4b202.e621f6","name":"es müssen alle LED's gelöscht werden, bevor einzelne wieder angehen...","info":"","x":350,"y":160,"wires":[]},{"id":"1ed8b207.8b4c3e","type":"comment","z":"cb4b202.e621f6","name":"Test MQTT und LEDs","info":"","x":200,"y":120,"wires":[]},{"id":"e9e61324.d5b68","type":"comment","z":"cb4b202.e621f6","name":"Versuch OPCua SPS","info":"","x":120,"y":560,"wires":[]},{"id":"1e02af1b.50d4e9","type":"inject","z":"cb4b202.e621f6","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":760,"wires":[["c8d48d9e.2d3ce","632f6edb.2a65b"]]},{"id":"378f51a3.243afe","type":"OpcUa-Client","z":"cb4b202.e621f6","endpoint":"85a68a30.06e8d","action":"write","deadbandtype":"a","deadbandvalue":1,"time":10,"timeUnit":"s","certificate":"n","localfile":"","localkeyfile":"","securitymode":"None","securitypolicy":"None","name":"","x":500,"y":760,"wires":[["9748d002.47732"]]},{"id":"a0872110.82af08","type":"OpcUa-Client","z":"cb4b202.e621f6","endpoint":"85a68a30.06e8d","action":"read","deadbandtype":"a","deadbandvalue":1,"time":10,"timeUnit":"s","certificate":"n","localfile":"","localkeyfile":"","securitymode":"None","securitypolicy":"None","name":"","x":300,"y":640,"wires":[["fe103b05.8bb75","b6054890.d5938"]]},{"id":"fe103b05.8bb75","type":"OpcUa-Item","z":"cb4b202.e621f6","item":"ns=3;s=\"Data_Block_1\".\"istPos\"","datatype":"Int16","value":"","name":"istPos","x":470,"y":640,"wires":[["b6957c76.7f5a58"]]},{"id":"b6054890.d5938","type":"OpcUa-Item","z":"cb4b202.e621f6","item":"ns=3;s=\"Data_Block_1\".\"sollPos\"","datatype":"Int16","value":"","name":"sollPos","x":480,"y":680,"wires":[["b6957c76.7f5a58"]]},{"id":"3dd5546d.8b465c","type":"inject","z":"cb4b202.e621f6","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":640,"wires":[["a0872110.82af08"]]},{"id":"b6957c76.7f5a58","type":"debug","z":"cb4b202.e621f6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":640,"wires":[]},{"id":"3acee9b2.ae172e","type":"rpi-srf","z":"cb4b202.e621f6","name":"","topic":"SRF","pulse":"1","pins":"13,11","x":150,"y":60,"wires":[["97736338.d9d31","b7ea156e.afeb28"]]},{"id":"539606f8.22efd","type":"s7comm write","z":"cb4b202.e621f6","connection":"35dc00ec.0edd38","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"100\",\"S7_Datatype\":\"uint16\",\"S7_Offset\":\"6\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"distanz\"}","s7Name":"distanz","topic":"","name":"","signalSetted":false,"x":620,"y":60,"wires":[[]]},{"id":"97736338.d9d31","type":"debug","z":"cb4b202.e621f6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":590,"y":100,"wires":[]},{"id":"b7ea156e.afeb28","type":"function","z":"cb4b202.e621f6","name":"wrap JSON","func":"var object = {\n \"value\":[msg.payload]\n }\n \nmsg.payload = Object.assign({}, object); \n\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":60,"wires":[["97736338.d9d31","539606f8.22efd"]]},{"id":"bcd06034.e998","type":"mqtt-broker","z":"","name":"Sortic Server","broker":"192.168.0.11","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"85a68a30.06e8d","type":"OpcUa-Endpoint","z":"","endpoint":"opc.tcp://192.168.0.100:4840","secpol":"None","secmode":"None","login":false},{"id":"35dc00ec.0edd38","type":"s7comm","z":"","ip":"192.168.0.100","port":"102","rack":"0","slot":"1","payload":[{"S7_Type":"DB","S7_DBnum":"100","S7_Datatype":"X","S7_Offset":"0","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"done"},{"S7_Type":"DB","S7_DBnum":"100","S7_Datatype":"uint16","S7_Offset":"2","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"sollPos"},{"S7_Type":"DB","S7_DBnum":"100","S7_Datatype":"uint16","S7_Offset":"4","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"istPos"},{"S7_Type":"DB","S7_DBnum":"100","S7_Datatype":"uint16","S7_Offset":"6","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"distanz"}]}]
\ No newline at end of file
diff --git a/sw-modules/module-package-reader/.gitignore b/sw-modules/module-package-reader/.gitignore
new file mode 100644
index 0000000..e6bddc6
--- /dev/null
+++ b/sw-modules/module-package-reader/.gitignore
@@ -0,0 +1,3 @@
+.pio
+.vscode/
+*.db
\ No newline at end of file
diff --git a/sw-modules/module-package-reader/LICENSE b/sw-modules/module-package-reader/LICENSE
new file mode 100644
index 0000000..fa9cbab
--- /dev/null
+++ b/sw-modules/module-package-reader/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 LMazzole
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/sw-modules/module-package-reader/README.md b/sw-modules/module-package-reader/README.md
new file mode 100644
index 0000000..2be638c
--- /dev/null
+++ b/sw-modules/module-package-reader/README.md
@@ -0,0 +1,216 @@
+# SmartFactory_MQTTCommunication
+
+The SmartFactroy_MQTTCommunication is an modular part of the SmartFactory project.
+MQTTCommunication establishes a WLAN-connection and allows you to connect
+with an MQTT-Broker to send and receive message.
+Incomming messages need to be in a known JSON-format and will be converted into a struct.
+These messages-structs are stored in a circular-buffer.
+
+
+
+## Table of contents
+
+
+- [The SmartFactory project](#the-smartfactory-project)
+- [Tools and technologies](#tools-and-technologies)
+ - [Doxygen](#doxygen)
+ - [VSCode PlatformIO](#vscode-platformio)
+ - [MQTT](#mqtt)
+ - [Circular buffer](#circular-buffer)
+- [Documentation](#documentation)
+ - [Hardware](#hardware)
+ - [Software](#software)
+ - [Dependency graph](#dependency-graph)
+ - [Collaboration diagram](#collaboration-diagram)
+ - [Important functions and files](#important-functions-and-files)
+ - [MQTTCommunication.h](#mqttcommunicationh)
+ - [CommunicationConfiguration.h](#communicationconfigurationh)
+ - [myJSONStr.h](#myjsonstrh)
+- [FAQ's](#faqs)
+ - [I'd like to use this code in my project. What do I need to know?](#id-like-to-use-this-code-in-my-project-what-do-i-need-to-know)
+ - [Where can I change the configurations like MQTT-Broker IP and WLAN-Credentials?](#where-can-i-change-the-configurations-like-mqtt-broker-ip-and-wlan-credentials)
+ - [I'd like to change the incoming JSON-Message. How can I do that?](#id-like-to-change-the-incoming-json-message-how-can-i-do-that)
+- [ToDo's](#todos)
+- [Contributors](#contributors)
+- [Changelog](#changelog)
+- [License](#license)
+
+
+
+
+## The SmartFactory project
+
+[SmartFactory_MQTTCommunication](https://github.com/LMazzole/SmartFactory_MQTTCommunication) is part of the SmartFactory-project. It provides a library with basic MQTT-Communication functions.
+
+Other SmartFactory-components are:
+* [SmartFactory_Box-Sortic]()
+
+A possible implementation of the SmartFactory-project can be seen in the Sortic-showcase:
+
+
+
+The associated repositorys are:
+ [SmartFactory-Sortic](https://github.com/LMazzole/SmartFactory-Sortic)
+ [SmartFactory_Box-Sortic](https://github.com/LMazzole/SmartFactory_Box-Sortic)
+ [SmartFactory_Vehicle-Sortic](https://github.com/LMazzole/SmartFactory_Vehicle-Sortic)
+ [SmartFactory_Vehicle-Basis](https://github.com/LMazzole/SmartFactory_Vehicle-Basis)
+ [SmartFactory_MQTTCommunication](https://github.com/LMazzole/SmartFactory_MQTTCommunication)
+
+
+
+## Tools and technologies
+
+The Source-code is written in C++.
+To achieve this project, the following tools and technologies were used.
+
+### Doxygen
+Doxygen is used for the documentation of the source code.
+An intorduction to *Doxygen* and how to install it can be found in the [ArdFSM-Repo](https://github.com/LMazzole/ArdFSM#documentation-with-doxygen).
+
+### VSCode PlatformIO
+The used IDE is [VSCode](https://code.visualstudio.com/) with the [PlatformIO](https://platformio.org/platformio-ide)-extension.
+
+### MQTT
+MQTT (Message Queuing Telemetry Transport) is a lightweight publish-subscribe messaging protocol and requires a broker to relay the messages. It's used for M2M (machine-to-machine) communication.
+An MQTT-system always consist of a broker and one or multiple clients, which can be either subscriber or publisher.
+
+
+
+[Image: [MQTT101 - Eclispe Foundation]()]
+
+A client can subscribe and publish to one or multiple topics. Topics are organized in a tree similar to a folder-structure in Windows. Here's an example of how such a topic-tree and published message can look like:
+
+
+
+This images also illustrates the scalability of MQTT appropriately.
+For more Infos about MQTT and MQTT-topics check out the MQTT-Wiki on [Github](https://github.com/mqtt/mqtt.github.io/wiki).
+[Source: [Wiki:MQTT](https://en.wikipedia.org/wiki/MQTT), [MQTT](https://mqtt.org/) ]
+
+
+
+### Circular buffer
+A circular buffer or a ring-buffer uses an buffer with fixed Size. If the buffer is full the oldest element gets overwritten.
+
+
+
+[Image: [Wiki: Circular buffer](https://en.wikipedia.org/wiki/Circular_buffer)]
+
+
+
+# Documentation
+## Hardware
+This code needs a WLAN-shield to function properly.
+It's tested with a [Adafruit Feather M0 WiFi - ATSAMD21 + ATWINC1500](https://www.adafruit.com/product/3010) from Adafruit.
+
+## Software
+All functions and files are documented on the [GitHub-Page with Doxygen](https://lmazzole.github.io/SmartFactory_MQTTCommunication/)
+
+### Dependency graph
+
+
+
+
+
+
+### Important functions and files
+
+#### MQTTCommunication.h
+The *MQTTCommunication.h*-file serves as interface.
+It provides the functions for:
+* Network-connection
+* MQTT-functionalities
+* access the message-storage (circular buffer)
+
+#### CommunicationConfiguration.h
+In the *CommunicationConfiguration.h*-file are all important settings defined:
+* WLAN SSID
+* WLAN password
+* WLAN Shield pins
+* MQTT Broker IP
+* JSON parse size
+* Cirrcular Buffer size
+
+#### myJSONStr.h
+In the *myJSONStr.h*-file is defined how the JSON-message and hence the struct looks like.
+
+This is how the JSON-message (received as String) can look like:
+``` javascript
+{
+ "id": "hostname",
+ "topic": "topic/topic",
+ "status": "driving",
+ "sector": "transit",
+ "line": 1,
+ "ack":"hostname",
+ "req":"hostname",
+ "cargo":"beer",
+ "token":false;
+ "error":false
+}
+```
+And the corresponding struct in which the message gets parsed:
+``` cpp
+struct myJSONStr {
+ String id = "hostname";
+ String topic = "topic/topic";
+ String status = "driving";
+ String sector = "transit";
+ int line = 1;
+ String ack = "hostname";
+ String req = "hostname";
+ String cargo = "beer";
+ bool token = false;
+ bool error = false;
+};
+```
+
+
+
+# FAQ's
+#### I'd like to use this code in my project. What do I need to know?
+> All you need to do is add the GitHub-Link to this Repo under *lib_deps* in your platformio.ini File and you're set up. All dependencies are downloaded automatic.
+
+#### Where can I change the configurations like MQTT-Broker IP and WLAN-Credentials?
+> All the Configuration data is stored in the *CommunicationConfiguration.h* file and can be edited there.
+
+#### I'd like to change the incoming JSON-Message. How can I do that?
+> Incoming messages need to be in a know JSON-Format which is defined in* myJSONStr.h* and needs to match the implementation in *myJSON::parsingJSONToStruct*. If you would like to change this format you need to adapt both files.
+
+
+# ToDo's
+The open ToDo's can be found in the Documentation on the [GitHub-Page](https://lmazzole.github.io/SmartFactory_MQTTCommunication/todo.html)
+- [ ] Split the code in 2 repos: MQTTCommunication-Sortic and MQTTCommunication in order to increase reusability.
+
+# Contributors
+- [Luca Mazzoleni](https://github.com/LMazzole)
+- Luciano Bettinaglio
+
+# Changelog
+V 1.0 - Release BA FS19 - [Luca Mazzoleni](https://github.com/LMazzole)
+
+# License
+
+MIT License
diff --git a/sw-modules/module-package-reader/docs/.nojekyll b/sw-modules/module-package-reader/docs/.nojekyll
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/sw-modules/module-package-reader/docs/.nojekyll
@@ -0,0 +1 @@
+
diff --git a/sw-modules/module-package-reader/docs/Circular_Buffer_Animation.gif b/sw-modules/module-package-reader/docs/Circular_Buffer_Animation.gif
new file mode 100644
index 0000000..8ffda04
Binary files /dev/null and b/sw-modules/module-package-reader/docs/Circular_Buffer_Animation.gif differ
diff --git a/sw-modules/module-package-reader/docs/MQTTPublishSubscribe.png b/sw-modules/module-package-reader/docs/MQTTPublishSubscribe.png
new file mode 100644
index 0000000..760ea93
Binary files /dev/null and b/sw-modules/module-package-reader/docs/MQTTPublishSubscribe.png differ
diff --git a/sw-modules/module-package-reader/docs/MQTTTopics.png b/sw-modules/module-package-reader/docs/MQTTTopics.png
new file mode 100644
index 0000000..9fe1d44
Binary files /dev/null and b/sw-modules/module-package-reader/docs/MQTTTopics.png differ
diff --git a/sw-modules/module-package-reader/docs/RepoOverview.png b/sw-modules/module-package-reader/docs/RepoOverview.png
new file mode 100644
index 0000000..63b7de0
Binary files /dev/null and b/sw-modules/module-package-reader/docs/RepoOverview.png differ
diff --git a/sw-modules/module-package-reader/docs/_communication_configuration_8h.html b/sw-modules/module-package-reader/docs/_communication_configuration_8h.html
new file mode 100644
index 0000000..c1ff9e5
--- /dev/null
+++ b/sw-modules/module-package-reader/docs/_communication_configuration_8h.html
@@ -0,0 +1,411 @@
+
+
+
+
+
+
+
+MQTT Communication: CommunicationConfiguration.h File Reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
callback (char *topic, byte *payload, unsigned int length)
+
If the client is used to subscribe to topics, a callback function must be provided in the constructor. his function is called when new messages arrive at the client. More...
If the client is used to subscribe to topics, a callback function must be provided in the constructor. his function is called when new messages arrive at the client.
The Connection-class provides the interface. More...
+
+
+
+Functions
+
void
callback (char *topic, byte *payload, unsigned int length)
+
If the client is used to subscribe to topics, a callback function must be provided in the constructor. his function is called when new messages arrive at the client. More...
If the client is used to subscribe to topics, a callback function must be provided in the constructor. his function is called when new messages arrive at the client.
+
Internally, the client uses the same buffer for both inbound and outbound messages. After the callback function returns, or if a call to either publish or subscribe is made from within the callback function, the topic and payload values passed to the function will be overwritten. The application should create its own copy of the values if they are required beyond this.
This Function is global because you need to access it from a diffrent class and pass it as pointer. This would be possible if it's static but then all function which get called in callback need to be static too.
+
Parameters
+
+
topic
- the topic the message arrived on (const char[])
+
payload
- the message payload (byte array)
+
length
- the length of the message payload (unsigned int)
Declares a global Circular Buffer of type myJSONStr with max Elements of MAX_JSON_MESSAGES_SAVED.
+
When declaring your buffer you should specify the data type it must handle and the buffer capacity: those two parameters will influence the memory consumed by the buffer. https://github.com/rlogiacco/CircularBuffer
+
Declares a global Circular Buffer of type myJSONStr with max Elements of MAX_JSON_MESSAGES_SAVED.
Checks if the Board is connected to a newtork and reconects if not
+
Beware though that the default packet size supported by the PubSub client is 128 bytes. You can increase this limit by editing the value lof MQTT_MAX_PACKET_SIZE in PubSubClient.h
The current RSSI /Received Signal Strength in dBm.
+
-30 dBm Maximum signal strength, you are probably standing right next to the access point.
+-50 dBm Anything down to this level can be considered excellent signal strength.
+-60 dBm Good, reliable signal strength.
+-67 dBm Reliable signal strength. The minimum for any service depending on a reliable connection and signal strength, such as voice over Wi-Fi and non-HD video streaming.
+-70 dBm Not a strong signal. Light browsing and email.
+-80 dBm Unreliable signal strength, will not suffice for most services. Connecting to the network.
+-90 dBm The chances of even connecting are very low at this level.
+Source https://eyesaas.com/wi-fi-signal-strength/
Populates myJsonStr from a string. If an error occures, the default myJsonStr is returned. If you change myJsonStr you also need to change this function.
Beware though that the default packet size supported by the PubSub client is 128 bytes. You can increase this limit by editing the value lof MQTT_MAX_PACKET_SIZE in PubSubClient.h
This page explains how to interpret the graphs that are generated by doxygen.
+
Consider the following example:
/*! Invisible class because of truncation */
class Invisible { };
/*! Truncated class, inheritance relation is hidden */
class Truncated : public Invisible { };
/* Class not documented with doxygen comments */
class Undocumented { };
/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };
/*! A template class */
template<class T> class Templ { };
/*! Class that is inherited using protected inheritance */
class ProtectedBase { };
/*! Class that is inherited using private inheritance */
class PrivateBase { };
/*! Class that is used by the Inherited class */
class Used { };
/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,
protected ProtectedBase,
private PrivateBase,
public Undocumented,
public Templ<int>
{
private:
Used *m_usedClass;
};
This will result in the following graph:
+
+
The boxes in the above graph have the following meaning:
+
+
+A filled gray box represents the struct or class for which the graph is generated.
+
+A box with a black border denotes a documented struct or class.
+
+A box with a gray border denotes an undocumented struct or class.
+
+A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
+
+
The arrows have the following meaning:
+
+
+A dark blue arrow is used to visualize a public inheritance relation between two classes.
+
+A dark green arrow is used for protected inheritance.
+
+A dark red arrow is used for private inheritance.
+
+A purple dashed arrow is used if a class is contained or used by another class. The arrow is labelled with the variable(s) through which the pointed class or struct is accessible.
+
+A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labelled with the template parameters of the instance.
+
+
diff --git a/sw-modules/module-package-reader/docs/jquery.js b/sw-modules/module-package-reader/docs/jquery.js
new file mode 100644
index 0000000..1ee895c
--- /dev/null
+++ b/sw-modules/module-package-reader/docs/jquery.js
@@ -0,0 +1,87 @@
+/*!
+ * jQuery JavaScript Library v1.7.2
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Wed Mar 21 12:46:34 2012 -0700
+ */
+(function(bd,L){var av=bd.document,bu=bd.navigator,bm=bd.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bd.jQuery,bH=bd.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b40){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bd.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bd.attachEvent("onload",bF.ready);var b0=false;try{b0=bd.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0!=null&&b0==b0.window},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bd.JSON&&bd.JSON.parse){return bd.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){if(typeof b2!=="string"||!b2){return null}var b0,b1;try{if(bd.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bd.execScript||function(b1){bd["eval"].call(bd,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b40&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b21?aK.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aK.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv
a";bH=bv.getElementsByTagName("*");bE=bv.getElementsByTagName("a")[0];if(!bH||!bH.length||!bE){return{}}bF=av.createElement("select");bx=bF.appendChild(av.createElement("option"));bD=bv.getElementsByTagName("input")[0];bI={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bE.getAttribute("style")),hrefNormalized:(bE.getAttribute("href")==="/a"),opacity:/^0.55/.test(bE.style.opacity),cssFloat:!!bE.style.cssFloat,checkOn:(bD.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true,pixelMargin:true};b.boxModel=bI.boxModel=(av.compatMode==="CSS1Compat");bD.checked=true;bI.noCloneChecked=bD.cloneNode(true).checked;bF.disabled=true;bI.optDisabled=!bx.disabled;try{delete bv.test}catch(bB){bI.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bI.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bD=av.createElement("input");bD.value="t";bD.setAttribute("type","radio");bI.radioValue=bD.value==="t";bD.setAttribute("checked","checked");bD.setAttribute("name","t");bv.appendChild(bD);bC=av.createDocumentFragment();bC.appendChild(bv.lastChild);bI.checkClone=bC.cloneNode(true).cloneNode(true).lastChild.checked;bI.appendChecked=bD.checked;bC.removeChild(bD);bC.appendChild(bv);if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bA="on"+by;bw=(bA in bv);if(!bw){bv.setAttribute(bA,"return;");bw=(typeof bv[bA]==="function")}bI[by+"Bubbles"]=bw}}bC.removeChild(bv);bC=bF=bx=bv=bD=null;b(function(){var bM,bV,bW,bU,bO,bP,bR,bL,bK,bQ,bN,e,bT,bS=av.getElementsByTagName("body")[0];if(!bS){return}bL=1;bT="padding:0;margin:0;border:";bN="position:absolute;top:0;left:0;width:1px;height:1px;";e=bT+"0;visibility:hidden;";bK="style='"+bN+bT+"5px solid #000;";bQ="
MQTT (Message Queuing Telemetry Transport) is a lightweight publish-subscribe messaging protocol and requires a broker to relay the messages. It's used for M2M (machine-to-machine) communication.
+
An MQTT-System always consist of a broker and one or multiple clients, which can be either subscriber or publisher.
A Client can subscribe and publish to one or multiple Topics. Topics are organized in a Tree similar to a Folder-structure in Windows. Here's an example of how such a Topic-Tree and published message can look like:
+
+
This Images also illustrates the scalability of MQTT appropriately.
+
For more Infos about MQTT and MQTT-Topics check out the MQTT-Wiki on Github.
In the myJSONStr.h-File is defined how the JSON-Message and hence the struct looks like.
+
This is how the JSON-Message (received as String) can look like:
{
"id": "hostname",
"topic": "topic/topic",
"status": "driving",
"sector": "transit",
"line": 1,
"ack":"hostname",
"req":"hostname",
"cargo":"beer",
"token":false;
"error":false
}
And the corresponding Struct in which the message gets parsed:
struct myJSONStr {
String id = "hostname";
String topic = "topic/topic";
String status = "driving";
String sector = "transit";
int line = 1;
String ack = "hostname";
String req = "hostname";
String cargo = "beer";
bool token = false;
bool error = false;
};
+
+
FAQ's
+
+
I'd like to use this code in my project. What do I need to know?
+
+
+
All you need to do is add the GitHub-Link to this Repo under lib_deps in your platformio.ini File and you're set up. All dependencies are downloaded automatic.
+
+
+
Where can I change the configurations like MQTT-Broker IP and WLAN-Credentials?
I'd like to change the incoming JSON-Message. How can I do that?
+
+
+
Incoming messages need to be in a know JSON-Format which is defined in* myJSONStr.h* and needs to match the implementation in myJSON::parsingJSONToStruct. If you would like to change this format you need to adapt both files.
+
+
+
ToDo's
+
+
The open ToDo's can be found in the Documentation on the GitHub-Page
+
[ ] Split the Code in 2 Repos: MQTTCommunication-Sortic and MQTTCommunication in order to increase reusability.