X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/20f69c200ec5703e958a6b95abfcfd5a108e5939..aa052184a12e61d01983f8c9047183e6b0d499f3:/lib/dvb/dvbtime.h diff --git a/lib/dvb/dvbtime.h b/lib/dvb/dvbtime.h index 59a26c21..a5114f82 100644 --- a/lib/dvb/dvbtime.h +++ b/lib/dvb/dvbtime.h @@ -1,9 +1,11 @@ #ifndef __LIB_DVB_DVBTIME_H_ #define __LIB_DVB_DVBTIME_H_ +#ifndef SWIG + #include #include -#include +#include class eDVBChannel; @@ -16,6 +18,13 @@ inline int fromBCD(int bcd) return ((bcd&0xF0)>>4)*10+(bcd&0xF); } +inline int toBCD(int dec) +{ + if (dec >= 100) + return -1; + return int(dec/10)*0x10 + dec%10; +} + time_t parseDVBtime(__u8 t1, __u8 t2, __u8 t3, __u8 t4, __u8 t5); class TDT: public eGTable @@ -23,37 +32,52 @@ class TDT: public eGTable eDVBChannel *chan; ePtr demux; eTimer m_interval_timer; - int createTable(int nr, const __u8 *data, unsigned int max); + int createTable(unsigned int nr, const __u8 *data, unsigned int max); void ready(int); + int update_count; public: - TDT(eDVBChannel *chan); + TDT(eDVBChannel *chan, int update_count=0); void start(); void startTimer(int interval); + int getUpdateCount() { return update_count; } }; +#endif // SWIG + class eDVBLocalTimeHandler: public Object { + struct channel_data + { + TDT *tdt; + ePtr channel; + ePtr m_stateChangedConn; + int m_prevChannelState; + }; friend class TDT; DECLARE_REF(eDVBLocalTimeHandler) - std::map m_active_tables; + std::map m_knownChannels; std::map m_timeOffsetMap; ePtr m_chanAddedConn; - ePtr m_chanRemovedConn; - ePtr m_chanRunningConn; bool m_time_ready; int m_time_difference; int m_last_tp_time_difference; void DVBChannelAdded(eDVBChannel*); - void DVBChannelRemoved(eDVBChannel*); - void DVBChannelRunning(iDVBChannel*); + void DVBChannelStateChanged(iDVBChannel*); void readTimeOffsetData(const char*); void writeTimeOffsetData(const char*); - void updateTime(time_t tp_time, eDVBChannel*); + void updateTime(time_t tp_time, eDVBChannel*, int updateCount); static eDVBLocalTimeHandler *instance; +#ifdef SWIG + eDVBLocalTimeHandler(); + ~eDVBLocalTimeHandler(); +#endif public: - PSignal0 m_timeUpdated; +#ifndef SWIG eDVBLocalTimeHandler(); ~eDVBLocalTimeHandler(); +#endif + PSignal0 m_timeUpdated; + time_t nowTime() const { return m_time_ready ? ::time(0)+m_time_difference : -1; } bool ready() const { return m_time_ready; } int difference() const { return m_time_difference; } static eDVBLocalTimeHandler *getInstance() { return instance; }