update changelog
[profile/ivi/genivi/genivi-audio-manager.git] / README
1 GENIVI_AudioManager
2 ===================
3 :Author: Christian Linke <christian.linke@bmw.de>
4 :doctitle: GENIVI_AudioManager
5  
6 Copyright
7 ---------
8 Copyright (C) 2012, GENIVI Alliance, Inc.
9 Copyright (C) 2012, BMW AG
10
11 This file is part of GENIVI Project AudioManager.
12  
13 Contributions are licensed to the GENIVI Alliance under one or more
14 Contribution License Agreements or MPL 2.0 .
15  
16 (C) Copyright
17 This Source Code Form is subject to the terms of the
18 Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed with
19 this file, You can obtain one at http://mozilla.org/MPL/2.0/.
20  
21 author Christian Mueller, christian.linke@bmw.de BMW 2011,2012
22
23 For further information see http://projects.genivi.org/audio-manager/.
24
25 == License
26 The licenses of this project are split into two parts:
27 1) the AudioManagerDaemon, licensed under MPL 2.0
28 2) all other parts that serve as example code that can be taken to build up an own project with it -
29     these parts are licensed with the MIT license
30     
31 Contribution is done under GENIVI CLA or MPL2.0. 
32
33 == Version
34 The current version can be taken out of the git. The version 1.0.0 is the first GENIVI compliant code,in the compliance statement of discovery (2.0). 
35 For every GENIVI release, there is a release of the AudioManager, each of the releases have an own bugfix branch that will get the most important fixes.
36 Development is done on the master branch.
37
38 === Versioning Scheme
39 The versioning scheme was decided in the February face2face 2012.
40 The firs number describes the release branch. This is 1 for discovery, 2 for excalibur and 3 for photon. For major features or release, the second number will be increased.
41 Each new GENIVI version (releases are every half year, around april and october) will get the current HEAD (for example 2.0.34 for excalibur) and release with the increase of the second number (2.1).
42 The next commit on the master branch gets then the new first numner (3) and starts from zero.
43
44 For the daemon the third number (for example 1.0.X) describes the patch version. The versions are automatically created by git during the build process.
45 The versioning scheme is used for the AudioManager daemon itself and for each of it's interfaces. The versioning of the Interfaces in EA is defined via the tag "version" and the name of the interfaceversion versionName, for example "CommandReceiveVersion". This information is generated into the interface header files and is used then by cmake to set the interface versions.
46 Whenever changes are done, the minor version of the interface needs to be incremented.
47
48 == Documentation
49 A very detailed documentation is provided by doxygen. In order to use this, please compile the AudioManager with
50 ----
51 cmake -DWITH_DOCUMENTATION=ON
52 make
53 ----
54
55 == COMPILE PROGRAMS
56
57 === Compile Options
58 These are the compile options with default values:
59
60  BUILD_SHARED_LIBS                OFF                                                                                                                                                                             
61  CMAKE_BUILD_TYPE                                                                                                                                                                                                 
62  CMAKE_INSTALL_PREFIX             /usr/local                                                                                                                                                                      
63  COMMON_API_DBUS_LIBRARY          /usr/local/lib/libCommonAPI-DBus.so                                                                                                                                             
64  COMMON_API_LIBRARY               /usr/local/lib/libCommonAPI.so                                                                                                                                                  
65  GLIB_DBUS_TYPES_TOLERANT         ON                                                                                                                                                                              
66  USE_BUILD_LIBS                   ON                                                                                                                                                                              
67  WITH_COMMAND_INTERFACE_COMMON_   ON                                                                                                                                                                              
68  WITH_DATABASE_STORAGE            OFF                                                                                                                                                                             
69  WITH_DLT                         ON                                                                                                                                                                              
70  WITH_DOCUMENTATION               ON                                                                                                                                                                              
71  WITH_ENABLED_IPC                 CAPI                                                                                                                                                                            
72  WITH_LOGSTATE                    ON                                                                                                                                                                              
73  WITH_NSM                         ON                                                                                                                                                                              
74  WITH_OXF_ANIMATION               OFF                                                                                                                                                                             
75  WITH_OXF_TRACE                   OFF                                                                                                                                                                             
76  WITH_PLUGIN_COMMAND              ON                                                                                                                                                                              
77  WITH_PLUGIN_CONTROL              ON                                                                                                                                                                              
78  WITH_PLUGIN_ROUTING              ON                                                                                                                                                                              
79  WITH_ROUTING_INTERFACE_ASYNC     OFF                                                                                                                                                                             
80  WITH_ROUTING_INTERFACE_CAPI      ON                                                                                                                                                                              
81  WITH_SYSTEMD_WATCHDOG            OFF                                                                                                                                                                             
82  WITH_TELNET                      ON                                                                                                                                                                              
83  WITH_TESTS                       ON                                                                                                                                                                              
84  WITH_TEST_CONTROLLER             OFF                                                                                                                                                                             
85  gmock_build_tests                OFF                                                                                                                                                                             
86  gtest_build_samples              OFF                                                                                                                                                                             
87  gtest_build_tests                OFF                                                                                                                                                                             
88  gtest_disable_pthreads           OFF                                                                                                                                                                             
89  gtest_force_shared_crt           OFF 
90     
91 === Passing options to cmake:
92
93 .-DVERSION="XXX"
94 When building the AudioManager without taking it from the git (and thus having a .git folder), you can set the version via passing _-DVERSION="XXX"_ to cmake.
95
96 .-DDBUS_SERVICE_PREFIX="XXX"
97 sets the service prefix for Dbus, default "org.genivi.audiomanager\0"
98
99 .-DDBUS_SERVICE_OBJECT_PATH="XXX"
100 sets the object path for Dbus, default "/org/genivi/audiomanager\0"
101
102 .-DDEFAULT_TELNETPORT="XXX"
103 sets the default telnetport, default 6060. Can be overwriten by command line parameter
104
105 .-DMAX_TELNETCONNECTIONS="XXX"
106 sets the default maximum number of telnetconnections, default is 3
107
108 .-DNSM_PATH="XXX"
109 sets the path of the NSM DBUS interface
110
111 .-DNSM_INTERFACE="XXX"
112 sets the interface to the NSM DBUS interface
113
114 In order to change these options, you can modify this values with ccmake, do the appropriate changes in 
115 CmakeList.txt or via the commandline for cmake or (when installed via ccmake)
116
117 === Build dependencies
118 Basically, all build dependencies are optional- but you might need to use some if you want to have support for Dbus,
119 for example...
120
121 You will need optionally fullfill some dependencies in order to comile the GENIVI AudioManager Daemon, these are:
122
123 * dbus (only when DBUS_WRAPPER==ON) [tested on version 1.2.16]
124 * sqlite3 [tested on version 3.6.22] (only when WITH_DATABASE_STORAGE==ON)
125 * automotive-dlt [greater 2.5.0] (only when WITH_DLT==ON)        
126 * doxygen [tested on version 1.6.3] (only when WITH_DOCUMENTATION==ON) 
127 * commonAPI [version > 2.1] (only with WITH_ENABLED_IPC CAPI), more information here http://projects.genivi.org/commonapi/
128
129 To install them in a build environment like Ubuntu you can use:
130 ----
131 sudo apt-get install libdbus-1-dev libsqlite3-dev doxygen git cmake build-essential
132 ----
133
134 === The NodeStateManager
135
136 The nodestatemanager headers are needed to compile the audiomanager. If the nodestatemanagerincludes are not found, 
137 the headers shipped with the audiomanager are used.
138 The nodestatemanager can be retrieved from projects.genivi.org . You can install the headers on you system by
139
140 ----
141 sudo make install-includeHEADERS
142 ----
143
144 For building the tests, you will need the following packages:
145
146 * python [tested on version 2.6, should work on higher versions as well]
147
148 GoogleMock and GoogleTest are as source code integrated in the sourcetree
149 To install them in a build environment like Ubuntu you can use:
150 ----
151 sudo apt-get install python2.6-dev
152 ----
153
154 For compiling, you will need a compiler, linker etc. On most linux systems you will get this via
155 ----
156 sudo apt-get install build-essential
157 ----
158
159 More details in the CMake Files CmakeList.txt in the projects.
160
161 === Compiling
162 To compile open a shell, browse to the AudioManager folder and 
163 ----
164 mkdir /build
165 cd build
166 cmake ..
167 make
168 ----
169
170 After the script finished, you should have:
171
172 * a bin/ folder which contains all executables and the libraries: 
173 * a build/ folder which has all build objects (erase that if you need a clean build)
174 * a doc/ folder in case you turned the documentation on
175
176 In order to install the AudioManager, you can do
177 ----
178 sudo make install
179 ----
180
181 Package generation is supported via CPack. To build packages, you have to 
182 ----
183 make genivi_package
184 ----
185
186 This will create one package if your CMake version is < 2.8.5 (all binaries stripped):
187 ----
188 AudioManager-<git verison>-Linux.deb 
189 ----
190
191 If your version is above 2.8.5, you will get 4 packages (all binaries stripped) :
192         
193 * AudioManager-<git verison>-Linux-bin.deb              [AudioManager binary]
194 * AudioManager-<git verison>-Linux-dev.deb              [header files needed to compile plugins]
195 * AudioManager-<git verison>-Linux-sampleplugins.deb    [sample plugins]
196 * AudioManager-<git verison>-Linux-tests.deb            [tests including tests for sample plugins, installed in the ~/AudioMAnagerTests]
197
198 In order to create a tar.gz file of all sources (not including .git, build and bin folder,config files), you can do:
199 ----
200 make package_source                     
201 ----
202
203 This will create the following package:
204 'AudioManager-<git verison>-Source.tar.gz'
205
206 All packages will be placed in a folder called packages
207
208 === Adding own plugins
209 The AudioManager needs to be completed with on plugins. To keep the own sources away from the GENIVI code the project specific elements can be reconfigured with own type definitions.
210
211 TIP: Using this feature is simple: +
212 Create in your projects an own projecttypes.h. The name is no naming convention given. The file is your project specific type definition which will be only referenced by the HMI, Routing Adapters and the Controller Plug-in.
213  
214 .The are already examples given in audiomanagertypes.h:
215 ----
216 /**
217  * This type gives the information about reason for Source/Sink change
218  */
219 typedef uint16_t am_CustomAvailabilityReason_t;
220 static const am_CustomAvailabilityReason_t AR_UNKNOWN = 0;
221 /** new media was entered  */
222 static const am_CustomAvailabilityReason_t AR_GENIVI_NEWMEDIA = 1;
223 /** same media was entered */
224 static const am_CustomAvailabilityReason_t AR_GENIVI_SAMEMEDIA = 2;
225 /** there is no media or media is removed */
226 static const am_CustomAvailabilityReason_t AR_GENIVI_NOMEDIA = 3;
227 /** there was a temperature event */
228 static const am_CustomAvailabilityReason_t AR_GENIVI_TEMPERATURE = 4;
229 /** there was a voltage event */
230 static const am_CustomAvailabilityReason_t AR_GENIVI_VOLTAGE = 5;
231 /** fatal errors on reading or accessing media */
232 static const am_CustomAvailabilityReason_t AR_GENIVI_ERRORMEDIA = 6;
233
234 /**
235  * This is a custom specific identifier of property. It can be used to
236  * differentiate between interrupt source/sink, main source/sink, etc.
237  */
238 typedef uint16_t am_CustomClassProperty_t;
239 static const am_CustomClassProperty_t CP_UNKNOWN = 0;
240 static const am_CustomClassProperty_t CP_GENIVI_SOURCE_TYPE = 1;
241 static const am_CustomClassProperty_t CP_GENIVI_SINK_TYPE = 2;
242
243 /**
244  * This type classifies the format in which data is exchanged within a connection.
245  * The type itself is project specific although there are some standard formats
246  * defined.
247  */
248 typedef uint16_t am_CustomConnectionFormat_t;
249 static const am_CustomConnectionFormat_t CF_UNKNOWN = 0;
250 /** plain mono */
251 static const am_CustomConnectionFormat_t CF_GENIVI_MONO = 1;
252 /** stereo connection */
253 static const am_CustomConnectionFormat_t CF_GENIVI_STEREO = 2;
254 /** analog connection */
255 static const am_CustomConnectionFormat_t CF_GENIVI_ANALOG = 3;
256 /** automatic connection.  */
257 static const am_CustomConnectionFormat_t CF_GENIVI_AUTO = 4;
258
259 /**
260  * Here are all SoundProperties that can be set via the CommandInterface.
261  * This type is product specific and can be changed or extended.
262  */
263 typedef uint16_t am_CustomMainSoundPropertyType_t;
264 static const am_CustomMainSoundPropertyType_t MSP_UNKNOWN = 0;
265 /** example value between -10 and +10  */
266 static const am_CustomMainSoundPropertyType_t MSP_GENIVI_TREBLE = 1;
267 /** example value between -10 and +10  */
268 static const am_CustomMainSoundPropertyType_t MSP_GENIVI_MID = 2;
269 /** example value between -10 and +10  */
270 static const am_CustomMainSoundPropertyType_t MSP_GENIVI_BASS = 3;
271
272 /**
273  * The notification types are project specific.
274  */
275 typedef uint16_t am_CustomNotificationType_t;
276 static const am_CustomNotificationType_t NT_UNKNOWN = 0;
277
278 /**
279  * The given ramp types here are just examples. For products, different ramp types
280  * can be defined here. It is in the responsibility of the product to make sure
281  * that the routing plugins are aware of the ramp types used.
282  */
283 typedef uint16_t am_CustomRampType_t;
284 static const am_CustomRampType_t RAMP_UNKNOWN = 0;
285 /** sets directly the value without a ramp */
286 static const am_CustomRampType_t RAMP_GENIVI_DIRECT = 1;
287 /** Sets the volume as fast as possible */
288 static const am_CustomRampType_t RAMP_GENIVI_NO_PLOP = 2;
289 static const am_CustomRampType_t RAMP_GENIVI_EXP_INV = 3;
290 static const am_CustomRampType_t RAMP_GENIVI_LINEAR = 4;
291 static const am_CustomRampType_t RAMP_GENIVI_EXP = 5;
292
293 /**
294  * Within genivi only the some example properties are defined.
295  * For products these should be changed or extended.
296  */
297 typedef uint16_t am_CustomSoundPropertyType_t;
298 static const am_CustomSoundPropertyType_t SP_UNKNOWN = 0;
299 /** example treble value min =-10 max =10 */
300 static const am_CustomSoundPropertyType_t SP_GENIVI_TREBLE = 1;
301 /** example mid value min =-10 max =10 */
302 static const am_CustomSoundPropertyType_t SP_GENIVI_MID = 2;
303 /** example bass value min =-10 max =10 */
304 static const am_CustomSoundPropertyType_t SP_GENIVI_BASS = 3;
305
306 /**
307  * Describes the different system properties which are project specific.
308  */
309 typedef uint16_t am_CustomSystemPropertyType_t;
310 static const am_CustomSystemPropertyType_t SYP_UNKNOWN = 0;
311 ----
312
313 === CommandLine options
314 The commandline options of the AudioManager:
315
316 ----
317 AudioManagerDaemon Version: 3.0.11
318 Usage:  AudioManagerDaemon [options]
319 options:        
320         -h: print this message  
321         -i: info about current settings         
322         -v: print version       
323         -d: daemonize AudioManager      
324         -T: DbusType to be used by CAmDbusWrapper (0=DBUS_SESSION[default], 1=DBUS_SYSTEM)      
325         -p<path> path for sqlite database (default is in memory)        
326         -t<port> port for telnetconnection      
327         -m<max> number of max telnetconnections 
328         -c<Name> use controllerPlugin <Name> (full path with .so ending)        
329         -l<Name> replace command plugin directory with <Name> (full path)       
330         -r<Name> replace routing plugin directory with <Name> (full path)       
331         -L<Name> add command plugin directory with <Name> (full path)   
332         -R<Name> add routing plugin directory with <Name> (full path)   
333 ----    
334
335
336 == Telnet Server
337 The audiomanager has a build- in telnetserver that serves for debuggin purposes.
338 If you compile your AudioManager with TelnetServer support (cmake -DWITH_TELNET=ON), you will be able to 
339 set with commandline argument -t the port number and with -m the maximum supported connections. 
340 The default telnet port is 6060. 
341    
342 .For example, launch a telnet session on port 6060:
343       telnet localhost 6060
344    
345       #>Welcome to GENIVI AudioManager ver-0.0.1-37-ga004215
346       #>
347    
348 .press 'help' to get a list of all supported commands on this level:
349    
350       #>help
351       ####################################################
352       ####### The following commands are supported: ######
353       ####################################################
354       #
355       #exit  - quit telnet session
356       #get   - Go into 'get'-submenu
357       #help  - show all possible commands
358       #info  - Go into 'info'-submenu
359       #list  - Go into 'list'-submenu
360       #set   - Go into 'set'-submenu
361       #
362       #\>
363    
364 .Now type one of these commands, for example 'get', followed with another 'help' to get a list of supported commands:
365    
366       #\>get
367       #
368       #\Get>help
369       ####################################################
370       ####### The following commands are supported: ######
371       ####################################################
372       # 
373       #.. - one step back in menu tree (back to root folder)
374       #exit  - close telnet session
375       #help  - show all possible commands
376       #recv  - show receiverversion 
377       #routing  - show current routing
378       #sendv - show senderversion
379       #
380       #\Get>
381    
382 .You can also execute several commands in a line:
383    
384       #\Get>recv sendv .. help exit
385       #   Receiver versions:
386       #   Ctrl: 1 | Cmd: 1 | Routing: 1
387       #   Sender versions:
388       #   Ctrl: 1 | Cmd: 1 | Routing: 1
389       ####################################################
390       ######## The following commands are supported: ######
391       ####################################################
392       #
393       #exit  - quit telnet session
394       #get   - Go into 'get'-submenu
395       #help  - show all possible commands
396       #info  - Go into 'info'-submenu
397       #list  - Go into 'list'-submenu
398       #set   - Go into 'set'-submenu
399       #
400       #Your wish is my command ... bye!
401       #Connection closed by foreign host.
402
403
404
405 == Code Formatting
406 The source code if formatted with eclipse, the style sheet used can be found in the cmake folder:
407 ----
408 cmake/AudioManager_Codestyle.xml
409 ----
410
411 == Working on the code & contribution
412
413 .First get the code from the git:
414         git clone 
415
416 .Get an overview of all branches:
417         git branch
418
419 .Switch to the branch you want to work on (see versioning schmeme, the master is the feature branch) and verify that it has switched (* changed)
420         git checkout <your branch>
421         git branch
422
423 .Best practice is to create a local branch based on the current branch:
424         git branch working_branch
425
426 Start working, best practice is to commit smaller, compilable peaced during the work that makes it easier to 
427 handle later on.
428
429 .If you want to commit you changes, send them to the audiomanager-dev list, you can create a patch like this:
430         git format-patch working_branch <your branch>
431
432 This creates a set of patches that are published via the mailing list.The patches will be discussed and then merged & uploaded on the git by the maintainer.
433
434 Patches can be accepted either under GENIVI Cla or MPL 2.0 (see section License). Please be sure that the signed-off-by is set correctly. For more, check out http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html
435
436
437
438 ----
439                                             _             _ _       __  __                                   
440                                            / \  _   _  __| (_) ___ |  \/  | __ _ _ __   __ _  __ _  ___ _ __ 
441                                           / _ \| | | |/ _` | |/ _ \| |\/| |/ _` | '_ \ / _` |/ _` |/ _ \ '__|
442                                          / ___ \ |_| | (_| | | (_) | |  | | (_| | | | | (_| | (_| |  __/ |   
443                                         /_/   \_\__,_|\__,_|_|\___/|_|  |_|\__,_|_| |_|\__,_|\__, |\___|_|   
444                                                                                              |___/    
445
446
447
448
449                                                                         QQ
450                                                                         QQ[
451                                                                   qaap
452                                                                   )4W? ayQap
453                                                                        4QQQ[
454                                                               .awQap   ==
455                                                                $WWQF   aaaa,
456                                                                  `    QWQWQQ
457                                                             _aaap=    J?QQP'|
458                                                            qQQWQQ6    -      qyQQQgp
459                                                            )4QQQQ^ .yQQQQ,   QQQQQQQ
460                                                          aa         4QQQW'   )?QQQP'  gmQQma
461                                                        ]QQQQp         .               WQQQQW
462                                                         ????    aQQQ6p    _aQQQQa      "??"+
463                                                        qaaa,   ]QQQQQQ    jQQQQQQf   -aaaap
464                                                       jQQWWQ    )????'    )4QQQQP'   mQWQWQf
465                                                       ]WQQQQ    jaaa                 QQQQQQf
466                                                       )WQQQQ   yQQWWQp    ayQQQap    QQQQQQf
467                                                       )QQQQQ   QQQQQQf   ]QQQQQQQ,   QQQQQQf
468                                                       ]QQQQD   QQQQQQf   ]QQQQQQQ[   QQQQQQf
469                                                         ??':   QQQQQQf   ]QQQQQQQ[   4QQQQQf
470                                                                QQQQQQf   ]QQQQQQQ[   =????'I
471                                                                QQQQQQf   ]QQQQQQQ[
472                                                               .4QQQQQ'   ]QQQQQQQ[
473                                                                 ]??"-    ]QQQQQQQ(
474                                                                          ]4QQQQQ?
475                                                                            :
476
477                             qaayQQQQQQQQQwaa   ]mmmmmmmmmmmmmm  ]mmmmmmg,     ]mmm[  ]mmmm  4mmmg         ymmm' ]mmmm pwLq
478                            jQQQQD???????QWWQf  ]QQQP??????????  ]QQQWQQQQp    ]QQQf  ]QQQQ   4QQQ6.     _yQQQ'  ]QQQQ \!'a'
479                            ]QQQf        )???'  ]QQQ6aaaaaaaaap  ]QQQf)4QQQ6,  ]QQQf  ]QQQQ   |4QQQ6    jmQQQ'v  ]QQQQ
480                            ]QQQ[   ]QQQQWWQQf  ]QQQQQQQWQWQWQf  ]QQQf  ?QQQQa ]QQQf  ]QQQQ    i4QQQ6  qQQQQ'    ]QQQQ
481                            ]QQQ6,   .   qQQQf  ]QQQf            ]QQQf   ]4QQQ6jQQQf  ]QQQQ      4QQQ6gQWQQ'     ]QQQQ
482                             4QQQQQQQQQQQQQQW'  ]QQQQQQWQWQWQWQ  ]QQQf    i?QQQQQQQf  ]QQQQ       ]QQQQQQQ'      ]QQQQ
483                             ++"??????????`     ]""!"""""""""""S ]""!'      ]"""!""'  -""!"        """!""'       ]""!"
484
485
486 ----
487
488