RDK Documentation (Open Sourced RDK Components)
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
setAudioEnable.cpp
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 // TODO: Include your class to test here.
20 
21 
22 /**
23 * @defgroup devicesettings
24 * @{
25 * @defgroup sample
26 * @{
27 **/
28 
29 
30 #include "videoOutputPort.hpp"
31 #include "videoOutputPortType.hpp"
32 #include "host.hpp"
33 #include "audioOutputPort.hpp"
34 #include "dsUtl.h"
35 #include "dsError.h"
36 #include "stdlib.h"
37 #include "manager.hpp"
38 
39 
40 
41 #include "libIBus.h"
42 
43 
44 #include <string>
45 
46 
47 
48 int main(int argc, char *argv[])
49 {
50 
51  IARM_Bus_Init("SetAudioEnable");
53 
55 
56 
57  if (argc != 4) {
58  printf("%s : <Port Type - HDMI, SPDIF > <Port Number-0, 1, 2...> <Enable-1 or Disable-0>\r\n", argv[0]);
59  return 0;
60  }
61 
62  char *portType = argv[1];
63  char *portId = argv[2];
64  bool toEnable = (bool) atoi((const char *)argv[3]);
65 
66  try {
67 
68  device::VideoOutputPort vPort = device::Host::getInstance().getVideoOutputPort(std::string(portType).append(portId));
69 
70  if(toEnable)
71  {
72  vPort.getAudioOutputPort().enable();
73  printf("Enable the Audio Port..\r\n");
74  }
75  else
76  {
77  vPort.getAudioOutputPort().disable();
78  printf("Disable the Audio Port..\r\n");
79  }
80 
81  printf("\t Audio Port Status - [%s]\r\n",vPort.getAudioOutputPort().isEnabled()? "On" : "Off");
82 
83  printf("Sample Application: set Audio Mute is completed\r\n");
84  }
85  catch (...) {
86  printf("Exception Caught during [%s]\r\n", argv[0]);
87  }
88 
91  IARM_Bus_Term();
92 
93  return 0;
94 }
95 
96 
97 /** @} */
98 /** @} */
device::AudioOutputPort::isEnabled
bool isEnabled() const
This API is used to check whether the audio is enabled or not.
Definition: audioOutputPort.cpp:549
device::AudioOutputPort::enable
void enable()
This API is used to enable the Audio output port.
Definition: audioOutputPort.cpp:304
IARM_Bus_Term
IARM_Result_t IARM_Bus_Term(void)
This API is used to terminate the IARM-Bus library.
device::VideoOutputPort
Class extending enumerable to implement the videoooutputport interface.
Definition: videoOutputPort.hpp:59
manager.hpp
It contains class referenced by manager.cpp file.
dsError.h
Device Settings HAL error codes.
dsUtl.h
Device Settings HAL utilities.
IARM_Bus_Disconnect
IARM_Result_t IARM_Bus_Disconnect(void)
This API disconnect Application from IARM Bus so the application will not receive any IARM event or R...
videoOutputPortType.hpp
It contains structures and class referenced by the videoOutputportTypes.cpp file.
device::Manager::Initialize
static void Initialize()
This API is used to initialize the Device Setting module. Each API should be called by any client of ...
Definition: manager.cpp:97
libIBus.h
RDK IARM-Bus API Declarations.
videoOutputPort.hpp
It contains class and structure refrenced by the videooutputport.cpp file.
device::VideoOutputPort::getAudioOutputPort
AudioOutputPort & getAudioOutputPort()
This API is used to get the audio output port connected to the video output port. This connection is ...
Definition: videoOutputPort.cpp:280
device::Manager::DeInitialize
static void DeInitialize()
This API is used to deinitialize the device settings module. DeInitialize() must be called to release...
Definition: manager.cpp:138
device::Host::getVideoOutputPort
VideoOutputPort & getVideoOutputPort(const std::string &name)
This API is used to get the reference to the video output port by its name. The name of the port must...
Definition: host.cpp:350
device::Host::getInstance
static Host & getInstance(void)
This API is used to get a reference to the single instance of the Host object.
Definition: host.cpp:88
IARM_Bus_Connect
IARM_Result_t IARM_Bus_Connect(void)
This API is used to connect application to the IARM bus daemon. After connected, the application can ...
Definition: iarmMgrMocks.cpp:33
audioOutputPort.hpp
It contain variables,stuctures,class and functions referenced by audiooutputport code.
IARM_Bus_Init
IARM_Result_t IARM_Bus_Init(const char *name)
This API is used to initialize the IARM-Bus library.
Definition: iarmMgrMocks.cpp:38