aboutsummaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
AgeCommit message (Collapse)AuthorFilesLines
2018-12-20Add halmap controls events generation for all halflounder_6.0.5flounder_6.0.4flounder/6.0.5flounder/6.0.46.0.56.0.4flounderJonathan Aillet1-3/+58
Each hal will now allow other bindings to subscribe to halmap ALSA controls events to be notified when a modification happened on a control. Bug-AGL: SPEC-1313 Change-Id: Ia6a019b254c78e5e752b0d39a7cf35114c1fc460 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-12-20Add streams events generation for each halJonathan Aillet1-0/+156
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-20Rework calls to mixer streamsJonathan Aillet1-23/+138
When using 'playback'/'capture' verbs, call all associated controls. When at least one stream has been created by the mixer, a verb called 'all-streams' is added to transfer a request to all the streams. Bug-AGL: SPEC-1313 Change-Id: Ie574e2ef0dcae8abbd45523b49093ec2ed1413cf Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-12-20Add 'halmap' controls in hal 'info' verb responseJonathan Aillet1-20/+76
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-12-20Add a function to get values of an alsa controlJonathan Aillet1-1/+1
Rework communication with 'alsacore' binding to be able to get current ALSA controls values. Bug-AGL: SPEC-1313 Change-Id: If1b4b9bdc49849772075e184768f572ac88fe6c3 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-12-20Improve ALSA controls volume values conversionJonathan Aillet1-1/+1
Rework halmap ALSA controls volume conversion to be able to add new types of volume conversions easily. Bug-AGL: SPEC-1313 Change-Id: I0949f25c24a349e7409233f51b3d5738ebc43a8a Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Move mixer attach into its controller sectionJonathan Aillet1-7/+14
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-39/+27
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-08Decrease level of a msg printed in event catcherJonathan Aillet1-5/+5
Decrease level of a message printed in event catcher to avoid polluting debug logs. Change-Id: Id222ddc958f9550da19507537944319888bac016 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Remove boolean libraryJonathan Aillet1-1/+0
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-08Free json objects that should have been freedJonathan Aillet1-8/+21
Free json objects that should have been freed after use. Change-Id: Ifb3dab9672d0c039292ae05f23ade008fe82ade8 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Correct handling of incomming json messagesJonathan Aillet1-2/+5
Correct handling of incomming json messages. An error occured when a received json object was an array containing only one item. Change-Id: I2c6f27f0fd87e11c356b8d4e6bd02d472bc3d60b Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Correct the request return when calling a streamJonathan Aillet1-8/+8
Correct the request return when someone tries to execute an action on a stream. Now, it is successfull if the mixer says so even if no response object was returned. Change-Id: Iee965db3e826ed9040c4b2bf50eaf9090584c1bc Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Optimize alsacore event handlerJonathan Aillet1-18/+14
Optimize alsacore event handler by avoiding generating a string to detect an alsacore event. Change-Id: I7498e99741b2b7095076016143ec8be6520ee122 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Auithorize sending empty json to verbsJonathan Aillet1-4/+2
Auithorize sending empty json to hal-manager 'loaded 'verb and to hal 'info' verb. Change-Id: Id664b0335ad80f88392dd24cd910016deaad25e3 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Return the result of call to mixerJonathan Aillet1-7/+20
Return the response field of mixer reponse to the caller of stream/capture/playback verbs. Force the verbose key in sent object. Change-Id: I5b87da0042c86c6b7dc8853af66cddd2f6819532 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Correct some compilation warningsJonathan Aillet1-1/+1
Correct some compilation warnings that appeared in some gcc versions. Change-Id: I846c573f3128f7d5d5da8b7d2eb1b63dc61af1ab Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Print some errors in info verbsJonathan Aillet1-4/+13
Print errors info when an error happen during call to mixer 'info' verb. Change-Id: Ic3b0b6312743af3ba41a7868d1347ce6b0fcc8cd Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Test 'asprintf' returnJonathan Aillet1-1/+4
Test 'asprintf' return to avoid compilation warning when building with yocto. Change-Id: I322890a149aff86c30afc7a654540d82dc0a8957 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-08Update 4a-hal to work with new 4a-softmixerJonathan Aillet1-50/+89
Update 4a-hal to work with new 4a-softmixer version : - Update audio configuration files to match the configuration format expected by the mixer. - Parse mixer attach response to get information about 'streams', 'playbacks', and 'captures'. store them in new field of controller hal data structure. - Create verb for each returned stream, but only one playback/capture verb even if threre are multiple playbacks/captures returned by the mixer attch verb. - Return 'streams', 'playbacks', and 'captures' when info verb is called. - If info verb is called with a json request, the request is transfered to the mixer. Change-Id: I65593281c34aa91ad87afbf8bebff755cc5cc6d0 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-08Update request success macro used in codeJonathan Aillet1-3/+3
Update request success macro used in code to correct compilation error. Change-Id: I0cb9c07b27000935b01aaaa17d5656f05d4e21ff Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Move mixer attach at hal startupJonathan Aillet1-79/+0
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-08Add value normalization of alsa control valuesJonathan Aillet1-11/+21
Add functions that allows to normalize values that are requested to be sent with an alsa set control call (using alsacore). Change-Id: I5046a66d807c9b9b6751e036a47303ceddc0c16a Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Process and handle alsa controls mapJonathan Aillet1-3/+294
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-08Correct a typo in responsesJonathan Aillet1-2/+2
Correct a typo in responses of the callback that transfer action to mixer. Change-Id: Ic9c33c00367963a6a3d3dbdf21b0e4cad27d0f7d Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Prevent sending data to mixer of hal is not readyJonathan Aillet1-2/+2
Prevent sending data to mixer of hal is not ready. Change-Id: Ie511a5e23760e87336745dbe15d8d2a5e9481518 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Change a comment about what to listJonathan Aillet1-1/+1
Change a comment about what to provide when list verb is called. Add 'playback' and 'capture' to response. Change-Id: I2b663d9a83b18f870dbd7b23be4ef8f41664e25f Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Include afb-definitions when using application frameworkJonathan Aillet1-50/+52
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-08Fix a typo in a debug messageJonathan Aillet1-5/+5
Fix a typo in a debug message. Change-Id: Iee894287f43d74fd72e41faad42f0617c50c0cf8 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Handle hal status using card presence and mixer initJonathan Aillet1-2/+19
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-08Generate an error when mixer initialization failsJonathan Aillet1-6/+6
Generate an error when mixer initialization is correctly transfered to mixer api but an error was raised by it. Change-Id: I617686b0167f9fb536ec56e430d10560e7f7ca31 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Add some missing castJonathan Aillet1-3/+3
Add some missing cast when getting controller hal data structure. Change-Id: I8fdfd7486345e89c4004c071b63890b751305ce2 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Handle app fw call errors in a dedicated functionJonathan Aillet1-3/+3
Two functions has been added in a new file in 4a-hal-utilities : - A function that handle application framework call errors by returning a specific error. - A function that handle application framework call errors from a request. Change-Id: I657773586111adc609cbbaead7db589a82e133b0 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Rename a filed of 'CtlHalStreamData' structureJonathan Aillet1-1/+1
Rename 'cardId' filed to 'streamCardId' in 'CtlHalStreamData' structure. Change-Id: I7615eece39aea6bf6b6aadd3361f58792e6531f6 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-08Correction of list verb when there's no streamsJonathan Aillet1-1/+1
Don't raise an error when list verb is called on a controller hal and there's no streams registered yet. Change-Id: Ie4126673f134ced3e93e1111f988923e4bf13e64 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Fix typo in request reponses of a app fw verbJonathan Aillet1-2/+2
Fix typo in request answers info message send back to application framework after an api verb call. Change-Id: Icbd06fc13d9abff8325145c355b6c8c3c6434e1c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Handle mixer responses correctlyJonathan Aillet1-14/+8
Use a function to handle mixer responses on stream action calls correctly. Before, there was no differencations between responses from api calls that didn't end well. Now, we print a different message if the api/verb is not found and if the request was transfered but an error occured during it. Change-Id: Ib4f9c3cf14b6612cd14762b74466ce484fdfb09d Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Handle mixer response after its initJonathan Aillet1-56/+16
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-08Store uid of the hal mixer configuration and use itJonathan Aillet1-8/+17
Stores uid of the hal mixer configuration in the specific controller hal structure. Use this uid as prefix when calling softmixer api. Change-Id: Iab00518e02e0f9ff6dbd78c126eda45225c55256 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Implementation of 'list' verb for controller halJonathan Aillet1-3/+58
Implementation of function allowing to list streams and controls of a controller hal. Change-Id: Ic347dd89dbbf36056b0fc3c5fe25bd111a85f627 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Parse config to get streams 'halmap' controlsJonathan Aillet1-2/+7
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-08Handle stream calls to transfer to mixer apiJonathan Aillet1-2/+68
Implementation of the function that transfer hal streams calls to mixer api. Change-Id: Icded7e160a1cfbe794c5fa2695bf0f9f54c80a06 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-10-08Add 'init-mixer' verb to hal controllerJonathan Aillet1-0/+59
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-1/+96
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-08Add a 'List' verb to each hal controller apiJonathan Aillet1-0/+38
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>