2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include <linux/errno.h>
28 #include "remotewin.h"
32 #include "remoteandroid.h"
41 #include "vserverselect.h"
47 #include "timerreceiver.h"
57 #include "vsleeptimer.h"
61 Command* Command::instance = NULL;
73 wallpaper = wallpaper_pict = NULL;
81 Command* Command::getInstance()
86 int Command::init(bool tcrashed, char* tServer)
88 if (initted) return 0;
93 logger = Log::getInstance();
94 boxstack = BoxStack::getInstance();
95 remote = Remote::getInstance();
97 remote->InitHWCListwithDefaults();
99 if (!logger || !boxstack || !remote)
105 SkinFactory::InitSkin(0);
108 pthread_mutex_init(&masterLock, NULL);
110 masterLock=CreateMutex(NULL,FALSE,NULL);
116 int Command::shutdown()
118 if (!initted) return 0;
125 // VDR::getInstance()->cancelFindingServer();
126 logger->log("Command", Log::NOTICE, "Command stop1...");
129 logger->log("Command", Log::NOTICE, "Command stop2...");
133 void Command::doWallpaper()
135 Video* video = Video::getInstance();
138 Boxx* bbg = new Boxx();
139 bbg->setSize(video->getScreenWidth(), video->getScreenHeight());
141 bbg->fillColour(DrawStyle::WALLPAPER);
143 boxstack->update(bbg);
144 boxstack->remove(bbg);
147 wallpaper = new Boxx();
148 wallpaper->setSize(video->getScreenWidth(), video->getScreenHeight());
149 wallpaper->createBuffer();
150 wallpaper ->setBackgroundColour(DrawStyle::WALLPAPER);
155 wallpaper_pict = new WJpegTYPE();
156 wallpaper_pict->setSize(video->getScreenWidth(), video->getScreenHeight());
159 if (video->getFormat() == Video::PAL)
161 logger->log("Command", Log::DEBUG, "PAL wallpaper selected");
163 wallpaper_pict->init("/wallpaperPAL.jpg");
165 wallpaper_pict->init("wallpaperPAL.jpg");
170 logger->log("Command", Log::DEBUG, "NTSC wallpaper selected");
171 wallpaper_pict->init("/wallpaperNTSC.jpg");
173 if (DrawStyle::WALLPAPER.alpha) {
174 wallpaper_pict->setVisible(true);
176 wallpaper_pict->setVisible(false);
178 wallpaper->add(wallpaper_pict);
181 boxstack->add(wallpaper);
182 boxstack->update(wallpaper);
190 if (!initted) return;
197 Video::getInstance()->signalOn();
198 Led::getInstance()->on();
202 // End of startup. Lock the mutex and put the first view up
203 // logger->log("Command", Log::DEBUG, "WANT LOCK");
205 pthread_mutex_lock(&masterLock);
207 WaitForSingleObject(masterLock, INFINITE );
209 //logger->log("Command", Log::DEBUG, "LOCKED");
217 VConnect* vconnect = new VConnect(server);
218 boxstack->add(vconnect);
222 // Start method 2 of getting commands in...
229 //logger->log("Command", Log::DEBUG, "UNLOCK");
231 pthread_mutex_unlock(&masterLock);
233 ReleaseMutex(masterLock);
236 button = remote->getButtonPress(2); // FIXME why is this set to 2 and not 0? so it can quit
237 // something happened, lock and process
239 // logger->log("Command", Log::DEBUG, "WANT LOCK");
241 pthread_mutex_lock(&masterLock);
243 WaitForSingleObject(masterLock, INFINITE );
245 // logger->log("Command", Log::DEBUG, "LOCK");
247 if ((button == Remote::NA_NONE) /*|| (button == Remote::NA_UNKNOWN)*/) continue;
249 if (button != Remote::NA_SIGNAL) handleCommand(button);
250 processMessageQueue();
254 //logger->log("Command", Log::DEBUG, "UNLOCK");
256 pthread_mutex_unlock(&masterLock);
258 ReleaseMutex(masterLock);
264 void Command::postMessage(Message* m)
266 // This is locked here in case the main loop is not waiting for an event, but is processing one
267 // it could be killed but then not react to it because the signal wouldn't cause
268 // remote->getButtonPress to break
269 // locking the mutex ensures that the master thread is waiting on getButtonPress
272 //logger->log("Command", Log::DEBUG, "WANT LOCK");
274 pthread_mutex_lock(&masterLock);
276 WaitForSingleObject(masterLock, INFINITE );
278 //logger->log("Command", Log::DEBUG, "LOCK");
279 MessageQueue::postMessage(m);
283 kill(mainPid, SIGURG);
285 ((RemoteAndroid*)Remote::getInstance())->Signal();
287 pthread_mutex_unlock(&masterLock);
289 ((RemoteWin*)Remote::getInstance())->Signal();
290 ReleaseMutex(masterLock);
292 //logger->log("Command", Log::DEBUG, "UNLOCK");
295 void Command::postMessageNoLock(Message* m)
297 // As above but use this one if this message is being posted because of a button press
298 // the mutex is already locked, locking around postMessage is not needed as the
299 // queue is guaranteed to be run when the button has been processed
300 MessageQueue::postMessage(m);
303 bool Command::postMessageIfNotBusy(Message* m)
305 // Used for Windows mouse events
307 //logger->log("Command", Log::DEBUG, "TRY LOCK");
309 if (pthread_mutex_trylock(&masterLock) != EBUSY)
311 //logger->log("Command", Log::DEBUG, "LOCK");
312 MessageQueue::postMessage(m);
314 kill(mainPid, SIGURG);
316 ((RemoteAndroid*)Remote::getInstance())->Signal();
318 pthread_mutex_unlock(&masterLock);
319 //logger->log("Command", Log::DEBUG, "UNLOCK");
327 switch (WaitForSingleObject(masterLock, 0 ))
328 { //FIXME this is not "if not busy" check
329 case WAIT_OBJECT_0: //but with proper argument 0 this did not work
330 // case WAIT_ABANDONED:
331 MessageQueue::postMessage(m);
332 ((RemoteWin*)Remote::getInstance())->Signal();
333 ReleaseMutex(masterLock);
336 case WAIT_ABANDONED: return false;
337 case WAIT_TIMEOUT: return false;
343 void Command::postMessageFromOuterSpace(Message* m)
346 Yet another way of getting messages into Command. This one is for events that
347 are not standard button presses (or UDP generated buttons). It is also not for
348 events that are generated as a result of other events (events that can safely
349 call postMessageNoLock and be guaranteed that the message will be processed
350 because it is known that the queue is currently being processed).
351 This is for events that come from outer space and can occur when the master
352 mutex is locked or not, they need to be queued and executed but it doesn't
354 Actually so far it is for events caused by the video stream - aspect ratio
355 changes. These can occur when the master mutex is locked and so postMessage
356 doesn't work. postMessageNoLock doesn't work because if the mutex *isn't*
357 locked at the time then the message could be sat around a while before
359 The whole message system was at first supposed to prevent the problem of
360 calling a function on an object that had just been deleted, by ordering
361 messages such that all calls are done before object deletion. However,
362 because of the new centralised messaging system and the fact that BoxStack
363 locates the destination object before calling it, the messaging system now
364 allows the kind of sloppy calls it was supposed to stop. Weird huh. This
365 is mentioned here because the video stream might generate an event just as
366 the user hits stop. The mutex is locked, and by the time the message
367 is examined the vvideorec/live has been deleted. This doesn't matter because
368 boxstack will drop the message if it can't find the matching object to
370 Finally, all this is fine and dandy, except that I'm not 100% sure that
371 this sloppy postMessage and hope a queued signal will force it to be processed
372 thingy will actually work. Hmmm.
373 Lastly <g>, I will consider making the naming system a little more sane
377 logger->log("Command", Log::DEBUG, "PMFOS called");
378 MessageQueue::postMessage(m);
382 kill(mainPid, SIGURG);
384 ((RemoteAndroid*)Remote::getInstance())->Signal();
387 ((RemoteWin*)Remote::getInstance())->Signal();
391 void Command::processMessage(Message* m)
393 // FIXME - a slight modification - how if messagereceivers were to register
394 // themselves as receivers to avoid the calling-a-deleted-object problem
395 // then only deliver/register/unregister would have to be protected
397 logger->log("Command", Log::DEBUG, "processing message %i", m->message);
405 case Message::STOP_PLAYBACK:
407 handleCommand(Remote::STOP); // an odd way of doing it, but so simple
410 // Also connection_lost comes from player - anywhere else?
414 case Message::VDR_CONNECTED:
416 doJustConnected((VConnect*)m->from);
419 case Message::SCREENSHOT:
421 #ifdef VOMP_PLATTFORM_MVP
422 Osd::getInstance()->screenShot("/out.jpg");
424 logger->log("Osd", Log::NOTICE, "Screenshot Message arrived");
425 Osd::getInstance()->screenShot("out.jpg");
429 case Message::CONNECTION_LOST:
434 case Message::UDP_BUTTON:
436 handleCommand(m->parameter);
439 case Message::CHANGE_LANGUAGE:
441 boxstack->removeAll();
442 boxstack->update(wallpaper);
444 if (!VDR::getInstance()->isConnected()) { connectionLost(); break; }
445 VWelcome* vw = new VWelcome();
448 boxstack->update(vw);
451 case Message::LAST_VIEW_CLOSE:
453 // Shouldn't be done like this. Some generic message pass back from vinfo perhaps
460 // VWelcome* vw = new VWelcome();
462 // boxstack->add(vw);
463 // boxstack->update(vw);
467 case Message::NEW_PICTURE:
469 //Log::getInstance()->log("Command", Log::DEBUG, "TVMedia NEW_PICTURE");
470 OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
472 osdv->informPicture(m->tag,m->parameter);
476 case Message::NEW_PICTURE_STATIC:
478 //Log::getInstance()->log("Command", Log::DEBUG, "TVMedia NEW_PICTURE %x %x",m->tag,m->parameter);
479 OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
481 osdv->informPicture(((unsigned long long)m->tag)<<32LL,m->parameter);
491 Instead of sending through the boxstack, implement a more generic MessageReceiver interface
492 and have potential receivers register with something
493 When a message needs to be delivered, check if the receiver is still registered, if so, deliver the message
494 This could all be done using the existing big command mutex to keep it simple
497 logger->log("Command", Log::DEBUG, "Sending message to boxstack");
498 boxstack->processMessage(m);
502 void Command::handleCommand(int button)
504 if (isStandby && (button != Remote::POWER)
505 && (button != Remote::POWERON) && (button != Remote::POWEROFF)) return;
506 if (!connLost && boxstack->handleCommand(button)) return; // don't send to boxstack if connLost
508 // command was not handled
512 case Remote::DF_LEFT:
513 case Remote::DF_RIGHT:
514 case Remote::VOLUMEUP:
515 case Remote::VOLUMEDOWN:
517 if (remote->handlesVolume()) {
518 if (button==Remote::DF_LEFT || button==Remote::VOLUMEDOWN)
519 remote->volumeDown();
520 else remote->volumeUp();
522 VVolume* v = new VVolume();
524 v->handleCommand(button); // this will draw+show
530 if (remote->handlesVolume()) {
531 remote->volumeMute();
533 VMute* v = new VMute();
545 case Remote::POWERON:
550 case Remote::POWEROFF:
558 if (!connLost) return; // if connLost, handle Remote::OK
564 VSleeptimer* sleep = new VSleeptimer();
565 boxstack->add(sleep);
566 sleep->handleCommand(button); // this will draw+show
575 Message* m = new Message(); // break into master mutex
576 m->message = Message::SCREENSHOT;
582 void Command::doStandby()
595 void Command::doPowerOn()
599 Video::getInstance()->signalOn();
600 Led::getInstance()->on();
601 Remote::getInstance()->changePowerState(true);
605 VConnect* vconnect = new VConnect(server);
606 boxstack->add(vconnect);
611 void Command::doPowerOff()
615 VDR::getInstance()->shutdownVDR();
616 boxstack->removeAll();
617 Video::getInstance()->signalOff();
618 boxstack->update(wallpaper);
620 VDR::getInstance()->configSave("General", "Last Power State", "Off");
621 logger->unsetExternLogger();
622 VDR::getInstance()->disconnect();
623 Led::getInstance()->off();
624 Remote::getInstance()->changePowerState(false);
626 Sleeptimer::getInstance()->shutdown();
628 stop(); //different behavoiur on windows, we exit
633 void Command::doFromTheTop(bool which)
635 if (isStandby) return;
640 logger->log("Command", Log::NOTICE, "Connection lost dialog already present");
644 logger->log("Command", Log::NOTICE, "Doing connection lost dialog");
645 connLost = new VInfo();
646 connLost->setSize(360, 200);
647 connLost->createBuffer();
648 if (Video::getInstance()->getFormat() == Video::PAL)
649 connLost->setPosition(190, 170);
651 connLost->setPosition(180, 120);
652 connLost->setOneLiner(tr("Connection lost"));
653 connLost->setDropThrough();
654 connLost->setBorderOn(1);
655 connLost->setTitleBarColour(DrawStyle::DANGER);
656 connLost->okButton();
658 boxstack->add(connLost);
659 boxstack->update(connLost);
660 remote->clearBuffer();
664 logger->unsetExternLogger();
665 VDR::getInstance()->disconnect();
666 boxstack->removeAll();
667 boxstack->update(wallpaper);
671 remote->clearBuffer();
673 // at this point, everything should be reset to first-go
675 VConnect* vconnect = new VConnect(server);
676 boxstack->add(vconnect);
681 void Command::doReboot()
684 logger->unsetExternLogger();
685 VDR::getInstance()->disconnect();
687 logger->log("Command", Log::NOTICE, "Reboot");
689 #ifndef VOMP_HAS_EXIT
690 // some plattforms, want a proper deinitialisation of their hardware before reboot
691 Osd::getInstance()->shutdown();
692 Audio::getInstance()->shutdown();
693 Video::getInstance()->shutdown();
694 Remote::getInstance()->shutdown();
696 reboot(LINUX_REBOOT_CMD_RESTART);
697 // if reboot is not allowed -> stop
709 #endif //Would we support this on windows?
712 void Command::connectionLost()
714 logger->unsetExternLogger();
715 Message* m = new Message(); // break into master mutex
716 m->message = Message::CONNECTION_LOST;
718 postMessageFromOuterSpace(m);
721 void Command::buildCrashedBox()
723 VInfo* crash = new VInfo();
724 crash->setSize(360, 250);
725 crash->createBuffer();
726 if (Video::getInstance()->getFormat() == Video::PAL)
727 crash->setPosition(190, 146);
729 crash->setPosition(180, 96);
730 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.");
731 crash->setBorderOn(1);
732 crash->setTitleBarColour(DrawStyle::DANGER);
734 crash->setExitable();
736 boxstack->add(crash);
737 boxstack->update(crash);
740 int Command::getLangPref(bool subtitle,const char* langcode)
742 vector<struct ASLPref>::iterator itty=langcodes.begin();
743 char templangcode[4];
744 templangcode[0]=langcode[0];
745 templangcode[1]=langcode[1];
746 templangcode[2]=langcode[2];
747 templangcode[3]='\0';
749 while (itty != langcodes.end()) {
750 size_t pos=(*itty).langcode.find(templangcode);
751 if (pos != string::npos) {
752 vector<struct ASLPref>::iterator itty2=langcodes.begin();
753 for (int i=0; i<langcodes.size();i++) {
756 pref=langcodes[i].subtitlepref;
758 pref=langcodes[i].audiopref;
760 if (pref < -1) break;
762 if (langcodes[i].audiopref==langpos) {
771 return langcodes.size(); //neutral
774 void Command::doJustConnected(VConnect* vconnect)
777 if (!VDR::getInstance()->isConnected()) { connectionLost(); return; }
778 logger->log("Command", Log::INFO, "Entering doJustConnected");
780 Video* video = Video::getInstance();
781 Audio* audio = Audio::getInstance();
782 boxstack->remove(vconnect);
784 VInfo* vi = new VInfo();
785 vi->setSize(400, 200);
787 if (video->getFormat() == Video::PAL)
788 vi->setPosition(170, 200);
790 vi->setPosition(160, 150);
791 vi->setOneLiner(tr("Connected, loading config"));
794 boxstack->update(vi);
796 VDR* vdr = VDR::getInstance();
799 // See if we're supposed to do network logging
800 config = vdr->configLoad("Advanced", "Network logging");
801 if (config && !STRCASECMP(config, "On"))
803 logger->log("Command", Log::INFO, "Turning on network logging");
804 logger->setExternLogger(vdr);
808 logger->unsetExternLogger();
809 logger->log("Command", Log::INFO, "Turned off network logging");
811 if (config) delete[] config;
813 config = vdr->configLoad("Advanced", "Skin Name");
815 const char **skinnames=SkinFactory::getSkinNames();
816 for (int i=0;i<SkinFactory::getNumberofSkins();i++) {
817 if (!STRCASECMP(config, skinnames[i])) {
818 SkinFactory::InitSkin(i);
823 if (wallpaper && wallpaper_pict) {
824 if (DrawStyle::WALLPAPER.alpha) {
825 wallpaper_pict->setVisible(true);
827 wallpaper_pict->setVisible(false);
830 boxstack->update(wallpaper);
834 SkinFactory::InitSkin(0);
837 // See if config says to override video format (PAL/NTSC)
838 config = vdr->configLoad("General", "Override Video Format");
841 logger->log("Command", Log::DEBUG, "Override Video Format is present");
843 if ( (!strcmp(config, "PAL") && (video->getFormat() != Video::PAL))
844 || (!strcmp(config, "NTSC") && (video->getFormat() != Video::NTSC))
845 || (!strcmp(config, "PAL_M") && (video->getFormat() != Video::PAL_M))
846 || (!strcmp(config, "NTSC_J") && (video->getFormat() != Video::NTSC_J))
849 // Oh sheesh, need to switch format. Bye bye TV...
851 // Take everything down
852 boxstack->removeAll();
853 boxstack->remove(wallpaper);
854 Osd* osd = Osd::getInstance();
860 remote->shutdown(); // need on raspberry shut not do any harm, hopefully
861 remote->init(RemoteStartDev);
863 // Get video and osd back up with the new mode
864 if (!strcmp(config, "PAL"))
866 logger->log("Command", Log::DEBUG, "Switching to PAL");
867 video->init(Video::PAL);
869 else if (!strcmp(config, "NTSC"))
871 logger->log("Command", Log::DEBUG, "Switching to NTSC");
872 video->init(Video::NTSC);
873 } else if (!strcmp(config, "PAL_M"))
875 logger->log("Command", Log::DEBUG, "Switching to PAL_M");
876 video->init(Video::PAL_M);
877 } else if (!strcmp(config, "NTSC_J"))
879 logger->log("Command", Log::DEBUG, "Switching to NTSC_J");
880 video->init(Video::NTSC_J);
885 //we do not init twice
886 osd->init((char*)("/dev/stbgfx"));
889 // Put the wallpaper back
894 vi->setSize(400, 200);
896 if (video->getFormat() == Video::PAL)
897 vi->setPosition(170, 200);
899 vi->setPosition(160, 150);
901 vi->setOneLiner(tr("Connected, loading config"));
904 boxstack->update(vi);
908 logger->log("Command", Log::DEBUG, "Already in requested mode, or request was not 'PAL' or 'NTSC'");
913 logger->log("Command", Log::DEBUG, "Phew, no dangerous on-the-fly mode switching to do!");
916 // Power off if first boot and config says so
921 logger->log("Command", Log::DEBUG, "Load power after boot");
923 config = vdr->configLoad("General", "Power After Boot");
927 if (!STRCASECMP(config, "On"))
929 logger->log("Command", Log::INFO, "Config says Power After Boot = On");
931 else if (!STRCASECMP(config, "Off"))
933 logger->log("Command", Log::INFO, "Config says Power After Boot = Off");
938 else if (!STRCASECMP(config, "Last state"))
940 char* lastPowerState = vdr->configLoad("General", "Last Power State");
943 if (!STRCASECMP(lastPowerState, "On"))
945 logger->log("Command", Log::INFO, "Config says Last Power State = On");
947 else if (!STRCASECMP(lastPowerState, "Off"))
949 logger->log("Command", Log::INFO, "Config says Last Power State = Off");
956 logger->log("Command", Log::INFO, "Config General/Last Power State not understood");
961 logger->log("Command", Log::INFO, "Config General/Last Power State not found");
966 logger->log("Command", Log::INFO, "Config/Power After Boot not understood");
972 logger->log("Command", Log::INFO, "Config General/Power After Boot not found");
977 // Go S-Video if config says so
979 config = vdr->configLoad("TV", "Connection");
983 if (!STRCASECMP(config, "S-Video"))
985 logger->log("Command", Log::INFO, "Switching to S-Video as Connection=%s", config);
986 video->setConnection(Video::SVIDEO);
987 } else if (!STRCASECMP(config, "HDMI"))
989 logger->log("Command", Log::INFO, "Switching to HDMI as Connection=%s", config);
990 video->setConnection(Video::HDMI);
991 } else if (!STRCASECMP(config, "HDMI3D"))
993 logger->log("Command", Log::INFO, "Switching to HDMI3D as Connection=%s", config);
994 video->setConnection(Video::HDMI3D);
998 logger->log("Command", Log::INFO, "Switching to RGB/Composite as Connection=%s", config);
999 video->setConnection(Video::COMPOSITERGB);
1005 logger->log("Command", Log::INFO, "Config TV/S-Video not found");
1008 // Set to shutdown VDR if config says
1010 config = vdr->configLoad("General", "VDR shutdown");
1013 if (!STRCASECMP(config, "On"))
1015 logger->log("Command", Log::INFO, "Shutdown VDR when shutting down vomp");
1016 vdr->setVDRShutdown(true);
1018 else if (!STRCASECMP(config, "Off"))
1020 logger->log("Command", Log::INFO, "Shutdown only vomp");
1021 vdr->setVDRShutdown(false);
1026 logger->log("Command", Log::INFO, "Default shutdown only vomp");
1027 vdr->setVDRShutdown(false); // Default
1032 config = vdr->configLoad("General", "Remote type");
1036 if (!STRCASECMP(config, "New"))
1038 logger->log("Command", Log::INFO, "Switching to New remote type");
1039 remote->setRemoteType(Remote::NEWREMOTE);
1043 logger->log("Command", Log::INFO, "Switching to Old remote type");
1044 remote->setRemoteType(Remote::OLDREMOTE);
1050 logger->log("Command", Log::INFO, "Config General/Remote type not found");
1051 remote->setRemoteType(Remote::OLDREMOTE);
1056 // Get TV aspect ratio
1058 config = vdr->configLoad("TV", "Aspect");
1061 if (!STRCASECMP(config, "16:9"))
1063 logger->log("Command", Log::INFO, "/// Switching to TV aspect 16:9");
1064 video->setTVsize(Video::ASPECT16X9);
1068 logger->log("Command", Log::INFO, "/// Switching to TV aspect 4:3");
1069 video->setTVsize(Video::ASPECT4X3);
1075 logger->log("Command", Log::INFO, "Config TV/Aspect type not found, going 4:3");
1076 video->setTVsize(Video::ASPECT4X3);
1079 config = vdr->configLoad("TV", "Widemode");
1082 if (!STRCASECMP(config, "Letterbox"))
1084 logger->log("Command", Log::INFO, "Setting letterbox mode");
1085 video->setMode(Video::LETTERBOX);
1089 logger->log("Command", Log::INFO, "Setting chop-sides mode");
1090 video->setMode(Video::NORMAL);
1097 logger->log("Command", Log::INFO, "Config TV/Widemode not found, Setting letterbox mode");
1098 video->setMode(Video::LETTERBOX);
1100 logger->log("Command", Log::INFO, "Config TV/Widemode not found, Setting chop-sides mode");
1101 video->setMode(Video::NORMAL);
1105 config = vdr->configLoad("Advanced", "TCP receive window");
1108 size_t newTCPsize = atoi(config);
1111 logger->log("Command", Log::INFO, "Setting TCP window size %i", newTCPsize);
1112 vdr->setReceiveWindow(newTCPsize);
1116 logger->log("Command", Log::INFO, "TCP window size not found, setting 2048");
1117 if (DEFAULT_TCP_WINDOWSIZE) vdr->setReceiveWindow(2048); // Default
1120 config = vdr->configLoad("Advanced", "Font Name");
1123 Osd::getInstance()->setFont(config);
1124 logger->log("Command", Log::INFO, "Setting Font to %s", config);
1130 // Set recording list type
1133 #ifdef ADVANCED_MENUES
1134 config = vdr->configLoad("Advanced", "Menu type");
1138 if (!STRCASECMP(config, "Advanced"))
1140 logger->log("Command", Log::INFO, "Switching to Advanced menu");
1146 logger->log("Command", Log::INFO, "Switching to Classic menu");
1153 logger->log("Command", Log::INFO, "Config General/menu type not found");
1158 config = vdr->configLoad("Advanced", "Disable WOL");
1161 if (!STRCASECMP(config, "Yes"))
1163 logger->log("Command", Log::INFO, "Config says disable WOL");
1164 Wol::getInstance()->setEnabled(false);
1168 logger->log("Command", Log::INFO, "Config says enable WOL");
1169 Wol::getInstance()->setEnabled(true);
1176 logger->log("Command", Log::INFO, "By default, enable WOL");
1177 Wol::getInstance()->setEnabled(true);
1179 /* device dependend config */
1180 audio->loadOptionsfromServer(vdr);
1181 video->loadOptionsfromServer(vdr);
1182 remote->loadOptionsfromServer(vdr);
1184 video->executePendingModeChanges();
1187 // Save power state = on
1189 vdr->configSave("General", "Last Power State", "On");
1191 // Make sure connection didn't die
1192 if (!vdr->isConnected())
1194 Command::getInstance()->connectionLost();
1198 boxstack->remove(vi);
1200 VWelcome* vw = new VWelcome();
1203 boxstack->update(vw);
1205 // Enter pre-keys here
1206 // handleCommand(Remote::OK);
1207 // handleCommand(Remote::THREE);
1208 // handleCommand(Remote::SIX);
1209 // handleCommand(Remote::OK);
1210 // handleCommand(Remote::UP);
1211 // handleCommand(Remote::PLAY);
1212 // handleCommand(Remote::DOWN);
1213 // handleCommand(Remote::DOWN);
1214 // handleCommand(Remote::DOWN);
1215 // handleCommand(Remote::OK);
1216 // handleCommand(Remote::RED);