RDK Documentation (Open Sourced RDK Components)
dsHdmiIn.c
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  * If not stated otherwise in this file or this component's Licenses.txt file the
21  * following copyright and licenses apply:
22  *
23  * Copyright ARRIS Enterprises, Inc. 2015.
24  *
25  * Licensed under the Apache License, Version 2.0 (the "License");
26  * you may not use this file except in compliance with the License.
27  * You may obtain a copy of the License at
28  *
29  * http://www.apache.org/licenses/LICENSE-2.0
30  *
31  * Unless required by applicable law or agreed to in writing, software
32  * distributed under the License is distributed on an "AS IS" BASIS,
33  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34  * See the License for the specific language governing permissions and
35  * limitations under
36 */
37 
38 
39 /**
40 * @defgroup devicesettings
41 * @{
42 * @defgroup rpc
43 * @{
44 **/
45 
46 
47 #include <stdio.h>
48 #include <string.h>
49 #include "dsHdmiIn.h"
50 #include "dsRpc.h"
51 #include "dsMgr.h"
52 #include "dsclientlogger.h"
53 #include "iarmUtil.h"
54 #include "libIARM.h"
55 #include "libIBus.h"
56 
57 
59 {
60  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
61 
62  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
63  (char *)IARM_BUS_DSMGR_API_dsHdmiInInit,
64  NULL,
65  0);
66 
67  if (IARM_RESULT_SUCCESS == rpcRet)
68  {
69  printf("%s:%d - dsERR_NONE\n", __PRETTY_FUNCTION__,__LINE__);
70  return dsERR_NONE;
71  }
72 
73  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
74  return dsERR_GENERAL;
75 }
76 
77 
79 {
80  _DEBUG_ENTER();
81 
82  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
83  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
84  (char *)IARM_BUS_DSMGR_API_dsHdmiInTerm,
85  NULL,
86  0);
87 
88  if (IARM_RESULT_SUCCESS == rpcRet)
89  {
90  printf("%s:%d - dsERR_NONE\n", __PRETTY_FUNCTION__,__LINE__);
91  return dsERR_NONE;
92  }
93 
94  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
95  return dsERR_GENERAL ;
96 }
97 
98 
99 dsError_t dsHdmiInGetNumberOfInputs (uint8_t *pNumHdmiInputs)
100 {
101  _DEBUG_ENTER();
102  _RETURN_IF_ERROR(pNumHdmiInputs != NULL, dsERR_INVALID_PARAM);
103 
105  param.numHdmiInputs = 0;
106 
107  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
108 
109  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
110  (char *)IARM_BUS_DSMGR_API_dsHdmiInGetNumberOfInputs,
111  (void *)&param,
112  sizeof(param));
113 
114  if (IARM_RESULT_SUCCESS == rpcRet)
115  {
116  *pNumHdmiInputs = param.numHdmiInputs;
117  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param.result);
118  return param.result;
119  }
120 
121  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
122  return dsERR_GENERAL;
123 }
124 
126 {
127  _DEBUG_ENTER();
128  _RETURN_IF_ERROR(pStatus != NULL, dsERR_INVALID_PARAM);
129 
130 
132  memset (&param, 0, sizeof(param));
133 
134  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
135 
136  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
137  (char *)IARM_BUS_DSMGR_API_dsHdmiInGetStatus,
138  (void *)&param,
139  sizeof(param));
140 
141  if (IARM_RESULT_SUCCESS == rpcRet)
142  {
143  *pStatus = param.status;
144  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param.result);
145  return param.result;
146  }
147 
148  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
149  return dsERR_GENERAL;
150 }
151 
152 dsError_t dsHdmiInSelectPort (dsHdmiInPort_t ePort)
153 {
154  _DEBUG_ENTER();
155 
157  param.port = ePort;
158 
159  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
160 
161  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
162  (char *)IARM_BUS_DSMGR_API_dsHdmiInSelectPort,
163  (void *)&param,
164  sizeof(param));
165 
166  if (IARM_RESULT_SUCCESS == rpcRet)
167  {
168  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param.result);
169  return param.result;
170  }
171 
172  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
173  return dsERR_GENERAL;
174 }
175 
176 dsError_t dsHdmiInScaleVideo (int32_t x, int32_t y, int32_t width, int32_t height)
177 {
178  _DEBUG_ENTER();
179 
181  param.videoRect.x = x;
182  param.videoRect.y = y;
183  param.videoRect.width = width;
184  param.videoRect.height = height;
185  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
186 
187  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
188  (char *)IARM_BUS_DSMGR_API_dsHdmiInScaleVideo,
189  (void *)&param,
190  sizeof(param));
191 
192  if (IARM_RESULT_SUCCESS == rpcRet)
193  {
194  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param.result);
195  return param.result;
196  }
197 
198  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
199  return dsERR_GENERAL;
200 }
201 
203 {
204  _DEBUG_ENTER();
205 
207  param.zoomMode = requestedZoomMode;
208  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
209 
210  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
211  (char *)IARM_BUS_DSMGR_API_dsHdmiInSelectZoomMode,
212  (void *)&param,
213  sizeof(param));
214 
215  if (IARM_RESULT_SUCCESS == rpcRet)
216  {
217  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param.result);
218  return param.result;
219  }
220 
221  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
222  return dsERR_GENERAL;
223 }
224 
226 {
227  _DEBUG_ENTER();
228 
229  dsError_t param;
230  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
231 
232  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
233  (char *)IARM_BUS_DSMGR_API_dsHdmiInPauseAudio,
234  (void *)&param,
235  sizeof(param));
236 
237  if (IARM_RESULT_SUCCESS == rpcRet)
238  {
239  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param);
240  return param;
241  }
242 
243  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
244  return dsERR_GENERAL;
245 }
246 
248 {
249  _DEBUG_ENTER();
250 
251  dsError_t param;
252  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
253 
254  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
255  (char *)IARM_BUS_DSMGR_API_dsHdmiInResumeAudio,
256  (void *)&param,
257  sizeof(param));
258 
259  if (IARM_RESULT_SUCCESS == rpcRet)
260  {
261  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param);
262  return param;
263  }
264 
265  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
266  return dsERR_GENERAL;
267 }
268 
270 {
271  _DEBUG_ENTER();
272  _RETURN_IF_ERROR(resolution != NULL, dsERR_INVALID_PARAM);
273 
274 
276  param.resolution = *resolution;
277 
278  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
279 
280  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
281  (char *)IARM_BUS_DSMGR_API_dsHdmiInGetCurrentVideoMode,
282  (void *)&param,
283  sizeof(param));
284 
285  if (IARM_RESULT_SUCCESS == rpcRet)
286  {
287  *resolution = param.resolution;
288  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param.result);
289  return param.result;
290  }
291 
292  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
293  return dsERR_GENERAL;
294 }
295 
296 dsError_t dsGetEDIDBytesInfo (int iHdmiPort, unsigned char **edid, int *length)
297 {
298  _DEBUG_ENTER();
299  _RETURN_IF_ERROR(edid != NULL, dsERR_INVALID_PARAM);
300  _RETURN_IF_ERROR(length != NULL, dsERR_INVALID_PARAM);
301 
302 
304  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
305  param.iHdmiPort = iHdmiPort;
306  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
307  (char *)IARM_BUS_DSMGR_API_dsGetEDIDBytesInfo,
308  (void *)&param,
309  sizeof(param));
310 
311  if (IARM_RESULT_SUCCESS == rpcRet)
312  {
313  *length = param.length;
314  *edid = param.edid;
315  printf("[cli] %s: dsGetEDIDBytesInfo eRet: %d data len: %d \r\n", __FUNCTION__, param.result, *length);
316  return param.result;
317  }
318  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
319  return dsERR_GENERAL;
320 }
321 
322 dsError_t dsGetHDMISPDInfo (int iHdmiPort, unsigned char **spdInfo)
323 {
324  _DEBUG_ENTER();
325 
326  printf("[cli] %s: dsGetHDMISPDInfo \r\n", __FUNCTION__);
327  _RETURN_IF_ERROR(spdInfo != NULL, dsERR_INVALID_PARAM);
328 
330  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
331  param.iHdmiPort = iHdmiPort;
332  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
333  (char *)IARM_BUS_DSMGR_API_dsGetHDMISPDInfo,
334  (void *)&param,
335  sizeof(param));
336 
337  if (IARM_RESULT_SUCCESS == rpcRet)
338  {
339  *spdInfo = param.spdInfo;
340  printf("[cli] %s: dsGetHDMISPDInfo eRet: %d \r\n", __FUNCTION__, param.result);
341  return param.result;
342  }
343  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
344  return dsERR_GENERAL;
345 }
346 
347 dsError_t dsSetEdidVersion (int iHdmiPort, int iEdidVersion)
348 {
349  _DEBUG_ENTER();
350 
351  dsEdidVersionParam_t param;
352  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
353  param.iHdmiPort = iHdmiPort;
354  param.iEdidVersion = iEdidVersion;
355  rpcRet = IARM_Bus_Call (IARM_BUS_DSMGR_NAME,
356  (char *)IARM_BUS_DSMGR_API_dsSetEdidVersion,
357  (void *)&param,
358  sizeof(param));
359 
360  if (IARM_RESULT_SUCCESS == rpcRet)
361  {
362  printf ("[cli] %s: dsSetEdidVersion eRet: %d \r\n", __FUNCTION__, param.result);
363  return param.result;
364  }
365  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
366  return dsERR_GENERAL;
367 }
368 
369 dsError_t dsGetEdidVersion (int iHdmiPort, int *iEdidVersion)
370 {
371  _DEBUG_ENTER();
372 
373  dsEdidVersionParam_t param;
374  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
375  param.iHdmiPort = iHdmiPort;
376  rpcRet = IARM_Bus_Call (IARM_BUS_DSMGR_NAME,
377  (char *)IARM_BUS_DSMGR_API_dsGetEdidVersion,
378  (void *)&param,
379  sizeof(param));
380 
381  if (IARM_RESULT_SUCCESS == rpcRet)
382  {
383  *iEdidVersion = param.iEdidVersion;
384  printf ("[cli] %s: dsGetEdidVersion EdidVersion: %d \r\n", __FUNCTION__, param.iEdidVersion);
385  return param.result;
386  }
387  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
388  return dsERR_GENERAL;
389 }
390 
391 dsError_t dsGetAllmStatus (int iHdmiPort, bool *allmStatus)
392 {
393  _DEBUG_ENTER();
394 
395  dsAllmStatusParam_t param;
396  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
397  param.iHdmiPort = iHdmiPort;
398  rpcRet = IARM_Bus_Call (IARM_BUS_DSMGR_NAME,
399  (char *)IARM_BUS_DSMGR_API_dsGetAllmStatus,
400  (void *)&param,
401  sizeof(param));
402 
403  if (IARM_RESULT_SUCCESS == rpcRet)
404  {
405  *allmStatus = param.allmStatus;
406  printf ("[cli] %s: dsGetAllmStatus ALLM Status: %d \r\n", __FUNCTION__, param.allmStatus);
407  return param.result;
408  }
409  printf("%s:%d - dsERR_GENERAL\n", __FUNCTION__,__LINE__);
410  return dsERR_GENERAL;
411 }
412 
413 dsError_t dsGetSupportedGameFeaturesList (dsSupportedGameFeatureList_t *feature)
414 {
415  _DEBUG_ENTER();
416 
418  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
419  rpcRet = IARM_Bus_Call (IARM_BUS_DSMGR_NAME,
420  (char *)IARM_BUS_DSMGR_API_dsGetSupportedGameFeaturesList,
421  (void *)&param,
422  sizeof(param));
423 
424  if (IARM_RESULT_SUCCESS == rpcRet)
425  {
426  feature->gameFeatureCount = param.featureList.gameFeatureCount;
427  strncpy(feature->gameFeatureList, param.featureList.gameFeatureList, MAX_FEATURE_LIST_BUFFER_LEN);
428  printf ("[cli] %s: dsGetSupportedGameFeaturesList: %s count:%d \r\n",
429  __FUNCTION__, param.featureList.gameFeatureList, param.featureList.gameFeatureCount);
430  return param.result;
431  }
432  printf("%s:%d - dsERR_GENERAL\n", __FUNCTION__,__LINE__);
433  return dsERR_GENERAL;
434 }
435 /** @} */
436 /** @} */
_dsSupportedGameFeatureListParam_t
Definition: dsRpc.h:985
dsHdmiInSelectZoomMode
dsError_t dsHdmiInSelectZoomMode(dsVideoZoom_t requestedZoomMode)
Select the HDMI Input zoom mode.
Definition: dsHdmiIn.c:202
_dsGetHDMISPDInfoParam_t
Definition: dsRpc.h:947
_dsSupportedGameFeatureList_t
Definition: dsTypes.h:1141
IARM_Bus_Call
IARM_Result_t IARM_Bus_Call(const char *ownerName, const char *methodName, void *arg, size_t argLen)
This API is used to Invoke RPC method by its application name and method name.
Definition: iarm_bus.c:57
_dsAllmStatusParam_t
Definition: dsRpc.h:978
dsHdmiInScaleVideo
dsError_t dsHdmiInScaleVideo(int32_t x, int32_t y, int32_t width, int32_t height)
Scale the HDMI In video This function is used to scale the HDMI In video.
Definition: dsHdmiIn.c:176
_dsHdmiInSelectPortParam_t
Definition: dsRpc.h:724
_dsEdidVersionParam_t
Definition: dsRpc.h:966
dsERR_GENERAL
@ dsERR_GENERAL
Definition: dsError.h:86
_dsHdmiInGetResolutionParam_t
Definition: dsRpc.h:742
dsERR_NONE
@ dsERR_NONE
Definition: dsError.h:85
MAX_FEATURE_LIST_BUFFER_LEN
#define MAX_FEATURE_LIST_BUFFER_LEN
Structure that captures Supported Game Features list.
Definition: dsTypes.h:1140
dsHdmiInPauseAudio
dsError_t dsHdmiInPauseAudio()
Stop the output of HDMI Input audio.
Definition: dsHdmiIn.c:225
libIBus.h
RDK IARM-Bus API Declarations.
_dsHdmiInGetStatusParam_t
Definition: dsRpc.h:718
dsHdmiInGetStatus
dsError_t dsHdmiInGetStatus(dsHdmiInStatus_t *pStatus)
Get the HDMI Inpuut Status.
Definition: dsHdmiIn.c:125
dsVideoZoom_t
enum _dsVideoZoom_t dsVideoZoom_t
_dsHdmiInStatus_t
Definition: dsTypes.h:1029
dsHdmiIn.h
Device Settings HAL HDMI Input Public API. This API defines the HAL for the Device Settings HDMI Inpu...
dsHdmiInGetCurrentVideoMode
dsError_t dsHdmiInGetCurrentVideoMode(dsVideoPortResolution_t *resolution)
Get the current HDMI Input video mode.
Definition: dsHdmiIn.c:269
_dsGetEDIDBytesInfoParam_t
Definition: dsRpc.h:939
_dsVideoPortResolution_t
Structure that defines video port resolution settings of output video device.
Definition: dsTypes.h:642
_dsHdmiInScaleVideoParam_t
Definition: dsRpc.h:730
_dsHdmiInSelectZoomModeParam_t
Definition: dsRpc.h:736
_dsHdmiInGetNumberOfInputsParam_t
Definition: dsRpc.h:712
dsERR_INVALID_PARAM
@ dsERR_INVALID_PARAM
Definition: dsError.h:87
dsError_t
dsError_t
Device Settings API Error return codes.
Definition: dsError.h:84
dsHdmiInResumeAudio
dsError_t dsHdmiInResumeAudio()
Start the output of HDMI Input audio.
Definition: dsHdmiIn.c:247
dsHdmiInInit
dsError_t dsHdmiInInit(void)
Initialize the underlying HDMI Input sub-system.
Definition: dsHdmiIn.c:58
dsHdmiInTerm
dsError_t dsHdmiInTerm(void)
Terminate the underlying HDMI Input sub-system.
Definition: dsHdmiIn.c:78
dsHdmiInGetNumberOfInputs
dsError_t dsHdmiInGetNumberOfInputs(uint8_t *pNumHdmiInputs)
Get the number of HDMI Input ports on the set-top.
Definition: dsHdmiIn.c:99
dsHdmiInSelectPort
dsError_t dsHdmiInSelectPort(dsHdmiInPort_t ePort)
Select the HDMI Input port to be presented.
Definition: dsHdmiIn.c:152