blob: c743fae21c082b2d76f0e941c257344ee860d0e7
1 | // |
2 | // |
3 | // amlogic 2013 |
4 | // |
5 | // @ Project : tv |
6 | // @ File Name : |
7 | // @ Date : 2013-11 |
8 | // @ Author : |
9 | // |
10 | // |
11 | #include <am_scan.h> |
12 | #include <am_epg.h> |
13 | #include <am_mem.h> |
14 | #include "CTvChannel.h" |
15 | #include "CTvLog.h" |
16 | #include "CTvEv.h" |
17 | #include "tvin/CTvin.h" |
18 | |
19 | #if !defined(_CTVSCANNER_H) |
20 | #define _CTVSCANNER_H |
21 | class CTvScanner |
22 | { |
23 | public: |
24 | /** ATSC Attenna type */ |
25 | static const int AM_ATSC_ATTENNA_TYPE_AIR = 1; |
26 | static const int AM_ATSC_ATTENNA_TYPE_CABLE_STD = 2; |
27 | static const int AM_ATSC_ATTENNA_TYPE_CABLE_IRC = 3; |
28 | static const int AM_ATSC_ATTENNA_TYPE_CABLE_HRC = 4; |
29 | CTvScanner(CTvin *pTvin); |
30 | ~CTvScanner(); |
31 | int startScan(); |
32 | int stopScan(); |
33 | int ATVManualScan(int min_freq, int max_freq, int std, int store_Type = 0, int channel_num = 0); |
34 | int autoAtvScan(int min_freq, int max_freq, int std, int search_type); |
35 | int autoDtmbScan(); |
36 | int manualDtmbScan(int beginFreq, int endFreq, int modulation = -1); |
37 | int autoAtscScan(int attennaType, int std); |
38 | int manualDtmbScan(int freq); |
39 | int manualAtscScan(int freq, int attennaType, int std); |
40 | int autoTvScan(); |
41 | int unsubscribeEvent(); |
42 | |
43 | class ScannerEvent: public CTvEv |
44 | { |
45 | public: |
46 | static const int EVENT_SCAN_PROGRESS = 0; |
47 | static const int EVENT_STORE_BEGIN = 1; |
48 | static const int EVENT_STORE_END = 2; |
49 | static const int EVENT_SCAN_END = 3; |
50 | static const int EVENT_BLINDSCAN_PROGRESS = 4; |
51 | static const int EVENT_BLINDSCAN_NEWCHANNEL = 5; |
52 | static const int EVENT_BLINDSCAN_END = 6; |
53 | |
54 | ScannerEvent(): CTvEv(CTvEv::TV_EVENT_SCANNER) |
55 | { |
56 | } |
57 | ~ScannerEvent() |
58 | { |
59 | } |
60 | int mType; |
61 | int mPercent; |
62 | int mTotalChannelCount; |
63 | int mLockedStatus; |
64 | int mChannelNumber; |
65 | //CTvChannel mChannel; |
66 | int mMode; |
67 | int mFrequency; |
68 | int mSymbolRate; |
69 | int mModulation; |
70 | int mBandwidth; |
71 | int mOfdm_mode; |
72 | int mAudio; |
73 | int mStandard; |
74 | int mSat_polarisation; |
75 | // |
76 | int mStrength; |
77 | int mSnr; |
78 | char mProgramName[1024]; |
79 | int mprogramType; |
80 | char mMSG[128]; |
81 | |
82 | // ScannerEvent(int type){ |
83 | // this->mType = type; |
84 | // } |
85 | }; |
86 | |
87 | class IObserver |
88 | { |
89 | public: |
90 | IObserver() {}; |
91 | virtual ~IObserver() {}; |
92 | virtual void onEvent(const ScannerEvent &ev) = 0; |
93 | }; |
94 | //1 VS n |
95 | //int addObserver(IObserver* ob); |
96 | //int removeObserver(IObserver* ob); |
97 | |
98 | //1 VS 1 |
99 | int setObserver(IObserver *ob) |
100 | { |
101 | mpObserver = ob; |
102 | return 0; |
103 | } |
104 | private: |
105 | static AM_Bool_t s_atv_cvbs_lock_check(void *); |
106 | AM_Bool_t atv_cvbs_lock_check(v4l2_std_id *colorStd); |
107 | static void tv_scan_evt_callback(int dev_no, int event_type, void *param, void *data); |
108 | void tv_scan_reconnect_dmx_to_fend(int dmx_no, int fend_no); |
109 | int getAtscChannelPara(int attennaType, Vector<sp<CTvChannel> > &vcp); |
110 | // |
111 | int mScanHandle; |
112 | volatile bool mbScanStart; |
113 | |
114 | //scan para info |
115 | /** General TV Scan Mode */ |
116 | static const int TV_MODE_ATV = 0; // Only search ATV |
117 | static const int TV_MODE_DTV = 1; // Only search DTV |
118 | static const int TV_MODE_ADTV = 2; // A/DTV will share a same frequency list, like ATSC |
119 | /** DTV scan mode */ |
120 | static const int DTV_MODE_AUTO = 1; |
121 | static const int DTV_MODE_MANUAL = 2; |
122 | static const int DTV_MODE_ALLBAND = 3; |
123 | static const int DTV_MODE_BLIND = 4; |
124 | |
125 | /** DTV scan options, DONOT channge */ |
126 | static const int DTV_OPTION_UNICABLE = 0x10; //Satellite unicable mode |
127 | static const int DTV_OPTION_FTA = 0x20; //Only store free programs |
128 | static const int DTV_OPTION_NO_TV = 0x40; //Only store tv programs |
129 | static const int DTV_OPTION_NO_RADIO = 0x80; //Only store radio programs |
130 | |
131 | /** ATV scan mode */ |
132 | static const int ATV_MODE_AUTO = 1; |
133 | static const int ATV_MODE_MANUAL = 2; |
134 | |
135 | // |
136 | private: |
137 | |
138 | // |
139 | IObserver *mpObserver; |
140 | // |
141 | CTvin *mpTvin; |
142 | int mMode; |
143 | int mFendID; |
144 | /** DTV parameters */ |
145 | int mTvMode; |
146 | int mTvOptions; |
147 | int mSat_id; |
148 | int mSource; |
149 | //showboz |
150 | //TVSatelliteParams tv_satparams; |
151 | int mTsSourceID; |
152 | CTvChannel mStartChannel; |
153 | Vector<CTvChannel> mvChooseListChannels; |
154 | /** ATV parameters */ |
155 | int mAtvMode; |
156 | int mStartFreq; |
157 | int mDirection; |
158 | int mChannelID; |
159 | |
160 | |
161 | |
162 | //extern for scanner |
163 | //int channelID; //can be used for manual scan |
164 | /** Atv set */ |
165 | int mMinFreq; |
166 | int mMaxFreq; |
167 | long long mCurScanStartFreq; |
168 | long long mCurScanEndFreq; |
169 | int tunerStd; |
170 | /** Tv set */ |
171 | int demuxID;//default 0 |
172 | String8 defaultTextLang; |
173 | String8 orderedTextLangs; |
174 | //showboz |
175 | //Vector<CTvChannel> ChannelList;//VS mvChooseListChannels |
176 | |
177 | /** Dtv-Sx set Unicable settings*/ |
178 | int user_band; |
179 | int ub_freq;//!< kHz |
180 | |
181 | ScannerEvent mCurEv; |
182 | }; |
183 | #endif //CTVSCANNER_H |
184 |