diff options
| author | louis <louis.braun@gmx.de> | 2015-04-26 14:05:14 +0200 |
|---|---|---|
| committer | louis <louis.braun@gmx.de> | 2015-04-26 14:05:14 +0200 |
| commit | e7d8a193a77b5a13e8ac9677ca890359e88959f5 (patch) | |
| tree | db5331186bc9e814c75ce314089ecd34e4be9908 /views | |
| parent | 4fb0b9de2281f5a35c2ca05ccb42f250488b945b (diff) | |
| download | vdr-plugin-skindesigner-e7d8a193a77b5a13e8ac9677ca890359e88959f5.tar.gz vdr-plugin-skindesigner-e7d8a193a77b5a13e8ac9677ca890359e88959f5.tar.bz2 | |
implemented dvbapi service interface, added viewelement ecminfo in displaychannel
Diffstat (limited to 'views')
| -rw-r--r-- | views/displaychannelview.c | 17 | ||||
| -rw-r--r-- | views/displaychannelview.h | 2 | ||||
| -rw-r--r-- | views/viewhelpers.c | 54 | ||||
| -rw-r--r-- | views/viewhelpers.h | 5 |
4 files changed, 78 insertions, 0 deletions
diff --git a/views/displaychannelview.c b/views/displaychannelview.c index 9252c40..a189429 100644 --- a/views/displaychannelview.c +++ b/views/displaychannelview.c @@ -282,6 +282,23 @@ void cDisplayChannelView::ClearAudioInfo(void) { ClearViewElement(veAudioInfo); } +void cDisplayChannelView::DrawEncryptionInfo(int channelSid) { + if (!ExecuteViewElement(veEcmInfo)) { + return; + } + map < string, int > intTokens; + map < string, string > stringTokens; + + if (SetEcmInfos(channelSid, stringTokens, intTokens)) { + ClearEncryptionInfo(); + DrawViewElement(veEcmInfo, &stringTokens, &intTokens); + } +} + +void cDisplayChannelView::ClearEncryptionInfo(void) { + ClearViewElement(veEcmInfo); +} + void cDisplayChannelView::DrawScreenResolution(void) { if (!ExecuteViewElement(veScreenResolution)) { return; diff --git a/views/displaychannelview.h b/views/displaychannelview.h index e3f33c3..f533e1c 100644 --- a/views/displaychannelview.h +++ b/views/displaychannelview.h @@ -34,6 +34,8 @@ public: void ClearStatusIcons(void); void DrawAudioInfo(void); void ClearAudioInfo(void); + void DrawEncryptionInfo(int channelSid); + void ClearEncryptionInfo(void); void DrawScreenResolution(void); void ClearScreenResolution(void); void DrawScraperContent(const cEvent *event); diff --git a/views/viewhelpers.c b/views/viewhelpers.c index 294ac22..50f197b 100644 --- a/views/viewhelpers.c +++ b/views/viewhelpers.c @@ -21,6 +21,11 @@ cViewHelpers::cViewHelpers(void) { lastMinute = -1; lastSystemLoad = 0.0; lastMemUsage = -1; + lastEcmInfo.hops = -1; + lastEcmInfo.ecmtime = -1; + lastEcmInfo.caid = -1; + lastEcmInfo.pid = -1; + lastEcmInfo.prid = -1; } cViewHelpers::~cViewHelpers() { @@ -855,6 +860,55 @@ void cViewHelpers::SetCurrentSchedule(string recName, map < string, string > &st } } +bool cViewHelpers::SetEcmInfos(int channelSid, map < string, string > &stringTokens, map < string, int > &intTokens) { + static cPlugin *pDVBApi = cPluginManager::GetPlugin("dvbapi"); + if (!pDVBApi) + return false; + + sDVBAPIEcmInfo ecmInfo; + ecmInfo.sid = channelSid; + + if (!pDVBApi->Service("GetEcmInfo", &ecmInfo)) { + return false; + } + + if (ecmInfo.hops < 0 || ecmInfo.ecmtime <= 0) + return false; + if (CompareECMInfos(&ecmInfo)) + return false; + lastEcmInfo = ecmInfo; + + intTokens.insert(pair<string,int>("caid", ecmInfo.caid)); + intTokens.insert(pair<string,int>("pid", ecmInfo.pid)); + intTokens.insert(pair<string,int>("prid", ecmInfo.prid)); + intTokens.insert(pair<string,int>("ecmtime", ecmInfo.ecmtime)); + intTokens.insert(pair<string,int>("hops", ecmInfo.hops)); + + stringTokens.insert(pair<string,string>("reader", *ecmInfo.reader ? *ecmInfo.reader : "")); + stringTokens.insert(pair<string,string>("from", *ecmInfo.from ? *ecmInfo.from : "")); + stringTokens.insert(pair<string,string>("protocol", *ecmInfo.protocol ? *ecmInfo.protocol : "")); + + return true; +} + +bool cViewHelpers::CompareECMInfos(sDVBAPIEcmInfo *ecmInfo) { + if (ecmInfo->caid != lastEcmInfo.caid) + return false; + if (ecmInfo->pid != lastEcmInfo.pid) + return false; + if (ecmInfo->prid != lastEcmInfo.prid) + return false; + if (ecmInfo->ecmtime != lastEcmInfo.ecmtime) + return false; + if (ecmInfo->hops != lastEcmInfo.hops) + return false; + return true; +} + +/******************************************************************************** +* Private Functions +********************************************************************************/ + void cViewHelpers::RecName(string &path, string &name, string &folder) { size_t delim = path.find_last_of('~'); if (delim == string::npos) { diff --git a/views/viewhelpers.h b/views/viewhelpers.h index 112b3ca..bc0adcf 100644 --- a/views/viewhelpers.h +++ b/views/viewhelpers.h @@ -1,6 +1,8 @@ #ifndef __VIEWHELPERS_H #define __VIEWHELPERS_H +#include "../services/dvbapi.h" + class cViewHelpers { private: int numDevices; @@ -15,10 +17,12 @@ private: int lastMinute; double lastSystemLoad; int lastMemUsage; + sDVBAPIEcmInfo lastEcmInfo; void RecName(string &path, string &name, string &folder); void RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster); void SetCurrentScheduleFromChannel(const cChannel *channel, map < string, string > &stringTokens, map < string, int > &intTokens); void SetCurrentScheduleFromRecording(const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens); + bool CompareECMInfos(sDVBAPIEcmInfo *ecmInfo); protected: void InitDevices(void); bool SetDevices(bool initial, bool light, map<string,int> *intTokens, vector<map<string,string> > *devices); @@ -37,6 +41,7 @@ protected: bool SetSystemMemory(map < string, string > &stringTokens, map < string, int > &intTokens); bool SetSystemTemperatures(map < string, string > &stringTokens, map < string, int > &intTokens); void SetCurrentSchedule(string recName, map < string, string > &stringTokens, map < string, int > &intTokens); + bool SetEcmInfos(int channelSid, map < string, string > &stringTokens, map < string, int > &intTokens); public: cViewHelpers(void); virtual ~cViewHelpers(void); |
