5d65d4a52a23040e7346e0fb4207beb06f58e319
[apps/agl-service-unicens.git] / ucs2-interface / ucs_vol_interf.c
1 /*
2  * Unicens Integration Helper Component
3  *
4  * Copyright (C) 2017 Microchip Technology Germany II GmbH & Co. KG
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  * You may also obtain this software under a propriety license from Microchip.
20  * Please contact Microchip for further information.
21  *
22  */
23 #include <assert.h>
24 #include "ucs_interface.h"
25 #include "libmostvolume.h"
26
27 static UCSI_channelsT ucsiChannels[] = {
28     {.name= "FRONT_LEFT" , .numid= (int)LIB_MOST_VOLUME_CH_FRONT_LEFT},
29     {.name= "FRONT_RIGHT", .numid= (int)LIB_MOST_VOLUME_CH_FRONT_RIGHT},
30     {.name= "REAR_LEFT"  , .numid= (int)LIB_MOST_VOLUME_CH_REAR_LEFT},
31     {.name= "REAR_LEFT"  , .numid= (int)LIB_MOST_VOLUME_CH_REAR_RIGHT},
32     {.name= "CENTER"     , .numid= (int)LIB_MOST_VOLUME_CH_CENTER},
33     {.name= "SUB"        , .numid= (int)LIB_MOST_VOLUME_CH_SUB},
34     {.name= "MASTER"     , .numid= (int)LIB_MOST_VOLUME_MASTER},
35
36     {.name= NULL}
37 };
38
39 // Small wrapper as UCSI and UCSVOL do not use the same handle
40 void UCSI_Vol_Service (UCSI_Data_t *pPriv) {
41     (void)lib_most_volume_service();
42
43 }
44
45 UCSI_channelsT *UCSI_Vol_Init (UCSI_Data_t *pPriv, UCSI_VolumeServiceCB_t serviceCB) {
46     int err;
47     err = lib_most_volume_init(pPriv->unicens, (lib_most_volume_service_cb_t) serviceCB);
48     if (err) return (NULL);
49     else return (ucsiChannels);
50 }
51
52 uint8_t UCSI_Vol_Set(UCSI_Data_t *pPriv, int numid, uint8_t volume) {
53
54     return (lib_most_volume_set((enum lib_most_volume_channel_t)numid, volume));
55 }
56
57