00001 #include "xbox.h" 00002 00003 #include "mythcontext.h" 00004 #include "remoteutil.h" 00005 00006 #include <unistd.h> 00007 #include <stdlib.h> 00008 00009 XBox::XBox(void) 00010 { 00011 timer = NULL; 00012 PhaseCache = ""; 00013 } 00014 00015 void XBox::GetSettings(void) 00016 { 00017 if (timer) 00018 { 00019 timer->stop(); 00020 delete timer; 00021 } 00022 00023 RecordingLED = gContext->GetSetting("XboxLEDRecording","rrrr"); 00024 DefaultLED = gContext->GetSetting("XboxLEDDefault","gggg"); 00025 BlinkBIN = gContext->GetSetting("XboxBlinkBIN"); 00026 LEDNonLiveTV = gContext->GetNumSetting("XboxLEDNonLiveTV", 0); 00027 00028 if (!BlinkBIN) 00029 return; 00030 00031 QString timelen = gContext->GetSetting("XboxCheckRec","5"); 00032 int timeout = timelen.toInt() * 1000; 00033 00034 timer = new QTimer(this); 00035 connect(timer, SIGNAL(timeout()), this, SLOT(CheckRec())); 00036 timer->start(timeout); 00037 } 00038 00039 void XBox::CheckRec(void) 00040 { 00041 QStringList recording = RemoteRecordings(); 00042 00043 int all = recording[0].toInt(); 00044 int livetv = recording[1].toInt(); 00045 int numrec = all; 00046 00047 if (LEDNonLiveTV) 00048 numrec -= livetv; 00049 00050 QString color = (numrec) ? RecordingLED : DefaultLED; 00051 00052 if (color != PhaseCache) 00053 { 00054 system(BlinkBIN + " " + color); 00055 PhaseCache = color; 00056 } 00057 } 00058
1.5.5