RDK Documentation (Open Sourced RDK Components)
dsMgrProductTraitsHandler.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 #include <iostream>
21 #include <thread>
22 #include <chrono>
23 #include <fstream>
24 #include <unistd.h>
25 #include <glib.h>
26 #include "dsMgrInternal.h"
27 #include "mfrTypes.h"
28 #include "mfrMgr.h"
29 #include "dsMgrProductTraitsHandler.h"
30 #include "frontPanelIndicator.hpp"
31 #include "dsRpc.h"
32 
33 using namespace dsMgrProductTraits;
34 extern bool isTVOperatingInFactory();
35 extern int _SetAVPortsPowerState(IARM_Bus_PWRMgr_PowerState_t powerState);
36 extern IARM_Result_t _dsSetFPState(void *arg);
37 
38 /*
39  Following profiles are supported:
40  * default-stb
41  * default-tv
42  * default-stb-eu
43  * default-tv-eu
44 */
45 const unsigned int REBOOT_REASON_RETRY_INTERVAL_SECONDS = 2;
46 ux_controller * ux_controller::singleton = nullptr;
47 static reboot_type_t getRebootType()
48 {
49  const char * file_updated_flag = "/tmp/Update_rebootInfo_invoked";
50  const char * reboot_info_file_name = "/opt/secure/reboot/previousreboot.info";
51  const char * hard_reboot_match_string = R"("reason":"POWER_ON_RESET")";
52  reboot_type_t ret = reboot_type_t::SOFT;
53 
54  //Check whether file has been updated first. If not, the data we read from the file is not valid.
55  if(0 != access(file_updated_flag, F_OK))
56  {
57  INT_DEBUG("%s: Error! Reboot info file isn't updated yet.\n", __func__);
58  ret = reboot_type_t::UNAVAILABLE;
59  }
60  else
61  {
62  std::ifstream reboot_info_file(reboot_info_file_name);
63  std::string line;
64  if (true == reboot_info_file.is_open())
65  {
66  while(std::getline(reboot_info_file, line))
67  {
68  if(std::string::npos != line.find(hard_reboot_match_string))
69  {
70  INT_DEBUG("%s: Detected hard reboot.\n", __func__);
71  ret = reboot_type_t::HARD;
72  break;
73  }
74  }
75  }
76  else
77  INT_DEBUG("%s: Failed to open file\n", __func__);
78  }
79  return ret;
80 }
81 
82 static gboolean reboot_reason_cb(gpointer data)
83 {
84  static unsigned int count = 0;
85  constexpr unsigned int max_count = 120 / REBOOT_REASON_RETRY_INTERVAL_SECONDS; //Stop after 2 minutes.
86 
87  reboot_type_t reboot_type = getRebootType();
88  if(reboot_type_t::UNAVAILABLE == reboot_type)
89  {
90  if(max_count >= count++)
91  {
92  return G_SOURCE_CONTINUE;
93  }
94  else
95  {
96  INT_DEBUG("%s: Exceeded retry limit.\n", __func__);
97  return G_SOURCE_REMOVE;
98  }
99  }
100  else
101  {
102  INT_DEBUG("%s: Got reboot reason in async check. Applying display configuration.\n", __func__);
103  ux_controller * ptr = static_cast <ux_controller *> (data);
104  ptr->sync_display_ports_with_reboot_reason(reboot_type);
105  return G_SOURCE_REMOVE;
106  }
107 }
108 
109 static inline bool doForceDisplayOnPostReboot() //Note: only to be used when the power state before reboot was ON.
110 {
111  const char * flag_filename = "/opt/force_display_on_after_reboot";
112  bool ret = false;
113  if(0 == access(flag_filename, F_OK))
114  ret = true;
115  INT_DEBUG("%s: %s\n", __func__, (true == ret ? "true" : "false"));
116  return ret;
117 }
118 
119 namespace dsMgrProductTraits
120 {
121 
122 /********************************* Begin base class definitions ********************************/
123 bool ux_controller::set_bootloader_pattern(mfrBlPattern_t pattern)
124 {
125  mutex.lock();
126  invalidateAsyncBootloaderPattern = true;
127  mutex.unlock();
128  return _set_bootloader_pattern(pattern);
129 }
130 
131 bool ux_controller::_set_bootloader_pattern(mfrBlPattern_t pattern) const
132 {
133  bool ret = true;
134 
135  if (false == enableSilentRebootSupport)
136  return true; // No-op on platforms that don't support it. Not logged was a warning/error as this is normal for many devices.
137 
139  mfrparam.pattern = pattern;
140  if (IARM_RESULT_SUCCESS != IARM_Bus_Call(IARM_BUS_MFRLIB_NAME, IARM_BUS_MFRLIB_API_SetBootLoaderPattern, (void *)&mfrparam, sizeof(mfrparam)))
141  {
142  INT_DEBUG("Warning! Call to IARM_BUS_MFRLIB_API_SetBootLoaderPattern failed.\n");
143  ret = false;
144  }
145  else
146  {
147  INT_DEBUG("%s: successfully set pattern %d\n", __func__, (int) pattern);
148  }
149  return ret;
150 }
151 void ux_controller::_set_bootloader_pattern_async(mfrBlPattern_t pattern) const
152 {
153  bool ret = true;
154  const unsigned int retry_interval_seconds = 5;
155  unsigned int remaining_retries = 12; //Give up after spending 1 minute trying to set pattern.
156  INT_DEBUG("%s start for pattern 0x%x\n", __func__, pattern);
157  do
158  {
159  std::this_thread::sleep_for(std::chrono::seconds(retry_interval_seconds));
160  std::unique_lock <std::mutex> lock (mutex);
161  if(false == invalidateAsyncBootloaderPattern)
162  {
163  ret = _set_bootloader_pattern(pattern);
164  }
165  else
166  {
167  INT_DEBUG("%s: bootloader pattern invalidated. Aborting.\n", __func__);
168  break;
169  }
170 
171  } while ((false == ret) && (0 < --remaining_retries));
172 
173 
174  INT_DEBUG("%s returns.\n", __func__);
175 }
176 
177 bool ux_controller::set_bootloader_pattern_fault_tolerant(mfrBlPattern_t pattern) //Handy when you suspect that mfrmgr isn't up yet and may need retries to make this work.
178 {
179  /* Note: this function is only meant to be used once, and that too immediately after a reboot, when setting bootloader pattern for the first time. It is not meant to
180  be invoked more than once and is not safe for use in such a manner; it can be race prone. */
181  bool ret = true;
182  ret = _set_bootloader_pattern(pattern);
183  if(false == ret)
184  {
185  //Failed to set bootloader pattern. This could be because mfrmgr isn't up yet. Fork a thread and retry repeatedly for a while.
186  mutex.lock();
187  invalidateAsyncBootloaderPattern = false;
188  mutex.unlock();
189  std::thread retry_thread(&ux_controller::_set_bootloader_pattern_async, this, pattern);
190  retry_thread.detach();
191  }
192  return ret;
193 }
194 
195 ux_controller::ux_controller(unsigned int in_id, const std::string &in_name, deviceType_t in_deviceType) : id(in_id), name(in_name), deviceType(in_deviceType)
196 {
197  INT_DEBUG("%s: initializing for profile id %d, name %s\n", __func__, id, name.c_str());
198  initialize_safe_defaults();
199 }
200 
201 void ux_controller::initialize_safe_defaults()
202 {
203  enableMultiColourLedSupport = false;
204  enableSilentRebootSupport = true;
205  preferedPowerModeOnReboot = POWER_MODE_LAST_KNOWN;
206  invalidateAsyncBootloaderPattern = false;
207  firstPowerTransitionComplete = false;
208 
209  if (DEVICE_TYPE_STB == deviceType)
210  {
211  ledEnabledInStandby = false;
212  ledEnabledInOnState = true;
213  }
214  else
215  {
216  ledEnabledInStandby = true;
217  ledEnabledInOnState = true;
218  }
219 }
220 
221 void ux_controller::sync_power_led_with_power_state(IARM_Bus_PWRMgr_PowerState_t power_state) const
222 {
223  if (true == enableMultiColourLedSupport)
224  {
225  INT_DEBUG("Warning! Device supports multi-colour LEDs but it isn't handled.");
226  }
227 
228  bool led_state;
229  if (IARM_BUS_PWRMGR_POWERSTATE_ON == power_state)
230  led_state = ledEnabledInOnState;
231  else
232  led_state = ledEnabledInStandby;
233 
234  try
235  {
236  INT_DEBUG("%s: setting power LED State to %s\n", __func__, (led_state ? "ON" : "FALSE"));
237  dsFPDStateParam_t param ;
238  param.eIndicator = dsFPD_INDICATOR_POWER;
239  param.state = (led_state ? dsFPD_STATE_ON : dsFPD_STATE_OFF);
240  _dsSetFPState(&param);
241  }
242  catch (...)
243  {
244  INT_DEBUG("%s: Warning! exception caught when trying to change FP state\n", __func__);
245  }
246 }
247 
248 void ux_controller::sync_display_ports_with_power_state(IARM_Bus_PWRMgr_PowerState_t power_state) const
249 {
250  _SetAVPortsPowerState(power_state);
251 }
252 bool ux_controller::initialize_ux_controller(unsigned int profile_id) // Not thread-safe
253 {
254  bool ret = true;
255  switch(profile_id)
256  {
257  case DEFAULT_STB_PROFILE:
258  singleton = new ux_controller_stb(profile_id, "default-stb");
259  break;
260 
261  case DEFAULT_TV_PROFILE:
262  singleton = new ux_controller_tv(profile_id, "default-tv");
263  break;
264 
265  case DEFAULT_STB_PROFILE_EUROPE:
266  singleton = new ux_controller_stb_eu(profile_id, "default-stb-eu");
267  break;
268 
269  case DEFAULT_TV_PROFILE_EUROPE:
270  singleton = new ux_controller_tv_eu(profile_id, "default-tv-eu");
271  break;
272 
273  default:
274  INT_DEBUG("Error! Unsupported product profile id %d\n", profile_id);
275  ret = false;
276  }
277  return ret;
278 }
279 
280 ux_controller * ux_controller::get_instance() //Not thread-safe.
281 {
282  return singleton;
283 }
284 /********************************* End base class definitions ********************************/
285 
286 
287 
288 
289 /********************************* Begin ux_controller_tv_eu class definitions ********************************/
290 
291 
292 ux_controller_tv_eu::ux_controller_tv_eu(unsigned int in_id, const std::string &in_name) : ux_controller(in_id, in_name, DEVICE_TYPE_TV)
293 {
294  preferedPowerModeOnReboot = POWER_MODE_LIGHT_SLEEP;
295 }
296 
297 bool ux_controller_tv_eu::applyPowerStateChangeConfig(IARM_Bus_PWRMgr_PowerState_t new_state, IARM_Bus_PWRMgr_PowerState_t prev_state)
298 {
299  bool ret = true;
300  sync_display_ports_with_power_state(new_state);
301  ret = set_bootloader_pattern((IARM_BUS_PWRMGR_POWERSTATE_ON == new_state ? mfrBL_PATTERN_NORMAL : mfrBL_PATTERN_SILENT_LED_ON));
302  return ret;
303 }
304 
305 bool ux_controller_tv_eu::applyPreRebootConfig(IARM_Bus_PWRMgr_PowerState_t current_state) const
306 {
307  return true;
308 }
309 bool ux_controller_tv_eu::applyPreMaintenanceRebootConfig(IARM_Bus_PWRMgr_PowerState_t current_state)
310 {
311  bool ret = true;
312  if (IARM_BUS_PWRMGR_POWERSTATE_ON != current_state) // Silent reboot only applies if maintenance reboot is triggered while TV is in one of the standby states.
313  {
314  ret = set_bootloader_pattern(mfrBL_PATTERN_SILENT);
315  }
316  return ret;
317 }
318 
319 bool ux_controller_tv_eu::applyPostRebootConfig(IARM_Bus_PWRMgr_PowerState_t target_state, IARM_Bus_PWRMgr_PowerState_t last_known_state /*last knnown power state from previous power cycle*/)
320 {
321  bool ret = true;
322  /* Note: the product requires a special LED pattern that's set by bootloader/kernel as it boots. Since power manager
323  doesn't support any fancy patterns yet, skip setting the LED configuration here so that we retain the boot pattern
324  until app takes over. */
325  if ((IARM_BUS_PWRMGR_POWERSTATE_ON == last_known_state) && (IARM_BUS_PWRMGR_POWERSTATE_STANDBY == target_state))
326  {
327  /* Special handling. Although the new power state is standby, leave display enabled. App will transition TV to ON state immediately afterwards anyway,
328  and if we turn off the display to match standby state here, it'll confuse the user into thinking that TV has gone into standby for good. */
329  sync_display_ports_with_power_state(IARM_BUS_PWRMGR_POWERSTATE_ON);
330  }
331  else
332  {
333  sync_display_ports_with_power_state(target_state);
334  }
335 
336  /* Reset applicable 'silent reboot' flags to appropriate values.
337  This device is booting into 'target_state' power state. Sync the bootloader flags to match the this state. That means, if the new state is ON,
338  set up BL display and LED flags to match ON state. If the new state is STANDBY, set up BL and LED flags to match STANDBY state.
339  */
340  mfrBlPattern_t pattern = mfrBL_PATTERN_NORMAL;
341  switch (target_state)
342  {
343  case IARM_BUS_PWRMGR_POWERSTATE_ON:
344  //Do nothing. Pattern is already set to normal.
345  break;
346 
347  case IARM_BUS_PWRMGR_POWERSTATE_STANDBY: //deliberate fall-through
348  case IARM_BUS_PWRMGR_POWERSTATE_STANDBY_LIGHT_SLEEP: //deliberate fall-through
349  case IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP:
350  pattern = mfrBL_PATTERN_SILENT_LED_ON;
351  break;
352  default:
353  INT_DEBUG("%s: Warning! Unhandled power transition. New state: %d\n", __func__, target_state);
354  break;
355  }
356  ret = set_bootloader_pattern_fault_tolerant(pattern);
357  return ret;
358 }
359 
360 IARM_Bus_PWRMgr_PowerState_t ux_controller_tv_eu::getPreferredPostRebootPowerState(IARM_Bus_PWRMgr_PowerState_t prev_state) const
361 {
362  return IARM_BUS_PWRMGR_POWERSTATE_STANDBY;
363 }
364 
365 /********************************* End ux_controller_tv_eu class definitions ********************************/
366 
367 
368 
369 /********************************* Begin ux_controller_stb_eu class definitions ********************************/
370 ux_controller_stb_eu::ux_controller_stb_eu(unsigned int in_id, const std::string &in_name) : ux_controller(in_id, in_name, DEVICE_TYPE_STB)
371 {
372  preferedPowerModeOnReboot = POWER_MODE_LIGHT_SLEEP;
373 }
374 
375 bool ux_controller_stb_eu::applyPowerStateChangeConfig(IARM_Bus_PWRMgr_PowerState_t new_state, IARM_Bus_PWRMgr_PowerState_t prev_state)
376 {
377  sync_display_ports_with_power_state(new_state);
378  sync_power_led_with_power_state(new_state);
379  return true;
380 }
381 
382 bool ux_controller_stb_eu::applyPreRebootConfig(IARM_Bus_PWRMgr_PowerState_t current_state) const
383 {
384  return true; //No-op
385 }
386 bool ux_controller_stb_eu::applyPreMaintenanceRebootConfig(IARM_Bus_PWRMgr_PowerState_t current_state)
387 {
388  bool ret = true;
389  if (IARM_BUS_PWRMGR_POWERSTATE_ON != current_state) // Silent reboot only applies if maintenance reboot is triggered while STB is in one of the standby states.
390  {
391  ret = set_bootloader_pattern(mfrBL_PATTERN_SILENT);
392  }
393  return ret;
394 }
395 
396 bool ux_controller_stb_eu::applyPostRebootConfig(IARM_Bus_PWRMgr_PowerState_t target_state, IARM_Bus_PWRMgr_PowerState_t last_known_state /*last knnown power state from previous power cycle*/)
397 {
398  bool ret = true;
399  if ((IARM_BUS_PWRMGR_POWERSTATE_ON == last_known_state) && (IARM_BUS_PWRMGR_POWERSTATE_STANDBY == target_state))
400  {
401  //Special handling. Although the new power state is standby, leave display and LED enabled.
402  sync_power_led_with_power_state(IARM_BUS_PWRMGR_POWERSTATE_ON);
403  sync_display_ports_with_power_state(IARM_BUS_PWRMGR_POWERSTATE_ON);
404  }
405  else
406  {
407  sync_power_led_with_power_state(target_state);
408  sync_display_ports_with_power_state(target_state);
409  }
410 
411  /* Reset applicable 'silent reboot' flags to appropriate values.*/
412  ret = set_bootloader_pattern_fault_tolerant(mfrBL_PATTERN_NORMAL);
413  return ret;
414 }
415 
416 IARM_Bus_PWRMgr_PowerState_t ux_controller_stb_eu::getPreferredPostRebootPowerState(IARM_Bus_PWRMgr_PowerState_t prev_state) const
417 {
418  return IARM_BUS_PWRMGR_POWERSTATE_STANDBY;
419 }
420 /********************************* End ux_controller_stb_eu class definitions ********************************/
421 
422 
423 
424 /********************************* Begin ux_controller_tv class definitions ********************************/
425 ux_controller_tv::ux_controller_tv(unsigned int in_id, const std::string &in_name) : ux_controller(in_id, in_name, DEVICE_TYPE_TV)
426 {
427  preferedPowerModeOnReboot = POWER_MODE_LIGHT_SLEEP;
428 }
429 
430 bool ux_controller_tv::applyPowerStateChangeConfig(IARM_Bus_PWRMgr_PowerState_t new_state, IARM_Bus_PWRMgr_PowerState_t prev_state)
431 {
432  mutex.lock();
433  if(false == firstPowerTransitionComplete)
434  firstPowerTransitionComplete = true; //In case we're still polling for reboot reason to turn on/off display, this will effectively cancel that job.
435  //The new power state takes precedence.
436  mutex.unlock();
437 
438  sync_display_ports_with_power_state(new_state);
439  bool ret = set_bootloader_pattern((IARM_BUS_PWRMGR_POWERSTATE_ON == new_state ? mfrBL_PATTERN_NORMAL : mfrBL_PATTERN_SILENT_LED_ON));
440  return ret;
441 }
442 
443 bool ux_controller_tv::applyPreRebootConfig(IARM_Bus_PWRMgr_PowerState_t current_state) const
444 {
445  return true;
446 }
447 bool ux_controller_tv::applyPreMaintenanceRebootConfig(IARM_Bus_PWRMgr_PowerState_t current_state)
448 {
449  bool ret = true;
450  if (IARM_BUS_PWRMGR_POWERSTATE_ON != current_state) // Silent reboot only applies if maintenance reboot is triggered while TV is in one of the standby states.
451  {
452  ret = set_bootloader_pattern(mfrBL_PATTERN_SILENT_LED_ON);
453  }
454  return ret;
455 }
456 
457 bool ux_controller_tv::applyPostRebootConfig(IARM_Bus_PWRMgr_PowerState_t target_state, IARM_Bus_PWRMgr_PowerState_t last_known_state /*last knnown power state from previous power cycle*/)
458 {
459  bool ret = true;
460  sync_power_led_with_power_state(target_state);
461 
462  if ((IARM_BUS_PWRMGR_POWERSTATE_ON == last_known_state) && (IARM_BUS_PWRMGR_POWERSTATE_STANDBY == target_state))
463  {
464  /* Special handling:
465  Although the new power state is standby, leave display enabled. If last known power state is ON, app will transition TV to ON state
466  immediately afterwards anyway, so if we turn off the display to match standby state here, it'll confuse the user into thinking that TV has gone into
467  standby for good.
468 
469  An exception to this criteria is if we just got here after a hard reboot. In that case, the product requirement is to go straight to standby
470  and stay there. Therefore we won't turn on the display here. This is to account for use cases where there is a power failure and power is restored
471  when user is away - in that scenario, we assume that there is no audience and keep the TV in standby.
472 
473  Important: The above behaviour can be a nuisance during production or testing as it can lead to the TV going dark during various production/QA stages immediately
474  after a hard reboot. Use isTVOperatingInFactory() and doForceDisplayOnPostReboot() to detect those scenarios and act accordingly.
475  */
476  if(true == doForceDisplayOnPostReboot() || (true == isTVOperatingInFactory()))
477  sync_display_ports_with_power_state(IARM_BUS_PWRMGR_POWERSTATE_ON);
478  else
479  {
480  reboot_type_t isHardReboot = getRebootType();
481  switch (isHardReboot)
482  {
483  case reboot_type_t::HARD:
484  sync_display_ports_with_power_state(IARM_BUS_PWRMGR_POWERSTATE_STANDBY);
485  break;
486 
487  case reboot_type_t::SOFT:
488  sync_display_ports_with_power_state(IARM_BUS_PWRMGR_POWERSTATE_ON);
489  break;
490 
491  default: //Unavailable. Take no action now, but keep checking every N seconds.
492  g_timeout_add_seconds(REBOOT_REASON_RETRY_INTERVAL_SECONDS, reboot_reason_cb, this);
493  break;
494  }
495  }
496  }
497  else
498  {
499  sync_display_ports_with_power_state(target_state);
500  }
501 
502  /* Reset applicable 'silent reboot' flags to appropriate values.
503  This device is booting into 'target_state' power state. Sync the bootloader flags to match the this state. That means, if the new state is ON,
504  set up BL display and LED flags to match ON state. If the new state is STANDBY, set up BL and LED flags to match STANDBY state.
505  */
506  mfrBlPattern_t pattern = mfrBL_PATTERN_NORMAL;
507  switch (target_state)
508  {
509  case IARM_BUS_PWRMGR_POWERSTATE_ON:
510  //Do nothing. Pattern is already set to normal.
511  break;
512 
513  case IARM_BUS_PWRMGR_POWERSTATE_STANDBY: //deliberate fall-through
514  case IARM_BUS_PWRMGR_POWERSTATE_STANDBY_LIGHT_SLEEP: //deliberate fall-through
515  case IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP:
516  pattern = mfrBL_PATTERN_SILENT_LED_ON;
517  break;
518  default:
519  INT_DEBUG("%s: Warning! Unhandled power transition. New state: %d\n", __func__, target_state);
520  break;
521  }
522  ret = set_bootloader_pattern_fault_tolerant(pattern);
523  return ret;
524 }
525 
526 IARM_Bus_PWRMgr_PowerState_t ux_controller_tv::getPreferredPostRebootPowerState(IARM_Bus_PWRMgr_PowerState_t prev_state) const
527 {
528  return IARM_BUS_PWRMGR_POWERSTATE_STANDBY;
529 }
530 
531 void ux_controller_tv::sync_display_ports_with_reboot_reason(reboot_type_t reboot_type)
532 {
533  // Assumes the TV is rebooting from ON state to STANDBY state.
534  mutex.lock();
535  if(false == firstPowerTransitionComplete)
536  {
537  mutex.unlock();
538  sync_display_ports_with_power_state(reboot_type_t::HARD == reboot_type? IARM_BUS_PWRMGR_POWERSTATE_STANDBY : IARM_BUS_PWRMGR_POWERSTATE_ON);
539  }
540  else // Do nothing, as we're already past the first power transition and display configuration has already been set as appropriate.
541  mutex.unlock();
542 }
543 /********************************* End ux_controller_tv class definitions ********************************/
544 
545 
546 
547 /********************************* Begin ux_controller_stb class definitions ********************************/
548 ux_controller_stb::ux_controller_stb(unsigned int in_id, const std::string &in_name) : ux_controller(in_id, in_name, DEVICE_TYPE_STB)
549 {
550  preferedPowerModeOnReboot = POWER_MODE_LAST_KNOWN;
551  enableSilentRebootSupport = false;
552 }
553 
554 bool ux_controller_stb::applyPowerStateChangeConfig(IARM_Bus_PWRMgr_PowerState_t new_state, IARM_Bus_PWRMgr_PowerState_t prev_state)
555 {
556  sync_display_ports_with_power_state(new_state);
557  sync_power_led_with_power_state(new_state);
558  return true;
559 }
560 
561 bool ux_controller_stb::applyPreRebootConfig(IARM_Bus_PWRMgr_PowerState_t current_state) const
562 {
563  return true; //No-op
564 }
565 bool ux_controller_stb::applyPreMaintenanceRebootConfig(IARM_Bus_PWRMgr_PowerState_t current_state)
566 {
567  bool ret = true;
568  return ret;
569 }
570 
571 bool ux_controller_stb::applyPostRebootConfig(IARM_Bus_PWRMgr_PowerState_t target_state, IARM_Bus_PWRMgr_PowerState_t last_known_state /*last knnown power state from previous power cycle*/)
572 {
573  bool ret = true;
574  sync_power_led_with_power_state(target_state);
575  sync_display_ports_with_power_state(target_state);
576  return ret;
577 }
578 
579 IARM_Bus_PWRMgr_PowerState_t ux_controller_stb::getPreferredPostRebootPowerState(IARM_Bus_PWRMgr_PowerState_t prev_state) const
580 {
581  return prev_state;
582 }
583 
584 /********************************* End ux_controller_stb class definitions ********************************/
585 
586 
587 }
_IARM_Bus_MFRLib_SetBLPattern_Param_t
Definition: mfrMgr.h:149
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
frontPanelIndicator.hpp
Structures and classes for front panel indicator are defined here.
dsFPD_STATE_ON
@ dsFPD_STATE_ON
Definition: dsTypes.h:821
dsMgrProductTraits::ux_controller_tv_eu
Definition: dsMgrProductTraitsHandler.h:129
dsMgrProductTraits::ux_controller
Definition: dsMgrProductTraitsHandler.h:72
IARM_BUS_MFRLIB_API_SetBootLoaderPattern
#define IARM_BUS_MFRLIB_API_SetBootLoaderPattern
Definition: mfrMgr.h:109
_dsFPDStateParam
Definition: dsRpc.h:662
dsMgrProductTraits::ux_controller_stb_eu
Definition: dsMgrProductTraitsHandler.h:140
IARM_BUS_MFRLIB_NAME
#define IARM_BUS_MFRLIB_NAME
Definition: mfrMgr.h:98
dsMgrProductTraits::ux_controller_tv
Definition: dsMgrProductTraitsHandler.h:151
dsMgrProductTraits::ux_controller_stb
Definition: dsMgrProductTraitsHandler.h:163
dsFPD_INDICATOR_POWER
#define dsFPD_INDICATOR_POWER
Definition: dsTypes.h:790
dsFPD_STATE_OFF
@ dsFPD_STATE_OFF
Definition: dsTypes.h:820
dsMgrInternal.h