Skip to content

Commit

Permalink
new tokens: {ActualDevice}, {SignalStrength}, {SignalQuality}, {Suppo…
Browse files Browse the repository at this point in the history
…rtsSignalInfo}; adaptions for new parameter 'evaluate' (<variable/> in skin-support of graphlcd-base; added method cGraphLCDDisplay::GetSkin(); beauty fixes
  • Loading branch information
mrwastl committed Oct 29, 2011
1 parent b696591 commit bbc8b87
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 21 deletions.
7 changes: 6 additions & 1 deletion display.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ void cGraphLCDDisplay::Action(void)

// update display if BrightnessDelay is exceeded
if (bActive && (nCurrentBrightness == GraphLCDSetup.BrightnessActive) &&
((uint32_t)((cTimeMs::Now() - LastTimeBrightness)) > (uint32_t)(GraphLCDSetup.BrightnessDelay*1000)))
((uint32_t)((/*cTimeMs::Now()*/currTimeMs - LastTimeBrightness)) > (uint32_t)(GraphLCDSetup.BrightnessDelay*1000)))
{
mUpdate = true;
}
Expand Down Expand Up @@ -339,6 +339,8 @@ void cGraphLCDDisplay::Action(void)

mScreen->Clear(mSkin->GetBackgroundColor());

mSkin->SetTSEvalTick(currTimeMs);

GLCD::cSkinDisplay * display = NULL;

if (mState == StateNormal)
Expand Down Expand Up @@ -453,6 +455,9 @@ void cGraphLCDDisplay::Replaying(bool Starting)

void cGraphLCDDisplay::SetMenuClear()
{
if (mSkin)
mSkin->SetTSEvalSwitch(cTimeMs::Now());

mSkinConfig->SetMenuClear();
if (mState == StateMenu)
{
Expand Down
1 change: 1 addition & 0 deletions display.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class cGraphLCDDisplay : public cThread
const cGraphLCDService * GetServiceObject() const { return mService; }

GLCD::cDriver * GetDriver() const { return mLcd; }
GLCD::cSkin * GetSkin() const { return mSkin; }

const eDisplayMode GetDisplayMode() const { return mDisplayMode; }
protected:
Expand Down
35 changes: 20 additions & 15 deletions service.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ cGraphLCDService::cGraphLCDService(cGraphLCDState * state)
mState = state;

/* initialise flags for services */
radioActive = false; radioChanged = false; radioUse = false;
lcrActive = false; lcrChanged = false; lcrUse = false;
femonActive = false; femonChanged = false; femonUse = false;
mailboxActive = false; mailboxChanged = false; mailboxUse = false;
spanActive = false; spanChanged = false; spanUse = false;
radioActive = false; radioChanged = false; radioUse = false; radioInit = false;
lcrActive = false; lcrChanged = false; lcrUse = false; lcrInit = false;
femonActive = false; femonChanged = false; femonUse = false; femonInit = false;
mailboxActive = false; mailboxChanged = false; mailboxUse = false; mailboxInit = false;
spanActive = false; spanChanged = false; spanUse = false; spanInit = false;

radioLastChange = lcrLastChange = femonLastChange = mailboxLastChange = spanLastChange = 0;

Expand Down Expand Up @@ -86,33 +86,38 @@ bool cGraphLCDService::ServiceIsAvailable(const std::string & Name, const std::s
bool firstTime = false;

if (Name == "RadioTextService-v1.0" || Name == "radio") {
if (!radioUse) {
if (!radioInit) {
radioInit = true;
firstTime = true;
radioUse = true;
}
rvAvail = (mState->GetChannelInfo().isRadio) ? radioActive : false;
} else if (Name == "LcrService-v1.0" || Name == "lcr") {
if (!lcrUse) {
if (!lcrInit) {
lcrInit = true;
firstTime = true;
lcrUse = true;
//lcrUse = true;
}
rvAvail = lcrActive;
} else if (Name == "FemonService-v1.0" || Name == "femon") {
if (!femonUse) {
if (!femonInit) {
femonInit = true;
firstTime = true;
femonUse = true;
//femonUse = true;
}
rvAvail = femonActive;
} else if (Name == "MailBox-1.0" || Name == "mailbox") {
if (!mailboxUse) {
if (!mailboxInit) {
mailboxInit = true;
firstTime = true;
mailboxUse = true;
//mailboxUse = true;
}
rvAvail = mailboxActive;
} else if (Name == "span") {
if (!spanUse) {
if (!spanInit) {
spanInit = true;
firstTime = true;
spanUse = true;
//spanUse = true;
}
//spanUse = true;
rvAvail = spanActive;
Expand Down Expand Up @@ -144,7 +149,7 @@ bool cGraphLCDService::ServiceIsAvailable(const std::string & Name, const std::s
it = opts.find("delay");
if (it != opts.end()) {
int delay = atoi( (*it).second.c_str() );
if (delay > 100) {
if (delay >= 100) {
SetServiceUpdateDelay(Name, delay);
}
}
Expand Down
11 changes: 6 additions & 5 deletions service.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ class cGraphLCDService
/* __Changed = data has been changed */
/* __Active = plugin/service is available and active */
/* __Use = service is requested in skin (don't call services that wouldn't be used anyway) */
bool radioChanged, radioActive, radioUse;
bool lcrChanged, lcrActive, lcrUse;
bool femonChanged, femonActive, femonUse;
bool mailboxChanged, mailboxActive, mailboxUse;
bool spanChanged, spanActive, spanUse;
/* __Init = ServiceIsAvailable() has been called at least one for this service */
bool radioChanged, radioActive, radioUse, radioInit;
bool lcrChanged, lcrActive, lcrUse, lcrInit;
bool femonChanged, femonActive, femonUse, femonInit;
bool mailboxChanged, mailboxActive, mailboxUse, mailboxInit;
bool spanChanged, spanActive, spanUse, spanInit;
// timestamp of last service update request
uint64_t radioLastChange, lcrLastChange, femonLastChange, mailboxLastChange, spanLastChange;
// min. delay between two service update requests
Expand Down
56 changes: 56 additions & 0 deletions skinconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ typedef enum _eTokenId
tokChannelAlias,
tokPrivateChannelEnd,

// current device
tokPrivateDeviceStart,
tokActualDevice,
tokSignalStrength,
tokSignalQuality,
tokSupportsSignalInfo,
tokPrivateDeviceEnd,

tokPrivateRecordingStart,
tokIsRecording,
tokRecordings,
Expand Down Expand Up @@ -191,6 +199,13 @@ static const std::string Tokens[tokCountToken] =
"ChannelAlias",
"privateChannelEnd",

"privatePrivateDeviceStart",
"ActualDevice",
"SignalStrength",
"SignalQuality",
"SupportsSignalInfo",
"privateDeviceEnd",

"privateRecordingStart",
"IsRecording",
"Recordings",
Expand Down Expand Up @@ -403,6 +418,47 @@ GLCD::cType cGraphLCDSkinConfig::GetToken(const GLCD::tSkinToken & Token)
break;
}
}
else if (Token.Id > tokPrivateDeviceStart && Token.Id < tokPrivateDeviceEnd)
{
cDevice * currDev = cDevice::ActualDevice();
if (currDev)
{
switch (Token.Id)
{
case tokActualDevice:
{
return currDev->DeviceNumber()+1; // DeviceNumber() starts with 0 but let output start w/ 1
}
case tokSignalStrength:
{
#if VDRVERSNUM >= 10719
return currDev->SignalStrength();
#else
return false;
#endif
}
case tokSignalQuality:
{
#if VDRVERSNUM >= 10719
return currDev->SignalQuality();
#else
return false;
#endif
}
case tokSupportsSignalInfo:
{
#if VDRVERSNUM >= 10719
return true;
#else
return false;
#endif
}
default:
break;
}
}
return false;
}
else if (Token.Id > tokPrivateRecordingStart && Token.Id < tokPrivateRecordingEnd)
{
switch (Token.Id)
Expand Down
3 changes: 3 additions & 0 deletions state.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ void cGraphLCDState::SetChannel(int ChannelNumber)

mutex.Unlock();

if (mDisplay->GetSkin())
mDisplay->GetSkin()->SetTSEvalSwitch(cTimeMs::Now());

mDisplay->Update();
}

Expand Down

0 comments on commit bbc8b87

Please sign in to comment.