implemented dvbapi service interface, added viewelement ecminfo in displaychannel

This commit is contained in:
louis
2015-04-26 14:05:14 +02:00
parent 4fb0b9de22
commit e7d8a193a7
13 changed files with 157 additions and 3 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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);