3 :Author: Christian Linke <christian.linke@bmw.de>
4 :doctitle: GENIVI_AudioManager
8 Copyright (C) 2012, GENIVI Alliance, Inc.
9 Copyright (C) 2012, BMW AG
11 This file is part of GENIVI Project AudioManager.
13 Contributions are licensed to the GENIVI Alliance under one or more
14 Contribution License Agreements or MPL 2.0 .
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/.
21 author Christian Mueller, christian.linke@bmw.de BMW 2011,2012
23 For further information see http://projects.genivi.org/audio-manager/.
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
31 Contribution is done under GENIVI CLA or MPL2.0.
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.
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.
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.
49 A very detailed documentation is provided by doxygen. In order to use this, please compile the AudioManager with
51 cmake -DWITH_DOCUMENTATION=ON
58 These are the compile options with default values:
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
67 WITH_COMMAND_INTERFACE_COMMON_ ON
68 WITH_DATABASE_STORAGE OFF
74 WITH_OXF_ANIMATION 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
84 WITH_TEST_CONTROLLER OFF
86 gtest_build_samples OFF
88 gtest_disable_pthreads OFF
89 gtest_force_shared_crt OFF
91 === Passing options to cmake:
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.
96 .-DDBUS_SERVICE_PREFIX="XXX"
97 sets the service prefix for Dbus, default "org.genivi.audiomanager\0"
99 .-DDBUS_SERVICE_OBJECT_PATH="XXX"
100 sets the object path for Dbus, default "/org/genivi/audiomanager\0"
102 .-DDEFAULT_TELNETPORT="XXX"
103 sets the default telnetport, default 6060. Can be overwriten by command line parameter
105 .-DMAX_TELNETCONNECTIONS="XXX"
106 sets the default maximum number of telnetconnections, default is 3
109 sets the path of the NSM DBUS interface
111 .-DNSM_INTERFACE="XXX"
112 sets the interface to the NSM DBUS interface
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)
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,
121 You will need optionally fullfill some dependencies in order to comile the GENIVI AudioManager Daemon, these are:
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/
129 To install them in a build environment like Ubuntu you can use:
131 sudo apt-get install libdbus-1-dev libsqlite3-dev doxygen git cmake build-essential
134 === The NodeStateManager
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
141 sudo make install-includeHEADERS
144 For building the tests, you will need the following packages:
146 * python [tested on version 2.6, should work on higher versions as well]
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:
151 sudo apt-get install python2.6-dev
154 For compiling, you will need a compiler, linker etc. On most linux systems you will get this via
156 sudo apt-get install build-essential
159 More details in the CMake Files CmakeList.txt in the projects.
162 To compile open a shell, browse to the AudioManager folder and
170 After the script finished, you should have:
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
176 In order to install the AudioManager, you can do
181 Package generation is supported via CPack. To build packages, you have to
186 This will create one package if your CMake version is < 2.8.5 (all binaries stripped):
188 AudioManager-<git verison>-Linux.deb
191 If your version is above 2.8.5, you will get 4 packages (all binaries stripped) :
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]
198 In order to create a tar.gz file of all sources (not including .git, build and bin folder,config files), you can do:
203 This will create the following package:
204 'AudioManager-<git verison>-Source.tar.gz'
206 All packages will be placed in a folder called packages
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.
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.
214 .The are already examples given in audiomanagertypes.h:
217 * This type gives the information about reason for Source/Sink change
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;
235 * This is a custom specific identifier of property. It can be used to
236 * differentiate between interrupt source/sink, main source/sink, etc.
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;
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
248 typedef uint16_t am_CustomConnectionFormat_t;
249 static const am_CustomConnectionFormat_t CF_UNKNOWN = 0;
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;
260 * Here are all SoundProperties that can be set via the CommandInterface.
261 * This type is product specific and can be changed or extended.
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;
273 * The notification types are project specific.
275 typedef uint16_t am_CustomNotificationType_t;
276 static const am_CustomNotificationType_t NT_UNKNOWN = 0;
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.
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;
294 * Within genivi only the some example properties are defined.
295 * For products these should be changed or extended.
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;
307 * Describes the different system properties which are project specific.
309 typedef uint16_t am_CustomSystemPropertyType_t;
310 static const am_CustomSystemPropertyType_t SYP_UNKNOWN = 0;
313 === CommandLine options
314 The commandline options of the AudioManager:
317 AudioManagerDaemon Version: 3.0.11
318 Usage: AudioManagerDaemon [options]
320 -h: print this message
321 -i: info about current settings
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)
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.
342 .For example, launch a telnet session on port 6060:
343 telnet localhost 6060
345 #>Welcome to GENIVI AudioManager ver-0.0.1-37-ga004215
348 .press 'help' to get a list of all supported commands on this level:
351 ####################################################
352 ####### The following commands are supported: ######
353 ####################################################
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
364 .Now type one of these commands, for example 'get', followed with another 'help' to get a list of supported commands:
369 ####################################################
370 ####### The following commands are supported: ######
371 ####################################################
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
382 .You can also execute several commands in a line:
384 #\Get>recv sendv .. help exit
386 # Ctrl: 1 | Cmd: 1 | Routing: 1
388 # Ctrl: 1 | Cmd: 1 | Routing: 1
389 ####################################################
390 ######## The following commands are supported: ######
391 ####################################################
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
400 #Your wish is my command ... bye!
401 #Connection closed by foreign host.
406 The source code if formatted with eclipse, the style sheet used can be found in the cmake folder:
408 cmake/AudioManager_Codestyle.xml
411 == Working on the code & contribution
413 .First get the code from the git:
416 .Get an overview of all branches:
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>
423 .Best practice is to create a local branch based on the current branch:
424 git branch working_branch
426 Start working, best practice is to commit smaller, compilable peaced during the work that makes it easier to
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>
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.
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
440 / \ _ _ __| (_) ___ | \/ | __ _ _ __ __ _ __ _ ___ _ __
441 / _ \| | | |/ _` | |/ _ \| |\/| |/ _` | '_ \ / _` |/ _` |/ _ \ '__|
442 / ___ \ |_| | (_| | | (_) | | | | (_| | | | | (_| | (_| | __/ |
443 /_/ \_\__,_|\__,_|_|\___/|_| |_|\__,_|_| |_|\__,_|\__, |\___|_|
459 )4QQQQ^ .yQQQQ, QQQQQQQ
460 aa 4QQQW' )?QQQP' gmQQma
462 ???? aQQQ6p _aQQQQa "??"+
463 qaaa, ]QQQQQQ jQQQQQQf -aaaap
464 jQQWWQ )????' )4QQQQP' mQWQWQf
466 )WQQQQ yQQWWQp ayQQQap QQQQQQf
467 )QQQQQ QQQQQQf ]QQQQQQQ, QQQQQQf
468 ]QQQQD QQQQQQf ]QQQQQQQ[ QQQQQQf
469 ??': QQQQQQf ]QQQQQQQ[ 4QQQQQf
470 QQQQQQf ]QQQQQQQ[ =????'I
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 ]""!' ]"""!""' -""!" """!""' ]""!"