contentmgmt/cafstreamingsupport/test/streamingtestagent/source/server/staserver.cpp
branchRCL_3
changeset 43 2f10d260163b
child 61 641f389e9157
equal deleted inserted replaced
42:eb9b28acd381 43:2f10d260163b
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implements CStaServer which provides streaming test agent services.
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "staserver.h"
       
    19 
       
    20 using namespace StreamAccess;
       
    21 
       
    22 static const TUint staRangeCount = 2;
       
    23 
       
    24 static const TInt staRanges[staRangeCount] =
       
    25 	{
       
    26 	0,							//Range 0 - 0 to EBaseSession-1. Not used.
       
    27 	CScsServer::EBaseSession,	//Range 1 - EBaseSession to KMaxTInt inclusive.
       
    28 	};
       
    29 
       
    30 static const TUint8 staElementsIndex[staRangeCount] =
       
    31 	{
       
    32 	CPolicyServer::ENotSupported, // Range 0 is not supported.
       
    33 	0,							  // Range 1 must come from a client who has DRM capability.
       
    34 	};							
       
    35 
       
    36 static const CPolicyServer::TPolicyElement staElements[] =
       
    37 	{
       
    38 	{_INIT_SECURITY_POLICY_C1(ECapabilityDRM), CPolicyServer::EFailClient},	
       
    39 	};
       
    40 
       
    41 static const CPolicyServer::TPolicy staPolicy =
       
    42 	{
       
    43 	CPolicyServer::EAlwaysPass, // Allow all connects
       
    44 	staRangeCount,
       
    45 	staRanges,
       
    46 	staElementsIndex,
       
    47 	staElements,
       
    48 	};
       
    49 
       
    50 //
       
    51 //CStaServer
       
    52 //
       
    53 
       
    54 CStaServer::CStaServer()
       
    55 /**
       
    56 	Intializes the Streaming Test Agent object with its version and policy.
       
    57  */
       
    58 	:	CScsServer(StaVersion(),staPolicy)
       
    59 		{
       
    60 		//empty
       
    61 		}
       
    62 
       
    63 CStaServer::~CStaServer()
       
    64 /**
       
    65 	Destructor. Cleanup the Streaming Test Agent object.
       
    66  */
       
    67 	{
       
    68 	iFs.Close();
       
    69 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY
       
    70 	SdpCodecStringPool::Close();
       
    71 #endif
       
    72 	}
       
    73 	
       
    74 	
       
    75 CStaServer* CStaServer::NewLC()
       
    76 /**
       
    77 	Factory function allocates new, initialized instance of CStaServer.
       
    78 
       
    79 	@return		New, initialized instance of CStaServer which is left on the cleanup stack.
       
    80  */
       
    81 	{
       
    82 	CStaServer *sta = new (ELeave) CStaServer();
       
    83 	CleanupStack::PushL(sta);
       
    84 	sta->ConstructL();
       
    85 	return sta;
       
    86 	}
       
    87 
       
    88 
       
    89 void CStaServer::ConstructL()
       
    90 /**
       
    91 	Second phase constructor starts the Streaming Test Agent Server.
       
    92  */
       
    93 	{
       
    94 	CScsServer::ConstructL(KStaShutdownPeriod);
       
    95 	
       
    96 	User::LeaveIfError(iFs.Connect());
       
    97 	User::LeaveIfError(iFs.ShareProtected());
       
    98 	User::LeaveIfError(iFs.CreatePrivatePath(iFs.GetSystemDrive()));
       
    99 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY
       
   100 	SdpCodecStringPool::OpenL();
       
   101 #endif
       
   102 	StartL(KStaName);
       
   103 	}
       
   104 
       
   105 
       
   106 CScsSession* CStaServer::DoNewSessionL(const RMessage2& aMessage)
       
   107 /**
       
   108 	Implement CScsServer by allocating a new instance of CStaSession.
       
   109 
       
   110 	@param	aMessage	Standard server-side handle to message.
       
   111 	@return				New instance of CStaSession which is owned by the caller.
       
   112  */
       
   113 	{
       
   114 	(void)aMessage;
       
   115 	return CStaSession::NewL(*this);
       
   116 	}
       
   117 
       
   118