summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
AgeCommit message (Collapse)AuthorFilesLines
2019-05-24Clarify internals hal functions and files namesJonathan Aillet1-243/+0
The purpose of this commit is to have of a more standard way to name files and functions used to generate/handle hal api (generated from hal json configuration file). It occurred to me that 'hal-controller' was not a good name because it is harder for people who don't know about the app-controller to understanded what is the purpose of these files/functions. It was renamed to 'internal-hal' because it's about hal that are all handle/load by hal-manager in opposition of external-hal that are independant binding/binder that can register themselves to hal-manager. BUG-AGL: SPEC-2329 Change-Id: I11b7efe64ec474b004a2a15ed8969b9db95d428f Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-22Clarify use of linked listJonathan Aillet1-1/+1
Clarify use of linked list by renaming some variables and functions. BUG-AGL: SPEC-2329 Change-Id: I21ada0b2914c99dfeecfcb6b55c8976dee1a0cd7 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-01-28Move from controller functions to afb functionsJonathan Aillet1-22/+20
Move from controller 'afb-definitions.h' functions to application framework 'afb/afb-binding.h' functions. Change-Id: I4cd62af881ef8ac949b082ede9dfcc4736d1e12c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-01-28Add event to indicate hal stream changesJonathan Aillet1-0/+4
This event can be used to be notified when a stream has been added/removed from hal. Change-Id: I0511b948accf4d3dc25e5603cbaaf5f1da741b49 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-01-28Use linked-list to handle hal stream listJonathan Aillet1-2/+0
Use linked-list instead of an array to handle hal stream list. Usefull to add/remove dynamic stream (e.g. bluetooth). Change-Id: I39bbf0f16941f1c4642c916fdc5143a683c6460c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-01-28Turn '4a-hal-utilities' into an internal libraryJonathan Aillet1-1/+1
That way, includes will be cleaner and '4a-hal-utilities' functions will be usable in plugin. Change-Id: I8a2146bd4e5dd5ef449b9ba7f2b1eed4d59045d3 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-12-20Remove old comments not true anymoreJonathan Aillet1-1/+0
Remove old comments not true anymore about moving to application framewrok v3 functions but it has already be done some weeks ago. Change-Id: Ia5dfc7a47d9e9eb929fa6c79fa37686206131301 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-12-20Add streams events generation for each halJonathan Aillet1-0/+2
Each hal will now have subscribe/unsubscribe verbs to allow other bindings to be notified when a modification (volume, mute, ...) happened on a stream. Bug-AGL: SPEC-1313 Change-Id: If68d3b4b4e39385c1fffdd04b9f3e2b7fa5ae108 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-12-20Add 'halmap' controls in hal 'info' verb responseJonathan Aillet1-1/+1
Add 'halmap' controls verbs (specified in json configuration file) in the response of verb 'info'. Bug-AGL: SPEC-1313 Change-Id: I4e7ec5c3d23fd505da1eb233c1da63708024912d Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-11-27Move hal controls actions at the end of hal initJonathan Aillet1-1/+1
Move hal controls actions at the end of hal initialization to avoid calling halmap controls before handling controller actions (onload, events). Change-Id: Id3896b9497985d7a82242d719551a507a0ca74c5 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-11-02Use new ctl functions to set/get ctl external dataJonathan Aillet1-2/+2
Use new controller functions to set/get controller configuration structure external data field. Change-Id: I0e1ce259fccbbd8b4054efbed07cef5c5b9243b5 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-11-02Force each hal to have its own ctl section dataJonathan Aillet1-2/+6
Force each hal api to have its own controller section data, it is very usefull if different hals don't have the same onload/events/... actions. Change-Id: Iaf3c2059a774ef8ec4f7262064d1cfa8d8159d91 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-11-02Use ctl defines to call afb functionsJonathan Aillet1-7/+7
Use controller 'afb-defintions.h' defines to call application framework functions. Change-Id: If9599b0397a593440ce2e08f039dc279c63f7428 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Move hal sections callbacks after plugin callbackJonathan Aillet1-2/+2
Into the controller section array, move hal sections callbacks after plugin callback so it will be executed before everything else. Change-Id: Id80063caae3b089e6ccef79a7b54a82b16600375 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Move mixer attach into its controller sectionJonathan Aillet1-10/+2
As the mixer section is obtained during a call of a controller section callback (during api pre-initilization), 'attach' call to 'mixer' has been moved in the same callback (called a second time during api initialization). Change-Id: I17f54aab1b9616649bfcb183297ba8128621a7c2 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Remove unnecessary 'function' string in printsJonathan Aillet1-7/+7
Function's names was printed using '__func__' when calling application framework prints functions. But, as the application framework prints functions already prints them, '__func__' has been removed from print calls to avoid duplicated information. Change-Id: I0dea49a9d84b7ccdbdaecec67ced6c98b5ed26d6 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Force hals init before ending hal-manager initJonathan Aillet1-1/+2
Force launched hals initialization before ending hal-manager initialization. This way, external api requiring 'hal-manager' will be sure that all launched hals are initialized. Change-Id: I00b9b14da623828d7cf7bc507873ad6de8ba2391 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Remove boolean libraryJonathan Aillet1-2/+1
As it was almost never used in code, remove boolean library. Change-Id: I9264ffd5600a7d9526f4f4cfa8209a0cd0e5bb77 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Authorize launching 4a-hal with no config fileJonathan Aillet1-3/+3
Now, even if no json audio configuration files are found at binding launch, it won't fails to initialize and will be reachable nethertheless. Change-Id: If7dd0798ef4b262eda98c5dbcc7dd6d9b1b108b5 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Delay event parsing to be the lastJonathan Aillet1-13/+18
Delay event parsing to be the last. This is to avoid receiving events before everything is parsed. Do some minor layout changes. Change-Id: I0fd3f8d387c27471657c58ca8c4ea5828c002e23 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Call onload section to before halmap sectionJonathan Aillet1-3/+3
Call onload section to before halmap section. This will be usefull if we want to execute action before the first alsa calls. Change-Id: Ia1b6428d322fb94538fee7b69b4886ab419a597c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Move onload section parsing lastJonathan Aillet1-1/+1
To avoid onload action to be launch before the configuration sets in other sections, parse onload section last. Change-Id: Icdc77239a9784e559bd9df130d3dc63c7ba5801b Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Revert "Move controller config exec before onload action"Jonathan Aillet1-8/+4
This reverts commit 19080e452e5ae909f64e09a4edfe9c57fbac43a4. Change-Id: I82c8f0a867a20995443f0cd600d5118ee9e3128d Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Correct some compilation warningsJonathan Aillet1-3/+3
Correct some compilation warnings that appeared in some gcc versions. Change-Id: I846c573f3128f7d5d5da8b7d2eb1b63dc61af1ab Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Use structure defined in controller to load verbsJonathan Aillet1-1/+3
Use structure defined in controller to load verbs into an api using 'HalUtlLoadVerbs' function. Change-Id: I57aabf9ce2c580fc98b7ea8438cd01083e032ac2 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Rename files handling call/response of mixerJonathan Aillet1-1/+1
Rename files handling call/response of mixer. Change-Id: I070f109e2f0249b74548ae7dc7b84793926cb261 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Change name of 'list' verb to 'info'Jonathan Aillet1-1/+1
Change name of 'list' verb to 'info'. Change-Id: I9062344b67cc2c19bce9a34d4ac7abfc1baa9428 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Move controller config exec before onload actionJonathan Aillet1-4/+8
Before, the onload action specified in the audio configuration file (see controller documention) was exectued before the sections configuration execution call. So, the onload action was launched before the hal was ready. Now, onload action is launched last. Change-Id: I05d46622b938ae5a818bd404779a2263ed334397 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Return an error when hal attach to mixer fails.Jonathan Aillet1-1/+3
Return an error when hal is not successfully attach to mixer. Change-Id: Ibfacf405153e87d8005feba17f963b2f49caad7a Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Change paramters in functions handling hal dataJonathan Aillet1-1/+1
Change paramters in functions handling hal data structure. Now, the only thing you need to add/search for/remove something in hal data structure list is the address of the first element of the list instead of the address of the whole hal manager data structure. Change-Id: Iafa7428735c3aa418a6ef6564f9acde8f44e7dfe Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Move mixer attach at hal startupJonathan Aillet1-2/+7
Move mixer attach at hal startup instead of making attachment possible only with a verb. Now, if the hal audio device is detected at startup, it will automatically be attached to the mixer. As it is useless now, the verb used to attach mixer has been deleted. Change-Id: I32c8b829ac37fb31ede4fe8830a6f2a699c0835c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Process and handle alsa controls mapJonathan Aillet1-1/+1
Process and handle alsa controls map by : Parse and store info from 'halmap' section into a structure. If the hal is available : - Test if controls are available (if use of existing control). - Create new controls (if use of control to create). - Add a verb for each element of the section. - Handle call to alsa when a verb request is detected. - Resgister to event from this device. - Handle call to action if event on this control is detected. Change-Id: I246e16e9d02e64a1778f5c78d2458a33bdfb6d7e Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Remove an unnecessary variableJonathan Aillet1-3/+2
Remove an unnecessary variable because it was used to get the result of a function call and to test this result (in a 'if' statment). So, to remove it, function was put directly into the 'if' statment. Change-Id: Ie79caa35b0873c6ec7cfdb19a25a3506c0082e53 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Change the field name use to store card pathJonathan Aillet1-2/+2
Change the field name use to store card path into controller hal data structure. Change-Id: I4413a4e5550f3122055db4c6184907d8be407ceb Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Use a boolean to set if api is internalJonathan Aillet1-1/+1
Use a boolean to set if api is internal. Change-Id: Ife5b8e052cf416205aca73c270bfb4b131be3656 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Change the way to get card id using its pathJonathan Aillet1-3/+5
Change the way to get card id using its path by returning directly the found card id. Corrects a typo in alsa core link header. Change-Id: Ib202632e049921a57428b31a29f7def4d9e78aaa Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Change some comments to add TBD thingsJonathan Aillet1-2/+2
- Change some comments from TODO to TDB. - Remove 'JAI' from warning messages. Change-Id: Ib2c39d4e0f0ca34929237ab8ca3d66c9c0d269d0 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Include afb-definitions when using application frameworkJonathan Aillet1-11/+11
Include <afb-definitions.h> from 'app-controller' instead of <afb/afb-binding.h> and use its definitions. It allows to migrate from an application framework version to another with less impact on the code. Change-Id: I22359cd3fe22145b3d6c551f227be2ba7e1b65d5 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Correct a debug warning about a variableJonathan Aillet1-1/+1
Correct a debug warning about a uninitialized variable. Change-Id: I94b8a5ba42013dd0ede5706a1646a61d58e7ef73 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Handle hal status using card presence and mixer initJonathan Aillet1-3/+6
Test audio card presence at hal startup using alsacore call. Handling a new state of hal. Move alsacore link files into 4a-hal-controllers. Check state of hal before mixer initialization call. Actualize hal state if mixer initlialization ends well. Add a sndCardId filed to 'SpecificHalData' structure which will contain audio card if (from alsa). Change-Id: I2e82a14ee6ba6e63f06fe2b498587783941b7b98 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Correct date in .c and .h filesJonathan Aillet1-1/+1
Set file creation date to 2018 instead of 2016. Change-Id: I0349bbc1dde097f899d9b38dd28b3891f88020ad Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Handle mixer response after its initJonathan Aillet1-0/+2
Handle mixer response to get created streams and them corresponding card ids after mixer initialization. Store these informations into the controller hal data strucure. Creation of a verb for each stream is now handle at response handling. Remove unnecessary function because we don't need to search for a stream by his name. Change-Id: Id9e598668b071ca18d152b57e71109314025f698 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Don't seal hal controller api at its initJonathan Aillet1-2/+0
To be able to declare new verbs for controller hal dynamic api, don't seal this api after its initialization. Change-Id: I0fd028034ef2f409eceae05b642c74163b26e332 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Parse config to get streams 'halmap' controlsJonathan Aillet1-1/+1
Parse controller config to get 'halmap' controls, these controls are inside 'halmap' section of controller configuration file. Change-Id: I71fb8494927cf05d9751a69fede4b7622921c6c2 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Add 'init-mixer' verb to hal controllerJonathan Aillet1-1/+2
Add creation of 4a-softmixer mixer as hal controller verb called 'init-mixer'. This verb sends json mixer configration to mixer api. Add a forgotten cast. Change-Id: Id4ca6b68caf21c74fb6b17b953d8db2f2db0c04b Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Parse controller config to get halmixer json objectJonathan Aillet1-0/+2
Parse controller configuration to get halmixer json object, this object is inside 'halmixer' section of controller configuration file. Use streams defined in this 'halmixer' section to get available streams of this hal, store them, and declare them as hal api verbs. Change-Id: I47adb2756f89f2a84c8d651ba38ecea5b84079c3 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Use a structure to store ctl hal specific dataJonathan Aillet1-3/+8
To avoid multiple variables at NULL in specific hal data, use a structure to store all controller hal specific data. These data won't be use if the hal is external (registered). Example of controller hal specific data : - Mixer api name - Mixer initialization json - Mixer streams names and card id ... Change-Id: Ifc4823d5ea21ed408b4ecc25b870cad74d3b2173 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Rename function used to load verbs into a dynamic apiJonathan Aillet1-1/+1
Rename function used to load verbs into a dynamic api from 'HalUtlLoadStaticVerbs' to 'HalUtlLoadVerbs' because it is used to load not only static verbs. Change-Id: Idc033ccf0a8e7556e0809e8fa3554d09d0e81d39 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Remove the 'ping' of each hal controller apiJonathan Aillet1-2/+0
Remove the 'ping' verb of each hal controller api which won't be useful anymore. Rename action in configuration file to be able ping an api nevertheless. Change-Id: I5b1ce8f8cd83dc3e689c3bd676244477921ba20d Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Add a 'List' verb to each hal controller apiJonathan Aillet1-0/+2
Add a 'List' verb to each hal controller api which will list verbs available for this api. The callback of the verb is not implemented yet. Change-Id: Ibc44ef8673267b0b952b32fb256214452aa3c000 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>