networkprotocolmodules/privacyprotocolmodule/PrivacyProtocolModule/inc/privacyrequestinfo.h
changeset 36 b47902b73a93
parent 0 9cfd9a3ee49c
equal deleted inserted replaced
35:a2efdd544abf 36:b47902b73a93
       
     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 "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 //
       
    15 
       
    16 #ifndef __PRIVACYREQUESTINFO_H__
       
    17 #define __PRIVACYREQUESTINFO_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <lbs/lbsloccommon.h>
       
    21 #include <lbs/lbsnetcommon.h>
       
    22 #include <lbs/lbsprivacyrequestcommon.h>
       
    23 
       
    24 
       
    25 /** 
       
    26 CRequestInfoBase
       
    27 
       
    28 Base class to represent requests that can be queued and handled by this protocol module
       
    29 */
       
    30 class CRequestInfoBase : public CBase
       
    31 	{
       
    32 	public:
       
    33 
       
    34 		TInt GetRequestId() const;
       
    35 		void SetRequestId(TInt aRequestId);
       
    36 
       
    37 		enum TPrivacyRequestType
       
    38 		{
       
    39 			EPrivacyRequestTypeUnknown = 0,
       
    40 			EPrivacyRequestTypeRequest,
       
    41 			EPrivacyRequestTypeCancel
       
    42 		};
       
    43 		
       
    44 		TPrivacyRequestType Type() const;
       
    45 		
       
    46 	protected:
       
    47 
       
    48 		CRequestInfoBase(TPrivacyRequestType aRequestType);
       
    49 	
       
    50 	private:
       
    51 
       
    52 		CRequestInfoBase();
       
    53 
       
    54 		TInt iRequestId;
       
    55 
       
    56 		TPrivacyRequestType iRequestType;
       
    57 		
       
    58 	};
       
    59 
       
    60 
       
    61 /** 
       
    62 CPrivacyRequestInfo
       
    63 
       
    64 Represents a privacy request
       
    65 */
       
    66 class CPrivacyRequestInfo : public CRequestInfoBase
       
    67 	{
       
    68 	public:
       
    69 
       
    70 		static CPrivacyRequestInfo* NewL(const RMessage2& aMessage);
       
    71 		~CPrivacyRequestInfo();
       
    72 		
       
    73 		void CompleteRequest(TInt aStatus);
       
    74 		
       
    75 		void GetRequestInfo(TLbsExternalRequestInfo2& aRequestInfo) const;
       
    76 		void SetRequestInfo(const TLbsExternalRequestInfo2& aRequestInfo);
       
    77 		
       
    78 		void GetRequestPrivacy(TLbsNetPosRequestPrivacy& aRequestPrivacy) const;
       
    79 		void SetRequestPrivacy(const TLbsNetPosRequestPrivacy& aRequestPrivacy);
       
    80 		
       
    81 		TBool IsResponseRequired() const;
       
    82 		void SetIsResponseRequired(TBool aResponseRequired);
       
    83 		
       
    84 		TBool IsSessionCompleteAutomatic() const;
       
    85 		void SetIsSessionCompleteAutomatic(TBool aAutomatic);
       
    86 		
       
    87 		TBool ConvertResponseCode() const;
       
    88 		void SetConvertResponseCode(TBool aConvert);
       
    89 		
       
    90 		const CSession2* Session() const;
       
    91 		
       
    92 	private:
       
    93 
       
    94 		CPrivacyRequestInfo(const RMessage2& aMessage);
       
    95 
       
    96 		RMessage2 iResponseMessage;
       
    97 		TLbsExternalRequestInfo2 iRequestInfo;
       
    98 		TLbsNetPosRequestPrivacy iRequestPrivacy;
       
    99 		TBool iResponseRequired;
       
   100 		TBool iSessionCompleteAutomatic;
       
   101 		TBool iConvertResponseCode;
       
   102 		
       
   103 	};
       
   104 	
       
   105 	
       
   106 /** 
       
   107 CCancelPrivacyRequestInfo
       
   108 
       
   109 Represents cancellation of a privacy request
       
   110 */
       
   111 class CCancelPrivacyRequestInfo : public CRequestInfoBase
       
   112 	{
       
   113 	public:
       
   114 
       
   115 		static CCancelPrivacyRequestInfo* NewL();
       
   116 		~CCancelPrivacyRequestInfo();
       
   117 		
       
   118 		TInt CancelReason() const;
       
   119 		void SetCancelReason(TInt aCancelReason);
       
   120 		
       
   121 	private:
       
   122 
       
   123 		CCancelPrivacyRequestInfo();
       
   124 		TInt iCancelReason;
       
   125 		
       
   126 	};
       
   127 
       
   128 
       
   129 	
       
   130 /** 
       
   131 CPrivacyRequestBuffer
       
   132 
       
   133 A buffer (or queue) of privacy requests to be handled by this protocol module
       
   134 */
       
   135 class CPrivacyRequestBuffer : public CBase
       
   136 	{
       
   137 	public:
       
   138 	
       
   139 		static CPrivacyRequestBuffer* NewL();
       
   140 		~CPrivacyRequestBuffer();
       
   141 		
       
   142 		void AddRequestL(CPrivacyRequestInfo* aRequestInfo);
       
   143 		CPrivacyRequestInfo* FindRequest(TInt aRequestId);
       
   144 		CPrivacyRequestInfo* FindRequest(const CSession2* aSession);
       
   145 		CPrivacyRequestInfo* RemoveRequest(CPrivacyRequestInfo* aRequestInfo);
       
   146 
       
   147 		TInt NumRequests() const;
       
   148 		
       
   149 		void CancelAnyOutstandingRequestById(TInt aRequestId, TInt aReason);
       
   150 		void CancelAnyOutstandingRequestBySession(const CSession2* aSession);
       
   151 		
       
   152 	private:
       
   153 	
       
   154 		CPrivacyRequestBuffer();
       
   155 		
       
   156 		RPointerArray<CPrivacyRequestInfo> iBuffer;
       
   157 	
       
   158 	};
       
   159 	
       
   160 
       
   161 #endif // __PRIVACYREQUESTINFO_H__