os/mm/mmplugins/cameraplugins/source/mmcameraclientplugin/mmcameraserver/src/mmcameraserverpolicymanager.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmplugins/cameraplugins/source/mmcameraclientplugin/mmcameraserver/src/mmcameraserverpolicymanager.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,77 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// mmcamerapolicymanager.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @internalTechnology
    1.24 +*/
    1.25 +
    1.26 +#ifndef MMCAMERASERVERPOLICYMANAGER_H
    1.27 +#define MMCAMERASERVERPOLICYMANAGER_H
    1.28 +
    1.29 +#include <e32std.h>
    1.30 +#include <e32hashtab.h>
    1.31 +#include <e32cmn.h>
    1.32 +
    1.33 +class CMMCameraServerSession;
    1.34 +
    1.35 +typedef TDblQue<CMMCameraServerSession> TCamSessionQue;
    1.36 +typedef TDblQueIter<CMMCameraServerSession> TCamSessionIter;
    1.37 +
    1.38 +
    1.39 +// ECAM Server Policies
    1.40 +static _LIT_SECURITY_POLICY_C1 (KMMCameraServerPolicyUserEnvironment, ECapabilityUserEnvironment);
    1.41 +static _LIT_SECURITY_POLICY_C1 (KMMCameraServerPolicyMultimediaDD, ECapabilityMultimediaDD);
    1.42 +
    1.43 +/**
    1.44 + * Manages policy for the ECAM server.
    1.45 + * 
    1.46 + * Handles both Platsec capability checks and Reserve/Release of camera devices.
    1.47 + */  
    1.48 +class CMMCameraServerPolicyManager : public CBase
    1.49 +	{
    1.50 +public:
    1.51 +	static CMMCameraServerPolicyManager* NewL();
    1.52 +
    1.53 +	~CMMCameraServerPolicyManager();
    1.54 +
    1.55 +	void ReleaseClient(CMMCameraServerSession* aSession);
    1.56 +	TBool ReserveClient(CMMCameraServerSession* aSession);
    1.57 +
    1.58 +	void OnConnectL (const RMessage2& aMessage);
    1.59 +	void ServiceHandlerL(const RMessage2& aMessage);
    1.60 +
    1.61 +private:
    1.62 +	CMMCameraServerPolicyManager();   // Named Constructor Idiom concept used
    1.63 +
    1.64 +	void ConstructL();
    1.65 +	CMMCameraServerSession* FindFirstInQue(TInt aIndex);
    1.66 +	CMMCameraServerSession* FindLastInQue(TInt aIndex);
    1.67 +	void ReserveUpdate(CMMCameraServerSession* aSession);
    1.68 +	TBool CheckControlOvertaking(CMMCameraServerSession* aSession); // informs whether the new client can overtake camera control from the previously reserved ones 
    1.69 +
    1.70 +private:
    1.71 +	TCamSessionQue iReservedSessionQ;
    1.72 +	TCamSessionIter iIter;
    1.73 +
    1.74 +	TInt iCameraIndex;
    1.75 +    TInt iHandle;
    1.76 +    TInt iPriority;
    1.77 +	TBool iMMCapability;   
    1.78 +	};
    1.79 +
    1.80 +#endif // MMCAMERASERVERPOLICYMANAGER_H