From 5770713075119f42d3486fa8db616efa8231a336 Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Mon, 10 Dec 2018 17:18:01 +0100 Subject: Rename unicens plugin as output unicens plugin Move all files according plugin name changes. Update cmake files. Update unicens configuration file. Change-Id: I468430dfbc885ec0bfa03a179a9dd4f14de3f1d0 Signed-off-by: Jonathan Aillet --- plugin/unicens-output/ucs2-vol/src/setup.cpp | 96 ++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 plugin/unicens-output/ucs2-vol/src/setup.cpp (limited to 'plugin/unicens-output/ucs2-vol/src/setup.cpp') diff --git a/plugin/unicens-output/ucs2-vol/src/setup.cpp b/plugin/unicens-output/ucs2-vol/src/setup.cpp new file mode 100644 index 0000000..ad841ab --- /dev/null +++ b/plugin/unicens-output/ucs2-vol/src/setup.cpp @@ -0,0 +1,96 @@ +/* + * libmostvolume example + * + * Copyright (C) 2017 Microchip Technology Germany II GmbH & Co. KG + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * You may also obtain this software under a propriety license from Microchip. + * Please contact Microchip for further information. + * + */ +#include +#include "setup.h" + +CSetup* CSetup::_instance = NULL; + +// singleton +CSetup* CSetup::GetInstance() { + if (_instance == NULL) { + _instance = new CSetup(); + } + + return _instance; +} + +// singleton +void CSetup::Release() { + if (_instance != NULL) { + delete _instance; + } + _instance = NULL; +} + +CSetup::CSetup() + : _volume_amp_270_m(0x270U, DEVICE_VAL_MASTER, LIB_MOST_VOLUME_MASTER, true), + _volume_amp_270_l(0x270U, DEVICE_VAL_LEFT, LIB_MOST_VOLUME_CH_FRONT_LEFT, true), + _volume_amp_270_r(0x270U, DEVICE_VAL_RIGHT, LIB_MOST_VOLUME_CH_FRONT_RIGHT, true), + _volume_amp_271_m(0x271U, DEVICE_VAL_MASTER, LIB_MOST_VOLUME_MASTER, true), + _volume_amp_271_l(0x271U, DEVICE_VAL_LEFT, LIB_MOST_VOLUME_CH_REAR_LEFT, true), + _volume_amp_271_r(0x271U, DEVICE_VAL_RIGHT, LIB_MOST_VOLUME_CH_REAR_RIGHT, true), + _volume_amp_272_m(0x272U, DEVICE_VAL_MASTER, LIB_MOST_VOLUME_MASTER, true), + _volume_amp_272_l(0x272U, DEVICE_VAL_LEFT, LIB_MOST_VOLUME_CH_CENTER, true), + _volume_amp_272_r(0x272U, DEVICE_VAL_RIGHT, LIB_MOST_VOLUME_CH_SUB, true), + _volume_amp_510_m(0x510U, DEVICE_VAL_FIBERDYNE_MASTER, LIB_MOST_VOLUME_MASTER, false), + _value_container() +{ + static CDeviceValue* value_list[10] = { &_volume_amp_270_m, + &_volume_amp_270_l, + &_volume_amp_270_r, + &_volume_amp_271_m, + &_volume_amp_271_l, + &_volume_amp_271_r, + &_volume_amp_272_m, + &_volume_amp_272_l, + &_volume_amp_272_r, + &_volume_amp_510_m}; + + _value_container.RegisterValues(value_list, 10U); +} + +CSetup::~CSetup() +{ + +} + +void CSetup::Configure(lib_most_volume_init_t *init_ptr) +{ + this->init_data = *init_ptr; + _value_container.AssignService(&this->init_data); +} + +void CSetup::SetVolume(enum lib_most_volume_channel_t channel, uint8_t volume) +{ + _value_container.SetValue((uint16_t)channel, volume); +} + +void CSetup::Update() +{ + _value_container.Update(); +} + +void CSetup::SetNodeAvailable(uint16_t address, bool available) +{ + _value_container.ChangeNodeAvailable(address, available); +} -- cgit 1.2.3-korg