RDK Documentation (Open Sourced RDK Components)
testGetVideoOutputPorts.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 
20 // TODO: Include your class to test here.
21 
22 
23 /**
24 * @defgroup devicesettings
25 * @{
26 * @defgroup test
27 * @{
28 **/
29 
30 
31 #define BOOST_TEST_MODULE GetVideoOutputPorts
32 #define BOOST_TEST_MAIN
33 #include "boost/test/included/unit_test.hpp"
34 #include <iostream>
35 
36 #include "videoOutputPort.hpp"
37 #include "host.hpp"
38 #include "videoOutputPortConfig.hpp"
39 #include "videoResolution.hpp"
40 #include "frameRate.hpp"
41 #include "audioOutputPort.hpp"
42 #include "audioEncoding.hpp"
43 #include "audioCompression.hpp"
44 #include "audioStereoMode.hpp"
45 #include "audioOutputPortType.hpp"
46 
47 
48 #include "dsUtl.h"
49 #include "dsError.h"
50 #include "dsVideoPort.h"
51 
52 #undef _DS_VIDEOOUTPUTPORTSETTINGS_H
53 #include "dsVideoPortSettings.h"
54 #undef _DS_VIDEORESOLUTIONSETTINGS_H
55 #include "dsVideoResolutionSettings.h"
56 
57 BOOST_AUTO_TEST_CASE(test_VideoOutputPort_get_Methods)
58 {
59  /*
60  * The following code demonstrate how to get the complete audio configuration information for SM.
61  * All audio ports connected to existing Video Ports are traversed.
62  *
63  * Please note current SM only requires information for HDMI port, alghough such requirment is not
64  * indicated in SM's request message.
65  *
66  * Basic relationship:
67  * A host has a list of VideoOutputPorts.
68  * A VideoOutPort has
69  * 1) a VideoOutPortType, that has a list of supported resolutions.
70  * 2) A set of port specific properties.
71  *
72  */
73  try {
75  BOOST_CHECK(vPorts.size() != 0);
76  for (size_t i = 0; i < vPorts.size(); i++) {
77  device::VideoOutputPort port = vPorts.at(i);
78  port.getName();
79  port.isDisplayConnected();
80  //port.isContentProtected();
81  port.isEnabled();
82  port.getResolution(); /* Current Resolution */
83  BOOST_CHECK(port.getResolution().getName() == std::string(kPorts[i].defaultResolution));
84 
85  port.getResolution().getName();
89  port.getResolution().getFrameRate();
90  port.getResolution().isInterlaced();
91 
92  port.getType().getId();
94  port.getType().isDTCPSupported();
95  port.getType().isHDCPSupported();
98  {
99  /* Iterated through supported Resolutions */
100  for (size_t j = 0; j < resolutions.size(); j++) {
101  device::VideoResolution resolution = resolutions.at(j);
102  resolution.getName();
103  resolution.getAspectRatio().toString();
104  resolution.getPixelResolution().toString();
105  resolution.getStereoscopicMode().toString();
106  resolution.getFrameRate();
107  resolution.isInterlaced();
108  }
109  }
110  }
111  }
112  catch(...) {
113  BOOST_CHECK(0);
114  }
115 }
116 
117 BOOST_AUTO_TEST_CASE(testDummy)
118 {
119  BOOST_CHECK(1 == 1);
120 }
121 
122 
123 /** @} */
124 /** @} */
device::VideoOutputPort::getName
const std::string & getName() const
This API gets the name of the VideoOutputPort. The VideoOutputPort names can be HDMI,...
Definition: videoOutputPort.hpp:225
device::VideoResolution::getFrameRate
const FrameRate & getFrameRate() const
This API is used to get the frame rate of the given video output port.
Definition: videoResolution.cpp:172
device::VideoOutputPort::isEnabled
bool isEnabled() const
This API is used to check whether this Video output port is enabled or not.
Definition: videoOutputPort.cpp:398
device::VideoResolution
Class extending DSConstant to implement the videoResolution interface.
Definition: videoResolution.hpp:57
device::Host::getVideoOutputPorts
List< VideoOutputPort > getVideoOutputPorts()
This API is used to get the list of the video output ports supported on the device....
Definition: host.cpp:285
device::VideoOutputPortType::isDTCPSupported
bool isDTCPSupported() const
This API is used to query if DTCP is supported by the port type.
Definition: videoOutputPortType.cpp:258
device::VideoOutputPort::isDisplayConnected
bool isDisplayConnected() const
This API is used to Check if the port is currently connected to any display device.
Definition: videoOutputPort.cpp:381
device::VideoOutputPort
Class extending enumerable to implement the videoooutputport interface.
Definition: videoOutputPort.hpp:59
dsVideoPort.h
device::VideoOutputPortType::isHDCPSupported
bool isHDCPSupported() const
This API is used to query if HDCP is supported by the port type.
Definition: videoOutputPortType.cpp:272
dsError.h
Device Settings HAL error codes.
device::VideoResolution::getStereoscopicMode
const StereoScopicMode & getStereoscopicMode() const
This API is used to get the stereoscopic mode of the given video output port.
Definition: videoResolution.cpp:161
device::List::size
size_t size()
This function gets the size of the container.
Definition: list.hpp:118
dsUtl.h
Device Settings HAL utilities.
device::VideoResolution::isInterlaced
bool isInterlaced() const
This API is used to check the video is interlaced or not.
Definition: videoResolution.cpp:185
device::VideoOutputPort::getType
const VideoOutputPortType & getType() const
This API is used to get the type of the video output port. A type of the video output port represent ...
Definition: videoOutputPort.cpp:265
audioStereoMode.hpp
This file defines AudioStereoMode class for managing audio mode types.
device::VideoOutputPort::getResolution
const VideoResolution & getResolution()
This API is used to get the current video resolution output from the video output port....
Definition: videoOutputPort.cpp:293
device::VideoOutputPortType::isDynamicResolutionsSupported
bool isDynamicResolutionsSupported() const
This function is used to query if dynamic resolutions are supported by the port type.
Definition: videoOutputPortType.cpp:286
videoResolution.hpp
It contains class and structure refrenced by the videoResolution.cpp file.
frameRate.hpp
This file defines FrameRate class to manage the video frame rate types.
device::VideoOutputPortType::getSupportedResolutions
const List< VideoResolution > getSupportedResolutions() const
This API is used to get a list of supported Video Resolutions by the port type.
Definition: videoOutputPortType.cpp:311
device::VideoResolution::getPixelResolution
const PixelResolution & getPixelResolution() const
This API is used to get the pixel format of the given video output port.
Definition: videoResolution.cpp:134
device::DSConstant::getName
virtual const std::string & getName() const
This function is used to the get the data member name.
Definition: dsConstant.hpp:141
videoOutputPort.hpp
It contains class and structure refrenced by the videooutputport.cpp file.
device::DSConstant::toString
virtual const std::string & toString() const
This function is used to the get the data member name in string format.
Definition: dsConstant.hpp:152
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
device::VideoOutputPortType::getRestrictedResolution
int getRestrictedResolution() const
This function is used to get the resolution type which has been restricted from usage.
Definition: videoOutputPortType.cpp:298
device::List< device::VideoOutputPort >
audioOutputPortType.hpp
It contain variables,stuctures,class and functions referenced by audiooutputportType code.
audioOutputPort.hpp
It contain variables,stuctures,class and functions referenced by audiooutputport code.
device::VideoResolution::getAspectRatio
const AspectRatio & getAspectRatio() const
This API is used to get the current Aspect Ratio setting of the Display Device (i....
Definition: videoResolution.cpp:149
audioCompression.hpp
This file defines AudioCompression class for managing audio compression levels.
device::DSConstant::getId
virtual int getId() const
This function is used to get the id.
Definition: dsConstant.hpp:130
audioEncoding.hpp
This file defines AudioEncoding class for managing audio encoding types.