diff --git a/vnsiclient.c b/vnsiclient.c index 645408d..5178a95 100644 --- a/vnsiclient.c +++ b/vnsiclient.c @@ -65,6 +65,7 @@ cVNSIClient::cVNSIClient(int fd, unsigned int id, const char *ClientAdr, CVNSITi { SetDescription("VNSI Client %u->%s", id, ClientAdr); + m_StatusInterfaceEnabled = false; Start(); } @@ -299,8 +300,6 @@ int cVNSIClient::EpgChange() void cVNSIClient::Recording(const cDevice *Device, const char *Name, const char *FileName, bool On) { - cMutexLock lock(&m_msgLock); - if (m_StatusInterfaceEnabled) { cResponsePacket resp; @@ -324,8 +323,6 @@ void cVNSIClient::Recording(const cDevice *Device, const char *Name, const char void cVNSIClient::OsdStatusMessage(const char *Message) { - cMutexLock lock(&m_msgLock); - if (m_StatusInterfaceEnabled && Message) { /* Ignore this messages */ diff --git a/vnsiclient.h b/vnsiclient.h index 95cf192..148900d 100644 --- a/vnsiclient.h +++ b/vnsiclient.h @@ -34,6 +34,7 @@ #include "cxsocket.h" #include "channelscancontrol.h" +#include #include #include @@ -53,41 +54,6 @@ class CVNSITimers; class cVNSIClient : public cThread , public cStatus { - const unsigned int m_Id; - cxSocket m_socket; - bool m_loggedIn = false; - bool m_StatusInterfaceEnabled = false; - cLiveStreamer *m_Streamer = nullptr; - bool m_isStreaming = false; - bool m_bSupportRDS = false; - const cString m_ClientAddress; - cRecPlayer *m_RecPlayer = nullptr; - cCharSetConv m_toUTF8; - uint32_t m_protocolVersion; - cMutex m_msgLock; - static cMutex m_timerLock; - cVnsiOsdProvider *m_Osd = nullptr; - CScanControl m_ChannelScanControl; - static bool m_inhibidDataUpdates; - typedef struct - { - int attempts = 0; - time_t lastEvent = 0; - time_t lastTrigger = 0; - } sEpgUpdate; - std::map m_epgUpdate; - CVNSITimers &m_vnsiTimers; - -protected: - - bool processRequest(cRequestPacket &req); - - virtual void Action(void) override; - virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On) override; - virtual void OsdStatusMessage(const char *Message) override; -#if VDRVERSNUM >= 20104 - virtual void ChannelChange(const cChannel *Channel) override; -#endif public: @@ -101,27 +67,25 @@ class cVNSIClient : public cThread void RecordingsChange(); void SignalTimerChange(); int EpgChange(); - static bool InhibidDataUpdates() { return m_inhibidDataUpdates; } - unsigned int GetID() { return m_Id; } + static bool InhibidDataUpdates() { return m_inhibidDataUpdates; } + protected: + void Action(void) override; + void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On) override; + void OsdStatusMessage(const char *Message) override; +#if VDRVERSNUM >= 20104 + void ChannelChange(const cChannel *Channel) override; +#endif + void SetLoggedIn(bool yesNo) { m_loggedIn = yesNo; } void SetStatusInterface(bool yesNo) { m_StatusInterfaceEnabled = yesNo; } bool StartChannelStreaming(cResponsePacket &resp, const cChannel *channel, int32_t priority, uint8_t timeshift, uint32_t timeout); void StopChannelStreaming(); -private: - - typedef struct { - bool automatic; - bool radio; - std::string name; - } ChannelGroup; - - std::map m_channelgroups[2]; - + bool processRequest(cRequestPacket &req); bool process_Login(cRequestPacket &r); bool process_GetTime(cRequestPacket &r); bool process_EnableStatusInterface(cRequestPacket &r); @@ -194,9 +158,8 @@ class cVNSIClient : public cThread cString CreatePiconRef(const cChannel* channel); -private: - /** Static callback functions to interact with wirbelscan plugin over - the plugin service interface */ + // Static callback functions to interact with wirbelscan plugin over + // the plugin service interface friend class CScanControl; void processSCAN_SetPercentage(int percent); @@ -206,4 +169,39 @@ class cVNSIClient : public cThread void processSCAN_NewChannel(const char *Name, bool isRadio, bool isEncrypted, bool isHD); void processSCAN_IsFinished(); void processSCAN_SetStatus(int status); + + typedef struct + { + bool automatic; + bool radio; + std::string name; + } ChannelGroup; + + std::map m_channelgroups[2]; + + const unsigned int m_Id; + cxSocket m_socket; + bool m_loggedIn = false; + std::atomic_bool m_StatusInterfaceEnabled; + cLiveStreamer *m_Streamer = nullptr; + bool m_isStreaming = false; + bool m_bSupportRDS = false; + const cString m_ClientAddress; + cRecPlayer *m_RecPlayer = nullptr; + cCharSetConv m_toUTF8; + uint32_t m_protocolVersion; + cMutex m_msgLock; + static cMutex m_timerLock; + cVnsiOsdProvider *m_Osd = nullptr; + CScanControl m_ChannelScanControl; + static bool m_inhibidDataUpdates; + + typedef struct + { + int attempts = 0; + time_t lastEvent = 0; + time_t lastTrigger = 0; + } sEpgUpdate; + std::map m_epgUpdate; + CVNSITimers &m_vnsiTimers; };