CTimerd::TimerList CTimerdClient::getOverlappingTimers(time_t& startTime, time_t& stopTime) { CTimerd::TimerList timerlist; CTimerd::TimerList overlapping; int timerPre; int timerPost; getTimerList(timerlist); getRecordingSafety(timerPre,timerPost); for (CTimerd::TimerList::iterator it = timerlist.begin(); it != timerlist.end();++it) { if(it->stopTime != 0 && stopTime != 0) { // Check if both timers have start and end. In this case do not show conflict, if endtime is the same than the starttime of the following timer if ((stopTime+timerPost > it->alarmTime) && (startTime-timerPre < it->stopTime)) { overlapping.push_back(*it); } } else { if (!((stopTime < it->announceTime) || (startTime > it->stopTime))) { overlapping.push_back(*it); } } } return overlapping; }
void CTimerdClient::getTimerList(CTimerd::TimerList &timerlist) { CTimerdMsg::generalInteger responseInteger; CTimerd::responseGetTimer response; send(CTimerdMsg::CMD_GETTIMERLIST); timerlist.clear(); if (CBasicClient::receive_data((char* )&responseInteger, sizeof(responseInteger))) { while (responseInteger.number-- > 0) { if (CBasicClient::receive_data((char*)&response, sizeof(response))) if (response.eventState != CTimerd::TIMERSTATE_TERMINATED) timerlist.push_back(response); }; } close_connection(); }