RDK Documentation (Open Sourced RDK Components)
hdmiIn.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 
21 
22 /**
23 * @defgroup devicesettings
24 * @{
25 * @defgroup sample
26 * @{
27 **/
28 
29 
30 #include <iostream>
31 #include "libIBus.h"
32 #include "hdmiIn.hpp"
33 #include "manager.hpp"
34 #include "dsUtl.h"
35 #include "dsError.h"
36 #include <exception>
37 #include <stdio.h>
38 #include <stdlib.h>
39 #include <unistd.h>
40 #include <string.h>
41 
42 int main(int argc, char *argv[])
43 {
44 
45  int i =0;
46 
47  if (argc != 2) {
48  printf("%s : <HDMI Input Port Index - 0, 1..> \r\n", argv[0]);
49  return 0;
50  }
51 
52  char *portId = argv[1];
53 
54  printf("%s : %s\r\n", argv[0],argv[1]);
55 
56  IARM_Bus_Init("SampleDSClient");
58 
60 
61  try {
63  printf("Device has %d HDMI inputs \r\n", numInputs);
64  int selectedPort = atoi(portId);
65  if(selectedPort < numInputs) {
66  printf("Start HDMI port, press ENTER to stop\r\n");
68  getc(stdin);
69  printf("Stop HDMI port \r\n");
70  device::HdmiInput::getInstance().selectPort(HDMI_IN_PORT_NONE);
71  }
72  else {
73  printf("Wrong input port number %d\r\n", selectedPort);
74  }
75  }
76  catch (const std::exception e) {
77  printf("Exception caught\r\n");
78  }
79 
80  while(++i < 2) {
81  printf("SampleDSClient Hearbeat\r\n");
82  sleep(2);
83  }
84 
85 
88  IARM_Bus_Term();
89 
90  return 0;
91 }
92 
93 
94 /** @} */
95 /** @} */
device::HdmiInput::getInstance
static HdmiInput & getInstance()
This API is used to get the instance of the HDMI Input.
Definition: hdmiIn.cpp:110
IARM_Bus_Term
IARM_Result_t IARM_Bus_Term(void)
This API is used to terminate the IARM-Bus library.
hdmiIn.hpp
Structures and classes for HDMI Input are defined here.
manager.hpp
It contains class referenced by manager.cpp file.
dsError.h
Device Settings HAL error codes.
dsUtl.h
Device Settings HAL utilities.
IARM_Bus_Disconnect
IARM_Result_t IARM_Bus_Disconnect(void)
This API disconnect Application from IARM Bus so the application will not receive any IARM event or R...
device::Manager::Initialize
static void Initialize()
This API is used to initialize the Device Setting module. Each API should be called by any client of ...
Definition: manager.cpp:97
libIBus.h
RDK IARM-Bus API Declarations.
device::HdmiInput::selectPort
void selectPort(int8_t Port) const
This API is used to select the HDMI In port to be presented.
Definition: hdmiIn.cpp:246
device::Manager::DeInitialize
static void DeInitialize()
This API is used to deinitialize the device settings module. DeInitialize() must be called to release...
Definition: manager.cpp:138
IARM_Bus_Connect
IARM_Result_t IARM_Bus_Connect(void)
This API is used to connect application to the IARM bus daemon. After connected, the application can ...
Definition: iarmMgrMocks.cpp:33
device::HdmiInput::getNumberOfInputs
uint8_t getNumberOfInputs() const
This API is used to get the number of HDMI Input ports on the set-top.
Definition: hdmiIn.cpp:125
IARM_Bus_Init
IARM_Result_t IARM_Bus_Init(const char *name)
This API is used to initialize the IARM-Bus library.
Definition: iarmMgrMocks.cpp:38