RDK Documentation (Open Sourced RDK Components)
dsVideoPort.c
1 /* If not stated otherwise in this file or this component's Licenses.txt file the
2  * following copyright and licenses apply:
3  *
4  * Copyright 2016 RDK Management
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17 */
18 
19 
20 
21 /**
22 * @defgroup devicesettings
23 * @{
24 * @defgroup rpc
25 * @{
26 **/
27 
28 
29 #include "dsVideoPort.h"
30 #include <sys/types.h>
31 #include <stdint.h>
32 #include <string.h>
33 #include "dsError.h"
34 #include "dsUtl.h"
35 #include "dsRpc.h"
36 #include "dsMgr.h"
37 #include "iarmUtil.h"
38 #include "libIBus.h"
39 #include "libIARM.h"
40 #include "dsTypes.h"
41 #include "dsclientlogger.h"
42 
43 #include "safec_lib.h"
44 
46 {
47  printf("<<<<< VOP is initialized in Multi-App Mode >>>>>>>>\r\n");
48 
49  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
50 
51  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
52  (char *)IARM_BUS_DSMGR_API_dsVideoPortInit,
53  NULL,
54  0);
55 
56  if (IARM_RESULT_SUCCESS == rpcRet)
57  {
58  return dsERR_NONE;
59  }
60 
61  return dsERR_GENERAL;
62 }
63 
64 dsError_t dsGetVideoPort(dsVideoPortType_t type, int index, intptr_t *handle)
65 {
66  _DEBUG_ENTER();
67  _RETURN_IF_ERROR(dsVideoPortType_isValid(type), dsERR_INVALID_PARAM);
68  _RETURN_IF_ERROR((handle) != NULL, dsERR_INVALID_PARAM);
69 
71  param.type = type;
72  param.index = index;
73  param.handle = NULL;
74 
75 
76 
77  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
78 
79  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
80  (char *)IARM_BUS_DSMGR_API_dsGetVideoPort,
81  &param,
82  sizeof(param));
83 
84  printf("%s..%d-%d\n",__func__,param.type,param.handle);
85 
86  if (IARM_RESULT_SUCCESS == rpcRet)
87  {
88  *handle = param.handle;
89  return dsERR_NONE;
90  }
91 
92  return dsERR_GENERAL ;
93 }
94 
95 
96 dsError_t dsIsHDCPEnabled(intptr_t handle, bool *enabled)
97 {
98  _DEBUG_ENTER();
99 
100  _RETURN_IF_ERROR(enabled != NULL, dsERR_INVALID_PARAM);
101 
103 
104  param.handle = handle;
105  param.enabled = false;
106 
107 
108 
109  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
110 
111  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
112  (char *)IARM_BUS_DSMGR_API_dsIsHDCPEnabled,
113  (void *)&param,
114  sizeof(param));
115 
116  if (IARM_RESULT_SUCCESS == rpcRet)
117  {
118  *enabled = param.enabled;
119  return dsERR_NONE;
120  }
121 
122  return dsERR_GENERAL ;
123 }
124 
125 dsError_t dsIsVideoPortEnabled(intptr_t handle, bool *enabled)
126 {
127  _DEBUG_ENTER();
128 
129  _RETURN_IF_ERROR(enabled != NULL, dsERR_INVALID_PARAM);
130 
132 
133  param.handle = handle;
134  param.enabled = false;
135 
136 
137 
138  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
139 
140  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
141  (char *)IARM_BUS_DSMGR_API_dsIsVideoPortEnabled,
142  (void *)&param,
143  sizeof(param));
144 
145  if (IARM_RESULT_SUCCESS == rpcRet)
146  {
147  *enabled = param.enabled;
148  return dsERR_NONE;
149  }
150 
151  return dsERR_GENERAL ;
152 }
153 
154 dsError_t dsGetHDCPStatus (intptr_t handle, dsHdcpStatus_t *status)
155 {
156  _DEBUG_ENTER();
157  _RETURN_IF_ERROR(status != NULL, dsERR_INVALID_PARAM);
158 
160  param.handle = handle;
161  param.hdcpStatus = dsHDCP_STATUS_UNAUTHENTICATED;
162 
163  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
164  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
165  (char *)IARM_BUS_DSMGR_API_dsGetHDCPStatus,
166  (void *)&param,
167  sizeof(param));
168  if (IARM_RESULT_SUCCESS == rpcRet)
169  {
170  *status = param.hdcpStatus;
171  return dsERR_NONE;
172  }
173 
174  return dsERR_GENERAL ;
175 }
176 
177 dsError_t dsGetHDCPProtocol (intptr_t handle, dsHdcpProtocolVersion_t *version)
178 {
179  _DEBUG_ENTER();
180  _RETURN_IF_ERROR(version != NULL, dsERR_INVALID_PARAM);
181 
183  param.handle = handle;
184  param.protocolVersion = dsHDCP_VERSION_MAX;
185 
186  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
187  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
188  (char *)IARM_BUS_DSMGR_API_dsGetHDCPProtocol,
189  (void *)&param,
190  sizeof(param));
191  if (IARM_RESULT_SUCCESS == rpcRet)
192  {
193  *version = param.protocolVersion;
194  return dsERR_NONE;
195  }
196 
197  return dsERR_GENERAL ;
198 }
199 
200 dsError_t dsGetHDCPReceiverProtocol (intptr_t handle, dsHdcpProtocolVersion_t *version)
201 {
202  _DEBUG_ENTER();
203  _RETURN_IF_ERROR(version != NULL, dsERR_INVALID_PARAM);
204 
206  param.handle = handle;
207  param.protocolVersion = dsHDCP_VERSION_MAX;
208 
209  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
210  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
211  (char *)IARM_BUS_DSMGR_API_dsGetHDCPReceiverProtocol,
212  (void *)&param,
213  sizeof(param));
214  if (IARM_RESULT_SUCCESS == rpcRet)
215  {
216  *version = param.protocolVersion;
217  return dsERR_NONE;
218  }
219 
220  return dsERR_GENERAL ;
221 }
222 
223 dsError_t dsGetHDCPCurrentProtocol (intptr_t handle, dsHdcpProtocolVersion_t *version)
224 {
225  _DEBUG_ENTER();
226  _RETURN_IF_ERROR(version != NULL, dsERR_INVALID_PARAM);
227 
229  param.handle = handle;
230  param.protocolVersion = dsHDCP_VERSION_MAX;
231 
232  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
233  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
234  (char *)IARM_BUS_DSMGR_API_dsGetHDCPCurrentProtocol,
235  (void *)&param,
236  sizeof(param));
237  if (IARM_RESULT_SUCCESS == rpcRet)
238  {
239  *version = param.protocolVersion;
240  return dsERR_NONE;
241  }
242 
243  return dsERR_GENERAL ;
244 }
245 dsError_t dsIsDisplayConnected(intptr_t handle, bool *connected)
246 {
247  _DEBUG_ENTER();
248  _RETURN_IF_ERROR(connected != NULL, dsERR_INVALID_PARAM);
249 
251 
252  param.handle = handle;
253  param.connected = false;
254 
255  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
256 
257 
258 
259  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
260  (char *)IARM_BUS_DSMGR_API_dsIsDisplayConnected,
261  (void *)&param,
262  sizeof(param));
263 
264  if (IARM_RESULT_SUCCESS == rpcRet)
265  {
266  *connected = param.connected;
267  return dsERR_NONE;
268  }
269 
270  return dsERR_GENERAL ;
271 }
272 
273 dsError_t dsIsDisplaySurround(intptr_t handle, bool *surround)
274 {
275  _DEBUG_ENTER();
276  _RETURN_IF_ERROR(surround != NULL, dsERR_INVALID_PARAM);
277 
279 
280  param.handle = handle;
281  param.surround = false;
282 
283  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
284 
285 
286 
287  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
288  (char *)IARM_BUS_DSMGR_API_dsIsDisplaySurround,
289  (void *)&param,
290  sizeof(param));
291 
292  if (IARM_RESULT_SUCCESS == rpcRet)
293  {
294  *surround = param.surround;
295  return dsERR_NONE;
296  }
297 
298  return dsERR_GENERAL ;
299 }
300 
301 dsError_t dsGetSurroundMode(intptr_t handle, int *surround)
302 {
303  _DEBUG_ENTER();
304  _RETURN_IF_ERROR(surround != NULL, dsERR_INVALID_PARAM);
305 
307 
308  param.handle = handle;
309  param.surround = dsSURROUNDMODE_NONE;
310 
311  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
312 
313 
314 
315  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
316  (char *)IARM_BUS_DSMGR_API_dsGetSurroundMode,
317  (void *)&param,
318  sizeof(param));
319 
320  if (IARM_RESULT_SUCCESS == rpcRet)
321  {
322  *surround = param.surround;
323  return dsERR_NONE;
324  }
325 
326  return dsERR_GENERAL ;
327 }
328 dsError_t dsEnableVideoPort(intptr_t handle, bool enabled)
329 {
330  _DEBUG_ENTER();
331 
333  param.handle = handle;
334  param.enabled = enabled;
335 
336 
337  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
338 
339  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
340  (char *)IARM_BUS_DSMGR_API_dsEnableVideoPort,
341  (void *)&param,
342  sizeof(param));
343 
344  if (IARM_RESULT_SUCCESS == rpcRet)
345  {
346  return dsERR_NONE;
347  }
348 
349  return dsERR_GENERAL ;
350 }
351 
352 
353 dsError_t dsGetResolution(intptr_t handle, dsVideoPortResolution_t *resolution)
354 {
355  _DEBUG_ENTER();
356  _RETURN_IF_ERROR(resolution != NULL, dsERR_INVALID_PARAM);
357 
359 
360  param.handle = handle;
361  param.toPersist = false;
362  param.resolution = *resolution;
363 
364  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
365 
366  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
367  (char *)IARM_BUS_DSMGR_API_dsGetResolution,
368  (void *)&param,
369  sizeof(param));
370 
371  *resolution = param.resolution;
372 
373  if (IARM_RESULT_SUCCESS == rpcRet)
374  {
375  return dsERR_NONE;
376  }
377  return dsERR_GENERAL ;
378 }
379 
380 dsError_t dsSetScartParameter(intptr_t handle, const char* parameter_str, const char* value_str)
381 {
382  _DEBUG_ENTER();
383  if ((value_str == NULL) || (parameter_str == NULL))
384  {
385  return dsERR_INVALID_PARAM;
386  }
387 
388  dsScartParamParam_t param;
389 
390  memset(&param, 0, sizeof(param));
391  param.handle = handle;
392  param.result = dsERR_NONE;
393  strncpy(param.param_bytes, parameter_str, DSSCART_PARAM_LEN_MAX -1);
394  strncpy(param.value_bytes, value_str, DSSCART_VALUE_LEN_MAX - 1);
395  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
396  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
397  (char *)IARM_BUS_DSMGR_API_dsSetScartParameter,
398  (void *)&param,
399  sizeof(param));
400 
401  if ((IARM_RESULT_SUCCESS == rpcRet) && (dsERR_NONE == param.result))
402  {
403  return dsERR_NONE;
404  }
405 
406  return dsERR_GENERAL;
407 }
408 
409 dsError_t dsSetResolution(intptr_t handle, dsVideoPortResolution_t *resolution, bool persist)
410 {
411  _DEBUG_ENTER();
412  _RETURN_IF_ERROR(resolution != NULL, dsERR_INVALID_PARAM);
413 
415 
416  param.handle = handle;
417  param.toPersist = persist;
418  param.forceCompatible = true;
419  param.resolution = *resolution;
420 
421  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
422 
423  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
424  (char *)IARM_BUS_DSMGR_API_dsSetResolution,
425  (void *)&param,
426  sizeof(param));
427 
428  if (IARM_RESULT_SUCCESS == rpcRet && (dsERR_NONE == param.result))
429  {
430  return dsERR_NONE;
431  }
432 
433  return dsERR_GENERAL ;
434 }
435 
436 dsError_t dsGetPreferredColorDepth (intptr_t handle, dsDisplayColorDepth_t *colorDepth, bool persist)
437 {
438  _DEBUG_ENTER();
439  _RETURN_IF_ERROR(colorDepth != NULL, dsERR_INVALID_PARAM);
440 
442 
443  param.handle = handle;
444  param.toPersist = persist;
445  param.colorDepth = *colorDepth;
446 
447  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
448 
449  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
450  (char *)IARM_BUS_DSMGR_API_dsGetPreferredColorDepth,
451  (void *)&param,
452  sizeof(param));
453 
454  *colorDepth = param.colorDepth;
455 
456  if (IARM_RESULT_SUCCESS == rpcRet)
457  {
458  return dsERR_NONE;
459  }
460  return dsERR_GENERAL ;
461 }
462 
463 dsError_t dsSetPreferredColorDepth (intptr_t handle, dsDisplayColorDepth_t colorDepth, bool persist)
464 {
465  _DEBUG_ENTER();
466 
468 
469  param.handle = handle;
470  param.toPersist = persist;
471  param.colorDepth = colorDepth;
472 
473  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
474 
475  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
476  (char *)IARM_BUS_DSMGR_API_dsSetPreferredColorDepth,
477  (void *)&param,
478  sizeof(param));
479 
480  if (IARM_RESULT_SUCCESS == rpcRet && (dsERR_NONE == param.result))
481  {
482  return dsERR_NONE;
483  }
484 
485  return dsERR_GENERAL ;
486 }
487 
488 dsError_t dsColorDepthCapabilities(intptr_t handle, unsigned int *capabilities)
489 {
490  _DEBUG_ENTER();
491 
493  memset(&param, 0, sizeof(param));
494  param.handle = handle;
495 
496  IARM_Result_t rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
497  (char *) IARM_BUS_DSMGR_API_dsColorDepthCapabilities,
498  (void *) &param,
499  sizeof(param));
500 
501  if (IARM_RESULT_SUCCESS == rpcRet)
502  {
503  *capabilities = param.colorDepthCapability;
504  return param.result;
505  }
506 
507  return dsERR_GENERAL ;
508 }
509 
510 
512 {
513  _DEBUG_ENTER();
514 
515  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
516 
517  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
518  (char *)IARM_BUS_DSMGR_API_dsVideoPortTerm,
519  NULL,
520  0);
521 
522  if (IARM_RESULT_SUCCESS == rpcRet)
523  {
524  return dsERR_NONE;
525  }
526 
527  return dsERR_GENERAL ;
528 }
529 
530 dsError_t dsEnableHDCP(intptr_t handle, bool contentProtect, char *hdcpKey, size_t keySize)
531 {
532  errno_t rc = -1;
533  _DEBUG_ENTER();
534 
535 // if ((keySize <= 0) || (keySize > HDCP_KEY_MAX_SIZE) )
536  if (((unsigned int) keySize > HDCP_KEY_MAX_SIZE) )
537  {
538  return dsERR_INVALID_PARAM;
539  }
540 
541 // if (contentProtect && !hdcpKey) {
542 // return dsERR_INVALID_PARAM;
543 // }
544 
545  dsEnableHDCPParam_t param;
546 
547  memset(&param, 0, sizeof(param));
548  param.handle = handle;
549  param.contentProtect = contentProtect;
550  param.keySize = keySize;
551  param.rpcResult = dsERR_NONE;
552 
553  if (contentProtect && hdcpKey && keySize && keySize <= HDCP_KEY_MAX_SIZE) {
554  rc = memcpy_s(param.hdcpKey,sizeof(param.hdcpKey), hdcpKey, keySize);
555  if(rc!=EOK)
556  {
557  ERR_CHK(rc);
558  }
559  }
560 
561  printf("IARM:CLI:dsEnableHDCP %d, %p, %d\r\n", contentProtect, hdcpKey, keySize);
562 
563  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
564  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
565  (char *)IARM_BUS_DSMGR_API_dsEnableHDCP,
566  (void *)&param,
567  sizeof(param));
568 
569  if( (IARM_RESULT_SUCCESS == rpcRet) && (dsERR_NONE == param.rpcResult))
570  {
571  return dsERR_NONE;
572  }
573 
574  return dsERR_GENERAL ;
575 }
576 
577 dsError_t dsIsVideoPortActive(intptr_t handle, bool *active)
578 {
579  _DEBUG_ENTER();
580 
581  _RETURN_IF_ERROR(active != NULL, dsERR_INVALID_PARAM);
582 
584 
585  param.handle = handle;
586  param.active = false;
587  param.result = dsERR_NONE;
588 
589 
590  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
591  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
592  (char *)IARM_BUS_DSMGR_API_dsIsVideoPortActive,
593  (void *)&param,
594  sizeof(param));
595 
596  if (IARM_RESULT_SUCCESS == rpcRet)
597  {
598  *active = param.active;
599  return param.result;
600  }
601 
602  return dsERR_GENERAL ;
603 }
604 
605 dsError_t dsGetTVHDRCapabilities(intptr_t handle, int *capabilities)
606 {
607  _DEBUG_ENTER();
608 
610  memset(&param, 0, sizeof(param));
611  param.handle = handle;
612 
613  IARM_Result_t rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
614  (char *) IARM_BUS_DSMGR_API_dsGetTVHDRCapabilities,
615  (void *) &param,
616  sizeof(param));
617 
618  if (IARM_RESULT_SUCCESS == rpcRet)
619  {
620  *capabilities = param.capabilities;
621  return param.result;
622  }
623 
624  return dsERR_GENERAL ;
625 }
626 
627 dsError_t dsSupportedTvResolutions(intptr_t handle, int *resolutions)
628 {
629  _DEBUG_ENTER();
630 
632  memset(&param, 0, sizeof(param));
633  param.handle = handle;
634 
635  IARM_Result_t rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
636  (char *) IARM_BUS_DSMGR_API_dsGetSupportedTVResolution,
637  (void *) &param,
638  sizeof(param));
639 
640  if (IARM_RESULT_SUCCESS == rpcRet)
641  {
642  *resolutions = param.resolutions;
643  return param.result;
644  }
645 
646  return dsERR_GENERAL ;
647 }
648 
649 dsError_t dsSetForceDisable4KSupport(intptr_t handle, bool disable)
650 {
651  _DEBUG_ENTER();
652 
654  memset(&param, 0, sizeof(param));
655  param.handle = handle;
656  param.disable = disable;
657 
658  IARM_Result_t rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
659  (char *) IARM_BUS_DSMGR_API_dsSetForceDisable4K,
660  (void *) &param,
661  sizeof(param));
662 
663  if (IARM_RESULT_SUCCESS == rpcRet)
664  {
665  return param.result;
666  }
667 
668  return dsERR_GENERAL ;
669 }
670 
671 dsError_t dsGetForceDisable4KSupport(intptr_t handle, bool *disable)
672 {
673  _DEBUG_ENTER();
674 
676  memset(&param, 0, sizeof(param));
677  param.handle = handle;
678 
679  IARM_Result_t rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
680  (char *) IARM_BUS_DSMGR_API_dsGetForceDisable4K,
681  (void *) &param,
682  sizeof(param));
683 
684  if (IARM_RESULT_SUCCESS == rpcRet)
685  {
686  *disable = param.disable;
687  return param.result;
688  }
689 
690  return dsERR_GENERAL ;
691 }
692 
693 dsError_t dsIsOutputHDR(intptr_t handle, bool *hdr)
694 {
695  _DEBUG_ENTER();
696 
697  _RETURN_IF_ERROR(hdr != NULL, dsERR_INVALID_PARAM);
698 
699  dsIsOutputHDRParam_t param;
700 
701  param.handle = handle;
702  param.hdr = false;
703  param.result = dsERR_NONE;
704 
705 
706  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
707  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
708  (char *)IARM_BUS_DSMGR_API_dsIsOutputHDR,
709  (void *)&param,
710  sizeof(param));
711 
712  if (IARM_RESULT_SUCCESS == rpcRet)
713  {
714  *hdr = param.hdr;
715  return param.result;
716  }
717 
718  return dsERR_GENERAL ;
719 }
720 
722 {
723  _DEBUG_ENTER();
724 
725  bool param =true;
726 
727  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
728  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
729  (char *)IARM_BUS_DSMGR_API_dsResetOutputToSDR,
730  (void *)&param,
731  sizeof(param));
732 
733  if (IARM_RESULT_SUCCESS != rpcRet)
734  {
735  return dsERR_GENERAL;
736  }
737 
738  return dsERR_NONE ;
739 }
740 
741 dsError_t dsSetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpProtocol)
742 {
743  _DEBUG_ENTER();
744 
745  _RETURN_IF_ERROR(hdcpProtocol != NULL, dsERR_INVALID_PARAM);
746 
748 
749  param.handle = handle;
750  param.hdcpCurrentProtocol = *hdcpProtocol;
751  param.result = dsERR_NONE;
752 
753 
754  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
755  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
756  (char *)IARM_BUS_DSMGR_API_dsSetHdmiPreference,
757  (void *)&param,
758  sizeof(param));
759 
760  if (IARM_RESULT_SUCCESS == rpcRet)
761  {
762  return param.result;
763  }
764 
765  return dsERR_GENERAL ;
766 }
767 
768 dsError_t dsGetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpProtocol)
769 {
770  _DEBUG_ENTER();
771 
772  _RETURN_IF_ERROR(hdcpProtocol != NULL, dsERR_INVALID_PARAM);
773 
775 
776  param.handle = handle;
777  param.hdcpCurrentProtocol = dsHDCP_VERSION_MAX;
778  param.result = dsERR_NONE;
779 
780 
781  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
782  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
783  (char *)IARM_BUS_DSMGR_API_dsGetHdmiPreference,
784  (void *)&param,
785  sizeof(param));
786 
787  if (IARM_RESULT_SUCCESS == rpcRet)
788  {
789  *hdcpProtocol = param.hdcpCurrentProtocol;
790  return param.result;
791  }
792 
793  return dsERR_GENERAL ;
794 }
795 
796 dsError_t dsGetVideoEOTF(intptr_t handle, dsHDRStandard_t* video_eotf)
797 {
798  _DEBUG_ENTER();
799 
800  if (video_eotf == NULL) {
801  return dsERR_INVALID_PARAM;
802  }
803 
804  dsEot_t param;
805 
806  memset(&param, 0, sizeof(param));
807  param.handle = handle;
808  param.result = dsERR_NONE;
809 
810  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
811  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
812  (char *)IARM_BUS_DSMGR_API_dsGetVideoEOTF,
813  (void *)&param,
814  sizeof(param));
815 
816  if( (IARM_RESULT_SUCCESS == rpcRet) && (dsERR_NONE == param.result))
817  {
818  *video_eotf = param.video_eotf;
819  return dsERR_NONE;
820  }
821 
822  return dsERR_GENERAL ;
823 }
824 
825 dsError_t dsGetMatrixCoefficients(intptr_t handle, dsDisplayMatrixCoefficients_t *matrix_coefficients)
826 {
827  _DEBUG_ENTER();
828 
829  if (matrix_coefficients == NULL) {
830  return dsERR_INVALID_PARAM;
831  }
832 
834 
835  memset(&param, 0, sizeof(param));
836  param.handle = handle;
837  param.result = dsERR_NONE;
838 
839  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
840  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
841  (char *)IARM_BUS_DSMGR_API_dsGetMatrixCoefficients,
842  (void *)&param,
843  sizeof(param));
844 
845  if( (IARM_RESULT_SUCCESS == rpcRet) && (dsERR_NONE == param.result))
846  {
847  *matrix_coefficients = param.matrix_coefficients;
848  return dsERR_NONE;
849  }
850 
851  return dsERR_GENERAL ;
852 }
853 
854 dsError_t dsGetColorDepth(intptr_t handle, unsigned int* color_depth)
855 {
856  _DEBUG_ENTER();
857 
858  if (color_depth == NULL) {
859  return dsERR_INVALID_PARAM;
860  }
861 
862  dsColorDepth_t param;
863 
864  memset(&param, 0, sizeof(param));
865  param.handle = handle;
866  param.result = dsERR_NONE;
867 
868  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
869  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
870  (char *)IARM_BUS_DSMGR_API_dsGetColorDepth,
871  (void *)&param,
872  sizeof(param));
873 
874  if( (IARM_RESULT_SUCCESS == rpcRet) && (dsERR_NONE == param.result))
875  {
876  *color_depth = param.color_depth;
877  return dsERR_NONE;
878  }
879 
880  return dsERR_GENERAL ;
881 }
882 
883 dsError_t dsGetColorSpace(intptr_t handle, dsDisplayColorSpace_t* color_space)
884 {
885  _DEBUG_ENTER();
886 
887  if (color_space == NULL) {
888  return dsERR_INVALID_PARAM;
889  }
890 
891  dsColorSpace_t param;
892 
893  memset(&param, 0, sizeof(param));
894  param.handle = handle;
895  param.result = dsERR_NONE;
896 
897  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
898  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
899  (char *)IARM_BUS_DSMGR_API_dsGetColorSpace,
900  (void *)&param,
901  sizeof(param));
902 
903  if( (IARM_RESULT_SUCCESS == rpcRet) && (dsERR_NONE == param.result))
904  {
905  *color_space = param.color_space;
906  return dsERR_NONE;
907  }
908 
909  return dsERR_GENERAL ;
910 }
911 
912 dsError_t dsGetQuantizationRange(intptr_t handle, dsDisplayQuantizationRange_t* quantization_range)
913 {
914  _DEBUG_ENTER();
915 
916  if (quantization_range == NULL) {
917  return dsERR_INVALID_PARAM;
918  }
919 
920  dsQuantizationRange_t param;
921 
922  memset(&param, 0, sizeof(param));
923  param.handle = handle;
924  param.result = dsERR_NONE;
925 
926  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
927  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
928  (char *)IARM_BUS_DSMGR_API_dsGetQuantizationRange,
929  (void *)&param,
930  sizeof(param));
931 
932  if( (IARM_RESULT_SUCCESS == rpcRet) && (dsERR_NONE == param.result))
933  {
934  *quantization_range = param.quantization_range;
935  return dsERR_NONE;
936  }
937 
938  return dsERR_GENERAL ;
939 }
940 
941 dsError_t dsGetCurrentOutputSettings(intptr_t handle, dsHDRStandard_t* video_eotf, dsDisplayMatrixCoefficients_t* matrix_coefficients, dsDisplayColorSpace_t* color_space, unsigned int* color_depth, dsDisplayQuantizationRange_t* quantization_range)
942 {
943  _DEBUG_ENTER();
944 
945  if (video_eotf == NULL || matrix_coefficients == NULL || color_space == NULL || color_depth == NULL || quantization_range == NULL) {
946  return dsERR_INVALID_PARAM;
947  }
948 
950 
951  memset(&param, 0, sizeof(param));
952  param.handle = handle;
953  param.result = dsERR_NONE;
954 
955  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
956  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
957  (char *)IARM_BUS_DSMGR_API_dsGetCurrentOutputSettings,
958  (void *)&param,
959  sizeof(param));
960 
961  if( (IARM_RESULT_SUCCESS == rpcRet) && (dsERR_NONE == param.result))
962  {
963  *video_eotf = param.video_eotf;
964  *matrix_coefficients = param.matrix_coefficients;
965  *color_space = param.color_space;
966  *color_depth = param.color_depth;
967  *quantization_range = param.quantization_range;
968  return dsERR_NONE;
969  }
970 
971  return dsERR_GENERAL ;
972 }
973 
975 {
976  _DEBUG_ENTER();
977 
978  dsForceHDRModeParam_t param;
979  memset(&param, 0, sizeof(param));
980  param.handle = handle;
981  param.hdrMode = mode;
982 
983  IARM_Result_t rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
984  (char *) IARM_BUS_DSMGR_API_dsSetForceHDRMode,
985  (void *) &param,
986  sizeof(param));
987 
988  if (IARM_RESULT_SUCCESS == rpcRet)
989  {
990  return param.result;
991  }
992 
993  return dsERR_GENERAL ;
994 }
995 
996 /** @} */
997 /** @} */
_dsVideoPortIsActiveParam_t
Definition: dsRpc.h:516
dsSetHdmiPreference
dsError_t dsSetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpProtocol)
This API is used to set the Preferred HDMI Protocol.
Definition: dsVideoPort.c:741
dsSetScartParameter
dsError_t dsSetScartParameter(intptr_t handle, const char *parameter_str, const char *value_str)
Sets various SCART parameters.
Definition: dsVideoPort.c:380
_dsVideoPortGetSurroundModeParam_t
Definition: dsRpc.h:547
dsGetResolution
dsError_t dsGetResolution(intptr_t handle, dsVideoPortResolution_t *resolution)
Get the video display resolution.
Definition: dsVideoPort.c:353
dsGetVideoPort
dsError_t dsGetVideoPort(dsVideoPortType_t type, int index, intptr_t *handle)
Get the video port handle.
Definition: dsVideoPort.c:64
_dsVideoPortIsDisplaySurroundParam_t
Definition: dsRpc.h:542
dsGetHDCPCurrentProtocol
dsError_t dsGetHDCPCurrentProtocol(intptr_t handle, dsHdcpProtocolVersion_t *version)
Get current used HDCP protocol version.
Definition: dsVideoPort.c:223
_dsCurrentOutputSettings_t
Definition: dsRpc.h:922
dsGetHDCPStatus
dsError_t dsGetHDCPStatus(intptr_t handle, dsHdcpStatus_t *status)
Get current HDCP status.
Definition: dsVideoPort.c:154
_dsVideoPortGetHandleParam_t
Definition: dsRpc.h:503
dsIsDisplayConnected
dsError_t dsIsDisplayConnected(intptr_t handle, bool *connected)
Indicate whether a video port is connected to a display.
Definition: dsVideoPort.c:245
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
dsTypes.h
Device Settings HAL types.
dsVideoPortInit
dsError_t dsVideoPortInit()
Initialize underlying Video Port sub-system.
Definition: dsVideoPort.c:45
dsHDCP_STATUS_UNAUTHENTICATED
@ dsHDCP_STATUS_UNAUTHENTICATED
Definition: dsTypes.h:415
_dsVideoPortSetResolutionParam_t
Definition: dsRpc.h:560
dsColorDepthCapabilitiesParam_t
Definition: dsRpc.h:568
dsSupportedTvResolutions
dsError_t dsSupportedTvResolutions(intptr_t handle, int *resolutions)
To find the TV supported resolutions.
Definition: dsVideoPort.c:627
_dsMatrixCoefficients_t
Definition: dsRpc.h:898
dsVideoPortType_t
enum _dsVideoPortType_t dsVideoPortType_t
dsGetHDCPReceiverProtocol
dsError_t dsGetHDCPReceiverProtocol(intptr_t handle, dsHdcpProtocolVersion_t *version)
Get Receiver/TV HDCP protocol version.
Definition: dsVideoPort.c:200
_dsSetHdmiPreferenceParam_t
Definition: dsRpc.h:857
dsVideoPort.h
HDCP_KEY_MAX_SIZE
#define HDCP_KEY_MAX_SIZE
Definition: mfrMgr.h:114
dsHDCP_VERSION_MAX
@ dsHDCP_VERSION_MAX
Definition: dsTypes.h:407
dsError.h
Device Settings HAL error codes.
dsGetHDCPProtocol
dsError_t dsGetHDCPProtocol(intptr_t handle, dsHdcpProtocolVersion_t *version)
Get STB HDCP protocol version.
Definition: dsVideoPort.c:177
dsPreferredColorDepthParam_t
Definition: dsRpc.h:574
_dsVideoPortGetResolutionParam_t
Definition: dsRpc.h:553
_dsVideoPortEnabledParam_t
Definition: dsRpc.h:509
dsUtl.h
Device Settings HAL utilities.
_dsGetHdmiPreferenceParam_t
Definition: dsRpc.h:863
_dsColorSpace_t
Definition: dsRpc.h:910
dsSetResolution
dsError_t dsSetResolution(intptr_t handle, dsVideoPortResolution_t *resolution, bool persist)
Set video port's display resolution.
Definition: dsVideoPort.c:409
dsERR_GENERAL
@ dsERR_GENERAL
Definition: dsError.h:86
dsResetOutputToSDR
dsError_t dsResetOutputToSDR()
Reset Video Output to SDR.
Definition: dsVideoPort.c:721
dsEnableHDCP
dsError_t dsEnableHDCP(intptr_t handle, bool contentProtect, char *hdcpKey, size_t keySize)
Toggle HDCP protection of a video port.
Definition: dsVideoPort.c:530
dsGetColorDepth
dsError_t dsGetColorDepth(intptr_t handle, unsigned int *color_depth)
Get current color depth value.
Definition: dsVideoPort.c:854
dsIsVideoPortActive
dsError_t dsIsVideoPortActive(intptr_t handle, bool *active)
This function is used to indicate whether a video port is connected to a display.
Definition: dsVideoPort.c:577
dsERR_NONE
@ dsERR_NONE
Definition: dsError.h:85
dsIsOutputHDR
dsError_t dsIsOutputHDR(intptr_t handle, bool *hdr)
Check Video Output is HDR or not.
Definition: dsVideoPort.c:693
_dsVideoPortIsDisplayConnectedParam_t
Definition: dsRpc.h:537
dsGetHdmiPreference
dsError_t dsGetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpProtocol)
This API is used to get the Preferred HDMI Protocol.
Definition: dsVideoPort.c:768
libIBus.h
RDK IARM-Bus API Declarations.
_dsIsOutputHDRParam_t
Definition: dsRpc.h:851
_dsEnableHDCPParam
Definition: dsRpc.h:680
dsColorDepthCapabilities
dsError_t dsColorDepthCapabilities(intptr_t handle, unsigned int *capabilities)
To find the color depth capabilities.
Definition: dsVideoPort.c:488
dsGetPreferredColorDepth
dsError_t dsGetPreferredColorDepth(intptr_t handle, dsDisplayColorDepth_t *colorDepth, bool persist)
To get the preffered color depth mode.
Definition: dsVideoPort.c:436
_dsEot_t
Definition: dsRpc.h:892
_dsGetHDRCapabilitiesParam_t
Definition: dsRpc.h:774
dsForceDisable4KParam_t
Definition: dsRpc.h:844
dsHDRStandard_t
enum _dsHDRStandard_t dsHDRStandard_t
dsGetQuantizationRange
dsError_t dsGetQuantizationRange(intptr_t handle, dsDisplayQuantizationRange_t *quantization_range)
Get quatization range.
Definition: dsVideoPort.c:912
_dsVideoPortResolution_t
Structure that defines video port resolution settings of output video device.
Definition: dsTypes.h:642
_dsColorDepth_t
Definition: dsRpc.h:904
_dsSupportedResolutionParam_t
Definition: dsRpc.h:607
_dsQuantizationRange_t
Definition: dsRpc.h:916
dsGetSurroundMode
dsError_t dsGetSurroundMode(intptr_t handle, int *surround)
This function is used to get supported surround mode.
Definition: dsVideoPort.c:301
_dsVideoPortGetHDCPStatus_t
Definition: dsRpc.h:522
dsForceHDRModeParam_t
Definition: dsRpc.h:837
dsGetColorSpace
dsError_t dsGetColorSpace(intptr_t handle, dsDisplayColorSpace_t *color_space)
Get current color space setting.
Definition: dsVideoPort.c:883
dsVideoPortType_isValid
#define dsVideoPortType_isValid(t)
Definition: dsTypes.h:451
dsEnableVideoPort
dsError_t dsEnableVideoPort(intptr_t handle, bool enabled)
Enable/disable a video port.
Definition: dsVideoPort.c:328
dsGetTVHDRCapabilities
dsError_t dsGetTVHDRCapabilities(intptr_t handle, int *capabilities)
To find the HDR capabilities of TV.
Definition: dsVideoPort.c:605
dsGetVideoEOTF
dsError_t dsGetVideoEOTF(intptr_t handle, dsHDRStandard_t *video_eotf)
Get current video Electro-Optical Transfer Function (EOT) value;.
Definition: dsVideoPort.c:796
_dsVideoPortGetHDCPProtocolVersion_t
Definition: dsRpc.h:527
dsIsHDCPEnabled
dsError_t dsIsHDCPEnabled(intptr_t handle, bool *enabled)
Indicate whether a video port is HDCP protected.
Definition: dsVideoPort.c:96
dsGetCurrentOutputSettings
dsError_t dsGetCurrentOutputSettings(intptr_t handle, dsHDRStandard_t *video_eotf, dsDisplayMatrixCoefficients_t *matrix_coefficients, dsDisplayColorSpace_t *color_space, unsigned int *color_depth, dsDisplayQuantizationRange_t *quantization_range)
Get current color space setting, color depth, matrix coefficients, video Electro-Optical Transfer Fun...
Definition: dsVideoPort.c:941
dsSetPreferredColorDepth
dsError_t dsSetPreferredColorDepth(intptr_t handle, dsDisplayColorDepth_t colorDepth, bool persist)
To set the preffered color depth mode.
Definition: dsVideoPort.c:463
_dsScartParamParam_t
Definition: dsRpc.h:885
dsVideoPortTerm
dsError_t dsVideoPortTerm(void)
Terminate the Video Port sub-system.
Definition: dsVideoPort.c:511
dsERR_INVALID_PARAM
@ dsERR_INVALID_PARAM
Definition: dsError.h:87
dsError_t
dsError_t
Device Settings API Error return codes.
Definition: dsError.h:84
dsIsVideoPortEnabled
dsError_t dsIsVideoPortEnabled(intptr_t handle, bool *enabled)
Indicate whether a video port is enabled.
Definition: dsVideoPort.c:125
dsGetMatrixCoefficients
dsError_t dsGetMatrixCoefficients(intptr_t handle, dsDisplayMatrixCoefficients_t *matrix_coefficients)
Get current matrix coefficients value.
Definition: dsVideoPort.c:825
dsIsDisplaySurround
dsError_t dsIsDisplaySurround(intptr_t handle, bool *surround)
This function is used to indicate if the display connected supports surround audio.
Definition: dsVideoPort.c:273
dsSetForceHDRMode
dsError_t dsSetForceHDRMode(intptr_t handle, dsHDRStandard_t mode)
This API is used to set/reset force HDR mode.
Definition: dsVideoPort.c:974