eitd/sectionsd.cpp: move public functions to CEitManager class

This commit is contained in:
[CST] Focus
2012-08-30 11:32:29 +04:00
parent ba051aaf41
commit fb68bff086
2 changed files with 75 additions and 79 deletions

View File

@@ -60,7 +60,6 @@
#define DEBUG_SECTION_THREADS #define DEBUG_SECTION_THREADS
#define DEBUG_CN_THREAD #define DEBUG_CN_THREAD
static bool sectionsd_ready = false;
/*static*/ bool reader_ready = true; /*static*/ bool reader_ready = true;
static unsigned int max_events; static unsigned int max_events;
static bool notify_complete = false; static bool notify_complete = false;
@@ -142,7 +141,7 @@ static CFreeSatThread threadFSEIT;
CSdtThread threadSDT; CSdtThread threadSDT;
#endif #endif
int sectionsd_stop = 0; static int sectionsd_stop = 0;
static bool slow_addevent = true; static bool slow_addevent = true;
@@ -2107,8 +2106,6 @@ printf("SIevent size: %d\n", sizeof(SIevent));
if (sections_debug) if (sections_debug)
dump_sched_info("main"); dump_sched_info("main");
sectionsd_ready = true;
while (running && sectionsd_server.run(sectionsd_parse_command, sectionsd::ACTVERSION, true)) { while (running && sectionsd_server.run(sectionsd_parse_command, sectionsd::ACTVERSION, true)) {
sched_yield(); sched_yield();
if (threadCN.checkUpdate()) { if (threadCN.checkUpdate()) {
@@ -2170,20 +2167,25 @@ printf("SIevent size: %d\n", sizeof(SIevent));
} }
/* was: commandAllEventsChannelID sendAllEvents */ /* was: commandAllEventsChannelID sendAllEvents */
void sectionsd_getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventList &eList, char search = 0, std::string search_text = "") void CEitManager::getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventList &eList, char search, std::string search_text)
{ {
dprintf("sendAllEvents for " PRINTF_CHANNEL_ID_TYPE "\n", serviceUniqueKey); dprintf("sendAllEvents for " PRINTF_CHANNEL_ID_TYPE "\n", serviceUniqueKey);
if ((serviceUniqueKey& 0xFFFFFFFFFFFFULL) != 0) { //0xFFFFFFFFFFFFULL for CREATE_CHANNEL_ID64 eList.clear();
serviceUniqueKey &= 0xFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFULL for CREATE_CHANNEL_ID64
if(serviceUniqueKey == 0)
return;
// service Found // service Found
readLockEvents(); readLockEvents();
int serviceIDfound = 0; int serviceIDfound = 0;
if (search_text.length()) if (search_text.length())
std::transform(search_text.begin(), search_text.end(), search_text.begin(), tolower); std::transform(search_text.begin(), search_text.end(), search_text.begin(), tolower);
for (MySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey::iterator e = mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.begin(); e != mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.end(); ++e) for (MySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey::iterator e = mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.begin(); e != mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.end(); ++e)
{ {
if ((*e)->get_channel_id() == (serviceUniqueKey& 0xFFFFFFFFFFFFULL)) { //0xFFFFFFFFFFFFULL for CREATE_CHANNEL_ID64 if ((*e)->get_channel_id() == serviceUniqueKey) {
serviceIDfound = 1; serviceIDfound = 1;
bool copy = true; bool copy = true;
@@ -2228,7 +2230,6 @@ void sectionsd_getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventL
break; // sind nach serviceID und startzeit sortiert -> nicht weiter suchen break; // sind nach serviceID und startzeit sortiert -> nicht weiter suchen
} }
unlockEvents(); unlockEvents();
}
} }
/* send back the current and next event for the channel id passed to it /* send back the current and next event for the channel id passed to it
@@ -2242,7 +2243,7 @@ void sectionsd_getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventL
* TODO: the handling of "flag" should be vastly simplified. * TODO: the handling of "flag" should be vastly simplified.
*/ */
/* was: commandCurrentNextInfoChannelID */ /* was: commandCurrentNextInfoChannelID */
void sectionsd_getCurrentNextServiceKey(t_channel_id uniqueServiceKey, CSectionsdClient::responseGetCurrentNextInfoChannelID& current_next ) void CEitManager::getCurrentNextServiceKey(t_channel_id uniqueServiceKey, CSectionsdClient::responseGetCurrentNextInfoChannelID& current_next )
{ {
dprintf("[sectionsd] Request of current/next information for " PRINTF_CHANNEL_ID_TYPE "\n", uniqueServiceKey); dprintf("[sectionsd] Request of current/next information for " PRINTF_CHANNEL_ID_TYPE "\n", uniqueServiceKey);
@@ -2434,7 +2435,7 @@ void sectionsd_getCurrentNextServiceKey(t_channel_id uniqueServiceKey, CSections
} }
/* commandEPGepgIDshort */ /* commandEPGepgIDshort */
bool sectionsd_getEPGidShort(event_id_t epgID, CShortEPGData * epgdata) bool CEitManager::getEPGidShort(event_id_t epgID, CShortEPGData * epgdata)
{ {
bool ret = false; bool ret = false;
dprintf("Request of current EPG for 0x%llx\n", epgID); dprintf("Request of current EPG for 0x%llx\n", epgID);
@@ -2459,7 +2460,7 @@ bool sectionsd_getEPGidShort(event_id_t epgID, CShortEPGData * epgdata)
/*was getEPGid commandEPGepgID(int connfd, char *data, const unsigned dataLength) */ /*was getEPGid commandEPGepgID(int connfd, char *data, const unsigned dataLength) */
/* TODO item / itemDescription */ /* TODO item / itemDescription */
bool sectionsd_getEPGid(const event_id_t epgID, const time_t startzeit, CEPGData * epgdata) bool CEitManager::getEPGid(const event_id_t epgID, const time_t startzeit, CEPGData * epgdata)
{ {
bool ret = false; bool ret = false;
dprintf("Request of actual EPG for 0x%llx 0x%lx\n", epgID, startzeit); dprintf("Request of actual EPG for 0x%llx 0x%lx\n", epgID, startzeit);
@@ -2503,7 +2504,7 @@ bool sectionsd_getEPGid(const event_id_t epgID, const time_t startzeit, CEPGData
return ret; return ret;
} }
/* was commandActualEPGchannelID(int connfd, char *data, const unsigned dataLength) */ /* was commandActualEPGchannelID(int connfd, char *data, const unsigned dataLength) */
bool sectionsd_getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata) bool CEitManager::getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata)
{ {
bool ret = false; bool ret = false;
SIevent evt; SIevent evt;
@@ -2573,7 +2574,7 @@ bool channel_in_requested_list(t_channel_id * clist, t_channel_id chid, int len)
} }
/* was static void sendEventList(int connfd, const unsigned char serviceTyp1, const unsigned char serviceTyp2 = 0, int sendServiceName = 1, t_channel_id * chidlist = NULL, int clen = 0) */ /* was static void sendEventList(int connfd, const unsigned char serviceTyp1, const unsigned char serviceTyp2 = 0, int sendServiceName = 1, t_channel_id * chidlist = NULL, int clen = 0) */
void sectionsd_getChannelEvents(CChannelEventList &eList, const bool tv_mode = true, t_channel_id *chidlist = NULL, int clen = 0) void CEitManager::getChannelEvents(CChannelEventList &eList, const bool tv_mode, t_channel_id *chidlist, int clen)
{ {
clen = clen / sizeof(t_channel_id); clen = clen / sizeof(t_channel_id);
@@ -2632,7 +2633,7 @@ showProfiling("sectionsd_getChannelEvents end");
} }
/*was static void commandComponentTagsUniqueKey(int connfd, char *data, const unsigned dataLength) */ /*was static void commandComponentTagsUniqueKey(int connfd, char *data, const unsigned dataLength) */
bool sectionsd_getComponentTagsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::ComponentTagList& tags) bool CEitManager::getComponentTagsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::ComponentTagList& tags)
{ {
bool ret = false; bool ret = false;
dprintf("Request of ComponentTags for 0x%llx\n", uniqueKey); dprintf("Request of ComponentTags for 0x%llx\n", uniqueKey);
@@ -2662,7 +2663,7 @@ bool sectionsd_getComponentTagsUniqueKey(const event_id_t uniqueKey, CSectionsdC
} }
/* was static void commandLinkageDescriptorsUniqueKey(int connfd, char *data, const unsigned dataLength) */ /* was static void commandLinkageDescriptorsUniqueKey(int connfd, char *data, const unsigned dataLength) */
bool sectionsd_getLinkageDescriptorsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::LinkageDescriptorList& descriptors) bool CEitManager::getLinkageDescriptorsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::LinkageDescriptorList& descriptors)
{ {
bool ret = false; bool ret = false;
dprintf("Request of LinkageDescriptors for 0x%llx\n", uniqueKey); dprintf("Request of LinkageDescriptors for 0x%llx\n", uniqueKey);
@@ -2693,7 +2694,7 @@ bool sectionsd_getLinkageDescriptorsUniqueKey(const event_id_t uniqueKey, CSecti
} }
/* was static void commandTimesNVODservice(int connfd, char *data, const unsigned dataLength) */ /* was static void commandTimesNVODservice(int connfd, char *data, const unsigned dataLength) */
bool sectionsd_getNVODTimesServiceKey(const t_channel_id uniqueServiceKey, CSectionsdClient::NVODTimesList& nvod_list) bool CEitManager::getNVODTimesServiceKey(const t_channel_id uniqueServiceKey, CSectionsdClient::NVODTimesList& nvod_list)
{ {
bool ret = false; bool ret = false;
dprintf("Request of NVOD times for " PRINTF_CHANNEL_ID_TYPE "\n", uniqueServiceKey); dprintf("Request of NVOD times for " PRINTF_CHANNEL_ID_TYPE "\n", uniqueServiceKey);
@@ -2732,17 +2733,8 @@ bool sectionsd_getNVODTimesServiceKey(const t_channel_id uniqueServiceKey, CSect
return ret; return ret;
} }
void sectionsd_setPrivatePid(unsigned short /*pid*/) void CEitManager::setLanguages(const std::vector<std::string>& newLanguages)
{
}
void sectionsd_set_languages(const std::vector<std::string>& newLanguages)
{ {
SIlanguage::setLanguages(newLanguages); SIlanguage::setLanguages(newLanguages);
SIlanguage::saveLanguages(); SIlanguage::saveLanguages();
} }
bool sectionsd_isReady(void)
{
return sectionsd_ready;
}

View File

@@ -32,13 +32,6 @@
#include <OpenThreads/Condition> #include <OpenThreads/Condition>
#include <sectionsdclient/sectionsdclient.h> #include <sectionsdclient/sectionsdclient.h>
#include <connection/basicserver.h> #include <connection/basicserver.h>
#include "dmx.h"
//#include "SIutils.hpp"
//#include "SIservices.hpp"
//#include "SIevents.hpp"
//#include "SIsections.hpp"
//#include "SIlanguage.hpp"
class CEitManager : public OpenThreads::Thread, public OpenThreads::Mutex class CEitManager : public OpenThreads::Thread, public OpenThreads::Mutex
{ {
@@ -61,6 +54,17 @@ class CEitManager : public OpenThreads::Thread, public OpenThreads::Mutex
bool Start(); bool Start();
bool Stop(); bool Stop();
void SetConfig(CSectionsdClient::epg_config &cfg) { config = cfg; }; void SetConfig(CSectionsdClient::epg_config &cfg) { config = cfg; };
void getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventList &eList, char search = 0, std::string search_text = "");
void getCurrentNextServiceKey(t_channel_id uniqueServiceKey, CSectionsdClient::responseGetCurrentNextInfoChannelID& current_next );
bool getEPGidShort(event_id_t epgID, CShortEPGData * epgdata);
bool getEPGid(const event_id_t epgID, const time_t startzeit, CEPGData * epgdata);
bool getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata);
void getChannelEvents(CChannelEventList &eList, const bool tv_mode = true, t_channel_id *chidlist = NULL, int clen = 0);
bool getComponentTagsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::ComponentTagList& tags);
bool getLinkageDescriptorsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::LinkageDescriptorList& descriptors);
bool getNVODTimesServiceKey(const t_channel_id uniqueServiceKey, CSectionsdClient::NVODTimesList& nvod_list);
void setLanguages(const std::vector<std::string>& newLanguages);
}; };
#endif #endif