11 #include "pvr/settings/PVRSettings.h" 12 #include "threads/Thread.h" 23 enum class TimerOperationResult;
29 class CPVRTimerInfoTag;
49 std::shared_ptr<CPVRTimerInfoTag>
GetByClient(
int iClientId,
int iClientIndex)
const;
51 typedef std::vector<std::shared_ptr<CPVRTimerInfoTag>> VecTimerInfoTag;
52 typedef std::map<CDateTime, VecTimerInfoTag> MapTags;
58 const MapTags&
GetTags()
const {
return m_tags; }
61 void InsertEntry(
const std::shared_ptr<CPVRTimerInfoTag>& newTimer);
63 mutable CCriticalSection m_critSection;
64 unsigned int m_iLastId = 0;
89 bool Update(
const std::vector<std::shared_ptr<CPVRClient>>& clients);
102 bool UpdateFromClients(
const std::vector<std::shared_ptr<CPVRClient>>& clients);
108 std::shared_ptr<CPVRTimerInfoTag> GetNextActiveTimer(
bool bIgnoreReminders =
true)
const;
113 std::shared_ptr<CPVRTimerInfoTag> GetNextActiveTVTimer()
const;
118 std::shared_ptr<CPVRTimerInfoTag> GetNextActiveRadioTimer()
const;
123 std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveTimers()
const;
128 std::shared_ptr<CPVRTimerInfoTag> GetNextReminderToAnnnounce();
134 std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetAll()
const;
139 int AmountActiveTimers()
const;
144 int AmountActiveTVTimers()
const;
149 int AmountActiveRadioTimers()
const;
154 std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveRecordings()
const;
159 std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveTVRecordings()
const;
164 std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveRadioRecordings()
const;
169 bool IsRecording()
const;
176 bool IsRecordingOnChannel(
const CPVRChannel& channel)
const;
183 std::shared_ptr<CPVRTimerInfoTag> GetActiveTimerForChannel(
184 const std::shared_ptr<CPVRChannel>& channel)
const;
189 int AmountActiveRecordings()
const;
194 int AmountActiveTVRecordings()
const;
199 int AmountActiveRadioRecordings()
const;
208 bool DeleteTimersOnChannel(
const std::shared_ptr<CPVRChannel>& channel,
209 bool bDeleteTimerRules =
true,
210 bool bCurrentlyActiveOnly =
false);
223 bool AddTimer(
const std::shared_ptr<CPVRTimerInfoTag>& tag);
235 TimerOperationResult DeleteTimer(
const std::shared_ptr<CPVRTimerInfoTag>& tag,
237 bool bDeleteRule =
false);
245 bool UpdateTimer(
const std::shared_ptr<CPVRTimerInfoTag>& tag);
252 std::shared_ptr<CPVRTimerInfoTag> GetTimerForEpgTag(
253 const std::shared_ptr<CPVREpgInfoTag>& epgTag)
const;
260 std::shared_ptr<CPVRTimerInfoTag> GetTimerRule(
261 const std::shared_ptr<CPVRTimerInfoTag>& timer)
const;
266 void UpdateChannels();
272 void Notify(
const PVREvent& event);
279 std::shared_ptr<CPVRTimerInfoTag> GetById(
unsigned int iTimerId)
const;
282 void Process()
override;
289 bool LoadFromDatabase(
const std::vector<std::shared_ptr<CPVRClient>>& clients);
291 void RemoveEntry(
const std::shared_ptr<CPVRTimerInfoTag>& tag);
292 bool UpdateEntries(
const CPVRTimersContainer& timers,
const std::vector<int>& failedClients);
293 bool UpdateEntries(
int iMaxNotificationDelay);
294 std::shared_ptr<CPVRTimerInfoTag> UpdateEntry(
const std::shared_ptr<CPVRTimerInfoTag>& timer);
296 bool AddLocalTimer(
const std::shared_ptr<CPVRTimerInfoTag>& tag,
bool bNotify);
297 bool DeleteLocalTimer(
const std::shared_ptr<CPVRTimerInfoTag>& tag,
bool bNotify);
298 bool UpdateLocalTimer(
const std::shared_ptr<CPVRTimerInfoTag>& tag);
299 std::shared_ptr<CPVRTimerInfoTag> PersistAndUpdateLocalTimer(
300 const std::shared_ptr<CPVRTimerInfoTag>& timer,
301 const std::shared_ptr<CPVRTimerInfoTag>& parentTimer);
302 void NotifyTimersEvent(
bool bAddedOrDeleted =
true);
311 bool KindMatchesTag(
const TimerKind& eKind,
const std::shared_ptr<CPVRTimerInfoTag>& tag)
const;
313 std::shared_ptr<CPVRTimerInfoTag> GetNextActiveTimer(
const TimerKind& eKind,
314 bool bIgnoreReminders)
const;
315 int AmountActiveTimers(
const TimerKind& eKind)
const;
316 std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveRecordings(
const TimerKind& eKind)
const;
317 int AmountActiveRecordings(
const TimerKind& eKind)
const;
319 bool CheckAndAppendTimerNotification(std::vector<std::pair<int, std::string>>& timerNotifications,
320 const std::shared_ptr<CPVRTimerInfoTag>& tag,
321 bool bDeleted)
const;
323 bool m_bIsUpdating =
false;
325 std::queue<std::shared_ptr<CPVRTimerInfoTag>> m_remindersToAnnounce;
326 bool m_bReminderRulesUpdatePending =
false;
328 bool m_bFirstUpdate =
true;
329 std::vector<int> m_failedClients;
Definition: PVRChannel.h:35
Definition: ContextMenuManager.h:24
const MapTags & GetTags() const
Get the timertags map.
Definition: PVRTimers.h:58
bool UpdateFromClient(const std::shared_ptr< CPVRTimerInfoTag > &timer)
Add a timer tag to this container or update the tag if already present in this container.
Definition: PVRTimers.cpp:44
Definition: PVRTimers.h:68
DateTime class, which uses FileTime as it's base.
Definition: XBDateTime.h:63
Definition: PVRTimers.h:32
Definition: PVRSettings.h:27
std::shared_ptr< CPVRTimerInfoTag > GetByClient(int iClientId, int iClientIndex) const
Get the timer tag denoted by given client id and timer id.
Definition: PVRTimers.cpp:61