DVBCore  1.0
Open source DVB engine
database/inc/dba.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
00003  * Copyright © 2013 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 _DBA_H
00028 #define _DBA_H
00029 
00030 //---Constant and macro definitions for public use-----------------------------
00031 
00032 /* Field IDs MUST be unique but need not be contiguous within records range 0x0000 to 0xffff
00033  * some fields are used in more than one record spare IDs are left for future expansion. */
00034 
00035 /* Fields common to more than one record type */
00036 #define DBA_FIELD_PARENT                        0x0100
00037 #define DBA_FIELD_REC_NAME                      0x0101
00038 #define DBA_FIELD_ORIG_NET_ID                   0x0102
00039 #define DBA_FIELD_NET_ID                        0x0103
00040 #define DBA_FIELD_TRANSPORT_ID                  0x0104
00041 #define DBA_FIELD_SERVICE_ID                    0x0105
00042 #define DBA_FIELD_VERSION                       0x0106
00043 
00044 /* Fields in LNB records */
00045 #define DBA_FIELD_LNB_LOFREQ                    0x0200
00046 #define DBA_FIELD_LNB_HIFREQ                    0x0201
00047 #define DBA_FIELD_LNB_TYPE                      0x0202
00048 #define DBA_FIELD_LNB_22K                       0x0203
00049 #define DBA_FIELD_LNB_12V                       0x0204
00050 #define DBA_FIELD_LNB_PULSEPOSN                 0x0205
00051 #define DBA_FIELD_LNB_DISPOSN                   0x0206
00052 #define DBA_FIELD_LNB_DISTONE                   0x0207
00053 #define DBA_FIELD_LNB_DISCSWITCH                0x0208
00054 #define DBA_FIELD_LNB_DISUSWITCH                0x0209
00055 #define DBA_FIELD_LNB_DISSMATV                  0x020a
00056 #define DBA_FIELD_LNB_DISREPEAT                 0x020b
00057 #define DBA_FIELD_LNB_UNICABLEFREQ              0x020c
00058 #define DBA_FIELD_LNB_UNICABLECHAN              0x020d
00059 #define DBA_FIELD_LNB_POWER                     0x020e
00060 
00061 /* Fields in satellite records */
00062 #define DBA_FIELD_SAT_DISH                      0x0300
00063 #define DBA_FIELD_SAT_LONGWE                    0x0301
00064 #define DBA_FIELD_SAT_LONGPOS                   0x0302
00065 
00066 /* Fields in network records */
00067 #define DBA_FIELD_PROFILE_TYPE                  0x0401
00068 #define DBA_FIELD_PROFILE_CAM_ID                0x0402
00069 #define DBA_FIELD_PROFILE_NAME                  0x0403
00070 #define DBA_FIELD_OPERATOR_SEARCH               0x0404
00071 #define DBA_FIELD_OP_SEARCH_DATE                0x0405
00072 #define DBA_FIELD_OP_SEARCH_TIME                0x0406
00073 
00074 /* Fields common to transport records */
00075 #define DBA_FIELD_TRAN_FREQ                     0x0500
00076 #define DBA_FIELD_TRAN_SRATE                    0x0501
00077 #define DBA_FIELD_TRAN_SIGNAL_LEVEL             0x0502
00078 
00079 /* Fields in satellite transport records */
00080 #define DBA_FIELD_STRAN_POL                     0x0600
00081 #define DBA_FIELD_STRAN_FEC                     0x0601
00082 #define DBA_FIELD_STRAN_DVBS2                   0x0602
00083 #define DBA_FIELD_STRAN_MODULATION              0x0603
00084 
00085 /* Fields in terrestrial transport records */
00086 #define DBA_FIELD_TTRAN_MODE                    0x0700
00087 #define DBA_FIELD_TTRAN_TERR_TYPE               0x0701
00088 #define DBA_FIELD_TTRAN_PLP_ID                  0x0702
00089 #define DBA_FIELD_TTRAN_BWIDTH                  0x0703
00090 
00091 /* Fields in cable transport records */
00092 #define DBA_FIELD_CTRAN_MODE                    0x0800
00093 
00094 /* Fields common to service records */
00095 #define DBA_FIELD_SERV_ID                       0x0900
00096 #define DBA_FIELD_SERV_TYPE                     0x0901
00097 #define DBA_FIELD_SERV_LCN                      0x0902
00098 #define DBA_FIELD_SERV_REQ_LCN                  0x0903
00099 #define DBA_FIELD_SERV_HIDDEN                   0x0904
00100 #define DBA_FIELD_SERV_SELECTABLE               0x0905
00101 #define DBA_FIELD_SERV_LOCKED                   0x0906
00102 #define DBA_FIELD_SERV_SCHED_DISABLED           0x0907
00103 #define DBA_FIELD_SERV_NOWNEXT_DISABLED         0x0908
00104 #define DBA_FIELD_SERV_FAV_GROUPS               0x0909
00105 #define DBA_FIELD_SERV_FREESAT_ID               0x090a
00106 #define DBA_FIELD_SERV_REGION_ID                0x090b
00107 #define DBA_FIELD_SERV_LCN_EDITABLE             0x090c
00108 
00109 /* Fields in timer records */
00110 #define DBA_FIELD_TIMER_HANDLE                  0x0a00
00111 #define DBA_FIELD_TIMER_STARTTIME               0x0a01
00112 #define DBA_FIELD_TIMER_DURATION                0x0a02
00113 #define DBA_FIELD_TIMER_TYPE                    0x0a03
00114 #define DBA_FIELD_TIMER_FREQUENCY               0x0a04
00115 #define DBA_FIELD_TIMER_RAMPVOLUME              0x0a05
00116 #define DBA_FIELD_TIMER_EVENTID                 0x0a06
00117 #define DBA_FIELD_TIMER_NOTIFY_TIME             0x0a07
00118 #define DBA_FIELD_TIMER_CRID                    0x0a08
00119 #define DBA_FIELD_TIMER_DISKID                  0x0a09
00120 #define DBA_FIELD_TIMER_OTHERCRID               0x0a0a
00121 #define DBA_FIELD_TIMER_RUNNING                 0x0a0b
00122 #define DBA_FIELD_TIMER_STARTING                0x0a0c
00123 #define DBA_FIELD_TIMER_STARTED                 0x0a0d
00124 #define DBA_FIELD_TIMER_EXPIRED                 0x0a0e
00125 #define DBA_FIELD_TIMER_MISSED                  0x0a0f
00126 #define DBA_FIELD_TIMER_EVENT_TRIGGERED         0x0a10
00127 #define DBA_FIELD_TIMER_ADDITIONAL_INFO         0x0a11
00128 #define DBA_FIELD_TIMER_START_PADDING           0x0a12
00129 #define DBA_FIELD_TIMER_END_PADDING             0x0a13
00130 
00131 /* Fields in CRID records */
00132 #define DBA_FIELD_CRID_EIT_DATE                 0x0b00
00133 #define DBA_FIELD_CRID_SERIES                   0x0b01
00134 #define DBA_FIELD_CRID_RECOMMENDED              0x0b02
00135 #define DBA_FIELD_CRID_RADIO_SERVICE            0x0b03
00136 
00137 /* Fields in favourite lists and favourite services */
00138 #define DBA_FIELD_FAVLIST_ID                    0x0c00
00139 #define DBA_FIELD_FAVLIST_INDEX                 0x0c01
00140 #define DBA_FIELD_FAVLIST_USER_DATA             0x0c02
00141 
00142 /* Fields used to store event information */
00143 #define DBA_FIELD_EVENT_STARTTIME               0x0d00
00144 #define DBA_FIELD_EVENT_DURATION                0x0d01
00145 #define DBA_FIELD_EVENT_ID                      0x0d02
00146 #define DBA_FIELD_EVENT_CONTENT                 0x0d03
00147 #define DBA_FIELD_EVENT_AGE_RATING              0x0d04
00148 #define DBA_FIELD_EVENT_SCRAMBLED               0x0d05
00149 #define DBA_FIELD_EVENT_SUBTITLES               0x0d06
00150 #define DBA_FIELD_EVENT_AUDIO_DESC              0x0d07
00151 #define DBA_FIELD_EVENT_FREE_TO_AIR             0x0d08
00152 #define DBA_FIELD_EVENT_DO_NOT_SCRAMBLE         0x0d09
00153 #define DBA_FIELD_EVENT_NAME                    0x0d0a
00154 #define DBA_FIELD_EVENT_DESCRIPTION             0x0d0b
00155 #define DBA_FIELD_EVENT_EXTENDED_DESC           0x0d0c
00156 #define DBA_FIELD_EVENT_GUIDANCE                0x0d0d
00157 #define DBA_FIELD_EVENT_CONTENT_DATA            0x0d0e
00158 
00159 
00160 //---Enumerations for public use-----------------------------------------------
00161 
00162 /* Set of record types supported by the database, though not all types may be supported
00163  * by all database implementations */
00164 typedef enum
00165 {
00166    DBA_RECORD_LNB = 0,
00167    DBA_RECORD_SATELLITE,
00168    DBA_RECORD_NETWORK,
00169    DBA_RECORD_SAT_TRANSPORT,
00170    DBA_RECORD_TERR_TRANSPORT,
00171    DBA_RECORD_CAB_TRANSPORT,
00172    DBA_RECORD_SERVICE,
00173    DBA_RECORD_TIMER,
00174    DBA_RECORD_CRID,
00175    DBA_RECORD_FAV_LIST,
00176    DBA_RECORD_FAV_SERV,
00177    DBA_RECORD_EVENT,
00178    DBA_NUM_RECORDS               /* This must be the last value in the enum */
00179 } E_DBA_RECORDS;
00180 
00181 
00182 //---Global type defs for public use-------------------------------------------
00183 
00184 //---Global Function prototypes for public use---------------------------------
00185 
00190 BOOLEAN DBA_Initialise(void);
00191 
00196 void DBA_Terminate(void);
00197 
00207 BOOLEAN DBA_LoadDatabase(U8BIT *pathname);
00208 
00214 BOOLEAN DBA_SaveDatabase(void);
00215 
00222 BOOLEAN DBA_ClearDatabase(void);
00223 
00232 BOOLEAN DBA_BackupDatabase(U8BIT *pathname);
00233 
00238 BOOLEAN DBA_RestoreDatabase(void);
00239 
00244 void DBA_EraseBackupDatabase(void);
00245 
00251 BOOLEAN DBA_ExportToXML(U8BIT *xml_pathname);
00252 
00260 BOOLEAN DBA_ImportFromXML(U8BIT *xml_pathname);
00261 
00265 void DBA_LockDatabase(void);
00266 
00270 void DBA_UnlockDatabase(void);
00271 
00276 U8BIT* DBA_DatabaseVersion(void);
00277 
00284 U32BIT DBA_DatabaseFileSize(U32BIT *max_size);
00285 
00293 void* DBA_CreateRecord(U32BIT record_id, void *parent);
00294 
00300 void DBA_DestroyRecord(void *record);
00301 
00312 void* DBA_FindRecord(U32BIT record_id, void *parent, void *last_rec);
00313 
00319 void DBA_SetRecordParent(void *record, void *parent);
00320 
00326 void* DBA_GetRecordParent(void *record);
00327 
00334 void DBA_SaveRecord(void *record);
00335 
00344 BOOLEAN DBA_SetFieldValue(void *record, U32BIT field_id, U32BIT value);
00345 
00357 BOOLEAN DBA_SetFieldString(void *record, U32BIT field_id, U8BIT *string, U16BIT num_bytes);
00358 
00371 BOOLEAN DBA_SetFieldLangString(void *record, U32BIT field_id, U32BIT lang_code, U8BIT *string,
00372    U16BIT num_bytes);
00373 
00384 BOOLEAN DBA_SetFieldData(void *record, U32BIT field_id, U8BIT *data, U16BIT num_bytes);
00385 
00394 BOOLEAN DBA_GetFieldValue(void *record, U32BIT field_id, U32BIT *value);
00395 
00407 BOOLEAN DBA_GetFieldString(void *record, U32BIT field_id, U8BIT **string, U16BIT *num_bytes);
00408 
00421 BOOLEAN DBA_GetFieldLangString(void *record, U32BIT field_id, U32BIT lang_code, U8BIT **string,
00422    U16BIT *num_bytes);
00423 
00435 BOOLEAN DBA_GetFieldData(void *record, U32BIT field_id, U8BIT **data, U16BIT *num_bytes);
00436 
00442 U32BIT DBA_DataBlockSize(U32BIT data_block_id);
00443 
00451 U32BIT DBA_DataBlockRead(U32BIT data_block_id, U8BIT *data, U32BIT max_num_bytes);
00452 
00460 BOOLEAN DBA_DataBlockWrite(U32BIT data_block_id, U8BIT *data, U32BIT num_bytes);
00461 
00462 #endif /* _DBA_H */
00463 
 All Data Structures Files Functions Typedefs Defines