RDK Documentation (Open Sourced RDK Components)
AampRfc.cpp
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2018 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 AampRfc.cpp
22  * @brief APIs to get RFC configured data
23  */
24 
25 #include <string>
26 #include <cstdio>
27 #include "tr181api.h"
28 #include "AampRfc.h"
29 #include "AampConfig.h"
30 
31 #ifdef AAMP_RFC_ENABLED
32 namespace RFCSettings
33 {
34 
35 #define AAMP_RFC_CALLERID "aamp"
36 
37  /**
38  * @brief Fetch data from RFC
39  * @param CallerId and Parameter to be fetched
40  * @retval std::string host value
41  */
42  std::string getRFCValue(const std::string& parameter){
43  TR181_ParamData_t param = {0};
44  std::string strhost ;
45  tr181ErrorCode_t status = getParam((char*)AAMP_RFC_CALLERID, parameter.c_str(), &param);
46  if (tr181Success == status)
47  {
48  AAMPLOG_INFO("RFC Parameter for %s is %s type = %d", parameter.c_str(), param.value, param.type);
49  strhost = std::string(param.value);
50  }
51  else if (tr181ValueIsEmpty == status)
52  {
53  // NO RFC is set , which is success case
54  AAMPLOG_TRACE("RFC Parameter : %s is not set", parameter.c_str());
55  }
56  else
57  {
58  AAMPLOG_ERR("get RFC Parameter for %s Failed : %s type = %d", parameter.c_str(), getTR181ErrorString(status), param.type);
59  }
60  return strhost;
61  }
62 }
63 #endif
64 /**
65  * EOF
66  */
AampRfc.h
Aamp RFC header files.
AampConfig.h
Configurations for AAMP.
AAMPLOG_TRACE
#define AAMPLOG_TRACE(FORMAT,...)
AAMP logging defines, this can be enabled through setLogLevel() as per the need.
Definition: AampLogManager.h:83