예제 #1
0
bool CSectionsdClient::getEPGid(const event_id_t eventid, const time_t starttime, CEPGData * epgdata)
{
	sectionsd::commandGetEPGid msg;

	msg.eventid   = eventid;
	msg.starttime = starttime; 

	if (send(sectionsd::epgEPGid, (char *)&msg, sizeof(msg)))
	{
		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 false;
			}
			close_connection();

			char* dp = pData;

			epgdata->eventID = *((event_id_t *)dp);
			dp+= sizeof(epgdata->eventID);

			epgdata->title = dp;
			dp+=strlen(dp)+1;
			epgdata->info1 = dp;
			dp+=strlen(dp)+1;
			epgdata->info2 = dp;
			dp+=strlen(dp)+1;
			// 21.07.2005 - rainerk
			// Convert line-terminated extended events to vector of strings
			dp = parseExtendedEvents(dp, epgdata);

			// *dp is the length, dp+1 is the chararray[]
			epgdata->contentClassification = std::string(dp+1, *dp);
			dp+=*dp+1;
			epgdata->userClassification = std::string(dp+1, *dp);
			dp+=*dp+1;

			epgdata->fsk = *dp++;

			epgdata->epg_times.startzeit = ((CSectionsdClient::sectionsdTime *) dp)->startzeit;
			epgdata->epg_times.dauer = ((CSectionsdClient::sectionsdTime *) dp)->dauer;
			dp+= sizeof(CSectionsdClient::sectionsdTime);

			delete[] pData;
			return true;
		}
		else
			printf("no response from sectionsd\n");
	}

	close_connection();

	return false;
}
예제 #2
0
bool CSectionsdClient::getActualEPGServiceKey(const t_channel_id channel_id, CEPGData * epgdata)
{
	epgdata->title = "";

	if (send(sectionsd::actualEPGchannelID, (char*)&channel_id, sizeof(channel_id)))
	{
		int nBufSize = readResponse();
		if( nBufSize > 0)
		{
			char* pData = new char[nBufSize];
			receive_data(pData, nBufSize);
			close_connection();

			char* dp = pData;

			epgdata->eventID = *((event_id_t *)dp);
			dp+= sizeof(epgdata->eventID);

			epgdata->title = dp;
			dp+=strlen(dp)+1;
			epgdata->info1 = dp;
			dp+=strlen(dp)+1;
			epgdata->info2 = dp;
			dp+=strlen(dp)+1;
			// 21.07.2005 - rainerk
			// Convert line-terminated extended events to vector of strings
			//showhexdumpa("Data:", (unsigned char *)pData, nBufSize);
			dp = parseExtendedEvents(dp, epgdata);

			// *dp is the length, dp+1 is the chararray[]
			epgdata->contentClassification = std::string(dp+1, *dp);
			dp+=*dp+1;
			epgdata->userClassification = std::string(dp+1, *dp);
			dp+=*dp+1;

			epgdata->fsk = *dp++;

			epgdata->epg_times.startzeit = ((CSectionsdClient::sectionsdTime *) dp)->startzeit;
			epgdata->epg_times.dauer = ((CSectionsdClient::sectionsdTime *) dp)->dauer;
			dp+= sizeof(CSectionsdClient::sectionsdTime);

			delete[] pData;
			return true;
		}
		else
			printf("[sectionsdclient] no response from sectionsd\n");
	}

	close_connection();

	return false;
}