summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README24
-rw-r--r--imon.c39
-rw-r--r--imonlcd.c64
-rw-r--r--watch.c2
4 files changed, 109 insertions, 20 deletions
diff --git a/README b/README
index c4d330e..8ef41ed 100644
--- a/README
+++ b/README
@@ -112,3 +112,27 @@ Possible options are:
vdr -P'imonlcd -d /dev/lcd0 -p ffdc'
+Plugin SVDRP commands
+---------------------
+* OFF - Suspend driver of display.
+* ON - Resume driver of display.
+
+Use this commands like
+ #> svdrpsend.pl PLUG imonlcd OFF
+ 220 vdr SVDRP VideoDiskRecorder ....
+ 250 driver suspended
+ 221 vdr closing connection
+
+This commands can have follow responses
+OFF :
+ 250 driver suspended
+ 251 driver already suspended
+
+ON :
+ 250 driver resumed
+ 251 driver already resumed
+ 554 driver could not resumed
+*
+ 501 unknown command
+
+
diff --git a/imon.c b/imon.c
index 6f50fe0..d34cd49 100644
--- a/imon.c
+++ b/imon.c
@@ -122,20 +122,6 @@ ciMonLCD::ciMonLCD()
ciMonLCD::~ciMonLCD() {
this->close();
-
- if(pFont) {
- delete pFont;
- pFont = NULL;
- }
- if(framebuf) {
- delete framebuf;
- framebuf = NULL;
- }
- if(backingstore) {
- delete backingstore;
- backingstore = NULL;
- }
-
}
@@ -249,6 +235,20 @@ void ciMonLCD::close()
::close(this->imon_fd);
this->imon_fd = -1;
}
+
+ if(pFont) {
+ delete pFont;
+ pFont = NULL;
+ }
+ if(framebuf) {
+ delete framebuf;
+ framebuf = NULL;
+ }
+ if(backingstore) {
+ delete backingstore;
+ backingstore = NULL;
+ }
+
}
@@ -272,6 +272,11 @@ bool ciMonLCD::flush()
unsigned char msb;
int offset = 0;
+ if(this->imon_fd<0) {
+ esyslog("iMonLCD: error writing to dead file descriptor");
+ return false;
+ }
+
/*
* The display only provides for a complete screen refresh. If
* nothing has changed, don't refresh.
@@ -484,7 +489,11 @@ bool ciMonLCD::icons(int state)
bool ciMonLCD::SendCmd(const uint64_t & cmdData) {
unsigned int i;
unsigned char buf[8];
-
+
+ if(this->imon_fd<0) {
+ esyslog("iMonLCD: error writing to dead file descriptor");
+ return false;
+ }
//dsyslog("iMonLCD: writing : %08llx", cmdData);
/* Fill the send buffer. */
diff --git a/imonlcd.c b/imonlcd.c
index 67a70bc..b1782ad 100644
--- a/imonlcd.c
+++ b/imonlcd.c
@@ -30,7 +30,10 @@ private:
char* m_szDevice;
ciMonWatch m_dev;
eProtocol m_Protocol;
-
+ bool m_bSuspend;
+protected:
+ bool resume();
+ bool suspend();
public:
cPluginImonlcd(void);
virtual ~cPluginImonlcd();
@@ -57,6 +60,7 @@ public:
cPluginImonlcd::cPluginImonlcd(void)
: m_Protocol(ePROTOCOL_0038)
{
+ m_bSuspend = true;
statusMonitor = NULL;
m_szDevice = NULL;
}
@@ -140,10 +144,29 @@ bool cPluginImonlcd::Initialize(void)
return true;
}
+bool cPluginImonlcd::resume() {
+
+ if(m_bSuspend
+ && NULL != m_szDevice
+ && 0 == m_dev.open(m_szDevice,m_Protocol)) {
+ m_bSuspend = false;
+ return true;
+ }
+ return false;
+}
+
+bool cPluginImonlcd::suspend() {
+ if(!m_bSuspend) {
+ m_dev.close();
+ m_bSuspend = true;
+ return true;
+ }
+ return false;
+}
+
bool cPluginImonlcd::Start(void)
{
- if(NULL != m_szDevice
- && 0 == m_dev.open(m_szDevice,m_Protocol)) {
+ if(resume()) {
statusMonitor = new ciMonStatusMonitor(&m_dev);
if(NULL == statusMonitor){
esyslog("iMonLCD: can't create ciMonStatusMonitor!");
@@ -215,14 +238,45 @@ bool cPluginImonlcd::Service(const char *Id, void *Data)
const char **cPluginImonlcd::SVDRPHelpPages(void)
{
// Return help text for SVDRP commands this plugin implements
- return NULL;
+ static const char *HelpPages[] = {
+ "ON\n"
+ " Resume driver of display.",
+ "OFF\n"
+ " Suspend driver of display.",
+ NULL
+ };
+ return HelpPages;
}
cString cPluginImonlcd::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode)
{
// Process SVDRP commands this plugin implements
+ if(!strcasecmp(Command, "ON")) {
+ if(!m_bSuspend) {
+ ReplyCode=251;
+ return "driver already resumed";
+ }
+ if(resume()) {
+ ReplyCode=250;
+ return "driver resumed";
+ } else {
+ ReplyCode=554;
+ return "driver could not resumed";
+ }
+ } else if(!strcasecmp(Command, "OFF")) {
+ if(suspend()) {
+ ReplyCode=250;
+ return "driver suspended";
+ } else {
+ ReplyCode=251;
+ return "driver already suspended";
+ }
+ } else {
+ ReplyCode=501;
+ return "unknown command";
+ }
+
return NULL;
}
VDRPLUGINCREATOR(cPluginImonlcd); // Don't touch this!
-
diff --git a/watch.c b/watch.c
index 7441312..e2a68d1 100644
--- a/watch.c
+++ b/watch.c
@@ -101,6 +101,8 @@ ciMonWatch::~ciMonWatch()
int ciMonWatch::open(const char* szDevice, eProtocol pro) {
int iRet = ciMonLCD::open(szDevice,pro);
if(0==iRet) {
+ m_bShutdown = false;
+ m_bUpdateScreen = true;
Start();
}
return iRet;