diff options
author | mrwastl <mrwastl@users.sourceforge.net> | 2011-05-19 10:08:47 +0200 |
---|---|---|
committer | mrwastl <mrwastl@users.sourceforge.net> | 2011-05-19 10:08:47 +0200 |
commit | 3e9031f96e17d7ac3babd4a0d0c70be1fcfbf3b7 (patch) | |
tree | 7b31365b1dd835e4f3b0546f97c37b385ff77128 /display.c | |
parent | 876ea90a3145c64c6b6b1e9109b8b8c9e3e11ce8 (diff) | |
download | vdr-plugin-graphlcd-3e9031f96e17d7ac3babd4a0d0c70be1fcfbf3b7.tar.gz vdr-plugin-graphlcd-3e9031f96e17d7ac3babd4a0d0c70be1fcfbf3b7.tar.bz2 |
set data via SVDRP and make these available to the skin-engine
Diffstat (limited to 'display.c')
-rw-r--r-- | display.c | 51 |
1 files changed, 51 insertions, 0 deletions
@@ -56,6 +56,8 @@ cGraphLCDDisplay::cGraphLCDDisplay() bBrightnessActive = true; mService = NULL; /* cannot be initialised here (mGraphLCDState not yet available) */ + + mExtData = new cExtData(); } cGraphLCDDisplay::~cGraphLCDDisplay() @@ -68,6 +70,8 @@ cGraphLCDDisplay::~cGraphLCDDisplay() delete mGraphLCDState; delete mService; + + delete mExtData; } bool cGraphLCDDisplay::Initialise(GLCD::cDriver * Lcd, const std::string & CfgPath, const std::string & SkinsPath, const std::string & SkinName) @@ -496,3 +500,50 @@ void cGraphLCDDisplay::Clear() { #endif mLcd->Refresh(false); } + + + +bool cExtData::Set(std::string key, std::string value, uint32_t expire) { + data[key] = value; + + if (expire > 0) { + expData[key] = cTimeMs::Now() + (expire * 1000); + } else { + expData.erase(key); // just in case of an old expiration entry for key + } + return true; +} + + +bool cExtData::Unset(std::string key) { + expData.erase(key); // ignore result; + return ( (data.erase(key) > 0) ? true : false ); +} + + +bool cExtData::IsSet(std::string key) { + std::string ret = Get(key); + return ( (ret != "") ? true : false ); +} + + +std::string cExtData::Get(std::string key) { + it = data.find(key); + if ( it != data.end() ) { + expDataIt = expData.find(key); + if ( expDataIt != expData.end() ) { + uint64_t expts = (*expDataIt).second; + if ( cTimeMs::Now() > expts ) { + expData.erase(key); + data.erase(key); + return ""; + } else { + return (*it).second; + } + } else { + return (*it).second; + } + } else { + return ""; + } +} |