The "flags" of a timer are now handled as an unsigned integer value

This commit is contained in:
Klaus Schmidinger 2006-01-06 14:31:57 +01:00
parent 16f037e3c2
commit 72e93b614b
6 changed files with 25 additions and 23 deletions

View File

@ -4116,3 +4116,5 @@ Video Disk Recorder Revision History
- Any cReceivers still attached to a cDevice when that device switches to a
different transponder are now automatically detached (suggested by Patrick
Fischer).
- The "flags" of a timer are now handled as an unsigned integer value. In order
to do this, the interface of cMenuEditBitItem also had to be changed.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menuitems.c 1.25 2006/01/03 12:47:39 kls Exp $
* $Id: menuitems.c 1.26 2006/01/06 14:19:06 kls Exp $
*/
#include "menuitems.h"
@ -116,7 +116,7 @@ void cMenuEditBoolItem::Set(void)
// --- cMenuEditBitItem ------------------------------------------------------
cMenuEditBitItem::cMenuEditBitItem(const char *Name, int *Value, int Mask, const char *FalseString, const char *TrueString)
cMenuEditBitItem::cMenuEditBitItem(const char *Name, uint *Value, uint Mask, const char *FalseString, const char *TrueString)
:cMenuEditBoolItem(Name, &bit, FalseString, TrueString)
{
value = Value;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menuitems.h 1.13 2006/01/03 12:45:38 kls Exp $
* $Id: menuitems.h 1.14 2006/01/06 14:19:12 kls Exp $
*/
#ifndef __MENUITEMS_H
@ -44,12 +44,12 @@ public:
class cMenuEditBitItem : public cMenuEditBoolItem {
protected:
int *value;
uint *value;
uint mask;
int bit;
int mask;
virtual void Set(void);
public:
cMenuEditBitItem(const char *Name, int *Value, int Mask, const char *FalseString = NULL, const char *TrueString = NULL);
cMenuEditBitItem(const char *Name, uint *Value, uint Mask, const char *FalseString = NULL, const char *TrueString = NULL);
};
class cMenuEditNumItem : public cMenuEditItem {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.c 1.39 2006/01/03 11:45:19 kls Exp $
* $Id: timers.c 1.40 2006/01/06 14:14:59 kls Exp $
*/
#include "timers.h"
@ -110,7 +110,7 @@ cString cTimer::ToText(bool UseChannelID)
char *buffer;
strreplace(file, ':', '|');
strreplace(summary, '\n', '|');
asprintf(&buffer, "%d:%s:%s:%04d:%04d:%d:%d:%s:%s\n", flags, UseChannelID ? *Channel()->GetChannelID().ToString() : *itoa(Channel()->Number()), *PrintDay(day, weekdays), start, stop, priority, lifetime, file, summary ? summary : "");
asprintf(&buffer, "%u:%s:%s:%04d:%04d:%d:%d:%s:%s\n", flags, UseChannelID ? *Channel()->GetChannelID().ToString() : *itoa(Channel()->Number()), *PrintDay(day, weekdays), start, stop, priority, lifetime, file, summary ? summary : "");
strreplace(summary, '|', '\n');
strreplace(file, '|', ':');
return cString(buffer, true);
@ -244,7 +244,7 @@ bool cTimer::Parse(const char *s)
s = s2;
}
bool result = false;
if (8 <= sscanf(s, "%d :%a[^:]:%a[^:]:%d :%d :%d :%d :%a[^:\n]:%a[^\n]", &flags, &channelbuffer, &daybuffer, &start, &stop, &priority, &lifetime, &filebuffer, &summary)) {
if (8 <= sscanf(s, "%u :%a[^:]:%a[^:]:%d :%d :%d :%d :%a[^:\n]:%a[^\n]", &flags, &channelbuffer, &daybuffer, &start, &stop, &priority, &lifetime, &filebuffer, &summary)) {
if (summary && !*skipspace(summary)) {
free(summary);
summary = NULL;
@ -467,22 +467,22 @@ void cTimer::SetPriority(int Priority)
priority = Priority;
}
void cTimer::SetFlags(int Flags)
void cTimer::SetFlags(uint Flags)
{
flags |= Flags;
}
void cTimer::ClrFlags(int Flags)
void cTimer::ClrFlags(uint Flags)
{
flags &= ~Flags;
}
void cTimer::InvFlags(int Flags)
void cTimer::InvFlags(uint Flags)
{
flags ^= Flags;
}
bool cTimer::HasFlags(int Flags) const
bool cTimer::HasFlags(uint Flags) const
{
return (flags & Flags) == Flags;
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.h 1.22 2006/01/03 11:45:26 kls Exp $
* $Id: timers.h 1.23 2006/01/06 14:13:17 kls Exp $
*/
#ifndef __TIMERS_H
@ -29,7 +29,7 @@ class cTimer : public cListObject {
private:
mutable time_t startTime, stopTime;
bool recording, pending, inVpsMargin;
int flags;
uint flags;
cChannel *channel;
mutable time_t day; ///< midnight of the day this timer shall hit, or of the first day it shall hit in case of a repeating timer
int weekdays; ///< bitmask, lowest bits: SSFTWTM (the 'M' is the LSB)
@ -49,7 +49,7 @@ public:
bool Recording(void) const { return recording; }
bool Pending(void) const { return pending; }
bool InVpsMargin(void) const { return inVpsMargin; }
int Flags(void) const { return flags; }
uint Flags(void) const { return flags; }
const cChannel *Channel(void) const { return channel; }
time_t Day(void) const { return day; }
int WeekDays(void) const { return weekdays; }
@ -82,10 +82,10 @@ public:
void SetPending(bool Pending);
void SetInVpsMargin(bool InVpsMargin);
void SetPriority(int Priority);
void SetFlags(int Flags);
void ClrFlags(int Flags);
void InvFlags(int Flags);
bool HasFlags(int Flags) const;
void SetFlags(uint Flags);
void ClrFlags(uint Flags);
void InvFlags(uint Flags);
bool HasFlags(uint Flags) const;
void Skip(void);
void OnOff(void);
cString PrintFirstDay(void) const;

6
vdr.5
View File

@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the
.\" vdr distribution.
.\"
.\" $Id: vdr.5 1.40 2005/12/25 11:08:40 kls Exp $
.\" $Id: vdr.5 1.41 2006/01/06 14:21:49 kls Exp $
.\"
.TH vdr 5 "19 Mar 2005" "1.3.38" "Video Disk Recorder Files"
.SH NAME
@ -207,7 +207,7 @@ separated by ':' characters. Example:
The fields in a timer definition have the following meaning (from left
to right):
.TP
.B Status
.B Flags
The individual bits in this field have the following meaning:
.TS
tab (@);
@ -219,7 +219,7 @@ l l.
.TE
Bits other than these can be used by external programs to mark active timers
and recognize if the user has modified them. When a user modifies an active
timer, the upper 16 bits of this 32 bit parameter will be explicitly set to 0.
timer, the upper 16 bits of this unsigned 32 bit parameter will be explicitly set to 0.
Note: in order to allow future extensibility, external programs using the
\fBstatus\fR parameter should only use the upper 16 bit of this 32 bit parameter