aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-03-20 11:13:28 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-03-20 12:19:25 +0100
commit16db388d019dba0dcae16004c5529d5ee0760b3a (patch)
tree0f88a7af9a64a4748442d379a00299c78cef758a
parentce0d90903caa993010d0873d429eec2ffdd63189 (diff)
Use gitbook to manage documentation
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
-rw-r--r--.gitignore4
-rw-r--r--CAN_signaling.doxygen6
-rw-r--r--README.md359
-rw-r--r--book.json93
-rw-r--r--docs/1-Architecture.md25
-rw-r--r--docs/2-Installation.md80
-rw-r--r--docs/3-Usage.md234
-rw-r--r--docs/Doc-Revisions.md6
-rw-r--r--docs/README.md11
-rw-r--r--docs/SUMMARY.md9
-rw-r--r--docs/_layouts/ebook/page.html36
-rw-r--r--docs/_layouts/ebook/pdf_footer.html13
-rw-r--r--docs/_layouts/ebook/pdf_header.html13
-rw-r--r--docs/_layouts/ebook/summary.html58
-rw-r--r--docs/_layouts/layout.html28
-rw-r--r--docs/images/CAN_bindings_communication.pngbin0 -> 43504 bytes
-rw-r--r--docs/images/CAN_level_mapping.pngbin0 -> 56087 bytes
-rw-r--r--docs/images/OpenXC_to_AGL.pngbin0 -> 49910 bytes
-rw-r--r--docs/images/logo_iot_bzh.svg (renamed from images/logo_iot_bzh.svg)0
-rw-r--r--docs/resources/cover.xcfbin0 -> 221522 bytes
-rw-r--r--docs/resources/ebook.css382
-rw-r--r--docs/resources/iotbzh_logo.pngbin0 -> 129625 bytes
-rw-r--r--docs/resources/iotbzh_logo_small.pngbin0 -> 6989 bytes
-rw-r--r--images/CAN_bindings_communication.pngbin48050 -> 0 bytes
-rw-r--r--images/CAN_level_mapping.pngbin98955 -> 0 bytes
-rw-r--r--images/OpenXC_to_AGL.pngbin54146 -> 0 bytes
26 files changed, 1000 insertions, 357 deletions
diff --git a/.gitignore b/.gitignore
index 7ac99370..c2230740 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,4 +10,6 @@
obj
build
bin
-docs
+docs_doxygen
+node_modules/
+_book/
diff --git a/CAN_signaling.doxygen b/CAN_signaling.doxygen
index 39d182e4..cf57f8b0 100644
--- a/CAN_signaling.doxygen
+++ b/CAN_signaling.doxygen
@@ -58,7 +58,7 @@ PROJECT_BRIEF = "AGL binding to manage CAN bus communication"
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = docs
+OUTPUT_DIRECTORY = docs_doxygen
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
@@ -1111,7 +1111,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -2167,7 +2167,7 @@ DOT_FONTSIZE = 10
# the path where dot can find it using this tag.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_FONTPATH =
+DOT_FONTPATH =
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
# each documented class showing the direct and indirect inheritance relations.
diff --git a/README.md b/README.md
index 3481a449..f3463272 100644
--- a/README.md
+++ b/README.md
@@ -1,358 +1,11 @@
# Low level CAN signaling binder
-## Abstract
-
Low level CAN bus binder, based upon OpenXC vi-firmware project.
-Purpose of this project is to offer a low level binding to an AGL platform, idea remains the same than OpenXC project.
-
-It's meant to generate from a JSON file describing CAN messages and diagnostic message (OBD2 for now), a cpp file to integrate with the project.
-
-Once generated binding is built with it and result will be a widget file to install on an AGL target system.
-
-![OpenXC_to_AGL][OpenXC_to_AGL]
-
-## AGL CAN binding architecture proposal
-
-Bring CAN management into the AGL project is more than allowing decode and print CAN messages, lot of tools can do that (Wireshark, CAN-utils, ...).
-
-The goal is to provide a common API and abstraction to the CAN bus then you can bring some more high level functionnalities to the system.
-
-CAN binding will be separated in two parts:
-
-![CAN_mapping][CAN_mapping]
-
-- High level: Binding from which others applications will connect to.
-It will provides valuable access to the CAN bus by aggregate signals or providing new signals from several originals. For example, a signal exposing whether or not a door is open, no matter which one it is. Also, we can imagine an application which supervise if there is no one in the car but moving (1m, 2m ?) to alert the owner of an unexpected behavior. The high level binding will sends a single event representing that behavior to the application which in turn will send a phone message to.
-
-- Low level: Decode messages that transit and send event through **Application Framework** to the subscribers with human readable message. It provides some basic access to the bus + some basic mathematical, statistical features (last_values, min, max, timestamps, averaging) as well as basic filter to get discerning signal only (This part are not implemented yet in the low level).
-
-
-![Binding_architecture][CAN_bindings_communication]
-
-Last be not least, the low level binding can be shipped as binary only using OpenXC inspired [generator][generator].
-
-# Prerequirements
-
-- An AGL system installed with a Chinook version.
-
-- Make sure you built the AGL generator else you will not be able to generate custom low-level CAN binding. Generator can be found [here][generator] with the attached instruction to install and run it. It will produce a *configuration-generated.cpp* file to paste in the source, *src/*, directory.
-
-- Make sure you already set up the AGL SDK using the following [guide][SDK_instructions].
-
-To get the correct SDK version installed, you **must** prepare your environment with the **chinook-next** version. To do so, run the following command in your docker image:
-
-```bash
-$ prepare_meta -f chinook-next -o /xdt -l /home/devel/mirror -p /home/devel/share/proprietary-renesas-rcar/ -t porter -e wipeconfig -e rm_work
-```
-
-- Check that you updated git submodules, executing the following commands from this repository:
-
-```bash
-$ git submodule init
-$ git submodule update
-```
-
-- An [USB CAN adapter][USB_CAN] connected to OBD2 connector through the [right cable][OBD2_cable].
-
-# Getting started
-
-## Compile and install the binding
-
-With an AGL SDK environment correctly configured, I suggest you to set the TARGET variable in the root CMakeLists.txt file, if you have an AGL target already running in your network.
-
-Then you can directly build and install the binding and source directory on your target system.
-
-Execute these commands to get your binding compile :
-
-```bash
-$ mkdir build
-$ cd build
-$ cmake ..
-$ make
+Full document can be found under `docs` directory.
+Note that your can use gitbook to serve documentation:
```
-
-And if you have set TARGET variable, you can install it on your AGL system :
-
-```bash
-$ make install
-[ 16%] Built target bitfield
-[ 27%] Built target isotp
-[ 40%] Built target openxc
-[ 48%] Built target uds
-[ 97%] Built target low-can-binding
-[100%] Built target widget
-Install the project...
--- Install configuration: ""
-true
-{ "added": "low-can-binding@0.1" }
-```
-
-It's possible that you'll see the following message :
-
-```bash
-Error org.freedesktop.DBus.Error.Failed: "system error"
-```
-
-It's because installation remove the binding before installing it.
-
-If it is the first time that you make the installation then you'll have this message in place of ***true***.
-
-To install it manually, you need to copy the *low-can-binding.wgt* file on your target, then from it execute the following commands :
-
-On your host, to copy over the network :
-
-```bash
-$ scp low-can-binding.wgt root@<target_IP>:~
-```
-
-On the target, assuming ***wgt*** file is in the root home directory :
-
-```bash
-~# afm-util install low-can-binding.wgt
-{ "added": "low-can-binding@0.1" }
-```
-## Install AFB Websocket CLI client to test the binding.
-
-You can test it using afb-client-demo CLI tool provided by the RPM package *libafbwsc-dev*.
-
-You can find this package in your build environment, using docker SDK recommended setup the file is */xdt/build/tmp/deploy/rpm/<your-target-arch>/*.
-
-After a successful bitbake build and using Renesas RCar Gen2, Porter, you have to copy the file if your board is connected to your network and you know its IP address:
-
-```bash
-$ scp /xdt/build/tmp/deploy/rpm/cortex15hf_neon/libafbwsc-dev-1.0-r0.cortexa15hf_neon.rpm root@<target_IP>:~
-```
-
-Else, you have to copy into the SDcard with the AGL image installed on it.
-
-From the docker image copy RPM to the shared directory between docker image and your host:
-
-```bash
-$ cp /xdt/build/tmp/deploy/rpm/cortex15hf_neon/libafbwsc-dev-1.0-r0.cortexa15hf_neon.rpm ~/share
-```
-
-Then plugin you SDcard in your Linux host (Windows can't read ext4 filesystem AGL runs on) and copy RPM file on it.
-
-From your host, identify SDcard block device node here it is **sdc** with the correct capacity automounted by the desktop manager:
-
-```bash
-$ lsblk
-loop1 7:1 0 2G 0 loop
-└─docker-253:0-3146365-pool 253:3 0 100G 0 dm
- └─docker-253:0-3146365-e9f80849a2681e18549d3a4238cbf031e44052e36cd88a0abf041804b799b61c
- 253:4 0 10G 0 dm /var/lib/docker/devicemapper/mnt/e9f80849a2681e18549d3a4238cbf031e44052e36cd88a0abf041804b799b61c
-sdb 8:16 0 238.5G 0 disk
-├─sdb2 8:18 0 238G 0 part
-│ └─Shamash-agl 253:1 0 238G 0 lvm /home/claneys/Workspace/agl-docker
-└─sdb1 8:17 0 500M 0 part /boot
-sr0 11:0 1 1024M 0 rom
-loop0 7:0 0 100G 0 loop
-└─docker-253:0-3146365-pool 253:3 0 100G 0 dm
- └─docker-253:0-3146365-e9f80849a2681e18549d3a4238cbf031e44052e36cd88a0abf041804b799b61c
- 253:4 0 10G 0 dm /var/lib/docker/devicemapper/mnt/e9f80849a2681e18549d3a4238cbf031e44052e36cd88a0abf041804b799b61c
-sdc 8:32 1 14.9G 0 disk
-└─sdc1 8:33 1 2G 0 part /run/media/claneys/97f418a5-612f-44e9-b968-a19505695151
-sda 8:0 0 931.5G 0 disk
-├─sda2 8:2 0 500G 0 part
-│ ├─Shamash-home 253:2 0 150G 0 lvm /home
-│ └─Shamash-root 253:0 0 50G 0 lvm /
-└─sda1 8:1 0 16G 0 part [SWAP]
-```
-
-Copy, still from your host:
-
-> **Caution** Make sure to sync IO with sync command before unplug your SDcard. It could be corrupted if removed before all pending IO aren't done.
-
-```bash
-$ sudo cp ~/devel/docker/share/libafbwsc-dev-1.0-r0.cortexa15hf_neon.rpm /run/media/claneys/97f418a5-612f-44e9-b968-a19505695151/home/root
-$ sync
-```
-
-Insert the modified SDcard in your Porter board and boot from it. You are ready to go.
-
-## Configure the AGL system
-
-### Virtual CAN device
-
- Connected to the target, here is how to load the virtual CAN device driver and set up a new vcan device :
-
-```bash
-# modprobe vcan
-# ip link add vcan0 type vcan
-# ip link set vcan0 up
- ```
-
-### CAN device using the USB CAN adapter
-
-Using real connection to CAN bus of your car using the USB CAN adapter connected to the OBD2 connector.
-
-Once connected, launch ```dmesg``` command and search which device to use :
-
-```bash
-# dmesg
-[...]
-[ 131.871441] usb 1-3: new full-speed USB device number 4 using ohci-pci
-[ 161.860504] can: controller area network core (rev 20120528 abi 9)
-[ 161.860522] NET: Registered protocol family 29
-[ 177.561620] usb 1-3: USB disconnect, device number 4
-[ 191.061423] usb 1-2: USB disconnect, device number 3
-[ 196.095325] usb 1-2: new full-speed USB device number 5 using ohci-pci
-[ 327.568882] usb 1-2: USB disconnect, device number 5
-[ 428.594177] CAN device driver interface
-[ 1872.551543] usb 1-2: new full-speed USB device number 6 using ohci-pci
-[ 1872.809302] usb_8dev 1-2:1.0 can0: firmware: 1.7, hardware: 1.0
-[ 1872.809356] usbcore: registered new interface driver usb_8dev
-```
-
-Here device is named **can0**.
-
-This instruction assuming a speed of 500000kbps for your CAN bus, you can try others supported bitrate like 125000, 250000 if 500000 doesn't work:
-
-```bash
-# ip link set can0 type can bitrate 500000
-# ip link set can0 up
-# ip link show can0
- can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN qlen 10
- link/can
- can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
- bitrate 500000 sample-point 0.875
- tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
- sja1000: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
- clock 16000000
-```
-
-## Configure the binding
-
-Configure the binding specifying in the JSON configuration file the CAN device(s) that it will to connect to. Edit file */var/lib/afm/applications/low-can-binding/0.1/can_buses.json* and change the CAN device name to the one you have :
-
-```json
-{
- "canbus": "can0"
-}
-```
-
-If you have several specify CAN bus devices use an array:
-
-```json
-{
- "canbus": [ "vcan0", "can0" ]
-}
-```
-
-> **WARNING** Make sure the CAN bus(es) you specify in your configuration file match those specified in your generated source file with the [can-config-generator][generator].
-
-## Run it, test it, use it !
-
-You can run the binding using **afm-util** tool, here is the classic way to go :
-
-```bash
-# afm-util run low-can-binding@0.1
-1
-```
-
-You can find instructions to use afm-util tool [here][afm-util], as well as documentation about Application Framework.
-
-But you can't control nor interact with it because you don't know security token that **Application Framework** gaves it at launch.
-
-So, to test it, it is better to launch the binding manually. In the following example, we will use port **1234** and left empty security token for testing purpose:
-
-```bash
-# afb-daemon --ldpaths=/usr/lib/afb:/var/lib/afm/applications/low-can-binding/0.1/libs/ --rootdir=/var/lib/afm/applications/low-can-binding/0.1/ --port=1234 --token=
-NOTICE: binding [/usr/lib/afb/afb-dbus-binding.so] calling registering function afbBindingV1Register
-NOTICE: binding /usr/lib/afb/afb-dbus-binding.so loaded with API prefix dbus
-NOTICE: binding [/usr/lib/afb/authLogin.so] calling registering function afbBindingV1Register
-NOTICE: binding /usr/lib/afb/authLogin.so loaded with API prefix auth
-NOTICE: binding [/var/lib/afm/applications/low-can-binding/0.1/libs//low-can-binding.so] calling registering function afbBindingV1Register
-NOTICE: binding /var/lib/afm/applications/low-can-binding/0.1/libs//low-can-binding.so loaded with API prefix low-can
-NOTICE: Waiting port=1234 rootdir=/var/lib/afm/applications/low-can-binding/0.1/
-NOTICE: Browser URL= http:/*localhost:1234
-NOTICE: vcan0 device opened and reading {binding low-can}
-NOTICE: Initialized 1/1 can bus device(s) {binding low-can}
-```
-
-Then connect to the binding using previously installed ***AFB Websocket CLI*** tool :
-
-```bash
-# afb-client-demo ws://localhost:1234/api?token=
-```
-
-You will be on an interactive session where you can communicate directly with the binding API.
-
-The binding provides at this moment 2 verbs, *subscribe* and *unsubscribe*, which can take argument by a JSON **event** object.
-
-The argument value is the CAN message **generic_name** as described in the JSON file used to generate cpp file for the binding.
-
-To use the ***AFB Websocket CLI*** tool, a command line will be like the following :
-
-```
-<api> <verb> <arguments>
-```
-
-Where:
-
-- API : ***low-can***.
-- Verb : ***subscribe*** or ***unsubscribe***
-- Arguments : ***{ "event": "driver.doors.open" }***
-
-### Subscription and unsubscription
-
-You can ask to subscribe to chosen CAN event with a call to *subscribe* API verb with the CAN messages name as JSON argument.
-
-> **Note** If no argument is provided, then you'll subscribe to all signals at once.
-
-For example from a websocket session:
-
-```json
-low-can subscribe { "event": "doors.driver.open" }
-ON-REPLY 1:low-can/subscribe: {"jtype":"afb-reply","request":{"status":"success","uuid":"a18fd375-b6fa-4c0e-a1d4-9d3955975ae8"}}
-```
-
-Subscription and unsubscription can take wildcard in their *event* value.
-
-To reveive all doors events :
-
-```json
-low-can subscribe { "event" : "doors*" }
-ON-REPLY 1:low-can/subscribe: {"jtype":"afb-reply","request":{"status":"success","uuid":"511c872e-d7f3-4f3b-89c2-aa9a3e9fbbdb"}}
-```
-
-Then you will receive an event each time a CAN message is decoded for the event named *doors.driver.open*
-
-```json
-ON-EVENT low-can/messages.doors.driver.open({"event":"low-can\/messages.doors.driver.open","data":{"name":"messages.doors.driver.open","value":true},"jtype":"afb-event"})
-```
-
-Notice that event shows you that the CAN event is named *messages.doors.driver.open* but you ask for event about *doors.driver.open*.
-
-This is because all CAN messages or diagnostic messages are prefixed by the JSON parent node name, **messages** for CAN messages and **diagnostic_messages** for diagnostic messages like OBD2.
-
-This will let you subscribe or unsubcribe to all signals at once, not recommended, and better make filter on subscribe operation based upon their type. Examples:
-
-```json
-low-can subscribe { "event" : "*speed*" } --> will subscribe to all messages with speed in their name. Search will be make without prefix for it.
-low-can subscribe { "event" : "speed*" } --> will subscribe to all messages begin by speed in their name. Search will be make without prefix for it.
-low-can subscribe { "event" : "messages*speed*" } --> will subscribe to all CAN messages with speed in their name. Search will be on prefixed messages here.
-low-can subscribe { "event" : "messages*speed" } --> will subscribe to all CAN messages ending with speed in their name. Search will be on prefixed messages here.
-low-can subscribe { "event" : "diagnostic*speed*" } --> will subscribe to all diagnostic messages with speed in their name. Search will be on prefixed messages here.
-low-can subscribe { "event" : "diagnostic*speed" } --> will subscribe to all diagnostic messages ending with speed in their name. Search will be on prefixed messages here.
-```
-
-You can stop receiving event from it by unsubscribe the signal the same way you did for subscribe
-
-```json
-low-can unsubscribe { "event": "doors.driver.open" }
-ON-REPLY 2:low-can/unsubscribe: {"jtype":"afb-reply","request":{"status":"success"}}
-low-can unsubscribe { "event" : "doors*" }
-ON-REPLY 3:low-can/unsubscribe: {"jtype":"afb-reply","request":{"status":"success"}}
-```
-
-[OpenXC_to_AGL]: images/OpenXC_to_AGL.png "From OpenXC firmware to AGL binding"
-[CAN_bindings_communication]: images/CAN_bindings_communication.png "Communication between CAN bindings and third applications"
-[CAN_mapping]: images/CAN_level_mapping.png "CAN low and high level bindings mapping"
-
-[USB_CAN]: http://shop.8devices.com/usb2can "USB CAN adapter recommended"
-[OBD2_cable]: http://www.obd2cables.com/ "OBD2<->DB9 recommended cable"
-[SDK_instructions]: http://docs.iot.bzh/docs/getting_started/en/dev/reference/setup-sdk-environment.html "Setup SDK environment"
-[generator]: http://github.com/iotbzh/can-config-generator "AGL low level CAN binding Generator"
-[afm-util]: http://docs.iot.bzh/docs/apis_services/en/dev/reference/af-main/afm-daemons.html#using-afm-util "afm-util usage" \ No newline at end of file
+mkdir build && cd build
+cmake ..
+make serve-docs
+``` \ No newline at end of file
diff --git a/book.json b/book.json
new file mode 100644
index 00000000..b22e42fa
--- /dev/null
+++ b/book.json
@@ -0,0 +1,93 @@
+{
+ "title": "Low Level CAN Binding Guide",
+ "description": "Low level CAN bus binder, based upon OpenXC vi-firmware project.",
+ "keywords": "AGL, Development, CAN, binder, OpenXC",
+ "author": "IoT.Bzh Team",
+ "website": "http://iot.bzh",
+ "published": "March 2017",
+ "version": "1.0",
+
+ "gitbook": "3.2.2",
+ "root": "docs",
+ "pdf": {
+ "fontFamily": "Verdana",
+ "fontSize": 12,
+ "paperSize": "a4"
+ },
+ "styles": {
+ "website": "resources/ebook.css",
+ "ebook": "resources/ebook.css",
+ "pdf": "resources/ebook.css"
+ },
+
+ "hidepageheaders": [2, 3],
+ "hidepagefooters": [2, 3],
+
+ "plugins": [
+ "regexplace",
+ "richquotes"
+ ],
+ "pluginsConfig": {
+ "regexplace": {
+ "removeFirstPartsInSectionNumber": true,
+ "substitutes": [{
+ "pattern": "<!-- pagebreak -->",
+ "flags": "g",
+ "substitute": "<div class=\"page-break\"></div>"
+ },
+ {
+ "pattern": "<!-- clear -->",
+ "flags": "g",
+ "substitute": "<div class=\"clear\"></div>"
+ },
+ {
+ "pattern": "<!-- nopagebreak -->",
+ "flags": "g",
+ "substitute": "<div class=\"nopb\">"
+ },
+ {
+ "pattern": "<!-- endnopagebreak -->",
+ "flags": "g",
+ "substitute": "</div>"
+ },
+ {
+ "pattern": "<!-- note -->",
+ "flags": "g",
+ "substitute": "<div class=\"note\">"
+ },
+ {
+ "pattern": "<!-- endnote -->",
+ "flags": "g",
+ "substitute": "</div>"
+ },
+ {
+ "pattern": "!\\[(.*?)\\]\\((.*?)(?:\\s+\"(.*)\")?\\){0,}{caption=1([^\\}]*)}",
+ "flags": "gmi",
+ "substitute": "<figure id=\"fig_PAGE_LEVEL_._INDEX_\"><img $3 alt=\"$1\" title=\"$1\" href=\"$2\"><figcaption></figcaption></figure>",
+ "decode": true
+ },
+ {
+ "pattern": "<img ([^>]*) {0,}\/{0,}> {0,}{caption=1([^\\}]*)}",
+ "flags": "g",
+ "substitute": "<figure id=\"fig_PAGE_LEVEL_._INDEX_\"><img $2 $1><figcaption></figcaption></figure>",
+ "decode": true
+ },
+ {
+ "pattern": "<img (.*)alt=\"([^\"]*)\"(.*) {0,1}\/{0,1}><figcaption></figcaption>",
+ "flags": "g",
+ "substitute": "<img$1alt=\"$2\"$3><figcaption><span>Picture _PAGE_LEVEL_._INDEX_</span>: $2</figcaption>",
+ "store": {
+ "substitute": "<a href=\"_PAGE_PATH_#fig_PAGE_LEVEL_._INDEX_\">Pic. _PAGE_LEVEL_._INDEX_</a> <span>$2</span>",
+ "variable_name": "pictures"
+ }
+ },
+ {
+ "pattern": "<img ([^>]*)> {0,}{style {1,}([^}]*)}",
+ "flags": "g",
+ "substitute": "<img $1 style=\"$2\">",
+ "decode": true
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/docs/1-Architecture.md b/docs/1-Architecture.md
new file mode 100644
index 00000000..50cf1f1e
--- /dev/null
+++ b/docs/1-Architecture.md
@@ -0,0 +1,25 @@
+# AGL CAN binding architecture proposal
+
+It's meant to generate from a JSON file describing CAN messages and diagnostic message \(OBD2 for now\), a cpp file to integrate with the project.
+
+Once generated binding is built with it and result will be a widget file to install on an AGL target system.
+
+![From OpenXC firmware to AGL binding](images/OpenXC_to_AGL.png)
+
+Bringing CAN management into the AGL project is more than allowing decode and print CAN messages, lot of tools can do that (Wireshark, CAN-utils, ...).
+
+The goal is to provide a common API and abstraction to the CAN bus then you can bring some more high level functionalities to the system.
+
+CAN binding will be separated in two parts:
+
+![CAN low and high level bindings mapping](images/CAN_level_mapping.png)
+
+- High level: Binding from which others applications will connect to.
+It will provides valuable access to the CAN bus by aggregate signals or providing new signals from several originals. For example, a signal exposing whether or not a door is open, no matter which one it is. Also, we can imagine an application which supervise if there is no one in the car but moving (1m, 2m ?) to alert the owner of an unexpected behavior. The high level binding will sends a single event representing that behavior to the application which in turn will send a phone message to.
+
+- Low level: Decode messages that transit and send event through **Application Framework** to the subscribers with human readable message. It provides some basic access to the bus + some basic mathematical, statistical features (last_values, min, max, timestamps, averaging) as well as basic filter to get discerning signal only (This part are not implemented yet in the low level).
+
+
+![Communication between CAN bindings and third applications](images/CAN_bindings_communication.png)
+
+Last be not least, the low level binding can be shipped as binary only using OpenXC inspired [AGL low level CAN binding Generator](http://github.com/iotbzh/can-config-generator).
diff --git a/docs/2-Installation.md b/docs/2-Installation.md
new file mode 100644
index 00000000..b3ac04a6
--- /dev/null
+++ b/docs/2-Installation.md
@@ -0,0 +1,80 @@
+# Prerequisites
+
+- An AGL system installed with a Chinook version.
+
+- Make sure you built the AGL generator else you will not be able to generate custom low-level CAN binding. Generator can be found [here](http://github.com/iotbzh/can-config-generator) with the attached instruction to install and run it. It will produce a *configuration-generated.cpp* file to paste in the source, *src/*, directory.
+
+- Make sure you already set up the AGL SDK using the following [guide](http://docs.iot.bzh/docs/getting_started/en/dev/reference/setup-sdk-environment.html).
+
+To get the correct SDK version installed, you **must** prepare your environment with the **chinook-next** version. To do so, run the following command in your docker image:
+
+```bash
+$ prepare_meta -f chinook-next -o /xdt -l /home/devel/mirror -p /home/devel/share/proprietary-renesas-rcar/ -t porter -e wipeconfig -e rm_work
+```
+
+- Check that you updated git submodules, executing the following commands from this repository:
+
+```bash
+$ git submodule init
+$ git submodule update
+```
+
+- An [USB CAN adapter](http://shop.8devices.com/usb2can) connected to OBD2 connector through the [right cable](http://www.obd2cables.com/).
+
+# Getting started
+
+## Compile and install the binding
+
+With an AGL SDK environment correctly configured, I suggest you to set the TARGET variable in the root CMakeLists.txt file, if you have an AGL target already running in your network.
+
+Then you can directly build and install the binding and source directory on your target system.
+
+Execute these commands to get your binding compile :
+
+```bash
+$ mkdir build
+$ cd build
+$ cmake ..
+$ make
+```
+
+And if you have set TARGET variable, you can install it on your AGL system :
+
+```bash
+$ make install
+[ 16%] Built target bitfield
+[ 27%] Built target isotp
+[ 40%] Built target openxc
+[ 48%] Built target uds
+[ 97%] Built target low-can-binding
+[100%] Built target widget
+Install the project...
+-- Install configuration: ""
+true
+{ "added": "low-can-binding@0.1" }
+```
+
+It's possible that you'll see the following message :
+
+```bash
+Error org.freedesktop.DBus.Error.Failed: "system error"
+```
+
+It's because installation remove the binding before installing it.
+
+If it is the first time that you make the installation then you'll have this message in place of ***true***.
+
+To install it manually, you need to copy the *low-can-binding.wgt* file on your target, then from it execute the following commands :
+
+On your host, to copy over the network :
+
+```bash
+$ scp low-can-binding.wgt root@<target_IP>:~
+```
+
+On the target, assuming ***wgt*** file is in the root home directory :
+
+```bash
+~# afm-util install low-can-binding.wgt
+{ "added": "low-can-binding@0.1" }
+```
diff --git a/docs/3-Usage.md b/docs/3-Usage.md
new file mode 100644
index 00000000..bee088e3
--- /dev/null
+++ b/docs/3-Usage.md
@@ -0,0 +1,234 @@
+# Install AFB Websocket CLI client to test the binding.
+
+You can test it using afb-client-demo CLI tool provided by the RPM package *libafbwsc-dev*.
+
+You can find this package in your build environment, using docker SDK recommended setup the file is `/xdt/build/tmp/deploy/rpm/<your-target-arch>/`.
+
+After a successful bitbake build and using Renesas RCar Gen2, Porter, you have to copy the file if your board is connected to your network and you know its IP address:
+
+```bash
+$ scp /xdt/build/tmp/deploy/rpm/cortex15hf_neon/libafbwsc-dev-1.0-r0.cortexa15hf_neon.rpm root@<target_IP>:~
+```
+
+Else, you have to copy into the SDcard with the AGL image installed on it.
+
+From the docker image copy RPM to the shared directory between docker image and your host:
+
+```bash
+$ cp /xdt/build/tmp/deploy/rpm/cortex15hf_neon/libafbwsc-dev-1.0-r0.cortexa15hf_neon.rpm ~/share
+```
+
+Then plugin you SDcard in your Linux host (Windows can't read ext4 filesystem AGL runs on) and copy RPM file on it.
+
+From your host, identify SDcard block device node here it is **sdc** with the correct capacity automounted by the desktop manager:
+
+```bash
+$ lsblk
+loop1 7:1 0 2G 0 loop
+└─docker-253:0-3146365-pool 253:3 0 100G 0 dm
+ └─docker-253:0-3146365-e9f80849a2681e18549d3a4238cbf031e44052e36cd88a0abf041804b799b61c
+ 253:4 0 10G 0 dm /var/lib/docker/devicemapper/mnt/e9f80849a2681e18549d3a4238cbf031e44052e36cd88a0abf041804b799b61c
+sdb 8:16 0 238.5G 0 disk
+├─sdb2 8:18 0 238G 0 part
+│ └─Shamash-agl 253:1 0 238G 0 lvm /home/claneys/Workspace/agl-docker
+└─sdb1 8:17 0 500M 0 part /boot
+sr0 11:0 1 1024M 0 rom
+loop0 7:0 0 100G 0 loop
+└─docker-253:0-3146365-pool 253:3 0 100G 0 dm
+ └─docker-253:0-3146365-e9f80849a2681e18549d3a4238cbf031e44052e36cd88a0abf041804b799b61c
+ 253:4 0 10G 0 dm /var/lib/docker/devicemapper/mnt/e9f80849a2681e18549d3a4238cbf031e44052e36cd88a0abf041804b799b61c
+sdc 8:32 1 14.9G 0 disk
+└─sdc1 8:33 1 2G 0 part /run/media/claneys/97f418a5-612f-44e9-b968-a19505695151
+sda 8:0 0 931.5G 0 disk
+├─sda2 8:2 0 500G 0 part
+│ ├─Shamash-home 253:2 0 150G 0 lvm /home
+│ └─Shamash-root 253:0 0 50G 0 lvm /
+└─sda1 8:1 0 16G 0 part [SWAP]
+```
+
+Copy, still from your host:
+
+> **CAUTION** Make sure to sync IO with sync command before unplug your SDcard. It could be corrupted if removed before all pending IO aren't done.
+
+```bash
+$ sudo cp ~/devel/docker/share/libafbwsc-dev-1.0-r0.cortexa15hf_neon.rpm /run/media/claneys/97f418a5-612f-44e9-b968-a19505695151/home/root
+$ sync
+```
+
+Insert the modified SDcard in your Porter board and boot from it. You are ready to go.
+
+## Configure the AGL system
+
+### Virtual CAN device
+
+ Connected to the target, here is how to load the virtual CAN device driver and set up a new vcan device :
+
+```bash
+# modprobe vcan
+# ip link add vcan0 type vcan
+# ip link set vcan0 up
+ ```
+
+### CAN device using the USB CAN adapter
+
+Using real connection to CAN bus of your car using the USB CAN adapter connected to the OBD2 connector.
+
+Once connected, launch ```dmesg``` command and search which device to use :
+
+```bash
+# dmesg
+[...]
+[ 131.871441] usb 1-3: new full-speed USB device number 4 using ohci-pci
+[ 161.860504] can: controller area network core (rev 20120528 abi 9)
+[ 161.860522] NET: Registered protocol family 29
+[ 177.561620] usb 1-3: USB disconnect, device number 4
+[ 191.061423] usb 1-2: USB disconnect, device number 3
+[ 196.095325] usb 1-2: new full-speed USB device number 5 using ohci-pci
+[ 327.568882] usb 1-2: USB disconnect, device number 5
+[ 428.594177] CAN device driver interface
+[ 1872.551543] usb 1-2: new full-speed USB device number 6 using ohci-pci
+[ 1872.809302] usb_8dev 1-2:1.0 can0: firmware: 1.7, hardware: 1.0
+[ 1872.809356] usbcore: registered new interface driver usb_8dev
+```
+
+Here device is named **can0**.
+
+This instruction assuming a speed of 500000kbps for your CAN bus, you can try others supported bitrate like 125000, 250000 if 500000 doesn't work:
+
+```bash
+# ip link set can0 type can bitrate 500000
+# ip link set can0 up
+# ip link show can0
+ can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN qlen 10
+ link/can
+ can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
+ bitrate 500000 sample-point 0.875
+ tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
+ sja1000: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
+ clock 16000000
+```
+
+## Configure the binding
+
+Configure the binding specifying in the JSON configuration file the CAN device(s) that it will to connect to. Edit file */var/lib/afm/applications/low-can-binding/0.1/can_buses.json* and change the CAN device name to the one you have :
+
+```json
+{
+ "canbus": "can0"
+}
+```
+
+If you have several specify CAN bus devices use an array:
+
+```json
+{
+ "canbus": [ "vcan0", "can0" ]
+}
+```
+
+> **WARNING** Make sure the CAN bus(es) you specify in your configuration file match those specified in your generated source file with the [can-config-generator](http://github.com/iotbzh/can-config-generator).
+
+## Run it, test it, use it !
+
+You can run the binding using **afm-util** tool, here is the classic way to go :
+
+```bash
+# afm-util run low-can-binding@0.1
+1
+```
+
+You can find instructions to use afm-util tool [here](http://docs.iot.bzh/docs/apis_services/en/dev/reference/af-main/afm-daemons.html#using-afm-util), as well as documentation about Application Framework.
+
+But you can't control nor interact with it because you don't know security token that **Application Framework** gaves it at launch.
+
+So, to test it, it is better to launch the binding manually. In the following example, we will use port **1234** and left empty security token for testing purpose:
+
+```bash
+# afb-daemon --ldpaths=/usr/lib/afb:/var/lib/afm/applications/low-can-binding/0.1/libs/ --rootdir=/var/lib/afm/applications/low-can-binding/0.1/ --port=1234 --token=
+NOTICE: binding [/usr/lib/afb/afb-dbus-binding.so] calling registering function afbBindingV1Register
+NOTICE: binding /usr/lib/afb/afb-dbus-binding.so loaded with API prefix dbus
+NOTICE: binding [/usr/lib/afb/authLogin.so] calling registering function afbBindingV1Register
+NOTICE: binding /usr/lib/afb/authLogin.so loaded with API prefix auth
+NOTICE: binding [/var/lib/afm/applications/low-can-binding/0.1/libs//low-can-binding.so] calling registering function afbBindingV1Register
+NOTICE: binding /var/lib/afm/applications/low-can-binding/0.1/libs//low-can-binding.so loaded with API prefix low-can
+NOTICE: Waiting port=1234 rootdir=/var/lib/afm/applications/low-can-binding/0.1/
+NOTICE: Browser URL= http:/*localhost:1234
+NOTICE: vcan0 device opened and reading {binding low-can}
+NOTICE: Initialized 1/1 can bus device(s) {binding low-can}
+```
+
+Then connect to the binding using previously installed ***AFB Websocket CLI*** tool :
+
+```bash
+# afb-client-demo ws://localhost:1234/api?token=
+```
+
+You will be on an interactive session where you can communicate directly with the binding API.
+
+The binding provides at this moment 2 verbs, *subscribe* and *unsubscribe*, which can take argument by a JSON **event** object.
+
+The argument value is the CAN message **generic_name** as described in the JSON file used to generate cpp file for the binding.
+
+To use the ***AFB Websocket CLI*** tool, a command line will be like the following :
+
+```
+<api> <verb> <arguments>
+```
+
+Where:
+
+- API : ***low-can***.
+- Verb : ***subscribe*** or ***unsubscribe***
+- Arguments : ***{ "event": "driver.doors.open" }***
+
+### Subscription and unsubscription
+
+You can ask to subscribe to chosen CAN event with a call to *subscribe* API verb with the CAN messages name as JSON argument.
+
+> **Note** If no argument is provided, then you'll subscribe to all signals at once.
+
+For example from a websocket session:
+
+```json
+low-can subscribe { "event": "doors.driver.open" }
+ON-REPLY 1:low-can/subscribe: {"jtype":"afb-reply","request":{"status":"success","uuid":"a18fd375-b6fa-4c0e-a1d4-9d3955975ae8"}}
+```
+
+Subscription and unsubscription can take wildcard in their *event* value.
+
+To reveive all doors events :
+
+```json
+low-can subscribe { "event" : "doors*" }
+ON-REPLY 1:low-can/subscribe: {"jtype":"afb-reply","request":{"status":"success","uuid":"511c872e-d7f3-4f3b-89c2-aa9a3e9fbbdb"}}
+```
+
+Then you will receive an event each time a CAN message is decoded for the event named *doors.driver.open*
+
+```json
+ON-EVENT low-can/messages.doors.driver.open({"event":"low-can\/messages.doors.driver.open","data":{"name":"messages.doors.driver.open","value":true},"jtype":"afb-event"})
+```
+
+Notice that event shows you that the CAN event is named *messages.doors.driver.open* but you ask for event about *doors.driver.open*.
+
+This is because all CAN messages or diagnostic messages are prefixed by the JSON parent node name, **messages** for CAN messages and **diagnostic_messages** for diagnostic messages like OBD2.
+
+This will let you subscribe or unsubcribe to all signals at once, not recommended, and better make filter on subscribe operation based upon their type. Examples:
+
+```json
+low-can subscribe { "event" : "*speed*" } --> will subscribe to all messages with speed in their name. Search will be make without prefix for it.
+low-can subscribe { "event" : "speed*" } --> will subscribe to all messages begin by speed in their name. Search will be make without prefix for it.
+low-can subscribe { "event" : "messages*speed*" } --> will subscribe to all CAN messages with speed in their name. Search will be on prefixed messages here.
+low-can subscribe { "event" : "messages*speed" } --> will subscribe to all CAN messages ending with speed in their name. Search will be on prefixed messages here.
+low-can subscribe { "event" : "diagnostic*speed*" } --> will subscribe to all diagnostic messages with speed in their name. Search will be on prefixed messages here.
+low-can subscribe { "event" : "diagnostic*speed" } --> will subscribe to all diagnostic messages ending with speed in their name. Search will be on prefixed messages here.
+```
+
+You can stop receiving event from it by unsubscribe the signal the same way you did for subscribe
+
+```json
+low-can unsubscribe { "event": "doors.driver.open" }
+ON-REPLY 2:low-can/unsubscribe: {"jtype":"afb-reply","request":{"status":"success"}}
+low-can unsubscribe { "event" : "doors*" }
+ON-REPLY 3:low-can/unsubscribe: {"jtype":"afb-reply","request":{"status":"success"}}
+```
diff --git a/docs/Doc-Revisions.md b/docs/Doc-Revisions.md
new file mode 100644
index 00000000..7fa0c64d
--- /dev/null
+++ b/docs/Doc-Revisions.md
@@ -0,0 +1,6 @@
+Document revisions
+==================
+
+| Date | Version | Designation  | Author |
+|-------------|---------|--------------------------------------|-------------------------|
+| 20 Mar 2017 | 1.0 | Initial release | R. Forlot [ Iot.bzh ] <br> S. Douheret [ Iot.bzh ] |
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 00000000..eccf553e
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,11 @@
+# Low level CAN binding for AGL
+
+## Abstract
+
+This project proposes a Low Level CAN Binding for AGL, with the following features:
+
+* CAN messages and diagnostic messages (OBD-II) are currently supported
+* Description of CAN messages is done using JSON definition following OpenXC specifications (project OpenXC/vi-firmware)
+* Encoding/Decoding of CAN messages reuses OpenXC libraries
+* Proposes an API to other AGL applications and services to read/write on CAN bus(es).
+* Uses a publish/subscribe model with filtering for sending messages to clients for efficiency
diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md
new file mode 100644
index 00000000..f444d925
--- /dev/null
+++ b/docs/SUMMARY.md
@@ -0,0 +1,9 @@
+# Summary
+
+* [Document revisions](Doc-Revisions.md)
+
+* [Introduction](README.md)
+* [Architecture](1-Architecture.md)
+* [Installation](2-Installation.md)
+* [Usage](3-Usage.md)
+
diff --git a/docs/_layouts/ebook/page.html b/docs/_layouts/ebook/page.html
new file mode 100644
index 00000000..bf325e9b
--- /dev/null
+++ b/docs/_layouts/ebook/page.html
@@ -0,0 +1,36 @@
+{% extends "layout.html" %}
+
+{% block title %}{{ page.title }}{% endblock %}
+{% block description %}{{ page.description }}{% endblock %}
+
+{% block style %}
+ {### Include theme css before plugins css ###}
+ {% if not fileExists(config.styles.print) %}
+ {% if options.format %}
+ <link rel="stylesheet" href="{{ (options.format + ".css")|resolveAsset }}">
+ {% else %}
+ <link rel="stylesheet" href="{{ "ebook.css"|resolveAsset }}">
+ {% endif %}
+ {% endif %}
+
+ {{ super() }}
+
+ {### Custom stylesheets for the book ###}
+
+ {% for type, style in config.styles %}
+ {% if fileExists(style) and (type == "ebook" or type == "print" or type == options.format) %}
+ <link rel="stylesheet" href="{{ style|resolveFile }}">
+ {% endif %}
+ {% endfor %}
+{% endblock %}
+
+{% block body %}
+<div class="page">
+ {% block page %}
+ <h1 class="book-chapter book-chapter-{{ page.depth }}">{{ page.title }}</h1>
+ <div class="section">
+ {{ page.content|safe }}
+ </div>
+ {% endblock %}
+</div>
+{% endblock %}
diff --git a/docs/_layouts/ebook/pdf_footer.html b/docs/_layouts/ebook/pdf_footer.html
new file mode 100644
index 00000000..cc6464bd
--- /dev/null
+++ b/docs/_layouts/ebook/pdf_footer.html
@@ -0,0 +1,13 @@
+{% extends "./page.html" %}
+{% block body %}
+<div id="pdf-footer" class="pdf-footer">
+ <span class="footer-left">Version {{ config.version }}</span>
+ <span class="footer-right">{{ page.num }}</span>
+ <span class="footer-center">{{ config.published }}</span>
+</div>
+
+<!-- Allow to hide header for some pages using hidepageheaders config in book.json -->
+<script>
+ if (({% for num in config.hidepagefooters %}{{ page.num }} == {{ num }} || {% endfor %}false)) document.getElementById('pdf-footer').style.display = 'none'
+</script>
+{% endblock %}
diff --git a/docs/_layouts/ebook/pdf_header.html b/docs/_layouts/ebook/pdf_header.html
new file mode 100644
index 00000000..ef496410
--- /dev/null
+++ b/docs/_layouts/ebook/pdf_header.html
@@ -0,0 +1,13 @@
+{% extends "./page.html" %}
+{% block body %}
+<div id="pdf-header" class="pdf-header">
+ <span class="header-left">IoT.Bzh</span>
+ <span class="header-right">{{ config.title }}</span>
+</div>
+
+<!-- Allow to hide header for some pages using hidepageheaders config in book.json -->
+<script>
+ if (({% for num in config.hidepageheaders %}{{ page.num }} == {{ num }} || {% endfor %}false)) document.getElementById('pdf-header').style.display = 'none'
+</script>
+
+{% endblock %} \ No newline at end of file
diff --git a/docs/_layouts/ebook/summary.html b/docs/_layouts/ebook/summary.html
new file mode 100644
index 00000000..be328a42
--- /dev/null
+++ b/docs/_layouts/ebook/summary.html
@@ -0,0 +1,58 @@
+{% extends "./page.html" %}
+
+{% block title %}{{ "SUMMARY"|t }}{% endblock %}
+
+{% macro articles(_articles) %}
+ {% for article in _articles %}
+ <li>
+ <span class="inner">
+ {% if article.path or article.url %}
+ {% if article.path %}
+ <a href="{{ article.path|contentURL }}{{ article.anchor }}">{{ article.title }}</a>
+ {% else %}
+ <a target="_blank" href="{{ article.url }}">{{ article.title }}</a>
+ {% endif %}
+ {% else %}
+ <span>{{ article.title }}</span>
+ {% endif %}
+ {% if 1 %}
+ <span class="page">{{ article.level }}</span>
+ {% endif %}
+ </span>
+ {% if article.articles.length > 0 %}
+ <ol>
+ {{ articles(article.articles) }}
+ </ol>
+ {% endif %}
+ </li>
+ {% endfor %}
+{% endmacro %}
+
+{% block page %}
+<div class="section toc">
+ <h1>{{ "SUMMARY"|t }}</h1>
+ <ol>
+ {% for part in summary.parts %}
+ {% if part.title %}
+ <li class="part-title">
+ <h2>{{ part.title }}</h2>
+ </li>
+ {% endif %}
+ {{ articles(part.articles) }}
+
+ {% if not loop.last %}
+ <li class="divider"></li>
+ {% endif %}
+ {% endfor %}
+
+ {% if glossary.path %}
+ <li>
+ <span class="inner">
+ <a href="{{ ('/' + glossary.path)|contentURL }}">{{ "GLOSSARY"|t }}</a>
+ </span>
+ </li>
+ {% endif %}
+ </ol>
+</div>
+{% endblock %}
+
diff --git a/docs/_layouts/layout.html b/docs/_layouts/layout.html
new file mode 100644
index 00000000..3d5aca60
--- /dev/null
+++ b/docs/_layouts/layout.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html lang="{{ config.language }}" {% if page.dir == "rtl" %}dir="rtl"{% endif %}>
+ <head>
+ <meta charset="UTF-8">
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
+ <title>{% block title %}{{ config.title|d("GitBook", true) }}{% endblock %}</title>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta name="description" content="{% block description %}{% endblock %}">
+ <meta name="generator" content="GitBook {{ gitbook.version }}">
+ {% if config.author %}<meta name="author" content="{{ config.author }}">{% endif %}
+ {% if config.isbn %}<meta name="identifier" content="{{ config.isbn }}" scheme="ISBN">{% endif %}
+ {% block style %}
+ {% for resource in plugins.resources.css %}
+ {% if resource.url %}
+ <link rel="stylesheet" href="{{ resource.url }}">
+ {% else %}
+ <link rel="stylesheet" href="{{ resource.path|resolveAsset }}">
+ {% endif %}
+ {% endfor %}
+ {% endblock %}
+
+ {% block head %}{% endblock %}
+ </head>
+ <body>
+ {% block body %}{% endblock %}
+ {% block javascript %}{% endblock %}
+ </body>
+</html>
diff --git a/docs/images/CAN_bindings_communication.png b/docs/images/CAN_bindings_communication.png
new file mode 100644
index 00000000..426e2f78
--- /dev/null
+++ b/docs/images/CAN_bindings_communication.png
Binary files differ
diff --git a/docs/images/CAN_level_mapping.png b/docs/images/CAN_level_mapping.png
new file mode 100644
index 00000000..1f1d906b
--- /dev/null
+++ b/docs/images/CAN_level_mapping.png
Binary files differ
diff --git a/docs/images/OpenXC_to_AGL.png b/docs/images/OpenXC_to_AGL.png
new file mode 100644
index 00000000..1ea66432
--- /dev/null
+++ b/docs/images/OpenXC_to_AGL.png
Binary files differ
diff --git a/images/logo_iot_bzh.svg b/docs/images/logo_iot_bzh.svg
index aa23e848..aa23e848 100644
--- a/images/logo_iot_bzh.svg
+++ b/docs/images/logo_iot_bzh.svg
diff --git a/docs/resources/cover.xcf b/docs/resources/cover.xcf
new file mode 100644
index 00000000..a08c3a38
--- /dev/null
+++ b/docs/resources/cover.xcf
Binary files differ
diff --git a/docs/resources/ebook.css b/docs/resources/ebook.css
new file mode 100644
index 00000000..313386d0
--- /dev/null
+++ b/docs/resources/ebook.css
@@ -0,0 +1,382 @@
+/* IoT.Bzh theaming */
+
+h1 {
+ color: #330066;
+ border-bottom: 2px solid #330066;
+}
+
+h2 {
+ color: #330066;
+}
+
+h3 {
+ color: #330066;
+}
+
+h4 {
+ color: #330066;
+}
+
+
+/* GENERAL ELEMENTS */
+
+/* clear both */
+
+.clear {
+ clear: both;
+}
+
+.section> :last-child {
+ margin-bottom: 0 !important;
+}
+
+.section> :first-child {
+ margin-top: 0 !important;
+}
+
+
+/* SPECIAL ELEMENTS */
+
+
+/* page break always after element on pdf/print definition */
+
+div.pagebreak {
+ page-break-after: always;
+}
+
+
+/* no page break inside element on pdf/print definition */
+
+div.nopb {
+ page-break-inside: avoid !important;
+ margin: 4px 0 4px 0;
+}
+
+
+/* note blocks */
+
+div.note {
+ background: #FCF8E3 none repeat scroll 0% 0%;
+ color: #8A6D3B;
+ padding: 15px;
+ margin-bottom: 10px;
+ border-bottom: 5px solid #DDD;
+ border-color: #FAEBCC;
+ page-break-inside: avoid;
+}
+
+div.note p {
+ padding-bottom: 0;
+ margin-bottom: 0;
+}
+
+
+/* images, figures and captions */
+
+p img {
+ /* center all images */
+ display: block;
+ margin: 0 auto;
+ padding: 10px 0;
+}
+
+figure {
+ margin: 1.0em 0px;
+ padding: 10px 0;
+ text-align: center;
+ page-break-inside: avoid;
+ display: block;
+}
+
+figure img {
+ display: block;
+ margin: 0 auto;
+}
+
+figcaption {
+ clear: left;
+ margin: 1.0em 0 0 0;
+ text-align: center;
+ font-style: italic;
+ line-height: 1.5em;
+ font-size: 80%;
+ color: #666;
+ display: block;
+}
+
+.page .section p img {
+ margin-top: 10px;
+}
+
+
+/* ul, ol list margin fix */
+
+.page .section ol,
+.page .section ul {
+ margin-bottom: 10px;
+}
+
+
+/* blockquotes */
+
+.page .section blockquote {
+ margin: 0 0 0 5%;
+ font-style: italic;
+}
+
+
+/* PAGE SPECIFIC */
+
+
+/* set summary page to right side of the paper */
+
+.page .toc h1 {
+ page-break-before: right;
+}
+
+.page .section.toc {
+ page-break-inside: always;
+}
+
+/* table headers */
+
+div#README\.md table {
+ margin-top: 30px;
+ font-size: 95%;
+}
+
+div#README\.md table thead {
+ display: none;
+}
+
+
+
+/* CITATION AND IMAGES */
+
+
+/* math image styles */
+
+.page .section p img.svg,
+.page .section p img.png {
+ margin-top: 0px;
+ margin-bottom: -2px;
+}
+
+.page .section p img.math {
+ vertical-align: middle;
+ height: auto;
+ width: auto;
+ margin-top: -4px;
+ max-height: 15px;
+}
+
+.page .section p img.math.line1 {
+ margin-top: -7px;
+ max-height: 19px;
+}
+
+.page .section p img.math.line2 {
+ margin-top: -1px;
+ max-height: 30px;
+}
+
+
+/* credits page */
+
+.page .section ul.pictures {
+ margin-left: -30px;
+}
+
+.page .section ul.pictures li {
+ list-style: outside none none;
+}
+
+.page .section ul.pictures li a {
+ float: left;
+}
+
+.page .section ul.pictures li span {
+ display: block;
+ margin-left: 100px;
+}
+
+
+
+/* sub and super script */
+
+.page .section sub {
+ font-size: 80%;
+ margin-left: 1px;
+}
+
+
+/* citations and references */
+
+.page .section sup {
+ margin-left: -1px;
+ margin-right: 2px;
+ font-size: 80%;
+}
+
+.page .section sup:before {
+ content: " ";
+}
+
+.page .section ul.citations,
+.page .section ul.references {
+ margin-left: -30px;
+}
+
+
+.page .section ul.citations li:nth-child(1) {
+ margin-top: 20px;
+ padding-top: 20px;
+ border-top: 1px solid #BBB;
+}
+
+.page .section ul.citations li,
+.page .section ul.references li {
+ list-style: outside none none;
+}
+
+.page .section ul.citations li {
+ font-size: 80%;
+}
+
+.page .section ul.citations li>span:nth-child(1),
+.page .section ul.references li>span:nth-child(1) {
+ display: block;
+ float: left;
+ text-align: left;
+ width: 70px
+}
+
+.page .section ul.citations li>span:nth-child(1) {
+ width: 50px
+}
+
+.page .section ul.references li div {
+ margin-left: 70px;
+}
+
+.page .section ul.citations li div {
+ margin-left: 50px;
+}
+
+.page .section a[href="#"],
+.page .section a[href="#"]:link,
+.page .section a[href="#"]:visited,
+.page .section a[href="#"]:hover,
+.page .section a[href="#"]:focus {
+ text-decoration: none;
+ color: inherit;
+ cursor: text;
+ font-style: italic;
+}
+
+
+/* self referential footnotes */
+
+.page .section div[type="selfref"] a[href="#"],
+.page .section div[type="selfref"] a[href="#"]:link,
+.page .section div[type="selfref"] a[href="#"]:visited,
+.page .section div[type="selfref"] a[href="#"]:hover,
+.page .section div[type="selfref"] a[href="#"]:focus {
+ font-style: normal;
+}
+
+.page .section div[type="selfref"] span:nth-child(1) {
+ display: none;
+}
+
+
+/* page break always after element on pdf/print definition */
+
+div.page-break {
+ page-break-inside: always;
+}
+
+div.page-break:before {
+ content: ' ';
+}
+
+
+/* no page break inside element on pdf/print definition */
+
+div.nopb {
+ page-break-inside: avoid;
+}
+
+
+/* page header and footer */
+
+.pdf-footer,
+.pdf-header {
+ margin-top: 20px;
+ color: #aaa;
+}
+
+.pdf-header .header-left {
+ float: left;
+ margin-left: 2em;
+ margin-right: auto;
+}
+
+.pdf-header .header-right {
+ display: table;
+ margin-left: auto;
+ margin-right: 2em;
+}
+
+.pdf-footer .sub {
+ padding-top: 8px;
+ font-size: 70%;
+}
+
+.pdf-header .sub {
+ padding-top: 2px;
+ font-size: 70%;
+}
+
+.pdf-footer {
+ padding-top: 10px;
+ border-top: 1px solid #eee;
+}
+
+.pdf-footer .footer-left {
+ float: left;
+ margin-left: 2em;
+ margin-right: auto;
+}
+
+.pdf-footer .footer-center {
+ display: table;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.pdf-footer .footer-right {
+ float: right;
+ margin-left: auto;
+ margin-right: 2em;
+}
+
+.pdf-header {
+ padding-bottom: 10px;
+ border-bottom: 1px solid #eee;
+}
+
+.pdf-header .header-pages-count {
+ float: right;
+ text-align: right;
+}
+
+.pdf-header .header-pages-count a,
+.pdf-header .header-pages-count a:visited,
+.pdf-header .header-pages-count a:active,
+.pdf-header .header-pages-count a:focus,
+.pdf-header .header-pages-count a:link {
+ text-decoration: none;
+ color: #aaa;
+ cursor: text;
+}
diff --git a/docs/resources/iotbzh_logo.png b/docs/resources/iotbzh_logo.png
new file mode 100644
index 00000000..ae6bc48a
--- /dev/null
+++ b/docs/resources/iotbzh_logo.png
Binary files differ
diff --git a/docs/resources/iotbzh_logo_small.png b/docs/resources/iotbzh_logo_small.png
new file mode 100644
index 00000000..6a98c609
--- /dev/null
+++ b/docs/resources/iotbzh_logo_small.png
Binary files differ
diff --git a/images/CAN_bindings_communication.png b/images/CAN_bindings_communication.png
deleted file mode 100644
index 1ee388d1..00000000
--- a/images/CAN_bindings_communication.png
+++ /dev/null
Binary files differ
diff --git a/images/CAN_level_mapping.png b/images/CAN_level_mapping.png
deleted file mode 100644
index 5c36ae15..00000000
--- a/images/CAN_level_mapping.png
+++ /dev/null
Binary files differ
diff --git a/images/OpenXC_to_AGL.png b/images/OpenXC_to_AGL.png
deleted file mode 100644
index d05776d9..00000000
--- a/images/OpenXC_to_AGL.png
+++ /dev/null
Binary files differ