RDK Documentation (Open Sourced RDK Components)
Components_SPDIF.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @file Components_SPDIF.h
22  * @brief The header file provides components SPDIF(Sony/Philips Digital Interface Format) information APIs.
23  */
24 
25 /**
26  * @defgroup TR69_HOSTIF_STBSERVICES_SPDIF TR-069 Object (Device.STBServices.{i}.Components.SPDIF.{i})
27  * A SPDIF component models features of the S/PDIF functionality of the STB. It allows the ACS
28  * to force the audio format to be down mixed into stereo PCM in the case an external audio
29  * amplifier does not support multi-channel audio format decode. It also contains some parameters
30  * to manage the audio delay to preserve lip-sync.
31  * @ingroup TR69_HOSTIF_STBSERVICES
32  *
33  * @defgroup TR69_HOSTIF_STBSERVICES_SPDIF_API TR-069 Object (Device.STBServices.{i}.Components.SPDIF.{i}) Public APIs
34  * Describe the details about RDK TR-069 components SPDIF APIs specifications.
35  * @ingroup TR69_HOSTIF_STBSERVICES_SPDIF
36  *
37  * @defgroup TR69_HOSTIF_STBSERVICES_SPDIF_CLASSES TR-069 Object (Device.STBServices.{i}.Components.SPDIF.{i}) Public Classes
38  * Describe the details about classes used in TR-069 components SPDIF.
39  * @ingroup TR69_HOSTIF_STBSERVICES_SPDIF
40  */
41 
42 /**
43 * @defgroup tr69hostif
44 * @{
45 * @defgroup hostif
46 * @{
47 **/
48 
49 
50 #ifndef DEVSET_COMP_SPDIF_HPP__
51 #define DEVSET_COMP_SPDIF_HPP__
52 
53 #include <iostream>
54 #include "host.hpp"
55 #include "videoDevice.hpp"
56 #include "videoDFC.hpp"
57 #include "manager.hpp"
58 #include "dsUtl.h"
59 #include "dsError.h"
60 #include "list.hpp"
61 #include <exception>
62 #include <string.h>
63 #include <stdlib.h>
64 #include "hostIf_utils.h"
65 #include "hostIf_tr69ReqHandler.h"
66 #include "hostIf_updateHandler.h"
67 #include "hostIf_main.h"
68 #include "audioOutputPort.hpp"
69 
70 #ifndef PARAM_LEN
71 #define PARAM_LEN TR69HOSTIFMGR_MAX_PARAM_LEN
72 #endif
73 
74 
75 /**
76  * @brief This class provides the TR-069 components SPDIF information.
77  * @ingroup TR69_HOSTIF_STBSERVICES_SPDIF_CLASSES
78  */
80 {
81  static GHashTable *ifHash;
84  static GMutex *m_mutex;
85  int dev_id;
87 
88  bool backupEnable;
89  char backupStatus[_BUF_LEN_16];
90  bool backupForcePCM;
91  bool backupPassthrough;
92  unsigned backupAudioDelay;
93 
94  bool bCalledEnable;
95  bool bCalledStatus;
96  bool bCalledAlias;
97  bool bCalledName;
98  bool bCalledForcePCM;
99  bool bCalledPassthrough;
100  bool bCalledAudioDelay;
101 
102 private:
103  int setEnable(HOSTIF_MsgData_t *stMsgData);
104  int setAlias(HOSTIF_MsgData_t *stMsgData);
105  int setForcePCM(HOSTIF_MsgData_t *stMsgData);
106 
107  int getEnable(HOSTIF_MsgData_t *stMsgData, bool *pChanged = NULL);
108  int getStatus(HOSTIF_MsgData_t *stMsgData, bool *pChanged = NULL);
109  int getAlias(HOSTIF_MsgData_t *stMsgData, bool *pChanged = NULL);
110  int getName(HOSTIF_MsgData_t *stMsgData, bool *pChanged = NULL);
111  int getForcePCM(HOSTIF_MsgData_t *stMsgData, bool *pChanged = NULL);
112  int getPassthrough(HOSTIF_MsgData_t *stMsgData, bool *pChanged = NULL);
113  int getAudioDelay(HOSTIF_MsgData_t *stMsgData, bool *pChanged = NULL);
114 
115 public:
116  static hostIf_STBServiceSPDIF *getInstance(int devid);
117  static void closeInstance(hostIf_STBServiceSPDIF *);
118  static GList* getAllInstances();
119  static void closeAllInstances();
120  static void getLock();
121  static void releaseLock();
122  static int getNumberOfInstances(HOSTIF_MsgData_t *stMsgData);
123  void doUpdates(updateCallback mUpdateCallback);
124  int handleSetMsg(const char *paramName, HOSTIF_MsgData_t *stMsgData);
125  int handleGetMsg(const char *paramName, HOSTIF_MsgData_t *stMsgData);
126 
127 };
128 #endif /* DEVSET_COMP_AUDIOOUTPUT_HPP_ */
129 
130 
131 /** @} */
132 /** @} */
hostIf_STBServiceSPDIF::doUpdates
void doUpdates(updateCallback mUpdateCallback)
This function updates the SPDIF interface updates such as Enable, Status, Alias, Name,...
Definition: Components_SPDIF.cpp:252
hostIf_STBServiceSPDIF
This class provides the TR-069 components SPDIF information.
Definition: Components_SPDIF.h:79
manager.hpp
It contains class referenced by manager.cpp file.
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
hostIf_STBServiceSPDIF::handleGetMsg
int handleGetMsg(const char *paramName, HOSTIF_MsgData_t *stMsgData)
This function get the SPDIF interface updates such as Enable, Status, Alias, Name,...
Definition: Components_SPDIF.cpp:210
dsError.h
Device Settings HAL error codes.
hostIf_main.h
hostIf_main API.
dsUtl.h
Device Settings HAL utilities.
device::AudioOutputPort
Class extending Enumerable to implement the audiooutputport interface.
Definition: audioOutputPort.hpp:60
videoDevice.hpp
It contains class referenced by videoDevice.cpp file.
hostIf_STBServiceSPDIF::handleSetMsg
int handleSetMsg(const char *paramName, HOSTIF_MsgData_t *stMsgData)
This function set the SPDIF interface updates such as Enable, Status, Alias, Name,...
Definition: Components_SPDIF.cpp:187
audioOutputPort.hpp
It contain variables,stuctures,class and functions referenced by audiooutputport code.
videoDFC.hpp
This file defines VideoDFC class for managing video decoder format conversion types.
hostIf_STBServiceSPDIF::hostIf_STBServiceSPDIF
hostIf_STBServiceSPDIF(int dev_id, device::AudioOutputPort &port)
Class Constructor of the class hostIf_STBServiceSPDIF.
Definition: Components_SPDIF.cpp:150