#ifndef __LIB_DVB_DVBTIME_H_
#define __LIB_DVB_DVBTIME_H_
+#ifndef SWIG
+
#include <lib/base/eerror.h>
#include <lib/dvb/esection.h>
-#include <lib/dvb_si/tdt.h>
+#include <dvbsi++/time_date_section.h>
class eDVBChannel;
eTimer m_interval_timer;
int createTable(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<eDVBChannel> channel;
+ ePtr<eConnection> m_stateChangedConn;
+ int m_prevChannelState;
+ };
friend class TDT;
DECLARE_REF(eDVBLocalTimeHandler)
- std::map<iDVBChannel*, TDT*> m_active_tables;
+ std::map<iDVBChannel*, channel_data> m_knownChannels;
std::map<eDVBChannelID,int> m_timeOffsetMap;
ePtr<eConnection> m_chanAddedConn;
- ePtr<eConnection> m_chanRemovedConn;
- ePtr<eConnection> 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:
+#ifndef SWIG
PSignal0<void> m_timeUpdated;
eDVBLocalTimeHandler();
~eDVBLocalTimeHandler();
+#endif
+ 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; }