contentmgmt/referencedrmagent/RefTestAgent/RefTestAgent/Reftestagentcontent.cpp
changeset 15 da2ae96f639b
parent 8 35751d3474b7
child 45 030c4fbc13d7
equal deleted inserted replaced
10:afc583cfa176 15:da2ae96f639b
    49 	CRefTestAgentContent* self=new(ELeave) CRefTestAgentContent();
    49 	CRefTestAgentContent* self=new(ELeave) CRefTestAgentContent();
    50 	CleanupStack::PushL(self);
    50 	CleanupStack::PushL(self);
    51 	self->ConstructL(aFile);
    51 	self->ConstructL(aFile);
    52 	return self;
    52 	return self;
    53 	}
    53 	}
       
    54 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    55 CRefTestAgentContent* CRefTestAgentContent::NewL(const TDesC8& aHeaderData)  
       
    56 	{
       
    57 	CRefTestAgentContent* self = NewLC(aHeaderData);    
       
    58     CleanupStack::Pop(self);
       
    59     return self;
       
    60 	}
       
    61           
       
    62 CRefTestAgentContent* CRefTestAgentContent::NewLC(const TDesC8& aHeaderData)  
       
    63 	{
       
    64     CRefTestAgentContent* self = new (ELeave) CRefTestAgentContent;
       
    65 	CleanupStack::PushL(self);  
       
    66 	self->ConstructL(aHeaderData);
       
    67 	return self;
       
    68 	}
       
    69 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
    54 
    70 
    55 
    71 
    56 CRefTestAgentContent::CRefTestAgentContent() 
    72 CRefTestAgentContent::CRefTestAgentContent() 
    57 	{
    73 	{
    58 	}
    74 	}
    59 
    75 
    60 CRefTestAgentContent::~CRefTestAgentContent()
    76 CRefTestAgentContent::~CRefTestAgentContent()
    61 	{
    77 	{
    62 	iContentSession.Close();
    78 	iContentSession.Close();
       
    79 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    80     delete iHeaderData;
       
    81 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
    63 	}
    82 	}
    64   
    83   
    65 void CRefTestAgentContent::ConstructL(const TDesC& aURI, TContentShareMode aShareMode)
    84 void CRefTestAgentContent::ConstructL(const TDesC& aURI, TContentShareMode aShareMode)
    66 	{
    85 	{
    67 	// default share mode of EFileShareReadersOnly
    86 	// default share mode of EFileShareReadersOnly
    94 	
   113 	
    95 	// can now close our file handle, server owns it now
   114 	// can now close our file handle, server owns it now
    96 	CleanupStack::PopAndDestroy(&file);
   115 	CleanupStack::PopAndDestroy(&file);
    97 	}
   116 	}
    98 
   117 
       
   118 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   119 void CRefTestAgentContent::ConstructL(const TDesC8& aHeaderData)     
       
   120     {     
       
   121     iHeaderData = aHeaderData.AllocL();     
       
   122     User::LeaveIfError(iContentSession.Open(aHeaderData));     
       
   123     }     
       
   124 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT 
       
   125 
    99 TInt CRefTestAgentContent::OpenContainer(const TDesC& aUniqueId)
   126 TInt CRefTestAgentContent::OpenContainer(const TDesC& aUniqueId)
   100 	{
   127 	{
   101 	return iContentSession.OpenContainer(aUniqueId);
   128 	return iContentSession.OpenContainer(aUniqueId);
   102 	}
   129 	}
   103 
   130 
   121 	return iContentSession.Search(aArray, aMimeType, ETrue); 
   148 	return iContentSession.Search(aArray, aMimeType, ETrue); 
   122 	}
   149 	}
   123 
   150 
   124 TInt CRefTestAgentContent::GetAttribute(TInt aAttribute, TInt& aValue, const TDesC& aUniqueId)
   151 TInt CRefTestAgentContent::GetAttribute(TInt aAttribute, TInt& aValue, const TDesC& aUniqueId)
   125 	{
   152 	{
       
   153 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   154     if(iHeaderData != NULL)  
       
   155         return iContentSession.GetWmdrmAttribute(aUniqueId, aAttribute, aValue); 
       
   156     else
       
   157         return iContentSession.GetAttribute(aUniqueId, aAttribute, aValue);
       
   158 #else
   126 	return iContentSession.GetAttribute(aUniqueId, aAttribute, aValue);
   159 	return iContentSession.GetAttribute(aUniqueId, aAttribute, aValue);
       
   160 #endif
   127 	}
   161 	}
   128 
   162 
   129 TInt CRefTestAgentContent::GetAttributeSet(RAttributeSet& aAttributeSet, const TDesC& aUniqueId)
   163 TInt CRefTestAgentContent::GetAttributeSet(RAttributeSet& aAttributeSet, const TDesC& aUniqueId)
   130 	{
   164 	{
       
   165 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   166     if(iHeaderData != NULL)
       
   167         return iContentSession.GetWmdrmAttributeSet(aUniqueId, aAttributeSet);
       
   168     else
       
   169         return iContentSession.GetAttributeSet(aUniqueId, aAttributeSet);
       
   170 #else
   131 	return iContentSession.GetAttributeSet(aUniqueId, aAttributeSet);
   171 	return iContentSession.GetAttributeSet(aUniqueId, aAttributeSet);
       
   172 #endif
   132 	}
   173 	}
   133 
   174 
   134 TInt CRefTestAgentContent::GetStringAttribute(TInt aAttribute, TDes& aValue, const TDesC& aUniqueId)
   175 TInt CRefTestAgentContent::GetStringAttribute(TInt aAttribute, TDes& aValue, const TDesC& aUniqueId)
   135 	{
   176 	{
       
   177 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   178     if(iHeaderData != NULL)
       
   179         return iContentSession.GetWmdrmStringAttribute(aUniqueId, aAttribute, aValue);
       
   180     else
       
   181         return iContentSession.GetStringAttribute(aUniqueId, aAttribute, aValue);
       
   182 #else
   136 	return iContentSession.GetStringAttribute(aUniqueId, aAttribute, aValue);
   183 	return iContentSession.GetStringAttribute(aUniqueId, aAttribute, aValue);
       
   184 #endif
   137 	}
   185 	}
   138 
   186 
   139 TInt CRefTestAgentContent::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet, const TDesC& aUniqueId)
   187 TInt CRefTestAgentContent::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet, const TDesC& aUniqueId)
   140 	{
   188 	{
       
   189 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   190     if(iHeaderData != NULL)
       
   191         return iContentSession.GetWmdrmStringAttributeSet(aUniqueId, aStringAttributeSet);
       
   192     else
       
   193         return iContentSession.GetStringAttributeSet(aUniqueId, aStringAttributeSet);
       
   194 #else
   141 	return iContentSession.GetStringAttributeSet(aUniqueId, aStringAttributeSet);
   195 	return iContentSession.GetStringAttributeSet(aUniqueId, aStringAttributeSet);
       
   196 #endif
   142 	}
   197 	}
   143 
   198 
   144 TInt CRefTestAgentContent::AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer)
   199 TInt CRefTestAgentContent::AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer)
   145 	{
   200 	{
   146 	return iContentSession.AgentSpecificCommand(aCommand, aInputBuffer, aOutputBuffer);
   201 	return iContentSession.AgentSpecificCommand(aCommand, aInputBuffer, aOutputBuffer);