RDK Documentation (Open Sourced RDK Components)
dsCompositeIn.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 "dsCompositeIn.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 
61  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
62 
63  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
64  (char *)IARM_BUS_DSMGR_API_dsCompositeInInit,
65  NULL,
66  0);
67 
68  if (IARM_RESULT_SUCCESS == rpcRet)
69  {
70  printf("%s:%d - dsERR_NONE\n", __PRETTY_FUNCTION__,__LINE__);
71  return dsERR_NONE;
72  }
73 
74  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
75  return dsERR_GENERAL;
76 }
77 
78 
80 {
81  _DEBUG_ENTER();
82 
83  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
84  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
85  (char *)IARM_BUS_DSMGR_API_dsCompositeInTerm,
86  NULL,
87  0);
88 
89  if (IARM_RESULT_SUCCESS == rpcRet)
90  {
91  printf("%s:%d - dsERR_NONE\n", __PRETTY_FUNCTION__,__LINE__);
92  return dsERR_NONE;
93  }
94 
95  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
96  return dsERR_GENERAL ;
97 }
98 
99 
100 dsError_t dsCompositeInGetNumberOfInputs (uint8_t *pNumCompositeInputs)
101 {
102  _DEBUG_ENTER();
103  _RETURN_IF_ERROR(pNumCompositeInputs != NULL, dsERR_INVALID_PARAM);
104 
105 
107  param.numCompositeInputs = 0;
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_dsCompositeInGetNumberOfInputs,
113  (void *)&param,
114  sizeof(param));
115 
116  if (IARM_RESULT_SUCCESS == rpcRet)
117  {
118  *pNumCompositeInputs = param.numCompositeInputs;
119  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param.result);
120  return param.result;
121  }
122 
123  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
124  return dsERR_GENERAL;
125 }
126 
128 {
129  _DEBUG_ENTER();
130  _RETURN_IF_ERROR(pStatus != NULL, dsERR_INVALID_PARAM);
131 
132 
134  memset (&param, 0, sizeof(param));
135 
136  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
137 
138  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
139  (char *)IARM_BUS_DSMGR_API_dsCompositeInGetStatus,
140  (void *)&param,
141  sizeof(param));
142 
143  if (IARM_RESULT_SUCCESS == rpcRet)
144  {
145  *pStatus = param.status;
146  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param.result);
147  return param.result;
148  }
149 
150  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
151  return dsERR_GENERAL;
152 }
153 
154 dsError_t dsCompositeInSelectPort (dsCompositeInPort_t ePort)
155 {
156  _DEBUG_ENTER();
157 
159  param.port = ePort;
160 
161  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
162 
163  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
164  (char *)IARM_BUS_DSMGR_API_dsCompositeInSelectPort,
165  (void *)&param,
166  sizeof(param));
167 
168  if (IARM_RESULT_SUCCESS == rpcRet)
169  {
170  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param.result);
171  return param.result;
172  }
173 
174  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
175  return dsERR_GENERAL;
176 }
177 
178 dsError_t dsCompositeInScaleVideo (int32_t x, int32_t y, int32_t width, int32_t height)
179 {
180  _DEBUG_ENTER();
181 
183  param.videoRect.x = x;
184  param.videoRect.y = y;
185  param.videoRect.width = width;
186  param.videoRect.height = height;
187  IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
188 
189  rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
190  (char *)IARM_BUS_DSMGR_API_dsCompositeInScaleVideo,
191  (void *)&param,
192  sizeof(param));
193 
194  if (IARM_RESULT_SUCCESS == rpcRet)
195  {
196  printf("%s:%d - %d\n", __PRETTY_FUNCTION__,__LINE__, param.result);
197  return param.result;
198  }
199 
200  printf("%s:%d - dsERR_GENERAL\n", __PRETTY_FUNCTION__,__LINE__);
201  return dsERR_GENERAL;
202 }
203 
204 
205 /** @} */
206 /** @} */
dsCompositeInInit
dsError_t dsCompositeInInit(void)
Initialize the underlying COMPOSITE Input sub-system.
Definition: dsCompositeIn.c:58
_dsCompositeInScaleVideoParam_t
Definition: dsRpc.h:767
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
dsERR_GENERAL
@ dsERR_GENERAL
Definition: dsError.h:86
dsERR_NONE
@ dsERR_NONE
Definition: dsError.h:85
dsCompositeInTerm
dsError_t dsCompositeInTerm(void)
Terminate the underlying COMPOSITE Input sub-system.
Definition: dsCompositeIn.c:79
_dsCompositeInGetNumberOfInputsParam_t
Definition: dsRpc.h:749
libIBus.h
RDK IARM-Bus API Declarations.
_dsCompositeInStatus_t
Definition: dsTypes.h:1076
dsCompositeInGetNumberOfInputs
dsError_t dsCompositeInGetNumberOfInputs(uint8_t *pNumCompositeInputs)
Get the number of COMPOSITE Input ports on the set-top.
Definition: dsCompositeIn.c:100
dsCompositeInSelectPort
dsError_t dsCompositeInSelectPort(dsCompositeInPort_t ePort)
Select the COMPOSITE Input port to be presented.
Definition: dsCompositeIn.c:154
dsCompositeInScaleVideo
dsError_t dsCompositeInScaleVideo(int32_t x, int32_t y, int32_t width, int32_t height)
Scale the COMPOSITE In video This function is used to scale the COMPOSITE In video.
Definition: dsCompositeIn.c:178
dsCompositeIn.h
Device Settings HAL COMPOSITE Input Public API. This API defines the HAL for the Device Settings COMP...
_dsCompositeInGetStatusParam_t
Definition: dsRpc.h:755
_dsCompositeInSelectPortParam_t
Definition: dsRpc.h:761
dsERR_INVALID_PARAM
@ dsERR_INVALID_PARAM
Definition: dsError.h:87
dsError_t
dsError_t
Device Settings API Error return codes.
Definition: dsError.h:84
dsCompositeInGetStatus
dsError_t dsCompositeInGetStatus(dsCompositeInStatus_t *pStatus)
Get the COMPOSITE Input Status.
Definition: dsCompositeIn.c:127