DVBCore  20.3.0
DVBCore Documentation
ap_dbacc.c
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  *******************************************************************************/
24 //---includes for this file-------------------------------------------------------------------------
25 // compiler library header files
26 #include <string.h>
27 #include <stdio.h>
28 
29 // third party header files
30 
31 // Ocean Blue Software header files
32 #include "techtype.h"
33 #include "dbgfuncs.h"
34 
35 #include "stbhwos.h"
36 #include "stbheap.h"
37 #include "stbdpc.h"
38 #include "stbsiflt.h"
39 #include "stbsitab.h"
40 #include "stbuni.h"
41 #include "stbgc.h"
42 #include "stberc.h"
43 
44 #include "stbllist.h"
45 
46 #include "app.h"
47 #include "app_nvm.h"
48 #include "ap_cfg.h"
49 #include "ap_cfdat.h"
50 
51 #include "ap_dbacc.h"
52 #include "ap_tmr.h"
53 #include "ap_dbdef.h"
54 #include "ap_cntrl.h"
55 
56 #include "dba.h"
57 
58 //---constant definitions for this file-------------------------------------------------------------
59 #define CI_PROTECTION_DESC_TIME_LIMIT (7 * 24 * 60 * 60) /* 7 days in seconds */
60 
61 #define ADB_FAV_SERVICE_LIST_TYPE (ADB_SERVICE_LIST_FAV_GROUP_A | ADB_SERVICE_LIST_FAV_GROUP_B | \
62  ADB_SERVICE_LIST_FAV_GROUP_C | ADB_SERVICE_LIST_FAV_GROUP_D)
63 
64 #define FULL_SI_LINKAGE_TYPE 0x04
65 #define EPG_SERVICE_LINKAGE_TYPE 0x02
66 #define NORDIG_SIMULCAST_TYPE 0x82
67 
68 //#define DEBUG_DBACC
69 
70 #ifdef DEBUG_DBACC
71 #define DBG_DBACC(X) STB_SPDebugWrite X
72 #else
73 #define DBG_DBACC(X)
74 #endif
75 
76 //---local typedefs, structs, enumerations for this file--------------------------------------------
77 typedef struct s_component
78 {
79  U8BIT tag;
80  U8BIT type; /* component type as defined in the EITp's component descriptor */
81  U8BIT content; /* stream content as defined in the EITp's component descriptor */
82 } S_COMPONENT;
83 
84 typedef struct s_stream
85 {
86  U32BIT lang_code;
87  ADB_AUDIO_TYPE audio_type;
88  ADB_SUBTITLE_TYPE subt_type;
89  ADB_STREAM_TYPE stream_type;
90  E_STB_DP_AUDIO_MODE audio_mode;
91  U8BIT ttext_type;
92  U8BIT ttext_magazine;
93  U8BIT ttext_page;
94  U16BIT composition_page;
95  U16BIT ancillary_page;
96  S_COMPONENT *tag_array_ptr;
97  U8BIT num_tag_entries;
98  U16BIT pid;
99  BOOLEAN in_use;
100  BOOLEAN has_ca_descriptor;
101  U8BIT component_type; /* component_type as defined in the EITp's component descriptor */
102 } S_STREAM;
103 
104 //---local (static) variable declarations for this file---------------------------------------------
105 // (internal variables declared static to make them local)
106 
107 
108 //---local function prototypes for this file--------------------------------------------------------
109 // (internal functions declared static to make them local)
110 
111 static BOOLEAN EventAtTime(ADB_EVENT_REC *event_ptr, U32DHMS time);
112 static U8BIT* CopyString(ADB_STRING *str_desc, BOOLEAN to_unicode);
113 static U8BIT* CopySIString(SI_STRING_DESC *str_desc);
114 static U8BIT* ExtractShortName(ADB_STRING *str_desc);
115 
116 //transports
117 static U8BIT* GetTransportName(ADB_TRANSPORT_REC *t_ptr);
118 static U16BIT GetTransportTid(ADB_TRANSPORT_REC *t_ptr);
119 static U8BIT GetTransportTunedStrength(ADB_TRANSPORT_REC *t_ptr);
120 static U8BIT GetTransportTunedQuality(ADB_TRANSPORT_REC *t_ptr);
121 static U16BIT GetTransportOriginalNetworkId(ADB_TRANSPORT_REC *t_ptr);
122 static U32BIT GetTransportFreq(ADB_TRANSPORT_REC *t_ptr);
123 
124 static U8BIT GetTransportBwidth(ADB_TRANSPORT_REC *t_ptr);
125 static S8BIT GetTransportOffset(ADB_TRANSPORT_REC *t_ptr);
126 static U8BIT* GetTransportConstellationString(ADB_TRANSPORT_REC *t_ptr);
127 static U8BIT* GetTransportHierarchyString(ADB_TRANSPORT_REC *t_ptr);
128 
129 //services
130 static BOOLEAN CheckServiceInListType(ADB_SERVICE_REC *s_ptr, U32BIT list_type, BOOLEAN inc_hidden,
131  BOOLEAN ignore_selectable);
132 
133 static void GetServiceList(U32BIT list_type, void ***slist_ptr, U16BIT *num_entries_ptr,
134  BOOLEAN show_hidden, BOOLEAN ignore_selectable);
135 
136 static U8BIT* GetServiceNameByLangAndPrefId(ADB_SERVICE_REC *s_ptr, U8BIT lang, U8BIT pref_name_id, BOOLEAN short_name);
137 
138 static U16BIT GetServiceLcn(ADB_SERVICE_REC *s_ptr);
139 static U16BIT GetServiceId(ADB_SERVICE_REC *s_ptr);
140 
141 static BOOLEAN GetServiceUnavailFlag(void *s_ptr);
142 static BOOLEAN GetServiceNewFlag(void *s_ptr);
143 
144 // network
145 static U8BIT* GetNetworkName(ADB_NETWORK_REC *n_ptr, BOOLEAN short_name);
146 static U8BIT* GetNetworkNameByLang(ADB_NETWORK_REC *n_ptr, U8BIT lang, BOOLEAN short_name);
147 static U8BIT* GetDefaultNetworkName(ADB_NETWORK_REC *n_ptr, BOOLEAN short_name);
148 static U16BIT GetNetworkId(ADB_NETWORK_REC *n_ptr);
149 
150 //events
151 static S_EVENT* CopyEventRec(ADB_EVENT_REC *e_ptr, ADB_SERVICE_REC *s_ptr);
152 static BOOLEAN FindDoNotScramble(ADB_EVENT_REC *e_ptr, ADB_SERVICE_REC *s_ptr);
153 
154 static U8BIT* GetEventCridType(void *serv_ptr, void *event_ptr, U8BIT crid_type, U8BIT index);
155 static U8BIT NumberOfCridsOfType(S_EVENT *event_ptr, U8BIT crid_type);
156 
157 static BOOLEAN IsStreamOfType(ADB_STREAM_REC *stream_ptr, ADB_STREAM_LIST_TYPE stream_list_type);
158 static BOOLEAN HasNordigSimulcastService(void *serv_ptr);
159 
160 //--------------------------------------------------------------------------------------------------
161 // global function definitions
162 //--------------------------------------------------------------------------------------------------
163 
167 void ADB_Initialise(void)
168 {
169  FUNCTION_START(ADB_Initialise);
170 
172 
174  DBDEF_LoadDatabase(NULL);
177 
178  FUNCTION_FINISH(ADB_Initialise);
179 }
180 
188 void ADB_PrepareDatabaseForSearch(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite,
189  BOOLEAN retune, BOOLEAN manual_search)
190 {
191  ADB_TRANSPORT_REC *t_ptr;
192  ADB_SERVICE_REC *s_ptr;
193  ADB_SATELLITE_REC *sat_ptr;
194  ADB_BAT_VERSION_REC *ver_rec;
195 
196  FUNCTION_START(ADB_PrepareDatabaseForSearch);
197 
199 
200  /* Backup the database in preparation for the search so it can be
201  * restored if the search is cancelled */
203  DBA_BackupDatabase(NULL);
205 
206  if (retune)
207  {
208  DBDEF_DeleteRecordsForTunerType(tuner_type, satellite);
209  }
210  else
211  {
212  /* Prepare services for the search */
213  s_ptr = DBDEF_GetNextServiceRec(NULL);
214  while (s_ptr != NULL)
215  {
216  if (DBDEF_ServiceForTunerType(s_ptr, tuner_type, satellite))
217  {
218  /* Clear new flag */
219  s_ptr->new_service = FALSE;
220 
221  if (!manual_search)
222  {
223  /* Set the service as unavailable, which will be updated
224  * again during the search if the service is found */
225  s_ptr->unavailable = TRUE;
226  }
227  }
228 
229  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
230  }
231 
232  /* Prepare transports for the search */
233  t_ptr = DBDEF_GetNextTransportRec(NULL);
234  while (t_ptr != NULL)
235  {
236  if (DBDEF_TransportForTunerType(t_ptr, tuner_type, satellite))
237  {
238  /* Clear version history on this transport */
240 
241  /* Set the flag to show the transport hasn't been searched yet */
242  t_ptr->searched = FALSE;
243 
244  if (!manual_search)
245  {
246  /* Set the flag to show the transport hasn't been found yet */
247  t_ptr->available = FALSE;
248  }
249  }
250 
251  t_ptr = DBDEF_GetNextTransportRec(t_ptr);
252  }
253  }
254 
255  if (satellite != NULL)
256  {
257  /* Clear the BAT versions to prevent them being ignored when the scan is performed */
258  sat_ptr = (ADB_SATELLITE_REC *)satellite;
259  ver_rec = sat_ptr->bat_version_list;
260  while (ver_rec != NULL)
261  {
262  sat_ptr->bat_version_list = ver_rec->next;
263  STB_AppFreeMemory(ver_rec);
264  ver_rec = sat_ptr->bat_version_list;
265  }
266  }
267 
269 
270  FUNCTION_FINISH(ADB_PrepareDatabaseForSearch);
271 }
272 
283 void ADB_FinaliseDatabaseAfterSearch(BOOLEAN save_changes, E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite,
284  BOOLEAN search_completed, BOOLEAN clear_new_flags, BOOLEAN manual_search)
285 {
286  ADB_TRANSPORT_REC *t_ptr;
287  ADB_SERVICE_REC *s_ptr;
288 
289  FUNCTION_START(ADB_FinaliseDatabaseAfterSearch);
290 
291  if (save_changes)
292  {
294 
295  if (clear_new_flags)
296  {
297  s_ptr = DBDEF_GetNextServiceRec(NULL);
298  while (s_ptr != NULL)
299  {
300  s_ptr->new_service = FALSE;
301 
302  if (s_ptr->unavailable)
303  {
304  /* If the service is unavailable but it's parent transport wasn't searched during
305  * the scan, then just set it back to being available because we don't know
306  * whether it's available or not */
307  if ((t_ptr = s_ptr->transport) != NULL)
308  {
309  if (!t_ptr->searched)
310  {
311  s_ptr->unavailable = FALSE;
312  }
313  }
314  else
315  {
316  /* No transport! */
317  s_ptr->unavailable = FALSE;
318  }
319  }
320 
321  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
322  }
323  }
324 
325  DBDEF_AllocateLcns(tuner_type, TRUE);
327  DBDEF_TidyDatabaseAfterSearch(tuner_type, satellite, search_completed, manual_search);
328 
330 
332  }
333  else
334  {
335  /* Restore previous database state */
338 
340  {
342 
345  DBDEF_LoadDatabase(NULL);
347  }
348 
351  }
352 
356 
358 
359  FUNCTION_FINISH(ADB_FinaliseDatabaseAfterSearch);
360 }
361 
368 BOOLEAN ADB_AreLcnsDuplicated(E_STB_DP_SIGNAL_TYPE tuner_type)
369 {
370  BOOLEAN result;
371 
372  FUNCTION_START(ADB_AreLcnsDuplicated);
373 
375 
376  /* Allocate LCNs to each service to determine if there are any duplicates,
377  * but don't store the result */
378  result = DBDEF_AllocateLcns(tuner_type, FALSE);
379 
381 
382  FUNCTION_FINISH(ADB_AreLcnsDuplicated);
383 
384  return(result);
385 }
386 
391 void ADB_AllocateLcns(E_STB_DP_SIGNAL_TYPE tuner_type)
392 {
393  FUNCTION_START(ADB_AllocateLcns);
394 
396 
397  DBDEF_AllocateLcns(tuner_type, TRUE);
399 
401 
402  FUNCTION_FINISH(ADB_AllocateLcns);
403 }
404 
410 {
411  ADB_NETWORK_REC *nptr;
412  ADB_TRANSPORT_REC *tptr;
413  ADB_SERVICE_REC *sptr;
414 
415  FUNCTION_START(ADB_ReleaseDatabaseSearchData);
416 
418 
419  nptr = DBDEF_GetNextNetworkRec(NULL);
420  while (nptr != NULL)
421  {
422  if (nptr->target_region_name_list != NULL)
423  {
424  STB_SIReleaseTargetRegionNameList(nptr->target_region_name_list);
425  nptr->target_region_name_list = NULL;
426  }
427 
428  if (nptr->target_region_list != NULL)
429  {
430  STB_SIReleaseTargetRegionList(nptr->target_region_list);
431  nptr->target_region_list = NULL;
432  }
433 
434  nptr = DBDEF_GetNextNetworkRec(nptr);
435  }
436 
437  tptr = DBDEF_GetNextTransportRec(NULL);
438  while (tptr != NULL)
439  {
440  if ((tptr->sig_type == SIGNAL_COFDM) && (tptr->u.terr.target_region_list != NULL))
441  {
442  STB_SIReleaseTargetRegionList(tptr->u.terr.target_region_list);
443  tptr->u.terr.target_region_list = NULL;
444  }
445 
446  tptr = DBDEF_GetNextTransportRec(tptr);
447  }
448 
449  sptr = DBDEF_GetNextServiceRec(NULL);
450  while (sptr != NULL)
451  {
452  if (sptr->target_region_list != NULL)
453  {
454  STB_SIReleaseTargetRegionList(sptr->target_region_list);
455  sptr->target_region_list = NULL;
456  }
457 
458  if (sptr->hd_lcn_desc != NULL)
459  {
460  STB_FreeMemory(sptr->hd_lcn_desc);
461  sptr->hd_lcn_desc = NULL;
462  }
463 
464  sptr = DBDEF_GetNextServiceRec(sptr);
465  }
466 
468 
469  FUNCTION_FINISH(ADB_ReleaseDatabaseSearchData);
470 }
471 
476 {
477  U8BIT path;
478 
479  FUNCTION_START(ADB_ResetDatabase);
480 
481  // Reset of database means that must stop tuning/decoding,
482  // otherwise ap_si.c will try to access deleted records
483  path = STB_DPGetLivePath();
484  if (path != INVALID_RES_ID)
485  {
486  ACTL_TuneOff(path);
487  }
488 
495 
496  FUNCTION_FINISH(ADB_ResetDatabase);
497 }
498 
503 {
504  FUNCTION_START(ADB_SaveDatabase);
505 
511 
512  FUNCTION_FINISH(ADB_SaveDatabase);
513 }
514 
524 void ADB_SaveEventSchedule(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
525 {
526  ADB_SERVICE_REC *s_ptr;
527 
528  FUNCTION_START(ADB_SaveEventSchedule);
529 
531 
532  s_ptr = DBDEF_GetNextServiceRec(NULL);
533  while (s_ptr != NULL)
534  {
535  if ((tuner_type == SIGNAL_NONE) || DBDEF_ServiceForTunerType(s_ptr, tuner_type, satellite))
536  {
538  }
539  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
540  }
541 
543 
544  FUNCTION_FINISH(ADB_SaveEventSchedule);
545 }
546 
553 void ADB_DeleteServices(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
554 {
555  FUNCTION_START(ADB_DeleteServices);
556 
558  DBDEF_DeleteRecordsForTunerType(tuner_type, satellite);
560 
561  FUNCTION_FINISH(ADB_DeleteServices);
562 }
563 
564 #ifdef DEBUG_PRINT_DATABASE
565 
568 void ADB_PrintDatabase(void)
569 {
570  FUNCTION_START(ADB_PrintDatabase);
571 
573  DBDEF_PrintAllRecords();
575 
576  FUNCTION_FINISH(ADB_PrintDatabase);
577 }
578 
579 #endif
580 
586 void ADB_ReleaseNameList(U8BIT **name_list, U16BIT num_names)
587 {
588  U16BIT i;
589 
590  FUNCTION_START(ADB_ReleaseNameList);
591 
592  if (name_list != NULL)
593  {
594  for (i = 0; i < num_names; i++)
595  {
596  STB_ReleaseUnicodeString(name_list[i]);
597  }
598 
599  STB_AppFreeMemory(name_list);
600  }
601 
602  FUNCTION_FINISH(ADB_ReleaseNameList);
603 }
604 
609 U16BIT ADB_GetNumLNBs(void)
610 {
611  U16BIT num;
612 
613  FUNCTION_START(ADB_GetNumLNBs);
614 
616  num = DBDEF_GetNumLNBs();
618 
619  FUNCTION_FINISH(ADB_GetNumLNBs);
620 
621  return(num);
622 }
623 
629 void* ADB_AddLNB(ADB_LNB_SETTINGS *settings)
630 {
631  ADB_LNB_REC *lnb;
632  ADB_STRING *name;
633  U8BIT *name_str;
634 
635  FUNCTION_START(ADB_AddLNB);
636 
638 
639  name_str = settings->name;
640  name = DBDEF_MakeString(0, name_str, STB_GetNumBytesInString(name_str));
641  if ((lnb = DBDEF_AddLNB(settings->type, name)) != NULL)
642  {
643  DBDEF_SetLNBPower(lnb, settings->power);
644  DBDEF_SetLNBDiSEqCTone(lnb, settings->diseqc_tone);
645  DBDEF_SetLNBCSwitch(lnb, settings->c_switch);
646  DBDEF_SetLNB22k(lnb, settings->is_22k);
647  DBDEF_SetLNB12V(lnb, settings->is_12v);
648  DBDEF_SetLNBPulsePosition(lnb, settings->is_pulse_posn);
649  DBDEF_SetLNBDiSEqCPosition(lnb, settings->is_diseqc_posn);
650  DBDEF_SetLNBSmatv(lnb, settings->is_smatv);
651  DBDEF_SetLNBRepeats(lnb, settings->diseqc_repeats);
652  DBDEF_SetLNBUSwitch(lnb, settings->u_switch);
653  DBDEF_SetLNBUnicable(lnb, settings->unicable_if, settings->unicable_chan);
654  }
655  else if (name != NULL)
656  {
657  DBDEF_ReleaseString(name);
658  }
659 
661 
662  FUNCTION_FINISH(ADB_AddLNB);
663 
664  return(lnb);
665 }
666 
672 void* ADB_GetNextLNB(void *lnb_ptr)
673 {
674  void *next_lnb;
675 
676  FUNCTION_START(ADB_GetNextLNB);
677 
679  next_lnb = DBDEF_GetNextLNBRec(lnb_ptr);
681 
682  FUNCTION_FINISH(ADB_GetNextLNB);
683 
684  return(next_lnb);
685 }
686 
693 BOOLEAN ADB_GetLNBSettings(void *lnb_ptr, ADB_LNB_SETTINGS *settings)
694 {
695  BOOLEAN retval;
696  ADB_LNB_REC *lnb;
697 
698  FUNCTION_START(ADB_GetLNBSettings);
699 
700  if (lnb_ptr != NULL)
701  {
703 
704  lnb = (ADB_LNB_REC *)lnb_ptr;
705 
706  settings->type = lnb->type;
707  settings->power = lnb->power;
708  settings->is_12v = lnb->is_12v;
709  settings->is_22k = lnb->is_22k;
710  settings->is_pulse_posn = lnb->is_pulse_posn;
711  settings->is_diseqc_posn = lnb->is_diseqc_posn;
712  settings->diseqc_tone = lnb->diseqc_tone;
713  settings->c_switch = lnb->c_switch;
714  settings->u_switch = lnb->u_switch;
715  settings->is_smatv = lnb->is_smatv;
716  settings->diseqc_repeats = lnb->diseqc_repeats;
717  settings->unicable_if = lnb->unicable_if;
718  settings->unicable_chan = lnb->unicable_chan;
719  settings->name = lnb->name->str_ptr;
720 
722 
723  retval = TRUE;
724  }
725  else
726  {
727  retval = FALSE;
728  }
729 
730  FUNCTION_FINISH(ADB_GetLNBSettings);
731 
732  return(retval);
733 }
734 
739 U16BIT ADB_GetNumLNBBands(void)
740 {
741  U16BIT num;
742 
743  FUNCTION_START(ADB_GetNumLNBBands);
744 
746  num = DBDEF_GetNumLNBBands();
748 
749  FUNCTION_FINISH(ADB_GetNumLNBBands);
750 
751  return num;
752 }
753 
760 void* ADB_AddLNBBand(S_STB_DP_LNB_BAND *band_parameters, void *lnb_ptr)
761 {
762  ADB_LNB_BAND_REC *band_rec;
763 
764  FUNCTION_START(ADB_AddLNBBand);
765 
767 
768  band_rec = DBDEF_AddLNBBandRec(band_parameters, lnb_ptr);
769 
771 
772  FUNCTION_FINISH(ADB_AddLNBBand);
773 
774  return band_rec;
775 }
776 
782 void* ADB_GetNextLNBBand(void *band_ptr)
783 {
784  void *next_band;
785 
786  FUNCTION_START(ADB_GetNextLNBBand);
787 
789  next_band = DBDEF_GetNextLNBBandRec(band_ptr);
791 
792  FUNCTION_FINISH(ADB_GetNextLNBBand);
793 
794  return(next_band);
795 }
796 
802 void* ADB_GetLNBBandLNB(void *band_ptr)
803 {
804  void *lnb_ptr;
805 
806  FUNCTION_START(ADB_GetLNBBandLNB);
807 
809 
810  if (band_ptr != NULL)
811  {
812  lnb_ptr = ((ADB_LNB_BAND_REC *)band_ptr)->lnb;
813  }
814  else
815  {
816  lnb_ptr = NULL;
817  }
818 
820 
821  FUNCTION_FINISH(ADB_GetLNBBandLNB);
822 
823  return(lnb_ptr);
824 }
825 
832 BOOLEAN ADB_GetLNBBandParameters(void *band_ptr, S_STB_DP_LNB_BAND *params)
833 {
834  BOOLEAN success;
835 
836  FUNCTION_START(ADB_GetLNBBandParameters);
837 
838  if (band_ptr != NULL)
839  {
840  success = TRUE;
841 
843 
844  memcpy(params, &(((ADB_LNB_BAND_REC *)band_ptr)->band_params), sizeof(S_STB_DP_LNB_BAND));
845 
847  }
848  else
849  {
850  success = FALSE;
851  }
852 
853  FUNCTION_FINISH(ADB_GetLNBBandParameters);
854 
855  return success;
856 }
857 
862 void ADB_DeleteAssociatedLNBBands(void *lnb_ptr)
863 {
864  ADB_LNB_BAND_REC *band_ptr = NULL;
865  ADB_LNB_BAND_REC *next_band_ptr;
866 
867  FUNCTION_START(ADB_DeleteAssociatedLNBBands);
868 
870 
871  band_ptr = DBDEF_GetNextLNBBandRec(band_ptr);
872  while (band_ptr != NULL)
873  {
874  next_band_ptr = DBDEF_GetNextLNBBandRec(band_ptr);
875 
876  if (band_ptr->lnb == lnb_ptr)
877  {
878  DBDEF_DeleteLNBBandRec(band_ptr);
879  }
880 
881  band_ptr = next_band_ptr;
882  }
883 
885 
886  FUNCTION_FINISH(ADB_DeleteAssociatedLNBBands);
887 }
888 
894 {
895  U16BIT num;
896 
897  FUNCTION_START(ADB_GetNumSatellites);
898 
900  num = DBDEF_GetNumSatellites();
902 
903  FUNCTION_FINISH(ADB_GetNumSatellites);
904 
905  return(num);
906 }
907 
918 void* ADB_AddSatellite(U8BIT *name_str, U16BIT dish_pos, U16BIT long_pos, BOOLEAN east_west,
919  void *lnb_ptr)
920 {
921  ADB_SATELLITE_REC *sat_ptr;
922  ADB_STRING *name;
923 
924  FUNCTION_START(ADB_AddSatellite);
925 
927 
928  name = DBDEF_MakeString(0, name_str, STB_GetNumBytesInString(name_str));
929  sat_ptr = DBDEF_AddSatelliteRec(name, dish_pos, long_pos, east_west, lnb_ptr);
930 
932 
933  FUNCTION_FINISH(ADB_AddSatellite);
934  return(sat_ptr);
935 }
936 
942 void* ADB_GetNextSatellite(void *sat_ptr)
943 {
944  void *next_sat;
945 
946  FUNCTION_START(ADB_GetNextSatellite);
947 
949  next_sat = DBDEF_GetNextSatelliteRec(sat_ptr);
951 
952  FUNCTION_FINISH(ADB_GetNextSatellite);
953 
954  return(next_sat);
955 }
956 
962 U8BIT* ADB_GetSatelliteName(void *sat_ptr)
963 {
964  ADB_SATELLITE_REC *sat = (ADB_SATELLITE_REC *)sat_ptr;
965  U8BIT *name;
966 
967  FUNCTION_START(ADB_GetSatelliteName);
968 
970 
971  if ((sat_ptr != NULL) && (sat->name != NULL))
972  {
973  name = sat->name->str_ptr;
974  }
975  else
976  {
977  name = NULL;
978  }
979 
981 
982  FUNCTION_FINISH(ADB_GetSatelliteName);
983 
984  return(name);
985 }
986 
992 void* ADB_GetSatelliteLNB(void *sat_ptr)
993 {
994  void *lnb_ptr;
995 
996  FUNCTION_START(ADB_GetSatelliteLNB);
997 
999 
1000  if (sat_ptr != NULL)
1001  {
1002  lnb_ptr = ((ADB_SATELLITE_REC *)sat_ptr)->lnb;
1003  }
1004  else
1005  {
1006  lnb_ptr = NULL;
1007  }
1008 
1010 
1011  FUNCTION_FINISH(ADB_GetSatelliteLNB);
1012 
1013  return(lnb_ptr);
1014 }
1015 
1021 U16BIT ADB_GetSatelliteLongitude(void *sat_ptr)
1022 {
1023  S16BIT long_pos;
1024 
1025  FUNCTION_START(ADB_GetSatelliteLongitude);
1026 
1027  if (sat_ptr != NULL)
1028  {
1030  long_pos = ((ADB_SATELLITE_REC *)sat_ptr)->long_pos;
1032  if (long_pos < 0)
1033  {
1034  long_pos *= -1;
1035  }
1036  }
1037  else
1038  {
1039  long_pos = 0;
1040  }
1041 
1042  FUNCTION_FINISH(ADB_GetSatelliteLongitude);
1043 
1044  return (U16BIT)long_pos;
1045 }
1046 
1052 BOOLEAN ADB_GetSatelliteDirection(void *sat_ptr)
1053 {
1054  BOOLEAN east_west;
1055 
1056  FUNCTION_START(ADB_GetSatelliteDirection);
1057 
1058  if (sat_ptr != NULL)
1059  {
1061  east_west = ((ADB_SATELLITE_REC *)sat_ptr)->east_west;
1063  }
1064  else
1065  {
1066  east_west = FALSE;
1067  }
1068 
1069  FUNCTION_FINISH(ADB_GetSatelliteDirection);
1070 
1071  return(east_west);
1072 }
1073 
1079 {
1080  U16BIT num_networks;
1081 
1082  FUNCTION_START(ADB_GetNumNetworks);
1083 
1085  num_networks = DBDEF_GetNumNetworks();
1087 
1088  FUNCTION_FINISH(ADB_GetNumNetworks);
1089 
1090  return(num_networks);
1091 }
1092 
1100 void ADB_GetNetworkList(void ***nlist_ptr, U16BIT *num_entries_ptr)
1101 {
1102  void **nlist;
1103  U16BIT num_entries;
1104  ADB_NETWORK_REC *n_ptr;
1105  U16BIT i;
1106 
1107  FUNCTION_START(ADB_GetNetworkList);
1108 
1110 
1111  if ((num_entries = DBDEF_GetNumNetworks()) > 0)
1112  {
1113  nlist = STB_AppGetMemory(num_entries * sizeof(void *));
1114  if (nlist != NULL)
1115  {
1116  n_ptr = DBDEF_GetNextNetworkRec(NULL);
1117  for (i = 0; ((i < num_entries) && (n_ptr != NULL)); i++)
1118  {
1119  nlist[i] = (void *)n_ptr;
1120  n_ptr = DBDEF_GetNextNetworkRec(n_ptr);
1121  }
1122  }
1123  else
1124  {
1125  num_entries = 0;
1126  }
1127 
1128  *nlist_ptr = nlist;
1129  }
1130 
1131  *num_entries_ptr = num_entries;
1132 
1134  FUNCTION_FINISH(ADB_GetNetworkList);
1135 }
1136 
1141 void ADB_ReleaseNetworkList(void **nlist)
1142 {
1143  FUNCTION_START(ADB_ReleaseNetworkList);
1144 
1145  if (nlist != NULL)
1146  {
1147  STB_AppFreeMemory(nlist);
1148  }
1149 
1150  FUNCTION_FINISH(ADB_ReleaseNetworkList);
1151 }
1152 
1161 U8BIT** ADB_GetNetworkListNames(void **nlist, U16BIT num_entries, BOOLEAN short_names)
1162 {
1163  U8BIT **names_array;
1164  U16BIT i;
1165 
1166  FUNCTION_START(ADB_GetNetworkListNames);
1167 
1168  if (nlist != NULL)
1169  {
1171  names_array = STB_AppGetMemory(num_entries * sizeof(U8BIT *));
1172  if (names_array != NULL)
1173  {
1174  for (i = 0; i < num_entries; i++)
1175  {
1176  names_array[i] = GetNetworkName((ADB_NETWORK_REC *)(nlist[i]), short_names);
1177  }
1178  }
1180  }
1181  else
1182  {
1183  names_array = NULL;
1184  }
1185 
1186  FUNCTION_FINISH(ADB_GetNetworkListNames);
1187  return(names_array);
1188 }
1189 
1198 U32BIT* ADB_GetNetworkListIds(void **nlist, U16BIT num_entries)
1199 {
1200  U32BIT *nid_array;
1201  U16BIT i;
1202 
1203  FUNCTION_START(ADB_GetNetworkListIds);
1204 
1205  if (nlist != NULL)
1206  {
1208  nid_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
1209  if (nid_array != NULL)
1210  {
1211  for (i = 0; i < num_entries; i++)
1212  {
1213  nid_array[i] = (U32BIT)GetNetworkId((ADB_NETWORK_REC *)nlist[i]);
1214  }
1215  }
1217  }
1218  else
1219  {
1220  nid_array = NULL;
1221  }
1222 
1223  FUNCTION_FINISH(ADB_GetNetworkListIds);
1224 
1225  return(nid_array);
1226 }
1227 
1234 U8BIT* ADB_GetNetworkName(void *n_ptr)
1235 {
1236  U8BIT *name_str;
1237 
1238  FUNCTION_START(ADB_GetNetworkName);
1239 
1241  name_str = GetNetworkName((ADB_NETWORK_REC *)n_ptr, FALSE);
1243 
1244  FUNCTION_FINISH(ADB_GetNetworkName);
1245 
1246  return(name_str);
1247 }
1248 
1256 U8BIT* ADB_GetNetworkNameByLang(void *n_ptr, U8BIT lang)
1257 {
1258  U8BIT *name_str;
1259 
1260  FUNCTION_START(ADB_GetNetworkNameByLang);
1261 
1263  name_str = GetNetworkNameByLang((ADB_NETWORK_REC *)n_ptr, lang, FALSE);
1265 
1266  FUNCTION_FINISH(ADB_GetNetworkNameByLang);
1267 
1268  return(name_str);
1269 }
1270 
1276 U16BIT ADB_GetNetworkId(void *n_ptr)
1277 {
1278  U16BIT nid_value;
1279 
1280  FUNCTION_START(ADB_GetNetworkId);
1281 
1283  nid_value = GetNetworkId((ADB_NETWORK_REC *)n_ptr);
1285 
1286  FUNCTION_FINISH(ADB_GetNetworkId);
1287 
1288  return(nid_value);
1289 }
1290 
1296 U8BIT ADB_GetNetworkTargetCountries(U32BIT **code_array)
1297 {
1298  U8BIT num_countries;
1299  U8BIT i;
1300  ADB_NETWORK_REC *nptr;
1302  U32BIT *new_array;
1303  BOOLEAN code_found;
1304 
1305  FUNCTION_START(ADB_GetNetworkTargetCountries);
1306 
1308 
1309  num_countries = 0;
1310  *code_array = NULL;
1311 
1312  nptr = DBDEF_GetNextNetworkRec(NULL);
1313  while (nptr != NULL)
1314  {
1315  tptr = nptr->target_region_name_list;
1316  while (tptr != NULL)
1317  {
1318  code_found = FALSE;
1319 
1320  /* Check whether this country code is already in the array */
1321  if (*code_array != NULL)
1322  {
1323  for (i = 0; (i < num_countries) && !code_found; i++)
1324  {
1325  if ((*code_array)[i] == tptr->country_code)
1326  {
1327  code_found = TRUE;
1328  }
1329  }
1330  }
1331 
1332  if (!code_found)
1333  {
1334  new_array = (U32BIT *)STB_AppGetMemory((num_countries + 1) * sizeof(U32BIT));
1335  if (new_array != NULL)
1336  {
1337  memcpy(new_array, *code_array, num_countries * sizeof(U32BIT));
1338  STB_AppFreeMemory(*code_array);
1339  }
1340 
1341  *code_array = new_array;
1342 
1343  if (*code_array != NULL)
1344  {
1345  (*code_array)[num_countries] = tptr->country_code;
1346  num_countries++;
1347  }
1348  }
1349 
1350  tptr = tptr->next;
1351  }
1352 
1353  nptr = DBDEF_GetNextNetworkRec(nptr);
1354  }
1355 
1357 
1358  FUNCTION_FINISH(ADB_GetNetworkTargetCountries);
1359 
1360  return(num_countries);
1361 }
1362 
1372 U16BIT ADB_GetNetworkPrimaryTargetRegions(U32BIT country_code, U8BIT **code_array, U8BIT ***name_array)
1373 {
1374  U16BIT num_regions;
1375  U8BIT i, j;
1376  ADB_NETWORK_REC *nptr;
1378  U8BIT *new_codes;
1379  U8BIT **new_names;
1380  BOOLEAN code_found;
1381 
1382  FUNCTION_START(ADB_GetNetworkPrimaryTargetRegions);
1383 
1385 
1386  num_regions = 0;
1387  *code_array = NULL;
1388  *name_array = NULL;
1389 
1390  nptr = DBDEF_GetNextNetworkRec(NULL);
1391  while (nptr != NULL)
1392  {
1393  tptr = nptr->target_region_name_list;
1394  while (tptr != NULL)
1395  {
1396  if ((tptr->country_code == country_code) && (tptr->num_names > 0) &&
1397  (tptr->name_array != NULL))
1398  {
1399  /* Check each primary region defined for this country and add it to the array of
1400  * regions if it's new */
1401  for (i = 0; i < tptr->num_names; i++)
1402  {
1403  /* Does this region name define a primary region? */
1404  if (tptr->name_array[i].region_depth == 1)
1405  {
1406  code_found = FALSE;
1407 
1408  /* This is a name for a primary region, check whether it's already in the code array */
1409  if (*code_array != NULL)
1410  {
1411  for (j = 0; (j < num_regions) && !code_found; j++)
1412  {
1413  if ((*code_array)[j] == tptr->name_array[i].primary_region_code)
1414  {
1415  code_found = TRUE;
1416  }
1417  }
1418  }
1419 
1420  if (!code_found)
1421  {
1422  new_codes = (U8BIT *)STB_AppGetMemory((num_regions + 1) * sizeof(U8BIT));
1423  new_names = (U8BIT **)STB_AppGetMemory((num_regions + 1) * sizeof(U8BIT *));
1424  if ((new_codes != NULL) && (new_names != NULL))
1425  {
1426  memcpy(new_codes, *code_array, num_regions * sizeof(U8BIT));
1427  STB_AppFreeMemory(*code_array);
1428 
1429  memcpy(new_names, *name_array, num_regions * sizeof(U8BIT *));
1430  STB_AppFreeMemory(*name_array);
1431  }
1432 
1433  *code_array = new_codes;
1434  *name_array = (void *)new_names;
1435 
1436  if ((*code_array != NULL) && (*name_array != NULL))
1437  {
1438  (*code_array)[num_regions] = tptr->name_array[i].primary_region_code;
1439  (*name_array)[num_regions] = CopySIString(tptr->name_array[i].region_name);
1440  num_regions++;
1441  }
1442  }
1443  }
1444  }
1445  }
1446 
1447  tptr = tptr->next;
1448  }
1449 
1450  nptr = DBDEF_GetNextNetworkRec(nptr);
1451  }
1452 
1454 
1455  FUNCTION_FINISH(ADB_GetNetworkPrimaryTargetRegions);
1456 
1457  return(num_regions);
1458 }
1459 
1471 U16BIT ADB_GetNetworkSecondaryTargetRegions(U32BIT country_code, U8BIT primary_region,
1472  U8BIT **code_array, U8BIT ***name_array)
1473 {
1474  U16BIT num_regions;
1475  U8BIT i, j;
1476  ADB_NETWORK_REC *nptr;
1478  U8BIT *new_codes;
1479  U8BIT **new_names;
1480  BOOLEAN code_found;
1481 
1482  FUNCTION_START(ADB_GetNetworkSecondaryTargetRegions);
1483 
1485 
1486  num_regions = 0;
1487  *code_array = NULL;
1488  *name_array = NULL;
1489 
1490  nptr = DBDEF_GetNextNetworkRec(NULL);
1491  while (nptr != NULL)
1492  {
1493  tptr = nptr->target_region_name_list;
1494  while (tptr != NULL)
1495  {
1496  if ((tptr->country_code == country_code) && (tptr->num_names > 0) &&
1497  (tptr->name_array != NULL))
1498  {
1499  /* Check each secondary region defined for this country and primary and add
1500  * it to the array of regions if it's new */
1501  for (i = 0; i < tptr->num_names; i++)
1502  {
1503  /* Does this region name define a secondary region? */
1504  if ((tptr->name_array[i].region_depth == 2) &&
1505  (tptr->name_array[i].primary_region_code = primary_region))
1506  {
1507  code_found = FALSE;
1508 
1509  /* This is a name for a secondary region, check whether it's already in the code array */
1510  if (*code_array != NULL)
1511  {
1512  for (j = 0; (j < num_regions) && !code_found; j++)
1513  {
1514  if ((*code_array)[j] == tptr->name_array[i].secondary_region_code)
1515  {
1516  code_found = TRUE;
1517  }
1518  }
1519  }
1520 
1521  if (!code_found)
1522  {
1523  new_codes = (U8BIT *)STB_AppGetMemory((num_regions + 1) * sizeof(U8BIT));
1524  new_names = (U8BIT **)STB_AppGetMemory((num_regions + 1) * sizeof(U8BIT *));
1525  if ((new_codes != NULL) && (new_names != NULL))
1526  {
1527  memcpy(new_codes, *code_array, num_regions * sizeof(U8BIT));
1528  STB_AppFreeMemory(*code_array);
1529 
1530  memcpy(new_names, *name_array, num_regions * sizeof(U8BIT *));
1531  STB_AppFreeMemory(*name_array);
1532  }
1533 
1534  *code_array = new_codes;
1535  *name_array = (void *)new_names;
1536 
1537  if ((*code_array != NULL) && (*name_array != NULL))
1538  {
1539  (*code_array)[num_regions] = tptr->name_array[i].secondary_region_code;
1540  (*name_array)[num_regions] = CopySIString(tptr->name_array[i].region_name);
1541  num_regions++;
1542  }
1543  }
1544  }
1545  }
1546  }
1547 
1548  tptr = tptr->next;
1549  }
1550 
1551  nptr = DBDEF_GetNextNetworkRec(nptr);
1552  }
1553 
1555 
1556  FUNCTION_FINISH(ADB_GetNetworkSecondaryTargetRegions);
1557 
1558  return(num_regions);
1559 }
1560 
1573 U16BIT ADB_GetNetworkTertiaryTargetRegions(U32BIT country_code, U8BIT primary_region,
1574  U8BIT secondary_region, U16BIT **code_array, U8BIT ***name_array)
1575 {
1576  U16BIT num_regions;
1577  U8BIT i, j;
1578  ADB_NETWORK_REC *nptr;
1580  U16BIT *new_codes;
1581  U8BIT **new_names;
1582  BOOLEAN code_found;
1583 
1584  FUNCTION_START(ADB_GetNetworkTertiaryTargetRegions);
1585 
1587 
1588  num_regions = 0;
1589  *code_array = NULL;
1590  *name_array = NULL;
1591 
1592  nptr = DBDEF_GetNextNetworkRec(NULL);
1593  while (nptr != NULL)
1594  {
1595  tptr = nptr->target_region_name_list;
1596  while (tptr != NULL)
1597  {
1598  if ((tptr->country_code == country_code) && (tptr->num_names > 0) &&
1599  (tptr->name_array != NULL))
1600  {
1601  /* Check each secondary region defined for this country and primary and add
1602  * it to the array of regions if it's new */
1603  for (i = 0; i < tptr->num_names; i++)
1604  {
1605  /* Does this region name define a tertiary region? */
1606  if ((tptr->name_array[i].region_depth == 3) &&
1607  (tptr->name_array[i].primary_region_code = primary_region) &&
1608  (tptr->name_array[i].secondary_region_code = secondary_region))
1609  {
1610  code_found = FALSE;
1611 
1612  /* This is a name for a tertiary region, check whether it's already in the code array */
1613  if (*code_array != NULL)
1614  {
1615  for (j = 0; (j < num_regions) && !code_found; j++)
1616  {
1617  if ((*code_array)[j] == tptr->name_array[i].tertiary_region_code)
1618  {
1619  code_found = TRUE;
1620  }
1621  }
1622  }
1623 
1624  if (!code_found)
1625  {
1626  new_codes = (U16BIT *)STB_AppGetMemory((num_regions + 1) * sizeof(U16BIT));
1627  new_names = (U8BIT **)STB_AppGetMemory((num_regions + 1) * sizeof(U8BIT *));
1628  if ((new_codes != NULL) && (new_names != NULL))
1629  {
1630  memcpy(new_codes, *code_array, num_regions * sizeof(U16BIT));
1631  STB_AppFreeMemory(*code_array);
1632 
1633  memcpy(new_names, *name_array, num_regions * sizeof(U8BIT *));
1634  STB_AppFreeMemory(*name_array);
1635  }
1636 
1637  *code_array = new_codes;
1638  *name_array = (void *)new_names;
1639 
1640  if ((*code_array != NULL) && (*name_array != NULL))
1641  {
1642  (*code_array)[num_regions] = tptr->name_array[i].tertiary_region_code;
1643  (*name_array)[num_regions] = CopySIString(tptr->name_array[i].region_name);
1644  num_regions++;
1645  }
1646  }
1647  }
1648  }
1649  }
1650 
1651  tptr = tptr->next;
1652  }
1653 
1654  nptr = DBDEF_GetNextNetworkRec(nptr);
1655  }
1656 
1658 
1659  FUNCTION_FINISH(ADB_GetNetworkTertiaryTargetRegions);
1660 
1661  return(num_regions);
1662 }
1663 
1669 void* ADB_GetTunedNetwork(U8BIT path)
1670 {
1671  void *n_ptr;
1672 
1673  FUNCTION_START(ADB_GetTunedNetwork);
1674 
1676  n_ptr = (void *)DBDEF_GetTunedNetwork(path);
1678 
1679  FUNCTION_FINISH(ADB_GetTunedNetwork);
1680 
1681  return(n_ptr);
1682 }
1683 
1691 void ADB_GetTransportList(void ***tlist_ptr, U16BIT *num_entries_ptr)
1692 {
1693  FUNCTION_START(ADB_GetTransportList);
1694 
1695  ADB_GetTransportListForTunerType(SIGNAL_NONE, tlist_ptr, num_entries_ptr);
1696 
1697  FUNCTION_FINISH(ADB_GetTransportList);
1698 }
1699 
1711 void ADB_GetTransportListForTunerType(E_STB_DP_SIGNAL_TYPE tuner_type, void ***tlist_ptr,
1712  U16BIT *num_entries_ptr)
1713 {
1714  void **tlist;
1715  U16BIT max_no_entries;
1716  U16BIT num_entries;
1717  ADB_TRANSPORT_REC *t_ptr;
1718  U16BIT i;
1719 
1720  FUNCTION_START(ADB_GetTransportListForTunerType);
1721 
1722  *tlist_ptr = NULL;
1723  *num_entries_ptr = 0;
1724 
1726 
1727  if ((max_no_entries = DBDEF_GetNumTransports()) > 0)
1728  {
1729  tlist = STB_AppGetMemory(max_no_entries * sizeof(void *));
1730  num_entries = 0;
1731  if (tlist != NULL)
1732  {
1733  t_ptr = DBDEF_GetNextTransportRec(NULL);
1734  for (i = 0; ((i < max_no_entries) && (t_ptr != NULL)); i++)
1735  {
1736  if ((tuner_type == SIGNAL_NONE) || (t_ptr->sig_type == tuner_type))
1737  {
1738  tlist[num_entries] = (void *)t_ptr;
1739  num_entries++;
1740  }
1741 
1742  t_ptr = DBDEF_GetNextTransportRec(t_ptr);
1743  }
1744  }
1745 
1746  *tlist_ptr = tlist;
1747  *num_entries_ptr = num_entries;
1748  }
1749 
1751 
1752  FUNCTION_FINISH(ADB_GetTransportListForTunerType);
1753 }
1754 
1764 void ADB_GetNetworkTransportList(void *n_ptr, void ***tlist_ptr, U16BIT *num_entries_ptr)
1765 {
1766  void **tlist;
1767  U16BIT max_no_entries;
1768  ADB_TRANSPORT_REC *t_ptr;
1769  U16BIT i;
1770  U16BIT num_entries;
1771 
1772  FUNCTION_START(ADB_GetNetworkTransportList);
1773 
1775 
1776  num_entries = 0;
1777 
1778  if ((max_no_entries = DBDEF_GetNumTransports()) > 0)
1779  {
1780  tlist = STB_AppGetMemory(max_no_entries * sizeof(void *));
1781  if (tlist != NULL)
1782  {
1783  t_ptr = DBDEF_GetNextTransportRec(NULL);
1784  for (i = 0; ((i < max_no_entries) && (t_ptr != NULL)); i++)
1785  {
1786  /* if transport belongs to the current network */
1787  if ((t_ptr->network != NULL) && (t_ptr->network == n_ptr))
1788  {
1789  tlist[num_entries] = (void *)t_ptr;
1790  num_entries++;
1791  }
1792  t_ptr = DBDEF_GetNextTransportRec(t_ptr);
1793  }
1794 
1795  if (num_entries == 0)
1796  {
1797  STB_AppFreeMemory(tlist);
1798  tlist = NULL;
1799  }
1800  }
1801 
1802  *tlist_ptr = tlist;
1803  }
1804 
1805  *num_entries_ptr = num_entries;
1806 
1808 
1809  FUNCTION_FINISH(ADB_GetNetworkTransportList);
1810 }
1811 
1817 {
1818  U16BIT num_transports;
1819 
1820  FUNCTION_START(ADB_GetNumTransports);
1821 
1823  num_transports = DBDEF_GetNumTransports();
1825 
1826  FUNCTION_FINISH(ADB_GetNumTransports);
1827 
1828  return(num_transports);
1829 }
1830 
1836 void ADB_ReleaseTransportList(void **tlist, U16BIT num_transports)
1837 {
1838  FUNCTION_START(ADB_ReleaseTransportList);
1839 
1840  USE_UNWANTED_PARAM(num_transports);
1841 
1842  if (tlist != NULL)
1843  {
1844  STB_AppFreeMemory(tlist);
1845  }
1846 
1847  FUNCTION_FINISH(ADB_ReleaseTransportList);
1848 }
1849 
1857 U8BIT** ADB_GetTransportListNames(void **tlist, U16BIT num_entries)
1858 {
1859  U8BIT **names_array;
1860  U16BIT i;
1861 
1862  FUNCTION_START(ADB_GetTransportListNames);
1863 
1864  if (tlist != NULL)
1865  {
1867  names_array = STB_AppGetMemory(num_entries * sizeof(U8BIT *));
1868  if (names_array != NULL)
1869  {
1870  for (i = 0; i < num_entries; i++)
1871  {
1872  names_array[i] = GetTransportName((ADB_TRANSPORT_REC *)(tlist[i]));
1873  }
1874  }
1876  }
1877  else
1878  {
1879  names_array = NULL;
1880  }
1881 
1882  FUNCTION_FINISH(ADB_GetTransportListNames);
1883  return(names_array);
1884 }
1885 
1894 U32BIT* ADB_GetTransportListTids(void **tlist, U16BIT num_entries)
1895 {
1896  U32BIT *tid_array;
1897  U16BIT i;
1898 
1899  FUNCTION_START(ADB_GetTransportListTids);
1900 
1901  if (tlist != NULL)
1902  {
1904  tid_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
1905  if (tid_array != NULL)
1906  {
1907  for (i = 0; i < num_entries; i++)
1908  {
1909  tid_array[i] = (U32BIT)GetTransportTid((ADB_TRANSPORT_REC *)(tlist[i]));
1910  }
1911  }
1913  }
1914  else
1915  {
1916  tid_array = NULL;
1917  }
1918 
1919  FUNCTION_FINISH(ADB_GetTransportListTids);
1920 
1921  return(tid_array);
1922 }
1923 
1933 U32BIT* ADB_GetTransportListTunedStrengths(void **tlist, U16BIT num_entries)
1934 {
1935  U32BIT *tuned_signal_strength_array;
1936  U16BIT i;
1937 
1938  FUNCTION_START(ADB_GetTransportListTunedStrengths);
1939 
1940  if (tlist != NULL)
1941  {
1943  tuned_signal_strength_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
1944  if (tuned_signal_strength_array != NULL)
1945  {
1946  for (i = 0; i < num_entries; i++)
1947  {
1948  tuned_signal_strength_array[i] = (U32BIT)GetTransportTunedStrength((ADB_TRANSPORT_REC *)(tlist[i]));
1949  }
1950  }
1952  }
1953  else
1954  {
1955  tuned_signal_strength_array = NULL;
1956  }
1957 
1958  FUNCTION_FINISH(ADB_GetTransportListTunedStrengths);
1959 
1960  return(tuned_signal_strength_array);
1961 }
1962 
1972 U32BIT* ADB_GetTransportListOriginalNetworkIds(void **tlist, U16BIT num_entries)
1973 {
1974  U32BIT *orig_network_array;
1975  U16BIT i;
1976 
1978 
1979  if (tlist != NULL)
1980  {
1982  orig_network_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
1983  if (orig_network_array != NULL)
1984  {
1985  for (i = 0; i < num_entries; i++)
1986  {
1987  orig_network_array[i] = (U32BIT)GetTransportOriginalNetworkId((ADB_TRANSPORT_REC *)(tlist[i]));
1988  }
1989  }
1991  }
1992  else
1993  {
1994  orig_network_array = NULL;
1995  }
1996 
1997  FUNCTION_FINISH(ADB_GetTransportListOriginalNetworkIds);
1998 
1999  return(orig_network_array);
2000 }
2001 
2010 U32BIT* ADB_GetTransportListFreqs(void **tlist, U16BIT num_entries)
2011 {
2012  U32BIT *freq_array;
2013  U16BIT i;
2014 
2015  FUNCTION_START(ADB_GetTransportListFreqs);
2016 
2017  if (tlist != NULL)
2018  {
2020  freq_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
2021  if (freq_array != NULL)
2022  {
2023  for (i = 0; i < num_entries; i++)
2024  {
2025  freq_array[i] = (U32BIT)GetTransportFreq((ADB_TRANSPORT_REC *)(tlist[i]));
2026  }
2027  }
2029  }
2030  else
2031  {
2032  freq_array = NULL;
2033  }
2034 
2035  FUNCTION_FINISH(ADB_GetTransportListFreqs);
2036 
2037  return(freq_array);
2038 }
2039 
2040 /* The next four functions are NEVER used! */
2041 
2053 U32BIT* ADB_GetTransportListBwidths(void **tlist, U16BIT num_entries)
2054 {
2055  U32BIT *bwidth_array;
2056  U16BIT i;
2057 
2058  FUNCTION_START(ADB_GetTransportListBwidths);
2059 
2060  if (tlist != NULL)
2061  {
2063  bwidth_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
2064  if (bwidth_array != NULL)
2065  {
2066  for (i = 0; i < num_entries; i++)
2067  {
2068  bwidth_array[i] = (U32BIT)GetTransportBwidth((ADB_TRANSPORT_REC *)(tlist[i]));
2069  }
2070  }
2072  }
2073  else
2074  {
2075  bwidth_array = NULL;
2076  }
2077 
2078  FUNCTION_FINISH(ADB_GetTransportListBwidths);
2079 
2080  return(bwidth_array);
2081 }
2082 
2094 U32BIT* ADB_GetTransportListOffsets(void **tlist, U16BIT num_entries)
2095 {
2096  U32BIT *offset_array;
2097  U16BIT i;
2098 
2099  FUNCTION_START(ADB_GetTransportListOffsets);
2100 
2101  if (tlist != NULL)
2102  {
2104  offset_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
2105  if (offset_array != NULL)
2106  {
2107  for (i = 0; i < num_entries; i++)
2108  {
2109  offset_array[i] = (U32BIT)GetTransportOffset((ADB_TRANSPORT_REC *)(tlist[i]));
2110  }
2111  }
2113  }
2114  else
2115  {
2116  offset_array = NULL;
2117  }
2118 
2119  FUNCTION_FINISH(ADB_GetTransportListOffsets);
2120 
2121  return(offset_array);
2122 }
2123 
2135 U8BIT** ADB_GetTransportListConstellationStrings(void **tlist, U16BIT num_entries)
2136 {
2137  U8BIT **constellation_array;
2138  U16BIT i;
2139 
2141 
2142  if (tlist != NULL)
2143  {
2145  constellation_array = STB_AppGetMemory(num_entries * sizeof(U8BIT *));
2146  if (constellation_array != NULL)
2147  {
2148  for (i = 0; i < num_entries; i++)
2149  {
2150  constellation_array[i] = GetTransportConstellationString((ADB_TRANSPORT_REC *)(tlist[i]));
2151  }
2152  }
2154  }
2155  else
2156  {
2157  constellation_array = NULL;
2158  }
2160 
2161  return(constellation_array);
2162 }
2163 
2175 U8BIT** ADB_GetTransportListHierarchyStrings(void **tlist, U16BIT num_entries)
2176 {
2177  U8BIT **hierarchy_array;
2178  U16BIT i;
2179 
2180  FUNCTION_START(ADB_GetTransportListHierarchyStrings);
2181 
2182  if (tlist != NULL)
2183  {
2185  hierarchy_array = STB_AppGetMemory(num_entries * sizeof(U8BIT *));
2186  if (hierarchy_array != NULL)
2187  {
2188  for (i = 0; i < num_entries; i++)
2189  {
2190  hierarchy_array[i] = GetTransportHierarchyString((ADB_TRANSPORT_REC *)(tlist[i]));
2191  }
2192  }
2194  }
2195  else
2196  {
2197  hierarchy_array = NULL;
2198  }
2199 
2200  FUNCTION_FINISH(ADB_GetTransportListHierarchyStrings);
2201 
2202  return(hierarchy_array);
2203 }
2204 
2210 BOOLEAN ADB_GetTransportSearchFlag(void *t_ptr)
2211 {
2212  BOOLEAN searched;
2213 
2214  FUNCTION_START(ADB_GetTransportSearchFlag);
2215 
2216  searched = FALSE;
2217 
2218  if (t_ptr != NULL)
2219  {
2221  searched = ((ADB_TRANSPORT_REC *)t_ptr)->searched;
2223  }
2224 
2225  FUNCTION_FINISH(ADB_GetTransportSearchFlag);
2226 
2227  return(searched);
2228 }
2229 
2235 void ADB_SetTransportSearchFlag(void *t_ptr, BOOLEAN state)
2236 {
2237  FUNCTION_START(ADB_SetTransportSearchFlag);
2238 
2239  if (t_ptr != NULL)
2240  {
2242  ((ADB_TRANSPORT_REC *)t_ptr)->searched = state;
2244  }
2245 
2246  FUNCTION_FINISH(ADB_SetTransportSearchFlag);
2247 }
2248 
2254 {
2255  ADB_TRANSPORT_REC *trans_ptr = (ADB_TRANSPORT_REC *)t_ptr;
2256 
2257  FUNCTION_START(ADB_ReportNoSignalDuringSearch);
2258 
2259  if (t_ptr != NULL)
2260  {
2262 
2263  trans_ptr->searched = TRUE;
2264  trans_ptr->signal_level_at_search = 0;
2265 
2267  }
2268 
2269  FUNCTION_FINISH(ADB_ReportNoSignalDuringSearch);
2270 }
2271 
2277 E_STB_DP_SIGNAL_TYPE ADB_GetTransportSignalType(void *t_ptr)
2278 {
2279  E_STB_DP_SIGNAL_TYPE stype;
2280 
2281  FUNCTION_START(ADB_GetTransportSignalType);
2282 
2284  if (t_ptr != NULL)
2285  {
2286  stype = ((ADB_TRANSPORT_REC *)t_ptr)->sig_type;
2287  }
2288  else
2289  {
2290  stype = SIGNAL_NONE;
2291  }
2293 
2294  FUNCTION_FINISH(ADB_GetTransportSignalType);
2295 
2296  return(stype);
2297 }
2298 
2305 U8BIT* ADB_GetTransportName(void *t_ptr)
2306 {
2307  U8BIT *name_str_ptr;
2308 
2309  FUNCTION_START(ADB_GetTransportName);
2310 
2312  name_str_ptr = GetTransportName((ADB_TRANSPORT_REC *)t_ptr);
2314 
2315  FUNCTION_FINISH(ADB_GetTransportName);
2316 
2317  return(name_str_ptr);
2318 }
2319 
2325 U16BIT ADB_GetTransportTid(void *t_ptr)
2326 {
2327  U16BIT tid_value;
2328 
2329  FUNCTION_START(ADB_GetTransportTid);
2330 
2332  tid_value = GetTransportTid((ADB_TRANSPORT_REC *)t_ptr);
2334 
2335  FUNCTION_FINISH(ADB_GetTransportTid);
2336 
2337  return(tid_value);
2338 }
2339 
2346 {
2347  U8BIT tuned_signal_strength;
2348 
2349  FUNCTION_START(ADB_GetTransportTunedStrength);
2350 
2352  tuned_signal_strength = GetTransportTunedStrength((ADB_TRANSPORT_REC *)t_ptr);
2354 
2355  FUNCTION_FINISH(ADB_GetTransportTunedStrength);
2356 
2357  return(tuned_signal_strength);
2358 }
2359 
2366 {
2367  U8BIT tuned_signal_quality;
2368 
2369  FUNCTION_START(ADB_GetTransportTunedQuality);
2370 
2372  tuned_signal_quality = GetTransportTunedQuality((ADB_TRANSPORT_REC *)t_ptr);
2374 
2375  FUNCTION_FINISH(ADB_GetTransportTunedQuality);
2376 
2377  return(tuned_signal_quality);
2378 }
2379 
2386 {
2387  U16BIT orig_network_id;
2388 
2389  FUNCTION_START(ADB_GetTransportOriginalNetworkId);
2390 
2392  orig_network_id = GetTransportOriginalNetworkId((ADB_TRANSPORT_REC *)t_ptr);
2394 
2395  FUNCTION_FINISH(ADB_GetTransportOriginalNetworkId);
2396 
2397  return(orig_network_id);
2398 }
2399 
2405 void* ADB_GetTransportNetworkPtr(void *t_ptr)
2406 {
2407  void *n_ptr;
2408  ADB_TRANSPORT_REC *trans;
2409 
2410  FUNCTION_START(ADB_GetTransportNetworkPtr);
2411 
2412  n_ptr = NULL;
2413  if (t_ptr != NULL)
2414  {
2415  trans = (ADB_TRANSPORT_REC *)t_ptr;
2416 
2418  n_ptr = trans->network;
2420  }
2421 
2422  FUNCTION_FINISH(ADB_GetTransportNetworkPtr);
2423 
2424  return(n_ptr);
2425 }
2426 
2433 U32BIT ADB_GetTransportFreqHz(void *t_ptr)
2434 {
2435  U32BIT tp_freq;
2436 
2437  FUNCTION_START(ADB_GetTransportFreqHz);
2438 
2440  tp_freq = GetTransportFreq((ADB_TRANSPORT_REC *)t_ptr);
2442 
2443  FUNCTION_FINISH(ADB_GetTransportFreqHz);
2444 
2445  return(tp_freq);
2446 }
2447 
2453 U8BIT ADB_GetTransportBwidth(void *t_ptr)
2454 {
2455  U8BIT bwidth;
2456 
2457  FUNCTION_START(ADB_GetTransportBwidth);
2458 
2460  bwidth = GetTransportBwidth((ADB_TRANSPORT_REC *)t_ptr);
2462 
2463  FUNCTION_FINISH(ADB_GetTransportBwidth);
2464 
2465  return(bwidth);
2466 }
2467 
2473 E_STB_DP_TMODE ADB_GetTransportTerrMode(void *t_ptr)
2474 {
2475  E_STB_DP_TMODE mode;
2476  ADB_TRANSPORT_REC *trans;
2477 
2478  FUNCTION_START(ADB_GetTransportTerrMode);
2479 
2480  mode = MODE_COFDM_UNDEFINED;
2481 
2482  if (t_ptr != NULL)
2483  {
2484  trans = (ADB_TRANSPORT_REC *)t_ptr;
2485 
2487  if (trans->sig_type == SIGNAL_COFDM)
2488  {
2489  mode = trans->u.terr.tmode;
2490  }
2492  }
2493 
2494  FUNCTION_FINISH(ADB_GetTransportTerrMode);
2495 
2496  return(mode);
2497 }
2498 
2504 S8BIT ADB_GetTransportOffset(void *t_ptr)
2505 {
2506  S8BIT offset;
2507 
2508  FUNCTION_START(ADB_GetTransportOffset);
2509 
2511  offset = GetTransportOffset((ADB_TRANSPORT_REC *)t_ptr);
2513 
2514  FUNCTION_FINISH(ADB_GetTransportOffset);
2515 
2516  return(offset);
2517 }
2518 
2524 E_STB_TUNE_TCONST ADB_GetTransportConstellation(void *t_ptr)
2525 {
2526  E_STB_TUNE_TCONST constellation;
2527  ADB_TRANSPORT_REC *trans;
2528 
2529  FUNCTION_START(ADB_GetTransportConstellation);
2530 
2531  constellation = TUNE_TCONST_UNDEFINED;
2532 
2533  if (t_ptr != NULL)
2534  {
2535  trans = (ADB_TRANSPORT_REC *)t_ptr;
2536 
2538  if (trans->sig_type == SIGNAL_COFDM)
2539  {
2540  constellation = trans->u.terr.constellation;
2541  }
2543  }
2544 
2545  FUNCTION_FINISH(ADB_GetTransportConstellation);
2546 
2547  return(constellation);
2548 }
2549 
2555 E_STB_TUNE_THIERARCHY ADB_GetTransportHierarchy(void *t_ptr)
2556 {
2557  E_STB_TUNE_THIERARCHY hierarchy;
2558  ADB_TRANSPORT_REC *trans;
2559 
2560  FUNCTION_START(ADB_GetTransportHierarchy);
2561 
2562  hierarchy = TUNE_THIERARCHY_UNDEFINED;
2563 
2564  if (t_ptr != NULL)
2565  {
2566  trans = (ADB_TRANSPORT_REC *)t_ptr;
2567 
2569  if (trans->sig_type == SIGNAL_COFDM)
2570  {
2571  hierarchy = trans->u.terr.hierarchy;
2572  }
2574  }
2575 
2576  FUNCTION_FINISH(ADB_GetTransportHierarchy);
2577 
2578  return(hierarchy);
2579 }
2580 
2586 E_STB_TUNE_TCODERATE ADB_GetTransportLpCodeRate(void *t_ptr)
2587 {
2588  E_STB_TUNE_TCODERATE coderate;
2589  ADB_TRANSPORT_REC *trans;
2590 
2591  FUNCTION_START(ADB_GetTransportLpCodeRate);
2592 
2593  coderate = TUNE_TCODERATE_UNDEFINED;
2594 
2595  if (t_ptr != NULL)
2596  {
2597  trans = (ADB_TRANSPORT_REC *)t_ptr;
2598 
2600  if (trans->sig_type == SIGNAL_COFDM)
2601  {
2602  coderate = trans->u.terr.lp_code_rate;
2603  }
2605  }
2606 
2607  FUNCTION_FINISH(ADB_GetTransportLpCodeRate);
2608 
2609  return(coderate);
2610 }
2611 
2617 E_STB_TUNE_TCODERATE ADB_GetTransportHpCodeRate(void *t_ptr)
2618 {
2619  E_STB_TUNE_TCODERATE coderate;
2620  ADB_TRANSPORT_REC *trans;
2621 
2622  FUNCTION_START(ADB_GetTransportHpCodeRate);
2623 
2624  coderate = TUNE_TCODERATE_UNDEFINED;
2625 
2626  if (t_ptr != NULL)
2627  {
2628  trans = (ADB_TRANSPORT_REC *)t_ptr;
2629 
2631  if (trans->sig_type == SIGNAL_COFDM)
2632  {
2633  coderate = trans->u.terr.hp_code_rate;
2634  }
2636  }
2637 
2638  FUNCTION_FINISH(ADB_GetTransportHpCodeRate);
2639 
2640  return(coderate);
2641 }
2642 
2648 E_STB_TUNE_TGUARDINT ADB_GetTransportGuardInt(void *t_ptr)
2649 {
2650  E_STB_TUNE_TGUARDINT guard_int;
2651  ADB_TRANSPORT_REC *trans;
2652 
2653  FUNCTION_START(ADB_GetTransportGuardInt);
2654 
2655  guard_int = TUNE_TGUARDINT_UNDEFINED;
2656 
2657  if (t_ptr != NULL)
2658  {
2659  trans = (ADB_TRANSPORT_REC *)t_ptr;
2660 
2662  if (trans->sig_type == SIGNAL_COFDM)
2663  {
2664  guard_int = trans->u.terr.guard_int;
2665  }
2667  }
2668 
2669  FUNCTION_FINISH(ADB_GetTransportGuardInt);
2670 
2671  return(guard_int);
2672 }
2673 
2679 E_STB_DP_CMODE ADB_GetTransportCableMode(void *t_ptr)
2680 {
2681  E_STB_DP_CMODE mode;
2682  ADB_TRANSPORT_REC *trans;
2683 
2684  FUNCTION_START(ADB_GetTransportCableMode);
2685 
2686  mode = MODE_QAM_AUTO;
2687 
2688  if (t_ptr != NULL)
2689  {
2690  trans = (ADB_TRANSPORT_REC *)t_ptr;
2691 
2693  if (trans->sig_type == SIGNAL_QAM)
2694  {
2695  mode = trans->u.cab.cmode;
2696  }
2698  }
2699 
2700  FUNCTION_FINISH(ADB_GetTransportCableMode);
2701 
2702  return(mode);
2703 }
2704 
2711 {
2712  U16BIT sym_rate;
2713  ADB_TRANSPORT_REC *trans;
2714 
2715  FUNCTION_START(ADB_GetTransportCableSymbolRate);
2716 
2717  sym_rate = 0;
2718 
2719  if (t_ptr != NULL)
2720  {
2721  trans = (ADB_TRANSPORT_REC *)t_ptr;
2722 
2724  if (trans->sig_type == SIGNAL_QAM)
2725  {
2726  sym_rate = (U16BIT)trans->u.cab.symbol_rate;
2727  }
2729  }
2730 
2731  FUNCTION_FINISH(ADB_GetTransportCableSymbolRate);
2732 
2733  return(sym_rate);
2734 }
2735 
2742 {
2743  U16BIT sym_rate;
2744  ADB_TRANSPORT_REC *trans;
2745 
2746  FUNCTION_START(ADB_GetTransportSatelliteSymbolRate);
2747 
2748  sym_rate = 0;
2749 
2750  if (t_ptr != NULL)
2751  {
2752  trans = (ADB_TRANSPORT_REC *)t_ptr;
2753 
2755  if (trans->sig_type == SIGNAL_QPSK)
2756  {
2757  sym_rate = (U16BIT)trans->u.sat.symbol_rate;
2758  }
2760  }
2761 
2762  FUNCTION_FINISH(ADB_GetTransportSatelliteSymbolRate);
2763 
2764  return(sym_rate);
2765 }
2766 
2776 void ADB_GetTransportTerrestrialTuningParams(void *t_ptr, E_STB_DP_TTYPE *terr_type, U32BIT *freq_hz,
2777  E_STB_DP_TMODE *mode, E_STB_DP_TBWIDTH *bwidth, U8BIT *plp_id)
2778 {
2779  ADB_TRANSPORT_REC *trans_rec;
2780 
2782 
2784 
2785  if (t_ptr != NULL)
2786  {
2787  trans_rec = (ADB_TRANSPORT_REC *)t_ptr;
2788 
2789  *terr_type = trans_rec->u.terr.terr_type;
2790  *freq_hz = trans_rec->frequency;
2791  *mode = trans_rec->u.terr.tmode;
2792  *bwidth = trans_rec->u.terr.bwidth;
2793 
2794  if (trans_rec->u.terr.terr_type == TERR_TYPE_DVBT2)
2795  {
2796  *plp_id = trans_rec->u.terr.plp_id;
2797  }
2798  else
2799  {
2800  *plp_id = 0;
2801  }
2802  }
2803  else
2804  {
2805  *terr_type = TERR_TYPE_UNKNOWN;
2806  *freq_hz = 0;
2807  *mode = MODE_COFDM_UNDEFINED;
2808  *bwidth = TBWIDTH_8MHZ;
2809  *plp_id = 0;
2810  }
2811 
2813 
2814  FUNCTION_FINISH(ADB_GetTransportTerrestrialTuningParams);
2815 }
2816 
2824 void ADB_GetTransportAnalogTuningParams(void *t_ptr, U32BIT *freq_hz, S8BIT *offset,
2825  E_STB_DP_ANALOG_VIDEO_TYPE *vtype)
2826 {
2827  FUNCTION_START(ADB_GetTransportAnalogTuningParams);
2828 
2830 
2831  if (t_ptr != NULL)
2832  {
2833  *freq_hz = ((ADB_TRANSPORT_REC *)t_ptr)->frequency;
2834  *offset = ((ADB_TRANSPORT_REC *)t_ptr)->u.anal.freq_offset;
2835  *vtype = ((ADB_TRANSPORT_REC *)t_ptr)->u.anal.vtype;
2836  }
2837  else
2838  {
2839  *freq_hz = 0;
2840  *offset = 0;
2841  *vtype = ANLG_VIDEO_PAL_I;
2842  }
2843 
2845 
2846  FUNCTION_FINISH(ADB_GetTransportAnalogTuningParams);
2847 }
2848 
2856 void ADB_GetTransportCableTuningParams(void *t_ptr, U32BIT *freq_hz, E_STB_DP_CMODE *mode,
2857  U16BIT *symrate)
2858 {
2859  ADB_TRANSPORT_REC *trans_rec;
2860 
2861  FUNCTION_START(ADB_GetTransportCableTuningParams);
2862 
2864 
2865  if (t_ptr != NULL)
2866  {
2867  trans_rec = (ADB_TRANSPORT_REC *)t_ptr;
2868 
2869  *freq_hz = trans_rec->frequency;
2870  *mode = trans_rec->u.cab.cmode;
2871  *symrate = (U16BIT)trans_rec->u.cab.symbol_rate;
2872  }
2873  else
2874  {
2875  *freq_hz = 0;
2876  *mode = MODE_QAM_AUTO;
2877  *symrate = 0;
2878  }
2879 
2881 
2882  FUNCTION_FINISH(ADB_GetTransportCableTuningParams);
2883 }
2884 
2895 void ADB_GetTransportSatTuningParams(void *t_ptr, U32BIT *freq_hz, E_STB_DP_POLARITY *polarity,
2896  U16BIT *symrate, E_STB_DP_FEC *fec, BOOLEAN *dvb_s2, E_STB_DP_MODULATION *modulation)
2897 {
2898  ADB_TRANSPORT_REC *trans_rec;
2899 
2900  FUNCTION_START(ADB_GetTransportSatTuningParams);
2901 
2903 
2904  if (t_ptr != NULL)
2905  {
2906  trans_rec = (ADB_TRANSPORT_REC *)t_ptr;
2907 
2908  *freq_hz = trans_rec->frequency;
2909  *polarity = trans_rec->u.sat.polarity;
2910  *symrate = trans_rec->u.sat.symbol_rate;
2911  *fec = trans_rec->u.sat.fec_code;
2912  *dvb_s2 = trans_rec->u.sat.dvb_s2;
2913  *modulation = trans_rec->u.sat.modulation;
2914  }
2915  else
2916  {
2917  *freq_hz = 0;
2918  *polarity = POLARITY_HORIZONTAL;
2919  *symrate = 0;
2920  *fec = FEC_AUTOMATIC;
2921  *dvb_s2 = FALSE;
2922  *modulation = MOD_QPSK;
2923  }
2924 
2926 
2927  FUNCTION_FINISH(ADB_GetTransportSatTuningParams);
2928 }
2929 
2935 void* ADB_GetTransportSatellite(void *t_ptr)
2936 {
2937  ADB_NETWORK_REC *n_ptr;
2938  void *sat_ptr;
2939 
2940  FUNCTION_START(ADB_GetTransportSatellite);
2941 
2943 
2944  sat_ptr = NULL;
2945 
2946  if (t_ptr != NULL)
2947  {
2948  if ((n_ptr = ((ADB_TRANSPORT_REC *)t_ptr)->network) != NULL)
2949  {
2950  sat_ptr = n_ptr->satellite;
2951  }
2952  }
2953 
2955 
2956  FUNCTION_FINISH(ADB_GetTransportSatellite);
2957 
2958  return(sat_ptr);
2959 }
2960 
2968 void* ADB_GetTransportFromIds(U16BIT net_id, U16BIT onet_id, U16BIT tran_id)
2969 {
2970  void *t_ptr;
2971 
2972  FUNCTION_START(ADB_GetTransportFromIds);
2973 
2975  t_ptr = DBDEF_FindTransportRecByIds(NULL, net_id, onet_id, tran_id);
2977 
2978  FUNCTION_FINISH(ADB_GetTransportFromIds);
2979  return(t_ptr);
2980 }
2981 
2988 void ADB_SetTunedTransport(U8BIT path, void *t_ptr)
2989 {
2990  FUNCTION_START(ADB_SetTunedTransport);
2991 
2993 
2994  DBDEF_SetTunedTransport(path, t_ptr);
2995 
2996  if (t_ptr != NULL)
2997  {
2998  DBDEF_SetTunedNetwork(path, ((ADB_TRANSPORT_REC *)t_ptr)->network);
2999  }
3000  else
3001  {
3002  DBDEF_SetTunedNetwork(path, NULL);
3003  }
3004 
3006 
3007  FUNCTION_FINISH(ADB_SetTunedTransport);
3008 }
3009 
3015 void* ADB_GetTunedTransport(U8BIT path)
3016 {
3017  void *t_ptr;
3018 
3019  FUNCTION_START(ADB_GetTunedTransport);
3020 
3022  t_ptr = (void *)DBDEF_GetTunedTransport(path);
3024 
3025  FUNCTION_FINISH(ADB_GetTunedTransport);
3026 
3027  return(t_ptr);
3028 }
3029 
3030 #if 0
3031 
3035 BOOLEAN ADB_AddAnalogService(void)
3036 {
3037  BOOLEAN success;
3038 
3039  FUNCTION_START(ADB_AddAnalogService);
3040 
3042  success = DBDEF_AddAnalogService();
3044 
3045  FUNCTION_FINISH(ADB_AddAnalogService);
3046  return(success);
3047 }
3048 
3049 #endif
3050 
3062 void *ADB_AddServiceUsingDsd(U8BIT *data, U16BIT service_id)
3063 {
3064  SI_DELIVERY_SYS_DESC_TYPE dsd_type;
3065  SI_DELIVERY_SYS_DESC *dsd;
3066  ADB_TRANSPORT_REC *t_ptr;
3067  ADB_SERVICE_REC *s_ptr = NULL;
3068 
3069  FUNCTION_START(ADB_AddServiceUsingDsd);
3070 
3071  if (service_id != 0 && service_id != ADB_INVALID_DVB_ID &&
3072  STB_SIParseDelSysDesc(data, &dsd_type, &dsd))
3073  {
3075 
3076  switch (dsd_type)
3077  {
3078  case SI_DEL_SYS_DESC_TYPE_TERR:
3079  {
3080  if (dsd->terr.is_t2)
3081  {
3082  if ((dsd->terr.u.t2.num_cells > 0) &&
3083  (dsd->terr.u.t2.cell[0].num_freqs > 0))
3084  {
3085  if ((t_ptr = DBDEF_FindTerrestrialTransportRec(dsd->terr.u.t2.cell[0].freq_hz[0], dsd->terr.u.t2.plp_id)) == NULL)
3086  {
3087  t_ptr = DBDEF_AddTerrestrialTransportRec(dsd->terr.u.t2.cell[0].freq_hz[0], dsd->terr.u.t2.plp_id, NULL);
3088  }
3089  }
3090  }
3091  else
3092  {
3093  if ((t_ptr = DBDEF_FindTerrestrialTransportRec(dsd->terr.u.t1.freq_hz, 0)) == NULL)
3094  {
3095  t_ptr = DBDEF_AddTerrestrialTransportRec(dsd->terr.u.t1.freq_hz, 0, NULL);
3096  }
3097  }
3098  break;
3099  }
3100 
3101  case SI_DEL_SYS_DESC_TYPE_CABLE:
3102  {
3103  if ((t_ptr = DBDEF_FindCableTransportRec(dsd->cable.freq_hz,
3104  dsd->cable.symbol_rate)) == NULL)
3105  {
3106  t_ptr = DBDEF_AddCableTransportRec(dsd->cable.freq_hz, dsd->cable.symbol_rate, NULL);
3107  }
3108  break;
3109  }
3110 
3111  case SI_DEL_SYS_DESC_TYPE_SAT:
3112  {
3113  if ((t_ptr = DBDEF_FindSatTransportRec(dsd->sat.freq_hz, dsd->sat.sym_rate,
3114  dsd->sat.polarity, dsd->sat.dvb_s2, dsd->sat.modulation, NULL)) == NULL)
3115  {
3116  t_ptr = DBDEF_AddSatTransportRec(dsd->sat.freq_hz, dsd->sat.sym_rate,
3117  dsd->sat.polarity, dsd->sat.dvb_s2, dsd->sat.modulation, NULL);
3118  }
3119  break;
3120  }
3121 
3122  default:
3123  {
3124  t_ptr = NULL;
3125  break;
3126  }
3127  }
3128  STB_SIReleaseDelSysDesc(dsd, dsd_type);
3129 
3130  if (t_ptr != NULL)
3131  {
3132  s_ptr = DBDEF_FindServiceRecByIds(NULL, ADB_INVALID_DVB_ID, t_ptr->orig_net_id,
3133  t_ptr->tran_id, service_id);
3134  if (s_ptr == NULL)
3135  {
3136  /* Create a service record */
3137  s_ptr = DBDEF_AddServiceRec(service_id, t_ptr);
3138  if (s_ptr != NULL)
3139  {
3140  /* Make the service hidden and non-selectable so it isn't available to the user */
3141  s_ptr->hidden = TRUE;
3142  DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_HIDDEN, s_ptr->hidden);
3143 
3144  s_ptr->selectable = FALSE;
3145  DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_SELECTABLE, s_ptr->selectable);
3146 
3147  s_ptr->serv_type = ADB_SERVICE_TYPE_DSD;
3148  DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_TYPE, s_ptr->serv_type);
3149 
3150  ADB_SaveDatabase();
3151  }
3152  }
3153  }
3154 
3156  }
3157 
3158  FUNCTION_FINISH(ADB_AddServiceUsingDsd);
3159 
3160  return((void *)s_ptr);
3161 }
3162 
3168 {
3169  U16BIT num_serv;
3170  ADB_SERVICE_REC *s_ptr;
3171 
3172  FUNCTION_START(ADB_GetNumServices);
3173 
3175 
3176  s_ptr = DBDEF_GetNextServiceRec(NULL);
3177  for (num_serv = 0; s_ptr != NULL; s_ptr = DBDEF_GetNextServiceRec(s_ptr))
3178  {
3179  if (s_ptr->found && DBDEF_ServiceInProfile(s_ptr))
3180  {
3181  num_serv++;
3182  }
3183  }
3184 
3186 
3187  FUNCTION_FINISH(ADB_GetNumServices);
3188 
3189  return(num_serv);
3190 }
3191 
3200 U16BIT ADB_GetNumServicesInList(U32BIT list_type, BOOLEAN inc_hidden)
3201 {
3202  U16BIT num_serv;
3203  ADB_SERVICE_REC *s_ptr;
3204  ADB_FAVLIST_REC *fav_list;
3205 
3206  FUNCTION_START(ADB_GetNumServicesInList);
3207 
3208  num_serv = 0;
3209 
3211 
3212  if ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0)
3213  {
3214  if ((fav_list = DBDEF_FindFavouriteList(ADB_FAVLIST_FROM_LIST_TYPE(list_type))) != NULL)
3215  {
3216  num_serv = DBDEF_GetNumServicesInFavouriteList(fav_list);
3217  }
3218  }
3219  else
3220  {
3221  s_ptr = DBDEF_GetNextServiceRec(NULL);
3222  while (s_ptr != NULL)
3223  {
3224  if (CheckServiceInListType(s_ptr, list_type, inc_hidden, FALSE) == TRUE)
3225  {
3226  num_serv++;
3227  }
3228  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
3229  }
3230  }
3231 
3233 
3234  FUNCTION_FINISH(ADB_GetNumServicesInList);
3235 
3236  return(num_serv);
3237 }
3238 
3249 void ADB_GetServiceList(U32BIT list_type, void ***slist_ptr, U16BIT *num_entries_ptr)
3250 {
3251  FUNCTION_START(ADB_GetServiceList);
3252 
3253  GetServiceList(list_type, slist_ptr, num_entries_ptr, FALSE, FALSE);
3254 
3255  FUNCTION_FINISH(ADB_GetServiceList);
3256 }
3257 
3270 void ADB_GetServiceListIncludingHidden(U32BIT list_type, void ***slist_ptr, U16BIT *num_entries_ptr,
3271  BOOLEAN ignore_selectable)
3272 {
3273  FUNCTION_START(ADB_GetServiceListIncludingHidden);
3274 
3275  GetServiceList(list_type, slist_ptr, num_entries_ptr, TRUE, ignore_selectable);
3276 
3277  FUNCTION_FINISH(ADB_GetServiceListIncludingHidden);
3278 }
3279 
3286 U16BIT ADB_GetNumDeletedServices(E_STB_DP_SIGNAL_TYPE tuner_type)
3287 {
3288  U16BIT num_services;
3289 
3290  FUNCTION_START(ADB_GetNumDeletedServices);
3291 
3293  num_services = DBDEF_GetNumDeletedServices(tuner_type);
3295 
3296  FUNCTION_FINISH(ADB_GetNumDeletedServices);
3297 
3298  return(num_services);
3299 }
3300 
3309 U16BIT ADB_GetDeletedServiceList(E_STB_DP_SIGNAL_TYPE tuner_type, void ***slist_ptr)
3310 {
3311  U16BIT num_services;
3312 
3313  FUNCTION_START(ADB_GetDeletedServiceList)
3314 
3316  num_services = DBDEF_GetDeletedServiceList(tuner_type, slist_ptr);
3318 
3319  FUNCTION_FINISH(ADB_GetDeletedServiceList)
3320 
3321  return(num_services);
3322 }
3323 
3332 void ADB_GetTransportServiceList(void *t_ptr, void ***slist_ptr, U16BIT *num_entries_ptr)
3333 {
3334  void **slist;
3335  U16BIT max_no_entries;
3336  U16BIT num_entries;
3337  ADB_SERVICE_REC *s_ptr;
3338  U16BIT i;
3339 
3340  FUNCTION_START(ADB_GetTransportServiceList);
3341 
3343 
3344  num_entries = 0;
3345 
3346  if ((max_no_entries = DBDEF_GetNumServices()) > 0)
3347  {
3348  slist = STB_AppGetMemory(max_no_entries * sizeof(void *));
3349  if (slist != NULL)
3350  {
3351  s_ptr = DBDEF_GetNextServiceRec(NULL);
3352  for (i = 0; ((i < max_no_entries) && (s_ptr != NULL)); i++)
3353  {
3354  if (s_ptr->transport == t_ptr)
3355  {
3356  slist[num_entries] = (void *)s_ptr;
3357  num_entries++;
3358  }
3359  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
3360  }
3361 
3362  if (num_entries == 0)
3363  {
3364  STB_AppFreeMemory(slist);
3365  slist = NULL;
3366  }
3367  }
3368 
3369  *slist_ptr = slist;
3370  }
3371 
3372  *num_entries_ptr = num_entries;
3373 
3375 
3376  FUNCTION_FINISH(ADB_GetTransportServiceList);
3377 }
3378 
3388 void ADB_GetNetworkServiceList(void *n_ptr, void ***slist_ptr, U16BIT *num_entries_ptr)
3389 {
3390  void **slist;
3391  U16BIT max_no_entries;
3392  U16BIT num_entries;
3393  ADB_SERVICE_REC *s_ptr;
3394  ADB_TRANSPORT_REC *t_ptr;
3395  U16BIT i;
3396 
3397  FUNCTION_START(ADB_GetNetworkServiceList);
3398 
3400 
3401  num_entries = 0;
3402 
3403  if ((max_no_entries = DBDEF_GetNumServices()) > 0)
3404  {
3405  slist = STB_AppGetMemory(max_no_entries * sizeof(void *));
3406  if (slist != NULL)
3407  {
3408  s_ptr = DBDEF_GetNextServiceRec(NULL);
3409  for (i = 0; ((i < max_no_entries) && (s_ptr != NULL)); i++)
3410  {
3411  t_ptr = s_ptr->transport;
3412  if (t_ptr != NULL)
3413  {
3414  if (t_ptr->network == n_ptr)
3415  {
3416  slist[num_entries] = (void *)s_ptr;
3417  num_entries++;
3418  }
3419  }
3420  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
3421  }
3422 
3423  if (num_entries == 0)
3424  {
3425  STB_AppFreeMemory(slist);
3426  slist = NULL;
3427  }
3428  }
3429 
3430  *slist_ptr = slist;
3431  }
3432 
3433  *num_entries_ptr = num_entries;
3434 
3436 
3437  FUNCTION_FINISH(ADB_GetNetworkServiceList);
3438 }
3439 
3448 void ADB_GetUnavailableServiceList(void ***slist_ptr, U16BIT *num_entries_ptr)
3449 {
3450  void **slist;
3451  U16BIT max_no_entries;
3452  U16BIT num_entries;
3453  ADB_SERVICE_REC *s_ptr;
3454  U16BIT i;
3455 
3456  FUNCTION_START(ADB_GetUnavailableServiceList);
3457 
3459 
3460  num_entries = 0;
3461 
3462  if ((max_no_entries = DBDEF_GetNumServices()) > 0)
3463  {
3464  slist = STB_AppGetMemory(max_no_entries * sizeof(void *));
3465  if (slist != NULL)
3466  {
3467  s_ptr = DBDEF_GetNextServiceRec(NULL);
3468  for (i = 0; ((i < max_no_entries) && (s_ptr != NULL)); i++)
3469  {
3470  if (s_ptr->unavailable == TRUE)
3471  {
3472  slist[num_entries] = (void *)s_ptr;
3473  num_entries++;
3474  }
3475  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
3476  }
3477 
3478  if (num_entries == 0)
3479  {
3480  STB_AppFreeMemory(slist);
3481  slist = NULL;
3482  }
3483  }
3484 
3485  *slist_ptr = slist;
3486  }
3487 
3488  *num_entries_ptr = num_entries;
3489 
3491 
3492  FUNCTION_FINISH(ADB_GetUnavailableServiceList);
3493 }
3494 
3503 void ADB_GetLockedServiceList(void ***slist_ptr, U16BIT *num_entries_ptr)
3504 {
3505  void **slist;
3506  U16BIT max_no_entries;
3507  U16BIT num_entries;
3508  ADB_SERVICE_REC *s_ptr;
3509  U16BIT i;
3510 
3511  FUNCTION_START(ADB_GetLockedServiceList);
3512 
3514 
3515  num_entries = 0;
3516 
3517  if ((max_no_entries = DBDEF_GetNumServices()) > 0)
3518  {
3519  slist = STB_AppGetMemory(max_no_entries * sizeof(void *));
3520  if (slist != NULL)
3521  {
3522  s_ptr = DBDEF_GetNextServiceRec(NULL);
3523  for (i = 0; ((i < max_no_entries) && (s_ptr != NULL)); i++)
3524  {
3525  if (s_ptr->locked)
3526  {
3527  slist[num_entries] = (void *)s_ptr;
3528  num_entries++;
3529  }
3530  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
3531  }
3532 
3533  if (num_entries == 0)
3534  {
3535  STB_AppFreeMemory(slist);
3536  slist = NULL;
3537  }
3538  }
3539 
3540  *slist_ptr = slist;
3541  }
3542 
3543  *num_entries_ptr = num_entries;
3544 
3546 
3547  FUNCTION_FINISH(ADB_GetLockedServiceList);
3548 }
3549 
3556 void ADB_ReleaseServiceList(void **slist, U16BIT num_servs)
3557 {
3558  FUNCTION_START(ADB_ReleaseServiceList);
3559 
3560  USE_UNWANTED_PARAM(num_servs);
3561 
3562  if (slist != NULL)
3563  {
3564  STB_AppFreeMemory(slist);
3565  }
3566 
3567  FUNCTION_FINISH(ADB_ReleaseServiceList);
3568 }
3569 
3578 void ADB_GetServiceListLockedSubset(void **slist, U16BIT num_entries,
3579  void ***locked_slist_ptr, U16BIT *locked_num_entries_ptr)
3580 {
3581  void **new_slist;
3582  U16BIT new_num_entries;
3583  ADB_SERVICE_REC *s_ptr;
3584  U16BIT i;
3585 
3586  FUNCTION_START(ADB_GetServiceListLockedSubset);
3587 
3589 
3590  if (slist != NULL)
3591  {
3592  new_slist = STB_AppGetMemory(num_entries * sizeof(void *));
3593  new_num_entries = 0;
3594  if (new_slist != NULL)
3595  {
3596  for (i = 0; i < num_entries; i++)
3597  {
3598  s_ptr = slist[i];
3599  if (s_ptr != NULL)
3600  {
3601  if (s_ptr->locked)
3602  {
3603  new_slist[new_num_entries] = (void *)s_ptr;
3604  new_num_entries++;
3605  }
3606  }
3607  }
3608 
3609  // if there are no locked entries free the new list and return NULL
3610  if (new_num_entries == 0)
3611  {
3612  STB_AppFreeMemory(new_slist);
3613  new_slist = NULL;
3614  }
3615  }
3616 
3617  *locked_slist_ptr = new_slist;
3618  *locked_num_entries_ptr = new_num_entries;
3619  }
3620 
3622 
3623  FUNCTION_FINISH(ADB_GetServiceListLockedSubset);
3624 }
3625 
3632 void ADB_SortServiceListAlphabetically(void **slist, U16BIT num_entries, BOOLEAN short_name)
3633 {
3634  U16BIT i, j;
3635  U8BIT *name1;
3636  U8BIT *name2;
3637  void *tmp;
3638 
3639  FUNCTION_START(ADB_SortServiceListAlphabetically);
3640 
3641  if (slist != NULL)
3642  {
3643  for (i = 0; i < num_entries - 1; i++)
3644  {
3645  for (j = i + 1; j < num_entries; j++)
3646  {
3647  if (short_name)
3648  {
3649  name1 = ADB_GetServiceShortName(slist[i], FALSE);
3650  name2 = ADB_GetServiceShortName(slist[j], FALSE);
3651  }
3652  else
3653  {
3654  name1 = ADB_GetServiceFullName(slist[i], FALSE);
3655  name2 = ADB_GetServiceFullName(slist[j], FALSE);
3656  }
3657 
3658  if (STB_CompareUnicodeStrings(name1, name2, TRUE, FALSE) > 0)
3659  {
3660  /* Swap items */
3661  tmp = slist[i];
3662  slist[i] = slist[j];
3663  slist[j] = tmp;
3664  }
3665  }
3666  }
3667  }
3668 
3669  FUNCTION_FINISH(ADB_SortServiceListAlphabetically);
3670 }
3671 
3677 BOOLEAN ADB_IsValidService(void *serv_ptr)
3678 {
3679  BOOLEAN retval;
3680  ADB_SERVICE_REC *s_ptr;
3681 
3682  FUNCTION_START(ADB_IsValidService);
3683 
3684  retval = FALSE;
3685 
3687  s_ptr = DBDEF_GetNextServiceRec(NULL);
3688  while (!retval && (s_ptr != NULL))
3689  {
3690  if (s_ptr == serv_ptr)
3691  {
3692  retval = TRUE;
3693  }
3694  else
3695  {
3696  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
3697  }
3698  }
3700 
3701  FUNCTION_FINISH(ADB_IsValidService);
3702 
3703  return(retval);
3704 }
3705 
3713 E_STB_DP_SIGNAL_TYPE ADB_GetServiceSignalType(void *s_ptr, BOOLEAN *is_sig2)
3714 {
3715  E_STB_DP_SIGNAL_TYPE result;
3716  ADB_TRANSPORT_REC *t_ptr;
3717 
3718  FUNCTION_START(ADB_GetServiceSignalType);
3719 
3720  result = SIGNAL_NONE;
3721  if (s_ptr != NULL)
3722  {
3724  t_ptr = ((ADB_SERVICE_REC *)s_ptr)->transport;
3725  if (t_ptr != NULL)
3726  {
3727  result = t_ptr->sig_type;
3728  switch (t_ptr->sig_type)
3729  {
3730  case SIGNAL_QPSK:
3731  {
3732  *is_sig2 = t_ptr->u.sat.dvb_s2;
3733  break;
3734  }
3735  case SIGNAL_COFDM:
3736  {
3737  *is_sig2 = (t_ptr->u.terr.terr_type == TERR_TYPE_DVBT2)? TRUE : FALSE;
3738  break;
3739  }
3740  case SIGNAL_QAM:
3741  {
3742  *is_sig2 = FALSE;
3743  break;
3744  }
3745  default:
3746  {
3747  *is_sig2 = FALSE;
3748  }
3749  }
3750  }
3752  }
3753 
3754  FUNCTION_FINISH(ADB_GetServiceSignalType);
3755 
3756  return result;
3757 }
3758 
3767 void* ADB_GetNextServiceInList(U32BIT list_type, void *serv)
3768 {
3769  ADB_SERVICE_REC *s_ptr;
3770  ADB_FAVLIST_REC *fav_list;
3771  ADB_FAVSERV_REC *fav_serv;
3772 
3773  FUNCTION_START(ADB_GetNextServiceInList);
3774 
3776 
3777  s_ptr = NULL;
3778  fav_list = NULL;
3779  fav_serv = NULL;
3780 
3781  // find next service and check it is in the required list]
3782  if ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0)
3783  {
3784  if ((fav_list = DBDEF_FindFavouriteList(ADB_FAVLIST_FROM_LIST_TYPE(list_type))) != NULL)
3785  {
3786  /* The service may be NULL, in which case the favourite service will also be NULL
3787  * and this is ok because it means to get the first service in the list */
3788  fav_serv = DBDEF_FindServiceInFavouriteList(fav_list, serv);
3789 
3790  if ((fav_serv = DBDEF_GetNextServiceFromFavouriteList(fav_list, fav_serv)) != NULL)
3791  {
3792  s_ptr = fav_serv->serv_ptr;
3793  }
3794  }
3795  }
3796  else
3797  {
3798  s_ptr = DBDEF_GetNextServiceRec(serv);
3799  }
3800 
3801  while (s_ptr != NULL)
3802  {
3803  if (CheckServiceInListType(s_ptr, list_type, FALSE, FALSE) == TRUE)
3804  {
3805  if (ACFG_IsNordigCountry())
3806  {
3807  if (HasNordigSimulcastService(s_ptr) == FALSE)
3808  {
3809  break;
3810  }
3811  }
3812  else
3813  {
3814  break;
3815  }
3816  }
3817 
3818  if ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0)
3819  {
3820  if ((fav_serv = DBDEF_GetNextServiceFromFavouriteList(fav_list, fav_serv)) != NULL)
3821  {
3822  s_ptr = fav_serv->serv_ptr;
3823  }
3824  else
3825  {
3826  s_ptr = NULL;
3827  }
3828  }
3829  else
3830  {
3831  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
3832  }
3833  }
3834 
3836 
3837  FUNCTION_FINISH(ADB_GetNextServiceInList);
3838 
3839  return((void *)s_ptr);
3840 }
3841 
3850 void* ADB_GetPrevServiceInList(U32BIT list_type, void *serv)
3851 {
3852  ADB_SERVICE_REC *s_ptr;
3853  ADB_FAVLIST_REC *fav_list;
3854  ADB_FAVSERV_REC *fav_serv;
3855 
3856  FUNCTION_START(ADB_GetPrevServiceInList);
3857 
3859 
3860  s_ptr = NULL;
3861  fav_list = NULL;
3862  fav_serv = NULL;
3863 
3864  // find next service and check it is in the required list
3865  if ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0)
3866  {
3867  if ((fav_list = DBDEF_FindFavouriteList(ADB_FAVLIST_FROM_LIST_TYPE(list_type))) != NULL)
3868  {
3869  /* The service may be NULL, in which case the favourite service will also be NULL
3870  * and this is ok because it means to get the first service in the list */
3871  fav_serv = DBDEF_FindServiceInFavouriteList(fav_list, serv);
3872 
3873  if ((fav_serv = DBDEF_GetPrevServiceFromFavouriteList(fav_list, fav_serv)) != NULL)
3874  {
3875  s_ptr = fav_serv->serv_ptr;
3876  }
3877  }
3878  }
3879  else
3880  {
3881  s_ptr = DBDEF_GetPrevServiceRec(serv);
3882  }
3883 
3884  while (s_ptr != NULL)
3885  {
3886  if (CheckServiceInListType(s_ptr, list_type, FALSE, FALSE) == TRUE)
3887  {
3888  if (ACFG_IsNordigCountry())
3889  {
3890  if (HasNordigSimulcastService(s_ptr) == FALSE)
3891  {
3892  break;
3893  }
3894  }
3895  else
3896  {
3897  break;
3898  }
3899  }
3900 
3901  if ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0)
3902  {
3903  if ((fav_serv = DBDEF_GetPrevServiceFromFavouriteList(fav_list, fav_serv)) != NULL)
3904  {
3905  s_ptr = fav_serv->serv_ptr;
3906  }
3907  else
3908  {
3909  s_ptr = NULL;
3910  }
3911  }
3912  else
3913  {
3914  s_ptr = DBDEF_GetPrevServiceRec(s_ptr);
3915  }
3916  }
3917 
3919 
3920  FUNCTION_FINISH(ADB_GetPrevServiceInList);
3921 
3922  return((void *)s_ptr);
3923 }
3924 
3934 void* ADB_FindServiceByLcn(U32BIT list_type, U16BIT lcn, BOOLEAN show_unselectable)
3935 {
3936  ADB_SERVICE_REC *s_ptr;
3937  ADB_FAVLIST_REC *fav_list;
3938  ADB_FAVSERV_REC *fav_serv;
3939 
3940  FUNCTION_START(ADB_FindServiceByLcn);
3941 
3943 
3944  s_ptr = NULL;
3945  fav_list = NULL;
3946  fav_serv = NULL;
3947 
3948  // find required lcn
3949  if ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0)
3950  {
3951  if ((fav_list = DBDEF_FindFavouriteList(ADB_FAVLIST_FROM_LIST_TYPE(list_type))) != NULL)
3952  {
3953  if ((fav_serv = DBDEF_GetNextServiceFromFavouriteList(fav_list, NULL)) != NULL)
3954  {
3955  s_ptr = fav_serv->serv_ptr;
3956  }
3957  }
3958  }
3959  else
3960  {
3961  s_ptr = DBDEF_GetNextServiceRec(NULL);
3962  }
3963 
3964  while (s_ptr != NULL)
3965  {
3966  if (ACFG_IsNordigCountry())
3967  {
3968  /* for Nordig, we need to check the service type as well */
3969  if ((s_ptr->allocated_lcn == lcn) &&
3970  ((list_type == ADB_SERVICE_LIST_ALL) || (list_type == s_ptr->serv_type) ||
3971  ((list_type & ADB_FAV_SERVICE_LIST_TYPE) != 0) ||
3972  ((list_type == ADB_SERVICE_LIST_TV) && ((s_ptr->serv_type == ADB_SERVICE_TYPE_AVC_SD_TV) ||
3973  (s_ptr->serv_type == ADB_SERVICE_TYPE_HD_TV) ||
3974  (s_ptr->serv_type == ADB_SERVICE_TYPE_MPEG2_HD) ||
3975  (s_ptr->serv_type == ADB_SERVICE_TYPE_UHD_TV))) ||
3976  ((list_type == ADB_SERVICE_LIST_RADIO) && (s_ptr->serv_type == ADB_SERVICE_TYPE_AVC_RADIO))))
3977  {
3978  if (HasNordigSimulcastService(s_ptr) == FALSE)
3979  {
3980  break;
3981  }
3982  }
3983  }
3984  else if (s_ptr->allocated_lcn == lcn)
3985  {
3986  break;
3987  }
3988 
3989  if ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0)
3990  {
3991  if ((fav_serv = DBDEF_GetNextServiceFromFavouriteList(fav_list, fav_serv)) != NULL)
3992  {
3993  s_ptr = fav_serv->serv_ptr;
3994  }
3995  else
3996  {
3997  s_ptr = NULL;
3998  }
3999  }
4000  else
4001  {
4002  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
4003  }
4004  }
4005 
4006  // check service matching reqd lcn is in the required list
4007  if (CheckServiceInListType(s_ptr, list_type, TRUE, show_unselectable) == FALSE)
4008  {
4009  s_ptr = NULL;
4010  }
4011 
4013 
4014  FUNCTION_FINISH(ADB_FindServiceByLcn);
4015 
4016  return((void *)s_ptr);
4017 }
4018 
4026 void* ADB_FindServiceByNearestLcn(U32BIT list_type, U16BIT lcn)
4027 {
4028  ADB_SERVICE_REC *s_ptr;
4029  ADB_SERVICE_REC *last_valid_s_ptr;
4030 
4031  FUNCTION_START(ADB_FindServiceByNearestLcn);
4032 
4033  last_valid_s_ptr = NULL;
4034 
4036 
4037  s_ptr = DBDEF_GetPrevServiceRec(NULL);
4038  while (s_ptr != NULL)
4039  {
4040  if (CheckServiceInListType(s_ptr, list_type, FALSE, FALSE) == TRUE)
4041  {
4042  last_valid_s_ptr = s_ptr;
4043  if (s_ptr->allocated_lcn <= lcn)
4044  {
4045  break; //break out of the while loop
4046  }
4047  }
4048 
4049  s_ptr = DBDEF_GetPrevServiceRec(s_ptr);
4050  }
4051 
4053 
4054  if (s_ptr == NULL)
4055  {
4056  s_ptr = last_valid_s_ptr;
4057  }
4058 
4059  FUNCTION_FINISH(ADB_FindServiceByNearestLcn);
4060 
4061  return((void *)s_ptr);
4062 }
4063 
4071 void* ADB_FindServiceByIds(U16BIT onet_id, U16BIT tid, U16BIT sid)
4072 {
4073  ADB_SERVICE_REC *s_ptr;
4074 
4075  FUNCTION_START(ADB_FindServiceByIds);
4076 
4078 
4079  s_ptr = DBDEF_FindServiceRecByIds(NULL, ADB_INVALID_DVB_ID, onet_id, tid, sid);
4080 
4082 
4083  FUNCTION_FINISH(ADB_FindServiceByIds);
4084 
4085  return((void *)s_ptr);
4086 }
4087 
4095 U16BIT ADB_FindLcnInServiceList(U16BIT lcn, void **slist_ptr, U16BIT num_entries)
4096 {
4097  U16BIT i;
4098  ADB_SERVICE_REC *s_ptr;
4099 
4100  FUNCTION_START(ADB_FindLcnInServiceList);
4101 
4102  if ((slist_ptr == NULL) || (num_entries == 0) || (lcn == 0))
4103  {
4104  i = num_entries;
4105  }
4106  else
4107  {
4109  for (i = 0; i < num_entries; i++)
4110  {
4111  s_ptr = (ADB_SERVICE_REC *)slist_ptr[i];
4112  if (s_ptr->allocated_lcn == lcn)
4113  {
4114  break;
4115  }
4116  }
4118  }
4119 
4120  FUNCTION_FINISH(ADB_FindLcnInServiceList);
4121 
4122  return(i);
4123 }
4124 
4133 U16BIT ADB_FindNearestLcnInServiceList(U16BIT lcn, void **slist_ptr, U16BIT num_entries)
4134 {
4135  U16BIT i;
4136  ADB_SERVICE_REC *s_ptr;
4137 
4138  FUNCTION_START(ADB_FindNearestLcnInServiceList);
4139 
4140  if ((slist_ptr == NULL) || (num_entries == 0) || (lcn == 0))
4141  {
4142  i = 0;
4143  }
4144  else
4145  {
4147  for (i = num_entries - 1; i > 0; i--)
4148  {
4149  s_ptr = (ADB_SERVICE_REC *)(*(slist_ptr + i));
4150  if (s_ptr->allocated_lcn <= lcn)
4151  {
4152  break;
4153  }
4154  }
4156  }
4157 
4158  FUNCTION_FINISH(ADB_FindNearestLcnInServiceList);
4159 
4160  return(i);
4161 }
4162 
4170 U16BIT ADB_FindServiceInList(void *s_ptr, void **slist_ptr, U16BIT num_entries)
4171 {
4172  U16BIT i;
4173 
4174  FUNCTION_START(ADB_FindServiceInList);
4175 
4176  if ((slist_ptr == NULL) || (num_entries == 0) || (s_ptr == NULL))
4177  {
4178  i = num_entries;
4179  }
4180  else
4181  {
4182  for (i = 0; i < num_entries; i++)
4183  {
4184  if (s_ptr == slist_ptr[i])
4185  {
4186  break;
4187  }
4188  }
4189  }
4190 
4191  FUNCTION_FINISH(ADB_FindServiceInList);
4192 
4193  return(i);
4194 }
4195 
4204 U8BIT** ADB_GetServiceListFullNames(void **slist, U16BIT num_entries, BOOLEAN use_pref_names)
4205 {
4206  ADB_STRING *name_str;
4207  U16BIT nchar;
4208  U8BIT **names_array;
4209  U16BIT i;
4210 
4211  FUNCTION_START(ADB_GetServiceListFullNames);
4212 
4213  if (slist != NULL)
4214  {
4216  names_array = STB_AppGetMemory(num_entries * sizeof(U8BIT *));
4217  if (names_array != NULL)
4218  {
4219  for (i = 0; i < num_entries; i++)
4220  {
4221  name_str = DBDEF_GetServiceName((ADB_SERVICE_REC *)slist[i], FALSE, use_pref_names);
4222  if (name_str != NULL)
4223  {
4224  names_array[i] = STB_ConvertStringToUTF8(name_str->str_ptr, &nchar, FALSE,
4225  name_str->lang_code);
4226  }
4227  else
4228  {
4229  names_array[i] = NULL;
4230  }
4231  }
4232  }
4234  }
4235  else
4236  {
4237  names_array = NULL;
4238  }
4239 
4240  FUNCTION_FINISH(ADB_GetServiceListFullNames);
4241 
4242  return(names_array);
4243 }
4244 
4254 U8BIT** ADB_GetServiceListShortNames(void **slist, U16BIT num_entries, BOOLEAN use_pref_names)
4255 {
4256  ADB_STRING *name_str;
4257  U8BIT **names_array;
4258  U16BIT i;
4259 
4260  FUNCTION_START(ADB_GetServiceListShortNames);
4261 
4262  if (slist != NULL)
4263  {
4265  names_array = STB_AppGetMemory(num_entries * sizeof(U8BIT *));
4266  if (names_array != NULL)
4267  {
4268  for (i = 0; i < num_entries; i++)
4269  {
4270  name_str = DBDEF_GetServiceName((ADB_SERVICE_REC *)slist[i], TRUE, use_pref_names);
4271  if (name_str != NULL)
4272  {
4273  names_array[i] = ExtractShortName(name_str);
4274  }
4275  else
4276  {
4277  names_array[i] = NULL;
4278  }
4279  }
4280  }
4282  }
4283  else
4284  {
4285  names_array = NULL;
4286  }
4287 
4288  FUNCTION_FINISH(ADB_GetServiceListShortNames);
4289 
4290  return(names_array);
4291 }
4292 
4301 U16BIT* ADB_GetServiceListLcns(void **slist, U16BIT num_entries)
4302 {
4303  U16BIT *lcn_array;
4304  U16BIT i;
4305 
4306  FUNCTION_START(ADB_GetServiceListLcns);
4307 
4308  if (slist != NULL)
4309  {
4311  lcn_array = STB_AppGetMemory(num_entries * sizeof(U16BIT));
4312  if (lcn_array != NULL)
4313  {
4314  for (i = 0; i < num_entries; i++)
4315  {
4316  lcn_array[i] = GetServiceLcn((ADB_SERVICE_REC *)(slist[i]));
4317  }
4318  }
4320  }
4321  else
4322  {
4323  lcn_array = NULL;
4324  }
4325 
4326  FUNCTION_FINISH(ADB_GetServiceListLcns);
4327 
4328  return(lcn_array);
4329 }
4330 
4339 U16BIT* ADB_GetServiceListOrigLcns(void **slist, U16BIT num_entries)
4340 {
4341  U16BIT *lcn_array;
4342  U16BIT i;
4343 
4344  FUNCTION_START(ADB_GetServiceListOrigLcns);
4345 
4346  if (slist != NULL)
4347  {
4349  lcn_array = STB_AppGetMemory(num_entries * sizeof(U16BIT));
4350  if (lcn_array != NULL)
4351  {
4352  for (i = 0; i < num_entries; i++)
4353  {
4354  lcn_array[i] = ((ADB_SERVICE_REC *)slist[i])->serv_lcn;
4355  }
4356  }
4358  }
4359  else
4360  {
4361  lcn_array = NULL;
4362  }
4363 
4364  FUNCTION_FINISH(ADB_GetServiceListOrigLcns);
4365 
4366  return(lcn_array);
4367 }
4368 
4369 #if 0
4370 
4384 U32BIT* ADB_GetServiceListSIDs(void **slist, U16BIT num_entries)
4385 {
4386  U32BIT *sid_array;
4387  U16BIT i;
4388 
4389  FUNCTION_START(ADB_GetServiceListSIDs);
4390 
4391  if (slist != NULL)
4392  {
4394  sid_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
4395  if (sid_array != NULL)
4396  {
4397  for (i = 0; i < num_entries; i++)
4398  {
4399  sid_array[i] = (U32BIT)GetServiceId((ADB_SERVICE_REC *)(slist[i]));
4400  }
4401  }
4403  }
4404  else
4405  {
4406  sid_array = NULL;
4407  }
4408  FUNCTION_FINISH(ADB_GetServiceListSIDs);
4409  return(sid_array);
4410 }
4411 
4412 #endif
4413 
4423 U32BIT* ADB_GetServiceListUnavailableFlag(void **slist, U16BIT num_entries)
4424 {
4425  U32BIT *unavail_array;
4426  U16BIT i;
4427 
4428  FUNCTION_START(ADB_GetServiceListUnavailableFlag);
4429 
4430  if (slist != NULL)
4431  {
4433  unavail_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
4434  if (unavail_array != NULL)
4435  {
4436  for (i = 0; i < num_entries; i++)
4437  {
4438  unavail_array[i] = (U32BIT)GetServiceUnavailFlag((ADB_SERVICE_REC *)(slist[i]));
4439  }
4440  }
4442  }
4443  else
4444  {
4445  unavail_array = NULL;
4446  }
4447 
4448  FUNCTION_FINISH(ADB_GetServiceListUnavailableFlag);
4449 
4450  return(unavail_array);
4451 }
4452 
4463 U32BIT* ADB_GetServiceListNewFlag(void **slist, U16BIT num_entries)
4464 {
4465  U32BIT *new_array;
4466  U16BIT i;
4467 
4468  FUNCTION_START(ADB_GetServiceListNewFlag);
4469 
4470  if (slist != NULL)
4471  {
4473  new_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
4474  if (new_array != NULL)
4475  {
4476  for (i = 0; i < num_entries; i++)
4477  {
4478  new_array[i] = (U32BIT)GetServiceNewFlag((ADB_SERVICE_REC *)(slist[i]));
4479  }
4480  }
4482  }
4483  else
4484  {
4485  new_array = NULL;
4486  }
4487 
4488  FUNCTION_FINISH(ADB_GetServiceListNewFlag);
4489 
4490  return(new_array);
4491 }
4492 
4503 U32BIT* ADB_GetServiceListLockedFlag(void **slist, U16BIT num_entries)
4504 {
4505  U32BIT *lock_array;
4506  U16BIT i;
4507 
4508  FUNCTION_START(ADB_GetServiceListlockedFlag);
4509 
4510  if (slist != NULL)
4511  {
4513  lock_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
4514  if (lock_array != NULL)
4515  {
4516  for (i = 0; i != num_entries; i++)
4517  {
4518  lock_array[i] = (U32BIT)((ADB_SERVICE_REC *)slist[i])->locked;
4519  }
4520  }
4522  }
4523  else
4524  {
4525  lock_array = NULL;
4526  }
4527 
4528  FUNCTION_FINISH(ADB_GetServiceListlockedFlag);
4529 
4530  return(lock_array);
4531 }
4532 
4542 U32BIT* ADB_GetServiceListScrambledFlag(void **slist, U16BIT num_entries)
4543 {
4544  U32BIT *scrambled_array;
4545  U16BIT i;
4546 
4547  FUNCTION_START(ADB_GetServiceListScrambledFlag);
4548 
4549  if (slist != NULL)
4550  {
4552  scrambled_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
4553  if (scrambled_array != NULL)
4554  {
4555  for (i = 0; i < num_entries; i++)
4556  {
4557  scrambled_array[i] = (U32BIT)(((ADB_SERVICE_REC *)slist[i])->scrambled);
4558  }
4559  }
4561  }
4562  else
4563  {
4564  scrambled_array = NULL;
4565  }
4566 
4567  FUNCTION_FINISH(ADB_GetServiceListScrambledFlag);
4568 
4569  return(scrambled_array);
4570 }
4571 
4581 U32BIT* ADB_GetServiceListHdFlag(void **slist, U16BIT num_entries)
4582 {
4583  U32BIT *hd_array;
4584  U16BIT i;
4585 
4586  FUNCTION_START(ADB_GetServiceListHdFlag);
4587 
4588  if (slist != NULL)
4589  {
4591  hd_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
4592  if (hd_array != NULL)
4593  {
4594  for (i = 0; i < num_entries; i++)
4595  {
4596  if ((((ADB_SERVICE_REC *)slist[i])->serv_type == ADB_SERVICE_TYPE_HD_TV) ||
4597  (((ADB_SERVICE_REC *)slist[i])->serv_type == ADB_SERVICE_TYPE_MPEG2_HD) ||
4598  (((ADB_SERVICE_REC *)slist[i])->serv_type == ADB_SERVICE_TYPE_UHD_TV))
4599  {
4600  hd_array[i] = 1;
4601  }
4602  else
4603  {
4604  hd_array[i] = 0;
4605  }
4606  }
4607  }
4609  }
4610  else
4611  {
4612  hd_array = NULL;
4613  }
4614 
4615  FUNCTION_FINISH(ADB_GetServiceListHdFlag);
4616 
4617  return(hd_array);
4618 }
4619 
4626 void ADB_SetServiceListLockedFlag(void **slist, U16BIT num_entries, BOOLEAN locked)
4627 {
4628  U16BIT i;
4629  ADB_SERVICE_REC *s_ptr;
4630 
4631  FUNCTION_START(ADB_SetServiceListLockedFlag);
4632 
4633  if (slist != NULL)
4634  {
4636 
4637  for (i = 0; i != num_entries; i++)
4638  {
4639  s_ptr = (ADB_SERVICE_REC *)slist[i];
4640 
4641  s_ptr->locked = locked;
4642  DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_LOCKED, locked);
4643  DBA_SaveRecord(s_ptr->dba_rec);
4644  }
4645 
4647  }
4648 
4649  FUNCTION_FINISH(ADB_SetServiceListLockedFlag);
4650 }
4651 
4661 U32BIT* ADB_GetServiceListHiddenFlag(void **slist, U16BIT num_entries)
4662 {
4663  U32BIT *hidden_array;
4664  U16BIT i;
4665 
4666  FUNCTION_START(ADB_GetServiceListHiddenFlag);
4667 
4668  if (slist != NULL)
4669  {
4671  hidden_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
4672  if (hidden_array != NULL)
4673  {
4674  for (i = 0; i != num_entries; i++)
4675  {
4676  hidden_array[i] = (U32BIT)(((ADB_SERVICE_REC *)slist[i])->hidden);
4677  }
4678  }
4680  }
4681  else
4682  {
4683  hidden_array = NULL;
4684  }
4685 
4686  FUNCTION_FINISH(ADB_GetServiceListHiddenFlag);
4687 
4688  return(hidden_array);
4689 }
4690 
4699 U8BIT** ADB_GetServiceListNetworkNames(void **slist, U16BIT num_entries)
4700 {
4701  U8BIT **names_array;
4702  U16BIT i;
4703  ADB_TRANSPORT_REC *t_ptr;
4704 
4705  FUNCTION_START(ADB_GetServiceListNetworkNames);
4706 
4707  if (slist != NULL)
4708  {
4710  names_array = STB_AppGetMemory(num_entries * sizeof(U8BIT *));
4711  if (names_array != NULL)
4712  {
4713  for (i = 0; i < num_entries; i++)
4714  {
4715  t_ptr = ((ADB_SERVICE_REC *)slist[i])->transport;
4716  if (t_ptr == NULL || t_ptr->network == NULL)
4717  {
4718  names_array[i] = NULL;
4719  }
4720  else
4721  {
4722  names_array[i] = GetNetworkName(t_ptr->network, FALSE);
4723  }
4724  }
4725  }
4727  }
4728  else
4729  {
4730  names_array = NULL;
4731  }
4732 
4733  FUNCTION_FINISH(ADB_GetServiceListNetworkNames);
4734 
4735  return(names_array);
4736 }
4737 
4746 U8BIT** ADB_GetServiceListTransportNames(void **slist, U16BIT num_entries)
4747 {
4748  U8BIT **names_array;
4749  U16BIT i;
4750  ADB_TRANSPORT_REC *t_ptr;
4751 
4752  FUNCTION_START(ADB_GetServiceListTransportNames);
4753 
4754  if (slist != NULL)
4755  {
4757  names_array = STB_AppGetMemory(num_entries * sizeof(U8BIT *));
4758  if (names_array != NULL)
4759  {
4760  for (i = 0; i < num_entries; i++)
4761  {
4762  t_ptr = ((ADB_SERVICE_REC *)slist[i])->transport;
4763 
4764  names_array[i] = GetTransportName(t_ptr);
4765  }
4766  }
4768  }
4769  else
4770  {
4771  names_array = NULL;
4772  }
4773 
4774  FUNCTION_FINISH(ADB_GetServiceListTransportNames);
4775 
4776  return(names_array);
4777 }
4778 
4787 U32BIT* ADB_GetServiceListTransportStrengths(void **slist, U16BIT num_entries)
4788 {
4789  U32BIT *tp_strength_array;
4790  U16BIT i;
4791  ADB_TRANSPORT_REC *t_ptr;
4792 
4793  FUNCTION_START(ADB_GetServiceListTransportStrengths);
4794 
4795  if (slist != NULL)
4796  {
4798  tp_strength_array = STB_AppGetMemory(num_entries * sizeof(U32BIT));
4799  if (tp_strength_array != NULL)
4800  {
4801  for (i = 0; i < num_entries; i++)
4802  {
4803  t_ptr = ((ADB_SERVICE_REC *)slist[i])->transport;
4804  if (t_ptr != NULL)
4805  {
4806  tp_strength_array[i] = (U32BIT)GetTransportTunedStrength(t_ptr);
4807  }
4808  else
4809  {
4810  tp_strength_array[i] = 0xff;
4811  }
4812  }
4813  }
4815  }
4816  else
4817  {
4818  tp_strength_array = NULL;
4819  }
4820 
4821  FUNCTION_FINISH(ADB_GetServiceListTransportStrengths);
4822 
4823  return(tp_strength_array);
4824 }
4825 
4833 U8BIT* ADB_GetServiceFullName(void *s_ptr, BOOLEAN use_pref_name)
4834 {
4835  ADB_STRING *name_str;
4836  U16BIT nchar;
4837  U8BIT *retval;
4838 
4839  FUNCTION_START(ADB_GetServiceFullName);
4840 
4841  retval = NULL;
4842 
4844 
4845  if ((name_str = DBDEF_GetServiceName((ADB_SERVICE_REC *)s_ptr, FALSE, use_pref_name)) != NULL)
4846  {
4847  retval = STB_ConvertStringToUTF8(name_str->str_ptr, &nchar, FALSE, name_str->lang_code);
4848  }
4849 
4851 
4852  FUNCTION_FINISH(ADB_GetServiceFullName);
4853 
4854  return(retval);
4855 }
4856 
4864 U8BIT* ADB_GetServiceShortName(void *s_ptr, BOOLEAN use_pref_name)
4865 {
4866  ADB_STRING *name_str;
4867  U8BIT *retval;
4868 
4869  FUNCTION_START(ADB_GetServiceShortName);
4870 
4871  retval = NULL;
4872 
4874 
4875  if ((name_str = DBDEF_GetServiceName((ADB_SERVICE_REC *)s_ptr, TRUE, use_pref_name)) != NULL)
4876  {
4877  retval = ExtractShortName(name_str);
4878  }
4879 
4881 
4882  FUNCTION_FINISH(ADB_GetServiceShortName);
4883 
4884  return(retval);
4885 }
4886 
4896 U8BIT* ADB_GetServiceFullNameByLangAndPrefId(void *s_ptr, U8BIT lang, U8BIT pref_name_id)
4897 {
4898  U8BIT *name_str;
4899 
4900  FUNCTION_START(ADB_GetServiceFullNameByLangAndPrefId);
4901 
4903  name_str = GetServiceNameByLangAndPrefId((ADB_SERVICE_REC *)s_ptr, lang, pref_name_id, FALSE);
4905 
4906  FUNCTION_FINISH(ADB_GetServiceFullNameByLangAndPrefId);
4907 
4908  return(name_str);
4909 }
4910 
4920 U8BIT* ADB_GetServiceShortNameByLangAndPrefId(void *s_ptr, U8BIT lang, U8BIT pref_name_id)
4921 {
4922  U8BIT *name_str;
4923 
4925 
4927  name_str = GetServiceNameByLangAndPrefId((ADB_SERVICE_REC *)s_ptr, lang, pref_name_id, TRUE);
4929 
4930  FUNCTION_FINISH(ADB_GetServiceShortNameByLangAndPrefId);
4931 
4932  return(name_str);
4933 }
4934 
4940 U16BIT ADB_GetServiceLcn(void *s_ptr)
4941 {
4942  U16BIT lcn_value;
4943 
4944  FUNCTION_START(ADB_GetServiceLcn);
4945 
4947  lcn_value = GetServiceLcn((ADB_SERVICE_REC *)s_ptr);
4949 
4950  FUNCTION_FINISH(ADB_GetServiceLcn);
4951 
4952  return(lcn_value);
4953 }
4954 
4960 U16BIT ADB_GetServiceId(void *s_ptr)
4961 {
4962  U16BIT sid_value;
4963 
4964  FUNCTION_START(ADB_GetServiceId);
4965 
4967  sid_value = GetServiceId((ADB_SERVICE_REC *)s_ptr);
4969 
4970  FUNCTION_FINISH(ADB_GetServiceId);
4971 
4972  return(sid_value);
4973 }
4974 
4982 void ADB_GetServiceIds(void *s_ptr, U16BIT *onet_id, U16BIT *trans_id, U16BIT *serv_id)
4983 {
4984  ADB_TRANSPORT_REC *t_ptr;
4985 
4986  FUNCTION_START(ADB_GetServiceIds);
4987 
4989 
4990  *serv_id = ((ADB_SERVICE_REC *)s_ptr)->serv_id;
4991 
4992  t_ptr = ((ADB_SERVICE_REC *)s_ptr)->transport;
4993  if (t_ptr != NULL)
4994  {
4995  *trans_id = t_ptr->tran_id;
4996  *onet_id = t_ptr->orig_net_id;
4997  }
4998  else
4999  {
5000  *trans_id = ADB_INVALID_DVB_ID;
5001  *onet_id = ADB_INVALID_DVB_ID;
5002  }
5003 
5005 
5006  FUNCTION_FINISH(ADB_GetServiceIds);
5007 }
5008 
5015 void ADB_SetServiceScheduleState(void *s_ptr, BOOLEAN state)
5016 {
5017  ADB_SERVICE_REC *serv_ptr = (ADB_SERVICE_REC *)s_ptr;
5018 
5019  FUNCTION_START(ADB_SetServiceScheduleState);
5020 
5021  if (s_ptr != NULL)
5022  {
5024 
5025  serv_ptr->sched_disabled = !state;
5026  DBA_SetFieldValue(serv_ptr->dba_rec, DBA_FIELD_SERV_SCHED_DISABLED, serv_ptr->sched_disabled);
5027 
5028  if (serv_ptr->sched_disabled && (serv_ptr->event_schedule != NULL))
5029  {
5030  DBDEF_DeleteEventList(serv_ptr->event_schedule);
5031  serv_ptr->event_schedule = NULL;
5032  serv_ptr->num_events_in_schedule = 0;
5033  ASI_NotifyEitSchedUpdate(s_ptr, 0, APP_SI_EIT_JOURNAL_TYPE_CLEAR);
5034  }
5035 
5036  DBA_SaveRecord(serv_ptr->dba_rec);
5038  }
5039 
5040  FUNCTION_FINISH(ADB_SetServiceScheduleState);
5041 }
5042 
5048 BOOLEAN ADB_GetServiceScheduleState(void *s_ptr)
5049 {
5050  BOOLEAN retval;
5051 
5052  FUNCTION_START(ADB_GetServiceScheduleState);
5053 
5054  retval = FALSE;
5055 
5056  if (s_ptr != NULL)
5057  {
5059  retval = !((ADB_SERVICE_REC *)s_ptr)->sched_disabled;
5061  }
5062 
5063  FUNCTION_FINISH(ADB_GetServiceScheduleState);
5064 
5065  return(retval);
5066 }
5067 
5074 void ADB_SetServiceNowNextState(void *s_ptr, BOOLEAN state)
5075 {
5076  ADB_SERVICE_REC *serv_ptr = (ADB_SERVICE_REC *)s_ptr;
5077 
5078  FUNCTION_START(ADB_SetServiceNowNextState);
5079 
5080  if (s_ptr != NULL)
5081  {
5083 
5084  serv_ptr->now_next_disabled = !state;
5085  DBA_SetFieldValue(serv_ptr->dba_rec, DBA_FIELD_SERV_NOWNEXT_DISABLED,
5086  serv_ptr->now_next_disabled);
5087 
5088  if (serv_ptr->now_next_disabled)
5089  {
5090  if (serv_ptr->now_event != NULL)
5091  {
5092  DBDEF_DeleteEventList(serv_ptr->now_event);
5093  serv_ptr->now_event = NULL;
5094  }
5095 
5096  if (serv_ptr->next_event != NULL)
5097  {
5098  DBDEF_DeleteEventList(serv_ptr->next_event);
5099  serv_ptr->next_event = NULL;
5100  }
5101  }
5102 
5103  DBA_SaveRecord(serv_ptr->dba_rec);
5104 
5106  }
5107 
5108  FUNCTION_FINISH(ADB_SetServiceNowNextState);
5109 }
5110 
5116 BOOLEAN ADB_GetServiceNowNextState(void *s_ptr)
5117 {
5118  BOOLEAN retval;
5119 
5120  FUNCTION_START(ADB_GetServiceNowNextState);
5121 
5122  retval = FALSE;
5123 
5124  if (s_ptr != NULL)
5125  {
5127  retval = !((ADB_SERVICE_REC *)s_ptr)->now_next_disabled;
5129  }
5130 
5131  FUNCTION_FINISH(ADB_GetServiceNowNextState);
5132 
5133  return(retval);
5134 }
5135 
5141 U16BIT ADB_GetServiceOrigLcn(void *s_ptr)
5142 {
5143  U16BIT orig_lcn;
5144 
5145  FUNCTION_START(ADB_GetServiceOrigLcn);
5146 
5147  orig_lcn = 0;
5148  if (s_ptr != NULL)
5149  {
5151  orig_lcn = ((ADB_SERVICE_REC *)s_ptr)->serv_lcn;
5153  }
5154 
5155  FUNCTION_FINISH(ADB_GetServiceOrigLcn);
5156  return(orig_lcn);
5157 }
5158 
5164 U16BIT ADB_GetServicePCRPid(void *s_ptr)
5165 {
5166  U16BIT pcr_pid;
5167 
5168  FUNCTION_START(ADB_GetServicePCRPid);
5169 
5170  pcr_pid = 0;
5171  if (s_ptr != NULL)
5172  {
5174  pcr_pid = ((ADB_SERVICE_REC *)s_ptr)->pcr_pid;
5176  }
5177 
5178  FUNCTION_FINISH(ADB_GetServicePCRPid);
5179  return(pcr_pid);
5180 }
5181 
5189 U16BIT ADB_GetServiceAudioPid(void *s_ptr)
5190 {
5191  U16BIT a_pid;
5192 
5193  FUNCTION_START(ADB_GetServiceAudioPid);
5194 
5195  a_pid = 0;
5196  if (s_ptr != NULL)
5197  {
5199  a_pid = ((ADB_SERVICE_REC *)s_ptr)->audio_pid;
5201  }
5202 
5203  FUNCTION_FINISH(ADB_GetServiceAudioPid);
5204  return(a_pid);
5205 }
5206 
5212 ADB_STREAM_TYPE ADB_GetServiceAudioType(void *s_ptr)
5213 {
5214  ADB_STREAM_TYPE audio_type;
5215 
5216  FUNCTION_START(ADB_GetServiceAudioType);
5217 
5218  audio_type = ADB_AUDIO_STREAM;
5219  if (s_ptr != NULL)
5220  {
5222  audio_type = ((ADB_SERVICE_REC *)s_ptr)->audio_type;
5224  }
5225 
5226  FUNCTION_FINISH(ADB_GetServiceAudioType);
5227  return(audio_type);
5228 }
5229 
5237 U16BIT ADB_GetServiceTextPid(void *s_ptr)
5238 {
5239  U16BIT t_pid;
5240 
5241  FUNCTION_START(ADB_GetServiceTextPid);
5242 
5243  t_pid = 0;
5244  if (s_ptr != NULL)
5245  {
5247  t_pid = ((ADB_SERVICE_REC *)s_ptr)->ttext_pid;
5249  }
5250 
5251  FUNCTION_FINISH(ADB_GetServiceTextPid);
5252  return(t_pid);
5253 }
5254 
5260 BOOLEAN ADB_GetServiceIsHd(void *s_ptr)
5261 {
5262  BOOLEAN is_hd;
5263  ADB_SERVICE_TYPE serv_type;
5264 
5265  FUNCTION_START(ADB_GetServiceIsHd);
5266 
5267  is_hd = FALSE;
5268 
5269  if (s_ptr != NULL)
5270  {
5272 
5273  serv_type = ((ADB_SERVICE_REC *)s_ptr)->serv_type;
5274 
5275  if ((serv_type == ADB_SERVICE_TYPE_HD_TV) ||
5276  (serv_type == ADB_SERVICE_TYPE_MPEG2_HD) ||
5277  (serv_type == ADB_SERVICE_TYPE_UHD_TV))
5278  {
5279  is_hd = TRUE;
5280  }
5281 
5283  }
5284 
5285  FUNCTION_FINISH(ADB_GetServiceIsHd);
5286 
5287  return(is_hd);
5288 }
5289 
5296 U16BIT ADB_GetRequiredAudioPid(void *s_ptr)
5297 {
5298  U16BIT a_pid;
5299  E_STB_DP_AUDIO_MODE audio_mode;
5300  ADB_STREAM_TYPE audio_type;
5301 
5302  FUNCTION_START(ADB_GetRequiredAudioPid);
5303 
5304  a_pid = 0;
5305  if (s_ptr != NULL)
5306  {
5308  a_pid = DBDEF_GetReqdAudioPid(s_ptr, &audio_mode, &audio_type);
5309  ((ADB_SERVICE_REC *)s_ptr)->audio_pid = a_pid;
5311  }
5312 
5313  FUNCTION_FINISH(ADB_GetRequiredAudioPid);
5314  return(a_pid);
5315 }
5316 
5324 U16BIT ADB_GetRequiredADPid(void *s_ptr, BOOLEAN *broadcast_mix)
5325 {
5326  U16BIT ad_pid;
5327  E_STB_DP_AUDIO_MODE ad_mode;
5328  ADB_STREAM_TYPE ad_type;
5329 
5330  FUNCTION_START(ADB_GetRequiredADPid);
5331 
5332  ad_pid = 0;
5333  *broadcast_mix = FALSE;
5334 
5335  if (s_ptr != NULL)
5336  {
5338 
5339  ad_pid = DBDEF_GetReqdADPid(s_ptr, &ad_mode, &ad_type, broadcast_mix);
5340  ((ADB_SERVICE_REC *)s_ptr)->ad_pid = ad_pid;
5341 
5343  }
5344 
5345  FUNCTION_FINISH(ADB_GetRequiredADPid);
5346  return(ad_pid);
5347 }
5348 
5355 E_STB_DP_AUDIO_MODE ADB_GetRequiredAudioMode(void *s_ptr)
5356 {
5357  E_STB_DP_AUDIO_MODE audio_mode;
5358  ADB_STREAM_TYPE audio_type;
5359 
5360  FUNCTION_START(ADB_GetRequiredAudioMode);
5361 
5362  audio_mode = AUDIO_STEREO;
5363 
5364  if (s_ptr != NULL)
5365  {
5367  DBDEF_GetReqdAudioPid(s_ptr, &audio_mode, &audio_type);
5369  }
5370 
5371  FUNCTION_FINISH(ADB_GetRequiredAudioMode);
5372  return(audio_mode);
5373 }
5374 
5384 U16BIT ADB_GetRequiredTtextPid(void *s_ptr, BOOLEAN for_subtitles, U8BIT *magazine, U8BIT *page)
5385 {
5386  U16BIT t_pid;
5387 
5388  FUNCTION_START(ADB_GetRequiredTtextPid);
5389 
5390  t_pid = 0;
5391  if (s_ptr != NULL)
5392  {
5394  DBDEF_GetReqdTtextPid(s_ptr, for_subtitles, &t_pid, magazine, page);
5395  ((ADB_SERVICE_REC *)s_ptr)->ttext_pid = t_pid;
5397  }
5398 
5399  FUNCTION_FINISH(ADB_GetRequiredTtextPid);
5400  return(t_pid);
5401 }
5402 
5411 U16BIT ADB_GetRequiredSubtitleParams(void *s_ptr, U16BIT *cpage_ptr, U16BIT *apage_ptr)
5412 {
5413  U16BIT pid;
5414  U16BIT cpage;
5415  U16BIT apage;
5416 
5417  FUNCTION_START(ADB_GetRequiredSubtitleParams);
5418 
5419  pid = 0;
5420  cpage = 0;
5421  apage = 0;
5422 
5423  if (s_ptr != NULL)
5424  {
5426 
5427  DBDEF_GetReqdSubtitleParams(s_ptr, &pid, &cpage, &apage);
5428  ((ADB_SERVICE_REC *)s_ptr)->subtitle_pid = pid;
5429  ((ADB_SERVICE_REC *)s_ptr)->subtitle_cpage = cpage;
5430  ((ADB_SERVICE_REC *)s_ptr)->subtitle_apage = apage;
5431 
5433  }
5434 
5435  *cpage_ptr = cpage;
5436  *apage_ptr = apage;
5437 
5438  FUNCTION_FINISH(ADB_GetRequiredSubtitleParams);
5439 
5440  return(pid);
5441 }
5442 
5448 U16BIT ADB_GetServiceVideoPid(void *s_ptr)
5449 {
5450  U16BIT v_pid;
5451 
5452  FUNCTION_START(ADB_GetServiceVideoPid);
5453 
5454  v_pid = 0;
5455  if (s_ptr != NULL)
5456  {
5458  v_pid = ((ADB_SERVICE_REC *)s_ptr)->video_pid;
5460  }
5461 
5462  FUNCTION_FINISH(ADB_GetServiceVideoPid);
5463  return(v_pid);
5464 }
5465 
5471 ADB_STREAM_TYPE ADB_GetServiceVideoType(void *s_ptr)
5472 {
5473  ADB_STREAM_TYPE video_type;
5474 
5475  FUNCTION_START(ADB_GetServiceVideoType);
5476 
5477  video_type = ADB_VIDEO_STREAM;
5478  if (s_ptr != NULL)
5479  {
5481  video_type = ((ADB_SERVICE_REC *)s_ptr)->video_type;
5483  }
5484 
5485  FUNCTION_FINISH(ADB_GetServiceVideoType);
5486  return(video_type);
5487 }
5488 
5494 ADB_SERVICE_TYPE ADB_GetServiceType(void *s_ptr)
5495 {
5496  U16BIT s_type;
5497 
5498  FUNCTION_START(ADB_GetServiceType);
5499 
5500  s_type = 0;
5501  if (s_ptr != NULL)
5502  {
5504  s_type = ((ADB_SERVICE_REC *)s_ptr)->serv_type;
5506  }
5507 
5508  FUNCTION_FINISH(ADB_GetServiceType);
5509  return(s_type);
5510 }
5511 
5519 U8BIT* ADB_GetServiceProviderName(void *s_ptr)
5520 {
5521  ADB_STRING *name_str;
5522  U16BIT nchar;
5523  U8BIT *retval;
5524 
5525  FUNCTION_START(ADB_GetServiceProviderName);
5526 
5527  retval = NULL;
5528 
5530 
5531  if ((name_str = DBDEF_GetServiceProviderName(s_ptr)) != NULL)
5532  {
5533  retval = STB_ConvertStringToUTF8(name_str->str_ptr, &nchar, FALSE, name_str->lang_code);
5534  }
5535 
5537 
5538  FUNCTION_FINISH(ADB_GetServiceProviderName);
5539 
5540  return(retval);
5541 }
5542 
5551 U8BIT* ADB_GetServiceProviderNameByLang(void *s_ptr, U8BIT lang)
5552 {
5553  U8BIT *name_str;
5554 
5555  FUNCTION_START(ADB_GetServiceProviderNameByLang);
5556 
5557  name_str = NULL;
5558  if (s_ptr != NULL)
5559  {
5561  name_str = CopyString(((ADB_SERVICE_REC *)s_ptr)->provider_array[lang], TRUE);
5563  }
5564 
5565  FUNCTION_FINISH(ADB_GetServiceProviderNameByLang);
5566  return(name_str);
5567 }
5568 
5581 {
5582  U8BIT *name_str;
5583 
5584  FUNCTION_START(ADB_GetDefaultServiceProviderName);
5585 
5586  name_str = NULL;
5587  if (s_ptr != NULL)
5588  {
5590  name_str = CopyString(((ADB_SERVICE_REC *)s_ptr)->provider_str, TRUE);
5592  }
5593 
5594  FUNCTION_FINISH(ADB_GetDefaultServiceProviderName);
5595  return(name_str);
5596 }
5597 
5604 BOOLEAN ADB_GetServiceUnavailableFlag(void *s_ptr)
5605 {
5606  BOOLEAN unavailable;
5607 
5608  FUNCTION_START(ADB_GetServiceUnavailableFlag);
5609 
5610  unavailable = FALSE;
5611  if (s_ptr != NULL)
5612  {
5614  unavailable = ((ADB_SERVICE_REC *)s_ptr)->unavailable;
5616  }
5617 
5618  FUNCTION_FINISH(ADB_GetServiceUnavailableFlag);
5619  return(unavailable);
5620 }
5621 
5628 {
5629  U8BIT status;
5630 
5631  FUNCTION_START(ADB_GetServiceRunningStatus);
5632 
5633  status = 0;
5634 
5635  if (s_ptr != NULL)
5636  {
5638  status = ((ADB_SERVICE_REC *)s_ptr)->running_status;
5640  }
5641 
5642  FUNCTION_FINISH(ADB_GetServiceRunningStatus);
5643 
5644  return(status);
5645 }
5646 
5654 BOOLEAN ADB_GetServiceNotRunningFlag(void *s_ptr)
5655 {
5656  BOOLEAN not_running;
5657 
5658  FUNCTION_START(ADB_GetServiceNotRunningFlag);
5659 
5660  not_running = FALSE;
5661  if (s_ptr != NULL)
5662  {
5664  not_running = ((ADB_SERVICE_REC *)s_ptr)->not_running;
5666  }
5667 
5668  FUNCTION_FINISH(ADB_GetServiceNotRunningFlag);
5669  return(not_running);
5670 }
5671 
5679 BOOLEAN ADB_GetServiceScrambledFlag(void *s_ptr)
5680 {
5681  BOOLEAN serv_scrambled;
5682 
5683  FUNCTION_START(ADB_GetServiceScrambledFlag);
5684 
5685  serv_scrambled = FALSE;
5686  if (s_ptr != NULL)
5687  {
5689  serv_scrambled = ((ADB_SERVICE_REC *)s_ptr)->scrambled;
5691  }
5692 
5693  FUNCTION_FINISH(ADB_GetServiceScrambledFlag);
5694  return(serv_scrambled);
5695 }
5696 
5702 BOOLEAN ADB_GetServiceHasCaDesc(void *s_ptr)
5703 {
5704  BOOLEAN has_ca_desc;
5705 
5706  FUNCTION_START(ADB_GetServiceHasCaDesc);
5707 
5708  has_ca_desc = FALSE;
5709  if (s_ptr != NULL)
5710  {
5712  has_ca_desc = ((ADB_SERVICE_REC *)s_ptr)->has_ca_descriptor;
5714  }
5715 
5716  FUNCTION_FINISH(ADB_GetServiceHasCaDesc);
5717  return(has_ca_desc);
5718 }
5719 
5727 BOOLEAN ADB_GetServiceDoNotScramble(void *s_ptr)
5728 {
5729  BOOLEAN do_not_scramble;
5730 
5731  FUNCTION_START(ADB_GetServiceDoNotScramble);
5732 
5733  do_not_scramble = TRUE;
5734 
5735  if (s_ptr != NULL)
5736  {
5737  do_not_scramble = FindDoNotScramble(NULL, s_ptr);
5738  }
5739 
5740  FUNCTION_FINISH(ADB_GetServiceDoNotScramble);
5741 
5742  return(do_not_scramble);
5743 }
5744 
5752 {
5753  U8BIT level;
5754 
5755  FUNCTION_START(ADB_GetServiceContentProtectionLevel);
5756 
5757  if (s_ptr != NULL)
5758  {
5760  level = ((ADB_SERVICE_REC *)s_ptr)->content_protection_level;
5762  }
5763  else
5764  {
5765  /* The default level according to Nordig v2.5.1 is 0x01,
5766  * which means content protection isn't required */
5767  level = 0x01;
5768  }
5769 
5770  FUNCTION_FINISH(ADB_GetServiceContentProtectionLevel);
5771 
5772  return(level);
5773 }
5774 
5782 BOOLEAN ADB_GetServiceNewFlag(void *s_ptr)
5783 {
5784  BOOLEAN new_service = FALSE;
5785 
5786  FUNCTION_START(ADB_GetServiceNewFlag);
5787 
5788  if (s_ptr != NULL)
5789  {
5791  new_service = ((ADB_SERVICE_REC *)s_ptr)->new_service;
5793  }
5794 
5795  FUNCTION_FINISH(ADB_GetServiceNewFlag);
5796  return(new_service);
5797 }
5798 
5805 BOOLEAN ADB_GetServiceLockedFlag(void *s_ptr)
5806 {
5807  BOOLEAN locked = FALSE;
5808 
5809  FUNCTION_START(ADB_GetServiceLockedFlag);
5810 
5811  if (s_ptr != NULL)
5812  {
5814  locked = ((ADB_SERVICE_REC *)s_ptr)->locked;
5816  }
5817 
5818  FUNCTION_FINISH(ADB_GetServiceLockedFlag);
5819  return(locked);
5820 }
5821 
5828 {
5829  ADB_SERVICE_REC *serv_ptr = (ADB_SERVICE_REC *)s_ptr;
5830  BOOLEAN locked;
5831 
5832  FUNCTION_START(ADB_ToggleServiceLockedFlag);
5833 
5834  if (s_ptr != NULL)
5835  {
5837 
5838  locked = serv_ptr->locked;
5839  if (locked)
5840  {
5841  serv_ptr->locked = FALSE;
5842  }
5843  else
5844  {
5845  serv_ptr->locked = TRUE;
5846  }
5847 
5848  DBA_SetFieldValue(serv_ptr->dba_rec, DBA_FIELD_SERV_LOCKED, serv_ptr->locked);
5849  DBA_SaveRecord(serv_ptr->dba_rec);
5850 
5852  }
5853 
5854  FUNCTION_FINISH(ADB_ToggleServiceLockedFlag);
5855 }
5856 
5862 void ADB_SetServiceLockedFlag(void *s_ptr, BOOLEAN locked)
5863 {
5864  ADB_SERVICE_REC *serv_ptr = (ADB_SERVICE_REC *)s_ptr;
5865 
5866  FUNCTION_START(ADB_SetServiceLockedFlag);
5867 
5868  if (s_ptr != NULL)
5869  {
5871  serv_ptr->locked = locked;
5872  DBA_SetFieldValue(serv_ptr->dba_rec, DBA_FIELD_SERV_LOCKED, serv_ptr->locked);
5873  DBA_SaveRecord(serv_ptr->dba_rec);
5875  }
5876 
5877  FUNCTION_FINISH(ADB_SetServiceLockedFlag);
5878 }
5879 
5885 BOOLEAN ADB_IsFreesatService(void *s_ptr)
5886 {
5887  BOOLEAN retval;
5888  ADB_SERVICE_REC *serv_ptr = (ADB_SERVICE_REC *)s_ptr;
5889 
5890  FUNCTION_START(ADB_IsFreesatService);
5891 
5892  retval = FALSE;
5893 
5894  if (s_ptr != NULL)
5895  {
5897  if (serv_ptr->freesat_id != INVALID_FREESAT_SERV_ID)
5898  {
5899  retval = TRUE;
5900  }
5902  }
5903 
5904  FUNCTION_FINISH(ADB_IsFreesatService);
5905 
5906  return(retval);
5907 }
5908 
5914 U16BIT ADB_GetFreesatServiceId(void *s_ptr)
5915 {
5916  U16BIT freesat_id;
5917  ADB_SERVICE_REC *serv_ptr = (ADB_SERVICE_REC *)s_ptr;
5918 
5919  FUNCTION_START(ADB_GetFreesatServiceId);
5920 
5921  if (s_ptr != NULL)
5922  {
5924  freesat_id = serv_ptr->freesat_id;
5926  }
5927  else
5928  {
5929  freesat_id = INVALID_FREESAT_SERV_ID;
5930  }
5931 
5932  FUNCTION_FINISH(ADB_GetFreesatServiceId);
5933 
5934  return(freesat_id);
5935 }
5936 
5937 #if 0
5938 
5954 void ADB_SetServiceListTaggedLockedFlag(U32BIT *tag_array, void **slist, U16BIT num_entries, BOOLEAN locked)
5955 {
5956  U16BIT i;
5957 
5958  FUNCTION_START(ADB_SetServiceListTaggedLockedFlag);
5959 
5960  if ((num_entries > 0) && (slist != NULL))
5961  {
5962  if (tag_array == NULL)
5963  {
5964  //Set all flags in list
5965  ADB_SetServiceListLockedFlag(slist, num_entries, locked);
5966  }
5967  else
5968  {
5970  //Only set flags associated with non-zero tag array values
5971  for (i = 0; i != num_entries; i++)
5972  {
5973  if (tag_array[i] > 0)
5974  {
5975  if (locked)
5976  {
5977  DBA_ServFlgLock(slist[i]);
5978  }
5979  else
5980  {
5981  DBA_ServFlgUnlock(slist[i]);
5982  }
5983  DBA_CommitService(slist[i]);
5984  }
5985  }
5987  }
5988  }
5989  FUNCTION_FINISH(ADB_SetServiceListTaggedLockedFlag);
5990 }
5991 
5992 #endif
5993 
5999 void* ADB_GetServiceTransportPtr(void *s_ptr)
6000 {
6001  void *t_ptr;
6002 
6003  FUNCTION_START(ADB_GetServiceTransportPtr);
6004 
6005  t_ptr = NULL;
6006  if (s_ptr != NULL)
6007  {
6009  t_ptr = ((ADB_SERVICE_REC *)s_ptr)->transport;
6011  }
6012 
6013  FUNCTION_FINISH(ADB_GetServiceTransportPtr);
6014  return(t_ptr);
6015 }
6016 
6023 void ADB_SetTunedService(U8BIT path, void *s_ptr)
6024 {
6025  ADB_TRANSPORT_REC *t_ptr;
6026  ADB_SERVICE_REC *serv_ptr = (ADB_SERVICE_REC *)s_ptr;
6027 
6028  FUNCTION_START(ADB_SetTunedService);
6029 
6031 
6032  DBDEF_SetTunedService(path, s_ptr);
6033 
6034  if (s_ptr != NULL)
6035  {
6036  // clear new flag
6037  serv_ptr->new_service = FALSE;
6038 
6039  // set tuned transport and network or satellite
6040  t_ptr = serv_ptr->transport;
6041  DBDEF_SetTunedTransport(path, t_ptr);
6042 
6043  if (t_ptr != NULL)
6044  {
6045  DBDEF_SetTunedNetwork(path, t_ptr->network);
6046  }
6047  else
6048  {
6049  DBDEF_SetTunedNetwork(path, NULL);
6050  }
6051  }
6052  else
6053  {
6054  DBDEF_SetTunedTransport(path, NULL);
6055  DBDEF_SetTunedNetwork(path, NULL);
6056  }
6057 
6059 
6060  FUNCTION_FINISH(ADB_SetTunedService);
6061 }
6062 
6068 void* ADB_GetTunedService(U8BIT path)
6069 {
6070  void *s_ptr;
6071 
6072  FUNCTION_START(ADB_GetTunedService);
6073 
6075  s_ptr = DBDEF_GetTunedService(path);
6077 
6078  FUNCTION_FINISH(ADB_GetTunedService);
6079 
6080  return(s_ptr);
6081 }
6082 
6089 U8BIT* ADB_GetServiceDefaultAuthority(void *serv_ptr)
6090 {
6091  U8BIT *crid_str;
6092 
6093  FUNCTION_START(ADB_GetServiceDefaultAuthority);
6094 
6096  crid_str = DBDEF_GetServiceDefaultAuthority(serv_ptr);
6098 
6099  FUNCTION_FINISH(ADB_GetServiceDefaultAuthority);
6100 
6101  return(crid_str);
6102 }
6103 
6110 void ADB_ServiceAddRCTLink(void *serv_ptr, void *link_ptr)
6111 {
6112  ADB_SERVICE_REC *s_ptr;
6113  ADB_RCT_LINK_INFO *l_ptr;
6114  ADB_RCT_LINK_INFO *curr_ptr;
6115 
6116  FUNCTION_START(ADB_ServiceAddRCTLink);
6117 
6118  ASSERT(serv_ptr != NULL);
6119  ASSERT(link_ptr != NULL);
6120 
6122 
6123  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
6124  l_ptr = (ADB_RCT_LINK_INFO *)link_ptr;
6125 
6126  l_ptr->next = NULL;
6127 
6128  if (s_ptr->rct_link_list == NULL)
6129  {
6130  s_ptr->rct_link_list = link_ptr;
6131  }
6132  else
6133  {
6134  /* Add the link to the end of the existing list */
6135  for (curr_ptr = s_ptr->rct_link_list; curr_ptr->next != NULL; )
6136  {
6137  curr_ptr = curr_ptr->next;
6138  }
6139 
6140  curr_ptr->next = link_ptr;
6141  }
6142 
6144 
6145  FUNCTION_FINISH(ADB_ServiceAddRCTLink);
6146 }
6147 
6152 void ADB_ServiceReleaseRCTLinks(void *serv_ptr)
6153 {
6154  ADB_SERVICE_REC *s_ptr;
6155 
6156  FUNCTION_START(ADB_ServiceReleaseRCTLinks);
6157 
6158  ASSERT(serv_ptr != NULL);
6159 
6161 
6162  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
6163  if (s_ptr->rct_link_list != NULL)
6164  {
6165  DBDEF_DeleteRCTLinks(s_ptr->rct_link_list);
6166  s_ptr->rct_link_list = NULL;
6167  }
6168 
6170 
6171  FUNCTION_FINISH(ADB_ServiceReleaseRCTLinks);
6172 }
6173 
6179 U8BIT ADB_GetServiceNumRCTLinks(void *serv_ptr)
6180 {
6181  U8BIT num_links;
6182  ADB_RCT_LINK_INFO *l_ptr;
6183 
6184  FUNCTION_START(ADB_GetServiceNumRCTLinks);
6185 
6187 
6188  num_links = 0;
6189 
6190  if (serv_ptr != NULL)
6191  {
6192  for (l_ptr = ((ADB_SERVICE_REC *)serv_ptr)->rct_link_list; l_ptr != NULL; l_ptr = l_ptr->next)
6193  {
6194  num_links++;
6195  }
6196  }
6197 
6199 
6200  FUNCTION_FINISH(ADB_GetServiceNumRCTLinks);
6201 
6202  return(num_links);
6203 }
6204 
6212 void* ADB_GetServiceRCTLinks(void *serv_ptr, U8BIT *num_links)
6213 {
6214  ADB_SERVICE_REC *s_ptr;
6215  ADB_RCT_LINK_INFO *links;
6216  ADB_RCT_LINK_INFO *l_ptr;
6217  ADB_RCT_LINK_INFO *new_ptr;
6218  ADB_RCT_LINK_INFO *last_link;
6219  U8BIT i;
6220 
6221  FUNCTION_START(ADB_GetServiceRCTLinks);
6222 
6224 
6225  links = NULL;
6226  *num_links = 0;
6227  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
6228 
6229  if ((s_ptr != NULL) && (s_ptr->rct_link_list != NULL))
6230  {
6231  last_link = NULL;
6232 
6233  for (l_ptr = s_ptr->rct_link_list; l_ptr != NULL; l_ptr = l_ptr->next)
6234  {
6236  if (new_ptr != NULL)
6237  {
6238  memset(new_ptr, 0, sizeof(ADB_RCT_LINK_INFO));
6239 
6240  new_ptr->is_group_trailer = l_ptr->is_group_trailer;
6241 
6242  if (l_ptr->uri_string != NULL)
6243  {
6244  new_ptr->uri_string = (U8BIT *)STB_AppGetMemory(strlen((char *)l_ptr->uri_string) + 1);
6245  if (new_ptr->uri_string != NULL)
6246  {
6247  strncpy((char *)new_ptr->uri_string, (char *)l_ptr->uri_string, strlen((char *)l_ptr->uri_string) + 1);
6248 
6249  new_ptr->can_use_default_icon = l_ptr->can_use_default_icon;
6250  new_ptr->icon_id = l_ptr->icon_id;
6251 
6252  for (i = 0; i < ACFG_NUM_DB_LANGUAGES; i++)
6253  {
6254  if (l_ptr->promo_text[i] != NULL)
6255  {
6256  new_ptr->promo_text[i] = DBDEF_CopyString(l_ptr->promo_text[i]);
6257  }
6258  }
6259 
6260  if (l_ptr->event_name != NULL)
6261  {
6262  new_ptr->event_name = DBDEF_CopyString(l_ptr->event_name);
6263  }
6264  }
6265  }
6266 
6267  if (links == NULL)
6268  {
6269  links = new_ptr;
6270  last_link = new_ptr;
6271  }
6272  else
6273  {
6274  last_link->next = new_ptr;
6275  last_link = new_ptr;
6276  }
6277 
6278  (*num_links)++;
6279  }
6280  }
6281  }
6282 
6284 
6285  FUNCTION_FINISH(ADB_GetServiceRCTLinks);
6286 
6287  return(links);
6288 }
6289 
6295 void* ADB_GetNextRCTLink(void *link_ptr)
6296 {
6297  void *next_link;
6298 
6299  FUNCTION_START(ADB_GetNextRCTLink);
6300 
6301  next_link = NULL;
6302 
6303  if (link_ptr != NULL)
6304  {
6305  next_link = ((ADB_RCT_LINK_INFO *)link_ptr)->next;
6306  }
6307 
6308  FUNCTION_FINISH(ADB_GetNextRCTLink);
6309 
6310  return(next_link);
6311 }
6312 
6317 void ADB_ReleaseRCTLinks(void *links)
6318 {
6319  FUNCTION_START(ADB_ReleaseRCTLinks);
6320 
6321  DBDEF_DeleteRCTLinks(links);
6322 
6323  FUNCTION_FINISH(ADB_ReleaseRCTLinks);
6324 }
6325 
6331 U8BIT* ADB_GetRCTLinkPromoText(void *link_ptr)
6332 {
6333  ADB_RCT_LINK_INFO *link;
6334  U8BIT *text;
6335  U8BIT *lang_ids;
6336  U16BIT i;
6337  U16BIT nchars;
6338 
6339  FUNCTION_START(ADB_GetRCTLinkPromoText);
6340 
6341  text = NULL;
6342 
6343  if (link_ptr != NULL)
6344  {
6345  link = (ADB_RCT_LINK_INFO *)link_ptr;
6346 
6347  lang_ids = DBDEF_GetTextLang();
6348 
6349  if (lang_ids != NULL)
6350  {
6351  for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
6352  (lang_ids[i] != ACFG_INVALID_DB_LANG) && (text == NULL); i++)
6353  {
6354  text = STB_ConvertStringToUTF8(link->promo_text[lang_ids[i]]->str_ptr, &nchars, FALSE,
6355  link->promo_text[lang_ids[i]]->lang_code);
6356  }
6357  }
6358 
6359  if (text == NULL)
6360  {
6361  /* Required language is not available - look for first non-null language */
6362  for (i = 0; i < ACFG_NUM_DB_LANGUAGES; i++)
6363  {
6364  text = link->promo_text[i]->str_ptr;
6365  if (text != NULL)
6366  {
6367  text = STB_ConvertStringToUTF8(link->promo_text[i]->str_ptr, &nchars, FALSE,
6368  link->promo_text[i]->lang_code);
6369  break;
6370  }
6371  }
6372  }
6373  }
6374 
6375  FUNCTION_FINISH(ADB_GetRCTLinkPromoText);
6376 
6377  return(text);
6378 }
6379 
6385 BOOLEAN ADB_IsRCTLinkGroupTrailer(void *link_ptr)
6386 {
6387  BOOLEAN is_group_trailer;
6388 
6389  FUNCTION_START(ADB_IsRCTLinkGroupTrailer);
6390 
6391  if (link_ptr != NULL)
6392  {
6393  is_group_trailer = ((ADB_RCT_LINK_INFO *)link_ptr)->is_group_trailer;
6394  }
6395  else
6396  {
6397  is_group_trailer = FALSE;
6398  }
6399 
6400  FUNCTION_FINISH(ADB_IsRCTLinkGroupTrailer);
6401 
6402  return(is_group_trailer);
6403 }
6404 
6410 U8BIT* ADB_GetRCTLinkName(void *link_ptr)
6411 {
6412  U8BIT *name;
6413  ADB_RCT_LINK_INFO *lptr;
6414  U16BIT nchars;
6415 
6416  FUNCTION_START(ADB_GetRCTLinkName);
6417 
6418  if (link_ptr != NULL)
6419  {
6420  lptr = (ADB_RCT_LINK_INFO *)link_ptr;
6421 
6422  name = STB_ConvertStringToUTF8(lptr->event_name->str_ptr, &nchars, FALSE,
6423  lptr->event_name->lang_code);
6424  }
6425  else
6426  {
6427  name = NULL;
6428  }
6429 
6430  FUNCTION_FINISH(ADB_GetRCTLinkName);
6431 
6432  return(name);
6433 }
6434 
6440 U8BIT* ADB_GetRCTLinkUriString(void *link_ptr)
6441 {
6442  U8BIT *uri_string;
6443 
6444  FUNCTION_START(ADB_GetRCTLinkUriString);
6445 
6446  if (link_ptr != NULL)
6447  {
6448  uri_string = ((ADB_RCT_LINK_INFO *)link_ptr)->uri_string;
6449  }
6450  else
6451  {
6452  uri_string = NULL;
6453  }
6454 
6455  FUNCTION_FINISH(ADB_GetRCTLinkUriString);
6456 
6457  return(uri_string);
6458 }
6459 
6468 BOOLEAN ADB_ServiceAddImageIcon(void *serv_ptr, void *icon_ptr)
6469 {
6470  BOOLEAN icon_added;
6471  ADB_SERVICE_REC *s_ptr;
6472  ADB_IMAGE_ICON *i_ptr;
6473  ADB_IMAGE_ICON *curr_ptr;
6474  ADB_IMAGE_ICON *prev_ptr;
6475 
6476  FUNCTION_START(ADB_ServiceAddImageIcon);
6477 
6478  ASSERT(serv_ptr != NULL);
6479  ASSERT(icon_ptr != NULL);
6480 
6482 
6483  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
6484  i_ptr = (ADB_IMAGE_ICON *)icon_ptr;
6485 
6486  /* Check whether the icon id is already in the list */
6487  for (curr_ptr = s_ptr->icon_list, prev_ptr = NULL; (curr_ptr != NULL) && (i_ptr->icon_id != curr_ptr->icon_id); )
6488  {
6489  prev_ptr = curr_ptr;
6490  curr_ptr = curr_ptr->next;
6491  }
6492 
6493  if (curr_ptr == NULL)
6494  {
6495  i_ptr->next = NULL;
6496 
6497  if (s_ptr->icon_list == NULL)
6498  {
6499  /* First icon in the list */
6500  s_ptr->icon_list = i_ptr;
6501  }
6502  else
6503  {
6504  /* Add new icon to the end of the list */
6505  prev_ptr->next = i_ptr;
6506  }
6507 
6508  icon_added = TRUE;
6509  }
6510  else
6511  {
6512  /* Icon with this id already exists. Only replace it if it can't be determined that it's
6513  * the same image */
6514  if ((i_ptr->icon_type != curr_ptr->icon_type) ||
6515  (i_ptr->transport_mode != curr_ptr->transport_mode) ||
6516  ((i_ptr->transport_mode == ICON_TRANS_URL) &&
6517  (STB_CompareStringsIgnoreCase(i_ptr->icon_url, curr_ptr->icon_url) != 0)))
6518  {
6519  i_ptr->next = curr_ptr->next;
6520 
6521  if (prev_ptr == NULL)
6522  {
6523  s_ptr->icon_list = i_ptr;
6524  }
6525  else
6526  {
6527  prev_ptr->next = i_ptr;
6528  }
6529 
6530  /* Set next pointer to NULL as only this icon should be deleted */
6531  curr_ptr->next = NULL;
6532  DBDEF_DeleteImageIcons(curr_ptr);
6533 
6534  icon_added = TRUE;
6535  }
6536  else
6537  {
6538  /* Icons are the same so ignore the new one */
6539  DBDEF_DeleteImageIcons(i_ptr);
6540 
6541  icon_added = FALSE;
6542  }
6543  }
6544 
6546 
6547  FUNCTION_FINISH(ADB_ServiceAddImageIcon);
6548 
6549  return(icon_added);
6550 }
6551 
6558 BOOLEAN ADB_ServiceRCTCanUseDefaultIcon(void *serv_ptr)
6559 {
6560  ADB_SERVICE_REC *s_ptr;
6561  ADB_RCT_LINK_INFO *link;
6562  BOOLEAN can_use_default;
6563 
6564  FUNCTION_START(ADB_ServiceRCTCanUseDefaultIcon);
6565 
6566  can_use_default = FALSE;
6567 
6568  if (serv_ptr != NULL)
6569  {
6571 
6572  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
6573 
6574  if (s_ptr->rct_link_list != NULL)
6575  {
6576  for (link = s_ptr->rct_link_list; (link != NULL) && !can_use_default; link = link->next)
6577  {
6578  if (link->can_use_default_icon)
6579  {
6580  can_use_default = TRUE;
6581  }
6582  }
6583  }
6584 
6586  }
6587 
6588  FUNCTION_FINISH(ADB_ServiceRCTCanUseDefaultIcon);
6589 
6590  return(can_use_default);
6591 }
6592 
6608 BOOLEAN ADB_ServiceGetRCTIcon(void *serv_ptr, U8BIT **icon_data, U32BIT *data_size, BOOLEAN *pos_valid,
6609  U16BIT *x_pos, U16BIT *y_pos, U16BIT *width, U16BIT *height, E_ICON_COORD_SYSTEM *coord_system)
6610 {
6611  BOOLEAN icon_available;
6612  ADB_SERVICE_REC *s_ptr;
6613  ADB_RCT_LINK_INFO *link;
6614  U8BIT icon_id;
6615  ADB_IMAGE_ICON *icon_ptr;
6616 
6617  FUNCTION_START(ADB_ServiceGetRCTIcon);
6618 
6619  icon_available = FALSE;
6620 
6621  if (serv_ptr != NULL)
6622  {
6624 
6625  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
6626 
6627  if (s_ptr->rct_link_list != NULL)
6628  {
6629  icon_id = 0;
6630 
6631  for (link = s_ptr->rct_link_list; (link != NULL) && (icon_id == 0); link = link->next)
6632  {
6633  if ((link->icon_id > 0) && (link->icon_id <= 7))
6634  {
6635  if (icon_id == 0)
6636  {
6637  icon_id = link->icon_id;
6638  }
6639  }
6640  }
6641 
6642  if (icon_id != 0)
6643  {
6644  /* Find the referenced icon */
6645  for (icon_ptr = s_ptr->icon_list; icon_ptr != NULL; icon_ptr = icon_ptr->next)
6646  {
6647  if (icon_ptr->icon_id == icon_id)
6648  {
6649  /* Check that the data is available */
6650  if (icon_ptr->icon_data != NULL)
6651  {
6652  *icon_data = icon_ptr->icon_data;
6653  *data_size = icon_ptr->data_len;
6654 
6655  *pos_valid = icon_ptr->position_defined;
6656  if (icon_ptr->position_defined)
6657  {
6658  *x_pos = icon_ptr->x_pos;
6659  *y_pos = icon_ptr->y_pos;
6660  }
6661 
6662  *width = icon_ptr->width;
6663  *height = icon_ptr->height;
6664  *coord_system = icon_ptr->coord_system;
6665 
6666  icon_available = TRUE;
6667  }
6668  break;
6669  }
6670  }
6671  }
6672  }
6673 
6675  }
6676 
6677  FUNCTION_FINISH(ADB_ServiceGetRCTIcon);
6678 
6679  return(icon_available);
6680 }
6681 
6686 void ADB_DeleteServiceRec(void *s_ptr)
6687 {
6688  FUNCTION_START(ADB_DeleteServiceRec);
6689 
6690  if (s_ptr != NULL)
6691  {
6693  DBDEF_DeleteServiceRec(s_ptr);
6695  }
6696 
6697  FUNCTION_FINISH(ADB_DeleteServiceRec);
6698 }
6699 
6706 void* ADB_GetAlternativeService(void *s_ptr, U8BIT alt_serv_type)
6707 {
6708  void *alt_serv;
6709  ADB_ALT_SERV_REC *alt_serv_rec;
6710 
6711  FUNCTION_START(ADB_GetAlternativeService);
6712 
6713  alt_serv = NULL;
6714  if (s_ptr != NULL)
6715  {
6717 
6718  // is there an alternate service?
6719  alt_serv_rec = ((ADB_SERVICE_REC *)s_ptr)->alt_serv_list;
6720  while (alt_serv_rec != NULL)
6721  {
6722  if (alt_serv_type == alt_serv_rec->link_type)
6723  {
6724  alt_serv = DBDEF_FindServiceRecByIds(NULL, ADB_INVALID_DVB_ID, alt_serv_rec->onet_id,
6725  alt_serv_rec->tran_id, alt_serv_rec->serv_id);
6726  if (alt_serv != NULL)
6727  {
6728  break;
6729  }
6730  }
6731  alt_serv_rec = alt_serv_rec->next;
6732  }
6734  }
6735  FUNCTION_FINISH(ADB_GetAlternativeService);
6736  return(alt_serv);
6737 }
6738 
6745 U16BIT ADB_ServiceGetSubtitlePid(void *serv_ptr, ADB_SUBT_INFO *subt_info)
6746 {
6747  U16BIT pid, text_pid;
6748  U16BIT cpage, apage;
6749  U8BIT magazine, page;
6750  E_STREAM_MATCH_TYPE dvb_match_type;
6751  E_STREAM_MATCH_TYPE ttx_match_type;
6752 
6753  FUNCTION_START(ADB_ServiceGetSubtitlePid);
6754 
6755  pid = 0;
6756  if (serv_ptr != NULL)
6757  {
6759  dvb_match_type = DBDEF_GetReqdSubtitleParams(serv_ptr, &pid, &cpage, &apage);
6760  ttx_match_type = DBDEF_GetReqdTtextPid(serv_ptr, TRUE, &text_pid, &magazine, &page);
6762 
6763  if (dvb_match_type != STREAM_MATCH_NONE && dvb_match_type <= ttx_match_type)
6764  {
6765  subt_info->is_dvb_subt = TRUE;
6766  subt_info->u.subt.cpage = cpage;
6767  subt_info->u.subt.apage = apage;
6768  }
6769  else if (ttx_match_type != STREAM_MATCH_NONE)
6770  {
6771  pid = text_pid;
6772  subt_info->is_dvb_subt = FALSE;
6773  subt_info->u.ttxt.magazine = magazine;
6774  subt_info->u.ttxt.page = page;
6775  }
6776  }
6777 
6778  FUNCTION_FINISH(ADB_ServiceGetSubtitlePid);
6779 
6780  return(pid);
6781 }
6782 
6789 BOOLEAN ADB_ServiceHasSubtitles(void *serv_ptr, BOOLEAN *dvb_subs)
6790 {
6791  BOOLEAN has_subs;
6792  U16BIT dvb_pid;
6793  U16BIT cpage, apage;
6794  E_STREAM_MATCH_TYPE dvb_match_type;
6795  E_STREAM_MATCH_TYPE ttx_match_type;
6796  U16BIT text_pid;
6797  U8BIT magazine, page;
6798 
6799  FUNCTION_START(ADB_ServiceHasSubtitles);
6800 
6801  has_subs = FALSE;
6802 
6803  if (serv_ptr != NULL)
6804  {
6806 
6807  /* Try for DVB subs first */
6808  dvb_match_type = DBDEF_GetReqdSubtitleParams(serv_ptr, &dvb_pid, &cpage, &apage);
6809 
6810  ttx_match_type = DBDEF_GetReqdTtextPid(serv_ptr, TRUE, &text_pid, &magazine, &page);
6811 
6812  if (dvb_match_type != STREAM_MATCH_NONE)
6813  {
6814  has_subs = TRUE;
6815 
6816  if (dvb_match_type <= ttx_match_type)
6817  {
6818  *dvb_subs = TRUE;
6819  }
6820  else
6821  {
6822  *dvb_subs = FALSE;
6823  }
6824  }
6825  else if (ttx_match_type != STREAM_MATCH_NONE)
6826  {
6827  has_subs = TRUE;
6828  *dvb_subs = FALSE;
6829  }
6830 
6832  }
6833 
6834  FUNCTION_FINISH(ADB_ServiceHasSubtitles);
6835 
6836  return(has_subs);
6837 }
6838 
6845 U16BIT ADB_GetNumStreams(void *serv_ptr, ADB_STREAM_LIST_TYPE stream_list_type)
6846 {
6847  U16BIT num_streams;
6848  ADB_STREAM_REC *stream_ptr;
6849 
6850  FUNCTION_START(ADB_GetNumStreams);
6851 
6853 
6854  num_streams = 0;
6855  stream_ptr = ((ADB_SERVICE_REC *)serv_ptr)->stream_list;
6856  while (stream_ptr != NULL)
6857  {
6858  if (IsStreamOfType(stream_ptr, stream_list_type))
6859  {
6860  num_streams++;
6861  }
6862 
6863  stream_ptr = stream_ptr->next;
6864  }
6865 
6867 
6868  FUNCTION_FINISH(ADB_GetNumStreams);
6869 
6870  return(num_streams);
6871 }
6872 
6882 void ADB_GetStreamList(void *serv_ptr, ADB_STREAM_LIST_TYPE stream_list_type, void ***streamlist_ptr,
6883  U16BIT *num_entries_ptr)
6884 {
6885  ADB_SERVICE_REC *s_ptr;
6886  U16BIT no_entries;
6887  U16BIT max_entries;
6888  ADB_STREAM_REC *stream_ptr;
6889  U16BIT i, j;
6890  S_STREAM *temp_stream;
6891  S_STREAM **temp_array;
6892  S_STREAM *sptr;
6893  U8BIT tag_index;
6894  ADB_EVENT_DESC *event_desc;
6895  U8BIT component_tag;
6896 
6897  FUNCTION_START(ADB_GetStreamList);
6898 
6900 
6901  no_entries = 0;
6902  max_entries = 0;
6903  temp_array = NULL;
6904 
6905  if (serv_ptr != NULL)
6906  {
6907  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
6908  stream_ptr = s_ptr->stream_list;
6909  while (stream_ptr != NULL)
6910  {
6911  max_entries++;
6912  stream_ptr = stream_ptr->next;
6913  }
6914 
6915  if (max_entries > 0)
6916  {
6917  temp_array = STB_AppGetMemory(max_entries * sizeof(S_STREAM *));
6918  if (temp_array != NULL)
6919  {
6920  stream_ptr = s_ptr->stream_list;
6921  for (i = 0; ((i < max_entries) && (stream_ptr != NULL)); i++)
6922  {
6923  if (IsStreamOfType(stream_ptr, stream_list_type))
6924  {
6925  temp_stream = STB_AppGetMemory(sizeof(S_STREAM));
6926  if (temp_stream != NULL)
6927  {
6928  temp_stream->num_tag_entries = 0;
6929  temp_stream->tag_array_ptr = STB_AppGetMemory(stream_ptr->num_tags * sizeof(S_COMPONENT));
6930  if ((temp_stream->tag_array_ptr != NULL) && (stream_ptr->tag_array != NULL))
6931  {
6932  for (tag_index = 0; tag_index < stream_ptr->num_tags; tag_index++)
6933  {
6934  temp_stream->tag_array_ptr[tag_index].tag = stream_ptr->tag_array[tag_index];
6935  }
6936  temp_stream->num_tag_entries = stream_ptr->num_tags;
6937  }
6938  temp_stream->pid = stream_ptr->pid;
6939  temp_stream->stream_type = stream_ptr->type;
6940  temp_stream->in_use = stream_ptr->in_use;
6941  temp_stream->has_ca_descriptor = stream_ptr->has_ca_descriptor;
6942 #if 0
6943  temp_stream->component_type = stream_ptr->component_type;
6944 #else
6945  /* Find the component type from the now event */
6946  if ((s_ptr->now_event != NULL) && (temp_stream->tag_array_ptr != NULL))
6947  {
6948  event_desc = s_ptr->now_event->desc_list_head;
6949 
6950  while ((event_desc = DBDEF_FindEventDescriptor(event_desc, COMPONENT_DTAG, 0)) != NULL)
6951  {
6952  component_tag = event_desc->desc_data[4];
6953 
6954  /* See if this stream has this component tag */
6955  for (tag_index = 0; tag_index != temp_stream->num_tag_entries; tag_index++)
6956  {
6957  if (temp_stream->tag_array_ptr[tag_index].tag == component_tag)
6958  {
6959  temp_stream->component_type = event_desc->desc_data[3];
6960  temp_stream->tag_array_ptr[tag_index].content = event_desc->desc_data[2]; /* stream_content_ext (bits 4..7) and stream_content (bits 0.3) */
6961  temp_stream->tag_array_ptr[tag_index].type = event_desc->desc_data[3];
6962  break;
6963  }
6964  }
6965 
6966  event_desc = event_desc->next;
6967  }
6968  }
6969 #endif
6970 
6971  if ((temp_stream->stream_type == ADB_AUDIO_STREAM) ||
6972  (temp_stream->stream_type == ADB_AAC_AUDIO_STREAM) ||
6973  (temp_stream->stream_type == ADB_HEAAC_AUDIO_STREAM) ||
6974  (temp_stream->stream_type == ADB_AC3_AUDIO_STREAM) ||
6975  (temp_stream->stream_type == ADB_EAC3_AUDIO_STREAM)
6976  )
6977  {
6978  /* For dual mono audio, a stream is available twice, with the same lang,
6979  * pid and type, so check for this and don't include it again unless all
6980  * streams have been asked for */
6981  if (stream_list_type != ADB_STREAM_LIST_ALL)
6982  {
6983  for (j = 0; j < no_entries; j++)
6984  {
6985  sptr = temp_array[j];
6986  if ((sptr->pid == stream_ptr->pid) &&
6987  (sptr->lang_code == stream_ptr->data.audio.lang_code))
6988  {
6989  /* This stream is already represented in the array being returned,
6990  * so this one can be ignored */
6991  STB_AppFreeMemory(temp_stream);
6992  temp_stream = NULL;
6993  break;
6994  }
6995  }
6996  }
6997 
6998  if (temp_stream != NULL)
6999  {
7000  temp_stream->lang_code = stream_ptr->data.audio.lang_code;
7001  temp_stream->audio_type = stream_ptr->data.audio.type;
7002  temp_stream->audio_mode = stream_ptr->data.audio.mode;
7003  }
7004  }
7005  else if (temp_stream->stream_type == ADB_SUBTITLE_STREAM)
7006  {
7007  temp_stream->lang_code = stream_ptr->data.subtitle.lang_code;
7008  temp_stream->subt_type = stream_ptr->data.subtitle.type;
7009  temp_stream->composition_page = stream_ptr->data.subtitle.composition_page;
7010  temp_stream->ancillary_page = stream_ptr->data.subtitle.ancillary_page;
7011  }
7012  else if (temp_stream->stream_type == ADB_TTEXT_STREAM)
7013  {
7014  temp_stream->lang_code = stream_ptr->data.ttext.lang_code;
7015  temp_stream->ttext_type = stream_ptr->data.ttext.type;
7016  temp_stream->ttext_magazine = stream_ptr->data.ttext.magazine;
7017  temp_stream->ttext_page = stream_ptr->data.ttext.page;
7018  }
7019 
7020  if (temp_stream != NULL)
7021  {
7022  temp_array[no_entries] = temp_stream;
7023  no_entries++;
7024  }
7025  }
7026  }
7027  stream_ptr = stream_ptr->next;
7028  }
7029 
7030  if (no_entries == 0)
7031  {
7032  STB_AppFreeMemory(temp_array);
7033  temp_array = NULL;
7034  }
7035  }
7036  }
7037  }
7038 
7039  *num_entries_ptr = no_entries;
7040  *streamlist_ptr = (void **)temp_array;
7041 
7043 
7044  FUNCTION_FINISH(ADB_GetStreamList);
7045 }
7046 
7052 void ADB_ReleaseStreamList(void **streamlist_ptr, U16BIT num_entries)
7053 {
7054  U16BIT i;
7055  S_STREAM *stream;
7056 
7057  FUNCTION_START(ADB_ReleaseStreamList);
7058 
7059  if (streamlist_ptr != NULL)
7060  {
7061  for (i = 0; i < num_entries; i++)
7062  {
7063  stream = streamlist_ptr[i];
7064  if (stream->tag_array_ptr != NULL)
7065  {
7066  STB_AppFreeMemory(stream->tag_array_ptr);
7067  }
7068 
7069  STB_AppFreeMemory(streamlist_ptr[i]);
7070  }
7071 
7072  STB_AppFreeMemory(streamlist_ptr);
7073  }
7074 
7075  FUNCTION_FINISH(ADB_ReleaseStreamList);
7076 }
7077 
7083 ADB_STREAM_TYPE ADB_GetStreamType(void *stream_ptr)
7084 {
7085  ADB_STREAM_TYPE stream_type;
7086  FUNCTION_START(ADB_GetStreamType);
7087 
7088  stream_type = 0;
7089 
7090  if (stream_ptr != NULL)
7091  {
7092  stream_type = ((S_STREAM *)stream_ptr)->stream_type;
7093  }
7094 
7095  FUNCTION_FINISH(ADB_GetStreamType);
7096  return(stream_type);
7097 }
7098 
7104 U8BIT ADB_GetStreamNumTags(void *stream_ptr)
7105 {
7106  U8BIT num;
7107 
7108  FUNCTION_START(ADB_GetStreamNumTags);
7109 
7110  num = 0;
7111 
7112  if (stream_ptr != NULL)
7113  {
7114  num = ((S_STREAM *)stream_ptr)->num_tag_entries;
7115  }
7116 
7117  FUNCTION_FINISH(ADB_GetStreamNumTags);
7118 
7119  return(num);
7120 }
7121 
7128 U8BIT ADB_GetStreamTag(void *stream_ptr, U8BIT index)
7129 {
7130  U8BIT tag;
7131  S_STREAM *stream;
7132 
7133  FUNCTION_START(ADB_GetStreamTag);
7134 
7135  tag = 0;
7136 
7137  if (stream_ptr != NULL)
7138  {
7139  stream = (S_STREAM *)stream_ptr;
7140 
7141  if ((index < stream->num_tag_entries) && (stream->tag_array_ptr != NULL))
7142  {
7143  tag = stream->tag_array_ptr[index].tag;
7144  }
7145  }
7146 
7147  FUNCTION_FINISH(ADB_GetStreamTag);
7148 
7149  return(tag);
7150 }
7151 
7157 U16BIT ADB_GetStreamPID(void *stream_ptr)
7158 {
7159  U16BIT pid;
7160  FUNCTION_START(ADB_GetStreamPID);
7161 
7162  pid = 0;
7163  if (stream_ptr != NULL)
7164  {
7165  pid = ((S_STREAM *)stream_ptr)->pid;
7166  }
7167 
7168  FUNCTION_FINISH(ADB_GetStreamPID);
7169  return(pid);
7170 }
7171 
7178 BOOLEAN ADB_GetStreamInUse(void *stream_ptr)
7179 {
7180  BOOLEAN in_use;
7181  FUNCTION_START(ADB_GetStreamInUse);
7182 
7183  in_use = FALSE;
7184  if (stream_ptr != NULL)
7185  {
7186  in_use = ((S_STREAM *)stream_ptr)->in_use;
7187  }
7188 
7189  FUNCTION_FINISH(ADB_GetStreamInUse);
7190  return(in_use);
7191 }
7192 
7198 BOOLEAN ADB_GetStreamHasCaDesc(void *stream_ptr)
7199 {
7200  BOOLEAN has_ca_desc;
7201  FUNCTION_START(ADB_GetStreamHasCaDesc);
7202 
7203  has_ca_desc = FALSE;
7204  if (stream_ptr != NULL)
7205  {
7206  has_ca_desc = ((S_STREAM *)stream_ptr)->has_ca_descriptor;
7207  }
7208 
7209  FUNCTION_FINISH(ADB_GetStreamHasCaDesc);
7210  return(has_ca_desc);
7211 }
7212 
7218 U32BIT ADB_GetAudioStreamLangCode(void *stream_ptr)
7219 {
7220  U32BIT lang_code;
7221  FUNCTION_START(ADB_GetAudioStreamLangCode);
7222 
7223  lang_code = 0;
7224  if (stream_ptr != NULL)
7225  {
7226  lang_code = ((S_STREAM *)stream_ptr)->lang_code;
7227  }
7228 
7229  FUNCTION_FINISH(ADB_GetAudioStreamLangCode);
7230  return(lang_code);
7231 }
7232 
7238 ADB_AUDIO_TYPE ADB_GetAudioStreamType(void *stream_ptr)
7239 {
7240  ADB_AUDIO_TYPE type;
7241  FUNCTION_START(ADB_GetAudioStreamType);
7242 
7243  type = 0;
7244  if (stream_ptr != NULL)
7245  {
7246  type = ((S_STREAM *)stream_ptr)->audio_type;
7247  }
7248 
7249  FUNCTION_FINISH(ADB_GetAudioStreamType);
7250  return(type);
7251 }
7252 
7258 E_STB_DP_AUDIO_MODE ADB_GetAudioStreamMode(void *stream_ptr)
7259 {
7260  E_STB_DP_AUDIO_MODE mode = AUDIO_UNDEF;
7261 
7262  FUNCTION_START(ADB_GetAudioStreamMode);
7263 
7264  if (stream_ptr != NULL)
7265  {
7266  mode = ((S_STREAM *)stream_ptr)->audio_mode;
7267  }
7268 
7269  FUNCTION_FINISH(ADB_GetAudioStreamMode);
7270 
7271  return mode;
7272 }
7273 
7279 U32BIT ADB_GetTtextStreamLangCode(void *stream_ptr)
7280 {
7281  U32BIT lang_code;
7282  FUNCTION_START(ADB_GetTtextStreamLangCode);
7283 
7284  lang_code = 0;
7285  if (stream_ptr != NULL)
7286  {
7287  lang_code = ((S_STREAM *)stream_ptr)->lang_code;
7288  }
7289 
7290  FUNCTION_FINISH(ADB_GetTtextStreamLangCode);
7291  return(lang_code);
7292 }
7293 
7299 U8BIT ADB_GetTtextStreamType(void *stream_ptr)
7300 {
7301  U8BIT type;
7302  FUNCTION_START(ADB_GetTtextStream);
7303 
7304  type = 0;
7305  if (stream_ptr != NULL)
7306  {
7307  type = ((S_STREAM *)stream_ptr)->ttext_type;
7308  }
7309 
7310  FUNCTION_FINISH(ADB_GetTtextStreamType);
7311  return(type);
7312 }
7313 
7319 U8BIT ADB_GetTtextStreamMagazine(void *stream_ptr)
7320 {
7321  U8BIT magazine;
7322  FUNCTION_START(ADB_GetTtextStreamMagazine);
7323 
7324  magazine = 0;
7325  if (stream_ptr != NULL)
7326  {
7327  magazine = ((S_STREAM *)stream_ptr)->ttext_magazine;
7328  }
7329 
7330  FUNCTION_FINISH(ADB_GetTtextStreamMagazine);
7331  return(magazine);
7332 }
7333 
7339 U8BIT ADB_GetTtextStreamPage(void *stream_ptr)
7340 {
7341  U8BIT page;
7342  FUNCTION_START(ADB_GetTtextStreamPage);
7343 
7344  page = 0;
7345  if (stream_ptr != NULL)
7346  {
7347  page = ((S_STREAM *)stream_ptr)->ttext_page;
7348  }
7349 
7350  FUNCTION_FINISH(ADB_GetTtextStreamPage);
7351  return(page);
7352 }
7353 
7359 U32BIT ADB_GetSubtitleStreamLangCode(void *stream_ptr)
7360 {
7361  U32BIT lang_code;
7362  FUNCTION_START(ADB_GetSubtitleStreamLangCode);
7363 
7364  lang_code = 0;
7365  if (stream_ptr != NULL)
7366  {
7367  lang_code = ((S_STREAM *)stream_ptr)->lang_code;
7368  }
7369 
7370  FUNCTION_FINISH(ADB_GetSubtitleStreamLangCode);
7371  return(lang_code);
7372 }
7373 
7380 {
7381  U16BIT comp_page;
7382  FUNCTION_START(ADB_GetSubtitleStreamCompositionPage);
7383 
7384  comp_page = 0;
7385  if (stream_ptr != NULL)
7386  {
7387  comp_page = ((S_STREAM *)stream_ptr)->composition_page;
7388  }
7389 
7390  FUNCTION_FINISH(ADB_GetSubtitleStreamCompositionPage);
7391  return(comp_page);
7392 }
7393 
7399 U16BIT ADB_GetSubtitleStreamAncillaryPage(void *stream_ptr)
7400 {
7401  U16BIT anc_page;
7402  FUNCTION_START(ADB_GetSubtitleStreamAncillaryPage);
7403 
7404  anc_page = 0;
7405  if (stream_ptr != NULL)
7406  {
7407  anc_page = ((S_STREAM *)stream_ptr)->ancillary_page;
7408  }
7409 
7410  FUNCTION_FINISH(ADB_GetSubtitleStreamAncillaryPage);
7411  return(anc_page);
7412 }
7413 
7420 U8BIT ADB_GetStreamComponentType(void *stream_ptr)
7421 {
7422  U8BIT component_type = 0;
7423 
7424  FUNCTION_START(ADB_GetStreamComponentType);
7425 
7426  if (stream_ptr != NULL)
7427  {
7428  component_type = ((S_STREAM *)stream_ptr)->component_type;
7429  }
7430 
7431  FUNCTION_FINISH(ADB_GetStreamComponentType);
7432 
7433  return component_type;
7434 }
7435 
7444 U16BIT ADB_GetStreamTagContentType(void *stream_ptr, U8BIT index)
7445 {
7446  U16BIT content_type;
7447  S_STREAM *stream;
7448 
7449  FUNCTION_START(ADB_GetStreamTagContentType);
7450 
7451  content_type = 0;
7452 
7453  if (stream_ptr != NULL)
7454  {
7455  stream = (S_STREAM *)stream_ptr;
7456 
7457  if ((index < stream->num_tag_entries) && (stream->tag_array_ptr != NULL))
7458  {
7459  content_type = (U16BIT)(stream->tag_array_ptr[index].content << 8) | (U16BIT)stream->tag_array_ptr[index].type;
7460  }
7461  }
7462 
7463  FUNCTION_FINISH(ADB_GetStreamTagContentType);
7464 
7465  return(content_type);
7466 }
7467 
7473 ADB_SUBTITLE_TYPE ADB_GetSubtitleStreamType(void *stream_ptr)
7474 {
7475  ADB_SUBTITLE_TYPE type;
7476  FUNCTION_START(ADB_GetSubtitleStreamType);
7477 
7478  type = 0;
7479  if (stream_ptr != NULL)
7480  {
7481  type = ((S_STREAM *)stream_ptr)->subt_type;
7482  }
7483 
7484  FUNCTION_FINISH(ADB_GetSubtitleStreamType);
7485  return(type);
7486 }
7487 
7493 void ADB_SetAudioLang(U32BIT country_code, U8BIT db_lang_id)
7494 {
7495  U8BIT *lang_ids;
7496 
7497  FUNCTION_START(ADB_SetAudioLang);
7498 
7499  lang_ids = ACFG_GetDbLangId(country_code, db_lang_id);
7500  if (lang_ids != NULL)
7501  {
7503  DBDEF_SetAudioLang(lang_ids);
7505  }
7506 
7507  FUNCTION_FINISH(ADB_SetAudioLang);
7508 }
7509 
7516 void ADB_SetSecondaryAudioLang(U32BIT country_code, U8BIT lang_id)
7517 {
7518  U8BIT *lang_ids;
7519 
7520  FUNCTION_START(ADB_SetSecondaryAudioLang);
7521 
7522  lang_ids = ACFG_GetDbLangId(country_code, lang_id);
7523  if (lang_ids != NULL)
7524  {
7526  DBDEF_SetSecondaryAudioLang(lang_ids);
7528  }
7529 
7530  FUNCTION_FINISH(ADB_SetSecondaryAudioLang);
7531 }
7532 
7538 void ADB_SetTextLang(U32BIT country_code, U8BIT lang_id)
7539 {
7540  U8BIT *lang_ids;
7541 
7542  FUNCTION_START(ADB_SetTextLang);
7543 
7544  lang_ids = ACFG_GetDbLangId(country_code, lang_id);
7545  if (lang_ids != NULL)
7546  {
7548  DBDEF_SetTextLang(lang_ids);
7550  }
7551 
7552  FUNCTION_FINISH(ADB_SetTextLang);
7553 }
7554 
7561 void ADB_SetSecondaryTextLang(U32BIT country_code, U8BIT lang_id)
7562 {
7563  U8BIT *lang_ids;
7564 
7565  FUNCTION_START(ADB_SetSecondaryTextLang);
7566 
7567  lang_ids = ACFG_GetDbLangId(country_code, lang_id);
7568  if (lang_ids != NULL)
7569  {
7571  DBDEF_SetSecondaryTextLang(lang_ids);
7573  }
7574 
7575  FUNCTION_FINISH(ADB_SetSecondaryTextLang);
7576 }
7577 
7587 void ADB_GetNowNextEvents(void *serv_ptr, void **v_now_event, void **v_next_event)
7588 {
7589  FUNCTION_START(ADB_GetNowNextEvents);
7590 
7591  if (v_now_event != NULL)
7592  {
7593  *v_now_event = NULL;
7594  }
7595  if (v_next_event != NULL)
7596  {
7597  *v_next_event = NULL;
7598  }
7599 
7600  if (serv_ptr != NULL)
7601  {
7603 
7604  /* The FTA content management descriptor is only "valid" for the now
7605  * event, even if it is included in others for info purposes, but searching
7606  * for it in each event could take quite a while, so just do it for the now event */
7607  if (v_now_event != NULL)
7608  {
7609  *v_now_event = (void *)CopyEventRec(((ADB_SERVICE_REC *)serv_ptr)->now_event, (ADB_SERVICE_REC *)serv_ptr);
7610  }
7611 
7612  if (v_next_event != NULL)
7613  {
7614  *v_next_event = (void *)CopyEventRec(((ADB_SERVICE_REC *)serv_ptr)->next_event, (ADB_SERVICE_REC *)serv_ptr);
7615  }
7616 
7618  }
7619 
7620  FUNCTION_FINISH(ADB_GetNowNextEvents);
7621 }
7622 
7634 void ADB_GetEventSchedule(BOOLEAN include_old_events, void *serv_ptr, void ***elist_ptr,
7635  U16BIT *num_entries_ptr)
7636 {
7637  void **elist;
7638  U16BIT max_no_entries;
7639  U16BIT num_entries;
7640  ADB_SERVICE_REC *s_ptr;
7641  ADB_EVENT_REC *e_ptr;
7642  ADB_EVENT_REC *event_ptr;
7643  S_EVENT *tmp_event;
7644  U32DHMS end_time;
7645 
7646  FUNCTION_START(ADB_GetEventSchedule);
7647 
7648  // initialise return values
7649  num_entries = 0;
7650  elist = NULL;
7651 
7652  // Check service ptr is not null
7653  if (serv_ptr != NULL)
7654  {
7656 
7657  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
7658 
7659  max_no_entries = 0;
7660 
7661  if (!include_old_events)
7662  {
7663  /* Use now/next as the first 2 events if they're present */
7664  if (s_ptr->now_event != NULL)
7665  {
7666  max_no_entries++;
7667  }
7668 
7669  if (s_ptr->next_event != NULL)
7670  {
7671  max_no_entries++;
7672  }
7673  }
7674 
7675  max_no_entries += s_ptr->num_events_in_schedule;
7676 
7677  if (max_no_entries > 0)
7678  {
7679  elist = STB_AppGetMemory(max_no_entries * sizeof(void *));
7680  if (elist != NULL)
7681  {
7682  e_ptr = s_ptr->event_schedule;
7683 
7684  if (!include_old_events)
7685  {
7686  /* Start list with now/next followed by events from the schedule */
7687  tmp_event = NULL;
7688  event_ptr = NULL;
7689 
7690  if (s_ptr->now_event != NULL)
7691  {
7692  tmp_event = CopyEventRec(s_ptr->now_event, s_ptr);
7693  if (tmp_event != NULL)
7694  {
7695  event_ptr = s_ptr->now_event;
7696  elist[num_entries] = tmp_event;
7697  num_entries++;
7698  }
7699  }
7700 
7701  if (s_ptr->next_event != NULL)
7702  {
7703  tmp_event = CopyEventRec(s_ptr->next_event, s_ptr);
7704  if (tmp_event != NULL)
7705  {
7706  event_ptr = s_ptr->next_event;
7707  elist[num_entries] = tmp_event;
7708  num_entries++;
7709  }
7710  }
7711 
7712  if (event_ptr != NULL)
7713  {
7714  /* Get the end time of the last event (either now or next) */
7715  end_time = STB_GCCalculateDHMS(event_ptr->start, event_ptr->duration, CALC_ADD);
7716 
7717  /* Find the first event in the schedule that starts after the 'next' event ends */
7718  while (e_ptr != NULL)
7719  {
7720  if (end_time <= e_ptr->start)
7721  {
7722  break;
7723  }
7724  e_ptr = e_ptr->next;
7725  }
7726  }
7727  }
7728 
7729  // go through event schedule copying each event in turn
7730  for (; (num_entries != max_no_entries) && (e_ptr != NULL); )
7731  {
7732  tmp_event = CopyEventRec(e_ptr, s_ptr);
7733  if (tmp_event != NULL)
7734  {
7735  elist[num_entries] = tmp_event;
7736  num_entries++;
7737  }
7738  e_ptr = e_ptr->next;
7739  }
7740  }
7741  else
7742  {
7743  num_entries = 0;
7744  }
7745  }
7746 
7748  }
7749 
7750  *elist_ptr = elist;
7751  *num_entries_ptr = num_entries;
7752 
7753  FUNCTION_FINISH(ADB_GetEventSchedule);
7754 }
7755 
7767 void ADB_GetEventScheduleByGenre(ADB_EVENT_CONTENT genre, BOOLEAN include_old_events, void *serv_ptr,
7768  void ***elist_ptr, U16BIT *num_entries_ptr)
7769 {
7770  void **elist;
7771  U16BIT max_no_entries;
7772  U16BIT num_entries;
7773  ADB_SERVICE_REC *s_ptr;
7774  ADB_EVENT_REC *e_ptr;
7775  ADB_EVENT_REC *event_ptr;
7776  S_EVENT *tmp_event;
7777  U32DHMS end_time;
7778 
7779  FUNCTION_START(ADB_GetEventScheduleByGenre);
7780 
7781  // initailise return values
7782  num_entries = 0;
7783  elist = NULL;
7784 
7785  // Check service ptr is not null
7786  if (serv_ptr != NULL)
7787  {
7789 
7790  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
7791 
7792  max_no_entries = 0;
7793 
7794  if (!include_old_events)
7795  {
7796  /* Use now/next as the first 2 events if they're present */
7797  if (s_ptr->now_event != NULL)
7798  {
7799  max_no_entries++;
7800  }
7801 
7802  if (s_ptr->next_event != NULL)
7803  {
7804  max_no_entries++;
7805  }
7806  }
7807 
7808  max_no_entries += s_ptr->num_events_in_schedule;
7809 
7810  if (max_no_entries > 0)
7811  {
7812  elist = STB_AppGetMemory(max_no_entries * sizeof(void *));
7813  if (elist != NULL)
7814  {
7815  e_ptr = s_ptr->event_schedule;
7816 
7817  if (!include_old_events)
7818  {
7819  /* Start list with now/next followed by events from the schedule */
7820  tmp_event = NULL;
7821  event_ptr = NULL;
7822 
7823  if (s_ptr->now_event != NULL)
7824  {
7825  if (DBDEF_GetEventGenre(s_ptr->now_event, s_ptr) == genre)
7826  {
7827  /* The FTA content management descriptor is only "valid" for the now
7828  * event, even if it is included in others for info purposes, but searching
7829  * for it in each event could take quite a while, so just do it for the now event */
7830  tmp_event = CopyEventRec(s_ptr->now_event, s_ptr);
7831  if (tmp_event != NULL)
7832  {
7833  event_ptr = s_ptr->now_event;
7834  elist[num_entries] = tmp_event;
7835  num_entries++;
7836  }
7837  }
7838  }
7839 
7840  if (s_ptr->next_event != NULL)
7841  {
7842  if (DBDEF_GetEventGenre(s_ptr->next_event, s_ptr) == genre)
7843  {
7844  tmp_event = CopyEventRec(s_ptr->next_event, s_ptr);
7845  if (tmp_event != NULL)
7846  {
7847  event_ptr = s_ptr->next_event;
7848  elist[num_entries] = tmp_event;
7849  num_entries++;
7850  }
7851  }
7852  }
7853 
7854  if (event_ptr != NULL)
7855  {
7856  /* Get the end time of the last event (either now or next) */
7857  end_time = STB_GCCalculateDHMS(event_ptr->start, event_ptr->duration, CALC_ADD);
7858 
7859  /* Find the first event in the schedule that starts after the 'next' event ends */
7860  while (e_ptr != NULL)
7861  {
7862  if (end_time <= e_ptr->start)
7863  {
7864  break;
7865  }
7866 
7867  e_ptr = e_ptr->next;
7868  }
7869  }
7870  }
7871 
7872  // go through event schedule copying each event in turn
7873  for (; (num_entries < max_no_entries) && (e_ptr != NULL); )
7874  {
7875  if (DBDEF_GetEventGenre(e_ptr, s_ptr) == genre)
7876  {
7877  tmp_event = CopyEventRec(e_ptr, s_ptr);
7878  if (tmp_event != NULL)
7879  {
7880  elist[num_entries] = tmp_event;
7881  num_entries++;
7882  }
7883  }
7884 
7885  e_ptr = e_ptr->next;
7886  }
7887  }
7888  else
7889  {
7890  num_entries = 0;
7891  }
7892  }
7893 
7895  }
7896 
7897  *elist_ptr = elist;
7898  *num_entries_ptr = num_entries;
7899 
7900  FUNCTION_FINISH(ADB_GetEventScheduleByGenre);
7901 }
7902 
7907 void ADB_ReleaseEventData(void *event_ptr)
7908 {
7909  FUNCTION_START(ADB_ReleaseEventData);
7910 
7911  if (event_ptr != NULL)
7912  {
7913  STB_AppFreeMemory(event_ptr);
7914  }
7915 
7916  FUNCTION_FINISH(ADB_ReleaseEventData);
7917 }
7918 
7924 void ADB_ReleaseEventList(void **elist, U16BIT num_entries)
7925 {
7926  U16BIT i;
7927 
7928  FUNCTION_START(ADB_ReleaseEventList);
7929 
7930  if (elist != NULL)
7931  {
7932  for (i = 0; i < num_entries; i++)
7933  {
7934  ADB_ReleaseEventData(elist[i]);
7935  }
7936 
7937  // release the event list itself
7938  STB_AppFreeMemory(elist);
7939  }
7940 
7941  FUNCTION_FINISH(ADB_ReleaseEventList);
7942 }
7943 
7949 void ADB_DeleteServiceEvents(void *serv_ptr, BOOLEAN delete_now_next)
7950 {
7951  ADB_SERVICE_REC *s_ptr;
7952 
7953  FUNCTION_START(ADB_DeleteServiceEvents);
7954 
7955  if (serv_ptr != NULL)
7956  {
7957  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
7958 
7960 
7961  if (s_ptr->event_schedule != NULL)
7962  {
7963  DBDEF_DeleteEventList(s_ptr->event_schedule);
7964  s_ptr->event_schedule = NULL;
7965  s_ptr->num_events_in_schedule = 0;
7966  ASI_NotifyEitSchedUpdate(s_ptr, 0, APP_SI_EIT_JOURNAL_TYPE_CLEAR);
7967  }
7968 
7969  if (delete_now_next)
7970  {
7971  if (s_ptr->now_event != NULL)
7972  {
7973  DBDEF_DeleteEventList(s_ptr->now_event);
7974  s_ptr->now_event = NULL;
7975  }
7976 
7977  if (s_ptr->next_event != NULL)
7978  {
7979  DBDEF_DeleteEventList(s_ptr->next_event);
7980  s_ptr->next_event = NULL;
7981  }
7982  }
7983 
7985  }
7986 
7987  FUNCTION_FINISH(ADB_DeleteServiceEvents);
7988 }
7989 
7994 void ADB_DeleteAllServiceEvents(BOOLEAN delete_now_next)
7995 {
7996  U16BIT num_services;
7997  U16BIT index;
7998  void **slist;
7999 
8000  FUNCTION_START(ADB_DeleteAllServiceEvents);
8001 
8002  ADB_GetServiceList(ADB_SERVICE_LIST_ALL, &slist, &num_services);
8003 
8004  if ((num_services > 0) && (slist != NULL))
8005  {
8006  for (index = 0; index < num_services; index++)
8007  {
8008  if (slist[index] != NULL)
8009  {
8010  ADB_DeleteServiceEvents(slist[index], delete_now_next);
8011  }
8012  }
8013 
8014  STB_AppFreeMemory(slist);
8015  }
8016 
8017  FUNCTION_FINISH(ADB_DeleteAllServiceEvents);
8018 }
8019 
8026 void* ADB_GetEvent(void *serv_ptr, U16BIT event_id)
8027 {
8028  ADB_SERVICE_REC *s_ptr;
8029  ADB_EVENT_REC *e_ptr;
8030  void *event_ptr = NULL;
8031 
8032  FUNCTION_START(ADB_GetEvent);
8033 
8034  if (serv_ptr != NULL)
8035  {
8037 
8038  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
8039  e_ptr = DBDEF_FindScheduleEventById(s_ptr, event_id);
8040  if (e_ptr != NULL)
8041  {
8042  event_ptr = (void *)CopyEventRec(e_ptr, s_ptr);
8043  }
8044 
8046  }
8047 
8048  FUNCTION_FINISH(ADB_GetEvent);
8049 
8050  return(event_ptr);
8051 }
8052 
8065 U8BIT* ADB_GetEventSIDescriptorData(void *serv_ptr, U16BIT event_id, U8BIT dtag_id,
8066  S16BIT ext_dtag_id, U16BIT *desc_len)
8067 {
8068  U8BIT *desc_data;
8069 #ifdef INTEGRATE_HBBTV
8070  ADB_SERVICE_REC *s_ptr;
8071  ADB_EVENT_REC *e_ptr;
8072  ADB_EVENT_DESC *event_desc;
8073  U16BIT num_bytes;
8074  U8BIT *desc_ptr;
8075 #endif
8076 
8077  FUNCTION_START(ADB_GetEventSIDescriptorData);
8078 
8079  desc_data = NULL;
8080  *desc_len = 0;
8081 
8082 #ifdef INTEGRATE_HBBTV
8083  if (serv_ptr != NULL)
8084  {
8086 
8087  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
8088  e_ptr = DBDEF_FindScheduleEventById(s_ptr, event_id);
8089  if (e_ptr != NULL)
8090  {
8091  /* Search for the requested descriptor to get the number of bytes to be returned */
8092  num_bytes = 0;
8093  event_desc = e_ptr->desc_list_head;
8094 
8095  while ((event_desc = DBDEF_FindEventDescriptor(event_desc, dtag_id, 0)) != NULL)
8096  {
8097  if ((ext_dtag_id < 0) ||
8098  ((event_desc->desc_data[0] == EXTENSION_DTAG) && (event_desc->desc_data[2] == ext_dtag_id)))
8099  {
8100  /* This descriptor needs to be copied
8101  * +2 for the dtag and length */
8102  num_bytes += event_desc->desc_data[1] + 2;
8103  }
8104 
8105  event_desc = event_desc->next;
8106  }
8107 
8108  /* Check there's data to be returned */
8109  if (num_bytes > 0)
8110  {
8111  if ((desc_data = STB_AppGetMemory(num_bytes)) != NULL)
8112  {
8113  *desc_len = num_bytes;
8114  desc_ptr = desc_data;
8115 
8116  event_desc = e_ptr->desc_list_head;
8117 
8118  while ((event_desc = DBDEF_FindEventDescriptor(event_desc, dtag_id, 0)) != NULL)
8119  {
8120  if ((ext_dtag_id < 0) ||
8121  ((event_desc->desc_data[0] == EXTENSION_DTAG) && (event_desc->desc_data[2] == ext_dtag_id)))
8122  {
8123  /* This descriptor needs to be copied */
8124  memcpy(desc_ptr, &event_desc->desc_data[0], event_desc->desc_data[1] + 2);
8125  desc_ptr += event_desc->desc_data[1] + 2;
8126  }
8127 
8128  event_desc = event_desc->next;
8129  }
8130  }
8131  }
8132  }
8133 
8135  }
8136 #else
8137  USE_UNWANTED_PARAM(serv_ptr);
8138  USE_UNWANTED_PARAM(event_id);
8139  USE_UNWANTED_PARAM(dtag_id);
8140  USE_UNWANTED_PARAM(ext_dtag_id);
8141 #endif
8142 
8143  FUNCTION_FINISH(ADB_GetEventSIDescriptorData);
8144 
8145  return(desc_data);
8146 }
8147 
8153 void ADB_ReleaseEventSIDescriptorData(U8BIT *desc_data, U16BIT desc_len)
8154 {
8155  FUNCTION_START(ADB_ReleaseEventSIDescriptorData);
8156 
8157  if ((desc_data != NULL) && (desc_len > 0))
8158  {
8159  STB_AppFreeMemory(desc_data);
8160  }
8161 
8162  FUNCTION_FINISH(ADB_ReleaseEventSIDescriptorData);
8163 }
8164 
8171 void* ADB_EarlierEvent(void *serv_ptr, U32DHMS time)
8172 {
8173  ADB_SERVICE_REC *s_ptr;
8174  ADB_EVENT_REC *e_ptr;
8175  ADB_EVENT_REC *prev_ptr;
8176  void *event_ptr = NULL;
8177 
8178  FUNCTION_START(ADB_GetEarlierEvent);
8179 
8180  if (serv_ptr != NULL)
8181  {
8183 
8184  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
8185 
8186  if (s_ptr->num_events_in_schedule != 0)
8187  {
8188  /* Find the first schedule event with a date/time >= the given time */
8189  prev_ptr = NULL;
8190  for (e_ptr = s_ptr->event_schedule; e_ptr != NULL; e_ptr = e_ptr->next)
8191  {
8192  if (e_ptr->start >= time)
8193  {
8194  if (prev_ptr != NULL)
8195  {
8196  /* The previous event is the earlier event to be returned */
8197  event_ptr = (void *)CopyEventRec(prev_ptr, s_ptr);
8198  }
8199  break;
8200  }
8201 
8202  prev_ptr = e_ptr;
8203  }
8204  }
8205  else
8206  {
8207  /* There is no schedule yet so just check the now/next events */
8208  if (s_ptr->now_event != NULL)
8209  {
8210  e_ptr = s_ptr->now_event;
8211 
8212  if (e_ptr->start < time)
8213  {
8214  event_ptr = (void *)CopyEventRec(e_ptr, s_ptr);
8215  }
8216  }
8217  else if (s_ptr->next_event != NULL)
8218  {
8219  e_ptr = s_ptr->next_event;
8220 
8221  if (e_ptr->start < time)
8222  {
8223  event_ptr = (void *)CopyEventRec(e_ptr, s_ptr);
8224  }
8225  }
8226  }
8227 
8229  }
8230 
8231  FUNCTION_FINISH(ADB_GetEarlierEvent);
8232 
8233  return(event_ptr);
8234 }
8235 
8244 void* ADB_GetEarlierEvent(void *serv_ptr, U16BIT date, U8BIT hour, U8BIT min)
8245 {
8246  return ADB_EarlierEvent(serv_ptr, DHMS_CREATE(date, hour, min, 0));
8247 }
8248 
8255 void* ADB_LaterEvent(void *serv_ptr, U32DHMS time)
8256 {
8257  ADB_SERVICE_REC *s_ptr;
8258  ADB_EVENT_REC *e_ptr;
8259  void *event_ptr = NULL;
8260 
8261  FUNCTION_START(ADB_GetLaterEvent);
8262 
8263  if (serv_ptr != NULL)
8264  {
8266 
8267  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
8268 
8269  if (s_ptr->num_events_in_schedule != 0)
8270  {
8271  /* Iterate through the event schedule to find the first event with a
8272  * start date/time later than the given date/time */
8273  for (e_ptr = s_ptr->event_schedule; e_ptr != NULL; e_ptr = e_ptr->next)
8274  {
8275  if (e_ptr->start >= time)
8276  {
8277  event_ptr = (void *)CopyEventRec(e_ptr, s_ptr);
8278  break;
8279  }
8280  }
8281  }
8282  else
8283  {
8284  /* There is no schedule yet so just check the now/next events */
8285  if (s_ptr->now_event != NULL)
8286  {
8287  e_ptr = s_ptr->now_event;
8288 
8289  if (e_ptr->start >= time)
8290  {
8291  event_ptr = (void *)CopyEventRec(e_ptr, s_ptr);
8292  }
8293  }
8294  else if (s_ptr->next_event != NULL)
8295  {
8296  e_ptr = s_ptr->next_event;
8297 
8298  if (e_ptr->start >= time)
8299  {
8300  event_ptr = (void *)CopyEventRec(e_ptr, s_ptr);
8301  }
8302  }
8303  }
8304 
8306  }
8307 
8308  FUNCTION_FINISH(ADB_GetLaterEvent);
8309 
8310  return(event_ptr);
8311 }
8312 
8321 void* ADB_GetLaterEvent(void *serv_ptr, U16BIT date, U8BIT hour, U8BIT min)
8322 {
8323  return ADB_LaterEvent(serv_ptr, DHMS_CREATE(date, hour, min, 0));
8324 }
8325 
8332 void* ADB_FindEventFromTime(U32DHMS time, void *serv_ptr)
8333 {
8334  void *retval;
8335  U32DHMS end_time;
8336  ADB_SERVICE_REC *s_ptr;
8337  ADB_EVENT_REC *event_ptr;
8338 
8339  FUNCTION_START(ADB_FindEventFromTime);
8340 
8341  // initialise return values
8342  retval = NULL;
8343 
8344  // Check service ptr is not null
8345  if (serv_ptr != NULL)
8346  {
8348 
8349  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
8350 
8351  end_time = 0;
8352 
8353  /* Use now/next as the first 2 events if they're present */
8354  event_ptr = s_ptr->now_event;
8355  if (event_ptr != NULL)
8356  {
8357  /* Get the end time of the "now" event */
8358  end_time = STB_GCCalculateDHMS(event_ptr->start, event_ptr->duration, CALC_ADD);
8359 
8360  if( EventAtTime(event_ptr, time) )
8361  {
8362  retval = CopyEventRec(event_ptr, s_ptr);
8363  }
8364  }
8365 
8366  if (retval == NULL)
8367  {
8368  event_ptr = s_ptr->next_event;
8369  if (event_ptr != NULL)
8370  {
8371  /* Get the end time of the "next" event */
8372  end_time = STB_GCCalculateDHMS(event_ptr->start, event_ptr->duration, CALC_ADD);
8373 
8374  if( EventAtTime(event_ptr, time) )
8375  {
8376  retval = CopyEventRec(event_ptr, s_ptr);
8377  }
8378  }
8379  }
8380 
8382 
8383  if (retval == NULL)
8384  {
8385  if(end_time <= time)
8386  {
8387  retval = ADB_FindEITScheduleEventFromTime(time, serv_ptr);
8388  }
8389  }
8390  }
8391 
8392  FUNCTION_FINISH(ADB_FindEventFromTime);
8393 
8394  return retval;
8395 }
8396 
8397 void* ADB_FindEITScheduleEventFromTime(U32DHMS time, void *serv_ptr)
8398 {
8399  void *retval;
8400  ADB_SERVICE_REC *s_ptr;
8401  ADB_EVENT_REC *e_ptr;
8402 
8403  FUNCTION_START(ADB_FindEITScheduleEventFromTime);
8404 
8405  // initialise return values
8406  retval = NULL;
8407 
8408  // Check service ptr is not null
8409  if (serv_ptr != NULL)
8410  {
8412 
8413  s_ptr = (ADB_SERVICE_REC *)serv_ptr;
8414 
8415  if (s_ptr->num_events_in_schedule != 0)
8416  {
8417  // go through event schedule checking each event in turn
8418  for(e_ptr = s_ptr->event_schedule; e_ptr != NULL; e_ptr = e_ptr->next)
8419  {
8420  if ( EventAtTime(e_ptr, time) )
8421  {
8422  retval = CopyEventRec(e_ptr, s_ptr);
8423  break;
8424  }
8425  }
8426  }
8427 
8429  }
8430 
8431  FUNCTION_FINISH(ADB_FindEITScheduleEventFromTime);
8432 
8433  return retval;
8434 }
8435 
8441 U32DHMS ADB_GetEventStartDateTime(void *event_ptr)
8442 {
8443  ADB_EVENT_REC *e_ptr;
8444  U32DHMS start;
8445 
8446  FUNCTION_START(ADB_GetEventStartDateTime);
8447 
8448  start = 0;
8449 
8450  if (event_ptr != NULL)
8451  {
8453 
8454  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8455  if (e_ptr != NULL)
8456  {
8457  start = e_ptr->start;
8458  }
8459 
8461  }
8462 
8463  FUNCTION_FINISH(ADB_GetEventStartDateTime);
8464 
8465  return(start);
8466 }
8467 
8473 U16BIT ADB_GetEventStartDate(void *event_ptr)
8474 {
8475  return DHMS_DATE(ADB_GetEventStartDateTime(event_ptr));
8476 }
8477 
8483 U8BIT ADB_GetEventStartHour(void *event_ptr)
8484 {
8485  return DHMS_HOUR(ADB_GetEventStartDateTime(event_ptr));
8486 }
8487 
8493 U8BIT ADB_GetEventStartMin(void *event_ptr)
8494 {
8495  return DHMS_MINS(ADB_GetEventStartDateTime(event_ptr));
8496 }
8497 
8503 U8BIT ADB_GetEventStartSecs(void *event_ptr)
8504 {
8505  return DHMS_SECS(ADB_GetEventStartDateTime(event_ptr));
8506 }
8507 
8513 U32DHMS ADB_GetEventDuration(void *event_ptr)
8514 {
8515  ADB_EVENT_REC *e_ptr;
8516  U32DHMS duration;
8517 
8518  FUNCTION_START(ADB_GetEventDuration);
8519 
8520  duration = 0;
8521 
8522  if (event_ptr != NULL)
8523  {
8525 
8526  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8527  if (e_ptr != NULL)
8528  {
8529  duration = e_ptr->duration;
8530  }
8531 
8533  }
8534 
8535  FUNCTION_FINISH(ADB_GetEventDuration);
8536 
8537  return(duration);
8538 }
8539 
8545 U8BIT ADB_GetEventDurationHour(void *event_ptr)
8546 {
8547  return DHMS_HOUR(ADB_GetEventDuration(event_ptr));
8548 }
8549 
8555 U8BIT ADB_GetEventDurationMin(void *event_ptr)
8556 {
8557  return DHMS_MINS(ADB_GetEventDuration(event_ptr));
8558 }
8559 
8565 U8BIT ADB_GetEventDurationSecs(void *event_ptr)
8566 {
8567  return DHMS_SECS(ADB_GetEventDuration(event_ptr));
8568 }
8569 
8575 U32DHMS ADB_GetEventEndDateTime(void *event_ptr)
8576 {
8577  ADB_EVENT_REC *e_ptr;
8578  U32DHMS end;
8579 
8580  FUNCTION_START(ADB_GetEventEndDateTime);
8581 
8582  end = 0;
8583 
8584  if (event_ptr != NULL)
8585  {
8587 
8588  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8589  if (e_ptr != NULL)
8590  {
8591  end = STB_GCCalculateDHMS(e_ptr->start, e_ptr->duration, CALC_ADD);
8592  }
8593 
8595  }
8596 
8597  FUNCTION_FINISH(ADB_GetEventEndDateTime);
8598 
8599  return(end);
8600 }
8601 
8607 BOOLEAN ADB_GetEventSubtitlesAvailFlag(void *event_ptr)
8608 {
8609  ADB_EVENT_REC *e_ptr;
8610  BOOLEAN available;
8611 
8612  FUNCTION_START(ADB_GetEventSubtitlesAvailFlag);
8613 
8614  available = FALSE;
8615 
8616  if (event_ptr != NULL)
8617  {
8619 
8620  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8621  if (e_ptr != NULL)
8622  {
8623  available = DBDEF_GetEventSubtitlesAvailFlag(e_ptr);
8624  }
8625 
8627  }
8628 
8629  FUNCTION_FINISH(ADB_GetEventSubtitlesAvailFlag);
8630 
8631  return(available);
8632 }
8633 
8639 ADB_EVENT_CONTENT ADB_GetEventContentDesc(void *event_ptr)
8640 {
8641  ADB_SERVICE_REC *s_ptr;
8642  ADB_EVENT_REC *e_ptr;
8643  ADB_EVENT_CONTENT genre;
8644 
8645  FUNCTION_START(ADB_GetEventContentDesc);
8646 
8647  genre = ADB_EVENT_CONTENT_UNCLASSIFIED;
8648 
8649  if (event_ptr != NULL)
8650  {
8652 
8653  s_ptr = (ADB_SERVICE_REC *)((S_EVENT *)event_ptr)->serv_ptr;
8654 
8655  e_ptr = DBDEF_FindScheduleEventById(s_ptr, ((S_EVENT *)event_ptr)->event_id);
8656  if (e_ptr != NULL)
8657  {
8658  genre = DBDEF_GetEventGenre(e_ptr, s_ptr);
8659  }
8660 
8662  }
8663 
8664  FUNCTION_FINISH(ADB_GetEventContentDesc);
8665 
8666  return(genre);
8667 }
8668 
8675 U8BIT* ADB_GetEventContentData(void *event_ptr, U8BIT *p_len)
8676 {
8677  ADB_EVENT_REC *e_ptr;
8678  U8BIT *retval;
8679 
8680  FUNCTION_START(ADB_GetEventContentData);
8681 
8682  retval = NULL;
8683 
8684  if (event_ptr != NULL)
8685  {
8687 
8688  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8689  if (e_ptr != NULL)
8690  {
8691  retval = DBDEF_GetEventContentData(e_ptr, p_len);
8692  }
8693 
8695  }
8696 
8697  FUNCTION_FINISH(ADB_GetEventContentData);
8698 
8699  return(retval);
8700 }
8701 
8707 U8BIT ADB_GetEventParentalAge(void *event_ptr)
8708 {
8709  ADB_EVENT_REC *e_ptr;
8710  U8BIT age;
8711 
8712  FUNCTION_START(ADB_GetEventParentalAge);
8713 
8714  age = 0;
8715 
8716  if (event_ptr != NULL)
8717  {
8719 
8720  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8721  if (e_ptr != NULL)
8722  {
8723  age = DBDEF_GetEventParentalAge(e_ptr);
8724  }
8725 
8727  }
8728 
8729  FUNCTION_FINISH(ADB_GetEventParentalAge);
8730 
8731  return(age);
8732 }
8733 
8740 U8BIT* ADB_GetEventName(void *event_ptr)
8741 {
8742  ADB_EVENT_REC *e_ptr;
8743  U8BIT *name_str;
8744 
8745  FUNCTION_START(ADB_GetEventName);
8746 
8747  name_str = NULL;
8748 
8749  if (event_ptr != NULL)
8750  {
8752 
8753  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8754  if (e_ptr != NULL)
8755  {
8756  name_str = DBDEF_GetEventName(e_ptr);
8757  }
8758 
8760  }
8761 
8762  FUNCTION_FINISH(ADB_GetEventName);
8763 
8764  return(name_str);
8765 }
8766 
8773 U8BIT* ADB_GetEventDescription(void *event_ptr)
8774 {
8775  ADB_EVENT_REC *e_ptr;
8776  U8BIT *desc_str;
8777 
8778  FUNCTION_START(ADB_GetEventDescription);
8779 
8780  desc_str = NULL;
8781 
8782  if (event_ptr != NULL)
8783  {
8785 
8786  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8787  if (e_ptr != NULL)
8788  {
8789  desc_str = DBDEF_GetEventDescription(e_ptr);
8790  }
8791 
8793  }
8794 
8795  FUNCTION_FINISH(ADB_GetEventDescription);
8796 
8797  return(desc_str);
8798 }
8799 
8805 BOOLEAN ADB_GetEventHasExtendedDescription(void *event_ptr)
8806 {
8807  ADB_EVENT_REC *e_ptr;
8808  BOOLEAN retval;
8809 
8810  FUNCTION_START(ADB_GetEventHasExtendedDescription);
8811 
8812  retval = FALSE;
8813 
8814  if (event_ptr != NULL)
8815  {
8817 
8818  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8819  if (e_ptr != NULL)
8820  {
8821  if (DBDEF_FindEventDescriptor(e_ptr->desc_list_head, EXTENDED_EVENT_DTAG, 0) != NULL)
8822  {
8823  retval = TRUE;
8824  }
8825  }
8826 
8828  }
8829 
8830  FUNCTION_FINISH(ADB_GetEventHasExtendedDescription);
8831 
8832  return(retval);
8833 }
8834 
8841 U8BIT* ADB_GetEventExtendedDescription(void *event_ptr)
8842 {
8843  ADB_EVENT_REC *e_ptr;
8844  U8BIT *desc_str;
8845 
8846  FUNCTION_START(ADB_GetEventExtendedDescription);
8847 
8848  desc_str = NULL;
8849 
8850  if (event_ptr != NULL)
8851  {
8853 
8854  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8855  if (e_ptr != NULL)
8856  {
8857  desc_str = DBDEF_GetEventExtendedDescription(e_ptr);
8858  }
8859 
8861  }
8862 
8863  FUNCTION_FINISH(ADB_GetEventExtendedDescription);
8864 
8865  return(desc_str);
8866 }
8867 
8874 ADB_EVENT_ITEMIZED_INFO* ADB_GetEventItemizedDescription(void *event_ptr, U16BIT *num_items_ptr)
8875 {
8876  ADB_EVENT_REC *e_ptr;
8877  ADB_EVENT_ITEMIZED_INFO *event_itemized_info;
8878 
8879  FUNCTION_START(ADB_GetEventItemizedDescription);
8880 
8881  event_itemized_info = NULL;
8882  *num_items_ptr = 0;
8883 
8884  if (event_ptr != NULL)
8885  {
8887 
8888  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8889  if (e_ptr != NULL)
8890  {
8891  event_itemized_info = DBDEF_GetEventItemizedDescription(e_ptr, num_items_ptr);
8892  }
8893 
8895  }
8896 
8897  FUNCTION_FINISH(ADB_GetEventItemizedDescription);
8898 
8899  return(event_itemized_info);
8900 }
8901 
8907 void ADB_ReleaseEventItemizedInfo(ADB_EVENT_ITEMIZED_INFO *event_itemized_info, U16BIT num_of_items)
8908 {
8909  U16BIT i;
8910 
8911  FUNCTION_START(ADB_ReleaseEventItemizedInfo);
8912 
8913  if (event_itemized_info != NULL)
8914  {
8915  for (i = 0; i < num_of_items; i++)
8916  {
8917  STB_ReleaseUnicodeString(event_itemized_info[i].item_description);
8918  STB_ReleaseUnicodeString(event_itemized_info[i].item);
8919  }
8920  STB_AppFreeMemory(event_itemized_info);
8921  }
8922  FUNCTION_FINISH(ADB_ReleaseEventItemizedInfo);
8923 }
8924 
8936 U8BIT* ADB_GetEventGuidance(void *event_ptr, void *serv_ptr, U8BIT *type, U8BIT *mode)
8937 {
8938  ADB_EVENT_REC *e_ptr;
8939  U8BIT *text_str;
8940 
8941  FUNCTION_START(ADB_GetEventGuidance);
8942 
8943  text_str = NULL;
8944 
8946  if (event_ptr != NULL)
8947  {
8948  e_ptr = DBDEF_FindScheduleEventById(serv_ptr, ((S_EVENT *)event_ptr)->event_id);
8949  if (e_ptr != NULL)
8950  {
8951  text_str = DBDEF_GetEventGuidance(e_ptr, serv_ptr, type, mode);
8952  }
8953  }
8954  else
8955  {
8956  text_str = DBDEF_GetServiceGuidanceData(serv_ptr, type, mode);
8957  }
8959 
8960  FUNCTION_FINISH(ADB_GetEventGuidance);
8961 
8962  return(text_str);
8963 }
8964 
8970 U16BIT ADB_GetEventId(void *event_ptr)
8971 {
8972  U16BIT event_id = 0;
8973 
8974  FUNCTION_START(ADB_GetEventId);
8975 
8976  if (event_ptr != NULL)
8977  {
8978  event_id = ((S_EVENT *)event_ptr)->event_id;
8979  }
8980 
8981  FUNCTION_FINISH(ADB_GetEventId);
8982 
8983  return(event_id);
8984 }
8985 
8991 BOOLEAN ADB_GetEventAudioDescriptionFlag(void *event_ptr)
8992 {
8993  ADB_EVENT_REC *e_ptr;
8994  BOOLEAN audio_desc;
8995 
8996  FUNCTION_START(ADB_GetEventAudioDescriptionFlag);
8997 
8998  audio_desc = FALSE;
8999 
9000  if (event_ptr != NULL)
9001  {
9003 
9004  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
9005  if (e_ptr != NULL)
9006  {
9007  audio_desc = DBDEF_GetEventAudioDescriptionFlag(e_ptr);
9008  }
9009 
9011  }
9012 
9013  FUNCTION_FINISH(ADB_GetEventAudioDescriptionFlag);
9014 
9015  return(audio_desc);
9016 }
9017 
9023 BOOLEAN ADB_GetEventFreeToAir(void *event_ptr)
9024 {
9025  ADB_EVENT_REC *e_ptr;
9026  BOOLEAN fta;
9027 
9028  FUNCTION_START(ADB_GetEventFreeToAir);
9029 
9030  fta = FALSE;
9031 
9032  if (event_ptr != NULL)
9033  {
9035 
9036  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
9037  if (e_ptr != NULL)
9038  {
9039  fta = e_ptr->free_to_air;
9040  }
9041 
9043  }
9044 
9045  FUNCTION_FINISH(ADB_GetEventFreeToAir);
9046 
9047  return(fta);
9048 }
9049 
9057 BOOLEAN ADB_GetEventDoNotScramble(void *event_ptr)
9058 {
9059  ADB_EVENT_REC *e_ptr;
9060  BOOLEAN do_not_scramble;
9061 
9062  FUNCTION_START(ADB_GetEventDoNotScramble);
9063 
9064  do_not_scramble = TRUE;
9065 
9066  if (event_ptr != NULL)
9067  {
9069 
9070  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
9071  if (e_ptr != NULL)
9072  {
9073  do_not_scramble = FindDoNotScramble(e_ptr, ((S_EVENT *)event_ptr)->serv_ptr);
9074  }
9075 
9077  }
9078 
9079  FUNCTION_FINISH(ADB_GetEventDoNotScramble);
9080 
9081  return(do_not_scramble);
9082 }
9083 
9097 BOOLEAN ADB_GetEventHDLinkageInfo(void *event_ptr, BOOLEAN verify_event, BOOLEAN only_simulcast,
9098  void **hd_serv_ptr, void **hd_event_ptr)
9099 {
9100  ADB_EVENT_REC *e_ptr;
9101  ADB_EVENT_REC *hd_event;
9102  ADB_SERVICE_REC *hd_service;
9103  BOOLEAN event_found;
9104 
9105  FUNCTION_START(ADB_GetEventHDLinkageInfo);
9106 
9107  event_found = FALSE;
9108 
9109  if (hd_serv_ptr != NULL)
9110  {
9111  *hd_serv_ptr = NULL;
9112  }
9113 
9114  if (hd_event_ptr != NULL)
9115  {
9116  *hd_event_ptr = NULL;
9117  }
9118 
9119  if (event_ptr != NULL)
9120  {
9122 
9123  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
9124  if (e_ptr != NULL)
9125  {
9126  event_found = DBDEF_GetEventHDLinkageInfo(e_ptr, verify_event, only_simulcast, &hd_service, &hd_event);
9127 
9128  if (event_found && (hd_event_ptr != NULL))
9129  {
9130  *hd_event_ptr = (void *)CopyEventRec(hd_event, hd_service);
9131  }
9132  }
9133 
9135  }
9136 
9137  FUNCTION_FINISH(ADB_GetEventHDLinkageInfo);
9138 
9139  return(event_found);
9140 }
9141 
9149 BOOLEAN ADB_IsSameEvent(void *event1_ptr, void *event2_ptr)
9150 {
9151  ADB_EVENT_REC *e1_ptr;
9152  ADB_EVENT_REC *e2_ptr;
9153  BOOLEAN same;
9154 
9155  FUNCTION_START(ADB_IsSameEvent);
9156 
9157  same = FALSE;
9158 
9159  if ((event1_ptr != NULL) && (event2_ptr != NULL))
9160  {
9162 
9163  e1_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event1_ptr)->serv_ptr, ((S_EVENT *)event1_ptr)->event_id);
9164  if (e1_ptr != NULL)
9165  {
9166  e2_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event2_ptr)->serv_ptr,
9167  ((S_EVENT *)event2_ptr)->event_id);
9168  if (e2_ptr != NULL)
9169  {
9170  if ((e1_ptr->start == e2_ptr->start) &&
9171  (e1_ptr->duration == e2_ptr->duration) && (e1_ptr->event_id == e2_ptr->event_id))
9172  {
9173  same = TRUE;
9174  }
9175  }
9176  }
9177 
9179  }
9180 
9181  FUNCTION_FINISH(ADB_IsSameEvent);
9182 
9183  return(same);
9184 }
9185 
9193 U8BIT* ADB_GetEventFullProgrammeCrid(void *serv_ptr, void *event_ptr)
9194 {
9195  U8BIT *crid_str;
9196 
9197  FUNCTION_START(ADB_GetEventFullProgrammeCrid);
9198 
9199  if (ACFG_GetCountry() == COUNTRY_CODE_UK)
9200  {
9201  crid_str = GetEventCridType(serv_ptr, event_ptr, UK_PROGRAMME_CRID, 0);
9202  }
9203  else
9204  {
9205  crid_str = GetEventCridType(serv_ptr, event_ptr, TVA_PROGRAMME_CRID, 0);
9206  }
9207 
9208  FUNCTION_FINISH(ADB_GetEventFullProgrammeCrid);
9209 
9210  return(crid_str);
9211 }
9212 
9219 BOOLEAN ADB_IsSplitProgrammeCrid(U8BIT *crid)
9220 {
9221  U16BIT crid_len;
9222  U8BIT *crid_ptr;
9223  BOOLEAN imi_found;
9224 
9225  FUNCTION_START(ADB_IsSplitProgrammeCrid);
9226 
9227  imi_found = FALSE;
9228 
9229  if (crid != NULL)
9230  {
9231  crid_len = strlen((char *)crid);
9232  if (crid_len > 0)
9233  {
9234  /* Search backwards through the string looking for a '#' char.
9235  * The search is terminated by finding a '/' or the start of the string */
9236  crid_ptr = crid + crid_len - 1;
9237  while ((crid_ptr != crid) && !imi_found)
9238  {
9239  if (*crid_ptr == '#')
9240  {
9241  imi_found = TRUE;
9242  }
9243  else if (*crid_ptr == '/')
9244  {
9245  /* No IMI found in the last section of the CRID string */
9246  crid_ptr = crid;
9247  }
9248  else
9249  {
9250  crid_ptr--;
9251  }
9252  }
9253  }
9254  }
9255 
9256  FUNCTION_FINISH(ADB_IsSplitProgrammeCrid);
9257 
9258  return(imi_found);
9259 }
9260 
9268 U8BIT* ADB_GetEventProgrammeCrid(void *serv_ptr, void *event_ptr)
9269 {
9270  U8BIT *crid_str;
9271  U16BIT crid_len;
9272  U8BIT *crid_ptr;
9273  BOOLEAN imi_found;
9274 
9275  FUNCTION_START(ADB_GetEventProgrammeCrid);
9276 
9277  if (ACFG_GetCountry() == COUNTRY_CODE_UK)
9278  {
9279  crid_str = GetEventCridType(serv_ptr, event_ptr, UK_PROGRAMME_CRID, 0);
9280  }
9281  else
9282  {
9283  crid_str = GetEventCridType(serv_ptr, event_ptr, TVA_PROGRAMME_CRID, 0);
9284  }
9285 
9286  if ((crid_str != NULL) && ADB_IsSplitProgrammeCrid(crid_str))
9287  {
9288  /* Search backwards through the string looking for a '#' char.
9289  * The search is terminated by finding a '/' or the start of the string */
9290  crid_len = strlen((char *)crid_str);
9291  crid_ptr = crid_str + crid_len - 1;
9292  imi_found = FALSE;
9293 
9294  while ((crid_ptr != crid_str) && !imi_found)
9295  {
9296  if (*crid_ptr == '#')
9297  {
9298  /* Terminate the crid string here */
9299  *crid_ptr = '\0';
9300  imi_found = TRUE;
9301  }
9302  else if (*crid_ptr == '/')
9303  {
9304  /* No IMI found in the last section of the CRID string */
9305  crid_ptr = crid_str;
9306  }
9307  else
9308  {
9309  crid_ptr--;
9310  }
9311  }
9312  }
9313 
9314  FUNCTION_FINISH(ADB_GetEventProgrammeCrid);
9315 
9316  return(crid_str);
9317 }
9318 
9326 U8BIT* ADB_GetFullCrid(void *serv_ptr, U8BIT *event_str)
9327 {
9328  U8BIT *crid_str = NULL;
9329 
9330  FUNCTION_START(ADB_GetFullCrid);
9331 
9332  ASSERT(serv_ptr != NULL);
9333  ASSERT(event_str != NULL);
9334 
9335  if ((serv_ptr != NULL) && (event_str != NULL))
9336  {
9338  crid_str = DBDEF_GetFullCrid(serv_ptr, event_str);
9340  }
9341 
9342  FUNCTION_FINISH(ADB_GetFullCrid);
9343 
9344  return(crid_str);
9345 }
9346 
9355 U8BIT* ADB_GetEventSeriesCrid(U8BIT index, void *serv_ptr, void *event_ptr)
9356 {
9357  U8BIT *crid_str;
9358 
9359  FUNCTION_START(ADB_GetEventSeriesCrid);
9360 
9361  if (ACFG_GetCountry() == COUNTRY_CODE_UK)
9362  {
9363  crid_str = GetEventCridType(serv_ptr, event_ptr, UK_SERIES_CRID, index);
9364  }
9365  else
9366  {
9367  crid_str = GetEventCridType(serv_ptr, event_ptr, TVA_SERIES_CRID, index);
9368  }
9369 
9370  FUNCTION_FINISH(ADB_GetEventSeriesCrid);
9371 
9372  return(crid_str);
9373 }
9374 
9380 U8BIT ADB_GetEventNumSeriesCrids(void *event_ptr)
9381 {
9382  U8BIT num_crids;
9383 
9384  FUNCTION_START(ADB_GetEventNumSeriesCrids);
9385 
9386  if (ACFG_GetCountry() == COUNTRY_CODE_UK)
9387  {
9388  num_crids = NumberOfCridsOfType((S_EVENT *)event_ptr, UK_SERIES_CRID);
9389  }
9390  else
9391  {
9392  num_crids = NumberOfCridsOfType((S_EVENT *)event_ptr, TVA_SERIES_CRID);
9393  }
9394 
9395  FUNCTION_FINISH(ADB_GetEventNumSeriesCrids);
9396 
9397  return(num_crids);
9398 }
9399 
9406 {
9407  U8BIT num_crids;
9408 
9409  FUNCTION_START(ADB_GetEventNumRecommendationCrids);
9410 
9411  if (ACFG_GetCountry() == COUNTRY_CODE_UK)
9412  {
9413  num_crids = NumberOfCridsOfType((S_EVENT *)event_ptr, UK_RECOMMENDATION_CRID);
9414  }
9415  else
9416  {
9417  num_crids = NumberOfCridsOfType((S_EVENT *)event_ptr, TVA_RECOMMENDATION_CRID);
9418  }
9419 
9420  FUNCTION_FINISH(ADB_GetEventNumRecommendationCrids);
9421 
9422  return(num_crids);
9423 }
9424 
9433 U8BIT* ADB_GetEventRecommendationCrid(U8BIT index, void *serv_ptr, void *event_ptr)
9434 {
9435  U8BIT *crid_str;
9436 
9437  FUNCTION_START(ADB_GetEventRecommendationCrid);
9438 
9439  if (ACFG_GetCountry() == COUNTRY_CODE_UK)
9440  {
9441  crid_str = GetEventCridType(serv_ptr, event_ptr, UK_RECOMMENDATION_CRID, index);
9442  }
9443  else
9444  {
9445  crid_str = GetEventCridType(serv_ptr, event_ptr, TVA_RECOMMENDATION_CRID, index);
9446  }
9447 
9448  FUNCTION_FINISH(ADB_GetEventRecommendationCrid);
9449 
9450  return(crid_str);
9451 }
9452 
9461 U8BIT ADB_GetEventComponentList(void *event_ptr, ADB_EVENT_COMPONENT_INFO **component_list)
9462 {
9463  ADB_EVENT_REC *e_ptr;
9464  U8BIT num_components;
9465 
9466  FUNCTION_START(ADB_GetEventComponentList);
9467 
9468  num_components = 0;
9469 
9470  if (event_ptr != NULL)
9471  {
9473 
9474  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
9475  if (e_ptr != NULL)
9476  {
9477  num_components = DBDEF_GetEventComponentList(e_ptr, component_list);
9478  }
9479 
9481  }
9482 
9483  FUNCTION_FINISH(ADB_GetEventComponentList);
9484 
9485  return(num_components);
9486 }
9487 
9494 U8BIT* ADB_GetAuthorityFromCrid(U8BIT *crid)
9495 {
9496  U8BIT *auth_str;
9497  U16BIT auth_str_len;
9498  U16BIT i;
9499 
9500  FUNCTION_START(ADB_GetAuthorityFromCrid);
9501 
9502  ASSERT(crid != NULL);
9503 
9504  auth_str_len = strlen((char *)crid);
9505 
9506  for (i = 0; i < auth_str_len; i++)
9507  {
9508  if (crid[i] == '/')
9509  {
9510  auth_str_len = i + 1;
9511  break;
9512  }
9513  }
9514 
9515  auth_str = (U8BIT *)STB_AppGetMemory(auth_str_len);
9516  if (auth_str != NULL)
9517  {
9518  memcpy(auth_str, crid, auth_str_len);
9519  auth_str[auth_str_len - 1] = '\0';
9520  }
9521 
9522  FUNCTION_FINISH(ADB_GetAuthorityFromCrid);
9523 
9524  return(auth_str);
9525 }
9526 
9535 void* ADB_FindEventFromCrid(U8BIT *prog_crid, void *original_event_ptr, void **serv_ptr)
9536 {
9537  void **slist;
9538  void **elist;
9539  void *event_ptr;
9540  U16BIT num_services;
9541  U16BIT num_events;
9542  U8BIT *event_prog_crid;
9543  U16BIT si, ei;
9544  U32DHMS now_time;
9545  BOOLEAN event_found;
9546  void *found_event_ptr;
9547  U16BIT onet_id, tran_id, serv_id;
9548  U16BIT event_id;
9549 
9550  FUNCTION_START(ADB_FindEventFromCrid);
9551 
9552  found_event_ptr = NULL;
9553 
9554  ADB_GetServiceList(ADB_SERVICE_LIST_ALL, &slist, &num_services);
9555 
9556  if ((num_services > 0) && (slist != NULL))
9557  {
9558  event_found = FALSE;
9559 
9560  for (si = 0; !event_found && (si < num_services); si++)
9561  {
9562  ADB_GetEventSchedule(FALSE, slist[si], &elist, &num_events);
9563 
9564  if ((num_events > 0) && (elist != NULL))
9565  {
9566  /* Get the current date/time to check for old events */
9567  now_time = STB_GCNowDHMSGmt();
9568 
9569  for (ei = 0; !event_found && (ei < num_events); ei++)
9570  {
9571  event_ptr = elist[ei];
9572 
9573  /* Check that the event isn't already in the past */
9574  if (ADB_GetEventStartDateTime(event_ptr) >= now_time)
9575  {
9576  event_prog_crid = ADB_GetEventProgrammeCrid(slist[si], event_ptr);
9577  if (event_prog_crid != NULL)
9578  {
9579  if (STB_CompareStringsIgnoreCase(event_prog_crid, prog_crid) == 0)
9580  {
9581  /* The programme CRIDs match so this must be the same programme content */
9582  if ((original_event_ptr != NULL) && ADB_IsSameEvent(original_event_ptr, event_ptr))
9583  {
9584  /* This is the same event so it can't be used */
9585  event_ptr = NULL;
9586  }
9587 
9588  if (event_ptr != NULL)
9589  {
9590  /* Check that this event isn't already set to be recorded */
9591  ADB_GetServiceIds(slist[si], &onet_id, &tran_id, &serv_id);
9592 
9593  event_id = ADB_GetEventId(event_ptr);
9594 
9595  if (ATMR_FindTimerFromEvent(onet_id, tran_id, serv_id, event_id) != INVALID_TIMER_HANDLE)
9596  {
9597  /* An altenate event has been found so return a copy of it */
9598  event_found = TRUE;
9599  *serv_ptr = slist[si];
9600  found_event_ptr = ADB_GetEvent(slist[si], event_id);
9601  }
9602  }
9603  }
9604 
9605  STB_AppFreeMemory(event_prog_crid);
9606  }
9607  }
9608  }
9609 
9610  ADB_ReleaseEventList(elist, num_events);
9611  }
9612  }
9613 
9614  STB_AppFreeMemory(slist);
9615  }
9616 
9617  FUNCTION_FINISH(ADB_FindEventFromCrid);
9618 
9619  return(found_event_ptr);
9620 }
9621 
9628 void ADB_SetServiceHiddenFlag(void *s_ptr, BOOLEAN hidden)
9629 {
9630  ADB_SERVICE_REC *serv_ptr = (ADB_SERVICE_REC *)s_ptr;
9631 
9632  FUNCTION_START(ADB_SetServiceHiddenFlag);
9633 
9634  if (s_ptr != NULL)
9635  {
9637 
9638  serv_ptr->hidden = hidden;
9639  DBA_SetFieldValue(serv_ptr->dba_rec, DBA_FIELD_SERV_HIDDEN, serv_ptr->hidden);
9640  DBA_SaveRecord(serv_ptr->dba_rec);
9641 
9643  }
9644 
9645  FUNCTION_FINISH(ADB_SetServiceHiddenFlag);
9646 }
9647 
9654 BOOLEAN ADB_GetServiceHiddenFlag(void *s_ptr)
9655 {
9656  BOOLEAN hidden = TRUE;
9657 
9658  FUNCTION_START(ADB_GetServiceHiddenFlag);
9659 
9660  if (s_ptr != NULL)
9661  {
9663  hidden = ((ADB_SERVICE_REC *)s_ptr)->hidden;
9665  }
9666 
9667  FUNCTION_FINISH(ADB_GetServiceHiddenFlag);
9668 
9669  return(hidden);
9670 }
9671 
9677 BOOLEAN ADB_GetServiceSelectableFlag(void *s_ptr)
9678 {
9679  BOOLEAN selectable = FALSE;
9680 
9681  FUNCTION_START(ADB_GetServiceSelectableFlag);
9682 
9683  if (s_ptr != NULL)
9684  {
9686  selectable = ((ADB_SERVICE_REC *)s_ptr)->selectable;
9688  }
9689 
9690  FUNCTION_FINISH(ADB_GetServiceSelectableFlag);
9691 
9692  return(selectable);
9693 }
9694 
9700 BOOLEAN ADB_GetServiceLcnEditable(void *s_ptr)
9701 {
9702  BOOLEAN lcn_editable = FALSE;
9703 
9704  FUNCTION_START(ADB_GetServiceLcnEditable);
9705 
9706  if (s_ptr != NULL)
9707  {
9709  lcn_editable = ((ADB_SERVICE_REC *)s_ptr)->lcn_editable;
9711  }
9712 
9713  FUNCTION_FINISH(ADB_GetServiceLcnEditable);
9714 
9715  return(lcn_editable);
9716 }
9717 
9724 void ADB_SetServiceDeletedFlag(void *s_ptr, BOOLEAN deleted)
9725 {
9726  FUNCTION_START(ADB_SetServiceDeletedFlag);
9727 
9729  DBDEF_SetServiceDeletedFlag(s_ptr, deleted);
9731 
9732  FUNCTION_FINISH(ADB_SetServiceDeletedFlag);
9733 }
9734 
9741 void ADB_SetServiceLcn(void *s_ptr, U16BIT lcn)
9742 {
9743  ADB_SERVICE_REC *serv_ptr = (ADB_SERVICE_REC *)s_ptr;
9744 
9745  FUNCTION_START(ADB_SetServiceLcn);
9746 
9747  if (s_ptr != NULL)
9748  {
9750 
9751  if (serv_ptr->allocated_lcn != lcn)
9752  {
9753  serv_ptr->allocated_lcn = lcn;
9754  DBA_SetFieldValue(serv_ptr->dba_rec, DBA_FIELD_SERV_LCN, serv_ptr->allocated_lcn);
9755  DBA_SaveRecord(serv_ptr->dba_rec);
9756  }
9757 
9759  }
9760 
9761  FUNCTION_FINISH(ADB_SetServiceLcn);
9762 }
9763 
9772 U8BIT ADB_GetServiceFavGroups(void *s_ptr)
9773 {
9774  U8BIT groups = 0;
9775 
9776  FUNCTION_START(ADB_GetServiceFavGroups);
9777 
9778  if (s_ptr != NULL)
9779  {
9781  groups = ((ADB_SERVICE_REC *)s_ptr)->fav_groups;
9783  }
9784 
9785  FUNCTION_FINISH(ADB_GetServiceFavGroups);
9786 
9787  return(groups);
9788 }
9789 
9798 void ADB_SetServiceFavGroups(void *s_ptr, U8BIT groups)
9799 {
9800  FUNCTION_START(ADB_SetServiceFavGroups);
9801 
9802  if (s_ptr != NULL)
9803  {
9805  DBDEF_SetServiceFavGroups(s_ptr, groups);
9807  }
9808 
9809  FUNCTION_FINISH(ADB_SetServiceFavGroups);
9810 }
9811 
9823 void ADB_SetReqdAudioStreamSettings(void *s_ptr, BOOLEAN valid, U32BIT lang_code,
9824  ADB_AUDIO_TYPE audio_type, ADB_STREAM_TYPE stream_type)
9825 {
9826  FUNCTION_START(ADB_SetReqdAudioStreamSettings);
9827 
9828  if (s_ptr != NULL)
9829  {
9831  ((ADB_SERVICE_REC *)s_ptr)->reqd_audio_valid = valid;
9832  ((ADB_SERVICE_REC *)s_ptr)->reqd_audio_lang_code = lang_code;
9833  ((ADB_SERVICE_REC *)s_ptr)->reqd_audio_type = audio_type;
9834  ((ADB_SERVICE_REC *)s_ptr)->reqd_stream_type = stream_type;
9835  ((ADB_SERVICE_REC *)s_ptr)->reqd_audio_pid = 0x1FFF;
9837  }
9838 
9839  FUNCTION_FINISH(ADB_SetReqdAudioStreamSettings);
9840 }
9841 
9851 void ADB_SetReqdAudioStreamPID(void *s_ptr, BOOLEAN valid, U16BIT pid)
9852 {
9853  FUNCTION_START(ADB_SetReqdAudioStreamPID);
9854 
9855  if (s_ptr != NULL)
9856  {
9858  ((ADB_SERVICE_REC *)s_ptr)->reqd_audio_valid = valid;
9859  ((ADB_SERVICE_REC *)s_ptr)->reqd_audio_pid = pid;
9861  }
9862 
9863  FUNCTION_FINISH(ADB_SetReqdAudioStreamPID);
9864 }
9865 
9875 void ADB_GetReqdAudioStreamSettings(void *s_ptr, BOOLEAN *valid, U32BIT *lang_code,
9876  ADB_AUDIO_TYPE *audio_type, ADB_STREAM_TYPE *stream_type)
9877 {
9878  FUNCTION_START(ADB_GetReqdAudioStreamSettings);
9879 
9880  if (s_ptr != NULL)
9881  {
9883  *valid = ((ADB_SERVICE_REC *)s_ptr)->reqd_audio_valid;
9884  *lang_code = ((ADB_SERVICE_REC *)s_ptr)->reqd_audio_lang_code;
9885  *audio_type = ((ADB_SERVICE_REC *)s_ptr)->reqd_audio_type;
9886  *stream_type = ((ADB_SERVICE_REC *)s_ptr)->reqd_stream_type;
9888  }
9889 
9890  FUNCTION_FINISH(ADB_GetReqdAudioStreamSettings);
9891 }
9892 
9903 void ADB_SetReqdSubtitleStreamSettings(void *s_ptr, BOOLEAN valid, U32BIT lang_code, ADB_SUBTITLE_TYPE subtitle_type)
9904 {
9905  FUNCTION_START(ADB_SetReqdSubtitleStreamSettings);
9906 
9907  if (s_ptr != NULL)
9908  {
9910  ((ADB_SERVICE_REC *)s_ptr)->reqd_subtitle_valid = valid;
9911  ((ADB_SERVICE_REC *)s_ptr)->reqd_subtitle_lang_code = lang_code;
9912  ((ADB_SERVICE_REC *)s_ptr)->reqd_subtitle_type = subtitle_type;
9914  }
9915 
9916  FUNCTION_FINISH(ADB_SetReqdSubtitleStreamSettings);
9917 }
9918 
9927 void ADB_GetReqdSubtitleStreamSettings(void *s_ptr, BOOLEAN *valid, U32BIT *lang_code, ADB_SUBTITLE_TYPE *subtitle_type)
9928 {
9929  FUNCTION_START(ADB_GetReqdSubtitleStreamSettings);
9930 
9931  if (s_ptr != NULL)
9932  {
9934  *valid = ((ADB_SERVICE_REC *)s_ptr)->reqd_subtitle_valid;
9935  *lang_code = ((ADB_SERVICE_REC *)s_ptr)->reqd_subtitle_lang_code;
9936  *subtitle_type = ((ADB_SERVICE_REC *)s_ptr)->reqd_subtitle_type;
9938  }
9939 
9940  FUNCTION_FINISH(ADB_GetReqdSubtitleStreamSettings);
9941 }
9942 
9953 void ADB_SetReqdTeletextStreamSettings(void *s_ptr, BOOLEAN valid, U32BIT lang_code, ADB_TELETEXT_TYPE ttext_type)
9954 {
9955  FUNCTION_START(ADB_SetReqdTeletextStreamSettings);
9956 
9957  if (s_ptr != NULL)
9958  {
9960  ((ADB_SERVICE_REC *)s_ptr)->reqd_ttext_valid = valid;
9961  ((ADB_SERVICE_REC *)s_ptr)->reqd_ttext_lang_code = lang_code;
9962  ((ADB_SERVICE_REC *)s_ptr)->reqd_ttext_type = ttext_type;
9964  }
9965 
9966  FUNCTION_FINISH(ADB_SetReqdTeletextStreamSettings);
9967 }
9968 
9977 void ADB_GetReqdTeletextStreamSettings(void *s_ptr, BOOLEAN *valid, U32BIT *lang_code, ADB_TELETEXT_TYPE *ttext_type)
9978 {
9979  FUNCTION_START(ADB_GetReqdTeletextStreamSettings);
9980 
9981  if (s_ptr != NULL)
9982  {
9984  *valid = ((ADB_SERVICE_REC *)s_ptr)->reqd_ttext_valid;
9985  *lang_code = ((ADB_SERVICE_REC *)s_ptr)->reqd_ttext_lang_code;
9986  *ttext_type = ((ADB_SERVICE_REC *)s_ptr)->reqd_ttext_type;
9988  }
9989 
9990  FUNCTION_FINISH(ADB_GetReqdTeletextStreamSettings);
9991 }
9992 
9993 #if 0
9994 
9999 void ADB_SetAnalogServiceName(void *s_ptr, U8BIT *new_name)
10000 {
10001  U8BIT new_len;
10002 
10003  FUNCTION_START(ADB_SetAnalogServiceName);
10004 
10006  if (new_name != NULL)
10007  {
10008  new_len = strlen((char *)new_name) + 1;
10009  }
10010  else
10011  {
10012  new_len = 0;
10013  }
10014  DBDEF_SetAnalogServiceName((ADB_SERVICE_REC *)s_ptr, new_name, new_len);
10016 
10017  FUNCTION_FINISH(ADB_SetAnalogServiceName);
10018 }
10019 
10020 #endif
10021 
10026 {
10027  FUNCTION_START(ADB_SortServicesByLcn);
10028 
10032 
10033  FUNCTION_FINISH(ADB_SortServicesByLcn);
10034 }
10035 
10045 void* ADB_AddCridRecord(U8BIT *crid, BOOLEAN series, BOOLEAN recommended)
10046 {
10047  void *crid_rec;
10048 
10049  FUNCTION_START(ADB_AddCridRecord);
10050 
10051  crid_rec = ADB_FindCridRecord(crid);
10052  if (crid_rec == NULL)
10053  {
10055  crid_rec = DBDEF_AddCridRecord(crid, series, recommended);
10057  }
10058 
10059  FUNCTION_FINISH(ADB_AddCridRecord);
10060 
10061  return(crid_rec);
10062 }
10063 
10068 void ADB_SaveCridRecord(void *c_ptr)
10069 {
10070  FUNCTION_START(ADB_SaveCridRecord);
10071 
10073 
10074  if (DBDEF_IsValidCridRecord((ADB_CRID_REC *)c_ptr))
10075  {
10076  DBA_SaveRecord(((ADB_CRID_REC *)c_ptr)->dba_rec);
10077  }
10078 
10080 
10081  FUNCTION_FINISH(ADB_SaveCridRecord);
10082 }
10083 
10089 void* ADB_FindCridRecord(U8BIT *crid_str)
10090 {
10091  ADB_CRID_REC *c_ptr;
10092 
10093  FUNCTION_START(ADB_FindCridRecord);
10094 
10096 
10097  c_ptr = DBDEF_GetNextCridRecord(NULL);
10098 
10099  while (c_ptr != NULL)
10100  {
10101  if ((c_ptr->crid_str != NULL) && (c_ptr->crid_str->str_ptr != NULL))
10102  {
10103  if (STB_CompareStringsIgnoreCase(c_ptr->crid_str->str_ptr, crid_str) == 0)
10104  {
10105  break;
10106  }
10107  }
10108 
10109  c_ptr = DBDEF_GetNextCridRecord(c_ptr);
10110  }
10111 
10113 
10114  FUNCTION_FINISH(ADB_FindCridRecord);
10115 
10116  return(c_ptr);
10117 }
10118 
10124 void ADB_SetCridDateTime(void *c_ptr, U32DHMS datetime)
10125 {
10126  FUNCTION_START(ADB_SetCridDateTime);
10127 
10128  if (c_ptr != NULL)
10129  {
10131 
10132  if (DBDEF_IsValidCridRecord(c_ptr))
10133  {
10134  DBDEF_SetCridDateTime(c_ptr, datetime);
10135  }
10136 
10138  }
10139 
10140  FUNCTION_FINISH(ADB_SetCridDateTime);
10141 }
10142 
10148 void ADB_SetCridService(void *c_ptr, U16BIT serv_id)
10149 {
10150  FUNCTION_START(ADB_SetCridService);
10151 
10152  if (c_ptr != NULL)
10153  {
10155 
10156  if (DBDEF_IsValidCridRecord(c_ptr))
10157  {
10158  DBDEF_SetCridService(c_ptr, serv_id);
10159  }
10160 
10162  }
10163 
10164  FUNCTION_FINISH(ADB_SetCridService);
10165 }
10166 
10172 void ADB_SetCridProgrammeName(void *c_ptr, U8BIT *prog_name)
10173 {
10174  FUNCTION_START(ADB_SetCridProgrammeName);
10175 
10176  if (c_ptr != NULL)
10177  {
10179 
10180  if (DBDEF_IsValidCridRecord(c_ptr))
10181  {
10182  DBDEF_SetCridProgrammeName(c_ptr, prog_name);
10183  }
10184 
10186  }
10187 
10188  FUNCTION_FINISH(ADB_SetCridProgrammeName);
10189 }
10190 
10197 U8BIT* ADB_GetCridProgrammeName(void *c_ptr)
10198 {
10199  U8BIT *prog_name;
10200 
10201  FUNCTION_START(ADB_GetCridProgrammeName);
10202 
10203  prog_name = NULL;
10204 
10205  if (c_ptr != NULL)
10206  {
10208 
10209  if (DBDEF_IsValidCridRecord(c_ptr))
10210  {
10211  prog_name = CopyString(((ADB_CRID_REC *)c_ptr)->name_str, TRUE);
10212  }
10213 
10215  }
10216 
10217  FUNCTION_FINISH(ADB_GetCridProgrammeName);
10218 
10219  return(prog_name);
10220 }
10221 
10226 void ADB_UpdateCridEitDate(void *c_ptr)
10227 {
10228  FUNCTION_START(ADB_UpdateEitDate);
10229 
10230  if (c_ptr != NULL)
10231  {
10233  DBDEF_UpdateCridEitDate(c_ptr);
10235  }
10236 
10237  FUNCTION_FINISH(ADB_UpdateEitDate);
10238 }
10239 
10245 BOOLEAN ADB_IsProgrammeCrid(void *c_ptr)
10246 {
10247  BOOLEAN result;
10248  ADB_CRID_REC *crid_ptr = (ADB_CRID_REC *)c_ptr;
10249 
10250  FUNCTION_START(ADB_IsProgrammeCrid);
10251 
10252  result = FALSE;
10253 
10254  if (c_ptr != NULL)
10255  {
10257 
10258  if (DBDEF_IsValidCridRecord(c_ptr))
10259  {
10260  if (!crid_ptr->series_flag && !crid_ptr->recommended_flag)
10261  {
10262  result = TRUE;
10263  }
10264  }
10265 
10267  }
10268 
10269  FUNCTION_FINISH(ADB_IsProgrammeCrid);
10270 
10271  return(result);
10272 }
10273 
10279 BOOLEAN ADB_IsSeriesCrid(void *c_ptr)
10280 {
10281  BOOLEAN result;
10282 
10283  FUNCTION_START(ADB_IsSeriesCrid);
10284 
10285  result = FALSE;
10286 
10287  if (c_ptr != NULL)
10288  {
10290 
10291  if (DBDEF_IsValidCridRecord(c_ptr))
10292  {
10293  result = ((ADB_CRID_REC *)c_ptr)->series_flag;
10294  }
10295 
10297  }
10298 
10299  FUNCTION_FINISH(ADB_IsSeriesCrid);
10300 
10301  return(result);
10302 }
10303 
10309 BOOLEAN ADB_IsRecommendationCrid(void *c_ptr)
10310 {
10311  BOOLEAN result;
10312 
10313  FUNCTION_START(ADB_IsRecommendationCrid);
10314 
10315  result = FALSE;
10316 
10317  if (c_ptr != NULL)
10318  {
10320 
10321  if (DBDEF_IsValidCridRecord(c_ptr))
10322  {
10323  result = ((ADB_CRID_REC *)c_ptr)->recommended_flag;
10324  }
10325 
10327  }
10328 
10329  FUNCTION_FINISH(ADB_IsRecommendationCrid);
10330 
10331  return(result);
10332 }
10333 
10339 void ADB_SetCridDoNotDelete(void *c_ptr, BOOLEAN do_not_delete)
10340 {
10341  FUNCTION_START(ADB_SetCridDoNotDelete);
10342 
10343  if (c_ptr != NULL)
10344  {
10346  DBDEF_SetCridDoNotDelete(c_ptr, do_not_delete);
10348  }
10349 
10350  FUNCTION_FINISH(ADB_SetCridDoNotDelete);
10351 }
10352 
10358 BOOLEAN ADB_GetCridDoNotDelete(void *c_ptr)
10359 {
10360  BOOLEAN result;
10361 
10362  FUNCTION_START(ADB_GetCridDoNotDelete);
10363 
10364  result = FALSE;
10365  if (c_ptr != NULL)
10366  {
10368 
10369  if (DBDEF_IsValidCridRecord(c_ptr))
10370  {
10371  result = ((ADB_CRID_REC *)c_ptr)->do_not_delete;
10372  }
10373 
10375  }
10376 
10377  FUNCTION_FINISH(ADB_GetCridDoNotDelete);
10378 
10379  return(result);
10380 }
10381 
10388 U8BIT* ADB_GetCridString(void *c_ptr)
10389 {
10390  U8BIT *crid_str;
10391 
10392  FUNCTION_START(ADB_GetCridString);
10393 
10394  crid_str = NULL;
10395 
10396  if (c_ptr != NULL)
10397  {
10399 
10400  if (DBDEF_IsValidCridRecord(c_ptr) && (((ADB_CRID_REC *)c_ptr)->crid_str != NULL))
10401  {
10402  crid_str = ((ADB_CRID_REC *)c_ptr)->crid_str->str_ptr;
10403  }
10404 
10406  }
10407 
10408  FUNCTION_FINISH(ADB_GetCridString);
10409 
10410  return(crid_str);
10411 }
10412 
10418 U32DHMS ADB_GetCridDateTime(void *c_ptr)
10419 {
10420  U32DHMS time;
10421 
10422  FUNCTION_START(ADB_GetCridDateTime);
10423 
10424  time = 0;
10425 
10426  if (c_ptr != NULL)
10427  {
10429 
10430  if (DBDEF_IsValidCridRecord(c_ptr))
10431  {
10432  time = ((ADB_CRID_REC *)c_ptr)->date_time;
10433  }
10434 
10436  }
10437 
10438  FUNCTION_FINISH(ADB_GetCridDateTime);
10439 
10440  return time;
10441 }
10442 
10448 U16BIT ADB_GetCridService(void *c_ptr)
10449 {
10450  U16BIT serv_id;
10451 
10452  FUNCTION_START(ADB_GetCridService);
10453 
10454  serv_id = ADB_INVALID_DVB_ID;
10455 
10456  if (c_ptr != NULL)
10457  {
10459 
10460  if (DBDEF_IsValidCridRecord(c_ptr))
10461  {
10462  serv_id = ((ADB_CRID_REC *)c_ptr)->serv_id;
10463  }
10464 
10466  }
10467 
10468  FUNCTION_FINISH(ADB_GetCridService);
10469 
10470  return(serv_id);
10471 }
10472 
10478 U16BIT ADB_GetCridEitDate(void *c_ptr)
10479 {
10480  U16BIT date;
10481 
10482  FUNCTION_START(ADB_GetCridEitDate);
10483 
10484  date = 0;
10485 
10486  if (c_ptr != NULL)
10487  {
10489 
10490  if (DBDEF_IsValidCridRecord(c_ptr))
10491  {
10492  date = ((ADB_CRID_REC *)c_ptr)->eit_date;
10493  }
10494 
10496  }
10497 
10498  FUNCTION_FINISH(ADB_GetCridEitDate);
10499 
10500  return(date);
10501 }
10502 
10507 void ADB_DeleteCridRecord(void *c_ptr)
10508 {
10509  FUNCTION_START(ADB_DeleteCridRecord);
10510 
10511  if (c_ptr != NULL)
10512  {
10514  DBDEF_DeleteCridRecord(c_ptr);
10516  }
10517 
10518  FUNCTION_FINISH(ADB_DeleteCridRecord);
10519 }
10520 
10531 void ADB_GetCridRecordList(void ***clist_ptr, U16BIT *num_entries_ptr, BOOLEAN inc_series_crids,
10532  BOOLEAN inc_rec_crids, BOOLEAN inc_prog_crids)
10533 {
10534  void **clist;
10535  U16BIT num_entries, num_crids;
10536  ADB_CRID_REC *c_ptr;
10537  U16BIT i, j;
10538 
10539  FUNCTION_START(ADB_GetCridRecordList);
10540 
10542 
10543  /* Count the number of required CRIDs */
10544  num_entries = DBDEF_GetNumCridRecords();
10545  num_crids = 0;
10546  clist = NULL;
10547 
10548  c_ptr = DBDEF_GetNextCridRecord(NULL);
10549 
10550  for (i = 0; (i < num_entries) && (c_ptr != NULL); i++)
10551  {
10552  if (c_ptr->series_flag)
10553  {
10554  if (inc_series_crids)
10555  {
10556  num_crids++;
10557  }
10558  }
10559  else if (c_ptr->recommended_flag)
10560  {
10561  if (inc_rec_crids)
10562  {
10563  num_crids++;
10564  }
10565  }
10566  else
10567  {
10568  if (inc_prog_crids)
10569  {
10570  num_crids++;
10571  }
10572  }
10573 
10574  c_ptr = DBDEF_GetNextCridRecord(c_ptr);
10575  }
10576 
10577  if (num_crids > 0)
10578  {
10579  clist = STB_AppGetMemory(num_crids * sizeof(void *));
10580 
10581  if (clist != NULL)
10582  {
10583  c_ptr = DBDEF_GetNextCridRecord(NULL);
10584 
10585  for (i = 0, j = 0; (i != num_entries) && (c_ptr != NULL); i++)
10586  {
10587  if (c_ptr->series_flag)
10588  {
10589  if (inc_series_crids)
10590  {
10591  clist[j] = (void *)c_ptr;
10592  j++;
10593  }
10594  }
10595  else if (c_ptr->recommended_flag)
10596  {
10597  if (inc_rec_crids)
10598  {
10599  clist[j] = (void *)c_ptr;
10600  j++;
10601  }
10602  }
10603  else
10604  {
10605  if (inc_prog_crids)
10606  {
10607  clist[j] = (void *)c_ptr;
10608  j++;
10609  }
10610  }
10611 
10612  c_ptr = DBDEF_GetNextCridRecord(c_ptr);
10613  }
10614  }
10615  else
10616  {
10617  num_crids = 0;
10618  }
10619  }
10620 
10621  *clist_ptr = clist;
10622  *num_entries_ptr = num_crids;
10623 
10625 
10626  FUNCTION_FINISH(ADB_GetCridRecordList);
10627 }
10628 
10634 void ADB_ReleaseCridRecordList(void **crid_list, U16BIT num_entries)
10635 {
10636  FUNCTION_START(ADB_ReleaseCridRecordList);
10637 
10638  USE_UNWANTED_PARAM(num_entries);
10639 
10640  if (crid_list != NULL)
10641  {
10642  STB_AppFreeMemory(crid_list);
10643  }
10644 
10645  FUNCTION_FINISH(ADB_ReleaseCridRecordList);
10646 }
10647 
10654 void* ADB_GetFullSITransport(void *n_ptr)
10655 {
10656  ADB_NETWORK_REC *net_ptr;
10657  SI_LINKAGE_DESC_ENTRY *desc_ptr;
10658  void *tran_rec;
10659 
10660  FUNCTION_START(ADB_GetFullSITransport);
10661 
10663 
10664  tran_rec = NULL;
10665 
10666  net_ptr = (ADB_NETWORK_REC *)n_ptr;
10667  if (net_ptr != NULL)
10668  {
10669  desc_ptr = net_ptr->linkage_desc_list;
10670  while ((desc_ptr != NULL) && (tran_rec == NULL))
10671  {
10672  if (desc_ptr->link_type == FULL_SI_LINKAGE_TYPE)
10673  {
10674  tran_rec = (void *)DBDEF_FindTransportRecByIds(NULL, ADB_INVALID_DVB_ID,
10675  desc_ptr->orig_net_id, desc_ptr->tran_id);
10676  }
10677  desc_ptr = desc_ptr->next;
10678  }
10679  }
10680 
10682 
10683  FUNCTION_FINISH(ADB_GetFullSITransport);
10684 
10685  return(tran_rec);
10686 }
10687 
10693 void* ADB_GetEPGService(void *n_ptr)
10694 {
10695  ADB_NETWORK_REC *net_ptr;
10696  SI_LINKAGE_DESC_ENTRY *desc_ptr;
10697  void *epg_service;
10698 
10699  FUNCTION_START(ADB_GetEPGService);
10700 
10702 
10703  epg_service = NULL;
10704 
10705  net_ptr = (ADB_NETWORK_REC *)n_ptr;
10706  if (net_ptr != NULL)
10707  {
10708  desc_ptr = net_ptr->linkage_desc_list;
10709  while ((desc_ptr != NULL) && (epg_service == NULL))
10710  {
10711  if (desc_ptr->link_type == EPG_SERVICE_LINKAGE_TYPE)
10712  {
10713  epg_service = DBDEF_FindServiceRecByIds(NULL, ADB_INVALID_DVB_ID,
10714  desc_ptr->orig_net_id, desc_ptr->tran_id, desc_ptr->serv_id);
10715  }
10716  desc_ptr = desc_ptr->next;
10717  }
10718  }
10719 
10721 
10722  FUNCTION_FINISH(ADB_GetEPGService);
10723 
10724  return epg_service;
10725 }
10726 
10732 {
10733  U16BIT num_favs;
10734 
10735  FUNCTION_START(ADB_GetNumFavouriteLists);
10736 
10738  num_favs = DBDEF_GetNumFavouriteLists();
10740 
10741  FUNCTION_FINISH(ADB_GetNumFavouriteLists);
10742 
10743  return(num_favs);
10744 }
10745 
10755 BOOLEAN ADB_AddFavouriteList(U8BIT *name, U32BIT user_data, S16BIT index, U8BIT *list_id)
10756 {
10757  BOOLEAN retval;
10758  ADB_FAVLIST_REC *fav_list;
10759 
10760  FUNCTION_START(ADB_AddFavouriteList);
10761 
10763 
10764  if ((fav_list = DBDEF_AddFavouriteList(0, name, user_data, index)) != NULL)
10765  {
10766  if (list_id != NULL)
10767  {
10768  /* Return the id assigned to the list */
10769  *list_id = fav_list->list_id;
10770  }
10771 
10772  retval = TRUE;
10773  }
10774  else
10775  {
10776  retval = FALSE;
10777  }
10778 
10780 
10781  FUNCTION_FINISH(ADB_AddFavouriteList);
10782 
10783  return(retval);
10784 }
10785 
10792 {
10793  ADB_FAVLIST_REC *fl_ptr;
10794  U8BIT list_id;
10795 
10796  FUNCTION_START(ADB_GetFavouriteListIdByIndex);
10797 
10799 
10800  fl_ptr = DBDEF_GetNextFavouriteList(NULL);
10801  while ((fl_ptr != NULL) && (index > 0))
10802  {
10803  fl_ptr = DBDEF_GetNextFavouriteList(fl_ptr);
10804  index--;
10805  }
10806 
10807  if (fl_ptr != NULL)
10808  {
10809  list_id = fl_ptr->list_id;
10810  }
10811  else
10812  {
10813  list_id = 0;
10814  }
10815 
10817 
10818  FUNCTION_FINISH(ADB_GetFavouriteListIdByIndex);
10819 
10820  return(list_id);
10821 }
10822 
10828 U8BIT ADB_GetFavouriteListByUserData(U32BIT user_data)
10829 {
10830  ADB_FAVLIST_REC *fl_ptr;
10831  U8BIT list_id;
10832 
10833  FUNCTION_START(ADB_GetFavouriteListByUserData);
10834 
10836 
10837  fl_ptr = DBDEF_GetNextFavouriteList(NULL);
10838  while ((fl_ptr != NULL) && (fl_ptr->user_data != user_data))
10839  {
10840  fl_ptr = DBDEF_GetNextFavouriteList(fl_ptr);
10841  }
10842 
10843  if (fl_ptr != NULL)
10844  {
10845  list_id = fl_ptr->list_id;
10846  }
10847  else
10848  {
10849  list_id = 0;
10850  }
10851 
10853 
10854  FUNCTION_FINISH(ADB_GetFavouriteListByUserData);
10855 
10856  return(list_id);
10857 }
10858 
10865 U8BIT* ADB_GetFavouriteListName(U8BIT list_id)
10866 {
10867  U8BIT *name;
10868  ADB_FAVLIST_REC *fav_list;
10869 
10870  FUNCTION_START(ADB_GetFavouriteListName);
10871 
10873 
10874  name = NULL;
10875 
10876  if ((fav_list = DBDEF_FindFavouriteList(list_id)) != NULL)
10877  {
10878  name = CopyString(fav_list->name, TRUE);
10879  }
10880 
10882 
10883  FUNCTION_FINISH(ADB_GetFavouriteListName);
10884 
10885  return(name);
10886 }
10887 
10894 BOOLEAN ADB_SetFavouriteListName(U8BIT list_id, U8BIT *name)
10895 {
10896  ADB_FAVLIST_REC *fav_list;
10897  BOOLEAN success = TRUE;
10898 
10899  FUNCTION_START(ADB_SetFavouriteListName);
10900 
10902 
10903  if ((fav_list = DBDEF_FindFavouriteList(list_id)) != NULL)
10904  {
10905  DBDEF_SetFavouriteListName(fav_list, name);
10906  }
10907  else
10908  {
10909  success = FALSE;
10910  }
10911 
10913 
10914  FUNCTION_FINISH(ADB_SetFavouriteListName);
10915 
10916  return(success);
10917 }
10918 
10924 U32BIT ADB_GetFavouriteListUserData(U8BIT list_id)
10925 {
10926  U32BIT user_data;
10927  ADB_FAVLIST_REC *fav_list;
10928 
10929  FUNCTION_START(ADB_GetFavouriteListUserData);
10930 
10932 
10933  user_data = 0;
10934 
10935  if ((fav_list = DBDEF_FindFavouriteList(list_id)) != NULL)
10936  {
10937  user_data = fav_list->user_data;
10938  }
10939 
10941 
10942  FUNCTION_FINISH(ADB_GetFavouriteListUserData);
10943 
10944  return(user_data);
10945 }
10946 
10952 void ADB_SetFavouriteListUserData(U8BIT list_id, U32BIT user_data)
10953 {
10954  ADB_FAVLIST_REC *fav_list;
10955 
10956  FUNCTION_START(ADB_SetFavouriteListUserData);
10957 
10959 
10960  if ((fav_list = DBDEF_FindFavouriteList(list_id)) != NULL)
10961  {
10962  DBDEF_SetFavouriteListUserData(fav_list, user_data);
10963  }
10964 
10966 
10967  FUNCTION_FINISH(ADB_SetFavouriteListUserData);
10968 }
10969 
10977 BOOLEAN ADB_MoveFavouriteListTo(U8BIT list_id, S16BIT index)
10978 {
10979  BOOLEAN retval;
10980  ADB_FAVLIST_REC *fav_list;
10981 
10982  FUNCTION_START(ADB_MoveFavouriteListTo);
10983 
10984  retval = FALSE;
10985 
10987 
10988  if ((fav_list = DBDEF_FindFavouriteList(list_id)) != NULL)
10989  {
10990  DBDEF_MoveFavouriteListTo(fav_list, index);
10991  retval = TRUE;
10992  }
10993 
10995 
10996  FUNCTION_FINISH(ADB_MoveFavouriteListTo);
10997 
10998  return(retval);
10999 }
11000 
11005 void ADB_DeleteFavouriteList(U8BIT list_id)
11006 {
11007  ADB_FAVLIST_REC *fav_list;
11008 
11009  FUNCTION_START(ADB_DeleteFavouriteList);
11010 
11012 
11013  if ((fav_list = DBDEF_FindFavouriteList(list_id)) != NULL)
11014  {
11015  DBDEF_DeleteFavouriteList(fav_list);
11016  }
11017 
11019 
11020  FUNCTION_FINISH(ADB_DeleteFavouriteList);
11021 }
11022 
11032 BOOLEAN ADB_AddServiceToFavouriteList(U8BIT list_id, void *serv_ptr, S16BIT index)
11033 {
11034  BOOLEAN retval;
11035  ADB_FAVLIST_REC *fav_list;
11036 
11037  FUNCTION_START(ADB_AddServiceToFavouriteList);
11038 
11039  retval = FALSE;
11040 
11042 
11043  if ((fav_list = DBDEF_FindFavouriteList(list_id)) != NULL)
11044  {
11045  /* Add the service to this list */
11046  if (DBDEF_AddServiceToFavouriteList(fav_list, (ADB_SERVICE_REC *)serv_ptr, index) != NULL)
11047  {
11048  retval = TRUE;
11049  }
11050  }
11051 
11053 
11054  FUNCTION_FINISH(ADB_AddServiceToFavouriteList);
11055 
11056  return(retval);
11057 }
11058 
11068 BOOLEAN ADB_MoveFavouriteListServiceTo(U8BIT list_id, void *serv_ptr, S16BIT index)
11069 {
11070  BOOLEAN retval;
11071  ADB_FAVLIST_REC *fav_list;
11072  ADB_FAVSERV_REC *fav_serv;
11073 
11074  FUNCTION_START(ADB_MoveFavouriteListServiceTo);
11075 
11076  retval = FALSE;
11077 
11079 
11080  if ((fav_list = DBDEF_FindFavouriteList(list_id)) != NULL)
11081  {
11082  if ((fav_serv = DBDEF_FindServiceInFavouriteList(fav_list, serv_ptr)) != NULL)
11083  {
11084  DBDEF_MoveFavouriteListServiceTo(fav_list, fav_serv, index);
11085  retval = TRUE;
11086  }
11087  }
11088 
11090 
11091  FUNCTION_FINISH(ADB_MoveFavouriteListServiceTo);
11092 
11093  return(retval);
11094 }
11095 
11105 BOOLEAN ADB_MoveFavouriteListServiceFromTo(U8BIT list_id, S16BIT current_index, S16BIT new_index)
11106 {
11107  BOOLEAN retval;
11108  ADB_FAVLIST_REC *fav_list;
11109  ADB_FAVSERV_REC *fav_serv;
11110 
11111  FUNCTION_START(ADB_MoveFavouriteListServiceFromTo);
11112 
11113  retval = FALSE;
11114 
11116 
11117  if ((fav_list = DBDEF_FindFavouriteList(list_id)) != NULL)
11118  {
11119  fav_serv = DBDEF_GetNextServiceFromFavouriteList(fav_list, NULL);
11120  while ((fav_serv != NULL) && (current_index > 0))
11121  {
11122  fav_serv = DBDEF_GetNextServiceFromFavouriteList(fav_list, fav_serv);
11123  current_index--;
11124  }
11125 
11126  if (fav_serv != NULL)
11127  {
11128  DBDEF_MoveFavouriteListServiceTo(fav_list, fav_serv, new_index);
11129  retval = TRUE;
11130  }
11131  }
11132 
11134 
11135  FUNCTION_FINISH(ADB_MoveFavouriteListServiceFromTo);
11136 
11137  return(retval);
11138 }
11139 
11145 void ADB_DeleteServiceFromFavouriteList(U8BIT list_id, void *serv_ptr)
11146 {
11147  ADB_FAVLIST_REC *fav_list;
11148  ADB_FAVSERV_REC *fav_serv;
11149 
11150  FUNCTION_START(ADB_DeleteServiceFromFavouriteList);
11151 
11153 
11154  if ((fav_list = DBDEF_FindFavouriteList(list_id)) != NULL)
11155  {
11156  /* Delete the service from this list */
11157  if ((fav_serv = DBDEF_FindServiceInFavouriteList(fav_list, serv_ptr)) != NULL)
11158  {
11159  DBDEF_DeleteServiceFromFavouriteList(fav_list, fav_serv);
11160  }
11161  }
11162 
11164 
11165  FUNCTION_FINISH(ADB_DeleteServiceFromFavouriteList);
11166 }
11167 
11173 {
11174  ADB_FAVLIST_REC *fav_list;
11175 
11177 
11179 
11180  if ((fav_list = DBDEF_FindFavouriteList(list_id)) != NULL)
11181  {
11183  }
11184 
11186 
11187  FUNCTION_FINISH(ADB_DeleteAllServicesFromFavouriteList);
11188 }
11189 
11190 #ifdef COMMON_INTERFACE
11191 
11196 BOOLEAN ADB_GetServiceSDTReceived(void *s_ptr)
11197 {
11198  BOOLEAN sdt_received;
11199 
11200  FUNCTION_START(ADB_GetServiceSDTReceived);
11201 
11203 
11204  if (s_ptr != NULL)
11205  {
11206  sdt_received = ((ADB_SERVICE_REC *)s_ptr)->sdt_received;
11207  }
11208  else
11209  {
11210  sdt_received = FALSE;
11211  }
11212 
11214 
11215  FUNCTION_FINISH(ADB_GetServiceSDTReceived);
11216 
11217  return(sdt_received);
11218 }
11219 
11225 U8BIT* ADB_GetServiceCIProtectionDesc(void *s_ptr)
11226 {
11227  U8BIT *ci_data;
11228 
11229  FUNCTION_START(ADB_GetServiceCIProtectionDesc);
11230 
11232 
11233  if (s_ptr != NULL)
11234  {
11235  ci_data = ((ADB_SERVICE_REC *)s_ptr)->ci_protection_desc;
11236  }
11237  else
11238  {
11239  ci_data = NULL;
11240  }
11241 
11243 
11244  FUNCTION_FINISH(ADB_GetServiceCIProtectionDesc);
11245 
11246  return(ci_data);
11247 }
11248 
11254 BOOLEAN ADB_HasCIProtectionExpired(void *s_ptr)
11255 {
11256  BOOLEAN expired;
11257  U32BIT time_diff;
11258 
11259  FUNCTION_START(ADB_HasCIProtectionExpired);
11260 
11262 
11263  expired = FALSE;
11264 
11265  if (s_ptr != NULL)
11266  {
11267  if (((ADB_SERVICE_REC *)s_ptr)->ci_protection_desc != NULL)
11268  {
11269  time_diff = STB_OSGetClockRTC() - ((ADB_SERVICE_REC *)s_ptr)->ci_prot_last_update;
11270  if (time_diff >= CI_PROTECTION_DESC_TIME_LIMIT)
11271  {
11272  expired = TRUE;
11273  }
11274  }
11275  }
11276 
11278 
11279  FUNCTION_FINISH(ADB_HasCIProtectionExpired);
11280 
11281  return(expired);
11282 }
11283 
11284 #endif /* COMMON_INTERFACE */
11285 
11293 U8BIT* ADB_GetServicePMTData(void *s_ptr, U16BIT *data_len)
11294 {
11295  U8BIT *pmt_data;
11296  ADB_SERVICE_REC *serv_ptr;
11297 
11298  FUNCTION_START(ADB_GetServicePMTData);
11299 
11301 
11302  if (s_ptr != NULL)
11303  {
11304  serv_ptr = (ADB_SERVICE_REC *)s_ptr;
11305  pmt_data = serv_ptr->pmt_data;
11306  *data_len = serv_ptr->pmt_data_len;
11307  }
11308  else
11309  {
11310  pmt_data = NULL;
11311  }
11312 
11314 
11315  FUNCTION_FINISH(ADB_GetServicePMTData);
11316 
11317  return(pmt_data);
11318 }
11319 
11325 U16BIT ADB_GetServicePmtPid(void *s_ptr)
11326 {
11327  U16BIT pmt_pid = 0;
11328 
11329  FUNCTION_START(ADB_GetServicePmtPid);
11330 
11332  pmt_pid = DBDEF_GetServicePmtPid((ADB_SERVICE_REC *)s_ptr);
11334 
11335  FUNCTION_FINISH(ADB_GetServicePmtPid);
11336 
11337  return pmt_pid;
11338 }
11339 
11345 U16BIT ADB_GetServiceAitPid(void *s_ptr)
11346 {
11347  U16BIT ait_pid = 0;
11348 
11349  FUNCTION_START(ADB_GetServiceAitPid);
11350 
11351 #ifdef INTEGRATE_HBBTV
11353  ait_pid = ((ADB_SERVICE_REC *)s_ptr)->ait_pid;
11355 #else
11356  USE_UNWANTED_PARAM(s_ptr);
11357 #endif
11358 
11359  FUNCTION_FINISH(ADB_GetServiceAitPid);
11360 
11361  return ait_pid;
11362 }
11363 
11373 U16BIT ADB_GetProfileList(void ***profile_list, U16BIT *active_profile)
11374 {
11375  U16BIT num_profiles;
11376 
11377  FUNCTION_START(ADB_GetProfileList);
11378 
11380  num_profiles = DBDEF_GetProfileList(profile_list, active_profile);
11382 
11383  FUNCTION_FINISH(ADB_GetProfileList);
11384 
11385  return(num_profiles);
11386 }
11387 
11393 void ADB_ReleaseProfileList(void **profile_list, U16BIT num_profiles)
11394 {
11395  FUNCTION_START(ADB_ReleaseProfileList);
11396 
11397  DBDEF_ReleaseProfileList(profile_list, num_profiles);
11398 
11399  FUNCTION_FINISH(ADB_ReleaseProfileList);
11400 }
11401 
11407 ADB_PROFILE_TYPE ADB_GetProfileType(void *profile)
11408 {
11409  ADB_PROFILE_TYPE type = ADB_PROFILE_TYPE_BROADCAST;
11410 
11411  FUNCTION_START(ADB_GetProfileType);
11412 
11413  if (profile != NULL)
11414  {
11416  type = ((ADB_NETWORK_REC *)profile)->profile_type;
11418  }
11419 
11420  FUNCTION_FINISH(ADB_GetProfileType);
11421 
11422  return(type);
11423 }
11424 
11431 ADB_SERVICE_LIST_TYPE ADB_GetServiceListTypeForCurrentProfile(void)
11432 {
11433  ADB_SERVICE_LIST_TYPE list_type;
11434 #ifdef COMMON_INTERFACE
11435  ADB_NETWORK_REC *n_ptr;
11436 #endif
11437 
11439 
11440  list_type = ADB_SERVICE_LIST_ALL;
11441 
11442 #ifdef COMMON_INTERFACE
11444  n_ptr = DBDEF_GetCurrentCIPlusProfile();
11445  if (n_ptr != NULL)
11446  {
11447  if (n_ptr->fav_list_id != 0)
11448  {
11449  list_type = ADB_LIST_TYPE_FROM_FAVLIST(n_ptr->fav_list_id);
11450  }
11451  }
11453 #endif
11454 
11455  FUNCTION_FINISH(ADB_GetServiceListTypeForCurrentProfile);
11456 
11457  return list_type;
11458 }
11459 
11460 #ifdef COMMON_INTERFACE
11461 
11466 void* ADB_FindProfileForModule(U32BIT module)
11467 {
11468  void *profile;
11469 
11470  FUNCTION_START(ADB_FindProfileForModule);
11471 
11473  profile = DBDEF_FindNetworkForCIPlusModule(module);
11475 
11476  FUNCTION_FINISH(ADB_FindProfileForModule);
11477 
11478  return(profile);
11479 }
11480 
11486 BOOLEAN ADB_DeleteProfile(void *profile)
11487 {
11488  BOOLEAN retval;
11489  ADB_NETWORK_REC *n_ptr;
11490  ADB_TRANSPORT_REC *t_ptr, *next_t_ptr;
11491  ADB_FAVLIST_REC *fav;
11492 
11493  FUNCTION_START(ADB_DeleteProfile);
11494 
11495  retval = FALSE;
11496 
11497  if (profile != NULL)
11498  {
11499  n_ptr = (ADB_NETWORK_REC *)profile;
11500 
11502 
11503  if (n_ptr->profile_type == ADB_PROFILE_TYPE_CIPLUS)
11504  {
11505  /* Can't delete the active profile */
11506  if (!DBDEF_IsActiveProfile(n_ptr))
11507  {
11508  DBDEF_PushCIPlusProfile(n_ptr->cicam_onet_id, n_ptr->cicam_identifier);
11509 
11510  DBA_LockDatabase();
11511 
11512  /* First remove the channel list */
11513  if (n_ptr->fav_list_id != 0)
11514  {
11515  fav = DBDEF_FindFavouriteList(n_ptr->fav_list_id);
11516  if (fav != NULL)
11517  {
11519  }
11520  }
11521 
11522  t_ptr = DBDEF_GetNextTransportRec(NULL);
11523  while (t_ptr != NULL)
11524  {
11525  next_t_ptr = DBDEF_GetNextTransportRec(t_ptr);
11526  if (t_ptr->network == n_ptr)
11527  {
11528  DBDEF_DeleteTransportRec(t_ptr);
11529  }
11530 
11531  t_ptr = next_t_ptr;
11532  }
11533 
11534  DBDEF_DeleteNetworkRec(n_ptr);
11535 
11536  DBA_SaveDatabase();
11538 
11539  DBDEF_PopProfile();
11540 
11541  retval = TRUE;
11542  }
11543  }
11544 
11546  }
11547 
11548  FUNCTION_FINISH(ADB_DeleteProfile);
11549 
11550  return(retval);
11551 }
11552 
11559 U8BIT* ADB_GetProfileName(void *profile)
11560 {
11561  U8BIT *name;
11562 
11563  FUNCTION_START(ADB_GetProfileName);
11564 
11565  if (profile != NULL)
11566  {
11568  name = CopyString(((ADB_NETWORK_REC *)profile)->profile_name, TRUE);
11570  }
11571  else
11572  {
11573  name = NULL;
11574  }
11575 
11576  FUNCTION_FINISH(ADB_GetProfileName);
11577 
11578  return(name);
11579 }
11580 
11587 void ADB_MarkCIModulePresent(U16BIT cicam_onet_id, U32BIT cicam_id)
11588 {
11589  ADB_NETWORK_REC *n_ptr;
11590 
11591  FUNCTION_START(ADB_MarkCIModulePresent);
11592 
11594  /* Mark the module as present if a network record exists for it */
11595  if ((n_ptr = DBDEF_FindNetworkForCIPlusProfile(cicam_onet_id, cicam_id)) != NULL)
11596  {
11597  n_ptr->module_present = TRUE;
11598  }
11600 
11601  FUNCTION_FINISH(ADB_MarkCIModulePresent);
11602 }
11603 
11609 void ADB_MarkCIModuleNotPresent(U32BIT module)
11610 {
11611  ADB_NETWORK_REC *n_ptr;
11612 
11613  FUNCTION_START(ADB_MarkCIModuleNotPresent);
11614 
11616  n_ptr = DBDEF_FindNetworkForCIPlusModule(module);
11617  if (n_ptr != NULL)
11618  {
11619  n_ptr->module_present = FALSE;
11620  }
11622 
11623  FUNCTION_FINISH(ADB_MarkCIModuleNotPresent);
11624 }
11625 
11631 BOOLEAN ADB_GetProfileModulePresent(void *profile)
11632 {
11633  BOOLEAN present;
11634  ADB_NETWORK_REC *n_ptr;
11635 
11636  FUNCTION_START(ADB_GetProfileModulePresent);
11637 
11638  if (profile != NULL)
11639  {
11641 
11642  n_ptr = (ADB_NETWORK_REC *)profile;
11643 
11644  if (n_ptr->profile_type == ADB_PROFILE_TYPE_CIPLUS)
11645  {
11646  present = n_ptr->module_present;
11647  }
11648  else
11649  {
11650  present = TRUE;
11651  }
11652 
11654  }
11655  else
11656  {
11657  present = FALSE;
11658  }
11659 
11660  FUNCTION_FINISH(ADB_GetProfileModulePresent);
11661 
11662  return(present);
11663 }
11664 
11670 U32BIT ADB_GetProfileModule(void *profile)
11671 {
11672  U32BIT module;
11673  ADB_NETWORK_REC *n_ptr;
11674 
11675  FUNCTION_START(ADB_GetProfileModule);
11676 
11677  module = 0;
11678 
11679  if (profile != NULL)
11680  {
11682 
11683  n_ptr = (ADB_NETWORK_REC *)profile;
11684 
11685  if (n_ptr->profile_type == ADB_PROFILE_TYPE_CIPLUS)
11686  {
11687  module = n_ptr->module;
11688  }
11689 
11691  }
11692 
11693  FUNCTION_FINISH(ADB_GetProfileModule);
11694 
11695  return(module);
11696 }
11697 
11705 BOOLEAN ADB_GetProfileCAMInfo(void *profile, U16BIT *cicam_onet_id, U32BIT *cicam_id)
11706 {
11707  BOOLEAN retval;
11708  ADB_NETWORK_REC *n_ptr;
11709 
11710  FUNCTION_START(ADB_GetProfileCAMInfo);
11711 
11712  retval = FALSE;
11713 
11714  if (profile != NULL)
11715  {
11717 
11718  n_ptr = (ADB_NETWORK_REC *)profile;
11719 
11720  if (n_ptr->profile_type == ADB_PROFILE_TYPE_CIPLUS)
11721  {
11722  *cicam_onet_id = n_ptr->cicam_onet_id;
11723  *cicam_id = n_ptr->cicam_identifier;
11724  retval = TRUE;
11725  }
11726 
11728  }
11729 
11730  FUNCTION_FINISH(ADB_GetProfileCAMInfo);
11731 
11732  return(retval);
11733 }
11734 
11744 BOOLEAN ADB_SetProfileSearchRequired(void *profile, BOOLEAN search_required, U16BIT date,
11745  U8BIT hour, U8BIT min)
11746 {
11747  BOOLEAN retval;
11748  ADB_NETWORK_REC *n_ptr;
11749 
11750  FUNCTION_START(ADB_SetProfileSearchRequired);
11751 
11752  retval = FALSE;
11753 
11754  if (profile != NULL)
11755  {
11757 
11758  n_ptr = (ADB_NETWORK_REC *)profile;
11759 
11760  if (n_ptr->profile_type == ADB_PROFILE_TYPE_CIPLUS)
11761  {
11762  n_ptr->op_search_required = search_required;
11763  DBA_SetFieldValue(n_ptr->dba_rec, DBA_FIELD_OPERATOR_SEARCH, (U32BIT)search_required);
11764 
11765  n_ptr->op_search_date = date;
11766  DBA_SetFieldValue(n_ptr->dba_rec, DBA_FIELD_OP_SEARCH_DATE, (U32BIT)n_ptr->op_search_date);
11767 
11768  n_ptr->op_search_time = (hour * 60) + min;
11769  DBA_SetFieldValue(n_ptr->dba_rec, DBA_FIELD_OP_SEARCH_TIME, (U32BIT)n_ptr->op_search_time);
11770 
11771  retval = TRUE;
11772  }
11773 
11775  }
11776 
11777  FUNCTION_FINISH(ADB_SetProfileSearchRequired);
11778 
11779  return(retval);
11780 }
11781 
11787 BOOLEAN ADB_GetProfileSearchRequired(void *profile)
11788 {
11789  BOOLEAN retval;
11790  ADB_NETWORK_REC *n_ptr;
11791 
11792  FUNCTION_START(ADB_GetProfileSearchRequired);
11793 
11794  retval = FALSE;
11795 
11796  if (profile != NULL)
11797  {
11799 
11800  n_ptr = (ADB_NETWORK_REC *)profile;
11801 
11802  if (n_ptr->profile_type == ADB_PROFILE_TYPE_CIPLUS)
11803  {
11804  /* Only return TRUE if it isn't a scheduled search, or is a scheduled
11805  * search and the date/time has passed */
11806  if (n_ptr->op_search_required && ((n_ptr->op_search_date == 0) ||
11807  !STB_GCIsFutureDateTime(n_ptr->op_search_date, n_ptr->op_search_time / 60, n_ptr->op_search_time % 60, 0)))
11808  {
11809  retval = TRUE;
11810  }
11811  }
11812 
11814  }
11815 
11816  FUNCTION_FINISH(ADB_GetProfileSearchRequired);
11817 
11818  return(retval);
11819 }
11820 
11829 BOOLEAN ADB_GetProfileSearchDateTime(void *profile, U16BIT *date, U8BIT *hours, U8BIT *mins)
11830 {
11831  BOOLEAN retval;
11832  ADB_NETWORK_REC *n_ptr;
11833 
11834  FUNCTION_START(ADB_GetProfileSearchDateTime);
11835 
11836  retval = FALSE;
11837 
11838  if (profile != NULL)
11839  {
11841 
11842  n_ptr = (ADB_NETWORK_REC *)profile;
11843 
11844  if ((n_ptr->profile_type == ADB_PROFILE_TYPE_CIPLUS) && n_ptr->op_search_required &&
11845  (n_ptr->op_search_date != 0))
11846  {
11847  *date = n_ptr->op_search_date;
11848  *hours = n_ptr->op_search_time / 60;
11849  *mins = n_ptr->op_search_time % 60;
11850  retval = TRUE;
11851  }
11852 
11854  }
11855 
11856  FUNCTION_FINISH(ADB_GetProfileSearchDateTime);
11857 
11858  return(retval);
11859 }
11860 
11866 void ADB_SetProfileSearchTimer(U32BIT cicam_id, U32BIT timer_handle)
11867 {
11868  ADB_CICAM_TIMER_REC *t;
11869 
11870  FUNCTION_START(ADB_SetProfileSearchTimer);
11871 
11873 
11874  t = DBDEF_FindCicamTimer(cicam_id);
11875  if (t != NULL)
11876  {
11877  DBDEF_DeleteCicamTimerRec(t);
11878  }
11879 
11880  if (timer_handle != INVALID_TIMER_HANDLE)
11881  {
11882  DBDEF_AddCicamTimer(cicam_id, timer_handle);
11883  }
11884 
11886 
11887  FUNCTION_FINISH(ADB_SetProfileSearchTimer);
11888 }
11889 
11895 U32BIT ADB_GetProfileSearchTimer(void *profile)
11896 {
11897  U32BIT timer_handle;
11898  ADB_NETWORK_REC *n_ptr;
11899  ADB_CICAM_TIMER_REC *t;
11900 
11901  FUNCTION_START(ADB_GetProfileSearchTimer);
11902 
11903  timer_handle = INVALID_TIMER_HANDLE;
11904 
11905  if (profile != NULL)
11906  {
11908 
11909  n_ptr = (ADB_NETWORK_REC *)profile;
11910 
11911  if (n_ptr->profile_type == ADB_PROFILE_TYPE_CIPLUS)
11912  {
11913  t = DBDEF_FindCicamTimer(n_ptr->cicam_identifier);
11914  if (t != NULL)
11915  {
11916  timer_handle = t->timer_handle;
11917  }
11918  }
11919 
11921  }
11922 
11923  FUNCTION_FINISH(ADB_GetProfileSearchTimer);
11924 
11925  return(timer_handle);
11926 }
11927 
11932 void ADB_DeleteCicamTimerbyHandle(U32BIT timer_handle)
11933 {
11934  ADB_CICAM_TIMER_REC *t;
11935 
11936  FUNCTION_START(ADB_DeleteCicamTimerbyHandle);
11937 
11938  if (timer_handle != INVALID_TIMER_HANDLE)
11939  {
11941 
11942  t = DBDEF_FindCicamTimerByHandle(timer_handle);
11943  if (t != NULL)
11944  {
11945  DBDEF_DeleteCicamTimerRec(t);
11946  }
11947 
11949  }
11950 
11951  FUNCTION_FINISH(ADB_DeleteCicamTimerbyHandle);
11952 }
11953 
11954 #endif /* COMMON_INTERFACE */
11955 
11956 
11957 /*!**************************************************************************
11958  * @brief Returns the full CRID of the type given for the given event
11959  * @param serv_ptr service for the event
11960  * @param event_ptr event CRID to be returned
11961  * @param crid_type CRID type to be returned
11962  * @param index the index of the CRID to be returned (only valid for series CRIDs)
11963  * @return pointer to a string containing the CRID name,
11964  * or NULL if the event doesn't have the requested CRID type
11965  ****************************************************************************/
11966 static U8BIT* GetEventCridType(void *serv_ptr, void *event_ptr, U8BIT crid_type, U8BIT index)
11967 {
11968  ADB_EVENT_REC *e_ptr;
11969  U8BIT *crid_str;
11970 
11971  FUNCTION_START(GetEventCridType);
11972 
11973  ASSERT(serv_ptr != NULL);
11974  ASSERT(event_ptr != NULL);
11975 
11976  crid_str = NULL;
11977 
11978  if ((serv_ptr != NULL) && (event_ptr != NULL))
11979  {
11981 
11982  e_ptr = DBDEF_FindScheduleEventById((ADB_SERVICE_REC *)serv_ptr, ((S_EVENT *)event_ptr)->event_id);
11983  if (e_ptr != NULL)
11984  {
11985  crid_str = DBDEF_GetEventCrid(serv_ptr, e_ptr, crid_type, index);
11986  }
11987 
11989  }
11990 
11991  FUNCTION_FINISH(GetEventCridType);
11992 
11993  return(crid_str);
11994 }
11995 
12002 static U8BIT NumberOfCridsOfType(S_EVENT *event_ptr, U8BIT crid_type)
12003 {
12004  ADB_EVENT_REC *e_ptr;
12005  U8BIT crids_found;
12006 
12007  FUNCTION_START(NumberOfCridsOfType);
12008 
12009  ASSERT(event_ptr != NULL);
12010 
12011  crids_found = 0;
12012 
12013  if (event_ptr != NULL)
12014  {
12016 
12017  e_ptr = DBDEF_FindScheduleEventById(((S_EVENT *)event_ptr)->serv_ptr, ((S_EVENT *)event_ptr)->event_id);
12018  if (e_ptr != NULL)
12019  {
12020  crids_found = DBDEF_NumberOfCridsOfType(e_ptr, crid_type);
12021  }
12022 
12024  }
12025 
12026  FUNCTION_FINISH(NumberOfCridsOfType);
12027 
12028  return(crids_found);
12029 }
12030 
12031 /*!**************************************************************************
12032  * @brief Checks whether the given stream is of the given type
12033  * @param stream_ptr stream to be checked
12034  * @param stream_list_type type of stream
12035  * @return TRUE if the stream type matches the given type, FALSE otherwise
12036  ****************************************************************************/
12037 static BOOLEAN IsStreamOfType(ADB_STREAM_REC *stream_ptr, ADB_STREAM_LIST_TYPE stream_list_type)
12038 {
12039  BOOLEAN retval;
12040 
12041  FUNCTION_START(IsStreamOfType);
12042 
12043  retval = FALSE;
12044 
12045  if ((stream_list_type == ADB_STREAM_LIST_ALL) ||
12046  (((stream_list_type & ADB_VIDEO_LIST_STREAM) != 0) &&
12047  ((stream_ptr->type == ADB_VIDEO_STREAM) ||
12048  (stream_ptr->type == ADB_H264_VIDEO_STREAM) ||
12049  (stream_ptr->type == ADB_H265_VIDEO_STREAM)
12050  )) ||
12051  (((stream_list_type & ADB_AUDIO_LIST_STREAM) != 0) &&
12052  ((stream_ptr->type == ADB_AUDIO_STREAM) ||
12053  (stream_ptr->type == ADB_AAC_AUDIO_STREAM) ||
12054  (stream_ptr->type == ADB_HEAAC_AUDIO_STREAM) ||
12055  (stream_ptr->type == ADB_AC3_AUDIO_STREAM) ||
12056  (stream_ptr->type == ADB_EAC3_AUDIO_STREAM)
12057  )) ||
12058  (((stream_list_type & ADB_TTEXT_LIST_STREAM) != 0) && (stream_ptr->type == ADB_TTEXT_STREAM)) ||
12059  (((stream_list_type & ADB_TTEXT_SUBT_LIST_STREAM) != 0) && (stream_ptr->type == ADB_TTEXT_STREAM) &&
12060  ((stream_ptr->data.ttext.type == ADB_TELETEXT_TYPE_SUBTITLE) ||
12061  (stream_ptr->data.ttext.type == ADB_TELETEXT_TYPE_SUBTITLE_HARD_HEARING))) ||
12062  (((stream_list_type & ADB_SUBTITLE_LIST_STREAM) != 0) && (stream_ptr->type == ADB_SUBTITLE_STREAM)) ||
12063  (((stream_list_type & ADB_DATA_LIST_STREAM) != 0) && (stream_ptr->type == ADB_DATA_STREAM)))
12064  {
12065  retval = TRUE;
12066  }
12067 
12068  FUNCTION_FINISH(IsStreamOfType);
12069 
12070  return(retval);
12071 }
12072 
12078 E_STB_DP_AUDIO_CODEC ADB_GetAudioCodecFromStream(ADB_STREAM_TYPE audio_stream_type)
12079 {
12080  switch (audio_stream_type)
12081  {
12082  case ADB_AAC_AUDIO_STREAM:
12083  return AUDIO_CODEC_AAC;
12084 
12085  case ADB_HEAAC_AUDIO_STREAM:
12086  return AUDIO_CODEC_HEAAC;
12087 
12088  case ADB_AC3_AUDIO_STREAM:
12089  return AUDIO_CODEC_AC3;
12090 
12091  case ADB_EAC3_AUDIO_STREAM:
12092  return AUDIO_CODEC_EAC3;
12093 
12094  case ADB_AUDIO_STREAM:
12095  return AUDIO_CODEC_MP2;
12096 
12097  default:
12098  break;
12099  }
12100  return AUDIO_CODEC_AUTO;
12101 }
12102 
12108 E_STB_DP_VIDEO_CODEC ADB_GetVideoCodecFromStream(ADB_STREAM_TYPE video_stream_type)
12109 {
12110  switch (video_stream_type)
12111  {
12112  case ADB_H264_VIDEO_STREAM:
12113  return VIDEO_CODEC_H264;
12114 
12115  case ADB_VIDEO_STREAM:
12116  return VIDEO_CODEC_MPEG2;
12117 
12118  case ADB_H265_VIDEO_STREAM:
12119  return VIDEO_CODEC_H265;
12120 
12121  default:
12122  break;
12123  }
12124  return VIDEO_CODEC_AUTO;
12125 }
12126 
12132 void* ADB_GetEventService(void *event_ptr)
12133 {
12134  void *service_ptr = NULL;
12135 
12136  FUNCTION_START(ADB_GetEventService);
12137 
12138  if (event_ptr != NULL)
12139  {
12140  service_ptr = ((S_EVENT *)event_ptr)->serv_ptr;
12141  }
12142 
12143  FUNCTION_FINISH(ADB_GetEventService);
12144 
12145  return service_ptr;
12146 }
12147 
12148 //--------------------------------------------------------------------------------------------------
12149 // local function definitions
12150 //--------------------------------------------------------------------------------------------------
12151 
12162 static BOOLEAN EventAtTime(ADB_EVENT_REC *event_ptr, U32DHMS time)
12163 {
12164  BOOLEAN value = FALSE;
12165  U32DHMS start_time, end_time;
12166 
12167  start_time = event_ptr->start;
12168  if (start_time <= time)
12169  {
12170  end_time = STB_GCCalculateDHMS(event_ptr->start, event_ptr->duration, CALC_ADD);
12171  if (end_time > time)
12172  {
12173  value = TRUE;
12174  }
12175  }
12176 
12177  return value;
12178 }
12179 
12185 static U8BIT* CopyString(ADB_STRING *str_desc, BOOLEAN to_unicode)
12186 {
12187  U16BIT str_len;
12188  U8BIT *copied_string;
12189 
12190  FUNCTION_START(CopyString);
12191 
12192  copied_string = NULL;
12193  if (str_desc != NULL)
12194  {
12195  if (to_unicode)
12196  {
12197  copied_string = STB_ConvertStringToUTF8(str_desc->str_ptr, &str_len, FALSE,
12198  str_desc->lang_code);
12199  }
12200  else
12201  {
12202  str_len = (U16BIT)str_desc->nbytes;
12203  copied_string = (U8BIT *)STB_AppGetMemory(str_len);
12204  if (copied_string != NULL)
12205  {
12206  memcpy(copied_string, str_desc->str_ptr, str_len);
12207  }
12208  }
12209  }
12210 
12211  FUNCTION_FINISH(CopyString);
12212  return(copied_string);
12213 }
12214 
12215 static U8BIT* CopySIString(SI_STRING_DESC *str_desc)
12216 {
12217  U32BIT str_len;
12218  U8BIT *copied_string;
12219 
12220  FUNCTION_START(CopySIString);
12221 
12222  copied_string = NULL;
12223  if (str_desc != NULL)
12224  {
12225  str_len = str_desc->nbytes;
12226  copied_string = (U8BIT *)STB_AppGetMemory(str_len);
12227  if (copied_string != NULL)
12228  {
12229  memcpy(copied_string, str_desc->str_ptr, str_len);
12230  }
12231  }
12232 
12233  FUNCTION_FINISH(CopySIString);
12234  return(copied_string);
12235 }
12236 
12250 static U8BIT* ExtractShortName(ADB_STRING *str_desc)
12251 {
12252  U8BIT *ucode_name;
12253  U16BIT full_name_len;
12254  BOOLEAN reverse;
12255  U16BIT short_name_len;
12256  BOOLEAN copy_state;
12257  U16BIT i;
12258  U16BIT ucode_char;
12259  U16BIT wr_id;
12260  U16BIT rd_id;
12261  U8BIT *short_name;
12262  U32BIT num_bytes;
12263 
12264  FUNCTION_START(ExtractShortName);
12265 
12266  short_name = NULL;
12267  if (str_desc != NULL)
12268  {
12269  ucode_name = STB_ConvertStringToUnicode(str_desc->str_ptr, &reverse, &full_name_len, FALSE,
12270  str_desc->lang_code);
12271 
12272  if (ucode_name != NULL)
12273  {
12274  // control codes 0x0086/0xe086 and 0x0087/0xe087 are used to identify short name - 86 means
12275  // following characters are in the short name, 87 means following characters are excluded from
12276  // short name
12277  //
12278  // so, search along the unicode string for control codes shifting characters up to beginning
12279 
12280  wr_id = 1; // skip unicode identifier code in unicode_name[0]
12281  rd_id = 1;
12282  copy_state = FALSE;
12283  short_name_len = 0;
12284  for (i = 0; i < full_name_len; i++)
12285  {
12286  ucode_char = (ucode_name[rd_id] << 8) | ucode_name[rd_id + 1];
12287  if ((ucode_char == 0x0086) || (ucode_char == 0xe086))
12288  {
12289  copy_state = TRUE;
12290  }
12291  else if ((ucode_char == 0x0087) || (ucode_char == 0xe087))
12292  {
12293  copy_state = FALSE;
12294  }
12295  else
12296  {
12297  if (copy_state == TRUE)
12298  {
12299  ucode_name[wr_id] = ucode_name[rd_id];
12300  ucode_name[wr_id + 1] = ucode_name[rd_id + 1];
12301  wr_id += 2;
12302  short_name_len++;
12303  }
12304  }
12305  rd_id += 2;
12306  }
12307 
12308  if (short_name_len != 0)
12309  {
12310  // control characters were found and the name has been shortened - insert a new null
12311  // terminator at the appropriate place
12312  ucode_name[wr_id] = 0x00;
12313  ucode_name[wr_id + 1] = 0x00;
12314  }
12315 
12316  short_name = STB_ConvertUTF16toUTF8(ucode_name, &num_bytes);
12317 
12318  // release the unicode string storage
12319  STB_ReleaseUnicodeString(ucode_name);
12320  }
12321  }
12322 
12323  FUNCTION_FINISH(ExtractShortName);
12324  return(short_name);
12325 }
12326 
12339 static U8BIT* GetTransportName(ADB_TRANSPORT_REC *t_ptr)
12340 {
12341  U8BIT *name_str;
12342  ADB_STRING str;
12343 
12344  FUNCTION_START(GetTransportName);
12345 
12346  name_str = NULL;
12347 
12348  if (t_ptr != NULL)
12349  {
12350  str.lang_code = 0;
12351  str.nbytes = 0;
12352  str.str_ptr = ACTL_GetRfNameFromFreq(t_ptr->sig_type, t_ptr->frequency);
12353  name_str = CopyString(&str, TRUE);
12354  }
12355 
12356  FUNCTION_FINISH(GetTransportName);
12357  return(name_str);
12358 }
12359 
12371 static U16BIT GetTransportTid(ADB_TRANSPORT_REC *t_ptr)
12372 {
12373  U16BIT tid_value;
12374 
12375  FUNCTION_START(GetTransportTid);
12376 
12377  tid_value = 0;
12378  if (t_ptr != NULL)
12379  {
12380  tid_value = t_ptr->tran_id;
12381  }
12382 
12383  FUNCTION_FINISH(GetTransportTid);
12384  return(tid_value);
12385 }
12386 
12398 static U8BIT GetTransportTunedStrength(ADB_TRANSPORT_REC *t_ptr)
12399 {
12400  U8BIT tuned_signal_strength;
12401 
12402  FUNCTION_START(GetTransportTunedStrength);
12403 
12404  tuned_signal_strength = 0;
12405  if (t_ptr != NULL)
12406  {
12407  if (t_ptr->signal_level_at_search != BAD_SIGNAL_STATUS)
12408  {
12409  tuned_signal_strength = GET_SIGNAL_STRENGTH(t_ptr->signal_level_at_search);
12410  }
12411  }
12412 
12413  FUNCTION_FINISH(GetTransportTunedStrength);
12414  return(tuned_signal_strength);
12415 }
12416 
12428 static U8BIT GetTransportTunedQuality(ADB_TRANSPORT_REC *t_ptr)
12429 {
12430  U8BIT tuned_signal_quality;
12431 
12432  FUNCTION_START(GetTransportTunedQuality);
12433 
12434  tuned_signal_quality = 0;
12435  if (t_ptr != NULL)
12436  {
12437  if (t_ptr->signal_level_at_search != BAD_SIGNAL_STATUS)
12438  {
12439  tuned_signal_quality = GET_SIGNAL_QUALITY(t_ptr->signal_level_at_search);
12440  }
12441  }
12442 
12443  FUNCTION_FINISH(GetTransportTunedQuality);
12444  return(tuned_signal_quality);
12445 }
12446 
12458 static U16BIT GetTransportOriginalNetworkId(ADB_TRANSPORT_REC *t_ptr)
12459 {
12460  U16BIT orig_nid;
12461 
12462  FUNCTION_START(GetTransportListOriginalNetworkId);
12463 
12464  orig_nid = 0;
12465  if (t_ptr != NULL)
12466  {
12467  orig_nid = t_ptr->orig_net_id;
12468  }
12469 
12470  FUNCTION_FINISH(GetTransportOriginalNetworkId);
12471  return(orig_nid);
12472 }
12473 
12485 static U32BIT GetTransportFreq(ADB_TRANSPORT_REC *t_ptr)
12486 {
12487  U32BIT tp_freq;
12488 
12489  FUNCTION_START(GetTransportFreq);
12490 
12491  tp_freq = 0;
12492  if (t_ptr != NULL)
12493  {
12494  tp_freq = (t_ptr->frequency);
12495  }
12496 
12497  FUNCTION_FINISH(GetTransportFreq);
12498  return(tp_freq);
12499 }
12500 
12512 static U8BIT GetTransportBwidth(ADB_TRANSPORT_REC *t_ptr)
12513 {
12514  U8BIT bwidth_no;
12515 
12516  FUNCTION_START(GetTransportBwidth);
12517 
12518  bwidth_no = 0;
12519  if (t_ptr != NULL)
12520  {
12521  switch (t_ptr->u.terr.bwidth)
12522  {
12523  case TBWIDTH_8MHZ: {bwidth_no = 8; break; }
12524  case TBWIDTH_7MHZ: {bwidth_no = 7; break; }
12525  case TBWIDTH_6MHZ: {bwidth_no = 6; break; }
12526  case TBWIDTH_5MHZ: {bwidth_no = 5; break; }
12527  case TBWIDTH_10MHZ: {bwidth_no = 10; break; }
12528  case TBWIDTH_UNDEFINED: {bwidth_no = 0; break; }
12529  }
12530  }
12531 
12532  FUNCTION_FINISH(GetTransportBwidth);
12533  return(bwidth_no);
12534 }
12535 
12547 static S8BIT GetTransportOffset(ADB_TRANSPORT_REC *t_ptr)
12548 {
12549  S8BIT offset;
12550 
12551  FUNCTION_START(GetTransportOffset);
12552 
12553  offset = 0;
12554  if (t_ptr != NULL)
12555  {
12556  offset = t_ptr->u.terr.freq_offset;
12557  }
12558 
12559  FUNCTION_FINISH(GetTransportOffset);
12560 
12561  return(offset);
12562 }
12563 
12575 static U8BIT* GetTransportConstellationString(ADB_TRANSPORT_REC *t_ptr)
12576 {
12577  U8BIT *temp_str;
12578  U8BIT *trans_qam_string_ptr;
12579  U32BIT nbytes;
12580 
12581  FUNCTION_START(GetTransportConstellationString);
12582 
12583  temp_str = NULL;
12584  if (t_ptr != NULL)
12585  {
12586  switch (t_ptr->u.terr.constellation)
12587  {
12588  case TUNE_TCONST_QPSK: {temp_str = (U8BIT *)"QPSK QAM"; break; }
12589  case TUNE_TCONST_QAM16: {temp_str = (U8BIT *)"16 QAM"; break; }
12590  case TUNE_TCONST_QAM64: {temp_str = (U8BIT *)"64 QAM"; break; }
12591  default: break;
12592  }
12593  }
12594 
12595  trans_qam_string_ptr = NULL;
12596  if (temp_str != NULL)
12597  {
12598  nbytes = STB_GetNumBytesInString(temp_str);
12599  trans_qam_string_ptr = STB_AppGetMemory(sizeof(U8BIT) * nbytes);
12600  if (trans_qam_string_ptr != NULL)
12601  {
12602  memcpy(trans_qam_string_ptr, temp_str, nbytes);
12603  }
12604  }
12605 
12606  FUNCTION_FINISH(GetTransportConstellationString);
12607  return(trans_qam_string_ptr);
12608 }
12609 
12621 static U8BIT* GetTransportHierarchyString(ADB_TRANSPORT_REC *t_ptr)
12622 {
12623  U8BIT *temp_str;
12624  U8BIT *hierarchy_str;
12625  U8BIT nbytes;
12626 
12627  FUNCTION_START(GetTransportHierarchyString);
12628 
12629  temp_str = NULL;
12630  if (t_ptr != NULL)
12631  {
12632  switch (t_ptr->u.terr.hierarchy)
12633  {
12634  case TUNE_THIERARCHY_NONE: {temp_str = (U8BIT *)"None"; break; }
12635  case TUNE_THIERARCHY_1: {temp_str = (U8BIT *)"1"; break; }
12636  case TUNE_THIERARCHY_2: {temp_str = (U8BIT *)"2"; break; }
12637  case TUNE_THIERARCHY_4: {temp_str = (U8BIT *)"4"; break; }
12638  default: break;
12639  }
12640  }
12641 
12642  hierarchy_str = NULL;
12643  if (temp_str != NULL)
12644  {
12645  nbytes = (U8BIT)STB_GetNumBytesInString(temp_str);
12646  hierarchy_str = STB_AppGetMemory(sizeof(U8BIT) * nbytes);
12647  if (hierarchy_str != NULL)
12648  {
12649  memcpy(hierarchy_str, temp_str, nbytes);
12650  }
12651  }
12652 
12653  FUNCTION_FINISH(GetTransportHierarchyString);
12654  return(hierarchy_str);
12655 }
12656 
12672 static BOOLEAN CheckServiceInListType(ADB_SERVICE_REC *s_ptr, U32BIT list_type, BOOLEAN inc_hidden,
12673  BOOLEAN ignore_selectable)
12674 {
12675  BOOLEAN retval;
12676  ADB_FAVLIST_REC *fl_ptr;
12677 
12678  FUNCTION_START(CheckServiceInListType);
12679 
12680  retval = FALSE;
12681 
12682  if (s_ptr != NULL)
12683  {
12684  if (!s_ptr->hidden || ignore_selectable || (inc_hidden && s_ptr->selectable))
12685  {
12686  if ((list_type == ADB_SERVICE_LIST_ALL) ||
12687  (((list_type & ADB_SERVICE_LIST_TV) != 0) &&
12688  ((s_ptr->serv_type == ADB_SERVICE_TYPE_TV) ||
12689  (s_ptr->serv_type == ADB_SERVICE_TYPE_AVC_SD_TV) ||
12690  (s_ptr->serv_type == ADB_SERVICE_TYPE_HD_TV) ||
12691  (s_ptr->serv_type == ADB_SERVICE_TYPE_MPEG2_HD) ||
12692  (s_ptr->serv_type == ADB_SERVICE_TYPE_UHD_TV)
12693  )) ||
12694  (((list_type & ADB_SERVICE_LIST_RADIO) != 0) &&
12695  ((s_ptr->serv_type == ADB_SERVICE_TYPE_RADIO) ||
12696  (s_ptr->serv_type == ADB_SERVICE_TYPE_AVC_RADIO)
12697  )) ||
12698  (((list_type & ADB_SERVICE_LIST_DATA) != 0) && (s_ptr->serv_type == ADB_SERVICE_TYPE_DATA)) ||
12699  (((list_type & ADB_SERVICE_LIST_FAV_GROUP_A) != 0) && ((s_ptr->fav_groups & FAV_GROUP_A) != 0)) ||
12700  (((list_type & ADB_SERVICE_LIST_FAV_GROUP_B) != 0) && ((s_ptr->fav_groups & FAV_GROUP_B) != 0)) ||
12701  (((list_type & ADB_SERVICE_LIST_FAV_GROUP_C) != 0) && ((s_ptr->fav_groups & FAV_GROUP_C) != 0)) ||
12702  (((list_type & ADB_SERVICE_LIST_FAV_GROUP_D) != 0) && ((s_ptr->fav_groups & FAV_GROUP_D) != 0)) ||
12703  (((list_type & ADB_SERVICE_LIST_ANALOG) != 0) && ((s_ptr->serv_type == ADB_SERVICE_TYPE_ANALOG) != 0)) ||
12704  ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0))
12705  {
12706  if ((list_type & ADB_SERVICE_LIST_FREESAT) == 0 ||
12707  (s_ptr->freesat_id != INVALID_FREESAT_SERV_ID &&
12708  ((s_ptr->allocated_lcn >= 100 && s_ptr->allocated_lcn <= 999) ||
12709  (s_ptr->allocated_lcn >= 1100 && s_ptr->allocated_lcn <= 1999))))
12710  {
12711  if ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0)
12712  {
12713  /* Check that the service is in the given favourite list */
12714  if ((fl_ptr = DBDEF_FindFavouriteList(ADB_FAVLIST_FROM_LIST_TYPE(list_type))) != NULL)
12715  {
12716  if (DBDEF_FindServiceInFavouriteList(fl_ptr, s_ptr) != NULL)
12717  {
12718  /* Service is in the given favourite list */
12719  retval = TRUE;
12720  }
12721  }
12722  }
12723  else
12724  {
12725  retval = TRUE;
12726  }
12727  }
12728  }
12729  }
12730  }
12731 
12732  FUNCTION_FINISH(CheckServiceInListType);
12733 
12734  return(retval);
12735 }
12736 
12751 static void GetServiceList(U32BIT list_type, void ***slist_ptr, U16BIT *num_entries_ptr,
12752  BOOLEAN show_hidden, BOOLEAN ignore_selectable)
12753 {
12754  void **slist;
12755  U16BIT max_no_entries;
12756  U16BIT num_entries;
12757  ADB_SERVICE_REC *s_ptr;
12758  U16BIT i;
12759  ADB_FAVLIST_REC *fav_list;
12760  ADB_FAVSERV_REC *fav_serv;
12761 
12762  FUNCTION_START(GetServiceList);
12763 
12765 
12766  slist = NULL;
12767  fav_list = NULL;
12768  fav_serv = NULL;
12769  num_entries = 0;
12770  max_no_entries = 0;
12771 
12772  /* Getting services for a favourite list by iterating through all the services
12773  * ignores the ordering that's associated with a favourite list, so favourite list
12774  * services have to be acquired directly from the favourite list */
12775  if ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0)
12776  {
12777  if ((fav_list = DBDEF_FindFavouriteList(ADB_FAVLIST_FROM_LIST_TYPE(list_type))) != NULL)
12778  {
12779  max_no_entries = DBDEF_GetNumServicesInFavouriteList(fav_list);
12780  }
12781  }
12782  else
12783  {
12784  max_no_entries = DBDEF_GetNumServices();
12785  }
12786 
12787  if (max_no_entries > 0)
12788  {
12789  slist = STB_AppGetMemory(max_no_entries * sizeof(void *));
12790  if (slist != NULL)
12791  {
12792  if ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0)
12793  {
12794  if ((fav_serv = DBDEF_GetNextServiceFromFavouriteList(fav_list, NULL)) != NULL)
12795  {
12796  s_ptr = fav_serv->serv_ptr;
12797  }
12798  else
12799  {
12800  s_ptr = NULL;
12801  }
12802  }
12803  else
12804  {
12805  s_ptr = DBDEF_GetNextServiceRec(NULL);
12806  }
12807 
12808  for (i = 0; ((i < max_no_entries) && (s_ptr != NULL)); i++)
12809  {
12810  if (DBDEF_ServiceInProfile(s_ptr) &&
12811  (CheckServiceInListType(s_ptr, list_type, show_hidden, ignore_selectable) == TRUE))
12812  {
12813  if (ACFG_IsNordigCountry())
12814  {
12815  if (!HasNordigSimulcastService(s_ptr))
12816  {
12817  slist[num_entries] = (void *)s_ptr;
12818  num_entries++;
12819  }
12820  }
12821  else
12822  {
12823  slist[num_entries] = (void *)s_ptr;
12824  num_entries++;
12825  }
12826  }
12827 
12828  if ((list_type & ADB_SERVICE_LIST_FAV_LIST) != 0)
12829  {
12830  if ((fav_serv = DBDEF_GetNextServiceFromFavouriteList(fav_list, fav_serv)) != NULL)
12831  {
12832  s_ptr = fav_serv->serv_ptr;
12833  }
12834  else
12835  {
12836  s_ptr = NULL;
12837  }
12838  }
12839  else
12840  {
12841  s_ptr = DBDEF_GetNextServiceRec(s_ptr);
12842  }
12843  }
12844 
12845  if (num_entries == 0)
12846  {
12847  STB_AppFreeMemory(slist);
12848  slist = NULL;
12849  }
12850  }
12851  }
12852 
12853  *slist_ptr = slist;
12854  *num_entries_ptr = num_entries;
12855 
12857 
12858  FUNCTION_FINISH(GetServiceList);
12859 }
12860 
12877 static U8BIT* GetServiceNameByLangAndPrefId(ADB_SERVICE_REC *s_ptr, U8BIT lang, U8BIT pref_name_id,
12878  BOOLEAN short_name)
12879 {
12880  U8BIT *name_str;
12881 
12882  FUNCTION_START(GetServiceNameByLangAndPrefId);
12883 
12884  name_str = NULL;
12885  if (s_ptr != NULL)
12886  {
12887  if (short_name == TRUE)
12888  {
12889  name_str = ExtractShortName(s_ptr->name_array[lang][pref_name_id]);
12890  }
12891  else
12892  {
12893  name_str = CopyString(s_ptr->name_array[lang][pref_name_id], TRUE);
12894  }
12895  }
12896  FUNCTION_FINISH(GetServiceNameByLangAndPrefId);
12897  return(name_str);
12898 }
12899 
12912 static U16BIT GetServiceLcn(ADB_SERVICE_REC *s_ptr)
12913 {
12914  U16BIT lcn_value;
12915 
12916  FUNCTION_START(GetServiceLcn);
12917 
12918  lcn_value = 0;
12919  if (s_ptr != NULL)
12920  {
12921  lcn_value = s_ptr->allocated_lcn;
12922  }
12923  FUNCTION_FINISH(GetServiceLcn);
12924 
12925  return(lcn_value);
12926 }
12927 
12939 static U16BIT GetServiceId(ADB_SERVICE_REC *s_ptr)
12940 {
12941  U16BIT sid_value;
12942 
12943  FUNCTION_START(GetServiceId);
12944 
12945  sid_value = 0;
12946  if (s_ptr != NULL)
12947  {
12948  sid_value = s_ptr->serv_id;
12949  }
12950  FUNCTION_FINISH(GetServiceId);
12951 
12952  return(sid_value);
12953 }
12954 
12966 static BOOLEAN GetServiceUnavailFlag(void *s_ptr)
12967 {
12968  BOOLEAN unavailable;
12969 
12970  FUNCTION_START(GetServiceUnavailFlag);
12971 
12972  unavailable = FALSE;
12973  if (s_ptr != NULL)
12974  {
12975  unavailable = ((ADB_SERVICE_REC *)s_ptr)->unavailable;
12976  }
12977 
12978  FUNCTION_FINISH(GetServiceUnavailFlag);
12979  return(unavailable);
12980 }
12981 
12993 static BOOLEAN GetServiceNewFlag(void *s_ptr)
12994 {
12995  BOOLEAN new_service;
12996 
12997  FUNCTION_START(GetServiceNewFlag);
12998 
12999  new_service = FALSE;
13000  if (s_ptr != NULL)
13001  {
13002  new_service = ((ADB_SERVICE_REC *)s_ptr)->new_service;
13003  }
13004 
13005  FUNCTION_FINISH(GetServiceNewFlag);
13006  return(new_service);
13007 }
13008 
13021 static U8BIT* GetNetworkName(ADB_NETWORK_REC *n_ptr, BOOLEAN short_name)
13022 {
13023  U8BIT *name_str;
13024  U8BIT *lang_ids;
13025  U8BIT i;
13026 
13027  FUNCTION_START(GetNetworkName);
13028  name_str = NULL;
13029 
13030  if (n_ptr != NULL)
13031  {
13032  // check if string is defined, if not use default name
13033  lang_ids = DBDEF_GetTextLang();
13034 
13035  if (lang_ids != NULL)
13036  {
13037  for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
13038  (lang_ids[i] != ACFG_INVALID_DB_LANG) && (name_str == NULL); i++)
13039  {
13040  if (n_ptr->name_array[lang_ids[i]] != NULL)
13041  {
13042  name_str = GetNetworkNameByLang(n_ptr, lang_ids[i], short_name);
13043  }
13044  }
13045  }
13046 
13047  if (name_str == NULL)
13048  {
13049  // use the default name
13050  name_str = GetDefaultNetworkName(n_ptr, short_name);
13051  }
13052  }
13053  FUNCTION_FINISH(GetNetworkName);
13054  return(name_str);
13055 }
13056 
13070 static U8BIT* GetNetworkNameByLang(ADB_NETWORK_REC *n_ptr, U8BIT lang, BOOLEAN short_name)
13071 {
13072  U8BIT *name_str;
13073 
13074  FUNCTION_START(GetNetworkNameByLang);
13075 
13076  name_str = NULL;
13077  if (n_ptr != NULL)
13078  {
13079  if (short_name)
13080  {
13081  name_str = ExtractShortName(n_ptr->name_array[lang]);
13082  }
13083  else
13084  {
13085  name_str = CopyString(n_ptr->name_array[lang], TRUE);
13086  }
13087  }
13088  FUNCTION_FINISH(GetNetworkNameByLang);
13089  return(name_str);
13090 }
13091 
13105 static U8BIT* GetDefaultNetworkName(ADB_NETWORK_REC *n_ptr, BOOLEAN short_name)
13106 {
13107  U8BIT *name_str;
13108 
13109  FUNCTION_START(GetDefaultNetworkName);
13110 
13111  name_str = NULL;
13112 
13113  if (n_ptr != NULL)
13114  {
13115  if (short_name)
13116  {
13117  name_str = ExtractShortName(n_ptr->name_str);
13118  }
13119  else
13120  {
13121  name_str = CopyString(n_ptr->name_str, TRUE);
13122  }
13123  }
13124  FUNCTION_FINISH(GetDefaultNetworkName);
13125  return(name_str);
13126 }
13127 
13139 static U16BIT GetNetworkId(ADB_NETWORK_REC *n_ptr)
13140 {
13141  U16BIT nid_value;
13142 
13143  FUNCTION_START(GetNetworkId);
13144 
13145  nid_value = 0;
13146  if (n_ptr != NULL)
13147  {
13148  nid_value = n_ptr->net_id;
13149  }
13150  FUNCTION_FINISH(GetNetworkId);
13151 
13152  return(nid_value);
13153 }
13154 
13170 static S_EVENT* CopyEventRec(ADB_EVENT_REC *e_ptr, ADB_SERVICE_REC *s_ptr)
13171 {
13172  S_EVENT *tmp_event;
13173 
13174  FUNCTION_START(CopyEventRec);
13175 
13176  tmp_event = NULL;
13177 
13178  if (e_ptr != NULL)
13179  {
13180  tmp_event = STB_AppGetMemory(sizeof(S_EVENT));
13181  if (tmp_event != NULL)
13182  {
13183  memset(tmp_event, 0, sizeof(S_EVENT));
13184 
13185  tmp_event->serv_ptr = (void *)s_ptr;
13186  tmp_event->event_id = e_ptr->event_id;
13187  }
13188  }
13189 
13190  FUNCTION_FINISH(CopyEventRec);
13191 
13192  return(tmp_event);
13193 }
13194 
13195 static BOOLEAN FindDoNotScramble(ADB_EVENT_REC *e_ptr, ADB_SERVICE_REC *s_ptr)
13196 {
13197  BOOLEAN has_desc;
13198  BOOLEAN do_not_scramble;
13199 
13200  FUNCTION_START(FindDoNotScramble);
13201 
13202  has_desc = FALSE;
13203  do_not_scramble = TRUE;
13204 
13205  if (e_ptr != NULL)
13206  {
13207  if (e_ptr->has_content_management_desc)
13208  {
13209  has_desc = TRUE;
13210  do_not_scramble = e_ptr->do_not_scramble;
13211  }
13212  }
13213 
13214  if (!has_desc)
13215  {
13216  /* Check the service for the flag */
13217  if (s_ptr->has_fta_desc)
13218  {
13219  do_not_scramble = s_ptr->do_not_scramble;
13220  }
13221  else
13222  {
13223  /* Check the service's transport record */
13224  if (s_ptr->transport != NULL)
13225  {
13226  if (s_ptr->transport->has_fta_desc)
13227  {
13228  do_not_scramble = s_ptr->transport->do_not_scramble;
13229  }
13230  else
13231  {
13232  /* Check the network record */
13233  if (s_ptr->transport->network != NULL)
13234  {
13235  if (s_ptr->transport->network->has_fta_desc)
13236  {
13237  do_not_scramble = s_ptr->transport->network->do_not_scramble;
13238  }
13239  else
13240  {
13241  /* Check the satellite */
13242  if (s_ptr->transport->network->satellite != NULL)
13243  {
13244  if (s_ptr->transport->network->satellite->has_fta_desc)
13245  {
13246  do_not_scramble = s_ptr->transport->network->satellite->do_not_scramble;
13247  }
13248  }
13249  }
13250  }
13251  }
13252  }
13253  }
13254  }
13255 
13256  FUNCTION_FINISH(FindDoNotScramble);
13257 
13258  return(do_not_scramble);
13259 }
13260 
13261 /*!**************************************************************************
13262  * @brief This checks for if a service has a Nordig Simulcast in its Linkage
13263  * @param serv_ptr service pointer to check for simulcast service
13264  * @return BOOLEAN TRUE - Simulcast service, FALSE - Non-Simulcast service
13265  ****************************************************************************/
13266 static BOOLEAN HasNordigSimulcastService(void *serv_ptr)
13267 {
13268  ADB_SERVICE_REC *temp_serv_ptr;
13269  SI_LINKAGE_DESC_ENTRY *desc_ptr;
13270  BOOLEAN found;
13271 
13272  FUNCTION_START(HasNordigSimulcastService);
13273 
13274  found = FALSE;
13275 
13276  temp_serv_ptr = (ADB_SERVICE_REC *)serv_ptr;
13277  if (temp_serv_ptr != NULL)
13278  {
13279  desc_ptr = temp_serv_ptr->linkage_desc_list;
13280  while ((desc_ptr != NULL) && !found)
13281  {
13282  if (desc_ptr->link_type == NORDIG_SIMULCAST_TYPE)
13283  {
13284  if (DBDEF_FindServiceRecByIds(NULL, ADB_INVALID_DVB_ID, desc_ptr->orig_net_id,
13285  desc_ptr->tran_id, desc_ptr->serv_id) != NULL)
13286  {
13287  found = TRUE;
13288  }
13289  }
13290  desc_ptr = desc_ptr->next;
13291  }
13292  }
13293 
13294  FUNCTION_FINISH(HasNordigSimulcastService);
13295 
13296  return(found);
13297 }
13298 
13299 //**************************************************************************************************
13300 // End of File
13301 //**************************************************************************************************
U8BIT DBDEF_GetEventComponentList(ADB_EVENT_REC *e_ptr, ADB_EVENT_COMPONENT_INFO **component_list)
Retrieves a list of components associated with the specified event, as described by component descrip...
Definition: ap_dbdef.c:3298
ADB_LNB_BAND_REC * DBDEF_GetNextLNBBandRec(ADB_LNB_BAND_REC *band_ptr)
Returns the next LNB band record after the one given. If the argument is NULL then the first record i...
Definition: ap_dbdef.c:4587
U16BIT ADB_FindServiceInList(void *s_ptr, void **slist_ptr, U16BIT num_entries)
Returns the index in the given list of services of the given service.
Definition: ap_dbacc.c:4170
U8BIT ** ADB_GetServiceListTransportNames(void **slist, U16BIT num_entries)
Allocates and returns a list of transport names for all the services in the given service list...
Definition: ap_dbacc.c:4746
U16BIT DBDEF_GetReqdAudioPid(ADB_SERVICE_REC *s_ptr, E_STB_DP_AUDIO_MODE *audio_mode, ADB_STREAM_TYPE *audio_type)
Gets the appropriate audio pid - looks first for the pid matching exactly the required audio settings...
Definition: ap_dbdef.c:6298
BOOLEAN ADB_GetEventAudioDescriptionFlag(void *event_ptr)
Returns whether audio description is signalled as being available for the given event.
Definition: ap_dbacc.c:8991
U8BIT * DBDEF_GetServiceGuidanceData(ADB_SERVICE_REC *s_ptr, U8BIT *type, U8BIT *mode)
Returns the guidance text for the service, as a UTF-8 string. The returned string should be freed usi...
Definition: ap_dbdef.c:2879
U16BIT ADB_GetNumNetworks(void)
Returns the number of network records in the database.
Definition: ap_dbacc.c:1078
void * ADB_EarlierEvent(void *serv_ptr, U32DHMS time)
Returns a copy of the event preceeding the given date/time on the given service.
Definition: ap_dbacc.c:8171
U8BIT DBDEF_GetEventParentalAge(ADB_EVENT_REC *e_ptr)
Returns the parental age value for the given event.
Definition: ap_dbdef.c:2938
void DBDEF_SetTunedTransport(U8BIT path, ADB_TRANSPORT_REC *t_ptr)
sets the currently tuned transport
Definition: ap_dbdef.c:8034
U8BIT ADB_GetTransportBwidth(void *t_ptr)
Returns the bandwidth value of the given DVB-T/T2 transport.
Definition: ap_dbacc.c:2453
void * ADB_GetTransportNetworkPtr(void *t_ptr)
Returns the network of the given transport.
Definition: ap_dbacc.c:2405
U8BIT * STB_ConvertStringToUnicode(U8BIT *string, BOOLEAN *reverse_dir, U16BIT *nchar, BOOLEAN strip_DVB_cntrl_char, U32BIT lang_code)
Converts the specified DVB coded string into a unicode string, counting the number of characters and ...
Definition: stbuni.c:1069
void DBDEF_DeleteCridRecord(ADB_CRID_REC *c_ptr)
Deletes the given CRID record from the database.
Definition: ap_dbdef.c:8939
U32DHMS STB_GCCalculateDHMS(U32DHMS dhms, U32DHMS period, E_STB_GC_CALCTYPE calc)
Calculates the date/time when the period is added/subtracted to/from dhms.
Definition: stbgc.c:2136
U16BIT ADB_GetServicePCRPid(void *s_ptr)
Returns the PCR PID for the given service.
Definition: ap_dbacc.c:5164
void ADB_AllocateLcns(E_STB_DP_SIGNAL_TYPE tuner_type)
Allocates LCNs to services after a service search. This function assumes that ADB_FinaliseDatabaseAft...
Definition: ap_dbacc.c:391
U16BIT ADB_GetStreamTagContentType(void *stream_ptr, U8BIT index)
For the given stream and index into component tag array for stream, return stream content and compone...
Definition: ap_dbacc.c:7444
void ADB_SetTransportSearchFlag(void *t_ptr, BOOLEAN state)
Sets whether a transport has been used during a service scan operation.
Definition: ap_dbacc.c:2235
void ASI_NotifyEitSchedUpdate(void *serv_ptr, U16BIT event_id, E_APP_SI_EIT_JOURNAL_TYPE type)
Calls the EIT schedule update callback function, if one has been registered, with details of the serv...
Definition: ap_si.c:10572
void ADB_GetServiceListIncludingHidden(U32BIT list_type, void ***slist_ptr, U16BIT *num_entries_ptr, BOOLEAN ignore_selectable)
Allocates and returns a list of all services in the database for the given list type, including hidden services.
Definition: ap_dbacc.c:3270
U32BIT * ADB_GetServiceListHdFlag(void **slist, U16BIT num_entries)
Allocates and returns an array indicating whether each service in the given service list is an HD ser...
Definition: ap_dbacc.c:4581
void * ADB_GetLNBBandLNB(void *band_ptr)
Returns the LNB associated with the band.
Definition: ap_dbacc.c:802
U16BIT ADB_GetNumSatellites(void)
Returns the number of satellites in the database.
Definition: ap_dbacc.c:893
void DBDEF_DeleteEventList(ADB_EVENT_REC *elist)
Deletes all events in the given list.
Definition: ap_dbdef.c:3754
U16BIT ADB_GetStreamPID(void *stream_ptr)
Returns the PID for the given stream.
Definition: ap_dbacc.c:7157
U16BIT ADB_GetServiceId(void *s_ptr)
Returns the signalled service id of the given service.
Definition: ap_dbacc.c:4960
void ADB_FinaliseDatabaseAfterSearch(BOOLEAN save_changes, E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite, BOOLEAN search_completed, BOOLEAN clear_new_flags, BOOLEAN manual_search)
Completes the database setup after a search.
Definition: ap_dbacc.c:283
void * ADB_AddLNBBand(S_STB_DP_LNB_BAND *band_parameters, void *lnb_ptr)
Creates a new LNB band in the database with the given settings.
Definition: ap_dbacc.c:760
void ADB_SaveCridRecord(void *c_ptr)
Saves a CRID record to non-volatile storage.
Definition: ap_dbacc.c:10068
U8BIT * ADB_GetFullCrid(void *serv_ptr, U8BIT *event_str)
Returns the full CRID for the given CRID string The returned string should be freed using STB_AppFree...
Definition: ap_dbacc.c:9326
void ADB_SetCridDateTime(void *c_ptr, U32DHMS datetime)
Sets the date and time fields on the given CRID record.
Definition: ap_dbacc.c:10124
U16BIT ADB_GetNetworkId(void *n_ptr)
Returns the network id of the given network.
Definition: ap_dbacc.c:1276
U8BIT ** ADB_GetServiceListFullNames(void **slist, U16BIT num_entries, BOOLEAN use_pref_names)
Allocates and returns a list of the fullnames for all the services in the given service list...
Definition: ap_dbacc.c:4204
U16BIT DBDEF_GetNumServicesInFavouriteList(ADB_FAVLIST_REC *fav_list)
Returns the number of services in the given favourite list.
Definition: ap_dbdef.c:9389
U16BIT DBDEF_GetReqdADPid(ADB_SERVICE_REC *s_ptr, E_STB_DP_AUDIO_MODE *ad_mode, ADB_STREAM_TYPE *ad_type, BOOLEAN *broadcast_mix)
Gets the appropriate audio description pid - looks first for the pid matching exactly the required au...
Definition: ap_dbdef.c:6352
U8BIT * DBDEF_GetTextLang(void)
returns array of current text langs
Definition: ap_dbdef.c:8133
void * ADB_FindCridRecord(U8BIT *crid_str)
Searches for and returns the CRID record with the given CRID string.
Definition: ap_dbacc.c:10089
void DBDEF_SetSecondaryTextLang(U8BIT *lang_ids)
sets secondary text lang
Definition: ap_dbdef.c:8151
ADB_FAVSERV_REC * DBDEF_FindServiceInFavouriteList(ADB_FAVLIST_REC *fav_list, void *serv_ptr)
Returns the ADB_FAVSERV_REC from the given favourite list for the given service.
Definition: ap_dbdef.c:9501
void * ADB_AddSatellite(U8BIT *name_str, U16BIT dish_pos, U16BIT long_pos, BOOLEAN east_west, void *lnb_ptr)
Creates a new satellite in the database with the given settings.
Definition: ap_dbacc.c:918
void * ADB_GetNextServiceInList(U32BIT list_type, void *serv)
Returns the next service, in LCN order, for the given list type, starting from the given service...
Definition: ap_dbacc.c:3767
U16BIT DBDEF_GetNumSatellites(void)
Returns the number of satellite records in the database.
Definition: ap_dbdef.c:4362
ADB_STREAM_TYPE ADB_GetServiceAudioType(void *s_ptr)
Returns the audio type being used by the given service.
Definition: ap_dbacc.c:5212
BOOLEAN DBDEF_SetLNB22k(ADB_LNB_REC *lnb, BOOLEAN is_22k)
Sets the LNB 22k setting.
Definition: ap_dbdef.c:4085
U16BIT ADB_GetEventId(void *event_ptr)
Returns the event id for the given event.
Definition: ap_dbacc.c:8970
U8BIT * ADB_GetEventGuidance(void *event_ptr, void *serv_ptr, U8BIT *type, U8BIT *mode)
Returns the guidance text for an event, either from the event itself or the event&#39;s service...
Definition: ap_dbacc.c:8936
BOOLEAN ADB_GetServiceHiddenFlag(void *s_ptr)
Returns the hidden status of the given service. A hidden service should not be present to the user in...
Definition: ap_dbacc.c:9654
BOOLEAN DBA_SaveDatabase(void)
Saves any changes made to the working database to non-volatile storage. If saving to a file...
Definition: dba_nvm.c:667
U32BIT * ADB_GetServiceListNewFlag(void **slist, U16BIT num_entries)
Allocates and returns an array of the &#39;new&#39; flags for each of the services in the given service list...
Definition: ap_dbacc.c:4463
U8BIT ADB_GetStreamComponentType(void *stream_ptr)
Returns the component type as defined in the EITp/f&#39;s component descriptor for the given stream...
Definition: ap_dbacc.c:7420
BOOLEAN ADB_ServiceRCTCanUseDefaultIcon(void *serv_ptr)
Checks all the RCT links for the given service to determine whether any of them specify that the defa...
Definition: ap_dbacc.c:6558
void ADB_SetCridDoNotDelete(void *c_ptr, BOOLEAN do_not_delete)
Sets the do not delete flag for the given CRID.
Definition: ap_dbacc.c:10339
void ADB_SetServiceFavGroups(void *s_ptr, U8BIT groups)
Sets the favourite group value for the given service. This is an 8-bit value that can define whether ...
Definition: ap_dbacc.c:9798
void * ADB_GetTunedTransport(U8BIT path)
Returns the transport that&#39;s tuned to on the given decode path.
Definition: ap_dbacc.c:3015
BOOLEAN DBA_RestoreDatabase(void)
Restores the working database from a previously made backup copy.
Definition: dba_nvm.c:789
void * ADB_GetNextLNB(void *lnb_ptr)
Returns the next LNB from the database.
Definition: ap_dbacc.c:672
ADB_SERVICE_LIST_TYPE ADB_GetServiceListTypeForCurrentProfile(void)
Returns the default list type for the current profile. This function returns ADB_SERVICE_LIST_ALL if ...
Definition: ap_dbacc.c:11431
U8BIT * ADB_GetServiceShortNameByLangAndPrefId(void *s_ptr, U8BIT lang, U8BIT pref_name_id)
Returns the short name of the given service as a UTF-8 string using the given language and preferred ...
Definition: ap_dbacc.c:4920
U16BIT ADB_GetCridEitDate(void *c_ptr)
Returns the EIT update date contained in the given CRID record.
Definition: ap_dbacc.c:10478
void ADB_SetSecondaryAudioLang(U32BIT country_code, U8BIT lang_id)
Sets the secondary audio language to be used. This will be selected if the primary audio language isn...
Definition: ap_dbacc.c:7516
void ADB_ReleaseTransportList(void **tlist, U16BIT num_transports)
Frees a transport list returned from one of the ADB_GetTransportList functions.
Definition: ap_dbacc.c:1836
BOOLEAN ADB_GetServiceScrambledFlag(void *s_ptr)
Returns the status of the &#39;scrambled&#39; flag of the given service. This flag is set depending on the sc...
Definition: ap_dbacc.c:5679
U16BIT ADB_GetNumLNBBands(void)
Returns the number of LNB bands in the database.
Definition: ap_dbacc.c:739
void ADB_SetServiceListLockedFlag(void **slist, U16BIT num_entries, BOOLEAN locked)
Sets the locked state of all services in the given service list.
Definition: ap_dbacc.c:4626
BOOLEAN DBA_BackupDatabase(U8BIT *pathname)
Creates a backup copy of the working database. Whether the backup database is saved to non-volatile s...
Definition: dba_nvm.c:723
ADB_TRANSPORT_REC * DBDEF_FindSatTransportRec(U32BIT freq_hz, U16BIT symbol_rate, E_STB_DP_POLARITY polarity, BOOLEAN dvb_s2, E_STB_DP_MODULATION modulation, void *satellite)
Find the satellite transport record in the database matching the given params.
Definition: ap_dbdef.c:5170
BOOLEAN ADB_IsSeriesCrid(void *c_ptr)
Returns TRUE if the CRID record given represents a series.
Definition: ap_dbacc.c:10279
BOOLEAN ADB_GetStreamHasCaDesc(void *stream_ptr)
Returns whether the given stream has a CA descriptor.
Definition: ap_dbacc.c:7198
U8BIT ADB_GetServiceFavGroups(void *s_ptr)
Returns the favourite group value for the given service. This is an 8-bit value that can define wheth...
Definition: ap_dbacc.c:9772
Application configuration.
ADB_FAVSERV_REC * DBDEF_AddServiceToFavouriteList(ADB_FAVLIST_REC *fav_list, ADB_SERVICE_REC *serv_ptr, S16BIT index)
Adds a new service to the given favourite list at the given position.
Definition: ap_dbdef.c:9404
U32BIT * ADB_GetTransportListBwidths(void **tlist, U16BIT num_entries)
Returns the transport bwidth_array.
Definition: ap_dbacc.c:2053
U16BIT ADB_GetNumStreams(void *serv_ptr, ADB_STREAM_LIST_TYPE stream_list_type)
Returns the number of streams of the given type for the given service.
Definition: ap_dbacc.c:6845
void ADB_ReleaseNetworkList(void **nlist)
Frees a network list returned by ADB_GetNetworkList.
Definition: ap_dbacc.c:1141
U16BIT DBDEF_GetNumCridRecords(void)
Returns the number of CRID records in the database.
Definition: ap_dbdef.c:8969
U8BIT * STB_ConvertUTF16toUTF8(U8BIT *src, U32BIT *outlen)
Creates the given string from UTF-16 to UTF-8 and returns a new string. The returned string should be...
Definition: stbuni.c:1974
void ADB_GetUnavailableServiceList(void ***slist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all services that are marked as being unavailable. A service becomes unavailable when it disappears from the SDT.
Definition: ap_dbacc.c:3448
U32BIT ADB_GetSubtitleStreamLangCode(void *stream_ptr)
Returns the 3 char language code of the given subtitle stream.
Definition: ap_dbacc.c:7359
void * ADB_FindServiceByNearestLcn(U32BIT list_type, U16BIT lcn)
Returns the service matching the given, or preceding, LCN and list type.
Definition: ap_dbacc.c:4026
U16BIT ADB_GetServicePmtPid(void *s_ptr)
Returns the current PMT PID for the given service.
Definition: ap_dbacc.c:11325
void ADB_SetServiceHiddenFlag(void *s_ptr, BOOLEAN hidden)
Sets the hidden status of the given service, which means the service would not be presented to the us...
Definition: ap_dbacc.c:9628
Application database control.
U32DHMS STB_GCNowDHMSGmt(void)
Reads the current GMT date code and time.
Definition: stbgc.c:2264
U16BIT ADB_GetNumDeletedServices(E_STB_DP_SIGNAL_TYPE tuner_type)
Returns the number of services marked as deleted with the given tuner type.
Definition: ap_dbacc.c:3286
BOOLEAN ADB_GetSatelliteDirection(void *sat_ptr)
Returns the position direction of the given satellite.
Definition: ap_dbacc.c:1052
U16BIT DBDEF_GetDeletedServiceList(E_STB_DP_SIGNAL_TYPE tuner_type, void ***slist_ptr)
Definition: ap_dbdef.c:6772
Header file - macros and function prototypes for public use.
BOOLEAN DBDEF_IsActiveProfile(ADB_NETWORK_REC *profile)
Is the given profile the currently active profile?
Definition: ap_dbdef.c:10122
void ACTL_TuneOff(U8BIT path)
Stops tuning on the given path.
Definition: ap_cntrl.c:2079
U8BIT * ACTL_GetRfNameFromFreq(E_STB_DP_SIGNAL_TYPE tuner_type, U32BIT freq_hz)
Returns the rf name appropriate to the frequency specified.
Definition: ap_cntrl.c:1308
void ADB_SortServiceListAlphabetically(void **slist, U16BIT num_entries, BOOLEAN short_name)
Sorts the given list of services into alphabetical order. Case is significant.
Definition: ap_dbacc.c:3632
Header file for NVM data handling functions.
void ADB_ReleaseEventSIDescriptorData(U8BIT *desc_data, U16BIT desc_len)
Frees the data returned by ADB_GetEventSIDescriptorData.
Definition: ap_dbacc.c:8153
U8BIT ADB_GetEventStartHour(void *event_ptr)
Returns the hour (0-23) value for the start of the given event.
Definition: ap_dbacc.c:8483
void * ADB_GetTransportFromIds(U16BIT net_id, U16BIT onet_id, U16BIT tran_id)
Finds the transport with the given ids.
Definition: ap_dbacc.c:2968
void ADB_SetReqdSubtitleStreamSettings(void *s_ptr, BOOLEAN valid, U32BIT lang_code, ADB_SUBTITLE_TYPE subtitle_type)
Explicitly sets or clears the stream that will be used for subtitles on the given service...
Definition: ap_dbacc.c:9903
void ADB_DeleteAllServiceEvents(BOOLEAN delete_now_next)
Deletes all events and event related data for all services.
Definition: ap_dbacc.c:7994
BOOLEAN ADB_GetEventHDLinkageInfo(void *event_ptr, BOOLEAN verify_event, BOOLEAN only_simulcast, void **hd_serv_ptr, void **hd_event_ptr)
Returns whether there&#39;s an HD event linked to the SD event and returns the info for it...
Definition: ap_dbacc.c:9097
ADB_TRANSPORT_REC * DBDEF_FindTerrestrialTransportRec(U32BIT freq_hz, U8BIT plp_id)
Find the terrestrial transport record in the database matching the given params.
Definition: ap_dbdef.c:4952
BOOLEAN DBDEF_SetLNBCSwitch(ADB_LNB_REC *lnb, E_STB_DP_DISEQC_CSWITCH cswitch)
Sets the LNB committed switch setting.
Definition: ap_dbdef.c:4210
void ADB_SetServiceLcn(void *s_ptr, U16BIT lcn)
Sets the assigned logical channel number of the given service. This will override any LCN assigned wh...
Definition: ap_dbacc.c:9741
BOOLEAN ADB_AddFavouriteList(U8BIT *name, U32BIT user_data, S16BIT index, U8BIT *list_id)
Creates a new favourite list and adds it to the existing lists, if any.
Definition: ap_dbacc.c:10755
void DBDEF_SetCridProgrammeName(ADB_CRID_REC *c_ptr, U8BIT *prog_name)
Sets the programme name field of the given CRID record.
Definition: ap_dbdef.c:8881
BOOLEAN ADB_GetServiceScheduleState(void *s_ptr)
Returns whether the EIT schedule events are being held in memory for the service. ...
Definition: ap_dbacc.c:5048
U8BIT ADB_GetStreamNumTags(void *stream_ptr)
Returns the number of tag values defined for the given stream.
Definition: ap_dbacc.c:7104
void * ADB_AddCridRecord(U8BIT *crid, BOOLEAN series, BOOLEAN recommended)
Adds a CRID record to the database; use ADB_SaveCridRecord to store it. If a CRID record with the giv...
Definition: ap_dbacc.c:10045
void DBDEF_SetTunedService(U8BIT path, ADB_SERVICE_REC *s_ptr)
Sets the currently tuned service.
Definition: ap_dbdef.c:8066
void STB_SIReleaseTargetRegionList(SI_TARGET_REGION_DESC *desc_list)
Frees the memory used by the descriptor list specified.
Definition: stbsitab.c:12669
void ADB_GetLockedServiceList(void ***slist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all services that are marked as locked for parental control purposes...
Definition: ap_dbacc.c:3503
U8BIT * ADB_GetAuthorityFromCrid(U8BIT *crid)
Returns a copy of the authority part of the CRID string The returned string should be freed using STB...
Definition: ap_dbacc.c:9494
void * STB_AppGetMemory(U32BIT bytes)
Attempts to allocate memory from the application heap.
Definition: stbheap.c:651
void * ADB_GetEarlierEvent(void *serv_ptr, U16BIT date, U8BIT hour, U8BIT min)
Returns a copy of the event preceeding the given date/time on the given service.
Definition: ap_dbacc.c:8244
U8BIT ADB_GetEventComponentList(void *event_ptr, ADB_EVENT_COMPONENT_INFO **component_list)
Retrieves a list of components associated with the specified event, as described by component descrip...
Definition: ap_dbacc.c:9461
BOOLEAN ADB_GetCridDoNotDelete(void *c_ptr)
Returns the value of the do not delete flag for the given CRID record.
Definition: ap_dbacc.c:10358
ADB_SERVICE_REC * DBDEF_FindServiceRecByIds(ADB_SERVICE_REC *servp, U32BIT net_id, U32BIT onet_id, U32BIT tran_id, U32BIT serv_id)
Search for a service with the given IDs.
Definition: ap_dbdef.c:6150
void ADB_SetServiceLockedFlag(void *s_ptr, BOOLEAN locked)
Locks or unlocks the given service.
Definition: ap_dbacc.c:5862
void ADB_GetReqdSubtitleStreamSettings(void *s_ptr, BOOLEAN *valid, U32BIT *lang_code, ADB_SUBTITLE_TYPE *subtitle_type)
Returns the settings defined by ADB_SetReqdSubtitleStreamSettings that will be used for subtitles on ...
Definition: ap_dbacc.c:9927
E_STB_DP_VIDEO_CODEC ADB_GetVideoCodecFromStream(ADB_STREAM_TYPE video_stream_type)
Derive video codec from stream.
Definition: ap_dbacc.c:12108
E_STB_DP_SIGNAL_TYPE ADB_GetServiceSignalType(void *s_ptr, BOOLEAN *is_sig2)
Returns the signal type for transport of given service. It also indicates the mode - i...
Definition: ap_dbacc.c:3713
E_STB_TUNE_TCODERATE ADB_GetTransportLpCodeRate(void *t_ptr)
Returns the LP coderate of the given DVB-T/T2 transport.
Definition: ap_dbacc.c:2586
void DBA_SaveRecord(void *record)
Forces a record to be saved to non-volatile storage. Depending on the implementation, this function may not do anything if the data is updated to non-volatile storage as any records and/or fields are created or updated.
Definition: dba_nvm.c:1157
U8BIT * DBDEF_GetEventGuidance(ADB_EVENT_REC *e_ptr, ADB_SERVICE_REC *s_ptr, U8BIT *type, U8BIT *mode)
Returns the guidance text for an event, either from the event itself or the event&#39;s service...
Definition: ap_dbdef.c:2732
void ADB_GetTransportAnalogTuningParams(void *t_ptr, U32BIT *freq_hz, S8BIT *offset, E_STB_DP_ANALOG_VIDEO_TYPE *vtype)
Returns the settings to tune to the given terrestrial analog transport.
Definition: ap_dbacc.c:2824
void DBA_EraseBackupDatabase(void)
Erases the backup copy of the database. If data was stored in non-volatile storage then this should b...
Definition: dba_nvm.c:822
void DBDEF_SetAudioLang(U8BIT *lang_ids)
sets current audio lang
Definition: ap_dbdef.c:8187
U8BIT * ADB_GetEventExtendedDescription(void *event_ptr)
Returns the extended event description text of the event as a UTF-8 string. The returned string shoul...
Definition: ap_dbacc.c:8841
void ADB_ReleaseEventItemizedInfo(ADB_EVENT_ITEMIZED_INFO *event_itemized_info, U16BIT num_of_items)
Frees the memory used by event itemized data.
Definition: ap_dbacc.c:8907
Structure representing the component information as found in the EIT component_descriptor.
Definition: ap_dbacc.h:238
void DBDEF_PopProfile(void)
Restores a previously pushed profile.
Definition: ap_dbdef.c:10253
U16BIT ADB_GetSubtitleStreamCompositionPage(void *stream_ptr)
Returns the composition page value of the given subtitle stream.
Definition: ap_dbacc.c:7379
U16BIT ADB_GetNetworkTertiaryTargetRegions(U32BIT country_code, U8BIT primary_region, U8BIT secondary_region, U16BIT **code_array, U8BIT ***name_array)
Returns an array of tertiary region codes and names for the given country, primary region and seconda...
Definition: ap_dbacc.c:1573
ADB_TRANSPORT_REC * DBDEF_AddSatTransportRec(U32BIT freq_hz, U16BIT symbol_rate, E_STB_DP_POLARITY polarity, BOOLEAN dvb_s2, E_STB_DP_MODULATION modulation, ADB_NETWORK_REC *network)
Adds a satellite transport record with the given frequency, symbol rate and polarity.
Definition: ap_dbdef.c:5102
void ADB_ReleaseDatabaseSearchData(void)
Frees all data that&#39;s only required for service search. This should be called after the search is com...
Definition: ap_dbacc.c:409
U16BIT ADB_GetTransportTid(void *t_ptr)
Returns the transport id of the given transport.
Definition: ap_dbacc.c:2325
E_STB_DP_AUDIO_MODE ADB_GetRequiredAudioMode(void *s_ptr)
Returns the mode to be used for audio for the given service based on language settings, output format, etc.
Definition: ap_dbacc.c:5355
void ADB_GetTransportServiceList(void *t_ptr, void ***slist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all services in the database on the given transport.
Definition: ap_dbacc.c:3332
void ADB_GetTransportListForTunerType(E_STB_DP_SIGNAL_TYPE tuner_type, void ***tlist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all transport records in the database for the given type of tuner...
Definition: ap_dbacc.c:1711
ADB_FAVLIST_REC * DBDEF_AddFavouriteList(U8BIT list_id, U8BIT *name, U32BIT user_data, S16BIT index)
Creates a new favourite list and adds it to the list of favourite lists. Creation of the new list wil...
Definition: ap_dbdef.c:9061
ADB_CRID_REC * DBDEF_GetNextCridRecord(ADB_CRID_REC *c_ptr)
Returns the next CRID record after the one specified. If the record specified is NULL then the first ...
Definition: ap_dbdef.c:8982
U8BIT * STB_ConvertStringToUTF8(U8BIT *string, U16BIT *nchar, BOOLEAN strip_DVB_cntrl_char, U32BIT lang_code)
Converts the given DVB coded string into a UTF-8 unicode string. The returned string will be preceded...
Definition: stbuni.c:1508
U8BIT ADB_GetEventDurationSecs(void *event_ptr)
Returns the seconds value (0-59) for the duration of the given event.
Definition: ap_dbacc.c:8565
U32BIT ADB_GetTtextStreamLangCode(void *stream_ptr)
Returns the 3 char language code of the given teletext stream.
Definition: ap_dbacc.c:7279
U16BIT ADB_GetServiceLcn(void *s_ptr)
Returns the logical channel number assigned to the given service.
Definition: ap_dbacc.c:4940
void DBDEF_ReleaseString(ADB_STRING *string)
Releases an ADB_STRING.
Definition: ap_dbdef.c:3983
BOOLEAN ADB_GetServiceHasCaDesc(void *s_ptr)
Used to query whether the given service has a CA descriptor.
Definition: ap_dbacc.c:5702
void ADB_PrepareDatabaseForSearch(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite, BOOLEAN retune, BOOLEAN manual_search)
Sets up the database for a search.
Definition: ap_dbacc.c:188
BOOLEAN DBDEF_SetLNBUnicable(ADB_LNB_REC *lnb, U32BIT inter_freq, U8BIT chan)
Sets the LNB Unicable settings.
Definition: ap_dbdef.c:4311
ADB_EVENT_ITEMIZED_INFO * DBDEF_GetEventItemizedDescription(ADB_EVENT_REC *e_ptr, U16BIT *num_items_ptr)
Returns the items of extended event descriptor as item descriptor and item itself.
Definition: ap_dbdef.c:2503
void DBDEF_ReleaseProfileList(void **profile_list, U16BIT num_profiles)
Frees a profile list returned by DBDEF_GetProfileList.
Definition: ap_dbdef.c:10104
void ADB_DeleteAssociatedLNBBands(void *lnb_ptr)
Deletes LNB bands associated with a given LNB.
Definition: ap_dbacc.c:862
U8BIT * ADB_GetEventContentData(void *event_ptr, U8BIT *p_len)
Returns the level 1 and 2 values for all content identifiers for the given event. ...
Definition: ap_dbacc.c:8675
ADB_TRANSPORT_REC * DBDEF_AddTerrestrialTransportRec(U32BIT freq_hz, U8BIT plp_id, ADB_NETWORK_REC *network)
Adds a terrestrial transport record with the given frequency and PLP id.
Definition: ap_dbdef.c:4874
U16BIT DBDEF_GetNumFavouriteLists(void)
Returns the number of favourite lists.
Definition: ap_dbdef.c:9041
U32BIT ADB_GetTransportFreqHz(void *t_ptr)
Returns the frequency, in Hz for DVB-T/T2 and DVB-C, and MHz for DVB-S/S2, of the given transport...
Definition: ap_dbacc.c:2433
U16BIT ADB_GetCridService(void *c_ptr)
Returns the service ID held in the given CRID record.
Definition: ap_dbacc.c:10448
BOOLEAN DBDEF_SetLNBRepeats(ADB_LNB_REC *lnb, U8BIT repeats)
Sets the LNB message repeat setting in the range 0 to 3.
Definition: ap_dbdef.c:4285
void * ADB_GetServiceTransportPtr(void *s_ptr)
Returns a pointer to the service&#39;s parent transport record.
Definition: ap_dbacc.c:5999
void ADB_Initialise(void)
Initialises database access.
Definition: ap_dbacc.c:167
void ADB_SetTunedService(U8BIT path, void *s_ptr)
Sets the tuned service for the given path, together with the associated tuned transport and network...
Definition: ap_dbacc.c:6023
U32BIT * ADB_GetServiceListLockedFlag(void **slist, U16BIT num_entries)
Allocates and returns an array of the &#39;locked&#39; flags for each of the services in the given service li...
Definition: ap_dbacc.c:4503
U16BIT ADB_GetServiceAudioPid(void *s_ptr)
Returns the audio PID for the given service. This will be the one chosen based on the settings for la...
Definition: ap_dbacc.c:5189
void STB_SIReleaseDelSysDesc(SI_DELIVERY_SYS_DESC *desc, SI_DELIVERY_SYS_DESC_TYPE type)
Frees the memory used by the descriptor specified.
Definition: stbsitab.c:11989
U8BIT * ADB_GetEventName(void *event_ptr)
Returns the name of the event as a UTF-8 string in the currently selected language. The returned string should be freed using STB_ReleaseUnicodeString.
Definition: ap_dbacc.c:8740
Application timer functions and defines.
void ADB_DeleteAllServicesFromFavouriteList(U8BIT list_id)
Removes all services from the favourite list defined by list_id.
Definition: ap_dbacc.c:11172
U8BIT * ADB_GetCridString(void *c_ptr)
Returns the CRID string from the given CRID record. The returned value should not be freed...
Definition: ap_dbacc.c:10388
ADB_SERVICE_REC * DBDEF_GetTunedService(U8BIT path)
Returns the currently tuned service on the given path.
Definition: ap_dbdef.c:8084
U16BIT ADB_GetNumFavouriteLists(void)
Returns the number of favourite lists.
Definition: ap_dbacc.c:10731
U16BIT ADB_ServiceGetSubtitlePid(void *serv_ptr, ADB_SUBT_INFO *subt_info)
Determines subtitle PID and whether it is DVB or teletext, for the given service. ...
Definition: ap_dbacc.c:6745
U16BIT ADB_GetSubtitleStreamAncillaryPage(void *stream_ptr)
Returns the ancillary page value of the given subtitle stream.
Definition: ap_dbacc.c:7399
BOOLEAN ADB_GetStreamInUse(void *stream_ptr)
Returns whether the given stream is marked as being &#39;in use&#39;, which means it will be the stream being...
Definition: ap_dbacc.c:7178
U8BIT ADB_GetServiceContentProtectionLevel(void *s_ptr)
Returns the content protection level value for the service that will have been set by the Nordig cont...
Definition: ap_dbacc.c:5751
void ADB_SetAudioLang(U32BIT country_code, U8BIT db_lang_id)
Sets the primary audio language to be used.
Definition: ap_dbacc.c:7493
void ADB_SetServiceNowNextState(void *s_ptr, BOOLEAN state)
Sets whether the now/next EIT events for this service are held in memory. All services save now/next ...
Definition: ap_dbacc.c:5074
void * ADB_AddLNB(ADB_LNB_SETTINGS *settings)
Creates a new LNB in the database with the given settings.
Definition: ap_dbacc.c:629
U8BIT * ADB_GetNetworkName(void *n_ptr)
Returns the name, in UTF-8 format, of the given network. The returned name should be freed using STB_...
Definition: ap_dbacc.c:1234
ADB_LNB_REC * DBDEF_GetNextLNBRec(ADB_LNB_REC *lnb_ptr)
Returns the next LNB record after the one given. If the argument is NULL then the first record is ret...
Definition: ap_dbdef.c:4338
void ADB_SetCridProgrammeName(void *c_ptr, U8BIT *prog_name)
Sets the programme name field of the given CRID record.
Definition: ap_dbacc.c:10172
BOOLEAN DBDEF_SetLNB12V(ADB_LNB_REC *lnb, BOOLEAN is_12v)
Sets the LNB 12V setting.
Definition: ap_dbdef.c:4110
void ADB_DeleteServiceRec(void *s_ptr)
Deletes the given service from the database.
Definition: ap_dbacc.c:6686
void DBDEF_DeleteServiceRec(ADB_SERVICE_REC *s_ptr)
Deletes specified service record.
Definition: ap_dbdef.c:1754
void DBDEF_DeleteImageIcons(ADB_IMAGE_ICON *icon_list)
Frees given list of image icons and any associated memory.
Definition: ap_dbdef.c:3849
ADB_FAVLIST_REC * DBDEF_FindFavouriteList(U8BIT list_id)
Return the favourite list with the given list id.
Definition: ap_dbdef.c:9237
BOOLEAN ADB_AreLcnsDuplicated(E_STB_DP_SIGNAL_TYPE tuner_type)
Checks through all services after a service search and determines whether any of them require the sam...
Definition: ap_dbacc.c:368
U8BIT * ADB_GetFavouriteListName(U8BIT list_id)
Returns the name of the given favourite list, as a Unicode string.
Definition: ap_dbacc.c:10865
ADB_LNB_REC * DBDEF_AddLNB(E_STB_DP_LNB_TYPE type, ADB_STRING *name)
Add an LNB record to the database.
Definition: ap_dbdef.c:4012
void DBDEF_TidyDatabaseAfterSearch(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite, BOOLEAN search_completed, BOOLEAN manual)
Calls any country and tuner type specific function to tidy up the database following a search...
Definition: ap_dbdef.c:8256
ADB_EVENT_ITEMIZED_INFO * ADB_GetEventItemizedDescription(void *event_ptr, U16BIT *num_items_ptr)
Returns the items of extended event descriptor as item descriptor and item itself.
Definition: ap_dbacc.c:8874
void * ADB_AddServiceUsingDsd(U8BIT *data, U16BIT service_id)
Add service record defined by the given delivery system descriptor. If the DSD defines a transport th...
Definition: ap_dbacc.c:3062
void DBDEF_SetAnalogServiceName(ADB_SERVICE_REC *s_ptr, U8BIT *new_name, U8BIT new_len)
Updates analog service names - ASSUMES NORMAL ASCII CODED.
Definition: ap_dbdef.c:6903
void ADB_SetServiceDeletedFlag(void *s_ptr, BOOLEAN deleted)
Sets the &#39;deleted&#39; flag for the given service as a deleted service. If it&#39;s marked as deleted then it...
Definition: ap_dbacc.c:9724
ADB_FAVSERV_REC * DBDEF_GetPrevServiceFromFavouriteList(ADB_FAVLIST_REC *fav_list, ADB_FAVSERV_REC *fav_serv)
Returns the previous favourite list service record.
Definition: ap_dbdef.c:9554
U8BIT * DBDEF_GetEventDescription(ADB_EVENT_REC *e_ptr)
Returns the short event description text of the event as a UTF-8 string. The returned string should b...
Definition: ap_dbdef.c:2175
U16BIT ADB_GetServiceOrigLcn(void *s_ptr)
Returns the logical channel number originally requested by the given service.
Definition: ap_dbacc.c:5141
U8BIT * ADB_GetServiceProviderName(void *s_ptr)
Returns the provider name, as a UTF-8 string, using the default language, of the given service...
Definition: ap_dbacc.c:5519
U16BIT ADB_GetServiceVideoPid(void *s_ptr)
Returns the video PID for the given service.
Definition: ap_dbacc.c:5448
void * ADB_FindServiceByLcn(U32BIT list_type, U16BIT lcn, BOOLEAN show_unselectable)
Returns the service matching the given LCN and list type.
Definition: ap_dbacc.c:3934
BOOLEAN DBDEF_SetLNBDiSEqCTone(ADB_LNB_REC *lnb, E_STB_DP_DISEQC_TONE diseqc_tone)
Sets the LNB DiSEqC tone setting.
Definition: ap_dbdef.c:4185
void ADB_SetTunedTransport(U8BIT path, void *t_ptr)
Sets the given transport as the one tuned to on the given decode path. The transport&#39;s network is als...
Definition: ap_dbacc.c:2988
BOOLEAN ADB_GetEventFreeToAir(void *event_ptr)
Returns whether the event is signalled with none of its streams being CA scrambled.
Definition: ap_dbacc.c:9023
BOOLEAN DBDEF_GetEventAudioDescriptionFlag(ADB_EVENT_REC *e_ptr)
Returns whether audio description is signalled as being available for the given event.
Definition: ap_dbdef.c:2984
void ADB_ReleaseEventData(void *event_ptr)
Frees any memory allocated for the given event and the event itself.
Definition: ap_dbacc.c:7907
U8BIT ** ADB_GetNetworkListNames(void **nlist, U16BIT num_entries, BOOLEAN short_names)
Returns a list of names, in UTF-8 format, corresponding to the given network list. The returned list should be freed using ADB_ReleaseNameList.
Definition: ap_dbacc.c:1161
ADB_STRING * DBDEF_GetServiceProviderName(ADB_SERVICE_REC *s_ptr)
Returns a pointer to the service provider name.
Definition: ap_dbdef.c:6682
ADB_STRING * DBDEF_MakeString(U32BIT lang_code, U8BIT *str_ptr, U16BIT nbytes)
Creates an ADB_STRING, copying the given data into it. If the string passed in is NULL or the number ...
Definition: ap_dbdef.c:3890
U8BIT ADB_GetTtextStreamMagazine(void *stream_ptr)
Returns the magazine value of the given teletext stream.
Definition: ap_dbacc.c:7319
BOOLEAN ADB_GetServiceDoNotScramble(void *s_ptr)
Returns the do_not_scramble flag for the service which is based on the presence of an FTA descriptor...
Definition: ap_dbacc.c:5727
E_STB_DP_TMODE ADB_GetTransportTerrMode(void *t_ptr)
Returns the terrestrial mode of the given DVB-T/T2 transport.
Definition: ap_dbacc.c:2473
U16BIT ADB_FindNearestLcnInServiceList(U16BIT lcn, void **slist_ptr, U16BIT num_entries)
Returns the index in the given list of services of the service matching the given, or preceding, LCN.
Definition: ap_dbacc.c:4133
U16BIT DBDEF_GetNumServices(void)
Returns the total number of services.
Definition: ap_dbdef.c:5506
U32BIT STB_OSGetClockRTC(void)
Returns the current time in seconds. This is calculated by using the set UTC time and adding the diff...
ADB_EVENT_CONTENT DBDEF_GetEventGenre(ADB_EVENT_REC *e_ptr, ADB_SERVICE_REC *s_ptr)
Returns the genre of an event.
Definition: ap_dbdef.c:3440
U32DHMS ADB_GetEventDuration(void *event_ptr)
Returns a value representing the duration of the given event.
Definition: ap_dbacc.c:8513
U8BIT * ADB_GetServiceShortName(void *s_ptr, BOOLEAN use_pref_name)
Returns the short name of the given service as a UTF-8 string. The returned string should be freed us...
Definition: ap_dbacc.c:4864
U8BIT * ADB_GetEventSeriesCrid(U8BIT index, void *serv_ptr, void *event_ptr)
Returns the full series CRID of the given event The returned string should be freed using STB_AppFree...
Definition: ap_dbacc.c:9355
U8BIT STB_DPGetLivePath(void)
Returns the ID of the decode path being used for live viewing.
Definition: stbdpc.c:1271
ADB_SERVICE_REC * DBDEF_GetPrevServiceRec(ADB_SERVICE_REC *s_ptr)
Returns the service before the one given. If NULL is passed then the last service in the list is retu...
Definition: ap_dbdef.c:5566
U8BIT * ADB_GetTransportName(void *t_ptr)
Returns the name, in UTF-8 format, of the given transport. The returned name should be freed using ST...
Definition: ap_dbacc.c:2305
U16BIT ADB_FindLcnInServiceList(U16BIT lcn, void **slist_ptr, U16BIT num_entries)
Returns the index into the given list of services of the service with the given LCN.
Definition: ap_dbacc.c:4095
void ADB_SaveEventSchedule(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
Saves the event schedule for all services for the given type of tuner to the database. Note: the database has to support this operation.
Definition: ap_dbacc.c:524
void ADB_UpdateCridEitDate(void *c_ptr)
Updates the time the CRID was last seen in the EIT.
Definition: ap_dbacc.c:10226
U16BIT ADB_GetEventStartDate(void *event_ptr)
Returns the MJD date code for the start of the given event.
Definition: ap_dbacc.c:8473
ADB_TRANSPORT_REC * DBDEF_GetNextTransportRec(ADB_TRANSPORT_REC *t_ptr)
Returns the transport following the one given. If the argument is NULL then the first transport will ...
Definition: ap_dbdef.c:4842
S8BIT STB_CompareUnicodeStrings(U8BIT *string1_ptr, U8BIT *string2_ptr, BOOLEAN exact_match, BOOLEAN ignore_case)
Compares the contents of the two given unicode strings and returns the status (as per strcmp) ...
Definition: stbuni.c:910
void ADB_GetCridRecordList(void ***clist_ptr, U16BIT *num_entries_ptr, BOOLEAN inc_series_crids, BOOLEAN inc_rec_crids, BOOLEAN inc_prog_crids)
Creates an array of CRID record pointers to pass back to the caller with the number of entries in the...
Definition: ap_dbacc.c:10531
void ADB_GetEventSchedule(BOOLEAN include_old_events, void *serv_ptr, void ***elist_ptr, U16BIT *num_entries_ptr)
Allocates and returns an array containing copies of events for the given service from the service&#39;s E...
Definition: ap_dbacc.c:7634
BOOLEAN ADB_GetServiceIsHd(void *s_ptr)
Returns whether the service is signalled as an HD service.
Definition: ap_dbacc.c:5260
U16BIT DBDEF_GetNumLNBs(void)
Returns the number of LNB records in the database.
Definition: ap_dbdef.c:3999
void STB_FreeMemory(void *addr)
Releases previously allocated heap memory.
Definition: stbheap.c:336
U16BIT ADB_GetNumServices(void)
Returns the total number of services in the database.
Definition: ap_dbacc.c:3167
U8BIT * ADB_GetEventDescription(void *event_ptr)
Returns the short event description text of the event as a UTF-8 string. The returned string should b...
Definition: ap_dbacc.c:8773
ADB_LNB_BAND_REC * DBDEF_AddLNBBandRec(S_STB_DP_LNB_BAND *band_parameters, ADB_LNB_REC *associated_lnb)
Add an LNB band record to the database.
Definition: ap_dbdef.c:4506
void * ADB_GetAlternativeService(void *s_ptr, U8BIT alt_serv_type)
Searches for a replacement service of the given type for the given service.
Definition: ap_dbacc.c:6706
U16BIT ADB_GetTransportSatelliteSymbolRate(void *t_ptr)
Returns the symbol rate of the given satellite transponder.
Definition: ap_dbacc.c:2741
BOOLEAN ADB_IsProgrammeCrid(void *c_ptr)
Returns TRUE if the CRID record given represents a programme (split event)
Definition: ap_dbacc.c:10245
BOOLEAN ADB_IsSameEvent(void *event1_ptr, void *event2_ptr)
Checks whether the two events are the same. Not all fields are checked, just date, time, duration and event ID.
Definition: ap_dbacc.c:9149
void DBDEF_SaveServiceEventSchedule(ADB_SERVICE_REC *s_ptr)
Saves the event schedule of a service to the service database.
Definition: ap_dbdef.c:5994
void ADB_ServiceReleaseRCTLinks(void *serv_ptr)
Frees all RCT link info for the given service.
Definition: ap_dbacc.c:6152
BOOLEAN DBDEF_ServiceForTunerType(ADB_SERVICE_REC *s_ptr, E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
Checks whether the given service is a terrestrial, cable or satellite service, and optionally check w...
Definition: ap_dbdef.c:9775
BOOLEAN DBDEF_AddAnalogService(void)
Adds an analogue service, transport and, if necessary, network to the database based on the current t...
Definition: ap_dbdef.c:6825
BOOLEAN STB_SIParseDelSysDesc(U8BIT *data, SI_DELIVERY_SYS_DESC_TYPE *type, SI_DELIVERY_SYS_DESC **desc)
Parses and allocates a system delivery descriptor which should be freed by calling STB_SIReleaseDelSy...
Definition: stbsitab.c:11071
U8BIT * DBDEF_GetEventContentData(ADB_EVENT_REC *e_ptr, U8BIT *p_len)
Returns the level 1 and 2 values for all content identifiers for the given event. ...
Definition: ap_dbdef.c:3406
void STB_ReleaseUnicodeString(U8BIT *string)
Releases the specified unicode string, freeing associated heap resources.
Definition: stbuni.c:1955
U8BIT * DBDEF_GetServiceDefaultAuthority(ADB_SERVICE_REC *s_ptr)
Returns a copy of the default authority CRID string for the given service. This string will be return...
Definition: ap_dbdef.c:3700
BOOLEAN ADB_IsRecommendationCrid(void *c_ptr)
Returns TRUE if the CRID record given represents a recommendation.
Definition: ap_dbacc.c:10309
BOOLEAN ADB_GetLNBSettings(void *lnb_ptr, ADB_LNB_SETTINGS *settings)
Returns the current settings for the given LNB.
Definition: ap_dbacc.c:693
U8BIT * ADB_GetEventFullProgrammeCrid(void *serv_ptr, void *event_ptr)
Returns the full programme CRID of the given event (including IMI). The returned string should be fre...
Definition: ap_dbacc.c:9193
void DBDEF_ReleaseAccess(void)
Releases access to the app&#39;s database.
Definition: ap_dbdef.c:245
U8BIT * ADB_GetNetworkNameByLang(void *n_ptr, U8BIT lang)
Returns the name in the language defined by lang, in UTF-8 format, of the given network. The returned name should be freed using STB_ReleaseUnicodeString.
Definition: ap_dbacc.c:1256
U32BIT * ADB_GetNetworkListIds(void **nlist, U16BIT num_entries)
Allocates and returns an array of network ids for the given networks The returned array should be fre...
Definition: ap_dbacc.c:1198
void ADB_ServiceAddRCTLink(void *serv_ptr, void *link_ptr)
Adds the given RCT link info to the end of the list of existing RCT links already defined for the giv...
Definition: ap_dbacc.c:6110
U16BIT DBDEF_GetNumDeletedServices(E_STB_DP_SIGNAL_TYPE tuner_type)
Returns the number of services that are marked as deleted for the given tuner type.
Definition: ap_dbdef.c:6737
U32BIT * ADB_GetTransportListFreqs(void **tlist, U16BIT num_entries)
Allocates and returns an array of tuning frequencies for each transport in the given list...
Definition: ap_dbacc.c:2010
BOOLEAN ADB_GetServiceNewFlag(void *s_ptr)
Returns the status of the &#39;new&#39; flag of the given service. This flag indicates whether a service has ...
Definition: ap_dbacc.c:5782
BOOLEAN ACFG_IsNordigCountry(void)
Returns whether the current country requires Nordig compliance for SI.
Definition: ap_cfg.c:1656
void DBDEF_UpdateCridEitDate(ADB_CRID_REC *c_ptr)
Updates the stored EIT date of this CRID with the current GMT date.
Definition: ap_dbdef.c:8920
void ADB_ReleaseEventList(void **elist, U16BIT num_entries)
Frees all teh events in the given list and all associated memory for those events.
Definition: ap_dbacc.c:7924
U8BIT * ACFG_GetDbLangId(U32BIT country_code, U8BIT lang_entry)
Returns an array of language ids for a given country and index into the language array. A language id is one of the ACFG_DB_LANG_XXXX values above and there might be more than one for a given language. For example german language has two ids associated to it: ACFG_DB_LANG_GERMAN1 and ACFG_DB_LANG_GERMAN2 because german language can have two different codes, &#39;deu&#39; and &#39;ger&#39;. See also functions ACFG_ConvertLangIdToCode and ACFG_ConvertLangCodeToId. The returned pointer is an internal array and must not be freed.
Definition: ap_cfg.c:900
Debug functions header file.
Header file - Function prototypes for linked lists.
Header file - macros and function prototypes for public use.
void ADB_ReleaseNameList(U8BIT **name_list, U16BIT num_names)
Frees the memory used by any of the name lists (e.g. networks, services, etc)
Definition: ap_dbacc.c:586
void ADB_DeleteCridRecord(void *c_ptr)
Deletes the given CRID record from the database.
Definition: ap_dbacc.c:10507
void DBDEF_SetTextLang(U8BIT *lang_ids)
sets current text lang
Definition: ap_dbdef.c:8115
BOOLEAN ADB_GetServiceLockedFlag(void *s_ptr)
Returns the status of the &#39;locked&#39; flag of the given service, which is used by the parental control...
Definition: ap_dbacc.c:5805
Header file - macros and function prototypes for public use.
void DBDEF_SetCridDoNotDelete(ADB_CRID_REC *c_ptr, BOOLEAN do_not_delete)
Sets the do not delete flag in the crid record.
Definition: ap_dbdef.c:8903
ADB_TRANSPORT_REC * DBDEF_AddCableTransportRec(U32BIT freq_hz, U32BIT symbol_rate, ADB_NETWORK_REC *network)
Adds a cable transport record with the given frequency and symbol rate.
Definition: ap_dbdef.c:4982
U8BIT ADB_GetEventNumSeriesCrids(void *event_ptr)
Returns the number of series CRIDs for the given event.
Definition: ap_dbacc.c:9380
U16BIT ADB_GetServiceTextPid(void *s_ptr)
Returns the PID being used for DVB subtitles and/or teletext for the given service. This will be the one chosen based on the settings for language, etc, or the one explicitly set (e.g. due to user selection).
Definition: ap_dbacc.c:5237
void ADB_ResetDatabase(void)
Clears the service database and resets everything to default values.
Definition: ap_dbacc.c:475
U8BIT * ADB_GetServiceFullName(void *s_ptr, BOOLEAN use_pref_name)
Returns the full name of the given service as a UTF-8 string. The returned string should be freed usi...
Definition: ap_dbacc.c:4833
Database access defines, structures and public functions.
void * ADB_FindServiceByIds(U16BIT onet_id, U16BIT tid, U16BIT sid)
Returns a pointer to the service matching the given IDs.
Definition: ap_dbacc.c:4071
U8BIT ADB_GetNetworkTargetCountries(U32BIT **code_array)
Returns a combined array of country codes for all discovered networks.
Definition: ap_dbacc.c:1296
U8BIT ADB_GetServiceRunningStatus(void *s_ptr)
Returns the running status of the given service as reported by the SDT.
Definition: ap_dbacc.c:5627
U8BIT ADB_GetServiceNumRCTLinks(void *serv_ptr)
Returns the number of RCT links for the given service.
Definition: ap_dbacc.c:6179
void ADB_SetReqdAudioStreamSettings(void *s_ptr, BOOLEAN valid, U32BIT lang_code, ADB_AUDIO_TYPE audio_type, ADB_STREAM_TYPE stream_type)
Explicitly sets or clears the stream that will be used for audio on the given service. If &#39;valid&#39; is TRUE then the stream is set according to the given language and types, but if FALSE then the audio stream selected for the service will be based on the default settings.
Definition: ap_dbacc.c:9823
ADB_TRANSPORT_REC * DBDEF_FindCableTransportRec(U32BIT freq_hz, U32BIT symbol_rate)
Find the cable transport record in the database matching the given params.
Definition: ap_dbdef.c:5040
ADB_SERVICE_REC * DBDEF_GetNextServiceRec(ADB_SERVICE_REC *s_ptr)
Returns the service after the one given. If NULL is passed then the first service in the list is retu...
Definition: ap_dbdef.c:5535
void ADB_SetSecondaryTextLang(U32BIT country_code, U8BIT lang_id)
Sets the secondary subtitle and teletext language to be used. This will be used if the primary langua...
Definition: ap_dbacc.c:7561
ADB_STREAM_TYPE ADB_GetStreamType(void *stream_ptr)
Returns the type of the given stream.
Definition: ap_dbacc.c:7083
U16BIT ADB_GetNetworkPrimaryTargetRegions(U32BIT country_code, U8BIT **code_array, U8BIT ***name_array)
Returns an array of primary region codes and names for the given country.
Definition: ap_dbacc.c:1372
U32BIT * ADB_GetServiceListScrambledFlag(void **slist, U16BIT num_entries)
Allocates and returns an array of the scrambled flags for each of the services in the given service l...
Definition: ap_dbacc.c:4542
BOOLEAN ADB_GetTransportSearchFlag(void *t_ptr)
Returns whether a transport has been used during a service scan operation.
Definition: ap_dbacc.c:2210
ADB_FAVLIST_REC * DBDEF_GetNextFavouriteList(ADB_FAVLIST_REC *fav_list)
Returns the favourite list following the given item.
Definition: ap_dbdef.c:9212
Application configuration data.
U32BIT * ADB_GetServiceListTransportStrengths(void **slist, U16BIT num_entries)
Allocates and returns an array of the signal strengths of the transports containing the given list of...
Definition: ap_dbacc.c:4787
void * ADB_GetEventService(void *event_ptr)
Returns the service pointer of event.
Definition: ap_dbacc.c:12132
void ADB_GetServiceIds(void *s_ptr, U16BIT *onet_id, U16BIT *trans_id, U16BIT *serv_id)
Returns the original network id, transport id and service id for the given service.
Definition: ap_dbacc.c:4982
void DBDEF_SetFavouriteListUserData(ADB_FAVLIST_REC *fav_list, U32BIT user_data)
Saves the given user data with a favourite list.
Definition: ap_dbdef.c:9263
U16BIT DBDEF_GetNumNetworks(void)
Returns the number of networks in ther service database.
Definition: ap_dbdef.c:4631
void ADB_GetTransportCableTuningParams(void *t_ptr, U32BIT *freq_hz, E_STB_DP_CMODE *mode, U16BIT *symrate)
Returns the parameters needed to tune a cable tuner to a transport.
Definition: ap_dbacc.c:2856
BOOLEAN ADB_ServiceAddImageIcon(void *serv_ptr, void *icon_ptr)
Adds the given image icon to the end of the service&#39;s icon list. The icon id is checked and if it mat...
Definition: ap_dbacc.c:6468
BOOLEAN ADB_IsSplitProgrammeCrid(U8BIT *crid)
Returns TRUE if the given CRID represents a split event (i.e. it contains an Instance Metadata Identi...
Definition: ap_dbacc.c:9219
ADB_STRING * DBDEF_GetServiceName(ADB_SERVICE_REC *s_ptr, BOOLEAN short_name, BOOLEAN pref_name)
Returns a pointer to the service name, taking into account perferred names and short names...
Definition: ap_dbdef.c:6586
void * ADB_FindEventFromTime(U32DHMS time, void *serv_ptr)
Finds the event scheduled to be broadcast at the specified time on the specified service.
Definition: ap_dbacc.c:8332
Header file - Function prototypes for Event Reporting.
void DBDEF_SetServiceFavGroups(ADB_SERVICE_REC *s_ptr, U8BIT groups)
Sets the favourite groups for a service.
Definition: ap_dbdef.c:7001
U8BIT * ADB_GetEventRecommendationCrid(U8BIT index, void *serv_ptr, void *event_ptr)
Returns the full recommendation CRID of the given event The returned string should be freed using STB...
Definition: ap_dbacc.c:9433
BOOLEAN DBA_CanRestoreDatabase(void)
Checks whether the working database can be restored from a backup copy.
Definition: dba_nvm.c:766
ADB_SERVICE_REC * DBDEF_AddServiceRec(U16BIT serv_id, ADB_TRANSPORT_REC *t_ptr)
Adds a new service record to the service database with the given service ID and parent transport...
Definition: ap_dbdef.c:5598
Header for STB unicode string handling routines.
void ADB_GetReqdTeletextStreamSettings(void *s_ptr, BOOLEAN *valid, U32BIT *lang_code, ADB_TELETEXT_TYPE *ttext_type)
Returns the settings defined by ADB_SetReqdTeletextStreamSettings that will be used for teletext on t...
Definition: ap_dbacc.c:9977
E_STB_DP_AUDIO_CODEC ADB_GetAudioCodecFromStream(ADB_STREAM_TYPE audio_stream_type)
Derive audio codec from stream.
Definition: ap_dbacc.c:12078
void ADB_GetServiceListLockedSubset(void **slist, U16BIT num_entries, void ***locked_slist_ptr, U16BIT *locked_num_entries_ptr)
Creates a subset of locked services from the supplied service list. Memory is allocated as TempMemory...
Definition: ap_dbacc.c:3578
U32BIT ADB_GetAudioStreamLangCode(void *stream_ptr)
Returns the language code associated with the given audio stream.
Definition: ap_dbacc.c:7218
void DBDEF_SetTunedNetwork(U8BIT path, ADB_NETWORK_REC *n_ptr)
sets the currently tuned network
Definition: ap_dbdef.c:7996
E_STB_DP_AUDIO_MODE ADB_GetAudioStreamMode(void *stream_ptr)
Returns the audio mode of the given stream.
Definition: ap_dbacc.c:7258
U32DHMS ADB_GetEventEndDateTime(void *event_ptr)
Returns a value representing the date and time of the end of the given event.
Definition: ap_dbacc.c:8575
BOOLEAN ADB_GetLNBBandParameters(void *band_ptr, S_STB_DP_LNB_BAND *params)
Returns the structure describing the band and the expected LNB behaviour in it.
Definition: ap_dbacc.c:832
U8BIT ** ADB_GetServiceListNetworkNames(void **slist, U16BIT num_entries)
Allocates and returns a list of network names for all the services in the given service list...
Definition: ap_dbacc.c:4699
U16BIT ADB_GetSatelliteLongitude(void *sat_ptr)
Returns the longitudinal position of the given satellite in 1/10ths degree.
Definition: ap_dbacc.c:1021
void DBDEF_RequestAccess(void)
Requests access to the app&#39;s database.
Definition: ap_dbdef.c:235
BOOLEAN ADB_GetEventHasExtendedDescription(void *event_ptr)
Checks whether the given event has any extended event descriptors.
Definition: ap_dbacc.c:8805
U8BIT ** ADB_GetTransportListConstellationStrings(void **tlist, U16BIT num_entries)
Returns the transport constellation string array.
Definition: ap_dbacc.c:2135
BOOLEAN ADB_GetEventDoNotScramble(void *event_ptr)
Returns the do_not_scramble flag for the event, which will have been found by looking backwards in th...
Definition: ap_dbacc.c:9057
void ADB_GetStreamList(void *serv_ptr, ADB_STREAM_LIST_TYPE stream_list_type, void ***streamlist_ptr, U16BIT *num_entries_ptr)
Allocates and returns an array of the streams of the given type and for the given service...
Definition: ap_dbacc.c:6882
U8BIT * DBDEF_GetEventName(ADB_EVENT_REC *e_ptr)
Returns the name of the event as a UTF-8 string in the currently selected language. The returned string should be freed using STB_ReleaseUnicodeString.
Definition: ap_dbdef.c:2055
Definition: stbdsc.c:107
BOOLEAN STB_GCIsFutureDateTime(U16BIT code, U8BIT hour, U8BIT min, U8BIT secs)
Tests given date and time against current GMT date and time.
Definition: stbgc.c:1411
BOOLEAN DBDEF_LoadDatabase(U8BIT *db_pathname)
Loads the service database from non-volatile storage and creates the RAM version of this data that wi...
Definition: ap_dbdef.c:259
void DBDEF_DeleteFavouriteList(ADB_FAVLIST_REC *fav_list)
Deletes the given favourite list.
Definition: ap_dbdef.c:9339
U16BIT ADB_GetRequiredTtextPid(void *s_ptr, BOOLEAN for_subtitles, U8BIT *magazine, U8BIT *page)
Returns the PID to be used for teletext for the given service based on language settings.
Definition: ap_dbacc.c:5384
void ADB_SaveDatabase(void)
Saves the database to non-volatile memory.
Definition: ap_dbacc.c:502
void DBDEF_DeleteTransportRec(ADB_TRANSPORT_REC *t_ptr)
Deletes the given transport from the service database, deleting any service records that it&#39;s the par...
Definition: ap_dbdef.c:5431
ADB_STRING * DBDEF_CopyString(ADB_STRING *src_str)
Creates a copy of the given ADB_STRING.
Definition: ap_dbdef.c:3922
U8BIT ** ADB_GetTransportListNames(void **tlist, U16BIT num_entries)
Returns a list of names, in UTF-8 format, corresponding to the given transport list. The returned list should be freed using ADB_ReleaseNameList.
Definition: ap_dbacc.c:1857
BOOLEAN DBDEF_IsValidCridRecord(ADB_CRID_REC *c_ptr)
Checks whether the given crid record is in the list of valid crid records.
Definition: ap_dbdef.c:9007
BOOLEAN ADB_GetServiceLcnEditable(void *s_ptr)
Returns whether the LCN assigned to the given service can be changed.
Definition: ap_dbacc.c:9700
U8BIT ADB_GetStreamTag(void *stream_ptr, U8BIT index)
Returns the requested tag value of the given stream.
Definition: ap_dbacc.c:7128
U32BIT ACFG_GetCountry(void)
Returns the country code the DVB is configured for.
Definition: ap_cfg.c:150
ADB_FAVSERV_REC * DBDEF_GetNextServiceFromFavouriteList(ADB_FAVLIST_REC *fav_list, ADB_FAVSERV_REC *fav_serv)
Returns the next favourite list service record.
Definition: ap_dbdef.c:9529
ADB_EVENT_CONTENT ADB_GetEventContentDesc(void *event_ptr)
Returns the level 1 value of the first content identifier for the given event.
Definition: ap_dbacc.c:8639
void * ADB_GetNextSatellite(void *sat_ptr)
Returns the next satellite from the database.
Definition: ap_dbacc.c:942
BOOLEAN DBDEF_SetLNBSmatv(ADB_LNB_REC *lnb, BOOLEAN is_smatv)
Sets the LNB SMATV setting.
Definition: ap_dbdef.c:4260
U32BIT STB_GetNumBytesInString(U8BIT *string_ptr)
Determines the no of bytes of the given string.
Definition: stbuni.c:311
E_STB_DP_SIGNAL_TYPE ADB_GetTransportSignalType(void *t_ptr)
Returns the signal type for the given transport.
Definition: ap_dbacc.c:2277
U8BIT DBDEF_NumberOfCridsOfType(ADB_EVENT_REC *e_ptr, U8BIT crid_type)
Returns the number of CRIDs of the given type for the event.
Definition: ap_dbdef.c:3587
BOOLEAN DBDEF_ServiceInProfile(ADB_SERVICE_REC *s_ptr)
Checks whether the given service is valid for the current profile. There may be multiple CI+ profiles...
Definition: ap_dbdef.c:10276
void ADB_ReleaseServiceList(void **slist, U16BIT num_servs)
Frees a list of services returned from one of the functions that returns a service list...
Definition: ap_dbacc.c:3556
Application stb layer control.
void DBDEF_DeleteNetworkRec(ADB_NETWORK_REC *n_ptr)
Deletes specified network record.
Definition: ap_dbdef.c:4696
U8BIT ** ADB_GetTransportListHierarchyStrings(void **tlist, U16BIT num_entries)
Returns the transport hierarchy string array.
Definition: ap_dbacc.c:2175
U8BIT ADB_GetTransportTunedStrength(void *t_ptr)
Returns the signal strength, as a percentage, of the tuned transport.
Definition: ap_dbacc.c:2345
U16BIT ADB_GetNumLNBs(void)
Returns the number of LNBs in the database.
Definition: ap_dbacc.c:609
void DBDEF_DeleteServiceFromFavouriteList(ADB_FAVLIST_REC *fav_list, ADB_FAVSERV_REC *fav_serv)
Delete the given service from the given favourite list.
Definition: ap_dbdef.c:9639
void DBDEF_DeleteAllServicesFromFavouriteList(ADB_FAVLIST_REC *fav_list)
Delete the all services from the given favourite list.
Definition: ap_dbdef.c:9673
void * ADB_GetNextRCTLink(void *link_ptr)
Returns the RCT link following the given link.
Definition: ap_dbacc.c:6295
U8BIT ADB_GetTtextStreamType(void *stream_ptr)
Returns the type, as defined in the PMT, of the given teletext stream.
Definition: ap_dbacc.c:7299
Header file - Function prototypes for operating system.
System Wide Global Technical Data Type Definitions.
U8BIT ADB_GetFavouriteListByUserData(U32BIT user_data)
Returns the list id of the favourite list with the given user data.
Definition: ap_dbacc.c:10828
BOOLEAN DBA_SetFieldValue(void *record, U32BIT field_id, U32BIT value)
Set the value of a record&#39;s field. The function will fail if the record doesn&#39;t exist, the record doesn&#39;t include the given field, or the field is a string value.
Definition: dba_nvm.c:1175
BOOLEAN ADB_SetFavouriteListName(U8BIT list_id, U8BIT *name)
Set the name of the given favourite list.
Definition: ap_dbacc.c:10894
void DBDEF_DeleteAllRecords(void)
Deletes all records in the database.
Definition: ap_dbdef.c:1486
ADB_AUDIO_TYPE ADB_GetAudioStreamType(void *stream_ptr)
Returns the audio type of the given stream.
Definition: ap_dbacc.c:7238
U16BIT DBDEF_GetServicePmtPid(ADB_SERVICE_REC *s_ptr)
gets the PMT PID associated with the service
Definition: ap_dbdef.c:6980
ADB_SATELLITE_REC * DBDEF_GetNextSatelliteRec(ADB_SATELLITE_REC *sat_ptr)
Returns the next satellite record after the one given. If the argument is NULL then the first record ...
Definition: ap_dbdef.c:4469
ADB_SATELLITE_REC * DBDEF_AddSatelliteRec(ADB_STRING *name_str, U16BIT dish_pos, U16BIT long_pos, BOOLEAN east_west, ADB_LNB_REC *associated_lnb)
Add a satellite record to the database.
Definition: ap_dbdef.c:4378
void ADB_SetReqdAudioStreamPID(void *s_ptr, BOOLEAN valid, U16BIT pid)
Explicitly sets or clears the stream that will be used for audio on the given service. If &#39;valid&#39; is TRUE then the stream is set according to the given PID, but if FALSE then the audio stream selected for the service will be based on the default settings.
Definition: ap_dbacc.c:9851
U16BIT ADB_GetRequiredAudioPid(void *s_ptr)
Returns the audio PID to be used for the given service based on language settings, output format, etc.
Definition: ap_dbacc.c:5296
BOOLEAN ADB_ServiceHasSubtitles(void *serv_ptr, BOOLEAN *dvb_subs)
Determines whether the given service has subtitles, DVB or teletext.
Definition: ap_dbacc.c:6789
void * ADB_GetNextLNBBand(void *band_ptr)
Returns the next LNB band from the database.
Definition: ap_dbacc.c:782
void ADB_DeleteServices(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
Deletes all networks, transports and services related to the given type of tuner. ...
Definition: ap_dbacc.c:553
U16BIT ADB_GetFreesatServiceId(void *s_ptr)
Returns Freesat service ID of the given service.
Definition: ap_dbacc.c:5914
ADB_NETWORK_REC * DBDEF_GetTunedNetwork(U8BIT path)
gets the currently tuned network
Definition: ap_dbdef.c:8015
void STB_AppFreeMemory(void *addr)
Releases previously allocated application heap memory.
Definition: stbheap.c:781
BOOLEAN DBDEF_GetEventHDLinkageInfo(ADB_EVENT_REC *e_ptr, BOOLEAN verify_event, BOOLEAN only_simulcast, ADB_SERVICE_REC **hd_serv_ptr, ADB_EVENT_REC **hd_event_ptr)
Returns whether there&#39;s an HD event linked to the SD event and returns the info for it...
Definition: ap_dbdef.c:3042
void DBDEF_DeleteRecordsForTunerType(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
Deletes all network, transport and services records for the given tuner type.
Definition: ap_dbdef.c:1588
void ADB_ReportNoSignalDuringSearch(void *t_ptr)
Set the signal level to 0 and searched flag to TRUE for the given transport.
Definition: ap_dbacc.c:2253
ADB_TRANSPORT_REC * DBDEF_GetTunedTransport(U8BIT path)
gets the currently tuned transport
Definition: ap_dbdef.c:8053
void DBDEF_SetServiceDeletedFlag(ADB_SERVICE_REC *s_ptr, BOOLEAN deleted)
Marks whether a service is deleted or not.
Definition: ap_dbdef.c:6721
U8BIT * ADB_GetCridProgrammeName(void *c_ptr)
Returns the programme name field of the given CRID record. The returned string should be freed using ...
Definition: ap_dbacc.c:10197
U32BIT * ADB_GetTransportListOriginalNetworkIds(void **tlist, U16BIT num_entries)
Allocates and returns an array of original network ids for each transport in the given list was tuned...
Definition: ap_dbacc.c:1972
BOOLEAN DBDEF_SetLNBUSwitch(ADB_LNB_REC *lnb, U8BIT uswitch)
Sets the LNB uncommitted switch setting.
Definition: ap_dbdef.c:4235
BOOLEAN ADB_ServiceGetRCTIcon(void *serv_ptr, U8BIT **icon_data, U32BIT *data_size, BOOLEAN *pos_valid, U16BIT *x_pos, U16BIT *y_pos, U16BIT *width, U16BIT *height, E_ICON_COORD_SYSTEM *coord_system)
Searches all the RCT links for a service to see if any of them define an icon to be used...
Definition: ap_dbacc.c:6608
void ADB_GetEventScheduleByGenre(ADB_EVENT_CONTENT genre, BOOLEAN include_old_events, void *serv_ptr, void ***elist_ptr, U16BIT *num_entries_ptr)
Creates a copy of the event schedule for the given service, but only includes events of the given gen...
Definition: ap_dbacc.c:7767
U8BIT * ADB_GetServicePMTData(void *s_ptr, U16BIT *data_len)
Returns the current PMT data for the given service.
Definition: ap_dbacc.c:11293
ADB_EVENT_DESC * DBDEF_FindEventDescriptor(ADB_EVENT_DESC *start_desc, U8BIT desc_tag, U32BIT private_data_specifier)
Searches a descriptor list for the first descriptor with the given descriptor tag.
Definition: ap_dbdef.c:2003
U16BIT DBDEF_GetNumTransports(void)
Returns the number of transports in ther service database.
Definition: ap_dbdef.c:4829
void ADB_GetTransportTerrestrialTuningParams(void *t_ptr, E_STB_DP_TTYPE *terr_type, U32BIT *freq_hz, E_STB_DP_TMODE *mode, E_STB_DP_TBWIDTH *bwidth, U8BIT *plp_id)
Returns the settings to tune to the given DVB-T/T2 transport.
Definition: ap_dbacc.c:2776
void * ADB_GetTunedNetwork(U8BIT path)
Returns the network currently tuned to on the given decode path.
Definition: ap_dbacc.c:1669
U8BIT * DBDEF_GetFullCrid(ADB_SERVICE_REC *serv_ptr, U8BIT *event_str)
Returns the full CRID for the given CRID string The returned string should be freed using STB_AppFree...
Definition: ap_dbdef.c:3649
void ADB_ReleaseCridRecordList(void **crid_list, U16BIT num_entries)
Frees memory allocated for a CRID list due to a call to ADB_GetCridRecordList.
Definition: ap_dbacc.c:10634
U8BIT ADB_GetTransportTunedQuality(void *t_ptr)
Returns the signal quality, as a percentage, of the tuned transport.
Definition: ap_dbacc.c:2365
U32DHMS ADB_GetCridDateTime(void *c_ptr)
Returns a value representing the date & time held in the given CRID record.
Definition: ap_dbacc.c:10418
void * ADB_GetPrevServiceInList(U32BIT list_type, void *serv)
Returns the previous service, in LCN order, for the given list type, starting from the given service...
Definition: ap_dbacc.c:3850
BOOLEAN ADB_IsRCTLinkGroupTrailer(void *link_ptr)
Returns whether the given link is for a group trailer.
Definition: ap_dbacc.c:6385
void * ADB_GetTunedService(U8BIT path)
Returns the tuned service for the given decode path.
Definition: ap_dbacc.c:6068
E_STB_TUNE_TCODERATE ADB_GetTransportHpCodeRate(void *t_ptr)
Returns the HP coderate of the given DVB-T/T2 transport.
Definition: ap_dbacc.c:2617
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:2964
U8BIT ADB_GetEventStartMin(void *event_ptr)
Returns the minute (0-59) value for the start of the given event.
Definition: ap_dbacc.c:8493
BOOLEAN ADB_IsValidService(void *serv_ptr)
Checks whether the given service is in the current service list.
Definition: ap_dbacc.c:3677
U16BIT * ADB_GetServiceListOrigLcns(void **slist, U16BIT num_entries)
Allocates and returns an array of the logical channel numbers that each of the services in the given ...
Definition: ap_dbacc.c:4339
U8BIT ADB_GetEventDurationHour(void *event_ptr)
Returns the hour value for the duration of the given event.
Definition: ap_dbacc.c:8545
U32BIT * ADB_GetTransportListTids(void **tlist, U16BIT num_entries)
Allocates and returns an array of transport ids for the given transports. The returned array should b...
Definition: ap_dbacc.c:1894
void DBDEF_SetSecondaryAudioLang(U8BIT *lang_ids)
sets the secondary audio lang
Definition: ap_dbdef.c:8205
U8BIT * ADB_GetServiceProviderNameByLang(void *s_ptr, U8BIT lang)
Returns the provider name, as a UTF-8 string, using the given language, of the given service...
Definition: ap_dbacc.c:5551
BOOLEAN ADB_GetServiceNowNextState(void *s_ptr)
Returns whether the EIT now/next data is being held in memory for the service.
Definition: ap_dbacc.c:5116
void ADB_SortServicesByLcn(void)
Sort all services in the database according to their LCNs.
Definition: ap_dbacc.c:10025
U32BIT * ADB_GetTransportListTunedStrengths(void **tlist, U16BIT num_entries)
Allocates and returns an array of percentage values representing the signal strength when each transp...
Definition: ap_dbacc.c:1933
U8BIT * DBDEF_GetEventExtendedDescription(ADB_EVENT_REC *e_ptr)
Returns the extended event description text of the event as a UTF-8 string. The returned string shoul...
Definition: ap_dbdef.c:2302
U16BIT ADB_GetRequiredADPid(void *s_ptr, BOOLEAN *broadcast_mix)
Returns the PID to be used for audio description for the given service based on language settings...
Definition: ap_dbacc.c:5324
U8BIT * DBDEF_GetEventCrid(ADB_SERVICE_REC *serv_ptr, ADB_EVENT_REC *e_ptr, U8BIT crid_type, U8BIT index)
Returns the full CRID of the type given for the given event.
Definition: ap_dbdef.c:3515
void ADB_SetFavouriteListUserData(U8BIT list_id, U32BIT user_data)
Set the user data of the given favourite list.
Definition: ap_dbacc.c:10952
U16BIT * ADB_GetServiceListLcns(void **slist, U16BIT num_entries)
Allocates and returns an array of the logical channel numbers that have been assigned to all the serv...
Definition: ap_dbacc.c:4301
void * ADB_GetLaterEvent(void *serv_ptr, U16BIT date, U8BIT hour, U8BIT min)
Returns a copy of the event following the given date/time on the given service.
Definition: ap_dbacc.c:8321
void ADB_SetTextLang(U32BIT country_code, U8BIT lang_id)
Sets the primary subtitle and teletext language to be used.
Definition: ap_dbacc.c:7538
S8BIT STB_CompareStringsIgnoreCase(U8BIT *string1_ptr, U8BIT *string2_ptr)
Compares the contents of the two given ASCII strings and returns the status (as per strcmp) but ignor...
Definition: stbuni.c:2183
U16BIT ADB_GetNumTransports(void)
Returns the number of transports in the database.
Definition: ap_dbacc.c:1816
U16BIT DBDEF_GetNumLNBBands(void)
Returns the number of LNB band records in the database.
Definition: ap_dbdef.c:4493
U8BIT * ADB_GetEventProgrammeCrid(void *serv_ptr, void *event_ptr)
Returns the programme CRID of the given event (excluding IMI) The returned string should be freed usi...
Definition: ap_dbacc.c:9268
void ADB_ReleaseRCTLinks(void *links)
Frees the given list of RCT links.
Definition: ap_dbacc.c:6317
Header file - Function prototypes for heap memory.
BOOLEAN ADB_AddServiceToFavouriteList(U8BIT list_id, void *serv_ptr, S16BIT index)
Adds the given service to the favourite list defined by list_id, with the service being optionally ad...
Definition: ap_dbacc.c:11032
void ADB_DeleteFavouriteList(U8BIT list_id)
Deletes the favourite list with the given list id.
Definition: ap_dbacc.c:11005
BOOLEAN ADB_GetServiceSelectableFlag(void *s_ptr)
Returns the selectable status of the given service.
Definition: ap_dbacc.c:9677
BOOLEAN DBA_ClearDatabase(void)
Clears the working database of all records. Following this call, it should still be possible to acces...
Definition: dba_nvm.c:694
BOOLEAN ADB_MoveFavouriteListServiceFromTo(U8BIT list_id, S16BIT current_index, S16BIT new_index)
Change the order of the services in the given favourite lists by moving it to the given position...
Definition: ap_dbacc.c:11105
E_STREAM_MATCH_TYPE DBDEF_GetReqdSubtitleParams(ADB_SERVICE_REC *s_ptr, U16BIT *pid_ptr, U16BIT *cpage_ptr, U16BIT *apage_ptr)
Gets the appropriate subtitle pid and page ids - looks first for the params matching exactly the requ...
Definition: ap_dbdef.c:6472
void DBDEF_SetFavouriteListName(ADB_FAVLIST_REC *f_ptr, U8BIT *name)
Set or change the name of the given favourite list.
Definition: ap_dbdef.c:9706
U16BIT ADB_GetRequiredSubtitleParams(void *s_ptr, U16BIT *cpage_ptr, U16BIT *apage_ptr)
Returns the PID to be used for DVB subtitles for the given service based on language settings...
Definition: ap_dbacc.c:5411
void DBDEF_SetCridService(ADB_CRID_REC *c_ptr, U16BIT serv_id)
Sets the service ID in the crid record.
Definition: ap_dbdef.c:8863
E_STB_TUNE_TGUARDINT ADB_GetTransportGuardInt(void *t_ptr)
Returns the guard interval of the given DVB-T/T2 transport.
Definition: ap_dbacc.c:2648
Application header file.
U8BIT ADB_GetEventParentalAge(void *event_ptr)
Returns the parental age value for the given event.
Definition: ap_dbacc.c:8707
void DBDEF_MoveFavouriteListTo(ADB_FAVLIST_REC *fav_list, S16BIT index)
Changes the order of the favourite lists by moving the given list to the given position.
Definition: ap_dbdef.c:9283
void ADB_ToggleServiceLockedFlag(void *s_ptr)
Changes the current state of the given service from locked to unlocked, or vice versa.
Definition: ap_dbacc.c:5827
BOOLEAN DBDEF_GetEventSubtitlesAvailFlag(ADB_EVENT_REC *e_ptr)
Returns whether DVB subtitles are signalled as being available for the given event.
Definition: ap_dbdef.c:3363
BOOLEAN DBDEF_SetLNBPulsePosition(ADB_LNB_REC *lnb, BOOLEAN is_pulse_posn)
Sets the LNB pulse position setting.
Definition: ap_dbdef.c:4135
void * ADB_FindEventFromCrid(U8BIT *prog_crid, void *original_event_ptr, void **serv_ptr)
Finds an alternative event for the given programme CRID and returns a pointer to a copy of the event ...
Definition: ap_dbacc.c:9535
U8BIT * ADB_GetRCTLinkUriString(void *link_ptr)
Returns the uri string of the given RCT link.
Definition: ap_dbacc.c:6440
BOOLEAN DBDEF_TransportForTunerType(ADB_TRANSPORT_REC *t_ptr, E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
Checks whether the given transport is a terrestrial, cable or satellite transport, and optionally check whether it&#39;s on a particular satellite.
Definition: ap_dbdef.c:9805
void ADB_SetServiceScheduleState(void *s_ptr, BOOLEAN state)
Sets whether the EIT schedule events for this service are held in memory. All services hold schedule ...
Definition: ap_dbacc.c:5015
U8BIT * ADB_GetRCTLinkPromoText(void *link_ptr)
Returns the RCT link&#39;s promotional text based on the default language.
Definition: ap_dbacc.c:6331
void ADB_DeleteServiceEvents(void *serv_ptr, BOOLEAN delete_now_next)
Deletes all events and event related data for the given service.
Definition: ap_dbacc.c:7949
void ADB_GetNetworkServiceList(void *n_ptr, void ***slist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all services in the database on all transports on the given network...
Definition: ap_dbacc.c:3388
ADB_TRANSPORT_REC * DBDEF_FindTransportRecByIds(ADB_TRANSPORT_REC *transp, U32BIT net_id, U32BIT onet_id, U32BIT tran_id)
Find a transport record matching the given set of IDs, starting from the given transport.
Definition: ap_dbdef.c:5314
ADB_SUBTITLE_TYPE ADB_GetSubtitleStreamType(void *stream_ptr)
Returns the type, as defined in the PMT, of the given subtitle stream.
Definition: ap_dbacc.c:7473
U8BIT ADB_GetEventNumRecommendationCrids(void *event_ptr)
Returns the number of recommendation CRIDs for the given event.
Definition: ap_dbacc.c:9405
U8BIT * ADB_GetDefaultServiceProviderName(void *s_ptr)
Returns the default service provider name of the specified service.
Definition: ap_dbacc.c:5580
BOOLEAN ADB_GetServiceNotRunningFlag(void *s_ptr)
Returns the status of the &#39;not running&#39; flag of the given service. This flag indicates whether a serv...
Definition: ap_dbacc.c:5654
BOOLEAN DBDEF_AllocateLcns(E_STB_DP_SIGNAL_TYPE tuner_type, BOOLEAN assign_lcns)
allocates lcns - expects allocated lcn for all services to be 0
Definition: ap_dbdef.c:7038
BOOLEAN ADB_IsFreesatService(void *s_ptr)
Returns a value indicating whether the given service is a Freesat service.
Definition: ap_dbacc.c:5885
BOOLEAN DBDEF_SetLNBPower(ADB_LNB_REC *lnb, E_STB_DP_LNB_POWER power)
Sets the LNB power setting.
Definition: ap_dbdef.c:4060
BOOLEAN ADB_GetServiceUnavailableFlag(void *s_ptr)
Returns the status of the unavailable flag of the given service. This flag indicates whether a servic...
Definition: ap_dbacc.c:5604
void DBA_LockDatabase(void)
Locks the database to prevent access from other threads or processes.
Definition: dba_nvm.c:866
void ADB_GetServiceList(U32BIT list_type, void ***slist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all services in the database for the given list type.
Definition: ap_dbacc.c:3249
ADB_CRID_REC * DBDEF_AddCridRecord(U8BIT *crid, BOOLEAN series, BOOLEAN recommended)
Creates a CRID record and adds it to the database.
Definition: ap_dbdef.c:8793
U8BIT ** ADB_GetServiceListShortNames(void **slist, U16BIT num_entries, BOOLEAN use_pref_names)
Allocates and returns a list of the short names for all the services in the given service list...
Definition: ap_dbacc.c:4254
void ADB_GetNowNextEvents(void *serv_ptr, void **v_now_event, void **v_next_event)
Makes copies of the now and/or next events (EITp/f) for the given service. The returned events should...
Definition: ap_dbacc.c:7587
U8BIT * ADB_GetServiceDefaultAuthority(void *serv_ptr)
Returns a copy of the default authority CRID string for the given service. This string will be return...
Definition: ap_dbacc.c:6089
void ADB_GetTransportSatTuningParams(void *t_ptr, U32BIT *freq_hz, E_STB_DP_POLARITY *polarity, U16BIT *symrate, E_STB_DP_FEC *fec, BOOLEAN *dvb_s2, E_STB_DP_MODULATION *modulation)
Returns the parameters needed to tune a satellite tuner to a transport.
Definition: ap_dbacc.c:2895
U32BIT * ADB_GetServiceListHiddenFlag(void **slist, U16BIT num_entries)
Allocates and returns an array indicating whether each service in the given service list is signalled...
Definition: ap_dbacc.c:4661
void DBDEF_Initialise(void)
Initialises the database, preparing for it to be accessed.
Definition: ap_dbdef.c:201
void * ADB_FindEITScheduleEventFromTime(U32DHMS time, void *serv_ptr)
Finds the event in the event schedule to be broadcast at the specified time on the specified service...
Definition: ap_dbacc.c:8397
void DBA_UnlockDatabase(void)
Unlocks the database to allow other threads or processes to access it.
Definition: dba_nvm.c:876
void * ADB_GetFullSITransport(void *n_ptr)
Returns a transport that is signalled as containing a complete set of SI data via an NIT linkage desc...
Definition: ap_dbacc.c:10654
U8BIT * ADB_GetEventSIDescriptorData(void *serv_ptr, U16BIT event_id, U8BIT dtag_id, S16BIT ext_dtag_id, U16BIT *desc_len)
Returns a copy of the raw SI descriptor data with the given descriptor tag id and, optionally, extended descriptor tag id, for the event with the given event id. The data must be freed using ADB_ReleaseEventSIDescriptorData.
Definition: ap_dbacc.c:8065
void ADB_GetNetworkList(void ***nlist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of the network records in the database.
Definition: ap_dbacc.c:1100
void * ADB_GetTransportSatellite(void *t_ptr)
Returns the parent satellite for the given transport.
Definition: ap_dbacc.c:2935
void * ADB_GetEvent(void *serv_ptr, U16BIT event_id)
Returns a copy of the event with the given event ID on the given service.
Definition: ap_dbacc.c:8026
U16BIT ADB_GetDeletedServiceList(E_STB_DP_SIGNAL_TYPE tuner_type, void ***slist_ptr)
Returns a list of services that have been marked as &#39;deleted&#39; for the given tuner type...
Definition: ap_dbacc.c:3309
U8BIT * ADB_GetSatelliteName(void *sat_ptr)
Returns the pointer to the name of the satellite.
Definition: ap_dbacc.c:962
E_STREAM_MATCH_TYPE DBDEF_GetReqdTtextPid(ADB_SERVICE_REC *s_ptr, BOOLEAN for_subtitles, U16BIT *pid_ptr, U8BIT *magazine, U8BIT *page)
Gets the appropriate teletext pid - looks first for the params matching exactly the required teletext...
Definition: ap_dbdef.c:6404
U8BIT ADB_GetEventDurationMin(void *event_ptr)
Returns the minute value (0-59) for the duration of the given event.
Definition: ap_dbacc.c:8555
U16BIT ADB_GetServiceAitPid(void *s_ptr)
Returns the current AIT PID for the given service.
Definition: ap_dbacc.c:11345
void ADB_SetReqdTeletextStreamSettings(void *s_ptr, BOOLEAN valid, U32BIT lang_code, ADB_TELETEXT_TYPE ttext_type)
Explicitly sets or clears the stream that will be used for teletext on the given service. If &#39;valid&#39; is TRUE then the stream is set according to the given language and type, but if FALSE then the stream selected for the service will be based on the default settings.
Definition: ap_dbacc.c:9953
void ADB_ReleaseProfileList(void **profile_list, U16BIT num_profiles)
Frees a profile list acquired using ADB_GetProfileList.
Definition: ap_dbacc.c:11393
U8BIT ADB_GetEventStartSecs(void *event_ptr)
Returns the seconds (0-59) value for the start of the given event.
Definition: ap_dbacc.c:8503
ADB_PROFILE_TYPE ADB_GetProfileType(void *profile)
Returns the type of the given profile.
Definition: ap_dbacc.c:11407
void DBDEF_ClearTableVersionHistory(ADB_TRANSPORT_REC *t_ptr)
Clears the version histories stored in the transport records.
Definition: ap_dbdef.c:5479
BOOLEAN ADB_GetEventSubtitlesAvailFlag(void *event_ptr)
Returns whether DVB subtitles are signalled as being available for the given event.
Definition: ap_dbacc.c:8607
void ADB_GetNetworkTransportList(void *n_ptr, void ***tlist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all transport records in the database for the given network...
Definition: ap_dbacc.c:1764
ADB_STREAM_TYPE ADB_GetServiceVideoType(void *s_ptr)
Returns the video type being used by the given service.
Definition: ap_dbacc.c:5471
U32BIT * ADB_GetTransportListOffsets(void **tlist, U16BIT num_entries)
Returns the transport offset array.
Definition: ap_dbacc.c:2094
U16BIT ADB_GetNumServicesInList(U32BIT list_type, BOOLEAN inc_hidden)
Returns the number of services in the database that would be returned with the given list type...
Definition: ap_dbacc.c:3200
void DBDEF_MoveFavouriteListServiceTo(ADB_FAVLIST_REC *fav_list, ADB_FAVSERV_REC *fav_serv, S16BIT index)
Changes the order of the services in the favourite list by moving the given service to the given posi...
Definition: ap_dbdef.c:9581
S8BIT ADB_GetTransportOffset(void *t_ptr)
Returns the tuning offset of the given DVB-T/T2 transport.
Definition: ap_dbacc.c:2504
void ADB_GetTransportList(void ***tlist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all transport records in the database.
Definition: ap_dbacc.c:1691
void * ADB_GetSatelliteLNB(void *sat_ptr)
Returns the LNB associated with the given satellite.
Definition: ap_dbacc.c:992
U16BIT ADB_GetNetworkSecondaryTargetRegions(U32BIT country_code, U8BIT primary_region, U8BIT **code_array, U8BIT ***name_array)
Returns an array of secondary region codes and names for the given country and primary region...
Definition: ap_dbacc.c:1471
void ADB_GetReqdAudioStreamSettings(void *s_ptr, BOOLEAN *valid, U32BIT *lang_code, ADB_AUDIO_TYPE *audio_type, ADB_STREAM_TYPE *stream_type)
Returns the settings defined by ADB_SetReqdAudioStreamSettings that will be used for audio on the giv...
Definition: ap_dbacc.c:9875
U16BIT ADB_GetProfileList(void ***profile_list, U16BIT *active_profile)
Returns an array of available profiles. The array will be allocated within the function and should be...
Definition: ap_dbacc.c:11373
void DBDEF_SetCridDateTime(ADB_CRID_REC *c_ptr, U32DHMS date_time)
Sets the date and time fields in the crid record.
Definition: ap_dbdef.c:8845
E_STB_TUNE_TCONST ADB_GetTransportConstellation(void *t_ptr)
Returns the constellation of the given DVB-T/T2 transport.
Definition: ap_dbacc.c:2524
U32BIT * ADB_GetServiceListUnavailableFlag(void **slist, U16BIT num_entries)
Allocates and returns an array of the unavailable flags for each of the services in the given service...
Definition: ap_dbacc.c:4423
void DBDEF_DeleteLNBBandRec(ADB_LNB_BAND_REC *band_ptr)
Deletes an LNB band record from the database.
Definition: ap_dbdef.c:4611
U8BIT ADB_GetFavouriteListIdByIndex(U16BIT index)
Returns the list id of the favourite list defined by the given index.
Definition: ap_dbacc.c:10791
ADB_EVENT_REC * DBDEF_FindScheduleEventById(ADB_SERVICE_REC *s_ptr, U16BIT event_id)
Find an event for a service from its event_id.
Definition: ap_dbdef.c:1967
U8BIT ADB_GetTtextStreamPage(void *stream_ptr)
Returns the page value of the given teletext stream.
Definition: ap_dbacc.c:7339
BOOLEAN ADB_MoveFavouriteListServiceTo(U8BIT list_id, void *serv_ptr, S16BIT index)
Change the order of the services in the given favourite lists by moving it to the given position...
Definition: ap_dbacc.c:11068
U16BIT ADB_GetTransportCableSymbolRate(void *t_ptr)
Returns the symbol rate of the given cable transport.
Definition: ap_dbacc.c:2710
U8BIT * ADB_GetRCTLinkName(void *link_ptr)
Returns the name of the given RCT link.
Definition: ap_dbacc.c:6410
BOOLEAN ADB_MoveFavouriteListTo(U8BIT list_id, S16BIT index)
Change the order of the favourite lists by moving the given list to the given position.
Definition: ap_dbacc.c:10977
Application database access functions.
BOOLEAN DBDEF_SetLNBDiSEqCPosition(ADB_LNB_REC *lnb, BOOLEAN is_diseqc_posn)
Sets the LNB DiSEqC position setting.
Definition: ap_dbdef.c:4160
void ADB_ReleaseStreamList(void **streamlist_ptr, U16BIT num_entries)
Frees the memory allocated for a stream list using ADB_GetStreamList.
Definition: ap_dbacc.c:7052
ADB_NETWORK_REC * DBDEF_GetNextNetworkRec(ADB_NETWORK_REC *n_ptr)
Returns the network following the one given. If the argument is NULL then the first network will be r...
Definition: ap_dbdef.c:4800
E_STB_TUNE_THIERARCHY ADB_GetTransportHierarchy(void *t_ptr)
Returns the hierarchy of the given DVB-T/T2 transport.
Definition: ap_dbacc.c:2555
void * ADB_GetEPGService(void *n_ptr)
Returns a service that is signalled as containing EPG data via an NIT linkage descriptor.
Definition: ap_dbacc.c:10693
void * ADB_GetServiceRCTLinks(void *serv_ptr, U8BIT *num_links)
Returns a copy of the RCT links for the given service. The returned list should be freed using ADB_Re...
Definition: ap_dbacc.c:6212
void ADB_DeleteServiceFromFavouriteList(U8BIT list_id, void *serv_ptr)
Removes the given service from the favourite list defined by the list id.
Definition: ap_dbacc.c:11145
U32DHMS ADB_GetEventStartDateTime(void *event_ptr)
Returns a value representing the date and time of the start of the given event.
Definition: ap_dbacc.c:8441
void ADB_SetCridService(void *c_ptr, U16BIT serv_id)
Sets the service ID on the given CRID record.
Definition: ap_dbacc.c:10148
U16BIT DBDEF_GetProfileList(void ***profile_list, U16BIT *active_profile)
Gets a list of the available network profiles.
Definition: ap_dbdef.c:10031
E_STB_DP_CMODE ADB_GetTransportCableMode(void *t_ptr)
Returns the QAM mode of the given cable transport.
Definition: ap_dbacc.c:2679
U8BIT * ADB_GetServiceFullNameByLangAndPrefId(void *s_ptr, U8BIT lang, U8BIT pref_name_id)
Returns the full name of the given service as a UTF-8 string using the given language and preferred n...
Definition: ap_dbacc.c:4896
Header file - macros and function prototypes for public use.
void STB_SIReleaseTargetRegionNameList(SI_NIT_TARGET_REGION_NAME_DESC *desc_list)
Frees the memory used by the descriptor list specified.
Definition: stbsitab.c:12630
U16BIT ADB_GetTransportOriginalNetworkId(void *t_ptr)
Returns the original network id of the given transport.
Definition: ap_dbacc.c:2385
void DBDEF_SortServicesByLcn(void)
Sort the full service list into ascending logical channel number order.
Definition: ap_dbdef.c:7017
U32BIT ADB_GetFavouriteListUserData(U8BIT list_id)
Returns the user data of the given favourite list.
Definition: ap_dbacc.c:10924
void * ADB_LaterEvent(void *serv_ptr, U32DHMS time)
Returns a copy of the event following the given date/time on the given service.
Definition: ap_dbacc.c:8255
void DBDEF_DeleteRCTLinks(ADB_RCT_LINK_INFO *links)
Frees the given list of RCT links.
Definition: ap_dbdef.c:3815
ADB_SERVICE_TYPE ADB_GetServiceType(void *s_ptr)
Returns the signalled type of the given service.
Definition: ap_dbacc.c:5494