RDK Documentation (Open Sourced RDK Components)
FakeAampConfig.cpp
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 2022 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 #include "AampConfig.h"
21 #include "MockAampConfig.h"
22 
23 MockAampConfig *g_mockAampConfig = nullptr;
24 
25 template void AampConfig::SetConfigValue<long>(ConfigPriority owner, AAMPConfigSettings cfg , const long &value);
26 template void AampConfig::SetConfigValue<double>(ConfigPriority owner, AAMPConfigSettings cfg , const double &value);
27 template void AampConfig::SetConfigValue<int>(ConfigPriority owner, AAMPConfigSettings cfg , const int &value);
28 template void AampConfig::SetConfigValue<bool>(ConfigPriority owner, AAMPConfigSettings cfg , const bool &value);
29 
31 {
32 }
33 
35 {
36  return *this;
37 }
38 
39 void AampConfig::Initialize()
40 {
41 }
42 
44 {
45  if (g_mockAampConfig != nullptr)
46  {
47  return g_mockAampConfig->IsConfigSet(cfg);
48  }
49  else
50  {
51  return false;
52  }
53 }
54 
56 {
57  if (g_mockAampConfig != nullptr)
58  {
59  return g_mockAampConfig->GetConfigValue(cfg, value);
60  }
61  else
62  {
63  return false;
64  }
65 }
66 
68 {
69  if (g_mockAampConfig != nullptr)
70  {
71  return g_mockAampConfig->GetConfigValue(cfg, value);
72  }
73  else
74  {
75  return false;
76  }
77 }
78 
79 bool AampConfig::GetConfigValue(AAMPConfigSettings cfg, double &value)
80 {
81  if (g_mockAampConfig != nullptr)
82  {
83  return g_mockAampConfig->GetConfigValue(cfg, value);
84  }
85  else
86  {
87  return false;
88  }
89 }
90 
91 bool AampConfig::GetConfigValue(AAMPConfigSettings cfg, std::string &value)
92 {
93  if (g_mockAampConfig != nullptr)
94  {
95  return g_mockAampConfig->GetConfigValue(cfg, value);
96  }
97  else
98  {
99  return false;
100  }
101 }
102 
103 template<typename T>
104 void AampConfig::SetConfigValue(ConfigPriority owner, AAMPConfigSettings cfg ,const T &value)
105 {
106 }
107 
108 template <>
109 void AampConfig::SetConfigValue(ConfigPriority owner, AAMPConfigSettings cfg , const std::string &value)
110 {
111 }
112 
114 {
115 }
116 
118 {
119  return false;
120 }
121 
123 {
124  return false;
125 }
126 
128 {
129 }
130 
132 {
133 }
134 
136 {
137 }
138 
140 {
141 }
142 
143 bool AampConfig::ProcessConfigJson(const cJSON *cfgdata, ConfigPriority owner )
144 {
145  return false;
146 }
147 
149 {
150 }
151 
153 {
154  return AAMP_DEFAULT_SETTING;
155 }
156 
157 bool AampConfig::GetAampConfigJSONStr(std::string &str)
158 {
159  return false;
160 }
161 
162 std::string AampConfig::GetUserAgentString()
163 {
164  return "";
165 }
166 
167 const char * AampConfig::GetChannelOverride(const std::string manifestUrl)
168 {
169  return nullptr;
170 }
171 
172 const char * AampConfig::GetChannelLicenseOverride(const std::string manifestUrl)
173 {
174  return nullptr;
175 }
176 
177 bool AampConfig::CustomSearch( std::string url, int playerId , std::string appname)
178 {
179  return false;
180 }
AampConfig::SetConfigValue
void SetConfigValue(ConfigPriority owner, AAMPConfigSettings cfg, const T &value)
SetConfigValue - Set function to set bool/int/long data type configuration.
Definition: AampConfig.cpp:830
MockAampConfig
Definition: MockAampConfig.h:26
AampConfig::GetAampConfigJSONStr
bool GetAampConfigJSONStr(std::string &str)
GetAampConfigJSONStr - Function to Complete Config as JSON str.
Definition: AampConfig.cpp:1287
AAMP_DEFAULT_SETTING
@ AAMP_DEFAULT_SETTING
Definition: AampDefine.h:210
AampConfig::GetChannelOverride
const char * GetChannelOverride(const std::string chName)
GetChannelOverride - Gets channel override url for channel Name.
Definition: AampConfig.cpp:764
AampConfig::operator=
AampConfig & operator=(const AampConfig &)
AampConfig Copy Constructor function.
Definition: AampConfig.cpp:317
AampLogManager
AampLogManager Class.
Definition: AampLogManager.h:150
AampConfig
AAMP Config Class defn.
Definition: AampConfig.h:457
AampConfig::GetConfigValue
bool GetConfigValue(AAMPConfigSettings cfg, std::string &value)
GetConfigValue - Gets configuration for string data type.
Definition: AampConfig.cpp:748
AampConfig::ProcessConfigJson
bool ProcessConfigJson(const char *cfg, ConfigPriority owner)
ProcessConfigJson - Function to parse and process json configuration string.
Definition: AampConfig.cpp:889
AampConfig::ReadOperatorConfiguration
void ReadOperatorConfiguration()
ReadOperatorConfiguration - Reads Operator configuration from RFC and env variables.
Definition: AampConfig.cpp:1789
AampConfig::ReadAampCfgJsonFile
bool ReadAampCfgJsonFile()
ReadAampCfgJsonFile - Function to parse and process configuration file in json format.
Definition: AampConfig.cpp:1523
ConfigPriority
ConfigPriority
AAMP Config Ownership values.
Definition: AampDefine.h:208
AampConfig::DoCustomSetting
void DoCustomSetting(ConfigPriority owner)
DoCustomSetting - Function to do override , to avoid complexity with multiple configs.
Definition: AampConfig.cpp:1993
AampConfig::GetChannelLicenseOverride
const char * GetChannelLicenseOverride(const std::string chName)
GetChannelLicenseOverride - Gets channel License override url for channel Url.
Definition: AampConfig.cpp:785
AampConfig.h
Configurations for AAMP.
AampConfig::GetConfigOwner
ConfigPriority GetConfigOwner(AAMPConfigSettings cfg)
GetConfigOwner - Gets configuration Owner.
Definition: AampConfig.cpp:680
AampConfig::ReadDeviceCapability
void ReadDeviceCapability()
Definition: AampConfig.cpp:609
AampConfig::RestoreConfiguration
void RestoreConfiguration(ConfigPriority owner, AampLogManager *mLogObj)
RestoreConfiguration - Function is restore last configuration value from current ownership.
Definition: AampConfig.cpp:2147
AampConfig::ShowOperatorSetConfiguration
void ShowOperatorSetConfiguration()
ShowOperatorSetConfiguration - List all operator configured settings.
Definition: AampConfig.cpp:1909
AampConfig::CustomSearch
bool CustomSearch(std::string url, int playerId, std::string appname)
CustomSearch - Function to apply custom search.
Definition: AampConfig.cpp:1142
AampConfig::AampConfig
AampConfig()
AampConfig Constructor function . Default values defined.
Definition: AampConfig.cpp:305
AampConfig::ShowDevCfgConfiguration
void ShowDevCfgConfiguration()
ShowDevCfgConfiguration - List all developer configured settings.
Definition: AampConfig.cpp:1947
AampConfig::IsConfigSet
bool IsConfigSet(AAMPConfigSettings cfg)
Gets the boolean configuration value.
Definition: AampConfig.cpp:649
AampConfig::ReadAampCfgTxtFile
bool ReadAampCfgTxtFile()
ReadAampCfgTxtFile - Function to parse and process configuration file in text format.
Definition: AampConfig.cpp:1574
AAMPConfigSettings
AAMPConfigSettings
AAMP Config Settings.
Definition: AampConfig.h:95