2 Copyright 2004-2005 Chris Tallon
\r
4 This file is part of VOMP.
\r
6 VOMP is free software; you can redistribute it and/or modify
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 VOMP is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with VOMP; if not, write to the Free Software
\r
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
22 #include <linux/errno.h>
\r
25 #include "command.h"
\r
28 #include "remotewin.h"
\r
32 #include "remoteandroid.h"
\r
40 #include "vvolume.h"
\r
41 #include "vserverselect.h"
\r
42 #include "vwelcome.h"
\r
47 #include "timerreceiver.h"
\r
50 #include "vconnect.h"
\r
51 #include "message.h"
\r
55 #include "boxstack.h"
\r
57 #include "vsleeptimer.h"
\r
60 Command* Command::instance = NULL;
\r
64 if (instance) return;
\r
79 Command* Command::getInstance()
\r
84 int Command::init(bool tcrashed, char* tServer)
\r
86 if (initted) return 0;
\r
91 logger = Log::getInstance();
\r
92 boxstack = BoxStack::getInstance();
\r
93 remote = Remote::getInstance();
\r
95 remote->InitHWCListwithDefaults();
\r
97 if (!logger || !boxstack || !remote)
\r
103 pthread_mutex_init(&masterLock, NULL);
\r
105 masterLock=CreateMutex(NULL,FALSE,NULL);
\r
111 int Command::shutdown()
\r
113 if (!initted) return 0;
\r
118 void Command::stop()
\r
120 // VDR::getInstance()->cancelFindingServer();
\r
121 logger->log("Command", Log::NOTICE, "Command stop1...");
\r
124 logger->log("Command", Log::NOTICE, "Command stop2...");
\r
128 void Command::doWallpaper()
\r
130 Video* video = Video::getInstance();
\r
133 Boxx* bbg = new Boxx();
\r
134 bbg->setSize(video->getScreenWidth(), video->getScreenHeight());
\r
135 bbg->createBuffer();
\r
136 bbg->fillColour(DrawStyle::VIDEOBLUE);
\r
137 boxstack->add(bbg);
\r
138 boxstack->update(bbg);
\r
139 boxstack->remove(bbg);
\r
142 WJpeg* wallpaperj = new WJpegTYPE();
\r
143 wallpaperj->setSize(video->getScreenWidth(), video->getScreenHeight());
\r
144 wallpaperj->createBuffer();
\r
146 if (video->getFormat() == Video::PAL)
\r
148 logger->log("Command", Log::DEBUG, "PAL wallpaper selected");
\r
149 #ifndef _MIPS_ARCH
\r
150 wallpaperj->init("/wallpaperPAL.jpg");
\r
152 wallpaperj->init("wallpaperPAL.jpg");
\r
157 logger->log("Command", Log::DEBUG, "NTSC wallpaper selected");
\r
158 wallpaperj->init("/wallpaperNTSC.jpg");
\r
160 wallpaperj->draw();
\r
162 boxstack->add(wallpaperj);
\r
163 boxstack->update(wallpaperj);
\r
165 wallpaper = wallpaperj;
\r
168 void Command::run()
\r
170 if (!initted) return;
\r
173 mainPid = getpid();
\r
177 Video::getInstance()->signalOn();
\r
178 Led::getInstance()->on();
\r
182 // End of startup. Lock the mutex and put the first view up
\r
183 // logger->log("Command", Log::DEBUG, "WANT LOCK");
\r
185 pthread_mutex_lock(&masterLock);
\r
187 WaitForSingleObject(masterLock, INFINITE );
\r
189 //logger->log("Command", Log::DEBUG, "LOCKED");
\r
197 VConnect* vconnect = new VConnect(server);
\r
198 boxstack->add(vconnect);
\r
202 // Start method 2 of getting commands in...
\r
209 //logger->log("Command", Log::DEBUG, "UNLOCK");
\r
211 pthread_mutex_unlock(&masterLock);
\r
213 ReleaseMutex(masterLock);
\r
216 button = remote->getButtonPress(2); // FIXME why is this set to 2 and not 0? so it can quit
\r
217 // something happened, lock and process
\r
219 // logger->log("Command", Log::DEBUG, "WANT LOCK");
\r
221 pthread_mutex_lock(&masterLock);
\r
223 WaitForSingleObject(masterLock, INFINITE );
\r
225 // logger->log("Command", Log::DEBUG, "LOCK");
\r
227 if ((button == Remote::NA_NONE) /*|| (button == Remote::NA_UNKNOWN)*/) continue;
\r
229 if (button != Remote::NA_SIGNAL) handleCommand(button);
\r
230 processMessageQueue();
\r
234 //logger->log("Command", Log::DEBUG, "UNLOCK");
\r
236 pthread_mutex_unlock(&masterLock);
\r
238 ReleaseMutex(masterLock);
\r
244 void Command::postMessage(Message* m)
\r
246 // This is locked here in case the main loop is not waiting for an event, but is processing one
\r
247 // it could be killed but then not react to it because the signal wouldn't cause
\r
248 // remote->getButtonPress to break
\r
249 // locking the mutex ensures that the master thread is waiting on getButtonPress
\r
252 //logger->log("Command", Log::DEBUG, "WANT LOCK");
\r
254 pthread_mutex_lock(&masterLock);
\r
256 WaitForSingleObject(masterLock, INFINITE );
\r
258 //logger->log("Command", Log::DEBUG, "LOCK");
\r
259 MessageQueue::postMessage(m);
\r
262 #ifndef __ANDROID__
\r
263 kill(mainPid, SIGURG);
\r
265 ((RemoteAndroid*)Remote::getInstance())->Signal();
\r
267 pthread_mutex_unlock(&masterLock);
\r
269 ((RemoteWin*)Remote::getInstance())->Signal();
\r
270 ReleaseMutex(masterLock);
\r
272 //logger->log("Command", Log::DEBUG, "UNLOCK");
\r
275 void Command::postMessageNoLock(Message* m)
\r
277 // As above but use this one if this message is being posted because of a button press
\r
278 // the mutex is already locked, locking around postMessage is not needed as the
\r
279 // queue is guaranteed to be run when the button has been processed
\r
280 MessageQueue::postMessage(m);
\r
283 bool Command::postMessageIfNotBusy(Message* m)
\r
285 // Used for Windows mouse events
\r
287 //logger->log("Command", Log::DEBUG, "TRY LOCK");
\r
289 if (pthread_mutex_trylock(&masterLock) != EBUSY)
\r
291 //logger->log("Command", Log::DEBUG, "LOCK");
\r
292 MessageQueue::postMessage(m);
\r
293 #ifndef __ANDROID__
\r
294 kill(mainPid, SIGURG);
\r
296 ((RemoteAndroid*)Remote::getInstance())->Signal();
\r
298 pthread_mutex_unlock(&masterLock);
\r
299 //logger->log("Command", Log::DEBUG, "UNLOCK");
\r
307 switch (WaitForSingleObject(masterLock, 0 ))
\r
308 { //FIXME this is not "if not busy" check
\r
309 case WAIT_OBJECT_0: //but with proper argument 0 this did not work
\r
310 // case WAIT_ABANDONED:
\r
311 MessageQueue::postMessage(m);
\r
312 ((RemoteWin*)Remote::getInstance())->Signal();
\r
313 ReleaseMutex(masterLock);
\r
316 case WAIT_ABANDONED: return false;
\r
317 case WAIT_TIMEOUT: return false;
\r
323 void Command::postMessageFromOuterSpace(Message* m)
\r
326 Yet another way of getting messages into Command. This one is for events that
\r
327 are not standard button presses (or UDP generated buttons). It is also not for
\r
328 events that are generated as a result of other events (events that can safely
\r
329 call postMessageNoLock and be guaranteed that the message will be processed
\r
330 because it is known that the queue is currently being processed).
\r
331 This is for events that come from outer space and can occur when the master
\r
332 mutex is locked or not, they need to be queued and executed but it doesn't
\r
334 Actually so far it is for events caused by the video stream - aspect ratio
\r
335 changes. These can occur when the master mutex is locked and so postMessage
\r
336 doesn't work. postMessageNoLock doesn't work because if the mutex *isn't*
\r
337 locked at the time then the message could be sat around a while before
\r
339 The whole message system was at first supposed to prevent the problem of
\r
340 calling a function on an object that had just been deleted, by ordering
\r
341 messages such that all calls are done before object deletion. However,
\r
342 because of the new centralised messaging system and the fact that BoxStack
\r
343 locates the destination object before calling it, the messaging system now
\r
344 allows the kind of sloppy calls it was supposed to stop. Weird huh. This
\r
345 is mentioned here because the video stream might generate an event just as
\r
346 the user hits stop. The mutex is locked, and by the time the message
\r
347 is examined the vvideorec/live has been deleted. This doesn't matter because
\r
348 boxstack will drop the message if it can't find the matching object to
\r
350 Finally, all this is fine and dandy, except that I'm not 100% sure that
\r
351 this sloppy postMessage and hope a queued signal will force it to be processed
\r
352 thingy will actually work. Hmmm.
\r
353 Lastly <g>, I will consider making the naming system a little more sane
\r
357 logger->log("Command", Log::DEBUG, "PMFOS called");
\r
358 MessageQueue::postMessage(m);
\r
361 #ifndef __ANDROID__
\r
362 kill(mainPid, SIGURG);
\r
364 ((RemoteAndroid*)Remote::getInstance())->Signal();
\r
367 ((RemoteWin*)Remote::getInstance())->Signal();
\r
371 void Command::processMessage(Message* m)
\r
373 // FIXME - a slight modification - how if messagereceivers were to register
\r
374 // themselves as receivers to avoid the calling-a-deleted-object problem
\r
375 // then only deliver/register/unregister would have to be protected
\r
377 logger->log("Command", Log::DEBUG, "processing message %i", m->message);
\r
384 // << FIXME OBSELETE
\r
385 case Message::STOP_PLAYBACK:
\r
387 handleCommand(Remote::STOP); // an odd way of doing it, but so simple
\r
390 // Also connection_lost comes from player - anywhere else?
\r
391 // FIXME OBSELETE >>
\r
394 case Message::VDR_CONNECTED:
\r
396 doJustConnected((VConnect*)m->from);
\r
399 case Message::SCREENSHOT:
\r
401 Osd::getInstance()->screenShot("/out.jpg");
\r
404 case Message::CONNECTION_LOST:
\r
406 doFromTheTop(true);
\r
409 case Message::UDP_BUTTON:
\r
411 handleCommand(m->parameter);
\r
414 case Message::CHANGE_LANGUAGE:
\r
416 boxstack->removeAll();
\r
417 boxstack->update(wallpaper);
\r
418 I18n::initialize();
\r
419 if (!VDR::getInstance()->isConnected()) { connectionLost(); break; }
\r
420 VWelcome* vw = new VWelcome();
\r
423 boxstack->update(vw);
\r
426 case Message::LAST_VIEW_CLOSE:
\r
428 // Shouldn't be done like this. Some generic message pass back from vinfo perhaps
\r
432 doFromTheTop(false);
\r
435 // VWelcome* vw = new VWelcome();
\r
437 // boxstack->add(vw);
\r
438 // boxstack->update(vw);
\r
448 Instead of sending through the boxstack, implement a more generic MessageReceiver interface
\r
449 and have potential receivers register with something
\r
450 When a message needs to be delivered, check if the receiver is still registered, if so, deliver the message
\r
451 This could all be done using the existing big command mutex to keep it simple
\r
454 logger->log("Command", Log::DEBUG, "Sending message to boxstack");
\r
455 boxstack->processMessage(m);
\r
459 void Command::handleCommand(int button)
\r
461 if (isStandby && (button != Remote::POWER)) return;
\r
462 if (!connLost && boxstack->handleCommand(button)) return; // don't send to boxstack if connLost
\r
464 // command was not handled
\r
468 case Remote::DF_LEFT:
\r
469 case Remote::DF_RIGHT:
\r
470 case Remote::VOLUMEUP:
\r
471 case Remote::VOLUMEDOWN:
\r
473 if (remote->handlesVolume()) {
\r
474 if (button==Remote::DF_LEFT || button==Remote::VOLUMEDOWN)
\r
475 remote->volumeDown();
\r
476 else remote->volumeUp();
\r
478 VVolume* v = new VVolume();
\r
480 v->handleCommand(button); // this will draw+show
\r
486 if (remote->handlesVolume()) {
\r
487 remote->volumeMute();
\r
489 VMute* v = new VMute();
\r
492 boxstack->update(v);
\r
496 case Remote::POWER:
\r
504 if (!connLost) return; // if connLost, handle Remote::OK
\r
505 doFromTheTop(false);
\r
510 VSleeptimer* sleep = new VSleeptimer();
\r
511 boxstack->add(sleep);
\r
512 sleep->handleCommand(button); // this will draw+show
\r
518 void Command::sig1()
\r
521 Message* m = new Message(); // break into master mutex
\r
522 m->message = Message::SCREENSHOT;
\r
528 void Command::doStandby()
\r
532 Video::getInstance()->signalOn();
\r
533 Led::getInstance()->on();
\r
537 VConnect* vconnect = new VConnect(server);
\r
538 boxstack->add(vconnect);
\r
543 boxstack->removeAll();
\r
544 Video::getInstance()->signalOff();
\r
545 boxstack->update(wallpaper);
\r
547 VDR::getInstance()->configSave("General", "Last Power State", "Off");
\r
548 logger->unsetExternLogger();
\r
549 VDR::getInstance()->disconnect();
\r
550 Led::getInstance()->off();
\r
552 Sleeptimer::getInstance()->shutdown();
\r
554 stop(); //different behavoiur on windows, we exit
\r
559 void Command::doFromTheTop(bool which)
\r
565 logger->log("Command", Log::NOTICE, "Connection lost dialog already present");
\r
569 logger->log("Command", Log::NOTICE, "Doing connection lost dialog");
\r
570 connLost = new VInfo();
\r
571 connLost->setSize(360, 200);
\r
572 connLost->createBuffer();
\r
573 if (Video::getInstance()->getFormat() == Video::PAL)
\r
574 connLost->setPosition(190, 170);
\r
576 connLost->setPosition(180, 120);
\r
577 connLost->setOneLiner(tr("Connection lost"));
\r
578 connLost->setDropThrough();
\r
579 connLost->setBorderOn(1);
\r
580 connLost->setTitleBarColour(DrawStyle::DANGER);
\r
581 connLost->okButton();
\r
583 boxstack->add(connLost);
\r
584 boxstack->update(connLost);
\r
585 remote->clearBuffer();
\r
589 logger->unsetExternLogger();
\r
590 VDR::getInstance()->disconnect();
\r
591 boxstack->removeAll();
\r
592 boxstack->update(wallpaper);
\r
595 flushMessageQueue();
\r
596 remote->clearBuffer();
\r
598 // at this point, everything should be reset to first-go
\r
600 VConnect* vconnect = new VConnect(server);
\r
601 boxstack->add(vconnect);
\r
606 void Command::doReboot()
\r
609 logger->unsetExternLogger();
\r
610 VDR::getInstance()->disconnect();
\r
612 logger->log("Command", Log::NOTICE, "Reboot");
\r
614 #ifndef VOMP_HAS_EXIT
\r
615 // some plattforms, want a proper deinitialisation of their hardware before reboot
\r
616 Osd::getInstance()->shutdown();
\r
617 Audio::getInstance()->shutdown();
\r
618 Video::getInstance()->shutdown();
\r
619 Remote::getInstance()->shutdown();
\r
621 reboot(LINUX_REBOOT_CMD_RESTART);
\r
622 // if reboot is not allowed -> stop
\r
634 #endif //Would we support this on windows?
\r
637 void Command::connectionLost()
\r
639 logger->unsetExternLogger();
\r
640 Message* m = new Message(); // break into master mutex
\r
641 m->message = Message::CONNECTION_LOST;
\r
643 postMessageFromOuterSpace(m);
\r
646 void Command::buildCrashedBox()
\r
648 VInfo* crash = new VInfo();
\r
649 crash->setSize(360, 250);
\r
650 crash->createBuffer();
\r
651 if (Video::getInstance()->getFormat() == Video::PAL)
\r
652 crash->setPosition(190, 146);
\r
654 crash->setPosition(180, 96);
\r
655 crash->setMainText("Oops, vomp crashed.. :(\nPlease report this crash to the author, with as much detail as possible about what you were doing at the time that might have caused the crash.");
\r
656 crash->setBorderOn(1);
\r
657 crash->setTitleBarColour(DrawStyle::DANGER);
\r
659 crash->setExitable();
\r
661 boxstack->add(crash);
\r
662 boxstack->update(crash);
\r
665 void Command::doJustConnected(VConnect* vconnect)
\r
667 I18n::initialize();
\r
668 if (!VDR::getInstance()->isConnected()) { connectionLost(); return; }
\r
670 Video* video = Video::getInstance();
\r
671 Audio* audio = Audio::getInstance();
\r
672 boxstack->remove(vconnect);
\r
674 VInfo* vi = new VInfo();
\r
675 vi->setSize(400, 200);
\r
676 vi->createBuffer();
\r
677 if (video->getFormat() == Video::PAL)
\r
678 vi->setPosition(170, 200);
\r
680 vi->setPosition(160, 150);
\r
681 vi->setOneLiner(tr("Connected, loading config"));
\r
684 boxstack->update(vi);
\r
686 VDR* vdr = VDR::getInstance();
\r
689 // See if we're supposed to do network logging
\r
690 config = vdr->configLoad("Advanced", "Network logging");
\r
691 if (config && !STRCASECMP(config, "On"))
\r
693 logger->log("Command", Log::INFO, "Turning on network logging");
\r
694 logger->setExternLogger(vdr);
\r
698 logger->unsetExternLogger();
\r
699 logger->log("Command", Log::INFO, "Turned off network logging");
\r
701 if (config) delete[] config;
\r
703 // See if config says to override video format (PAL/NTSC)
\r
704 config = vdr->configLoad("General", "Override Video Format");
\r
707 logger->log("Command", Log::DEBUG, "Override Video Format is present");
\r
709 if ( (!strcmp(config, "PAL") && (video->getFormat() == Video::NTSC))
\r
710 || (!strcmp(config, "NTSC") && (video->getFormat() == Video::PAL)) )
\r
712 // Oh sheesh, need to switch format. Bye bye TV...
\r
714 // Take everything down
\r
715 boxstack->removeAll();
\r
716 boxstack->remove(wallpaper);
\r
717 Osd* osd = Osd::getInstance();
\r
718 #ifndef __ANDROID__
\r
723 // Get video and osd back up with the new mode
\r
724 if (!strcmp(config, "PAL"))
\r
726 logger->log("Command", Log::DEBUG, "Switching to PAL");
\r
727 video->init(Video::PAL);
\r
729 else if (!strcmp(config, "NTSC"))
\r
731 logger->log("Command", Log::DEBUG, "Switching to NTSC");
\r
732 video->init(Video::NTSC);
\r
734 #ifndef __ANDROID__
\r
735 //we do not init twice
\r
736 osd->init((char*)("/dev/stbgfx"));
\r
739 // Put the wallpaper back
\r
742 // Re add the vinfo
\r
744 vi->setSize(400, 200);
\r
745 vi->createBuffer();
\r
746 if (video->getFormat() == Video::PAL)
\r
747 vi->setPosition(170, 200);
\r
749 vi->setPosition(160, 150);
\r
751 vi->setOneLiner(tr("Connected, loading config"));
\r
754 boxstack->update(vi);
\r
758 logger->log("Command", Log::DEBUG, "Already in requested mode, or request was not 'PAL' or 'NTSC'");
\r
763 logger->log("Command", Log::DEBUG, "Phew, no dangerous on-the-fly mode switching to do!");
\r
766 // Power off if first boot and config says so
\r
771 logger->log("Command", Log::DEBUG, "Load power after boot");
\r
773 config = vdr->configLoad("General", "Power After Boot");
\r
777 if (!STRCASECMP(config, "On"))
\r
779 logger->log("Command", Log::INFO, "Config says Power After Boot = On");
\r
781 else if (!STRCASECMP(config, "Off"))
\r
783 logger->log("Command", Log::INFO, "Config says Power After Boot = Off");
\r
786 return; // quit here
\r
788 else if (!STRCASECMP(config, "Last state"))
\r
790 char* lastPowerState = vdr->configLoad("General", "Last Power State");
\r
791 if (lastPowerState)
\r
793 if (!STRCASECMP(lastPowerState, "On"))
\r
795 logger->log("Command", Log::INFO, "Config says Last Power State = On");
\r
797 else if (!STRCASECMP(lastPowerState, "Off"))
\r
799 logger->log("Command", Log::INFO, "Config says Last Power State = Off");
\r
802 return; // quit here
\r
806 logger->log("Command", Log::INFO, "Config General/Last Power State not understood");
\r
811 logger->log("Command", Log::INFO, "Config General/Last Power State not found");
\r
816 logger->log("Command", Log::INFO, "Config/Power After Boot not understood");
\r
822 logger->log("Command", Log::INFO, "Config General/Power After Boot not found");
\r
827 // Go S-Video if config says so
\r
829 config = vdr->configLoad("TV", "Connection");
\r
833 if (!STRCASECMP(config, "S-Video"))
\r
835 logger->log("Command", Log::INFO, "Switching to S-Video as Connection=%s", config);
\r
836 video->setConnection(Video::SVIDEO);
\r
840 logger->log("Command", Log::INFO, "Switching to RGB/Composite as Connection=%s", config);
\r
841 video->setConnection(Video::COMPOSITERGB);
\r
847 logger->log("Command", Log::INFO, "Config TV/S-Video not found");
\r
852 config = vdr->configLoad("General", "Remote type");
\r
856 if (!STRCASECMP(config, "New"))
\r
858 logger->log("Command", Log::INFO, "Switching to New remote type");
\r
859 remote->setRemoteType(Remote::NEWREMOTE);
\r
863 logger->log("Command", Log::INFO, "Switching to Old remote type");
\r
864 remote->setRemoteType(Remote::OLDREMOTE);
\r
870 logger->log("Command", Log::INFO, "Config General/Remote type not found");
\r
871 remote->setRemoteType(Remote::OLDREMOTE);
\r
877 // Get TV aspect ratio
\r
879 config = vdr->configLoad("TV", "Aspect");
\r
882 if (!STRCASECMP(config, "16:9"))
\r
884 logger->log("Command", Log::INFO, "/// Switching to TV aspect 16:9");
\r
885 video->setTVsize(Video::ASPECT16X9);
\r
889 logger->log("Command", Log::INFO, "/// Switching to TV aspect 4:3");
\r
890 video->setTVsize(Video::ASPECT4X3);
\r
896 logger->log("Command", Log::INFO, "Config TV/Aspect type not found, going 4:3");
\r
897 video->setTVsize(Video::ASPECT4X3);
\r
900 config = vdr->configLoad("TV", "Widemode");
\r
903 if (!STRCASECMP(config, "Letterbox"))
\r
905 logger->log("Command", Log::INFO, "Setting letterbox mode");
\r
906 video->setMode(Video::LETTERBOX);
\r
910 logger->log("Command", Log::INFO, "Setting chop-sides mode");
\r
911 video->setMode(Video::NORMAL);
\r
918 logger->log("Command", Log::INFO, "Config TV/Widemode not found, Setting letterbox mode");
\r
919 video->setMode(Video::LETTERBOX);
\r
921 logger->log("Command", Log::INFO, "Config TV/Widemode not found, Setting chop-sides mode");
\r
922 video->setMode(Video::NORMAL);
\r
926 config = vdr->configLoad("Advanced", "TCP receive window");
\r
929 size_t newTCPsize = atoi(config);
\r
932 logger->log("Command", Log::INFO, "Setting TCP window size %i", newTCPsize);
\r
933 vdr->setReceiveWindow(newTCPsize);
\r
937 logger->log("Command", Log::INFO, "TCP window size not found, setting 2048");
\r
938 vdr->setReceiveWindow(2048); // Default
\r
941 config = vdr->configLoad("Advanced", "Disable WOL");
\r
944 if (!STRCASECMP(config, "Yes"))
\r
946 logger->log("Command", Log::INFO, "Config says disable WOL");
\r
947 Wol::getInstance()->setEnabled(false);
\r
951 logger->log("Command", Log::INFO, "Config says enable WOL");
\r
952 Wol::getInstance()->setEnabled(true);
\r
959 logger->log("Command", Log::INFO, "By default, enable WOL");
\r
960 Wol::getInstance()->setEnabled(true);
\r
962 /* device dependend config */
\r
963 audio->loadOptionsfromServer(vdr);
\r
964 video->loadOptionsfromServer(vdr);
\r
965 remote->loadOptionsfromServer(vdr);
\r
968 // Save power state = on
\r
970 vdr->configSave("General", "Last Power State", "On");
\r
972 // Make sure connection didn't die
\r
973 if (!vdr->isConnected())
\r
975 Command::getInstance()->connectionLost();
\r
979 boxstack->remove(vi);
\r
981 VWelcome* vw = new VWelcome();
\r
984 boxstack->update(vw);
\r
986 // Enter pre-keys here
\r
987 // handleCommand(Remote::OK);
\r
988 // handleCommand(Remote::THREE);
\r
989 // handleCommand(Remote::SIX);
\r
990 // handleCommand(Remote::OK);
\r
991 // handleCommand(Remote::UP);
\r
992 // handleCommand(Remote::PLAY);
\r
993 // handleCommand(Remote::DOWN);
\r
994 // handleCommand(Remote::DOWN);
\r
995 // handleCommand(Remote::DOWN);
\r
996 // handleCommand(Remote::OK);
\r
997 // handleCommand(Remote::RED);
\r