1*c33452fbSAndroid Build Coastguard Worker# parameter-framework 2*c33452fbSAndroid Build Coastguard Worker 3*c33452fbSAndroid Build Coastguard Worker[](https://travis-ci.org/01org/parameter-framework) 4*c33452fbSAndroid Build Coastguard Worker[](https://ci.appveyor.com/project/parameter-framework/parameter-framework) 5*c33452fbSAndroid Build Coastguard Worker[](https://codecov.io/github/01org/parameter-framework?branch=master) 6*c33452fbSAndroid Build Coastguard Worker 7*c33452fbSAndroid Build Coastguard Worker## Introduction 8*c33452fbSAndroid Build Coastguard Worker 9*c33452fbSAndroid Build Coastguard WorkerThe parameter-framework is a plugin-based and rule-based framework for handling 10*c33452fbSAndroid Build Coastguard Workerparameters. This means that you can: 11*c33452fbSAndroid Build Coastguard Worker 12*c33452fbSAndroid Build Coastguard Worker1. Describe your system's structure and its parameters (in XML) - aka. **What**; 13*c33452fbSAndroid Build Coastguard Worker2. Write (in C++) or reuse a backend (aka. plugin) for accessing the parameters 14*c33452fbSAndroid Build Coastguard Workerthat you just described - aka. **How**; 15*c33452fbSAndroid Build Coastguard Worker3. Define (in XML or in a domain-specific-language) conditions/rules upon which 16*c33452fbSAndroid Build Coastguard Workera given parameter must take a given value - aka. **When**. 17*c33452fbSAndroid Build Coastguard Worker 18*c33452fbSAndroid Build Coastguard Worker 19*c33452fbSAndroid Build Coastguard Worker 20*c33452fbSAndroid Build Coastguard Worker### Usage examples 21*c33452fbSAndroid Build Coastguard Worker 22*c33452fbSAndroid Build Coastguard Worker#### Alsa controls on embedded platforms 23*c33452fbSAndroid Build Coastguard Worker 24*c33452fbSAndroid Build Coastguard WorkerThe parameter-framework can be used to set the value of alsa controls 25*c33452fbSAndroid Build Coastguard Worker(switches, volumes, etc.) on smartphones/tablets based on parameter-framework 26*c33452fbSAndroid Build Coastguard Workerrules (in this example, they transcribe use-cases). For accessing parameters 27*c33452fbSAndroid Build Coastguard Worker(i.e. alsa controls), you may use the 28*c33452fbSAndroid Build Coastguard Worker[alsa plugin](https://github.com/01org/parameter-framework-plugins-alsa). 29*c33452fbSAndroid Build Coastguard Worker 30*c33452fbSAndroid Build Coastguard Worker#### Parameters in files 31*c33452fbSAndroid Build Coastguard Worker 32*c33452fbSAndroid Build Coastguard WorkerThe [filesystem plugin](https://github.com/01org/parameter-framework-plugins-filesystem) 33*c33452fbSAndroid Build Coastguard Workercan be used to write parameters in files. This is particularly useful for 34*c33452fbSAndroid Build Coastguard Workerfiles in `/sys` managing GPIOs. 35*c33452fbSAndroid Build Coastguard Worker 36*c33452fbSAndroid Build Coastguard Worker### More details 37*c33452fbSAndroid Build Coastguard Worker 38*c33452fbSAndroid Build Coastguard WorkerThe parameter-framework's core comes in the form of a shared library. Its 39*c33452fbSAndroid Build Coastguard Workerclient has to provide: 40*c33452fbSAndroid Build Coastguard Worker 41*c33452fbSAndroid Build Coastguard Worker- configuration files describing the structure of the system to be managed by 42*c33452fbSAndroid Build Coastguard Worker the parameter-framework and what plugins it must use to read/write into each 43*c33452fbSAndroid Build Coastguard Worker subsystem; 44*c33452fbSAndroid Build Coastguard Worker- a list of criteria (representing the state of the client) and their possible 45*c33452fbSAndroid Build Coastguard Worker values; 46*c33452fbSAndroid Build Coastguard Worker- configuration files describing the value that each part of the system (aka 47*c33452fbSAndroid Build Coastguard Worker parameter) must take - this is done by writing rules based on the criteria 48*c33452fbSAndroid Build Coastguard Worker described above. 49*c33452fbSAndroid Build Coastguard Worker 50*c33452fbSAndroid Build Coastguard WorkerAt runtime, the most usual communication between the client and the 51*c33452fbSAndroid Build Coastguard Workerparameter-framework are: 52*c33452fbSAndroid Build Coastguard Worker 53*c33452fbSAndroid Build Coastguard Worker1. The update of *criteria* (that are used in the rules introduced above) and 54*c33452fbSAndroid Build Coastguard Worker2. Update all relevant parameters according to the new criteria values. The 55*c33452fbSAndroid Build Coastguard Worker parameter-framework uses the appropriate backend for writing the values in 56*c33452fbSAndroid Build Coastguard Worker each underlying subsystem. 57*c33452fbSAndroid Build Coastguard Worker 58*c33452fbSAndroid Build Coastguard WorkerThe parameter-framework comes with several tools, including a command-line 59*c33452fbSAndroid Build Coastguard Workerinterface: `remote-process`. 60*c33452fbSAndroid Build Coastguard Worker 61*c33452fbSAndroid Build Coastguard Worker## Going further 62*c33452fbSAndroid Build Coastguard Worker 63*c33452fbSAndroid Build Coastguard WorkerSee [the wiki on github](https://github.com/01org/parameter-framework/wiki). 64*c33452fbSAndroid Build Coastguard Worker 65*c33452fbSAndroid Build Coastguard Worker## Compiling 66*c33452fbSAndroid Build Coastguard Worker 67*c33452fbSAndroid Build Coastguard Worker**You may take a look at `.travis.yml` and `appveyor.yml` for examples on how we 68*c33452fbSAndroid Build Coastguard Workerbuild the Parameter Framework in the CI.** It will probably help if you have 69*c33452fbSAndroid Build Coastguard Workertroubles building the Parameter Framework even after reading the following 70*c33452fbSAndroid Build Coastguard Workersections: 71*c33452fbSAndroid Build Coastguard Worker 72*c33452fbSAndroid Build Coastguard Worker### Dependencies 73*c33452fbSAndroid Build Coastguard Worker 74*c33452fbSAndroid Build Coastguard WorkerIn order to compile you'll need, at the very least: 75*c33452fbSAndroid Build Coastguard Worker 76*c33452fbSAndroid Build Coastguard Worker- CMake (v3.2.2 or later) (v3.3.0 or later on Windows); 77*c33452fbSAndroid Build Coastguard Worker- A C/C++ compiler supporting C++11; 78*c33452fbSAndroid Build Coastguard Worker- libxml2 headers and libraries (Provided by the `libxml2-dev` on debian-based 79*c33452fbSAndroid Build Coastguard Workerdistributions); 80*c33452fbSAndroid Build Coastguard Worker 81*c33452fbSAndroid Build Coastguard WorkerIf you want to use the remote command interface (`NETWORKING=ON` by default), 82*c33452fbSAndroid Build Coastguard Workeryou'll also need: 83*c33452fbSAndroid Build Coastguard Worker 84*c33452fbSAndroid Build Coastguard Worker- Standalone ASIO (1.10.6 or later) (Provided by `libasio-dev` on debian-based 85*c33452fbSAndroid Build Coastguard Workerdistributions) ASIO is C++ header-only ASynchronous-IO library. 86*c33452fbSAndroid Build Coastguard Worker 87*c33452fbSAndroid Build Coastguard WorkerIf you want to compile the *Python bindings* (`PYTHON_BINDINGS=ON` by default), 88*c33452fbSAndroid Build Coastguard Workeryou'll also need: 89*c33452fbSAndroid Build Coastguard Worker 90*c33452fbSAndroid Build Coastguard Worker- SWIG 2.0 (A binding generator); 91*c33452fbSAndroid Build Coastguard Worker- Python2.7 development environment (Provided by `python2.7-dev` on debian-based 92*c33452fbSAndroid Build Coastguard Workerdistributions) 93*c33452fbSAndroid Build Coastguard Worker 94*c33452fbSAndroid Build Coastguard WorkerIf you want to *compile and run the tests* (`BUILD_TESTING=ON` by default), 95*c33452fbSAndroid Build Coastguard Workeryou'll also need: 96*c33452fbSAndroid Build Coastguard Worker 97*c33452fbSAndroid Build Coastguard Worker- Catch (Provided by `catch` on debian-based distributions). Catch is a 98*c33452fbSAndroid Build Coastguard Workersingle-header test framework - as such you may also download it directly 99*c33452fbSAndroid Build Coastguard Worker[here](https://raw.githubusercontent.com/philsquared/Catch/master/single_include/catch.hpp); 100*c33452fbSAndroid Build Coastguard Worker- Python2.7 (Provided by `python2.7` on debian-based distribution - it is 101*c33452fbSAndroid Build Coastguard Workerpreinstalled on most distributions). 102*c33452fbSAndroid Build Coastguard Worker 103*c33452fbSAndroid Build Coastguard WorkerIf you want to *build the code documentation* (`DOXYGEN=OFF` by default), you'll 104*c33452fbSAndroid Build Coastguard Workerneed `doxygen` and `graphviz`. This doc is already available to you - see the 105*c33452fbSAndroid Build Coastguard Workerwiki. 106*c33452fbSAndroid Build Coastguard Worker 107*c33452fbSAndroid Build Coastguard Worker**To list all available configuration options, try** `cmake -L` (you may also 108*c33452fbSAndroid Build Coastguard Workerfilter-out lines starting with `CMAKE_`). 109*c33452fbSAndroid Build Coastguard Worker 110*c33452fbSAndroid Build Coastguard Worker### How-To 111*c33452fbSAndroid Build Coastguard Worker 112*c33452fbSAndroid Build Coastguard WorkerIf you are already familiar with CMake, you know what to do. 113*c33452fbSAndroid Build Coastguard Worker 114*c33452fbSAndroid Build Coastguard WorkerRun `cmake .` then `make`. You may then install libraries, headers and 115*c33452fbSAndroid Build Coastguard Workerbinaries with `make install`. By default, they are installed under 116*c33452fbSAndroid Build Coastguard Worker`/usr/local` on unix OSes; if you want to install them under a custom 117*c33452fbSAndroid Build Coastguard Workerdirectory, you may do so by passing it to the `cmake .` command; e.g. 118*c33452fbSAndroid Build Coastguard Worker 119*c33452fbSAndroid Build Coastguard Worker # Always use absolute paths in CMake "-D" options: you don't know where 120*c33452fbSAndroid Build Coastguard Worker # relative paths will be evaluated from. 121*c33452fbSAndroid Build Coastguard Worker cmake -DCMAKE_INSTALL_PREFIX=/path/to/custom/install . 122*c33452fbSAndroid Build Coastguard Worker 123*c33452fbSAndroid Build Coastguard WorkerIf you want to provide your own dependencies (e.g. your own version of 124*c33452fbSAndroid Build Coastguard Workerlibxml2), you should pass the base paths as the `CMAKE_PREFIX_PATH` variable, 125*c33452fbSAndroid Build Coastguard Workere.g.: 126*c33452fbSAndroid Build Coastguard Worker 127*c33452fbSAndroid Build Coastguard Worker cmake -DCMAKE_PREFIX_PATH='/path/to/dependency1/;/path/to/dependency2/' 128*c33452fbSAndroid Build Coastguard Worker 129*c33452fbSAndroid Build Coastguard WorkerFor more information on how to use `CMAKE_PREFIX_PATH`, see CMake's 130*c33452fbSAndroid Build Coastguard Workerdocumentation. 131*c33452fbSAndroid Build Coastguard Worker 132*c33452fbSAndroid Build Coastguard WorkerAlso, CMake can build a project out-of-tree, which is the recommended method: 133*c33452fbSAndroid Build Coastguard Worker 134*c33452fbSAndroid Build Coastguard Worker mkdir /path/to/build/directory 135*c33452fbSAndroid Build Coastguard Worker cd /path/to/build/directory 136*c33452fbSAndroid Build Coastguard Worker cmake /path/to/sources/of/parameter-framework 137*c33452fbSAndroid Build Coastguard Worker make 138*c33452fbSAndroid Build Coastguard Worker 139*c33452fbSAndroid Build Coastguard WorkerAfter a build you may want to run the parameter-framework tests with 140*c33452fbSAndroid Build Coastguard Worker`make test` or `ctest`. 141*c33452fbSAndroid Build Coastguard Worker 142*c33452fbSAndroid Build Coastguard Worker### Compiling on Windows 143*c33452fbSAndroid Build Coastguard Worker 144*c33452fbSAndroid Build Coastguard WorkerThe only supported compiler on Windows in Visual Studio 14 2015. The 2013 145*c33452fbSAndroid Build Coastguard Workerversion does not support some C++11 features. When running CMake's 146*c33452fbSAndroid Build Coastguard Workerconfiguration step (the first call to CMake) you must specify the build system 147*c33452fbSAndroid Build Coastguard Workeryou want to use, i.e. `-G Visual Studio 14 2015 Win64`. Again, you may refer to 148*c33452fbSAndroid Build Coastguard Worker`appveyor.yml`. 149*c33452fbSAndroid Build Coastguard Worker 150*c33452fbSAndroid Build Coastguard WorkerIf you don't already have libxml2 headers/libraries and don't want to build them 151*c33452fbSAndroid Build Coastguard Workerby yourself, we have a precompiled version for x86-64. *These are provided for 152*c33452fbSAndroid Build Coastguard Workerreference and as a convenience for development purpose only; when making a 153*c33452fbSAndroid Build Coastguard Workerfinal product, you should recompile the latest libxml2 release yourself.* 154*c33452fbSAndroid Build Coastguard Worker 155*c33452fbSAndroid Build Coastguard WorkerCompiled with Visual Studio 12 2013: 156*c33452fbSAndroid Build Coastguard Worker- [in debug configuration](https://01.org/sites/default/files/libxml2-x86_64-debug-3eaedba1b64180668fdab7ad2eba549586017bf3.zip) 157*c33452fbSAndroid Build Coastguard Worker- [in release configuration](https://01.org/sites/default/files/libxml2-x86_64-3eaedba1b64180668fdab7ad2eba549586017bf3.zip) 158*c33452fbSAndroid Build Coastguard Worker 159*c33452fbSAndroid Build Coastguard WorkerWe have mirrored ASIO 1.10.6 [here](https://01.org/sites/default/files/asio-1.10.6.tar.gz). 160*c33452fbSAndroid Build Coastguard Worker 161*c33452fbSAndroid Build Coastguard WorkerOnce you have downloaded and uncompressed these two dependencies, add the 162*c33452fbSAndroid Build Coastguard Workerfollowing two entries to `CMAKE_PREFIX_PATH`: 163*c33452fbSAndroid Build Coastguard Worker 164*c33452fbSAndroid Build Coastguard Worker /path/to/libxml2-x86_64/ 165*c33452fbSAndroid Build Coastguard Worker /path/to/asio-1.10.6/ 166