os/mm/mmplugins/cameraplugins/source/mmcameraclientplugin/mmcameraserver/src/mmcameraserverpolicymanager.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2008-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 "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 // mmcamerapolicymanager.h
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20  @internalTechnology
    21 */
    22 
    23 #ifndef MMCAMERASERVERPOLICYMANAGER_H
    24 #define MMCAMERASERVERPOLICYMANAGER_H
    25 
    26 #include <e32std.h>
    27 #include <e32hashtab.h>
    28 #include <e32cmn.h>
    29 
    30 class CMMCameraServerSession;
    31 
    32 typedef TDblQue<CMMCameraServerSession> TCamSessionQue;
    33 typedef TDblQueIter<CMMCameraServerSession> TCamSessionIter;
    34 
    35 
    36 // ECAM Server Policies
    37 static _LIT_SECURITY_POLICY_C1 (KMMCameraServerPolicyUserEnvironment, ECapabilityUserEnvironment);
    38 static _LIT_SECURITY_POLICY_C1 (KMMCameraServerPolicyMultimediaDD, ECapabilityMultimediaDD);
    39 
    40 /**
    41  * Manages policy for the ECAM server.
    42  * 
    43  * Handles both Platsec capability checks and Reserve/Release of camera devices.
    44  */  
    45 class CMMCameraServerPolicyManager : public CBase
    46 	{
    47 public:
    48 	static CMMCameraServerPolicyManager* NewL();
    49 
    50 	~CMMCameraServerPolicyManager();
    51 
    52 	void ReleaseClient(CMMCameraServerSession* aSession);
    53 	TBool ReserveClient(CMMCameraServerSession* aSession);
    54 
    55 	void OnConnectL (const RMessage2& aMessage);
    56 	void ServiceHandlerL(const RMessage2& aMessage);
    57 
    58 private:
    59 	CMMCameraServerPolicyManager();   // Named Constructor Idiom concept used
    60 
    61 	void ConstructL();
    62 	CMMCameraServerSession* FindFirstInQue(TInt aIndex);
    63 	CMMCameraServerSession* FindLastInQue(TInt aIndex);
    64 	void ReserveUpdate(CMMCameraServerSession* aSession);
    65 	TBool CheckControlOvertaking(CMMCameraServerSession* aSession); // informs whether the new client can overtake camera control from the previously reserved ones 
    66 
    67 private:
    68 	TCamSessionQue iReservedSessionQ;
    69 	TCamSessionIter iIter;
    70 
    71 	TInt iCameraIndex;
    72     TInt iHandle;
    73     TInt iPriority;
    74 	TBool iMMCapability;   
    75 	};
    76 
    77 #endif // MMCAMERASERVERPOLICYMANAGER_H