Ejemplo n.º 1
0
CChannelEventList CSectionsdClient::getEventsServiceKey(const t_channel_id channel_id)
{
	CChannelEventList eList;

	if (send(sectionsd::allEventsChannelID_, (char*)&channel_id, sizeof(channel_id)))
	{
		int nBufSize = readResponse();

		if( nBufSize > 0)
		{
			char* pData = new char[nBufSize];
			if (!receive_data(pData, nBufSize))
			{
				/* receive_data might have timed out etc. */
				delete[] pData;
				close_connection();
				return eList;
			}

			char* dp = pData;

			while(dp < pData + nBufSize)
			{
				CChannelEvent aEvent;

				aEvent.eventID = *((event_id_t *) dp);
				dp+=sizeof(aEvent.eventID);

				aEvent.startTime = *((time_t *) dp);
				dp+=sizeof(aEvent.startTime);

				aEvent.duration = *((unsigned *) dp);
				dp+=sizeof(aEvent.duration);

				aEvent.description= dp;
				dp+=strlen(dp)+1;

				aEvent.text= dp;
				dp+=strlen(dp)+1;

				eList.push_back(aEvent);
			}
			delete[] pData;
		}
	}

	close_connection();
	return eList;
}
Ejemplo n.º 2
0
/* This function does initiate a search for a keyword in all EPG Event of the Channel channel_id in sectionsd.
   The parameter search_typ does specify the search mode
	 0: none 			-> all EPG events of the channel are returned
	 1: keyword search in EPG Title
	 2: keyword search in EPG short description (INFO1)
	 3: keyword search in EPG description (INFO2)
  In case of a match, the EPG event is added to the Eventlist eList.
  */
bool CSectionsdClient::getEventsServiceKeySearchAdd(CChannelEventList& eList,const t_channel_id channel_id,char search_typ,std::string& search_text)
{
	int nBufSize=0;

	nBufSize += sizeof(t_channel_id);
	nBufSize += sizeof(char);
	nBufSize += search_text.size()+1;

	char* pSData = new char[nBufSize];
	char* pSData_ptr = pSData;

	*(t_channel_id*)pSData_ptr = channel_id;
	pSData_ptr += sizeof(t_channel_id);
	*pSData_ptr = search_typ;
	pSData_ptr += sizeof(char);
	strcpy(pSData_ptr,search_text.c_str());

	if (send(sectionsd::allEventsChannelIDSearch, pSData, nBufSize))
	{
		int nBufSize2 = readResponse();

		if( nBufSize2 > 0)
		{
			char* pData = new char[nBufSize2];
			receive_data(pData, nBufSize2);

			char* dp = pData;

//			int a = eList.size();

			while(dp < pData + nBufSize2)
			{
				CChannelEvent aEvent;

				aEvent.eventID = *((event_id_t *) dp);
				dp+=sizeof(aEvent.eventID);

				aEvent.startTime = *((time_t *) dp);
				dp+=sizeof(aEvent.startTime);

				aEvent.duration = *((unsigned *) dp);
				dp+=sizeof(aEvent.duration);

				aEvent.description= dp;
				dp+=aEvent.description.length()+1;

				aEvent.text= dp;
				dp+=aEvent.text.length()+1;

				eList.push_back(aEvent);
			}
//			int b = eList.size() -a;
			delete[] pData;
		}
	}
	delete[] pSData;

	close_connection();
	return true;
}
Ejemplo n.º 3
0
CChannelEventList CSectionsdClient::getChannelEvents(const bool tv_mode, t_channel_id *p_requested_channels, int size_requested_channels)
{
	CChannelEventList eList;

	if (send(tv_mode ? sectionsd::actualEventListTVshortIDs : sectionsd::actualEventListRadioShortIDs, (char*)p_requested_channels, size_requested_channels))
	{
		int nBufSize = readResponse();

		if( nBufSize > 0)
		{
			char* pData = new char[nBufSize];
			if (!receive_data(pData, nBufSize)) 
			{
				delete[] pData;
				close_connection();
				return eList;
			}

			char* dp = pData;

			while(dp < pData + nBufSize)
			{
				CChannelEvent aEvent;

				aEvent.eventID = *((event_id_t *) dp);
				dp+=sizeof(aEvent.eventID);

				aEvent.startTime = *((time_t *) dp);
				dp+=sizeof(aEvent.startTime);

				aEvent.duration = *((unsigned *) dp);
				dp+=sizeof(aEvent.duration);

				aEvent.description= dp;
				dp+=strlen(dp)+1;

				aEvent.text= dp;
				dp+=strlen(dp)+1;

				eList.push_back(aEvent);
			}
			delete[] pData;
		}
	}
	close_connection();
	return eList;
}
Ejemplo n.º 4
0
CChannelEventList CSectionsdClient::getChannelEvents()
{
	CChannelEventList eList;

	if (send(sectionsd::actualEventListTVshortIDs))
	{
		int nBufSize = readResponse();

		if( nBufSize > 0)
		{
			char* pData = new char[nBufSize];
			receive_data(pData, nBufSize);

			char* dp = pData;

			while(dp < pData + nBufSize)
			{
				CChannelEvent aEvent;

				aEvent.eventID = *((unsigned long long *) dp);
				dp+=sizeof(aEvent.eventID);

				aEvent.startTime = *((time_t *) dp);
				dp+=sizeof(aEvent.startTime);

				aEvent.duration = *((unsigned *) dp);
				dp+=sizeof(aEvent.duration);

				aEvent.description= dp;
				dp+=strlen(dp)+1;

				aEvent.text= dp;
				dp+=strlen(dp)+1;

				eList.push_back(aEvent);
			}
			delete[] pData;
		}
	}
	close_connection();
	return eList;
}
Ejemplo n.º 5
0
void CAdZapMenu::Settings()
{
    CChannelList *channelList = CNeutrinoApp::getInstance()->channelList;
    channelId =
	channelList ? channelList->getActiveChannel_ChannelID() : -1;
    if (channelId < 0)
	return;
    channelName = channelList->getActiveChannelName();

    CMenuWidget *menu =
	new CMenuWidget(LOCALE_ADZAP, "settings", width);
    menu->addItem(new
		  CMenuSeparator(CMenuSeparator::LINE |
				 CMenuSeparator::STRING,
				 LOCALE_ADZAP_SWITCHBACK));
    neutrino_locale_t minute = LOCALE_ADZAP_MINUTE;
    for (int shortcut = 1; shortcut < 10; shortcut++) {
	char actionKey[2];
	actionKey[0] = '0' + shortcut;
	actionKey[1] = 0;
	bool selected = g_settings.adzap_zapBackPeriod == 60 * shortcut;
	menu->addItem(new
		      CMenuForwarder(minute, true, "", this, actionKey,
				     CRCInput::convertDigitToKey
				     (shortcut)), selected);
	minute = LOCALE_ADZAP_MINUTES;
    }

    menu->addItem(new
		  CMenuSeparator(CMenuSeparator::LINE |
				 CMenuSeparator::STRING,
				 LOCALE_ADZAP_COMMIT));
    menu->addItem(new
		  CMenuForwarder(LOCALE_ADZAP_ENABLE, true, "", this,
				 "enable", CRCInput::RC_green,
				 NEUTRINO_ICON_BUTTON_GREEN));
    menu->addItem(new
		  CMenuForwarder(LOCALE_ADZAP_DISABLE, true, "", this,
				 "disable", CRCInput::RC_red,
				 NEUTRINO_ICON_BUTTON_RED));

    CChannelEventList evtlist;
    sectionsd_getEventsServiceKey(azm->channelId & 0xFFFFFFFFFFFFULL,
				  evtlist);
    azm->monitorLifeTime.tv_sec = 0;
    if (!evtlist.empty()) {
	sort(evtlist.begin(), evtlist.end(), sortByDateTime);
	CChannelEventList::iterator eli;
	struct timespec ts;
	clock_gettime(CLOCK_REALTIME, &ts);
	for (eli = evtlist.begin(); eli != evtlist.end(); ++eli) {
	    if ((uint) eli->startTime + eli->duration > ts.tv_sec) {
		azm->monitorLifeTime.tv_sec =
		    (uint) eli->startTime + eli->duration;
		azm->Update();
		break;
	    }
	}
    }

    menu->addItem(new
		  CMenuForwarder(LOCALE_ADZAP_MONITOR,
				 azm->monitorLifeTime.tv_sec, "", this,
				 "monitor", CRCInput::RC_blue,
				 NEUTRINO_ICON_BUTTON_BLUE));

    monitor = false;
    menu->exec(NULL, "");
    menu->hide();
    delete menu;
    Update();
}