Doxygen base configuration file and logo.
[apps/low-level-can-service.git] / README.md
1 # Low level CAN signaling binder
2
3 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 the vi-firmware project. It's meant to generate from a JSON file describing CAN messages and diagnostic message (OBD2 for now) present in a car, a cpp file to integrate with the project and compile all together. Result will be a widget file to install on an AGL target system.
4
5 # Prerequirements
6
7 - Make sure you already have set up the AGL SDK before using the following [guide][SDK_instructions].
8
9 - This repo make use of git submodule, make sure to execute the following commands from the repository once cloned :
10
11 ```bash
12 $ git submodule init
13 $ git submodule update
14 ```
15
16 - Make sure you have installed the AGL generator else you aren't 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.
17
18 # Getting started
19
20 ## Compile and install the binding
21
22 AGL SDK environment correctly set, if you have an AGL target already running in your network, I encourage you to set the TARGET variable in the root CMakeLists.txt file. Then you can directly install the binding and source directory on your target system.
23
24 Execute commands to get your binding compile :
25
26 ```bash
27 $ mkdir build
28 $ cd build
29 $ cmake ..
30 $ make
31 ```
32
33 And if you have set TARGET variable, you can install it on your AGL system :
34
35 ```bash
36 $ make install
37 ```
38
39 If not, you will have to install it manually copying the *low-can-binding.wgt* file on your target, then from it execute the following commands :
40
41 ```bash
42 ~# afm-util install low-can-binding.wgt
43 { "added": "low-can-binding@0.1" } 
44 ```
45
46 ## Confiure system and binding
47
48 Configure the binding specifying in the JSON configuration file the CAN device that the binding 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 :
49
50 ```json
51 {
52         "canbus":  "vcan0"
53 }
54 ```
55
56 If you have several CAN bus devices then use an array:
57
58 ```json
59 {
60         "canbus": [ "vcan0", "can0" ]
61 }
62 ```
63
64 Connected to the target load the virtual CAN device driver and set up a new vcan device :
65
66 ```bash
67  ~# modprobe vcan
68  ~# ip link add vcan0 type vcan
69  ~# ip link set vcan0 up
70  ```
71
72 Or a real CAN bus device if on is present on your board (this instruction assuming a speed of 500000kbps for your device):
73
74 ```bash
75 ~# modprobe can
76 ~# ip link set can0 up type can bitrate 500000
77 ```
78 ## Run it, test it, use it !
79
80 You can run the binding using **afm-util** tool, it is the classic way to go :
81
82 ```bash
83 ~# afm-util run low-can-binding@0.1
84 1
85 ```
86 You can find instructions to use afm-util tool [here][afm-util], as well as documentation about Application Framework.
87
88 [SDK_instructions]: http://docs.iot.bzh/docs/getting_started/en/dev/reference/setup-sdk-environment.html "Setup SDK environment"
89 [generator]: http://github.com/user/generator "AGL low level CAN binding Generator"
90 [afm-util]: http://docs.iot.bzh/docs/apis_services/en/dev/reference/af-main/afm-daemons.html#using-afm-util "afm-util usage"