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
669 logger->log("Command", Log::INFO, "Entering doJustConnected");
\r
671 Video* video = Video::getInstance();
\r
672 Audio* audio = Audio::getInstance();
\r
673 boxstack->remove(vconnect);
\r
675 VInfo* vi = new VInfo();
\r
676 vi->setSize(400, 200);
\r
677 vi->createBuffer();
\r
678 if (video->getFormat() == Video::PAL)
\r
679 vi->setPosition(170, 200);
\r
681 vi->setPosition(160, 150);
\r
682 vi->setOneLiner(tr("Connected, loading config"));
\r
685 boxstack->update(vi);
\r
687 VDR* vdr = VDR::getInstance();
\r
690 // See if we're supposed to do network logging
\r
691 config = vdr->configLoad("Advanced", "Network logging");
\r
692 if (config && !STRCASECMP(config, "On"))
\r
694 logger->log("Command", Log::INFO, "Turning on network logging");
\r
695 logger->setExternLogger(vdr);
\r
699 logger->unsetExternLogger();
\r
700 logger->log("Command", Log::INFO, "Turned off network logging");
\r
702 if (config) delete[] config;
\r
704 // See if config says to override video format (PAL/NTSC)
\r
705 config = vdr->configLoad("General", "Override Video Format");
\r
708 logger->log("Command", Log::DEBUG, "Override Video Format is present");
\r
710 if ( (!strcmp(config, "PAL") && (video->getFormat() != Video::PAL))
\r
711 || (!strcmp(config, "NTSC") && (video->getFormat() != Video::NTSC))
\r
712 || (!strcmp(config, "PAL_M") && (video->getFormat() != Video::PAL_M))
\r
713 || (!strcmp(config, "NTSC_J") && (video->getFormat() != Video::NTSC_J))
\r
716 // Oh sheesh, need to switch format. Bye bye TV...
\r
718 // Take everything down
\r
719 boxstack->removeAll();
\r
720 boxstack->remove(wallpaper);
\r
721 Osd* osd = Osd::getInstance();
\r
722 #ifndef __ANDROID__
\r
727 remote->shutdown(); // need on raspberry shut not do any harm, hopefully
\r
728 remote->init(RemoteStartDev);
\r
730 // Get video and osd back up with the new mode
\r
731 if (!strcmp(config, "PAL"))
\r
733 logger->log("Command", Log::DEBUG, "Switching to PAL");
\r
734 video->init(Video::PAL);
\r
736 else if (!strcmp(config, "NTSC"))
\r
738 logger->log("Command", Log::DEBUG, "Switching to NTSC");
\r
739 video->init(Video::NTSC);
\r
740 } else if (!strcmp(config, "PAL_M"))
\r
742 logger->log("Command", Log::DEBUG, "Switching to PAL_M");
\r
743 video->init(Video::PAL_M);
\r
744 } else if (!strcmp(config, "NTSC_J"))
\r
746 logger->log("Command", Log::DEBUG, "Switching to NTSC_J");
\r
747 video->init(Video::NTSC_J);
\r
749 #ifndef __ANDROID__
\r
750 //we do not init twice
\r
751 osd->init((char*)("/dev/stbgfx"));
\r
754 // Put the wallpaper back
\r
757 // Re add the vinfo
\r
759 vi->setSize(400, 200);
\r
760 vi->createBuffer();
\r
761 if (video->getFormat() == Video::PAL)
\r
762 vi->setPosition(170, 200);
\r
764 vi->setPosition(160, 150);
\r
766 vi->setOneLiner(tr("Connected, loading config"));
\r
769 boxstack->update(vi);
\r
773 logger->log("Command", Log::DEBUG, "Already in requested mode, or request was not 'PAL' or 'NTSC'");
\r
778 logger->log("Command", Log::DEBUG, "Phew, no dangerous on-the-fly mode switching to do!");
\r
781 // Power off if first boot and config says so
\r
786 logger->log("Command", Log::DEBUG, "Load power after boot");
\r
788 config = vdr->configLoad("General", "Power After Boot");
\r
792 if (!STRCASECMP(config, "On"))
\r
794 logger->log("Command", Log::INFO, "Config says Power After Boot = On");
\r
796 else if (!STRCASECMP(config, "Off"))
\r
798 logger->log("Command", Log::INFO, "Config says Power After Boot = Off");
\r
801 return; // quit here
\r
803 else if (!STRCASECMP(config, "Last state"))
\r
805 char* lastPowerState = vdr->configLoad("General", "Last Power State");
\r
806 if (lastPowerState)
\r
808 if (!STRCASECMP(lastPowerState, "On"))
\r
810 logger->log("Command", Log::INFO, "Config says Last Power State = On");
\r
812 else if (!STRCASECMP(lastPowerState, "Off"))
\r
814 logger->log("Command", Log::INFO, "Config says Last Power State = Off");
\r
817 return; // quit here
\r
821 logger->log("Command", Log::INFO, "Config General/Last Power State not understood");
\r
826 logger->log("Command", Log::INFO, "Config General/Last Power State not found");
\r
831 logger->log("Command", Log::INFO, "Config/Power After Boot not understood");
\r
837 logger->log("Command", Log::INFO, "Config General/Power After Boot not found");
\r
842 // Go S-Video if config says so
\r
844 config = vdr->configLoad("TV", "Connection");
\r
848 if (!STRCASECMP(config, "S-Video"))
\r
850 logger->log("Command", Log::INFO, "Switching to S-Video as Connection=%s", config);
\r
851 video->setConnection(Video::SVIDEO);
\r
852 } else if (!STRCASECMP(config, "HDMI"))
\r
854 logger->log("Command", Log::INFO, "Switching to HDMI as Connection=%s", config);
\r
855 video->setConnection(Video::HDMI);
\r
856 } else if (!STRCASECMP(config, "HDMI3D"))
\r
858 logger->log("Command", Log::INFO, "Switching to HDMI3D as Connection=%s", config);
\r
859 video->setConnection(Video::HDMI3D);
\r
863 logger->log("Command", Log::INFO, "Switching to RGB/Composite as Connection=%s", config);
\r
864 video->setConnection(Video::COMPOSITERGB);
\r
870 logger->log("Command", Log::INFO, "Config TV/S-Video not found");
\r
875 config = vdr->configLoad("General", "Remote type");
\r
879 if (!STRCASECMP(config, "New"))
\r
881 logger->log("Command", Log::INFO, "Switching to New remote type");
\r
882 remote->setRemoteType(Remote::NEWREMOTE);
\r
886 logger->log("Command", Log::INFO, "Switching to Old remote type");
\r
887 remote->setRemoteType(Remote::OLDREMOTE);
\r
893 logger->log("Command", Log::INFO, "Config General/Remote type not found");
\r
894 remote->setRemoteType(Remote::OLDREMOTE);
\r
900 // Get TV aspect ratio
\r
902 config = vdr->configLoad("TV", "Aspect");
\r
905 if (!STRCASECMP(config, "16:9"))
\r
907 logger->log("Command", Log::INFO, "/// Switching to TV aspect 16:9");
\r
908 video->setTVsize(Video::ASPECT16X9);
\r
912 logger->log("Command", Log::INFO, "/// Switching to TV aspect 4:3");
\r
913 video->setTVsize(Video::ASPECT4X3);
\r
919 logger->log("Command", Log::INFO, "Config TV/Aspect type not found, going 4:3");
\r
920 video->setTVsize(Video::ASPECT4X3);
\r
923 config = vdr->configLoad("TV", "Widemode");
\r
926 if (!STRCASECMP(config, "Letterbox"))
\r
928 logger->log("Command", Log::INFO, "Setting letterbox mode");
\r
929 video->setMode(Video::LETTERBOX);
\r
933 logger->log("Command", Log::INFO, "Setting chop-sides mode");
\r
934 video->setMode(Video::NORMAL);
\r
941 logger->log("Command", Log::INFO, "Config TV/Widemode not found, Setting letterbox mode");
\r
942 video->setMode(Video::LETTERBOX);
\r
944 logger->log("Command", Log::INFO, "Config TV/Widemode not found, Setting chop-sides mode");
\r
945 video->setMode(Video::NORMAL);
\r
949 config = vdr->configLoad("Advanced", "TCP receive window");
\r
952 size_t newTCPsize = atoi(config);
\r
955 logger->log("Command", Log::INFO, "Setting TCP window size %i", newTCPsize);
\r
956 vdr->setReceiveWindow(newTCPsize);
\r
960 logger->log("Command", Log::INFO, "TCP window size not found, setting 2048");
\r
961 vdr->setReceiveWindow(2048); // Default
\r
964 config = vdr->configLoad("Advanced", "Disable WOL");
\r
967 if (!STRCASECMP(config, "Yes"))
\r
969 logger->log("Command", Log::INFO, "Config says disable WOL");
\r
970 Wol::getInstance()->setEnabled(false);
\r
974 logger->log("Command", Log::INFO, "Config says enable WOL");
\r
975 Wol::getInstance()->setEnabled(true);
\r
982 logger->log("Command", Log::INFO, "By default, enable WOL");
\r
983 Wol::getInstance()->setEnabled(true);
\r
985 /* device dependend config */
\r
986 audio->loadOptionsfromServer(vdr);
\r
987 video->loadOptionsfromServer(vdr);
\r
988 remote->loadOptionsfromServer(vdr);
\r
990 video->executePendingModeChanges();
\r
993 // Save power state = on
\r
995 vdr->configSave("General", "Last Power State", "On");
\r
997 // Make sure connection didn't die
\r
998 if (!vdr->isConnected())
\r
1000 Command::getInstance()->connectionLost();
\r
1004 boxstack->remove(vi);
\r
1006 VWelcome* vw = new VWelcome();
\r
1008 boxstack->add(vw);
\r
1009 boxstack->update(vw);
\r
1011 // Enter pre-keys here
\r
1012 // handleCommand(Remote::OK);
\r
1013 // handleCommand(Remote::THREE);
\r
1014 // handleCommand(Remote::SIX);
\r
1015 // handleCommand(Remote::OK);
\r
1016 // handleCommand(Remote::UP);
\r
1017 // handleCommand(Remote::PLAY);
\r
1018 // handleCommand(Remote::DOWN);
\r
1019 // handleCommand(Remote::DOWN);
\r
1020 // handleCommand(Remote::DOWN);
\r
1021 // handleCommand(Remote::OK);
\r
1022 // handleCommand(Remote::RED);
\r