vdr  1.7.31
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
cCamSlot Class Reference

#include <ci.h>

Public Member Functions

 cCamSlot (cCiAdapter *CiAdapter)
virtual ~cCamSlot ()
bool Assign (cDevice *Device, bool Query=false)
cDeviceDevice (void)
int SlotIndex (void)
int SlotNumber (void)
bool Reset (void)
eModuleStatus ModuleStatus (void)
const char * GetCamName (void)
bool Ready (void)
bool HasMMI (void)
bool HasUserIO (void)
bool EnterMenu (void)
cCiMenuGetMenu (void)
cCiEnquiryGetEnquiry (void)
int Priority (void)
bool ProvidesCa (const int *CaSystemIds)
void AddPid (int ProgramNumber, int Pid, int StreamType)
void SetPid (int Pid, bool Active)
void AddChannel (const cChannel *Channel)
bool CanDecrypt (const cChannel *Channel)
void StartDecrypting (void)
void StopDecrypting (void)
bool IsDecrypting (void)
 cCamSlot (cCiAdapter *CiAdapter)
virtual ~cCamSlot ()
bool Assign (cDevice *Device, bool Query=false)
cDeviceDevice (void)
int SlotIndex (void)
int SlotNumber (void)
bool Reset (void)
eModuleStatus ModuleStatus (void)
const char * GetCamName (void)
bool Ready (void)
bool HasMMI (void)
bool HasUserIO (void)
bool EnterMenu (void)
cCiMenuGetMenu (void)
cCiEnquiryGetEnquiry (void)
int Priority (void)
bool ProvidesCa (const int *CaSystemIds)
void AddPid (int ProgramNumber, int Pid, int StreamType)
void SetPid (int Pid, bool Active)
void AddChannel (const cChannel *Channel)
bool CanDecrypt (const cChannel *Channel)
void StartDecrypting (void)
void StopDecrypting (void)
bool IsDecrypting (void)
- Public Member Functions inherited from cListObject
 cListObject (void)
virtual ~cListObject ()
virtual int Compare (const cListObject &ListObject) const
void Append (cListObject *Object)
void Insert (cListObject *Object)
void Unlink (void)
int Index (void) const
cListObjectPrev (void) const
cListObjectNext (void) const
 cListObject (void)
virtual ~cListObject ()
virtual int Compare (const cListObject &ListObject) const
void Append (cListObject *Object)
void Insert (cListObject *Object)
void Unlink (void)
int Index (void) const
cListObjectPrev (void) const
cListObjectNext (void) const

Private Member Functions

const int * GetCaSystemIds (void)
void SendCaPmt (uint8_t CmdId)
void NewConnection (void)
void DeleteAllConnections (void)
void Process (cTPDU *TPDU=NULL)
void Write (cTPDU *TPDU)
cCiSessionGetSessionByResourceId (uint32_t ResourceId)
const int * GetCaSystemIds (void)
void SendCaPmt (uint8_t CmdId)
void NewConnection (void)
void DeleteAllConnections (void)
void Process (cTPDU *TPDU=NULL)
void Write (cTPDU *TPDU)
cCiSessionGetSessionByResourceId (uint32_t ResourceId)

Private Attributes

cMutex mutex
cCondVar processed
cCiAdapterciAdapter
int slotIndex
int slotNumber
cCiTransportConnectiontc [MAX_CONNECTIONS_PER_CAM_SLOT+1]
eModuleStatus lastModuleStatus
time_t resetTime
cTimeMs moduleCheckTimer
bool resendPmt
int source
int transponder
cList< cCiCaProgramDatacaProgramList

Friends

class cCiAdapter
class cCiTransportConnection

Detailed Description

Definition at line 125 of file ci.h.

Constructor & Destructor Documentation

cCamSlot::cCamSlot ( cCiAdapter CiAdapter)

Creates a new CAM slot for the given CiAdapter.

The CiAdapter will take care of deleting the CAM slot, so the caller must not delete it!

Definition at line 1555 of file ci.c.

References cListBase::Add(), cCiAdapter::AddCamSlot(), ciAdapter, cListObject::Index(), lastModuleStatus, MAX_CONNECTIONS_PER_CAM_SLOT, msReset, resendPmt, Reset(), resetTime, slotIndex, slotNumber, source, tc, and transponder.

cCamSlot::~cCamSlot ( )
virtual

Definition at line 1572 of file ci.c.

References cListBase::Del(), and DeleteAllConnections().

cCamSlot::cCamSlot ( cCiAdapter CiAdapter)

Creates a new CAM slot for the given CiAdapter.

The CiAdapter will take care of deleting the CAM slot, so the caller must not delete it!

virtual cCamSlot::~cCamSlot ( )
virtual

Member Function Documentation

void cCamSlot::AddChannel ( const cChannel Channel)

Adds all PIDs if the given Channel to the current list of PIDs.

If the source or transponder of the channel are different than what was given in a previous call to AddChannel(), any previously added PIDs will be cleared.

Definition at line 1902 of file ci.c.

References AddPid(), cChannel::Apids(), cChannel::Ca(), CA_ENCRYPTED_MIN, cChannel::Dpids(), mutex, Setup, cChannel::Sid(), source, cChannel::Source(), cChannel::Spids(), StopDecrypting(), STREAM_TYPE_AUDIO, STREAM_TYPE_PRIVATE, STREAM_TYPE_VIDEO, cSetup::SupportTeletext, cChannel::Tpid(), transponder, cChannel::Transponder(), and cChannel::Vpid().

Referenced by cDevice::SetChannel().

void cCamSlot::AddChannel ( const cChannel Channel)

Adds all PIDs if the given Channel to the current list of PIDs.

If the source or transponder of the channel are different than what was given in a previous call to AddChannel(), any previously added PIDs will be cleared.

void cCamSlot::AddPid ( int  ProgramNumber,
int  Pid,
int  StreamType 
)

Adds the given PID information to the list of PIDs.

A later call to SetPid() will (de)activate one of these entries.

Definition at line 1863 of file ci.c.

References cListBase::Add(), caProgramList, cList< T >::First(), mutex, cListObject::Next(), cList< T >::Next(), and cCiCaProgramData::pidList.

Referenced by AddChannel().

void cCamSlot::AddPid ( int  ProgramNumber,
int  Pid,
int  StreamType 
)

Adds the given PID information to the list of PIDs.

A later call to SetPid() will (de)activate one of these entries.

bool cCamSlot::Assign ( cDevice Device,
bool  Query = false 
)

Assigns this CAM slot to the given Device, if this is possible.

If Query is 'true', the CI adapter of this slot only checks whether it can be assigned to the Device, but doesn't actually assign itself to it. Returns true if this slot can be assigned to the Device. If Device is NULL, the slot will be unassigned from any device it was previously assigned to. The value of Query is ignored in that case, and this function always returns 'true'.

Definition at line 1578 of file ci.c.

References cCiAdapter::Assign(), cCiAdapter::assignedDevice, ciAdapter, Device(), cDevice::DeviceNumber(), dsyslog, mutex, cDevice::SetCamSlot(), slotNumber, source, StopDecrypting(), and transponder.

Referenced by cDevice::GetDevice().

bool cCamSlot::Assign ( cDevice Device,
bool  Query = false 
)

Assigns this CAM slot to the given Device, if this is possible.

If Query is 'true', the CI adapter of this slot only checks whether it can be assigned to the Device, but doesn't actually assign itself to it. Returns true if this slot can be assigned to the Device. If Device is NULL, the slot will be unassigned from any device it was previously assigned to. The value of Query is ignored in that case, and this function always returns 'true'.

bool cCamSlot::CanDecrypt ( const cChannel Channel)

Returns true if there is a CAM in this slot that is able to decrypt the given Channel (or at least claims to be able to do so).

Since the QUERY/REPLY mechanism for CAMs is pretty unreliable (some CAMs don't reply to queries at all), we always return true if the CAM is currently not decrypting anything. If there is already a channel being decrypted, a call to CanDecrypt() checks whether the CAM can also decrypt the given channel. Only CAMs that have replied to the initial QUERY will perform this check at all. CAMs that never replied to the initial QUERY are assumed not to be able to handle more than one channel at a time.

Definition at line 1924 of file ci.c.

References cChannel::Apids(), cChannel::Ca(), CA_ENCRYPTED_MIN, cCiConditionalAccessSupport::CanDecrypt(), CPCI_QUERY, CPLM_ADD, cChannel::Dpids(), dsyslog, GetCaSystemIds(), GetSessionByResourceId(), IsDecrypting(), mutex, processed, QUERY_REPLY_TIMEOUT, QUERY_REPLY_WAIT, cCiConditionalAccessSupport::ReceivedReply(), cCiConditionalAccessSupport::RepliesToQuery(), RI_CONDITIONAL_ACCESS_SUPPORT, cCiConditionalAccessSupport::SendPMT(), cCiCaPmt::SetListManagement(), Setup, cChannel::Sid(), SlotNumber(), cChannel::Source(), cChannel::Spids(), STREAM_TYPE_AUDIO, STREAM_TYPE_PRIVATE, STREAM_TYPE_VIDEO, cSetup::SupportTeletext, cTimeMs::TimedOut(), cCondVar::TimedWait(), cChannel::Tpid(), cChannel::Transponder(), and cChannel::Vpid().

Referenced by cDvbDevice::ProvidesChannel().

bool cCamSlot::CanDecrypt ( const cChannel Channel)

Returns true if there is a CAM in this slot that is able to decrypt the given Channel (or at least claims to be able to do so).

Since the QUERY/REPLY mechanism for CAMs is pretty unreliable (some CAMs don't reply to queries at all), we always return true if the CAM is currently not decrypting anything. If there is already a channel being decrypted, a call to CanDecrypt() checks whether the CAM can also decrypt the given channel. Only CAMs that have replied to the initial QUERY will perform this check at all. CAMs that never replied to the initial QUERY are assumed not to be able to handle more than one channel at a time.

void cCamSlot::DeleteAllConnections ( void  )
private
void cCamSlot::DeleteAllConnections ( void  )
private

Definition at line 1630 of file ci.c.

References MAX_CONNECTIONS_PER_CAM_SLOT, mutex, and tc.

Referenced by Process(), Reset(), and ~cCamSlot().

cDevice * cCamSlot::Device ( void  )

Returns the device this CAM slot is currently assigned to.

Definition at line 1606 of file ci.c.

References cCiAdapter::assignedDevice, cDevice::CamSlot(), ciAdapter, and mutex.

Referenced by Assign(), cDevice::GetDevice(), Priority(), and cMenuSetupCAM::Reset().

cDevice* cCamSlot::Device ( void  )

Returns the device this CAM slot is currently assigned to.

bool cCamSlot::EnterMenu ( void  )

Requests the CAM in this slot to start its menu.

Definition at line 1763 of file ci.c.

References cCiApplicationInformation::EnterMenu(), GetSessionByResourceId(), mutex, and RI_APPLICATION_INFORMATION.

Referenced by cMenuSetupCAM::Menu().

bool cCamSlot::EnterMenu ( void  )

Requests the CAM in this slot to start its menu.

const char* cCamSlot::GetCamName ( void  )

Returns the name of the CAM in this slot, or NULL if there is no ready CAM in this slot.

const char * cCamSlot::GetCamName ( void  )

Returns the name of the CAM in this slot, or NULL if there is no ready CAM in this slot.

Definition at line 1740 of file ci.c.

References cCiTransportConnection::GetCamName(), mutex, and tc.

Referenced by cMenuSetupCAMItem::Changed(), and cMenuCam::GenerateTitle().

const int * cCamSlot::GetCaSystemIds ( void  )
private
const int* cCamSlot::GetCaSystemIds ( void  )
private
cCiEnquiry * cCamSlot::GetEnquiry ( void  )

Gets a pending enquiry, or NULL if there is no enquiry.

Definition at line 1783 of file ci.c.

References cCiMMI::Enquiry(), GetSessionByResourceId(), cCiEnquiry::mutex, mutex, and RI_MMI.

Referenced by cMenuCam::QueryCam().

cCiEnquiry* cCamSlot::GetEnquiry ( void  )

Gets a pending enquiry, or NULL if there is no enquiry.

cCiMenu * cCamSlot::GetMenu ( void  )

Gets a pending menu, or NULL if there is no menu.

Definition at line 1770 of file ci.c.

References GetSessionByResourceId(), cCiMMI::Menu(), cCiMenu::mutex, mutex, and RI_MMI.

Referenced by cMenuCam::QueryCam().

cCiMenu* cCamSlot::GetMenu ( void  )

Gets a pending menu, or NULL if there is no menu.

cCiSession* cCamSlot::GetSessionByResourceId ( uint32_t  ResourceId)
private
cCiSession * cCamSlot::GetSessionByResourceId ( uint32_t  ResourceId)
private
bool cCamSlot::HasMMI ( void  )

Returns 'true' if the CAM in this slot has an active MMI.

Definition at line 1752 of file ci.c.

References GetSessionByResourceId(), and RI_MMI.

Referenced by cMenuCam::ProcessKey().

bool cCamSlot::HasMMI ( void  )

Returns 'true' if the CAM in this slot has an active MMI.

bool cCamSlot::HasUserIO ( void  )

Returns true if there is a pending user interaction, which shall be retrieved via GetMenu() or GetEnquiry().

Definition at line 1757 of file ci.c.

References cCiTransportConnection::HasUserIO(), mutex, and tc.

Referenced by cMenuSetupCAM::Menu(), and cMenuCam::QueryCam().

bool cCamSlot::HasUserIO ( void  )

Returns true if there is a pending user interaction, which shall be retrieved via GetMenu() or GetEnquiry().

bool cCamSlot::IsDecrypting ( void  )

Returns true if the CAM in this slot is currently used for decrypting.

Definition at line 1975 of file ci.c.

References caProgramList, cListBase::Count(), cList< T >::First(), mutex, cListObject::Next(), and cList< T >::Next().

Referenced by CanDecrypt(), and cDevice::GetDevice().

bool cCamSlot::IsDecrypting ( void  )

Returns true if the CAM in this slot is currently used for decrypting.

eModuleStatus cCamSlot::ModuleStatus ( void  )

Returns the status of the CAM in this slot.

eModuleStatus cCamSlot::ModuleStatus ( void  )

Returns the status of the CAM in this slot.

Definition at line 1726 of file ci.c.

References ciAdapter, MODULE_RESET_TIMEOUT, cCiAdapter::ModuleStatus(), msNone, msReset, mutex, resetTime, and slotIndex.

Referenced by cMenuSetupCAMItem::Changed(), cDevice::GetDevice(), Process(), and Ready().

void cCamSlot::NewConnection ( void  )
private
void cCamSlot::NewConnection ( void  )
private
int cCamSlot::Priority ( void  )

Returns the priority if the device this slot is currently assigned to, or IDLEPRIORITY if it is not assigned to any device.

Definition at line 1842 of file ci.c.

References Device(), IDLEPRIORITY, and cDevice::Priority().

Referenced by cDevice::GetDevice().

int cCamSlot::Priority ( void  )

Returns the priority if the device this slot is currently assigned to, or IDLEPRIORITY if it is not assigned to any device.

void cCamSlot::Process ( cTPDU TPDU = NULL)
private
void cCamSlot::Process ( cTPDU TPDU = NULL)
private
bool cCamSlot::ProvidesCa ( const int *  CaSystemIds)

Returns true if the CAM in this slot provides one of the given CaSystemIds.

This doesn't necessarily mean that it will be possible to actually decrypt such a programme, since CAMs usually advertise several CA system ids, while the actual decryption is controlled by the smart card inserted into the CAM.

Definition at line 1848 of file ci.c.

References cCiConditionalAccessSupport::GetCaSystemIds(), GetSessionByResourceId(), mutex, and RI_CONDITIONAL_ACCESS_SUPPORT.

Referenced by cDevice::GetDevice().

bool cCamSlot::ProvidesCa ( const int *  CaSystemIds)

Returns true if the CAM in this slot provides one of the given CaSystemIds.

This doesn't necessarily mean that it will be possible to actually decrypt such a programme, since CAMs usually advertise several CA system ids, while the actual decryption is controlled by the smart card inserted into the CAM.

bool cCamSlot::Ready ( void  )

Returns 'true' if the CAM in this slot is ready to decrypt.

bool cCamSlot::Ready ( void  )

Returns 'true' if the CAM in this slot is ready to decrypt.

Definition at line 1746 of file ci.c.

References ModuleStatus(), msNone, mutex, cCiTransportConnection::Ready(), and tc.

bool cCamSlot::Reset ( void  )

Resets the CAM in this slot.

Returns true if the operation was successful.

bool cCamSlot::Reset ( void  )

Resets the CAM in this slot.

Returns true if the operation was successful.

Definition at line 1708 of file ci.c.

References ChannelCamRelations, ciAdapter, dbgprotocol, DeleteAllConnections(), lastModuleStatus, msReset, mutex, cCiAdapter::Reset(), cChannelCamRelations::Reset(), resetTime, slotIndex, and slotNumber.

Referenced by cCamSlot(), Process(), and cMenuSetupCAM::Reset().

void cCamSlot::SendCaPmt ( uint8_t  CmdId)
private
void cCamSlot::SendCaPmt ( uint8_t  CmdId)
private
void cCamSlot::SetPid ( int  Pid,
bool  Active 
)

Sets the given Pid (which has previously been added through a call to AddPid()) to Active.

A later call to StartDecrypting() will send the full list of currently active CA_PMT entries to the CAM.

Definition at line 1881 of file ci.c.

References caProgramList, cList< T >::First(), mutex, cListObject::Next(), and cList< T >::Next().

Referenced by cDevice::AddPid(), cDevice::DelPid(), cDvbHdFfDevice::SetAudioTrackDevice(), and cDvbSdFfDevice::SetAudioTrackDevice().

void cCamSlot::SetPid ( int  Pid,
bool  Active 
)

Sets the given Pid (which has previously been added through a call to AddPid()) to Active.

A later call to StartDecrypting() will send the full list of currently active CA_PMT entries to the CAM.

int cCamSlot::SlotIndex ( void  )
inline

Returns the index of this CAM slot within its CI adapter.

The first slot has an index of 0.

Definition at line 166 of file ci.h.

References slotIndex.

Referenced by cCiTransportConnection::cCiTransportConnection(), cCiTransportConnection::CloseSession(), cCiTransportConnection::HandleSessions(), cCiTransportConnection::OpenSession(), cCiTransportConnection::Process(), and cCiTransportConnection::SendTPDU().

int cCamSlot::SlotIndex ( void  )
inline

Returns the index of this CAM slot within its CI adapter.

The first slot has an index of 0.

Definition at line 166 of file include/vdr/ci.h.

References slotIndex.

int cCamSlot::SlotNumber ( void  )
inline

Returns the number of this CAM slot within the whole system.

The first slot has the number 1.

Definition at line 169 of file include/vdr/ci.h.

References slotNumber.

int cCamSlot::SlotNumber ( void  )
inline
void cCamSlot::StartDecrypting ( void  )

Triggers sending all currently active CA_PMT entries to the CAM, so that it will start decrypting.

Definition at line 1961 of file ci.c.

References CPCI_OK_DESCRAMBLING, and SendCaPmt().

Referenced by cDevice::AttachReceiver(), cDevice::Detach(), cDvbHdFfDevice::SetAudioTrackDevice(), cDvbSdFfDevice::SetAudioTrackDevice(), and cDevice::SetChannel().

void cCamSlot::StartDecrypting ( void  )

Triggers sending all currently active CA_PMT entries to the CAM, so that it will start decrypting.

void cCamSlot::StopDecrypting ( void  )

Clears the list of CA_PMT entries and tells the CAM to stop decrypting.

void cCamSlot::StopDecrypting ( void  )

Clears the list of CA_PMT entries and tells the CAM to stop decrypting.

Definition at line 1966 of file ci.c.

References caProgramList, cListBase::Clear(), cListBase::Count(), CPCI_NOT_SELECTED, mutex, and SendCaPmt().

Referenced by AddChannel(), and Assign().

void cCamSlot::Write ( cTPDU TPDU)
private
void cCamSlot::Write ( cTPDU TPDU)
private

Friends And Related Function Documentation

cCiAdapter
friend

Definition at line 126 of file ci.h.

Definition at line 127 of file ci.h.

Referenced by NewConnection().

Member Data Documentation

cList< cCiCaProgramData > cCamSlot::caProgramList
private

Definition at line 141 of file ci.h.

Referenced by AddPid(), IsDecrypting(), Process(), SendCaPmt(), SetPid(), and StopDecrypting().

cCiAdapter * cCamSlot::ciAdapter
private

Definition at line 131 of file ci.h.

Referenced by Assign(), cCamSlot(), Device(), ModuleStatus(), Reset(), and Write().

eModuleStatus cCamSlot::lastModuleStatus
private

Definition at line 135 of file ci.h.

Referenced by cCamSlot(), Process(), and Reset().

cTimeMs cCamSlot::moduleCheckTimer
private

Definition at line 137 of file ci.h.

Referenced by Process().

cMutex cCamSlot::mutex
private
cCondVar cCamSlot::processed
private

Definition at line 130 of file ci.h.

Referenced by CanDecrypt(), and Process().

bool cCamSlot::resendPmt
private

Definition at line 138 of file ci.h.

Referenced by cCamSlot(), Process(), and SendCaPmt().

time_t cCamSlot::resetTime
private

Definition at line 136 of file ci.h.

Referenced by cCamSlot(), ModuleStatus(), and Reset().

int cCamSlot::slotIndex
private

Definition at line 132 of file ci.h.

Referenced by cCiAdapter::AddCamSlot(), cCamSlot(), ModuleStatus(), Reset(), and SlotIndex().

int cCamSlot::slotNumber
private

Definition at line 133 of file ci.h.

Referenced by Assign(), cCamSlot(), NewConnection(), Process(), Reset(), and SlotNumber().

int cCamSlot::source
private

Definition at line 139 of file ci.h.

Referenced by AddChannel(), Assign(), cCamSlot(), and SendCaPmt().

cCiTransportConnection * cCamSlot::tc
private
int cCamSlot::transponder
private

Definition at line 140 of file ci.h.

Referenced by AddChannel(), Assign(), cCamSlot(), and SendCaPmt().


The documentation for this class was generated from the following files: