summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--Makefile1
-rw-r--r--displaychannel.c2
-rw-r--r--dtd/displaychannel.dtd7
-rw-r--r--libtemplate/templateview.c6
-rw-r--r--libtemplate/templateviewelement.h2
-rw-r--r--skins/metrixhd/xmlfiles/displaychannel.xml35
-rw-r--r--skinskeleton/xmlfiles/displaychannel.xml20
-rw-r--r--views/displaychannelview.c27
-rw-r--r--views/displaychannelview.h5
-rw-r--r--views/displaymenuview.c119
-rw-r--r--views/displaymenuview.h7
-rw-r--r--views/viewhelpers.c133
-rw-r--r--views/viewhelpers.h18
14 files changed, 258 insertions, 125 deletions
diff --git a/HISTORY b/HISTORY
index f4e3843..1a648c7 100644
--- a/HISTORY
+++ b/HISTORY
@@ -34,6 +34,7 @@ Version 0.0.2
- fixed a bug if displaydetailedtext is called without correct menucat (mailbox plugin)
- implemented function drawslope, see Wiki for documentation
- using default menu list in case an invalid MenuCategory is set
+- added device info in displaychannel, example in metrixHD
diff --git a/Makefile b/Makefile
index 1bd789c..549b9b6 100644
--- a/Makefile
+++ b/Makefile
@@ -90,6 +90,7 @@ OBJS = $(PLUGIN).o \
libtemplate/templateloopfunction.o \
libtemplate/xmlparser.o \
views/view.o \
+ views/viewhelpers.o \
views/displaychannelview.o \
views/displaymenurootview.o \
views/displaymenuview.o \
diff --git a/displaychannel.c b/displaychannel.c
index a416073..97013bb 100644
--- a/displaychannel.c
+++ b/displaychannel.c
@@ -185,11 +185,13 @@ void cSDDisplayChannel::Flush(void) {
channelView->DrawScreenResolution();
channelView->DrawSignal();
channelView->DrawAudioInfo();
+ channelView->DrawDevices(initial);
} else {
channelView->ClearStatusIcons();
channelView->ClearScreenResolution();
channelView->ClearSignal();
channelView->ClearSignalBackground();
+ channelView->ClearDevices();
}
if (initial) {
diff --git a/dtd/displaychannel.dtd b/dtd/displaychannel.dtd
index 33ae069..a99e87e 100644
--- a/dtd/displaychannel.dtd
+++ b/dtd/displaychannel.dtd
@@ -4,7 +4,7 @@
<!ELEMENT displaychannel (background | channelinfo | epginfo | progressbar | progressbarback |
statusinfo | audioinfo | screenresolution | channelgroup |
- signalquality | signalqualityback | scrapercontent |
+ signalquality | signalqualityback | devices | scrapercontent |
datetime | message | customtokens)* >
<!ATTLIST displaychannel
x CDATA #REQUIRED
@@ -73,6 +73,11 @@
debug CDATA #IMPLIED
>
+<!ELEMENT devices (area|areascroll)*>
+<!ATTLIST devices
+ debug CDATA #IMPLIED
+>
+
<!ELEMENT scrapercontent (area|areascroll)*>
<!ATTLIST scrapercontent
debug CDATA #IMPLIED
diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c
index 7786ce1..f122732 100644
--- a/libtemplate/templateview.c
+++ b/libtemplate/templateview.c
@@ -612,6 +612,7 @@ void cTemplateViewChannel::SetViewElements(void) {
viewElementsAllowed.insert("screenresolution");
viewElementsAllowed.insert("signalquality");
viewElementsAllowed.insert("signalqualityback");
+ viewElementsAllowed.insert("devices");
viewElementsAllowed.insert("scrapercontent");
viewElementsAllowed.insert("datetime");
viewElementsAllowed.insert("message");
@@ -654,6 +655,9 @@ string cTemplateViewChannel::GetViewElementName(eViewElement ve) {
case veSignalQualityBack:
name = "Signal Quality Background";
break;
+ case veDevices:
+ name = "Devices";
+ break;
case veScraperContent:
name = "Scraper Content";
break;
@@ -698,6 +702,8 @@ void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix,
ve = veSignalQuality;
} else if (!sViewElement.compare("signalqualityback")) {
ve = veSignalQualityBack;
+ } else if (!sViewElement.compare("devices")) {
+ ve = veDevices;
} else if (!sViewElement.compare("scrapercontent")) {
ve = veScraperContent;
} else if (!sViewElement.compare("datetime")) {
diff --git a/libtemplate/templateviewelement.h b/libtemplate/templateviewelement.h
index 5d61c13..7fe78b9 100644
--- a/libtemplate/templateviewelement.h
+++ b/libtemplate/templateviewelement.h
@@ -24,6 +24,7 @@ enum eViewElement {
veBackground,
veDateTime,
veMessage,
+ veDevices,
veCustomTokens,
//DisplayChannel ViewElements
veChannelInfo,
@@ -43,7 +44,6 @@ enum eViewElement {
veDiscUsage,
veSystemLoad,
veTimers,
- veDevices,
veMenuItem,
veMenuCurrentItemDetail,
veScrollbar,
diff --git a/skins/metrixhd/xmlfiles/displaychannel.xml b/skins/metrixhd/xmlfiles/displaychannel.xml
index 060d951..030e937 100644
--- a/skins/metrixhd/xmlfiles/displaychannel.xml
+++ b/skins/metrixhd/xmlfiles/displaychannel.xml
@@ -173,6 +173,41 @@
<signalqualityback>
</signalqualityback>
+ <!-- Available Variables devices:
+ {numdevices} number of available devices
+ {devices[]} array with available devices
+ {devices[num]} number of current device
+ {devices[type]} type of device (DVB-S, DVB-C, ...)
+ {devices[istuned]} true if device is currently tuned to a transponder
+ {devices[livetv]} true if device is currently playing livetv
+ {devices[recording]} true if device is currently recording
+ {devices[hascam]} true if device has a CAM
+ {devices[cam]} number of CAM
+ {devices[signalstrength]} signalstrength of devcie
+ {devices[signalquality]} signalstrength of devcie
+ {devices[channelnumber]} number of the currently tuned channel
+ {devices[channelname]} name of the currently tuned channel
+ {devices[channelid]} ID of the currently tuned channel
+ {devices[source]} source of the currently tuned channel
+ -->
+ <devices>
+ <area x="70%" y="15%" width="30%" height="{areaheight}/12 * {numdevices}" layer="1">
+ <fill color="{clrTransBlack}"/>
+ </area>
+ <area x="70%" y="15%" width="30%" height="{areaheight}/12 * {numdevices}" layer="2">
+ <loop name="devices" x="0" y="0" orientation="vertical" columnwidth="{areawidth}" rowheight="{areaheight} / {numdevices}" overflow="cut">
+ <drawtext name="label" x="5" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="{devices[num]}: {devices[type]}" />
+ <drawtext condition="{devices[hascam]}" x="{width(label)} + 15" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="(CAM {devices[cam]})" />
+ <drawtext condition="{devices[recording]} ++ {devices[livetv]}" align="right" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrRed}" text="LiveTV, Recording ({devices[channelname]}) " />
+ <drawtext condition="{devices[recording]} ++ not{devices[livetv]}" align="right" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrRed}" text="Recording ({devices[channelname]}) " />
+ <drawtext condition="not{devices[recording]} ++ {devices[livetv]}" align="right" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="LiveTV ({devices[channelname]}) " />
+ <drawrectangle condition="{devices[istuned]}" x="5" y="{rowheight}/3 + 5" width="{areawidth} * {devices[signalstrength]} / 100 - 10 * {devices[signalstrength]} / 100" height="{rowheight}/3 - 10" color="{clrTransWhite}" />
+ <drawrectangle condition="{devices[istuned]}" x="5" y="2*{rowheight}/3 + 5" width="{areawidth} * {devices[signalquality]} / 100 - 10 * {devices[signalquality]} / 100" height="{rowheight}/3 - 10" color="{clrTransWhite}" />
+ <drawtext condition="not{devices[istuned]}" align="center" y="{rowheight}/2" font="{light}" fontsize="{rowheight}*0.40" color="{clrWhite}" text="not tuned" />
+ </loop>
+ </area>
+ </devices>
+
<!-- Available Variables scrapercontent:
{mediapath} Full Path of Poster or Banner to use in image path attribute
{mediawidth} width of image in pixel
diff --git a/skinskeleton/xmlfiles/displaychannel.xml b/skinskeleton/xmlfiles/displaychannel.xml
index 38267d8..49a1630 100644
--- a/skinskeleton/xmlfiles/displaychannel.xml
+++ b/skinskeleton/xmlfiles/displaychannel.xml
@@ -105,6 +105,26 @@
<signalqualityback>
</signalqualityback>
+ <!-- Available Variables devices:
+ {numdevices} number of available devices
+ {devices[]} array with available devices
+ {devices[num]} number of current device
+ {devices[type]} type of device (DVB-S, DVB-C, ...)
+ {devices[istuned]} true if device is currently tuned to a transponder
+ {devices[livetv]} true if device is currently playing livetv
+ {devices[recording]} true if device is currently recording
+ {devices[hascam]} true if device has a CAM
+ {devices[cam]} number of CAM
+ {devices[signalstrength]} signalstrength of devcie
+ {devices[signalquality]} signalstrength of devcie
+ {devices[channelnumber]} number of the currently tuned channel
+ {devices[channelname]} name of the currently tuned channel
+ {devices[channelid]} ID of the currently tuned channel
+ {devices[source]} source of the currently tuned channel
+ -->
+ <devices>
+ </devices>
+
<!-- Available Variables scrapercontent:
{mediapath} Full Path of Poster or Banner to use in image path attribute
{mediawidth} width of image in pixel
diff --git a/views/displaychannelview.c b/views/displaychannelview.c
index 880f9a1..e8b5177 100644
--- a/views/displaychannelview.c
+++ b/views/displaychannelview.c
@@ -17,6 +17,7 @@ cDisplayChannelView::cDisplayChannelView(cTemplateView *tmplView) : cView(tmplVi
lastAudioChannel = -1;
lastTracDesc = "";
lastTrackLang = "";
+ InitDevices();
DeleteOsdOnExit();
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
}
@@ -109,7 +110,8 @@ void cDisplayChannelView::DrawProgressBar(cString &start, cString &stop, int Cur
intTokens.insert(pair<string, int>("duration", Total));
intTokens.insert(pair<string, int>("elapsed", Current));
intTokens.insert(pair<string, int>("remaining", Total - Current));
-
+
+ ClearProgressBar();
DrawViewElement(veProgressBar, &stringTokens, &intTokens);
}
@@ -399,6 +401,29 @@ void cDisplayChannelView::ClearSignalBackground(void) {
ClearViewElement(veSignalQualityBack);
}
+void cDisplayChannelView::DrawDevices(bool initial) {
+ if (!ViewElementImplemented(veDevices)) {
+ return;
+ }
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+ map < string, vector< map< string, string > > > deviceLoopTokens;
+ vector< map< string, string > > devices;
+
+ bool changed = SetDevices(initial, &intTokens, &devices);
+ if (!changed)
+ return;
+
+ deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
+
+ ClearViewElement(veDevices);
+ DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
+}
+
+void cDisplayChannelView::ClearDevices(void) {
+ ClearViewElement(veDevices);
+}
+
void cDisplayChannelView::DrawChannelGroups(const cChannel *Channel, cString ChannelName) {
if (!ViewElementImplemented(veChannelGroup)) {
return;
diff --git a/views/displaychannelview.h b/views/displaychannelview.h
index 7df085d..4cb0be4 100644
--- a/views/displaychannelview.h
+++ b/views/displaychannelview.h
@@ -3,8 +3,9 @@
#include "../libtemplate/template.h"
#include "view.h"
+#include "viewhelpers.h"
-class cDisplayChannelView : public cView {
+class cDisplayChannelView : public cView, public cViewHelpers {
private:
cString lastDate;
int lastScreenWidth;
@@ -44,6 +45,8 @@ public:
void DrawSignalBackground(void);
void ClearSignal(void);
void ClearSignalBackground(void);
+ void DrawDevices(bool initial);
+ void ClearDevices(void);
void DrawChannelGroups(const cChannel *Channel, cString ChannelName);
void ClearChannelGroups(void);
void DisplayMessage(eMessageType Type, const char *Text);
diff --git a/views/displaymenuview.c b/views/displaymenuview.c
index 66df9a6..47c1591 100644
--- a/views/displaymenuview.c
+++ b/views/displaymenuview.c
@@ -223,9 +223,6 @@ cDisplayMenuMainView::cDisplayMenuMainView(cTemplateView *tmplView, bool menuIni
cDisplayMenuMainView::~cDisplayMenuMainView() {
CancelSave();
FadeOut();
- delete[] lastSignalStrength;
- delete[] lastSignalQuality;
- delete[] recDevices;
}
void cDisplayMenuMainView::DrawStaticViewElements(void) {
@@ -360,18 +357,6 @@ void cDisplayMenuMainView::DrawDiscUsage(void) {
DrawViewElement(veDiscUsage, &stringTokens, &intTokens);
}
-void cDisplayMenuMainView::InitDevices(void) {
- int numDevices = cDevice::NumDevices();
- lastSignalStrength = new int[numDevices];
- lastSignalQuality = new int[numDevices];
- recDevices = new bool[numDevices];
- for (int i=0; i<numDevices; i++) {
- lastSignalStrength[i] = 0;
- lastSignalQuality[i] = 0;
- recDevices[i] = false;
- }
-}
-
bool cDisplayMenuMainView::DrawLoad(void) {
if (!ViewElementImplemented(veSystemLoad)) {
return false;
@@ -400,120 +385,22 @@ bool cDisplayMenuMainView::DrawDevices(void) {
if (!ViewElementImplemented(veDevices)) {
return false;
}
- int numDevices = cDevice::NumDevices();
- if (!initial) {
- //check if drawing is necessary
- bool changed = false;
- for (int i = 0; i < numDevices; i++) {
- const cDevice *device = cDevice::GetDevice(i);
- if (!device || !device->NumProvidedSystems()) {
- continue;
- }
- if ((device->SignalStrength() != lastSignalStrength[i]) || (device->SignalQuality() != lastSignalQuality[i])) {
- changed = true;
- break;
- }
- }
- if (!changed) {
- return false;
- }
- }
map < string, string > stringTokens;
map < string, int > intTokens;
-
map < string, vector< map< string, string > > > deviceLoopTokens;
vector< map< string, string > > devices;
- //check device which currently displays live tv
- int deviceLiveTV = -1;
- cDevice *primaryDevice = cDevice::PrimaryDevice();
- if (primaryDevice) {
- if (!primaryDevice->Replaying() || primaryDevice->Transferring())
- deviceLiveTV = cDevice::ActualDevice()->DeviceNumber();
- else
- deviceLiveTV = primaryDevice->DeviceNumber();
- }
-
- //check currently recording devices
- for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) {
- if (!timer->Recording()) {
- continue;
- }
- if (cRecordControl *RecordControl = cRecordControls::GetRecordControl(timer)) {
- const cDevice *recDevice = RecordControl->Device();
- if (recDevice) {
- recDevices[recDevice->DeviceNumber()] = true;
- }
- }
- }
- int actualNumDevices = 0;
- for (int i = 0; i < numDevices; i++) {
- const cDevice *device = cDevice::GetDevice(i);
- if (!device || !device->NumProvidedSystems()) {
- continue;
- }
- actualNumDevices++;
- map< string, string > deviceVals;
- stringstream strNum;
- strNum << actualNumDevices;
- deviceVals.insert(pair< string, string >("devices[num]", strNum.str()));
- deviceVals.insert(pair< string, string >("devices[type]", *(device->DeviceType())));
- cCamSlot *camSlot = device->CamSlot();
- int camNumber = -1;
- if (camSlot) {
- camNumber = camSlot->SlotNumber();
- deviceVals.insert(pair< string, string >("devices[hascam]", "1"));
- } else {
- deviceVals.insert(pair< string, string >("devices[hascam]", "0"));
- }
- int signalStrength = device->SignalStrength();
- int signalQuality = device->SignalQuality();
- stringstream strCamNumber;
- strCamNumber << camNumber;
- deviceVals.insert(pair< string, string >("devices[cam]", strCamNumber.str()));
- stringstream strStrength;
- strStrength << signalStrength;
- deviceVals.insert(pair< string, string >("devices[signalstrength]", strStrength.str()));
- stringstream strQuality;
- strQuality << signalQuality;
- deviceVals.insert(pair< string, string >("devices[signalquality]", strQuality.str()));
-
- deviceVals.insert(pair< string, string >("devices[livetv]", i == deviceLiveTV ? "1" : "0"));
- deviceVals.insert(pair< string, string >("devices[recording]", recDevices[i] ? "1" : "0"));
-
- const cChannel *channel = device->GetCurrentlyTunedTransponder();
- const cSource *source = (channel) ? Sources.Get(channel->Source()) : NULL;
- if (channel && channel->Number() > 0) {
- stringstream strChanNum;
- strChanNum << channel->Number();
- deviceVals.insert(pair< string, string >("devices[channelnumber]", strChanNum.str()));
- deviceVals.insert(pair< string, string >("devices[channelname]", channel->Name()));
- deviceVals.insert(pair< string, string >("devices[channelid]", *(channel->GetChannelID().ToString())));
- deviceVals.insert(pair< string, string >("devices[istuned]", "1"));
- } else {
- deviceVals.insert(pair< string, string >("devices[channelnumber]", "0"));
- deviceVals.insert(pair< string, string >("devices[channelname]", ""));
- deviceVals.insert(pair< string, string >("devices[channelid]", ""));
- deviceVals.insert(pair< string, string >("devices[istuned]", "0"));
- }
-
- deviceVals.insert(pair< string, string >("devices[source]", source ? source->Description() : ""));
-
- devices.push_back(deviceVals);
+ bool changed = SetDevices(initial, &intTokens, &devices);
+ if (!changed)
+ return false;
- lastSignalStrength[i] = signalStrength;
- lastSignalQuality[i] = signalQuality;
- }
deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
-
- intTokens.insert(pair<string, int>("numdevices", actualNumDevices));
ClearViewElement(veDevices);
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
return true;
}
-
/************************************************************************
* cDisplayMenuSchedulesView
************************************************************************/
diff --git a/views/displaymenuview.h b/views/displaymenuview.h
index 52f5361..34fed44 100644
--- a/views/displaymenuview.h
+++ b/views/displaymenuview.h
@@ -2,6 +2,7 @@
#define __DISPLAYMENUVIEW_H
#include "../libtemplate/template.h"
+#include "viewhelpers.h"
#include "displaymenulistview.h"
class cDisplayMenuView : public cView {
@@ -28,17 +29,13 @@ public:
bool BackgroundImplemented(void);
};
-class cDisplayMenuMainView : public cDisplayMenuView {
+class cDisplayMenuMainView : public cDisplayMenuView, public cViewHelpers {
private:
bool initial;
- int* lastSignalStrength;
- int* lastSignalQuality;
double lastSystemLoad;
- bool* recDevices;
void DrawTimers(void);
void DrawDiscUsage(void);
bool DrawLoad(void);
- void InitDevices(void);
bool DrawDevices(void);
public:
cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit);
diff --git a/views/viewhelpers.c b/views/viewhelpers.c
new file mode 100644
index 0000000..b97a7a3
--- /dev/null
+++ b/views/viewhelpers.c
@@ -0,0 +1,133 @@
+#include <vdr/menu.h>
+#include "../config.h"
+#include "viewhelpers.h"
+
+cViewHelpers::cViewHelpers(void) {
+ devicesInit = false;
+}
+
+cViewHelpers::~cViewHelpers() {
+ if (devicesInit) {
+ delete[] lastSignalStrength;
+ delete[] lastSignalQuality;
+ delete[] recDevices;
+ }
+}
+
+void cViewHelpers::InitDevices(void) {
+ int numDevices = cDevice::NumDevices();
+ lastSignalStrength = new int[numDevices];
+ lastSignalQuality = new int[numDevices];
+ recDevices = new bool[numDevices];
+ for (int i=0; i<numDevices; i++) {
+ lastSignalStrength[i] = 0;
+ lastSignalQuality[i] = 0;
+ recDevices[i] = false;
+ }
+ devicesInit = true;
+}
+
+bool cViewHelpers::SetDevices(bool initial, map<string,int> *intTokens, vector<map<string,string> > *devices) {
+ int numDevices = cDevice::NumDevices();
+ if (!initial) {
+ //check if drawing is necessary
+ bool changed = false;
+ for (int i = 0; i < numDevices; i++) {
+ const cDevice *device = cDevice::GetDevice(i);
+ if (!device || !device->NumProvidedSystems()) {
+ continue;
+ }
+ if ((device->SignalStrength() != lastSignalStrength[i]) || (device->SignalQuality() != lastSignalQuality[i])) {
+ changed = true;
+ break;
+ }
+ }
+ if (!changed) {
+ return false;
+ }
+ }
+ //check device which currently displays live tv
+ int deviceLiveTV = -1;
+ cDevice *primaryDevice = cDevice::PrimaryDevice();
+ if (primaryDevice) {
+ if (!primaryDevice->Replaying() || primaryDevice->Transferring())
+ deviceLiveTV = cDevice::ActualDevice()->DeviceNumber();
+ else
+ deviceLiveTV = primaryDevice->DeviceNumber();
+ }
+
+ //check currently recording devices
+ for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) {
+ if (!timer->Recording()) {
+ continue;
+ }
+ if (cRecordControl *RecordControl = cRecordControls::GetRecordControl(timer)) {
+ const cDevice *recDevice = RecordControl->Device();
+ if (recDevice) {
+ recDevices[recDevice->DeviceNumber()] = true;
+ }
+ }
+ }
+ int actualNumDevices = 0;
+ for (int i = 0; i < numDevices; i++) {
+ const cDevice *device = cDevice::GetDevice(i);
+ if (!device || !device->NumProvidedSystems()) {
+ continue;
+ }
+ actualNumDevices++;
+ map< string, string > deviceVals;
+ stringstream strNum;
+ strNum << actualNumDevices;
+ deviceVals.insert(pair< string, string >("devices[num]", strNum.str()));
+ deviceVals.insert(pair< string, string >("devices[type]", *(device->DeviceType())));
+ cCamSlot *camSlot = device->CamSlot();
+ int camNumber = -1;
+ if (camSlot) {
+ camNumber = camSlot->SlotNumber();
+ deviceVals.insert(pair< string, string >("devices[hascam]", "1"));
+ } else {
+ deviceVals.insert(pair< string, string >("devices[hascam]", "0"));
+ }
+ int signalStrength = device->SignalStrength();
+ int signalQuality = device->SignalQuality();
+ stringstream strCamNumber;
+ strCamNumber << camNumber;
+ deviceVals.insert(pair< string, string >("devices[cam]", strCamNumber.str()));
+ stringstream strStrength;
+ strStrength << signalStrength;
+ deviceVals.insert(pair< string, string >("devices[signalstrength]", strStrength.str()));
+ stringstream strQuality;
+ strQuality << signalQuality;
+ deviceVals.insert(pair< string, string >("devices[signalquality]", strQuality.str()));
+
+ deviceVals.insert(pair< string, string >("devices[livetv]", i == deviceLiveTV ? "1" : "0"));
+ deviceVals.insert(pair< string, string >("devices[recording]", recDevices[i] ? "1" : "0"));
+
+ const cChannel *channel = device->GetCurrentlyTunedTransponder();
+ const cSource *source = (channel) ? Sources.Get(channel->Source()) : NULL;
+ if (channel && channel->Number() > 0) {
+ stringstream strChanNum;
+ strChanNum << channel->Number();
+ deviceVals.insert(pair< string, string >("devices[channelnumber]", strChanNum.str()));
+ deviceVals.insert(pair< string, string >("devices[channelname]", channel->Name()));
+ deviceVals.insert(pair< string, string >("devices[channelid]", *(channel->GetChannelID().ToString())));
+ deviceVals.insert(pair< string, string >("devices[istuned]", "1"));
+ } else {
+ deviceVals.insert(pair< string, string >("devices[channelnumber]", "0"));
+ deviceVals.insert(pair< string, string >("devices[channelname]", ""));
+ deviceVals.insert(pair< string, string >("devices[channelid]", ""));
+ deviceVals.insert(pair< string, string >("devices[istuned]", "0"));
+ }
+
+ deviceVals.insert(pair< string, string >("devices[source]", source ? source->Description() : ""));
+
+ devices->push_back(deviceVals);
+
+ lastSignalStrength[i] = signalStrength;
+ lastSignalQuality[i] = signalQuality;
+ }
+
+ intTokens->insert(pair<string, int>("numdevices", actualNumDevices));
+
+ return true;
+} \ No newline at end of file
diff --git a/views/viewhelpers.h b/views/viewhelpers.h
new file mode 100644
index 0000000..d88651c
--- /dev/null
+++ b/views/viewhelpers.h
@@ -0,0 +1,18 @@
+#ifndef __VIEWHELPERS_H
+#define __VIEWHELPERS_H
+
+class cViewHelpers {
+private:
+ bool devicesInit;
+ int* lastSignalStrength;
+ int* lastSignalQuality;
+ bool* recDevices;
+protected:
+public:
+ cViewHelpers(void);
+ virtual ~cViewHelpers(void);
+ void InitDevices(void);
+ bool SetDevices(bool initial, map<string,int> *intTokens, vector<map<string,string> > *devices);
+};
+
+#endif //__VIEWHELPERS_H \ No newline at end of file