DVBCore  1.0
Open source DVB engine
dvb/inc/ap_tmr.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
00003  * Copyright © 2004 Ocean Blue Software Ltd
00004  *
00005  * This file is part of a DTVKit Software Component
00006  * You are permitted to copy, modify or distribute this file subject to the terms
00007  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
00008  * 
00009  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
00010  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
00011  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
00012  * 
00013  * If you or your organisation is not a member of DTVKit then you have access
00014  * to this source code outside of the terms of the licence agreement
00015  * and you are expected to delete this and any associated files immediately.
00016  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
00017  *******************************************************************************/
00025 // pre-processor mechanism so multiple inclusions don't cause compilation error
00026 
00027 #ifndef _AP_TMR_H
00028 #define _AP_TMR_H
00029 
00030 #include "stbgc.h"
00031 
00032 //---Constant and macro definitions for public use-----------------------------
00033 #define INVALID_TIMER_HANDLE        0
00034 
00035 #define TMR_MAX_NAME_LENGTH         128
00036 
00037 #define TMR_PVR_CRID_LEN_MAX        65
00038 
00039 #define TMR_PVR_ADDINFO_LEN_MAX     255
00040 #if 0
00041 #define TMR_HOURS_THRESHOLD_EXC     24
00042 #define TMR_MINS_THRESHOLD_EXC      60
00043 #endif
00044 
00045 /* The number of hours added to a timer to allow an event triggered recording to overrun
00046  * before the recording is stopped */
00047 #define EVENT_DURATION_OVERRUN_TIME    2
00048 
00049 //---Enumerations for public use-----------------------------------------------
00050 
00051 /* Valid timer types are in the range 0-15 */
00052 typedef enum
00053 {
00054    TIMER_TYPE_NONE = 0x00,
00055    TIMER_TYPE_ALARM = 0x01,
00056    TIMER_TYPE_SLEEP = 0x02,
00057    TIMER_TYPE_PVR_RECORD = 0x04,
00058    TIMER_TYPE_PRIVATE = 0x80,
00059    TIMER_TYPE_ALL = 0xff
00060 } E_TIMER_TYPE;
00061 
00062 typedef enum
00063 {
00064    TIMER_FREQ_ONCE,
00065    TIMER_FREQ_WEEKLY,
00066    TIMER_FREQ_WEEKENDDAYS,
00067    TIMER_FREQ_WEEKDAYS,
00068    TIMER_FREQ_DAILY,
00069    TIMER_FREQ_HOURLY
00070 } E_TIMER_FREQ;
00071 
00072 //---Global type defs for public use-------------------------------------------
00073 // service data structures:
00074 typedef struct
00075 {
00076    BOOLEAN change_service;
00077    U16BIT service_id;
00078    U16BIT transport_id;
00079    U16BIT orig_net_id;
00080    BOOLEAN ramp_volume;
00081 } S_ALARM_INFO;
00082 
00083 typedef struct
00084 {
00085    U32DHMS duration;
00086    BOOLEAN event_triggered;
00087    U16BIT event_id;
00088    U16BIT service_id;
00089    U16BIT transport_id;
00090    U16BIT orig_net_id;
00091    U8BIT prog_crid[TMR_PVR_CRID_LEN_MAX];
00092    U8BIT other_crid[TMR_PVR_CRID_LEN_MAX];
00093    U16BIT disk_id;
00094    BOOLEAN recommendation;
00095    U16BIT notify_time;        /* Time in seconds to receive notification that a recording will soon start */
00096 } S_PVR_RECORD_INFO;
00097 
00098 typedef struct s_timer
00099 {
00100    E_TIMER_TYPE type;
00101    U8BIT name[TMR_MAX_NAME_LENGTH];
00102    E_TIMER_FREQ frequency;
00103    U32DHMS start_time;
00104    union
00105    {
00106       S_ALARM_INFO alarm;
00107       S_PVR_RECORD_INFO record;
00108    } u;
00109 } S_TIMER_INFO;
00110 
00111 typedef struct s_avrec_settings
00112 {
00113    U16BIT av_rec_lcn;
00114    BOOLEAN standby_mode;
00115 } S_AVREC_SETTINGS;
00116 
00117 //---Global Function prototypes for public use---------------------------------
00118 
00122 void ATMR_Initialise(void);
00123 
00129 U32BIT ATMR_AddTimer(S_TIMER_INFO *info);
00130 
00142 U32BIT ATMR_AddTimerForEvent(void *event_ptr, void *serv_ptr, BOOLEAN record, BOOLEAN event_triggered);
00143 
00150 BOOLEAN ATMR_UpdateTimerDuration(U32BIT handle, U32DHMS duration);
00151 
00157 BOOLEAN ATMR_DeleteTimer(U32BIT handle);
00158 
00168 BOOLEAN ATMR_GetTimerList(U32BIT **timer_list, U16BIT *list_size, E_TIMER_TYPE list_type,
00169    BOOLEAN date_time_order);
00170 
00176 void ATMR_ReleaseTimerList(U32BIT *timer_list, U16BIT list_size);
00177 
00187 BOOLEAN ATMR_InitialiseTimer(S_TIMER_INFO *timer_info, E_TIMER_TYPE timer_type, void *serv_ptr,
00188    void *event_ptr);
00189 
00196 BOOLEAN ATMR_GetTimerInfo(U32BIT handle, S_TIMER_INFO *timer_info);
00197 
00204 BOOLEAN ATMR_StartRecord(U8BIT path);
00205 
00211 void ATMR_RecordingFailed(U8BIT path);
00212 
00218 void* ATMR_GetRecordService(U8BIT path);
00219 
00225 U8BIT* ATMR_GetName(U32BIT handle);
00226 
00231 void ATMR_SetName(U32BIT handle, U8BIT *name);
00232 
00239 U32DHMS ATMR_GetStartDateTime(U32BIT handle);
00240 
00246 U32DHMS ATMR_GetDuration(U32BIT handle);
00247 
00254 U32DHMS ATMR_GetEndDateTime(U32BIT handle);
00255 
00261 E_TIMER_TYPE ATMR_GetType(U32BIT handle);
00262 
00268 E_TIMER_FREQ ATMR_GetFrequency(U32BIT handle);
00269 
00275 BOOLEAN ATMR_GetChangeService(U32BIT handle);
00276 
00282 BOOLEAN ATMR_GetRampVolume(U32BIT handle);
00283 
00289 U16BIT ATMR_GetEventId(U32BIT handle);
00290 
00297 U16BIT ATMR_GetServiceId(U32BIT handle);
00298 
00305 U16BIT ATMR_GetTransportId(U32BIT handle);
00306 
00313 U16BIT ATMR_GetOriginalNetworkId(U32BIT handle);
00314 
00320 BOOLEAN ATMR_GetMissed(U32BIT handle);
00321 
00328 BOOLEAN ATMR_HasSeriesCrid(U32BIT handle);
00329 
00336 BOOLEAN ATMR_HasRecommendationCrid(U32BIT handle);
00337 
00343 U16BIT ATMR_GetDiskId(U32BIT handle);
00344 
00350 void ATMR_SetDiskId(U32BIT handle, U16BIT disk_id);
00351 
00358 U32BIT ATMR_GetRecordingHandle(U32BIT handle);
00359 
00368 void ATMR_HandleTimerEvent(U32BIT timer_handle);
00369 
00376 BOOLEAN ATMR_CheckRecordStatus(BOOLEAN recordings_can_start);
00377 
00383 void ATMR_EitUpdated(void);
00384 
00389 void ATMR_DeleteRecordingTimer(U32BIT recording_handle);
00390 
00401 U8BIT ATMR_GetNumSimultaneousRecordings(U8BIT max_recordings, U32DHMS start_date_time,
00402    U32DHMS end_date_time, U32BIT **conflicting_timers);
00403 
00417 void* ATMR_RecordEvent(void *serv_ptr, void *event_ptr, U8BIT *prog_crid, U8BIT *series_crid,
00418    BOOLEAN is_series, BOOLEAN check_alternatives);
00419 
00432 BOOLEAN ATMR_RecordSplitEvent(void *serv_ptr, U8BIT *prog_crid, U32DHMS start_date_time,
00433    BOOLEAN radio_service, BOOLEAN search_forward);
00434 
00444 U32BIT ATMR_GetFirstWakeupTime(U32DHMS *rec_date_time, U16BIT *onet_id, U16BIT *trans_id,
00445    U16BIT *service_id);
00446 
00455 U32BIT ATMR_FindTimerFromEvent(U16BIT onet_id, U16BIT trans_id, U16BIT serv_id, U16BIT event_id);
00456 
00462 U32BIT ATMR_FindTimerFromCrid(U8BIT *prog_crid);
00463 
00472 U32BIT ATMR_FindTimerFromCridAndEvent(U8BIT *prog_crid, U16BIT service_id, U16BIT event_id);
00473 
00479 void ATMR_DeleteTimersForSeriesRecommendations(U8BIT *crid, BOOLEAN is_recommendation);
00480 
00488 void ATMR_SetAdditionalInfo(U32BIT handle, U8BIT *info, U32BIT size);
00489 
00497 U8BIT* ATMR_GetAdditionalInfo(U32BIT handle, U32BIT *size);
00498 
00506 S32BIT ATMR_GetStartPadding(U32BIT handle);
00507 
00516 BOOLEAN ATMR_SetStartPadding(U32BIT handle, S32BIT start_padding);
00517 
00525 S32BIT ATMR_GetEndPadding(U32BIT handle);
00526 
00535 BOOLEAN ATMR_SetEndPadding(U32BIT handle, S32BIT end_padding);
00536 
00537 void ATMR_DumpAllTimers(void);
00538 
00539 #endif // _AP_TMR_H
 All Data Structures Files Functions Typedefs Defines