Dali remote control and monitoring
[platform/core/uifw/dali-adaptor.git] / adaptors / base / environment-options.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include "environment-options.h"
20
21 namespace Dali
22 {
23
24 namespace Internal
25 {
26
27 namespace Adaptor
28 {
29
30 namespace
31 {
32 const unsigned int DEFAULT_STATISTICS_LOG_FREQUENCY = 2;
33 }
34 EnvironmentOptions::EnvironmentOptions()
35 : mNetworkControl(0),
36   mFpsFrequency(0),
37   mUpdateStatusFrequency(0),
38   mPerformanceStatsLevel(0),
39   mPerformanceStatsFrequency( DEFAULT_STATISTICS_LOG_FREQUENCY),
40   mPerformanceTimeStampOutput(0),
41   mPanGestureLoggingLevel(0),
42   mPanGesturePredictionMode(-1),
43   mPanGesturePredictionAmount(-1), ///< only sets value in pan gesture if greater than 0
44   mPanGestureMaxPredictionAmount(-1),
45   mPanGestureMinPredictionAmount(-1),
46   mPanGesturePredictionAmountAdjustment(-1),
47   mPanGestureSmoothingMode(-1),
48   mPanGestureSmoothingAmount(-1.0f),
49   mPanMinimumDistance(-1),
50   mPanMinimumEvents(-1),
51   mGlesCallTime(0),
52   mWindowWidth( 0 ),
53   mWindowHeight( 0 ),
54   mLogFunction( NULL )
55 {
56 }
57
58 EnvironmentOptions::~EnvironmentOptions()
59 {
60 }
61
62 void EnvironmentOptions::SetLogOptions( const Dali::Integration::Log::LogFunction& logFunction,
63                              unsigned int networkControl,
64                              unsigned int logFrameRateFrequency,
65                              unsigned int logupdateStatusFrequency,
66                              unsigned int logPerformanceStats,
67                              unsigned int logPerformanceStatsFrequency,
68                              unsigned int performanceTimeStampOutput,
69                              unsigned int logPanGestureLevel )
70 {
71   mLogFunction = logFunction;
72   mNetworkControl = networkControl;
73   mFpsFrequency = logFrameRateFrequency;
74   mUpdateStatusFrequency = logupdateStatusFrequency;
75   mPerformanceStatsLevel = logPerformanceStats;
76   mPerformanceStatsFrequency = logPerformanceStatsFrequency;
77   mPerformanceTimeStampOutput= performanceTimeStampOutput;
78   mPanGestureLoggingLevel = logPanGestureLevel;
79 }
80
81 void EnvironmentOptions::InstallLogFunction() const
82 {
83   Dali::Integration::Log::InstallLogFunction( mLogFunction );
84 }
85
86 void EnvironmentOptions::UnInstallLogFunction() const
87 {
88   Dali::Integration::Log::UninstallLogFunction();
89 }
90
91 unsigned int EnvironmentOptions::GetNetworkControlMode() const
92 {
93   return mNetworkControl;
94 }
95 unsigned int EnvironmentOptions::GetFrameRateLoggingFrequency() const
96 {
97   return mFpsFrequency;
98 }
99
100 unsigned int EnvironmentOptions::GetUpdateStatusLoggingFrequency() const
101 {
102   return mUpdateStatusFrequency;
103 }
104
105 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingOptions() const
106 {
107   return mPerformanceStatsLevel;
108 }
109 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingFrequency() const
110 {
111   return mPerformanceStatsFrequency;
112 }
113 unsigned int EnvironmentOptions::GetPerformanceTimeStampOutput() const
114 {
115   return mPerformanceTimeStampOutput;
116 }
117
118 unsigned int EnvironmentOptions::GetPanGestureLoggingLevel() const
119 {
120   return mPanGestureLoggingLevel;
121 }
122
123 int EnvironmentOptions::GetPanGesturePredictionMode() const
124 {
125   return mPanGesturePredictionMode;
126 }
127
128 int EnvironmentOptions::GetPanGesturePredictionAmount() const
129 {
130   return mPanGesturePredictionAmount;
131 }
132
133 int EnvironmentOptions::GetPanGestureMaximumPredictionAmount() const
134 {
135   return mPanGestureMaxPredictionAmount;
136 }
137
138 int EnvironmentOptions::GetPanGestureMinimumPredictionAmount() const
139 {
140   return mPanGestureMinPredictionAmount;
141 }
142
143 int EnvironmentOptions::GetPanGesturePredictionAmountAdjustment() const
144 {
145   return mPanGesturePredictionAmountAdjustment;
146 }
147
148 int EnvironmentOptions::GetPanGestureSmoothingMode() const
149 {
150   return mPanGestureSmoothingMode;
151 }
152
153 float EnvironmentOptions::GetPanGestureSmoothingAmount() const
154 {
155   return mPanGestureSmoothingAmount;
156 }
157
158 int EnvironmentOptions::GetMinimumPanDistance() const
159 {
160   return mPanMinimumDistance;
161 }
162
163 int EnvironmentOptions::GetMinimumPanEvents() const
164 {
165   return mPanMinimumEvents;
166 }
167
168 unsigned int EnvironmentOptions::GetWindowWidth() const
169 {
170   return mWindowWidth;
171 }
172
173 unsigned int EnvironmentOptions::GetWindowHeight() const
174 {
175   return mWindowHeight;
176 }
177
178 void EnvironmentOptions::SetPanGesturePredictionMode( unsigned int mode )
179 {
180   mPanGesturePredictionMode = mode;
181 }
182
183 void EnvironmentOptions::SetPanGesturePredictionAmount( unsigned int amount )
184 {
185   mPanGesturePredictionAmount = amount;
186 }
187
188 void EnvironmentOptions::SetPanGestureMaximumPredictionAmount( unsigned int amount )
189 {
190   mPanGestureMaxPredictionAmount = amount;
191 }
192
193 void EnvironmentOptions::SetPanGestureMinimumPredictionAmount( unsigned int amount )
194 {
195   mPanGestureMinPredictionAmount = amount;
196 }
197
198 void EnvironmentOptions::SetPanGesturePredictionAmountAdjustment( unsigned int amount )
199 {
200   mPanGesturePredictionAmountAdjustment = amount;
201 }
202
203 void EnvironmentOptions::SetPanGestureSmoothingMode( unsigned int mode )
204 {
205   mPanGestureSmoothingMode = mode;
206 }
207
208 void EnvironmentOptions::SetPanGestureSmoothingAmount( float amount )
209 {
210   mPanGestureSmoothingAmount = amount;
211 }
212
213 void EnvironmentOptions::SetMinimumPanDistance( int distance )
214 {
215   mPanMinimumDistance = distance;
216 }
217
218 void EnvironmentOptions::SetMinimumPanEvents( int events )
219 {
220   mPanMinimumEvents = events;
221 }
222
223 void EnvironmentOptions::SetGlesCallTime( int time )
224 {
225   mGlesCallTime = time;
226 }
227
228 int EnvironmentOptions::GetGlesCallTime() const
229 {
230   return mGlesCallTime;
231 }
232
233 void EnvironmentOptions::SetWindowWidth( int width )
234 {
235   mWindowWidth = width;
236 }
237
238 void EnvironmentOptions::SetWindowHeight( int height )
239 {
240   mWindowHeight = height;
241 }
242
243 bool EnvironmentOptions::PerformanceServerRequired() const
244 {
245   return ( (GetPerformanceStatsLoggingOptions() > 0) ||
246            ( GetPerformanceTimeStampOutput() > 0 ) ||
247            ( GetNetworkControlMode() > 0) );
248 }
249
250 } // Adaptor
251
252 } // Internal
253
254 } // Dali