fix initializers and shadows

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@124 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Commit: 474790557f
Author: mws <mws@e54a6e83-5905-42d5-8d5c-058d10e6a962>
Date: 2009-12-29 (Tue, 29 Dec 2009)
This commit is contained in:
mws
2009-12-29 13:56:52 +00:00
parent 75bb567b43
commit 0ed8ac5577
10 changed files with 196 additions and 194 deletions

View File

@@ -95,7 +95,8 @@ static unsigned int _read_gxa(volatile unsigned char *base_addr, unsigned int of
*/
static void _write_gxa(volatile unsigned char *base_addr, unsigned int offset, unsigned int value)
{
while( (*(volatile unsigned int *)(base_addr + GXA_DEPTH_REG)) & 0x40000000);
while( (*(volatile unsigned int *)(base_addr + GXA_DEPTH_REG)) & 0x40000000)
{};
*(volatile unsigned int *)(base_addr + offset) = value;
}
@@ -901,16 +902,16 @@ bool CFrameBuffer::paintIcon8(const std::string & filename, const int x, const i
struct rawHeader header;
uint16_t width, height;
int fd;
int lfd;
fd = open((iconBasePath + filename).c_str(), O_RDONLY);
lfd = open((iconBasePath + filename).c_str(), O_RDONLY);
if (fd == -1) {
if (lfd == -1) {
printf("paintIcon8: error while loading icon: %s%s\n", iconBasePath.c_str(), filename.c_str());
return false;
}
read(fd, &header, sizeof(struct rawHeader));
read(lfd, &header, sizeof(struct rawHeader));
width = (header.width_hi << 8) | header.width_lo;
height = (header.height_hi << 8) | header.height_lo;
@@ -934,7 +935,7 @@ bool CFrameBuffer::paintIcon8(const std::string & filename, const int x, const i
}
d += stride;
}
close(fd);
close(lfd);
return true;
}
@@ -964,21 +965,21 @@ bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const in
}
struct rawHeader header;
uint16_t width, height;
int fd;
int lfd;
#if 0 // no need if we have whole / as r/w
std::string iconBasePath1 = "/var/share/icons/";
fd = open((iconBasePath1 + filename).c_str(), O_RDONLY);
if (fd == -1)
fd = open((iconBasePath + filename).c_str(), O_RDONLY);
lfd = open((iconBasePath1 + filename).c_str(), O_RDONLY);
if (lfd == -1)
lfd = open((iconBasePath + filename).c_str(), O_RDONLY);
#endif
fd = open((iconBasePath + filename).c_str(), O_RDONLY);
lfd = open((iconBasePath + filename).c_str(), O_RDONLY);
if (fd == -1) {
if (lfd == -1) {
printf("paintIcon: error while loading icon: %s%s\n", iconBasePath.c_str(), filename.c_str());
return false;
}
read(fd, &header, sizeof(struct rawHeader));
read(lfd, &header, sizeof(struct rawHeader));
width = (header.width_hi << 8) | header.width_lo;
height = (header.height_hi << 8) | header.height_lo;
@@ -1010,7 +1011,7 @@ bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const in
d += stride;
}
close(fd);
close(lfd);
return true;
}
@@ -1029,17 +1030,17 @@ void CFrameBuffer::loadPal(const std::string & filename, const unsigned char off
//printf("%s()\n", __FUNCTION__);
struct rgbData rgbdata;
int fd;
int lfd;
fd = open((iconBasePath + filename).c_str(), O_RDONLY);
lfd = open((iconBasePath + filename).c_str(), O_RDONLY);
if (fd == -1) {
if (lfd == -1) {
printf("error while loading palette: %s%s\n", iconBasePath.c_str(), filename.c_str());
return;
}
int pos = 0;
int readb = read(fd, &rgbdata, sizeof(rgbdata) );
int readb = read(lfd, &rgbdata, sizeof(rgbdata) );
while(readb) {
__u32 rgb = (rgbdata.r<<16) | (rgbdata.g<<8) | (rgbdata.b);
int colpos = offset+pos;
@@ -1051,7 +1052,7 @@ void CFrameBuffer::loadPal(const std::string & filename, const unsigned char off
pos++;
}
paletteSet(&cmap);
close(fd);
close(lfd);
}
void CFrameBuffer::paintPixel(const int x, const int y, const fb_pixel_t col)
@@ -1163,22 +1164,22 @@ void CFrameBuffer::setBackgroundColor(const fb_pixel_t color)
backgroundColor = color;
}
bool CFrameBuffer::loadPictureToMem(const std::string & filename, const uint16_t width, const uint16_t height, const uint16_t stride, fb_pixel_t * memp)
bool CFrameBuffer::loadPictureToMem(const std::string & filename, const uint16_t width, const uint16_t height, const uint16_t pstride, fb_pixel_t * memp)
{
struct rawHeader header;
int fd;
int lfd;
//printf("%s(%d, %d, memp)\n", __FUNCTION__, width, height);
fd = open((iconBasePath + filename).c_str(), O_RDONLY );
lfd = open((iconBasePath + filename).c_str(), O_RDONLY );
if (fd == -1)
if (lfd == -1)
{
printf("error while loading icon: %s%s\n", iconBasePath.c_str(), filename.c_str());
return false;
}
read(fd, &header, sizeof(struct rawHeader));
read(lfd, &header, sizeof(struct rawHeader));
if ((width != ((header.width_hi << 8) | header.width_lo)) ||
(height != ((header.height_hi << 8) | header.height_lo)))
@@ -1187,13 +1188,13 @@ bool CFrameBuffer::loadPictureToMem(const std::string & filename, const uint16_t
return false;
}
if ((stride == 0) || (stride == width * sizeof(fb_pixel_t)))
read(fd, memp, height * width * sizeof(fb_pixel_t));
if ((pstride == 0) || (pstride == width * sizeof(fb_pixel_t)))
read(lfd, memp, height * width * sizeof(fb_pixel_t));
else
for (int i = 0; i < height; i++)
read(fd, ((uint8_t *)memp) + i * stride, width * sizeof(fb_pixel_t));
read(lfd, ((uint8_t *)memp) + i * pstride, width * sizeof(fb_pixel_t));
close(fd);
close(lfd);
return true;
}
@@ -1214,7 +1215,7 @@ bool CFrameBuffer::savePictureFromMem(const std::string & filename, const fb_pix
{
struct rawHeader header;
uint16_t width, height;
int fd;
int lfd;
width = BACKGROUNDIMAGEWIDTH;
height = 576;
@@ -1225,19 +1226,19 @@ bool CFrameBuffer::savePictureFromMem(const std::string & filename, const fb_pix
header.height_hi = height >> 8;
header.transp = 0;
fd = open((iconBasePath + filename).c_str(), O_WRONLY | O_CREAT);
lfd = open((iconBasePath + filename).c_str(), O_WRONLY | O_CREAT);
if (fd==-1)
if (lfd==-1)
{
printf("error while saving icon: %s%s", iconBasePath.c_str(), filename.c_str() );
return false;
}
write(fd, &header, sizeof(struct rawHeader));
write(lfd, &header, sizeof(struct rawHeader));
write(fd, memp, width * height * sizeof(fb_pixel_t));
write(lfd, memp, width * height * sizeof(fb_pixel_t));
close(fd);
close(lfd);
return true;
}

View File

@@ -824,16 +824,16 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, unsig
{
case CSectionsdClient::EVT_TIMESET:
{
struct timeval tv;
gettimeofday( &tv, NULL );
long long timeOld = (long long) tv.tv_usec + (long long)((long long) tv.tv_sec * (long long) 1000000);
struct timeval ltv;
gettimeofday( &ltv, NULL );
long long timeOld = (long long) ltv.tv_usec + (long long)((long long) ltv.tv_sec * (long long) 1000000);
//printf("[neutrino] event TIMESET from SECTIONSD %x %x\n", emsg.eventID, *(unsigned*) p);
//g_Sectionsd->registerEvent(CSectionsdClient::EVT_TIMESET, 222, NEUTRINO_UDS_NAME);
stime((time_t*) p);
gettimeofday( &tv, NULL );
long long timeNew = (long long) tv.tv_usec + (long long)((long long) tv.tv_sec * (long long) 1000000);
gettimeofday( &ltv, NULL );
long long timeNew = (long long) ltv.tv_usec + (long long)((long long) ltv.tv_sec * (long long) 1000000);
delete[] p;//new [] delete []
p= new unsigned char[ sizeof(long long) ];
@@ -1440,13 +1440,13 @@ const char * CRCInput::getSpecialKeyName(const unsigned int key)
std::string CRCInput::getKeyName(const unsigned int key)
{
int unicode_value = getUnicodeValue(key);
if (unicode_value == -1)
int lunicode_value = getUnicodeValue(key);
if (lunicode_value == -1)
return getSpecialKeyName(key);
else
{
char tmp[2];
tmp[0] = unicode_value;
tmp[0] = lunicode_value;
tmp[1] = 0;
return std::string(tmp);
}

View File

@@ -51,7 +51,7 @@ size_t slotbuffer_remaining_read_space(slotbuffer_t * const slotbuffer)
delta = slotbuffer->write_pointer;
delta -= slotbuffer->read_pointer;
return (delta >= 0) ? delta : (delta + slotbuffer->size);
return (delta >= 0) ? (size_t)delta : (size_t)(delta + slotbuffer->size);
}
size_t slotbuffer_remaining_write_space(slotbuffer_t * const slotbuffer)
@@ -61,7 +61,7 @@ size_t slotbuffer_remaining_write_space(slotbuffer_t * const slotbuffer)
delta = slotbuffer->read_pointer;
delta -= slotbuffer->write_pointer;
return ((delta > 0) ? delta : (delta + slotbuffer->size)) - 1;
return ((delta > 0) ? (size_t)delta : (size_t)(delta + slotbuffer->size)) - 1;
}
size_t slotbuffer_remaining_continuous_read_space(slotbuffer_t * const slotbuffer)
@@ -73,7 +73,7 @@ size_t slotbuffer_remaining_continuous_read_space(slotbuffer_t * const slotbuffe
read_pointer = slotbuffer->read_pointer;
delta -= read_pointer;
return (delta >= 0) ? delta : (slotbuffer->size - read_pointer);
return (delta >= 0) ? (size_t)delta : (size_t)(slotbuffer->size - read_pointer);
}
size_t slotbuffer_remaining_continuous_write_space(slotbuffer_t * const slotbuffer)
@@ -89,7 +89,7 @@ size_t slotbuffer_remaining_continuous_write_space(slotbuffer_t * const slotbuff
write_pointer = slotbuffer->write_pointer;
delta -= write_pointer;
return (delta > 0) ? (delta - 1) : (slotbuffer->size - write_pointer);
return (delta > 0) ? (size_t)(delta - 1) : (size_t)(slotbuffer->size - write_pointer);
}
void slotbuffer_advance_read_pointer(slotbuffer_t * const slotbuffer, const size_t delta)

View File

@@ -704,7 +704,8 @@ void CVCRControl::Screenshot(const t_channel_id channel_id, char * fname)
pos = strlen(filename);
//if (g_Sectionsd->getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData))
if(sectionsd_getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData));
if(sectionsd_getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData))
{};
epgid = epgData.eventID;
if(epgid != 0) {
CShortEPGData epgdata;

View File

@@ -285,13 +285,13 @@ printf("CVFD::showPercentOver: %d, bar %d\n", (int) perc, pp);
}
}
void CVFD::showMenuText(const int /*position*/, const char * text, const int /*highlight*/, const bool /*utf_encoded*/)
void CVFD::showMenuText(const int /*position*/, const char * ptext, const int /*highlight*/, const bool /*utf_encoded*/)
{
if(!has_lcd) return;
if (mode != MODE_MENU_UTF8)
return;
ShowText((char *) text);
ShowText((char *) ptext);
wake_up();
}

View File

@@ -250,7 +250,7 @@ bool CFlashTool::erase(int globalProgressEnd)
{
int fd;
mtd_info_t meminfo;
erase_info_t erase;
erase_info_t lerase;
int globalProgressBegin = 0;
if( (fd = open( mtdDevice.c_str(), O_RDWR )) < 0 )
@@ -271,18 +271,18 @@ bool CFlashTool::erase(int globalProgressEnd)
globalProgressBegin = statusViewer->getGlobalStatus();
}
erase.length = meminfo.erasesize;
for (erase.start = 0; erase.start < meminfo.size;erase.start += meminfo.erasesize)
lerase.length = meminfo.erasesize;
for (lerase.start = 0; lerase.start < meminfo.size;lerase.start += meminfo.erasesize)
{
printf( "Erasing %s erase size %x start %x size %x\n",
mtdDevice.c_str(), meminfo.erasesize, erase.start,
mtdDevice.c_str(), meminfo.erasesize, lerase.start,
meminfo.size );
printf( "\rErasing %u Kbyte @ %x -- %2u %% complete.",
meminfo.erasesize/1024, erase.start,
erase.start*100/meminfo.size );
meminfo.erasesize/1024, lerase.start,
lerase.start*100/meminfo.size );
if(statusViewer)
{
int prog = int(erase.start*100./meminfo.size);
int prog = int(lerase.start*100./meminfo.size);
statusViewer->showLocalStatus(prog);
if(globalProgressEnd!=-1)
{
@@ -291,7 +291,7 @@ bool CFlashTool::erase(int globalProgressEnd)
}
}
if(ioctl( fd, MEMERASE, &erase) != 0)
if(ioctl( fd, MEMERASE, &lerase) != 0)
{
ErrorMessage = g_Locale->getText(LOCALE_FLASHUPDATE_ERASEFAILED);
close(fd);

View File

@@ -812,25 +812,25 @@ unsigned long long getcurrenttime()
#define USERMENU_ITEM_OPTION_COUNT SNeutrinoSettings::ITEM_MAX
const CMenuOptionChooser::keyval USERMENU_ITEM_OPTIONS[USERMENU_ITEM_OPTION_COUNT] =
{
{SNeutrinoSettings::ITEM_NONE, LOCALE_USERMENU_ITEM_NONE} ,
{SNeutrinoSettings::ITEM_BAR, LOCALE_USERMENU_ITEM_BAR} ,
{SNeutrinoSettings::ITEM_EPG_LIST, LOCALE_EPGMENU_EVENTLIST} ,
{SNeutrinoSettings::ITEM_EPG_SUPER, LOCALE_EPGMENU_EPGPLUS} ,
{SNeutrinoSettings::ITEM_EPG_INFO, LOCALE_EPGMENU_EVENTINFO} ,
{SNeutrinoSettings::ITEM_EPG_MISC, LOCALE_USERMENU_ITEM_EPG_MISC} ,
{SNeutrinoSettings::ITEM_AUDIO_SELECT, LOCALE_AUDIOSELECTMENUE_HEAD} ,
{SNeutrinoSettings::ITEM_SUBCHANNEL, LOCALE_INFOVIEWER_SUBSERVICE} ,
{SNeutrinoSettings::ITEM_RECORD, LOCALE_TIMERLIST_TYPE_RECORD} ,
{SNeutrinoSettings::ITEM_MOVIEPLAYER_MB, LOCALE_MOVIEBROWSER_HEAD} ,
{SNeutrinoSettings::ITEM_TIMERLIST, LOCALE_TIMERLIST_NAME} ,
{SNeutrinoSettings::ITEM_REMOTE, LOCALE_RCLOCK_MENUEADD} ,
{SNeutrinoSettings::ITEM_FAVORITS, LOCALE_FAVORITES_MENUEADD} ,
{SNeutrinoSettings::ITEM_TECHINFO, LOCALE_EPGMENU_STREAMINFO},
{SNeutrinoSettings::ITEM_PLUGIN, LOCALE_TIMERLIST_PLUGIN},
{SNeutrinoSettings::ITEM_VTXT, LOCALE_USERMENU_ITEM_VTXT} ,
{SNeutrinoSettings::ITEM_NONE, LOCALE_USERMENU_ITEM_NONE,0} ,
{SNeutrinoSettings::ITEM_BAR, LOCALE_USERMENU_ITEM_BAR,0} ,
{SNeutrinoSettings::ITEM_EPG_LIST, LOCALE_EPGMENU_EVENTLIST,0} ,
{SNeutrinoSettings::ITEM_EPG_SUPER, LOCALE_EPGMENU_EPGPLUS,0} ,
{SNeutrinoSettings::ITEM_EPG_INFO, LOCALE_EPGMENU_EVENTINFO,0} ,
{SNeutrinoSettings::ITEM_EPG_MISC, LOCALE_USERMENU_ITEM_EPG_MISC,0} ,
{SNeutrinoSettings::ITEM_AUDIO_SELECT, LOCALE_AUDIOSELECTMENUE_HEAD,0} ,
{SNeutrinoSettings::ITEM_SUBCHANNEL, LOCALE_INFOVIEWER_SUBSERVICE,0} ,
{SNeutrinoSettings::ITEM_RECORD, LOCALE_TIMERLIST_TYPE_RECORD,0} ,
{SNeutrinoSettings::ITEM_MOVIEPLAYER_MB, LOCALE_MOVIEBROWSER_HEAD,0} ,
{SNeutrinoSettings::ITEM_TIMERLIST, LOCALE_TIMERLIST_NAME,0} ,
{SNeutrinoSettings::ITEM_REMOTE, LOCALE_RCLOCK_MENUEADD,0} ,
{SNeutrinoSettings::ITEM_FAVORITS, LOCALE_FAVORITES_MENUEADD,0} ,
{SNeutrinoSettings::ITEM_TECHINFO, LOCALE_EPGMENU_STREAMINFO,0},
{SNeutrinoSettings::ITEM_PLUGIN, LOCALE_TIMERLIST_PLUGIN,0},
{SNeutrinoSettings::ITEM_VTXT, LOCALE_USERMENU_ITEM_VTXT,0} ,
#if 0
{SNeutrinoSettings::ITEM_MOVIEPLAYER_TS, LOCALE_MAINMENU_MOVIEPLAYER} ,
{SNeutrinoSettings::ITEM_RESTART_CAMD, LOCALE_EXTRA_RESTARTCAMD}
{SNeutrinoSettings::ITEM_MOVIEPLAYER_TS, LOCALE_MAINMENU_MOVIEPLAYER,0} ,
{SNeutrinoSettings::ITEM_RESTART_CAMD, LOCALE_EXTRA_RESTARTCAMD,0}
#endif
};

View File

@@ -141,58 +141,58 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd)
if (CBasicServer::send_data(connfd, &responseInteger, sizeof(responseInteger)) == true)
{
for(CTimerEventMap::iterator pos = events.begin();pos != events.end();pos++)
for(CTimerEventMap::iterator lpos = events.begin();lpos != events.end();++lpos)
{
CTimerd::responseGetTimer resp;
CTimerd::responseGetTimer lresp;
CTimerEvent *event = pos->second;
CTimerEvent *event = lpos->second;
resp.eventID = event->eventID;
resp.eventState = event->eventState;
resp.eventType = event->eventType;
resp.eventRepeat = event->eventRepeat;
resp.announceTime = event->announceTime;
resp.alarmTime = event->alarmTime;
resp.stopTime = event->stopTime;
resp.repeatCount = event->repeatCount;
lresp.eventID = event->eventID;
lresp.eventState = event->eventState;
lresp.eventType = event->eventType;
lresp.eventRepeat = event->eventRepeat;
lresp.announceTime = event->announceTime;
lresp.alarmTime = event->alarmTime;
lresp.stopTime = event->stopTime;
lresp.repeatCount = event->repeatCount;
if(event->eventType == CTimerd::TIMER_STANDBY)
resp.standby_on = static_cast<CTimerEvent_Standby*>(event)->standby_on;
lresp.standby_on = static_cast<CTimerEvent_Standby*>(event)->standby_on;
else if(event->eventType == CTimerd::TIMER_NEXTPROGRAM)
{
resp.epgID = static_cast<CTimerEvent_NextProgram*>(event)->eventInfo.epgID;
resp.epg_starttime = static_cast<CTimerEvent_NextProgram*>(event)->eventInfo.epg_starttime;
resp.channel_id = static_cast<CTimerEvent_NextProgram*>(event)->eventInfo.channel_id;
resp.apids = static_cast<CTimerEvent_Record*>(event)->eventInfo.apids;
lresp.epgID = static_cast<CTimerEvent_NextProgram*>(event)->eventInfo.epgID;
lresp.epg_starttime = static_cast<CTimerEvent_NextProgram*>(event)->eventInfo.epg_starttime;
lresp.channel_id = static_cast<CTimerEvent_NextProgram*>(event)->eventInfo.channel_id;
lresp.apids = static_cast<CTimerEvent_Record*>(event)->eventInfo.apids;
}
else if(event->eventType == CTimerd::TIMER_RECORD)
{
CTimerEvent_Record* ev= static_cast<CTimerEvent_Record*>(event);
resp.epgID = ev->eventInfo.epgID;
resp.epg_starttime = ev->eventInfo.epg_starttime;
resp.channel_id = ev->eventInfo.channel_id;
resp.apids = ev->eventInfo.apids;
strcpy(resp.recordingDir, ev->recordingDir.substr(0,sizeof(resp.recordingDir)-1).c_str());
strcpy(resp.epgTitle, ev->epgTitle.substr(0,sizeof(resp.epgTitle)-1).c_str());
lresp.epgID = ev->eventInfo.epgID;
lresp.epg_starttime = ev->eventInfo.epg_starttime;
lresp.channel_id = ev->eventInfo.channel_id;
lresp.apids = ev->eventInfo.apids;
strcpy(lresp.recordingDir, ev->recordingDir.substr(0,sizeof(lresp.recordingDir)-1).c_str());
strcpy(lresp.epgTitle, ev->epgTitle.substr(0,sizeof(lresp.epgTitle)-1).c_str());
}
else if(event->eventType == CTimerd::TIMER_ZAPTO)
{
CTimerEvent_Zapto* ev= static_cast<CTimerEvent_Zapto*>(event);
resp.epgID = ev->eventInfo.epgID;
resp.epg_starttime = ev->eventInfo.epg_starttime;
resp.channel_id = ev->eventInfo.channel_id;
resp.apids = ev->eventInfo.apids;
strcpy(resp.epgTitle, ev->epgTitle.substr(0,sizeof(resp.epgTitle)-1).c_str());
lresp.epgID = ev->eventInfo.epgID;
lresp.epg_starttime = ev->eventInfo.epg_starttime;
lresp.channel_id = ev->eventInfo.channel_id;
lresp.apids = ev->eventInfo.apids;
strcpy(lresp.epgTitle, ev->epgTitle.substr(0,sizeof(lresp.epgTitle)-1).c_str());
}
else if(event->eventType == CTimerd::TIMER_REMIND)
{
strcpy(resp.message, static_cast<CTimerEvent_Remind*>(event)->message);
strcpy(lresp.message, static_cast<CTimerEvent_Remind*>(event)->message);
}
else if(event->eventType == CTimerd::TIMER_EXEC_PLUGIN)
{
strcpy(resp.pluginName, static_cast<CTimerEvent_ExecPlugin*>(event)->name);
strcpy(lresp.pluginName, static_cast<CTimerEvent_ExecPlugin*>(event)->name);
}
CBasicServer::send_data(connfd, &resp, sizeof(CTimerd::responseGetTimer));
CBasicServer::send_data(connfd, &lresp, sizeof(CTimerd::responseGetTimer));
}
}
break;

View File

@@ -241,16 +241,16 @@ int CTimerManager::addEvent(CTimerEvent* evt, bool save)
}
//------------------------------------------------------------
bool CTimerManager::removeEvent(int eventID)
bool CTimerManager::removeEvent(int peventID)
{
bool res = false;
pthread_mutex_lock(&tm_eventsMutex);
if(events.find(eventID)!=events.end()) // if i have a event with this id
if(events.find(peventID)!=events.end()) // if i have a event with this id
{
if( (events[eventID]->eventState == CTimerd::TIMERSTATE_ISRUNNING) && (events[eventID]->stopTime > 0) )
events[eventID]->stopEvent(); // if event is running an has stopTime
if( (events[peventID]->eventState == CTimerd::TIMERSTATE_ISRUNNING) && (events[peventID]->stopTime > 0) )
events[peventID]->stopEvent(); // if event is running an has stopTime
events[eventID]->eventState = CTimerd::TIMERSTATE_TERMINATED; // set the state to terminated
events[peventID]->eventState = CTimerd::TIMERSTATE_TERMINATED; // set the state to terminated
res = true; // so timerthread will do the rest for us
}
else
@@ -259,15 +259,15 @@ bool CTimerManager::removeEvent(int eventID)
return res;
}
//------------------------------------------------------------
bool CTimerManager::stopEvent(int eventID)
bool CTimerManager::stopEvent(int peventID)
{
bool res = false;
pthread_mutex_lock(&tm_eventsMutex);
if(events.find(eventID)!=events.end()) // if i have a event with this id
if(events.find(peventID)!=events.end()) // if i have a event with this id
{
if( (events[eventID]->eventState == CTimerd::TIMERSTATE_ISRUNNING) && (events[eventID]->stopTime > 0) )
events[eventID]->stopEvent(); // if event is running an has stopTime
events[eventID]->eventState = CTimerd::TIMERSTATE_HASFINISHED; // set the state to finished
if( (events[peventID]->eventState == CTimerd::TIMERSTATE_ISRUNNING) && (events[peventID]->stopTime > 0) )
events[peventID]->stopEvent(); // if event is running an has stopTime
events[peventID]->eventState = CTimerd::TIMERSTATE_HASFINISHED; // set the state to finished
res = true; // so timerthread will do the rest for us
}
else
@@ -295,13 +295,13 @@ bool CTimerManager::listEvents(CTimerEventMap &Events)
}
//------------------------------------------------------------
CTimerd::CTimerEventTypes* CTimerManager::getEventType(int eventID)
CTimerd::CTimerEventTypes* CTimerManager::getEventType(int peventID)
{
CTimerd::CTimerEventTypes *res = NULL;
pthread_mutex_lock(&tm_eventsMutex);
if(events.find(eventID)!=events.end())
if(events.find(peventID)!=events.end())
{
res = &(events[eventID]->eventType);
res = &(events[peventID]->eventType);
}
else
res = NULL;
@@ -310,13 +310,13 @@ CTimerd::CTimerEventTypes* CTimerManager::getEventType(int eventID)
}
//------------------------------------------------------------
int CTimerManager::modifyEvent(int eventID, time_t announceTime, time_t alarmTime, time_t stopTime, uint32_t repeatCount, CTimerd::CTimerEventRepeat evrepeat, CTimerd::responseGetTimer& data)
int CTimerManager::modifyEvent(int peventID, time_t announceTime, time_t alarmTime, time_t stopTime, uint32_t repeatCount, CTimerd::CTimerEventRepeat evrepeat, CTimerd::responseGetTimer& data)
{
int res = 0;
pthread_mutex_lock(&tm_eventsMutex);
if(events.find(eventID)!=events.end())
if(events.find(peventID)!=events.end())
{
CTimerEvent *event = events[eventID];
CTimerEvent *event = events[peventID];
event->announceTime = announceTime;
event->alarmTime = alarmTime;
event->stopTime = stopTime;
@@ -349,7 +349,7 @@ int CTimerManager::modifyEvent(int eventID, time_t announceTime, time_t alarmTim
}
m_saveEvents=true;
res = eventID;
res = peventID;
}
else
res = 0;
@@ -357,14 +357,14 @@ int CTimerManager::modifyEvent(int eventID, time_t announceTime, time_t alarmTim
return res;
}
int CTimerManager::modifyEvent(int eventID, unsigned char apids)
int CTimerManager::modifyEvent(int peventID, unsigned char apids)
{
dprintf("Modify Event %d apid 0x%X\n",eventID,apids);
dprintf("Modify Event %d apid 0x%X\n",peventID,apids);
int res = 0;
pthread_mutex_lock(&tm_eventsMutex);
if(events.find(eventID)!=events.end())
if(events.find(peventID)!=events.end())
{
CTimerEvent *event = events[eventID];
CTimerEvent *event = events[peventID];
if(event->eventType == CTimerd::TIMER_RECORD)
{
((CTimerEvent_Record*) (event))->eventInfo.apids = apids;
@@ -375,21 +375,21 @@ int CTimerManager::modifyEvent(int eventID, unsigned char apids)
{
((CTimerEvent_Zapto*) (event))->eventInfo.apids = apids;
m_saveEvents=true;
res = eventID;
res = peventID;
}
}
pthread_mutex_unlock(&tm_eventsMutex);
return res;
}
int CTimerManager::rescheduleEvent(int eventID, time_t announceTime, time_t alarmTime, time_t stopTime)
int CTimerManager::rescheduleEvent(int peventID, time_t announceTime, time_t alarmTime, time_t stopTime)
{
int res = 0;
pthread_mutex_lock(&tm_eventsMutex);
if(events.find(eventID)!=events.end())
if(events.find(peventID)!=events.end())
{
CTimerEvent *event = events[eventID];
CTimerEvent *event = events[peventID];
if(event->announceTime > 0)
event->announceTime += announceTime;
if(event->alarmTime > 0)
@@ -398,7 +398,7 @@ int CTimerManager::rescheduleEvent(int eventID, time_t announceTime, time_t alar
event->stopTime += stopTime;
event->eventState = CTimerd::TIMERSTATE_SCHEDULED;
m_saveEvents=true;
res = eventID;
res = peventID;
}
else
res = 0;
@@ -869,10 +869,10 @@ void CTimerEvent::Reschedule()
weekday_arr[4]=((weekdays & 0x8) > 0); //Do
weekday_arr[5]=((weekdays & 0x10) > 0); //Fr
weekday_arr[6]=((weekdays & 0x20) > 0); //Sa
struct tm *t= localtime(&alarmTime);
struct tm *lt= localtime(&alarmTime);
int day;
for(day=1 ; !weekday_arr[(t->tm_wday+day)%7] ; day++){}
t->tm_mday+=day;
for(day=1 ; !weekday_arr[(lt->tm_wday+day)%7] ; day++){}
lt->tm_mday+=day;
}
}
else

View File

@@ -76,8 +76,8 @@ typedef std::map<int, CTimerEvent*> CTimerEventMap;
class CTimerEvent_Shutdown : public CTimerEvent
{
public:
CTimerEvent_Shutdown( time_t announceTime, time_t alarmTime, CTimerd::CTimerEventRepeat evrepeat = CTimerd::TIMERREPEAT_ONCE, uint32_t repeatcount = 1) :
CTimerEvent(CTimerd::TIMER_SHUTDOWN, announceTime, alarmTime, (time_t) 0, evrepeat, repeatcount ){};
CTimerEvent_Shutdown( time_t lannounceTime, time_t lalarmTime, CTimerd::CTimerEventRepeat evrepeat = CTimerd::TIMERREPEAT_ONCE, uint32_t repeatcount = 1) :
CTimerEvent(CTimerd::TIMER_SHUTDOWN, lannounceTime, lalarmTime, (time_t) 0, evrepeat, repeatcount ){};
CTimerEvent_Shutdown(CConfigFile *config, int iId):
CTimerEvent(CTimerd::TIMER_SHUTDOWN, config, iId){};
virtual void fireEvent();
@@ -87,8 +87,8 @@ class CTimerEvent_Shutdown : public CTimerEvent
class CTimerEvent_Sleeptimer : public CTimerEvent
{
public:
CTimerEvent_Sleeptimer( time_t announceTime, time_t alarmTime, CTimerd::CTimerEventRepeat evrepeat = CTimerd::TIMERREPEAT_ONCE, uint32_t repeatcount = 1) :
CTimerEvent(CTimerd::TIMER_SLEEPTIMER, announceTime, alarmTime, (time_t) 0,evrepeat,repeatcount ){};
CTimerEvent_Sleeptimer( time_t lannounceTime, time_t lalarmTime, CTimerd::CTimerEventRepeat evrepeat = CTimerd::TIMERREPEAT_ONCE, uint32_t repeatcount = 1) :
CTimerEvent(CTimerd::TIMER_SLEEPTIMER, lannounceTime, lalarmTime, (time_t) 0,evrepeat,repeatcount ){};
CTimerEvent_Sleeptimer(CConfigFile *config, int iId):
CTimerEvent(CTimerd::TIMER_SLEEPTIMER, config, iId){};
virtual void fireEvent();
@@ -139,13 +139,13 @@ class CTimerEvent_Record : public CTimerEvent
class CTimerEvent_Zapto : public CTimerEvent_Record
{
public:
CTimerEvent_Zapto(time_t announceTime, time_t alarmTime,
CTimerEvent_Zapto(time_t lannounceTime, time_t lalarmTime,
t_channel_id channel_id,
event_id_t epgID = 0,
time_t epg_starttime = 0,
CTimerd::CTimerEventRepeat evrepeat = CTimerd::TIMERREPEAT_ONCE,
uint32_t repeatcount = 1):
CTimerEvent_Record(announceTime, alarmTime, (time_t) 0, channel_id, epgID, epg_starttime, 0, evrepeat,repeatcount)
CTimerEvent_Record(lannounceTime, lalarmTime, (time_t) 0, channel_id, epgID, epg_starttime, 0, evrepeat,repeatcount)
{eventType = getEventType();};
CTimerEvent_Zapto(CConfigFile *config, int iId):
CTimerEvent_Record(config, iId)