cCamSlot Class Reference

#include <ci.h>

Inheritance diagram for cCamSlot:

Inheritance graph
[legend]
Collaboration diagram for cCamSlot:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 cCamSlot (cCiAdapter *CiAdapter)
virtual ~cCamSlot ()
bool Assign (cDevice *Device, bool Query=false)
cDeviceDevice (void)
 Returns the device this CAM slot is currently assigned to.
int SlotIndex (void)
int SlotNumber (void)
bool Reset (void)
eModuleStatus ModuleStatus (void)
 Returns the status of the CAM in this slot.
const char * GetCamName (void)
bool Ready (void)
 Returns 'true' if the CAM in this slot is ready to decrypt.
bool HasMMI (void)
 Returns 'true' if the CAM in this slot has an active MMI.
bool HasUserIO (void)
bool EnterMenu (void)
 Requests the CAM in this slot to start its menu.
cCiMenuGetMenu (void)
 Gets a pending menu, or NULL if there is no menu.
cCiEnquiryGetEnquiry (void)
 Gets a pending enquiry, or NULL if there is no enquiry.
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)
 Clears the list of CA_PMT entries and tells the CAM to stop decrypting.
bool IsDecrypting (void)
 Returns true if the CAM in this slot is currently used for decrypting.

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)

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 1531 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.

Here is the call graph for this function:

cCamSlot::~cCamSlot (  )  [virtual]

Definition at line 1548 of file ci.c.

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

Here is the call graph for this function:


Member Function Documentation

const int * cCamSlot::GetCaSystemIds ( void   )  [private]

Definition at line 1808 of file ci.c.

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

Referenced by CanDecrypt().

Here is the call graph for this function:

void cCamSlot::SendCaPmt ( uint8_t  CmdId  )  [private]

void cCamSlot::NewConnection ( void   )  [private]

Definition at line 1593 of file ci.c.

References cCiTransportConnection, cCiTransportConnection::CreateConnection(), esyslog, MAX_CONNECTIONS_PER_CAM_SLOT, mutex, slotNumber, and tc.

Referenced by Process().

Here is the call graph for this function:

void cCamSlot::DeleteAllConnections ( void   )  [private]

Definition at line 1606 of file ci.c.

References MAX_CONNECTIONS_PER_CAM_SLOT, mutex, and tc.

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

void cCamSlot::Process ( cTPDU TPDU = NULL  )  [private]

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

Definition at line 1673 of file ci.c.

References cTPDU::Buffer(), ciAdapter, cTPDU::Dump(), mutex, cTPDU::Size(), SlotNumber(), and cCiAdapter::Write().

Referenced by cCiTransportConnection::SendTPDU().

Here is the call graph for this function:

cCiSession * cCamSlot::GetSessionByResourceId ( uint32_t  ResourceId  )  [private]

Definition at line 1667 of file ci.c.

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

Referenced by CanDecrypt(), EnterMenu(), GetCaSystemIds(), GetEnquiry(), GetMenu(), HasMMI(), ProvidesCa(), and SendCaPmt().

Here is the call graph for this function:

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 1554 of file ci.c.

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

Referenced by cDevice::GetDevice().

Here is the call graph for this function:

cDevice * cCamSlot::Device ( void   ) 

Returns the device this CAM slot is currently assigned to.

Definition at line 1582 of file ci.c.

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

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

Here is the call graph for this function:

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::SlotNumber ( void   )  [inline]

bool cCamSlot::Reset ( void   ) 

Resets the CAM in this slot. Returns true if the operation was successful.

Definition at line 1682 of file ci.c.

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

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

Here is the call graph for this function:

eModuleStatus cCamSlot::ModuleStatus ( void   ) 

Returns the status of the CAM in this slot.

Definition at line 1699 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().

Here is the call graph for this function:

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 1713 of file ci.c.

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

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

Here is the call graph for this function:

bool cCamSlot::Ready ( void   ) 

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

Definition at line 1719 of file ci.c.

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

Here is the call graph for this function:

bool cCamSlot::HasMMI ( void   ) 

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

Definition at line 1725 of file ci.c.

References GetSessionByResourceId(), and RI_MMI.

Referenced by cMenuCam::ProcessKey().

Here is the call graph for this function:

bool cCamSlot::HasUserIO ( void   ) 

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

Definition at line 1730 of file ci.c.

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

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

Here is the call graph for this function:

bool cCamSlot::EnterMenu ( void   ) 

Requests the CAM in this slot to start its menu.

Definition at line 1736 of file ci.c.

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

Referenced by cMenuSetupCAM::Menu().

Here is the call graph for this function:

cCiMenu * cCamSlot::GetMenu ( void   ) 

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

Definition at line 1743 of file ci.c.

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

Referenced by cMenuCam::QueryCam().

Here is the call graph for this function:

cCiEnquiry * cCamSlot::GetEnquiry ( void   ) 

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

Definition at line 1756 of file ci.c.

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

Referenced by cMenuCam::QueryCam().

Here is the call graph for this function:

int cCamSlot::Priority ( void   ) 

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

Definition at line 1815 of file ci.c.

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

Referenced by cDevice::GetDevice().

Here is the call graph for this function:

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 1821 of file ci.c.

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

Referenced by cDevice::GetDevice().

Here is the call graph for this function:

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 1836 of file ci.c.

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

Referenced by AddChannel().

Here is the call graph for this function:

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 1854 of file ci.c.

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

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

Here is the call graph for this function:

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 1875 of file ci.c.

References AddPid(), cChannel::Apids(), cChannel::Ca(), CA_ENCRYPTED_MIN, cChannel::Dpids(), mutex, cChannel::Sid(), cChannel::Source(), source, StopDecrypting(), STREAM_TYPE_AUDIO, STREAM_TYPE_DOLBY, STREAM_TYPE_VIDEO, cChannel::Transponder(), transponder, and cChannel::Vpid().

Referenced by cDevice::SetChannel().

Here is the call graph for this function:

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 inital 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 1893 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(), cChannel::Sid(), SlotNumber(), cChannel::Source(), STREAM_TYPE_AUDIO, STREAM_TYPE_DOLBY, STREAM_TYPE_VIDEO, cTimeMs::TimedOut(), cCondVar::TimedWait(), cChannel::Transponder(), and cChannel::Vpid().

Referenced by cDvbDevice::ProvidesChannel().

Here is the call graph for this function:

void cCamSlot::StartDecrypting ( void   ) 

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

Definition at line 1925 of file ci.c.

References CPCI_OK_DESCRAMBLING, and SendCaPmt().

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

Here is the call graph for this function:

void cCamSlot::StopDecrypting ( void   ) 

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

Definition at line 1930 of file ci.c.

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

Referenced by AddChannel(), and Assign().

Here is the call graph for this function:

bool cCamSlot::IsDecrypting ( void   ) 

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

Definition at line 1939 of file ci.c.

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

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

Here is the call graph for this function:


Friends And Related Function Documentation

friend class cCiAdapter [friend]

Definition at line 126 of file ci.h.

friend class cCiTransportConnection [friend]

Definition at line 127 of file ci.h.

Referenced by NewConnection().


Member Data Documentation

Definition at line 130 of file ci.h.

Referenced by CanDecrypt(), and Process().

Definition at line 131 of file ci.h.

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

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().

cCiTransportConnection* cCamSlot::tc[MAX_CONNECTIONS_PER_CAM_SLOT+1] [private]

Definition at line 135 of file ci.h.

Referenced by cCamSlot(), and Process().

time_t cCamSlot::resetTime [private]

Definition at line 136 of file ci.h.

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

Definition at line 137 of file ci.h.

Referenced by Process().

bool cCamSlot::resendPmt [private]

Definition at line 138 of file ci.h.

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

int cCamSlot::source [private]

Definition at line 139 of file ci.h.

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

int cCamSlot::transponder [private]

Definition at line 140 of file ci.h.

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

Definition at line 141 of file ci.h.

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


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

Generated on Tue Nov 4 19:57:31 2008 for VDR by  doxygen 1.5.6