RDK Documentation (Open Sourced RDK Components)
dsDisplay.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 dsDisplay.h
22  */
23 
24 
25 
26 /**
27 * @defgroup devicesettings
28 * @{
29 * @defgroup hal
30 * @{
31 **/
32 
33 
34 #ifndef _DS_VIDEODISPLAY_H_
35 #define _DS_VIDEODISPLAY_H_
36 
37 #include "dsError.h"
38 #include "dsTypes.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 
45 /**
46  * @enum typedef enum _dsDisplayEvent_t
47  * @brief This enumeration defines standard display event types.
48  * @note Vendors, please add appropriate events needed for your implementation.
49  */
50 typedef enum _dsDisplayEvent_t {
51  dsDISPLAY_EVENT_CONNECTED = 0, //!< Display connected event.
52  dsDISPLAY_EVENT_DISCONNECTED, //!< Display disconnected event.
53  dsDISPLAY_RXSENSE_ON, //!< Rx Sense ON event
54  dsDISPLAY_RXSENSE_OFF, //!< Rx Sense OFF event
55  dsDISPLAY_HDCPPROTOCOL_CHANGE, //!< HDCP Protocol Version Change event
56 
57  dsDISPLAY_EVENT_MAX
58 } dsDisplayEvent_t;
59 
60 
61 /** @addtogroup DSHAL_DISPLAY_API Device Settings HAL Display Public API
62  * @ingroup devicesettingshalapi
63  * A set of events sourced from display device (e.g. TV)
64  * Described herein are DeviceSettings HAL types and functions that are part of the
65  * Display subsystem. The Display subsystem manages operations relating to connected
66  * Vendors please add appropriate events needed for your implementation.
67  * display devices, e.g. TVs.
68  * @{
69  */
70 
71 
72 /**
73  * @brief Callback function used to notify applications of display events.
74  *
75  * HAL Implementation should call this method to delivery display events
76  * to the application (e.g. connected, disconnected).
77  *
78  * @param handle Handle of the display device.
79  * @param event Display event.
80  * @param eventData Data associated with the event.
81  * This is currently a place holder.
82  *
83  * @note HAL implementation is responsible for allocation of memory needed for event data.
84  * The memory can be free'd after callback returns.
85  *
86  * @return None.
87  */
88 typedef void (*dsDisplayEventCallback_t)(intptr_t handle, dsDisplayEvent_t event, void *eventData/*Optional*/);
89 
90 /**
91  * @brief Initialize the Display sub-system.
92  *
93  * This function must initialize all underlying Display sub-system modules and
94  * associated data structures.
95  *
96  * @return Device Settings error code
97  * @retval dsERR_NONE If sucessfully dsDisplayInit api has been called using IARM support.
98  * @retval dsERR_GENERAL General failure.
99  */
101 
102 /**
103  * @brief Get the handle of a display device.
104  *
105  * This function will get the handle for the display device connected to the
106  * specified video port.
107  *
108  * @param [in] vType Type of video port (e.g. HDMI, COMPONENT, etc.).
109  * @param [in] index The index of the video port (0, 1, ...).
110  * @param [out] *handle The address of a location to hold the handle for the
111  * specified display device on return.
112  *
113  * @return Device Settings error code
114  * @retval dsERR_NONE If sucessfully dsGetDisplay api has been called using IARM support.
115  * @retval dsERR_GENERAL General failure.
116  */
117  dsError_t dsGetDisplay(dsVideoPortType_t vType, int index, intptr_t *handle);
118 
119 /**
120  * @brief Get the EDID information from the specified display device.
121  *
122  * This function gets the EDID information from the HDMI/DVI display corresponding to
123  * the specified display device handle.
124  *
125  * @param [in] handle Handle of the display device.
126  * @param [out] *edid The address of a location to hold the EDID for the specified
127  * display device on return.
128  * @return Device Settings error code
129  * @retval dsERR_NONE If sucessfully dsGetEDID api has been called using IARM support.
130  * @retval dsERR_GENERAL General failure.
131  */
132 dsError_t dsGetEDID(intptr_t handle, dsDisplayEDID_t *edid);
133 
134 /**
135  * @brief This function is used to get the EDID buffer and length of the connected display.
136  *
137  * @param[in] handle Handle for the video display. This must be HDMI output
138  * handle.
139  * @param[out] edid The EDID raw buffer of the display. The HAL implementation should
140  * malloc() the buffer and return it to the application. The
141  * application is required to free() the buffer after using it;
142  * If HDMI is not connected no data should be returned,
143  * and the API returns dsERR_INVALID_STATE.
144  * @param[out] length The length of EDID buffer data
145  * @return Device Settings error code
146  * @retval dsERR_NONE If sucessfully dsGetEDIDBytes api has been called using IARM support.
147  * @retval dsERR_GENERAL General failure.
148  */
149 dsError_t dsGetEDIDBytes(intptr_t handle, unsigned char **edid, int *length);
150 
151 /**
152  * @brief This function gets the aspect ratio for the dsiaply device.
153  * This function returns the aspect ratio of the display corresponding to the specified display device handle.
154  *
155  * @param[in] handle Handle of the display device.
156  * @param[out] aspectRatio The address of a location to hold the current aspect ratio
157  * for the specified display device on return.
158  * @return Device Settings error code
159  * @retval dsERR_NONE If sucessfully dsGetDisplayAspectRatio api has been called using IARM support.
160  * @retval dsERR_GENERAL General failure.
161  */
162 dsError_t dsGetDisplayAspectRatio(intptr_t handle, dsVideoAspectRatio_t *aspectRatio);
163 
164 /**
165  * @brief This function deinitialize the display sub-system.
166  * This function deallocates the data structures used within the display module and releases any display specific handles.
167  *
168  * @return Device Settings error code
169  * @retval dsERR_NONE If sucessfully dsDisplayTerm api has been called using IARM support.
170  * @retval dsERR_GENERAL General failure.
171  */
173 
174 /**
175  * @brief Register a callback function to listen for display events.
176  *
177  * This function registers a callback function for display events corresponding to
178  * the specified display device handle.
179  *
180  * @note Application should install at most one callback function per handle.
181  * Multiple listeners are supported at application layer and thus not
182  * required in HAL implementation.
183  *
184  * @param handle Handle of the display device.
185  * @param cb The callback function.
186  * @return Error code.
187  * @retval ::dsError_t
188  */
190 
191 /**
192  * @}
193  */
194 #ifdef __cplusplus
195 }
196 #endif
197 #endif
198 
199 
200 /** @} */
201 /** @} */
dsDisplayInit
dsError_t dsDisplayInit()
Initialize the Display sub-system.
Definition: dsDisplay.c:47
dsGetEDIDBytes
dsError_t dsGetEDIDBytes(intptr_t handle, unsigned char **edid, int *length)
This function is used to get the EDID buffer and length of the connected display.
Definition: dsDisplay.c:149
dsDISPLAY_EVENT_DISCONNECTED
@ dsDISPLAY_EVENT_DISCONNECTED
Display disconnected event.
Definition: dsDisplay.h:52
dsDisplayTerm
dsError_t dsDisplayTerm()
This function deinitialize the display sub-system. This function deallocates the data structures used...
Definition: dsDisplay.c:194
dsVideoAspectRatio_t
enum _dsVideoAspectRatio_t dsVideoAspectRatio_t
dsTypes.h
Device Settings HAL types.
dsDISPLAY_RXSENSE_OFF
@ dsDISPLAY_RXSENSE_OFF
Rx Sense OFF event.
Definition: dsDisplay.h:54
dsGetEDID
dsError_t dsGetEDID(intptr_t handle, dsDisplayEDID_t *edid)
Get the EDID information from the specified display device.
Definition: dsDisplay.c:119
dsVideoPortType_t
enum _dsVideoPortType_t dsVideoPortType_t
dsGetDisplayAspectRatio
dsError_t dsGetDisplayAspectRatio(intptr_t handle, dsVideoAspectRatio_t *aspectRatio)
This function gets the aspect ratio for the dsiaply device. This function returns the aspect ratio of...
Definition: dsDisplay.c:93
dsError.h
Device Settings HAL error codes.
dsGetDisplay
dsError_t dsGetDisplay(dsVideoPortType_t vType, int index, intptr_t *handle)
Get the handle of a display device.
Definition: dsDisplay.c:65
dsDISPLAY_RXSENSE_ON
@ dsDISPLAY_RXSENSE_ON
Rx Sense ON event.
Definition: dsDisplay.h:53
dsDISPLAY_EVENT_CONNECTED
@ dsDISPLAY_EVENT_CONNECTED
Display connected event.
Definition: dsDisplay.h:51
dsRegisterDisplayEventCallback
dsError_t dsRegisterDisplayEventCallback(intptr_t handle, dsDisplayEventCallback_t cb)
Register a callback function to listen for display events.
_dsDisplayEDID_t
Defines the structure that is used to get the EDID information of the video display.
Definition: dsTypes.h:901
_dsDisplayEvent_t
_dsDisplayEvent_t
Definition: dsDisplay.h:50
dsDISPLAY_HDCPPROTOCOL_CHANGE
@ dsDISPLAY_HDCPPROTOCOL_CHANGE
HDCP Protocol Version Change event.
Definition: dsDisplay.h:55
dsError_t
dsError_t
Device Settings API Error return codes.
Definition: dsError.h:84
dsDisplayEventCallback_t
void(* dsDisplayEventCallback_t)(intptr_t handle, dsDisplayEvent_t event, void *eventData)
Callback function used to notify applications of display events.
Definition: dsDisplay.h:88