Exemplo n.º 1
0
bool cDvbCi::SendCaPMT(CCaPmt *caPmt, int source)
{
	printf("%s:%s\n", FILENAME, __FUNCTION__);

	std::list<tSlot*>::iterator it;

        for(it = slot_data.begin(); it != slot_data.end(); it++)
        {
		//FIXME: ask cammanagr if module can handle this caids
		if (((*it)->fd > 0) && ((*it)->camIsReady)) 
		{
			unsigned int size = caPmt->getLength();
			
			unsigned char buffer[3 + get_length_field_size(size) + size];
			
			// get len and fill buffer
			printf(" %d, %d\n", get_length_field_size(size), size);
			int len = caPmt->writeToBuffer(buffer, 0, 0xff);

			dprintf(DEBUG_NORMAL, "capmt(%d): > \n", len);

			if ((*it)->hasCAManager)
				(*it)->camgrSession->sendSPDU(0x90, 0, 0, buffer, len);
			
			//set source
			setSource((*it)->slot, source);
		}
               
		/* konfetti: if cam is not ready we must store caPmt too, because
		* changing the slot should also descramble the channel
		*/
		if ((*it)->fd > 0) 
		{
			//FIXME: hmmm is this a copy or did I only save the pointer.
			//in copy case I must do some delete etc before if set and in destruct case
			(*it)->caPmt = caPmt;
			(*it)->source = source;
		}
	}
	
        return true;
}
Exemplo n.º 2
0
bool CCam::setCaPmt(CCaPmt * const caPmt, int demux, int camask, bool update)
{
	if (!caPmt)
		return true;

	printf("CCam::setCaPmt: dmx %d camask %d update %s\n", demux, camask, update ? "yes" : "no" );
	
	unsigned int size = caPmt->getLength();
	unsigned char buffer[3 + get_length_field_size(size) + size];
	size_t pos = caPmt->writeToBuffer(buffer, demux, camask);

	return sendMessage((char *)buffer, pos, update);
}