contentmgmt/referencedrmagent/RefTestAgent/RefTestAgent/Reftestagentdata.cpp
changeset 15 da2ae96f639b
parent 8 35751d3474b7
child 45 030c4fbc13d7
equal deleted inserted replaced
10:afc583cfa176 15:da2ae96f639b
    51 	CleanupStack::PushL(self);
    51 	CleanupStack::PushL(self);
    52 	self->ConstructL(aFile, aUniqueId);
    52 	self->ConstructL(aFile, aUniqueId);
    53 	return self;
    53 	return self;
    54 	}
    54 	}
    55 
    55 
       
    56 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    57       
       
    58 CRefTestAgentData* CRefTestAgentData::NewL(const TDesC8& aHeaderData)     
       
    59     {     
       
    60     CRefTestAgentData* self = NewLC(aHeaderData);     
       
    61     CleanupStack::Pop(self);     
       
    62     return self;     
       
    63     }     
       
    64       
       
    65 CRefTestAgentData* CRefTestAgentData::NewLC(const TDesC8& aHeaderData)     
       
    66     {     
       
    67     CRefTestAgentData* self = new (ELeave) CRefTestAgentData;     
       
    68     CleanupStack::PushL(self);     
       
    69     self->ConstructL(aHeaderData);     
       
    70     return self;     
       
    71     }     
       
    72          
       
    73 void CRefTestAgentData::ConstructL(const TDesC8& aHeaderData)     
       
    74     {     
       
    75     iHeaderData = aHeaderData.AllocL();     
       
    76     User::LeaveIfError(iServer.Open(aHeaderData));     
       
    77     }     
       
    78 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
       
    79   
       
    80 
    56 CRefTestAgentData::CRefTestAgentData()
    81 CRefTestAgentData::CRefTestAgentData()
    57 	{
    82 	{
    58 	}
    83 	}
    59 
    84 
    60 CRefTestAgentData::~CRefTestAgentData()
    85 CRefTestAgentData::~CRefTestAgentData()
    61 	{
    86 	{
    62 	iServer.Close();
    87 	iServer.Close();
       
    88 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
       
    89     delete iHeaderData;     
       
    90 #endif 
    63 	}
    91 	}
    64   
    92   
    65 void CRefTestAgentData::ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
    93 void CRefTestAgentData::ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
    66 	{
    94 	{
    67 	// default share mode of EFileShareReadersOnly
    95 	// default share mode of EFileShareReadersOnly
   179 	return iServer.SetProperty(aProperty, aValue);
   207 	return iServer.SetProperty(aProperty, aValue);
   180 	}
   208 	}
   181 
   209 
   182 TInt CRefTestAgentData::GetAttribute(TInt aAttribute, TInt& aValue)
   210 TInt CRefTestAgentData::GetAttribute(TInt aAttribute, TInt& aValue)
   183 	{
   211 	{
   184 	return iServer.GetAttribute(aAttribute, aValue);
   212 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   213     if(iHeaderData != NULL)     
       
   214         return iServer.GetWmdrmAttribute(aAttribute, aValue);     
       
   215     else     
       
   216         return iServer.GetAttribute(aAttribute, aValue);     
       
   217 #else     
       
   218     return iServer.GetAttribute(aAttribute, aValue);
       
   219 #endif
   185 	}
   220 	}
   186 
   221 
   187 TInt CRefTestAgentData::GetAttributeSet(RAttributeSet& aAttributeSet)
   222 TInt CRefTestAgentData::GetAttributeSet(RAttributeSet& aAttributeSet)
   188 	{
   223 	{
       
   224 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   225     if(iHeaderData != NULL)     
       
   226         return iServer.GetWmdrmAttributeSet(aAttributeSet);     
       
   227     else     
       
   228         return iServer.GetAttributeSet(aAttributeSet);     
       
   229 #else 
   189 	return iServer.GetAttributeSet(aAttributeSet);
   230 	return iServer.GetAttributeSet(aAttributeSet);
       
   231 #endif
   190 	}
   232 	}
   191 
   233 
   192 TInt CRefTestAgentData::GetStringAttribute(TInt aAttribute, TDes& aValue)
   234 TInt CRefTestAgentData::GetStringAttribute(TInt aAttribute, TDes& aValue)
   193 	{
   235 	{
       
   236 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   237     if(iHeaderData != NULL)     
       
   238         return iServer.GetWmdrmStringAttribute(aAttribute, aValue);     
       
   239     else     
       
   240         return iServer.GetStringAttribute(aAttribute, aValue);     
       
   241 #else 
   194 	return iServer.GetStringAttribute(aAttribute, aValue);
   242 	return iServer.GetStringAttribute(aAttribute, aValue);
       
   243 #endif
   195 	}
   244 	}
   196 
   245 
   197 TInt CRefTestAgentData::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet)
   246 TInt CRefTestAgentData::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet)
   198 	{
   247 	{
       
   248 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   249     if(iHeaderData != NULL)     
       
   250         return iServer.GetWmdrmStringAttributeSet(aStringAttributeSet);     
       
   251     else     
       
   252         return iServer.GetStringAttributeSet(aStringAttributeSet);     
       
   253 #else    
   199 	return iServer.GetStringAttributeSet(aStringAttributeSet);
   254 	return iServer.GetStringAttributeSet(aStringAttributeSet);
       
   255 #endif
   200 	}
   256 	}
   201 
   257 
   202 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   258 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   203 TInt CRefTestAgentData::Read(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus)
   259 TInt CRefTestAgentData::Read(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus)
   204 	{
   260 	{
   224 	// Reference Agent does not perform true asynchronous read operations, all Read client-server interaction
   280 	// Reference Agent does not perform true asynchronous read operations, all Read client-server interaction
   225 	// is done synchronously. Thus, it makes no sense to provide an asynchronous cancellation, as there
   281 	// is done synchronously. Thus, it makes no sense to provide an asynchronous cancellation, as there
   226 	// cannot be a situation where the consumer waits for an asynchronous operation to complete
   282 	// cannot be a situation where the consumer waits for an asynchronous operation to complete
   227 	}
   283 	}
   228 
   284 
       
   285 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   286       
       
   287 TInt CRefTestAgentData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputDataPacket)     
       
   288     {     
       
   289     return iServer.Read(aEncryptedInputDataPacket, aDecryptedOutputDataPacket);     
       
   290     }     
       
   291                  
       
   292 void CRefTestAgentData::Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputDataPacket, TRequestStatus& aStatus)     
       
   293     {     
       
   294     TInt err = Read(aEncryptedInputDataPacket, aDecryptedOutputDataPacket);     
       
   295     TRequestStatus* status = &aStatus;     
       
   296     User::RequestComplete(status, err);     
       
   297     }     
       
   298       
       
   299 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT