summaryrefslogtreecommitdiff
path: root/tvapi/libtv/tv/CTvEpg.h (plain)
blob: 3973af425f14507d522fbd9f2156cb0b0cb1185d
1/*
2 * amlogic 2013
3 *@ Project : tv
4 *@ Date : 2013-12
5 *@ Author :
6*/
7#include <am_debug.h>
8#include <am_scan.h>
9#include <am_epg.h>
10#include <am_mem.h>
11#include <utils/Log.h>
12#include "CTvEv.h"
13#if !defined(_CDTVEPG_H)
14#define _CDTVEPG_H
15class CTvEpg
16{
17public :
18 static const int MODE_ADD = 0;
19 static const int MODE_REMOVE = 1;
20 static const int MODE_SET = 2;
21
22 static const int SCAN_PAT = 0x01;
23 static const int SCAN_PMT = 0x02;
24 static const int SCAN_CAT = 0x04;
25 static const int SCAN_SDT = 0x08;
26 static const int SCAN_NIT = 0x10;
27 static const int SCAN_TDT = 0x20;
28 static const int SCAN_EIT_PF_ACT = 0x40;
29 static const int SCAN_EIT_PF_OTH = 0x80;
30 static const int SCAN_EIT_SCHE_ACT = 0x100;
31 static const int SCAN_EIT_SCHE_OTH = 0x200;
32 static const int SCAN_MGT = 0x400;
33 static const int SCAN_VCT = 0x800;
34 static const int SCAN_STT = 0x1000;
35 static const int SCAN_RRT = 0x2000;
36 static const int SCAN_PSIP_EIT = 0x4000;
37 static const int SCAN_PSIP_ETT = 0x8000;
38 static const int SCAN_EIT_PF_ALL = SCAN_EIT_PF_ACT | SCAN_EIT_PF_OTH;
39 static const int SCAN_EIT_SCHE_ALL = SCAN_EIT_SCHE_ACT | SCAN_EIT_SCHE_OTH;
40 static const int SCAN_EIT_ALL = SCAN_EIT_PF_ALL | SCAN_EIT_SCHE_ALL;
41 static const int SCAN_ALL = SCAN_PAT | SCAN_PMT | SCAN_CAT | SCAN_SDT | SCAN_NIT | SCAN_TDT | SCAN_EIT_ALL |
42 SCAN_MGT | SCAN_VCT | SCAN_STT | SCAN_RRT | SCAN_PSIP_EIT | SCAN_PSIP_ETT;
43
44 static const int INVALID_ID = -1;
45
46 //egp notify
47 /*static const int EVENT_PF_EIT_END = 1;
48 static const int EVENT_SCH_EIT_END = 2;
49 static const int EVENT_PMT_END = 3;
50 static const int EVENT_SDT_END = 4;
51 static const int EVENT_TDT_END = 5;
52 static const int EVENT_NIT_END = 6;
53 static const int EVENT_PROGRAM_AV_UPDATE = 7;
54 static const int EVENT_PROGRAM_NAME_UPDATE = 8;
55 static const int EVENT_PROGRAM_EVENTS_UPDATE = 9;
56 static const int EVENT_CHANNEL_UPDATE = 10;*/
57 //
58 class EpgEvent : public CTvEv
59 {
60 public:
61 EpgEvent(): CTvEv(CTvEv::TV_EVENT_EPG)
62 {
63
64 };
65 ~EpgEvent()
66 {};
67 static const int EVENT_PF_EIT_END = 1;
68 static const int EVENT_SCH_EIT_END = 2;
69 static const int EVENT_PMT_END = 3;
70 static const int EVENT_SDT_END = 4;
71 static const int EVENT_TDT_END = 5;
72 static const int EVENT_NIT_END = 6;
73 static const int EVENT_PROGRAM_AV_UPDATE = 7;
74 static const int EVENT_PROGRAM_NAME_UPDATE = 8;
75 static const int EVENT_PROGRAM_EVENTS_UPDATE = 9;
76 static const int EVENT_CHANNEL_UPDATE = 10;
77 static const int EVENT_CHANNEL_UPDATE_END = 11;
78
79 int type;
80 int channelID;
81 int programID;
82 int dvbOrigNetID;
83 int dvbTSID;
84 int dvbServiceID;
85 long time;
86 int dvbVersion;
87 };
88
89 class IObserver
90 {
91 public:
92 IObserver() {};
93 virtual ~IObserver() {};
94 virtual void onEvent(const EpgEvent &ev) = 0;
95 };
96 //1 VS n
97 //int addObserver(IObserver* ob);
98 //int removeObserver(IObserver* ob);
99
100 //1 VS 1
101 int setObserver(IObserver *ob)
102 {
103 mpObserver = ob;
104 return 0;
105 }
106
107 CTvEpg()
108 {
109 mCurScanChannelId = INVALID_ID;
110 mCurScanProgramId = INVALID_ID;
111 mEpgScanHandle = -1;
112 mpObserver = NULL;
113 }
114 void Init(int fend, int dmx, int fend_mod, char *textLanguages, char *dvb_text_coding);
115
116 ~CTvEpg()
117 {
118 epg_destroy();
119 }
120
121 /*Enter a channel.*/
122 void enterChannel(int chan_id);
123 /*Leave the channel.*/
124 void leaveChannel();
125 /*Enter the program.*/
126 void enterProgram(int prog_id);
127 /*Leave the program.*/
128 void leaveProgram();
129
130private:
131 //
132 void epg_create(int fend_id, int dmx_id, int src, char *textLangs);
133 void epg_destroy();
134 void epg_change_mode(int op, int mode);
135 void epg_monitor_service(int srv_id);
136 void epg_set_dvb_text_coding(char *coding);
137
138
139 /*Start scan the sections.*/
140 void startScan(int mode);
141 /*Stop scan the sections.*/
142 void stopScan(int mode);
143
144 static void epg_evt_callback(int dev_no, int event_type, void *param, void *user_data);
145
146 //
147 IObserver *mpObserver;
148
149 //
150 int mEpgScanHandle;
151 int mFend_dev_id;
152 int mDmx_dev_id ;
153 int mFend_mod;
154 int mCurScanChannelId ;
155 int mCurScanProgramId ;
156
157 //
158 EpgEvent mCurEpgEv;
159};
160#endif //_CDTVEPG_H
161