mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Fixed handling CAM menus in case the CAM connection fails while the menu is being presented
This commit is contained in:
		@@ -852,6 +852,10 @@ Markus Hardt <markus.hardt@gmx.net>
 | 
				
			|||||||
Thomas Rausch <Thomas.Rausch@gmx.de>
 | 
					Thomas Rausch <Thomas.Rausch@gmx.de>
 | 
				
			||||||
 for making VDR try to get a timer's channel without RID when loading 'timers.conf'
 | 
					 for making VDR try to get a timer's channel without RID when loading 'timers.conf'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Thomas v. Keller <v.keller@neckarufer.de>
 | 
				
			||||||
 | 
					 for reporting a crash in case the CAM connection fails while a CAM menu
 | 
				
			||||||
 | 
					 is being presented
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Emil Petersky <petersky@isr.uni-stuttgart.de>
 | 
					Emil Petersky <petersky@isr.uni-stuttgart.de>
 | 
				
			||||||
 for adding "Slovak Link" and "Czech Link" to 'ca.conf'
 | 
					 for adding "Slovak Link" and "Czech Link" to 'ca.conf'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								HISTORY
									
									
									
									
									
								
							@@ -2445,6 +2445,11 @@ Video Disk Recorder Revision History
 | 
				
			|||||||
  Oliver Endriss).
 | 
					  Oliver Endriss).
 | 
				
			||||||
- Fixed handling comments in editing marks.
 | 
					- Fixed handling comments in editing marks.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2003-10-26: Version 1.2.6pre4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Fixed handling CAM menus in case the CAM connection fails while the menu
 | 
				
			||||||
 | 
					  is being presented (thanks to Thomas v. Keller for reportign this one).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2003-10-24: Version 1.3.0
 | 
					2003-10-24: Version 1.3.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Changed thread handling to make it work with NPTL ("Native Posix Thread Library").
 | 
					- Changed thread handling to make it work with NPTL ("Native Posix Thread Library").
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										54
									
								
								ci.c
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								ci.c
									
									
									
									
									
								
							@@ -4,7 +4,7 @@
 | 
				
			|||||||
 * See the main source file 'vdr.c' for copyright information and
 | 
					 * See the main source file 'vdr.c' for copyright information and
 | 
				
			||||||
 * how to reach the author.
 | 
					 * how to reach the author.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * $Id: ci.c 1.16 2003/08/02 10:00:01 kls Exp $
 | 
					 * $Id: ci.c 1.17 2003/10/26 13:04:23 kls Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* XXX TODO
 | 
					/* XXX TODO
 | 
				
			||||||
@@ -1004,15 +1004,15 @@ bool cCiDateTime::Process(int Length, const uint8_t *Data)
 | 
				
			|||||||
class cCiMMI : public cCiSession {
 | 
					class cCiMMI : public cCiSession {
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  char *GetText(int &Length, const uint8_t **Data);
 | 
					  char *GetText(int &Length, const uint8_t **Data);
 | 
				
			||||||
  cCiMenu *menu;
 | 
					  cCiMenu *menu, *fetchedMenu;
 | 
				
			||||||
  cCiEnquiry *enquiry;
 | 
					  cCiEnquiry *enquiry, *fetchedEnquiry;
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  cCiMMI(int SessionId, cCiTransportConnection *Tc);
 | 
					  cCiMMI(int SessionId, cCiTransportConnection *Tc);
 | 
				
			||||||
  virtual ~cCiMMI();
 | 
					  virtual ~cCiMMI();
 | 
				
			||||||
  virtual bool Process(int Length = 0, const uint8_t *Data = NULL);
 | 
					  virtual bool Process(int Length = 0, const uint8_t *Data = NULL);
 | 
				
			||||||
  virtual bool HasUserIO(void) { return menu || enquiry; }
 | 
					  virtual bool HasUserIO(void) { return menu || enquiry; }
 | 
				
			||||||
  cCiMenu *Menu(void);
 | 
					  cCiMenu *Menu(bool Clear = false);
 | 
				
			||||||
  cCiEnquiry *Enquiry(void);
 | 
					  cCiEnquiry *Enquiry(bool Clear = false);
 | 
				
			||||||
  bool SendMenuAnswer(uint8_t Selection);
 | 
					  bool SendMenuAnswer(uint8_t Selection);
 | 
				
			||||||
  bool SendAnswer(const char *Text);
 | 
					  bool SendAnswer(const char *Text);
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
@@ -1021,13 +1021,21 @@ cCiMMI::cCiMMI(int SessionId, cCiTransportConnection *Tc)
 | 
				
			|||||||
:cCiSession(SessionId, RI_MMI, Tc)
 | 
					:cCiSession(SessionId, RI_MMI, Tc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  dbgprotocol("New MMI (session id %d)\n", SessionId);
 | 
					  dbgprotocol("New MMI (session id %d)\n", SessionId);
 | 
				
			||||||
  menu = NULL;
 | 
					  menu = fetchedMenu = NULL;
 | 
				
			||||||
  enquiry = NULL;
 | 
					  enquiry = fetchedEnquiry = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cCiMMI::~cCiMMI()
 | 
					cCiMMI::~cCiMMI()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  if (fetchedMenu) {
 | 
				
			||||||
 | 
					     cMutexLock MutexLock(&fetchedMenu->mutex);
 | 
				
			||||||
 | 
					     fetchedMenu->mmi = NULL;
 | 
				
			||||||
 | 
					     }
 | 
				
			||||||
  delete menu;
 | 
					  delete menu;
 | 
				
			||||||
 | 
					  if (fetchedEnquiry) {
 | 
				
			||||||
 | 
					     cMutexLock MutexLock(&fetchedEnquiry->mutex);
 | 
				
			||||||
 | 
					     fetchedEnquiry->mmi = NULL;
 | 
				
			||||||
 | 
					     }
 | 
				
			||||||
  delete enquiry;
 | 
					  delete enquiry;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1123,18 +1131,26 @@ bool cCiMMI::Process(int Length, const uint8_t *Data)
 | 
				
			|||||||
  return true;
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cCiMenu *cCiMMI::Menu(void)
 | 
					cCiMenu *cCiMMI::Menu(bool Clear)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  cCiMenu *m = menu;
 | 
					  if (Clear)
 | 
				
			||||||
  menu = NULL;
 | 
					     fetchedMenu = NULL;
 | 
				
			||||||
  return m;
 | 
					  else if (menu) {
 | 
				
			||||||
 | 
					     fetchedMenu = menu;
 | 
				
			||||||
 | 
					     menu = NULL;
 | 
				
			||||||
 | 
					     }
 | 
				
			||||||
 | 
					  return fetchedMenu;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cCiEnquiry *cCiMMI::Enquiry(void)
 | 
					cCiEnquiry *cCiMMI::Enquiry(bool Clear)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  cCiEnquiry *e = enquiry;
 | 
					  if (Clear)
 | 
				
			||||||
  enquiry = NULL;
 | 
					     fetchedEnquiry = NULL;
 | 
				
			||||||
  return e;
 | 
					  else if (enquiry) {
 | 
				
			||||||
 | 
					     fetchedEnquiry = enquiry;
 | 
				
			||||||
 | 
					     enquiry = NULL;
 | 
				
			||||||
 | 
					     }
 | 
				
			||||||
 | 
					  return fetchedEnquiry;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool cCiMMI::SendMenuAnswer(uint8_t Selection)
 | 
					bool cCiMMI::SendMenuAnswer(uint8_t Selection)
 | 
				
			||||||
@@ -1170,6 +1186,9 @@ cCiMenu::cCiMenu(cCiMMI *MMI, bool Selectable)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
cCiMenu::~cCiMenu()
 | 
					cCiMenu::~cCiMenu()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  cMutexLock MutexLock(&mutex);
 | 
				
			||||||
 | 
					  if (mmi)
 | 
				
			||||||
 | 
					     mmi->Menu(true);
 | 
				
			||||||
  free(titleText);
 | 
					  free(titleText);
 | 
				
			||||||
  free(subTitleText);
 | 
					  free(subTitleText);
 | 
				
			||||||
  free(bottomText);
 | 
					  free(bottomText);
 | 
				
			||||||
@@ -1188,6 +1207,7 @@ bool cCiMenu::AddEntry(char *s)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool cCiMenu::Select(int Index)
 | 
					bool cCiMenu::Select(int Index)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  cMutexLock MutexLock(&mutex);
 | 
				
			||||||
  if (mmi && -1 <= Index && Index < numEntries)
 | 
					  if (mmi && -1 <= Index && Index < numEntries)
 | 
				
			||||||
     return mmi->SendMenuAnswer(Index + 1);
 | 
					     return mmi->SendMenuAnswer(Index + 1);
 | 
				
			||||||
  return false;
 | 
					  return false;
 | 
				
			||||||
@@ -1210,11 +1230,15 @@ cCiEnquiry::cCiEnquiry(cCiMMI *MMI)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
cCiEnquiry::~cCiEnquiry()
 | 
					cCiEnquiry::~cCiEnquiry()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  cMutexLock MutexLock(&mutex);
 | 
				
			||||||
 | 
					  if (mmi)
 | 
				
			||||||
 | 
					     mmi->Enquiry(true);
 | 
				
			||||||
  free(text);
 | 
					  free(text);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool cCiEnquiry::Reply(const char *s)
 | 
					bool cCiEnquiry::Reply(const char *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  cMutexLock MutexLock(&mutex);
 | 
				
			||||||
  return mmi ? mmi->SendAnswer(s) : false;
 | 
					  return mmi ? mmi->SendAnswer(s) : false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								ci.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								ci.h
									
									
									
									
									
								
							@@ -4,7 +4,7 @@
 | 
				
			|||||||
 * See the main source file 'vdr.c' for copyright information and
 | 
					 * See the main source file 'vdr.c' for copyright information and
 | 
				
			||||||
 * how to reach the author.
 | 
					 * how to reach the author.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * $Id: ci.h 1.8 2003/05/25 11:44:47 kls Exp $
 | 
					 * $Id: ci.h 1.9 2003/10/26 12:22:09 kls Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __CI_H
 | 
					#ifndef __CI_H
 | 
				
			||||||
@@ -21,6 +21,7 @@ class cCiMenu {
 | 
				
			|||||||
private:
 | 
					private:
 | 
				
			||||||
  enum { MAX_CIMENU_ENTRIES = 64 }; ///< XXX is there a specified maximum?
 | 
					  enum { MAX_CIMENU_ENTRIES = 64 }; ///< XXX is there a specified maximum?
 | 
				
			||||||
  cCiMMI *mmi;
 | 
					  cCiMMI *mmi;
 | 
				
			||||||
 | 
					  cMutex mutex;
 | 
				
			||||||
  bool selectable;
 | 
					  bool selectable;
 | 
				
			||||||
  char *titleText;
 | 
					  char *titleText;
 | 
				
			||||||
  char *subTitleText;
 | 
					  char *subTitleText;
 | 
				
			||||||
@@ -45,6 +46,7 @@ class cCiEnquiry {
 | 
				
			|||||||
  friend class cCiMMI;
 | 
					  friend class cCiMMI;
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  cCiMMI *mmi;
 | 
					  cCiMMI *mmi;
 | 
				
			||||||
 | 
					  cMutex mutex;
 | 
				
			||||||
  char *text;
 | 
					  char *text;
 | 
				
			||||||
  bool blind;
 | 
					  bool blind;
 | 
				
			||||||
  int expectedLength;
 | 
					  int expectedLength;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user