DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
ap_tmr.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 // pre-processor mechanism so multiple inclusions don't cause compilation error
26 
27 #ifndef _AP_TMR_H
28 #define _AP_TMR_H
29 
30 #include "techtype.h"
31 #include "stbgc.h"
32 
33 //---Constant and macro definitions for public use-----------------------------
34 #define INVALID_TIMER_HANDLE 0
35 
36 #define TMR_MAX_NAME_LENGTH 128
37 
38 #define TMR_PVR_CRID_LEN_MAX 65
39 
40 #define TMR_PVR_ADDINFO_LEN_MAX 255
41 #if 0
42 #define TMR_HOURS_THRESHOLD_EXC 24
43 #define TMR_MINS_THRESHOLD_EXC 60
44 #endif
45 
46 /* The number of hours added to a timer to allow an event triggered recording to overrun
47  * before the recording is stopped */
48 #define EVENT_DURATION_OVERRUN_TIME 2
49 
50 //---Enumerations for public use-----------------------------------------------
51 
52 typedef enum
53 {
54  TIMER_TYPE_NONE = 0x00,
55  TIMER_TYPE_ALARM = 0x01,
56  TIMER_TYPE_SLEEP = 0x02,
57  TIMER_TYPE_PVR_RECORD = 0x04,
58  TIMER_TYPE_PRIVATE = 0x08,
59  TIMER_TYPE_ALL = 0xff
60 } E_TIMER_TYPE;
61 
62 typedef enum
63 {
64  TIMER_FREQ_ONCE,
65  TIMER_FREQ_WEEKLY,
66  TIMER_FREQ_WEEKENDDAYS,
67  TIMER_FREQ_WEEKDAYS,
68  TIMER_FREQ_DAILY,
69  TIMER_FREQ_HOURLY
70 } E_TIMER_FREQ;
71 
72 //---Global type defs for public use-------------------------------------------
73 // service data structures:
74 typedef struct
75 {
76  BOOLEAN change_service;
77  U16BIT service_id;
78  U16BIT transport_id;
79  U16BIT orig_net_id;
80  BOOLEAN ramp_volume;
81 } S_ALARM_INFO;
82 
83 typedef struct
84 {
85  U32DHMS duration;
86  BOOLEAN event_triggered;
87  U16BIT event_id;
88  U16BIT service_id;
89  U16BIT transport_id;
90  U16BIT orig_net_id;
91  U8BIT prog_crid[TMR_PVR_CRID_LEN_MAX];
92  U8BIT other_crid[TMR_PVR_CRID_LEN_MAX];
93  U16BIT disk_id;
94  BOOLEAN recommendation;
95  U16BIT notify_time; /* Time in seconds to receive notification that a recording will soon start */
97 
98 typedef struct s_timer
99 {
100  E_TIMER_TYPE type;
101  U8BIT name[TMR_MAX_NAME_LENGTH];
102  E_TIMER_FREQ frequency;
103  U32DHMS start_time;
104  BOOLEAN ram_only; /* If TRUE, don't save the timer in NVM */
105  union
106  {
107  S_ALARM_INFO alarm;
108  S_PVR_RECORD_INFO record;
109  } u;
110 } S_TIMER_INFO;
111 
112 typedef struct s_avrec_settings
113 {
114  U16BIT av_rec_lcn;
115  BOOLEAN standby_mode;
117 
118 //---Global Function prototypes for public use---------------------------------
119 
123 void ATMR_Initialise(void);
124 
130 U32BIT ATMR_AddTimer(S_TIMER_INFO *info);
131 
143 U32BIT ATMR_AddTimerForEvent(void *event_ptr, void *serv_ptr, BOOLEAN record, BOOLEAN event_triggered);
144 
151 BOOLEAN ATMR_UpdateTimerDuration(U32BIT handle, U32DHMS duration);
152 
159 BOOLEAN ATMR_UpdateTimer(U32BIT handle, S_TIMER_INFO *info);
160 
166 BOOLEAN ATMR_DeleteTimer(U32BIT handle);
167 
177 BOOLEAN ATMR_GetTimerList(U32BIT **timer_list, U16BIT *list_size, E_TIMER_TYPE list_type,
178  BOOLEAN date_time_order);
179 
185 void ATMR_ReleaseTimerList(U32BIT *timer_list, U16BIT list_size);
186 
201 BOOLEAN ATMR_InitialiseTimer(S_TIMER_INFO *timer_info, E_TIMER_TYPE timer_type, void *serv_ptr,
202  void *event_ptr);
203 
210 BOOLEAN ATMR_GetTimerInfo(U32BIT handle, S_TIMER_INFO *timer_info);
211 
218 BOOLEAN ATMR_StartRecord(U8BIT path);
219 
225 void ATMR_RecordingFailed(U8BIT path);
226 
232 void* ATMR_GetRecordService(U8BIT path);
233 
239 U8BIT* ATMR_GetName(U32BIT handle);
240 
245 void ATMR_SetName(U32BIT handle, U8BIT *name);
246 
253 U32DHMS ATMR_GetStartDateTime(U32BIT handle);
254 
260 U32DHMS ATMR_GetDuration(U32BIT handle);
261 
268 U32DHMS ATMR_GetEndDateTime(U32BIT handle);
269 
275 E_TIMER_TYPE ATMR_GetType(U32BIT handle);
276 
282 E_TIMER_FREQ ATMR_GetFrequency(U32BIT handle);
283 
289 BOOLEAN ATMR_GetChangeService(U32BIT handle);
290 
296 BOOLEAN ATMR_GetRampVolume(U32BIT handle);
297 
303 U16BIT ATMR_GetEventId(U32BIT handle);
304 
311 U16BIT ATMR_GetServiceId(U32BIT handle);
312 
319 U16BIT ATMR_GetTransportId(U32BIT handle);
320 
327 U16BIT ATMR_GetOriginalNetworkId(U32BIT handle);
328 
334 BOOLEAN ATMR_GetMissed(U32BIT handle);
335 
342 U8BIT* ATMR_GetProgrammeCrid(U32BIT handle);
343 
350 BOOLEAN ATMR_HasSeriesCrid(U32BIT handle);
351 
358 BOOLEAN ATMR_HasRecommendationCrid(U32BIT handle);
359 
365 U16BIT ATMR_GetDiskId(U32BIT handle);
366 
372 void ATMR_SetDiskId(U32BIT handle, U16BIT disk_id);
373 
380 U32BIT ATMR_GetRecordingHandle(U32BIT handle);
381 
390 void ATMR_HandleTimerEvent(U32BIT timer_handle);
391 
398 BOOLEAN ATMR_CheckRecordStatus(BOOLEAN recordings_can_start);
399 
405 void ATMR_EitUpdated(void);
406 
411 void ATMR_DeleteRecordingTimer(U32BIT recording_handle);
412 
423 U8BIT ATMR_GetNumSimultaneousRecordings(U8BIT max_recordings, U32DHMS start_date_time,
424  U32DHMS end_date_time, U32BIT **conflicting_timers);
425 
439 void* ATMR_RecordEvent(void *serv_ptr, void *event_ptr, U8BIT *prog_crid, U8BIT *series_crid,
440  BOOLEAN is_series, BOOLEAN check_alternatives);
441 
454 BOOLEAN ATMR_RecordSplitEvent(void *serv_ptr, U8BIT *prog_crid, U32DHMS start_date_time,
455  BOOLEAN radio_service, BOOLEAN search_forward);
456 
466 U32BIT ATMR_GetFirstWakeupTime(U32DHMS *rec_date_time, U16BIT *onet_id, U16BIT *trans_id,
467  U16BIT *service_id);
468 
477 U32BIT ATMR_FindTimerFromEvent(U16BIT onet_id, U16BIT trans_id, U16BIT serv_id, U16BIT event_id);
478 
484 U32BIT ATMR_FindTimerFromCrid(U8BIT *prog_crid);
485 
494 U32BIT ATMR_FindTimerFromCridAndEvent(U8BIT *prog_crid, U16BIT service_id, U16BIT event_id);
495 
501 void ATMR_DeleteTimersForSeriesRecommendations(U8BIT *crid, BOOLEAN is_recommendation);
502 
510 void ATMR_SetAdditionalInfo(U32BIT handle, U8BIT *info, U32BIT size);
511 
519 U8BIT* ATMR_GetAdditionalInfo(U32BIT handle, U32BIT *size);
520 
528 S32BIT ATMR_GetStartPadding(U32BIT handle);
529 
538 BOOLEAN ATMR_SetStartPadding(U32BIT handle, S32BIT start_padding);
539 
547 S32BIT ATMR_GetEndPadding(U32BIT handle);
548 
557 BOOLEAN ATMR_SetEndPadding(U32BIT handle, S32BIT end_padding);
558 
559 void ATMR_DumpAllTimers(void);
560 
561 #endif // _AP_TMR_H
U16BIT ATMR_GetDiskId(U32BIT handle)
Returns the disk id for the given timer if the timer is a PVR recording timer.
Definition: ap_tmr.c:1520
U8BIT * ATMR_GetProgrammeCrid(U32BIT handle)
Returns a pointer to the programme CRID string from a recording timer. The returned value shouldn't b...
Definition: ap_tmr.c:1423
U16BIT ATMR_GetTransportId(U32BIT handle)
Returns the transport ID for an alarm or PVR recording timer.
Definition: ap_tmr.c:1321
BOOLEAN ATMR_GetChangeService(U32BIT handle)
Returns the change service setting for an alarm timer.
Definition: ap_tmr.c:1194
BOOLEAN ATMR_CheckRecordStatus(BOOLEAN recordings_can_start)
Checks all timers to see whether any recordings should be started or stopped as a result of the now e...
Definition: ap_tmr.c:1817
BOOLEAN ATMR_SetEndPadding(U32BIT handle, S32BIT end_padding)
Sets the value of end_padding associated with the specified timer The end padding is the number of se...
Definition: ap_tmr.c:3251
S32BIT ATMR_GetEndPadding(U32BIT handle)
Returns the value of end_padding associated with the specified timer The end padding is the number of...
Definition: ap_tmr.c:3218
U32DHMS ATMR_GetDuration(U32BIT handle)
Returns the duration of the timert with the given handle.
Definition: ap_tmr.c:1070
BOOLEAN ATMR_GetRampVolume(U32BIT handle)
Returns the ramp volume setting for an alarm timer.
Definition: ap_tmr.c:1224
BOOLEAN ATMR_StartRecord(U8BIT path)
Finds the timer using the given decode path and if it's a recording timer the recording will be start...
Definition: ap_tmr.c:528
U32BIT ATMR_GetRecordingHandle(U32BIT handle)
Returns the recording handle associated with a PVR recording timer.
Definition: ap_tmr.c:1579
void ATMR_DeleteRecordingTimer(U32BIT recording_handle)
Delete the PVR record timer with the given recording handle.
Definition: ap_tmr.c:2179
U8BIT * ATMR_GetAdditionalInfo(U32BIT handle, U32BIT *size)
Gets the additional information string associated with a timer. The name is allocated in UI temp memo...
Definition: ap_tmr.c:3085
Definition: ap_tmr.h:98
BOOLEAN ATMR_RecordSplitEvent(void *serv_ptr, U8BIT *prog_crid, U32DHMS start_date_time, BOOLEAN radio_service, BOOLEAN search_forward)
Searches for events within 3 hours of the given start date/time for an event with the given programme...
Definition: ap_tmr.c:2572
void ATMR_DumpAllTimers(void)
Prints details of all existing timers.
Definition: ap_tmr.c:3322
E_TIMER_FREQ ATMR_GetFrequency(U32BIT handle)
Returns the frequency setting for the given timer.
Definition: ap_tmr.c:1164
BOOLEAN ATMR_HasSeriesCrid(U32BIT handle)
Does the timer have a series crid?
Definition: ap_tmr.c:1455
void ATMR_DeleteTimersForSeriesRecommendations(U8BIT *crid, BOOLEAN is_recommendation)
Deletes any PVR record timers with the given series CRID.
Definition: ap_tmr.c:2994
void ATMR_HandleTimerEvent(U32BIT timer_handle)
Used by the DVB stack to handle an event for the given timer. If the timer requires the app to deal w...
Definition: ap_tmr.c:1608
U32DHMS ATMR_GetEndDateTime(U32BIT handle)
Get the end date & time of the timer with the given handle. The date/time returned will be in UTC...
Definition: ap_tmr.c:1099
BOOLEAN ATMR_GetTimerList(U32BIT **timer_list, U16BIT *list_size, E_TIMER_TYPE list_type, BOOLEAN date_time_order)
Returns a list of all the timer handles and the number of items in the list.
Definition: ap_tmr.c:440
void ATMR_EitUpdated(void)
Checks each recording timer that's linked to an event to see whether the event is still in the schedu...
Definition: ap_tmr.c:1981
U32BIT ATMR_FindTimerFromCridAndEvent(U8BIT *prog_crid, U16BIT service_id, U16BIT event_id)
Searches the timers for a recording timer with the given programme CRID and event ID...
Definition: ap_tmr.c:2953
BOOLEAN ATMR_HasRecommendationCrid(U32BIT handle)
Does the timer have a recommendation crid?
Definition: ap_tmr.c:1488
BOOLEAN ATMR_GetTimerInfo(U32BIT handle, S_TIMER_INFO *timer_info)
Copies timer data for the given timer info the info structure provided.
Definition: ap_tmr.c:858
E_TIMER_TYPE ATMR_GetType(U32BIT handle)
Returns the type of the given timer.
Definition: ap_tmr.c:1134
U16BIT ATMR_GetOriginalNetworkId(U32BIT handle)
Returns the original network ID for an alarm or PVR recording timer.
Definition: ap_tmr.c:1357
U32BIT ATMR_FindTimerFromCrid(U8BIT *prog_crid)
Searches the timers for a recording timer with the given programme CRID.
Definition: ap_tmr.c:2915
void * ATMR_RecordEvent(void *serv_ptr, void *event_ptr, U8BIT *prog_crid, U8BIT *series_crid, BOOLEAN is_series, BOOLEAN check_alternatives)
Adds a timer to perform a recording based on the given event and service. Conflicts are checked and a...
Definition: ap_tmr.c:2369
U32BIT ATMR_AddTimerForEvent(void *event_ptr, void *serv_ptr, BOOLEAN record, BOOLEAN event_triggered)
Creates a timer based on the given event. If a recording timer is created, it will be set to record o...
Definition: ap_tmr.c:234
Header file - macros and function prototypes for public use.
U32BIT ATMR_GetFirstWakeupTime(U32DHMS *rec_date_time, U16BIT *onet_id, U16BIT *trans_id, U16BIT *service_id)
Searches the timers for the first timer that will cause the DVB to wakeup that hasn't been missed...
Definition: ap_tmr.c:2810
Definition: ap_tmr.h:83
void ATMR_SetAdditionalInfo(U32BIT handle, U8BIT *info, U32BIT size)
Sets the additioinal information string for the specified timer and commits the change to the databas...
Definition: ap_tmr.c:3043
void ATMR_SetDiskId(U32BIT handle, U16BIT disk_id)
Set the disk for the given timer if the timer is a recording timer.
Definition: ap_tmr.c:1550
S32BIT ATMR_GetStartPadding(U32BIT handle)
Returns the value of start_padding associated with the specified timer The start padding is the numbe...
Definition: ap_tmr.c:3115
Definition: ap_tmr.h:112
U16BIT ATMR_GetServiceId(U32BIT handle)
Returns the service ID for an alarm or PVR recording timer.
Definition: ap_tmr.c:1285
U8BIT * ATMR_GetName(U32BIT handle)
Get the name of the timer with the given handle.
Definition: ap_tmr.c:979
BOOLEAN ATMR_UpdateTimer(U32BIT handle, S_TIMER_INFO *info)
Updates all the timer fields.
Definition: ap_tmr.c:377
System Wide Global Technical Data Type Definitions.
BOOLEAN ATMR_GetMissed(U32BIT handle)
Gets the timer's missed flag.
Definition: ap_tmr.c:1392
void ATMR_RecordingFailed(U8BIT path)
Handles the timer when a recording fails to start for some reason. This may result in the timer being...
Definition: ap_tmr.c:636
BOOLEAN ATMR_InitialiseTimer(S_TIMER_INFO *timer_info, E_TIMER_TYPE timer_type, void *serv_ptr, void *event_ptr)
Sets up the given timer info structure with default values for the given timer type using the service...
Definition: ap_tmr.c:699
U32BIT ATMR_AddTimer(S_TIMER_INFO *info)
Creates a new timer based on the information supplied.
Definition: ap_tmr.c:175
U32DHMS ATMR_GetStartDateTime(U32BIT handle)
Get the start date & time of the timer with the given handle. The date/time returned will be in UTC...
Definition: ap_tmr.c:1042
BOOLEAN ATMR_UpdateTimerDuration(U32BIT handle, U32DHMS duration)
Updates the duration for an existing PVR recording timer.
Definition: ap_tmr.c:312
U32BIT ATMR_FindTimerFromEvent(U16BIT onet_id, U16BIT trans_id, U16BIT serv_id, U16BIT event_id)
Searches the timers for a recording timer with the given event and service IDs.
Definition: ap_tmr.c:2879
BOOLEAN ATMR_DeleteTimer(U32BIT handle)
Deletes the timer with the given handle.
Definition: ap_tmr.c:416
void * ATMR_GetRecordService(U8BIT path)
Returns the service for the recording timer on the given path.
Definition: ap_tmr.c:942
void ATMR_SetName(U32BIT handle, U8BIT *name)
Sets the name of the timer with the given handle.
Definition: ap_tmr.c:1006
U16BIT ATMR_GetEventId(U32BIT handle)
Returns the event ID for a PVR recording timer.
Definition: ap_tmr.c:1254
U8BIT ATMR_GetNumSimultaneousRecordings(U8BIT max_recordings, U32DHMS start_date_time, U32DHMS end_date_time, U32BIT **conflicting_timers)
Counts the number of simultaneous recordings (EXT and PVR) between the given start and end dates/time...
Definition: ap_tmr.c:2229
void ATMR_Initialise(void)
Performs initialisation of the timers, reading existing entries from the database.
Definition: ap_tmr.c:154
void ATMR_ReleaseTimerList(U32BIT *timer_list, U16BIT list_size)
Release the given array of timer handles.
Definition: ap_tmr.c:508
Definition: ap_tmr.h:74
BOOLEAN ATMR_SetStartPadding(U32BIT handle, S32BIT start_padding)
Sets the value of start_padding associated with the specified timer The start padding is the number o...
Definition: ap_tmr.c:3148