1 #ifndef __LIB_DVB_DVBTIME_H_
2 #define __LIB_DVB_DVBTIME_H_
6 #include <lib/base/eerror.h>
7 #include <lib/dvb/esection.h>
8 #include <dvbsi++/time_date_section.h>
12 inline int fromBCD(int bcd)
18 return ((bcd&0xF0)>>4)*10+(bcd&0xF);
21 inline int toBCD(int dec)
25 return int(dec/10)*0x10 + dec%10;
28 time_t parseDVBtime(__u8 t1, __u8 t2, __u8 t3, __u8 t4, __u8 t5);
30 class TDT: public eGTable
33 ePtr<iDVBDemux> demux;
34 ePtr<eTimer> m_interval_timer;
35 int createTable(unsigned int nr, const __u8 *data, unsigned int max);
39 TDT(eDVBChannel *chan, int update_count=0);
41 void startTimer(int interval);
42 int getUpdateCount() { return update_count; }
47 class eDVBLocalTimeHandler: public Object
49 DECLARE_REF(eDVBLocalTimeHandler);
53 ePtr<eDVBChannel> channel;
54 ePtr<eConnection> m_stateChangedConn;
55 int m_prevChannelState;
58 ePtr<eTimer> m_updateNonTunedTimer;
60 std::map<iDVBChannel*, channel_data> m_knownChannels;
61 std::map<eDVBChannelID,int> m_timeOffsetMap;
62 ePtr<eConnection> m_chanAddedConn;
64 int m_time_difference;
65 int m_last_tp_time_difference;
66 void DVBChannelAdded(eDVBChannel*);
67 void DVBChannelStateChanged(iDVBChannel*);
68 void readTimeOffsetData(const char*);
69 void writeTimeOffsetData(const char*);
70 void updateTime(time_t tp_time, eDVBChannel*, int updateCount);
71 void updateNonTuned();
72 static eDVBLocalTimeHandler *instance;
74 eDVBLocalTimeHandler();
75 ~eDVBLocalTimeHandler();
79 eDVBLocalTimeHandler();
80 ~eDVBLocalTimeHandler();
82 bool getUseDVBTime() { return m_use_dvb_time; }
83 void setUseDVBTime(bool b);
84 PSignal0<void> m_timeUpdated;
85 bool ready() const { return m_time_ready; }
86 static eDVBLocalTimeHandler *getInstance() { return instance; }
89 #endif // __LIB_DVB_DVBTIME_H_