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;
57 ePtr<eTimer> m_updateNonTunedTimer;
59 std::map<iDVBChannel*, channel_data> m_knownChannels;
60 std::map<eDVBChannelID,int> m_timeOffsetMap;
61 ePtr<eConnection> m_chanAddedConn;
63 int m_time_difference;
64 int m_last_tp_time_difference;
65 void DVBChannelAdded(eDVBChannel*);
66 void DVBChannelStateChanged(iDVBChannel*);
67 void readTimeOffsetData(const char*);
68 void writeTimeOffsetData(const char*);
69 void updateTime(time_t tp_time, eDVBChannel*, int updateCount);
70 void updateNonTuned();
71 static eDVBLocalTimeHandler *instance;
73 eDVBLocalTimeHandler();
74 ~eDVBLocalTimeHandler();
78 eDVBLocalTimeHandler();
79 ~eDVBLocalTimeHandler();
81 PSignal0<void> m_timeUpdated;
82 bool ready() const { return m_time_ready; }
83 static eDVBLocalTimeHandler *getInstance() { return instance; }
86 #endif // __LIB_DVB_DVBTIME_H_