bluetoothmgmt/btmgr/Inc/BTManServer.h
changeset 17 907b2fb7aa8e
parent 0 29b1cd4cb562
child 32 f72906e669b4
equal deleted inserted replaced
16:0089b2f7ebd8 17:907b2fb7aa8e
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    22 #define BTManServer_H
    22 #define BTManServer_H
    23 
    23 
    24 #include <bt_subscribe.h>
    24 #include <bt_subscribe.h>
    25 #include "BTRegistryDB.h"
    25 #include "BTRegistryDB.h"
    26 #include "btmanclientserver.h"
    26 #include "btmanclientserver.h"
       
    27 #include "btmanserverburmgr.h"
    27 
    28 
    28 #if KMaxBluetoothNameLen > KMaxFriendlyNameLen
    29 #if KMaxBluetoothNameLen > KMaxFriendlyNameLen
    29 #define KLongestName KMaxBluetoothNameLen
    30 #define KLongestName KMaxBluetoothNameLen
    30 #else
    31 #else
    31 #define KLongestName KMaxFriendlyNameLen
    32 #define KLongestName KMaxFriendlyNameLen
   103 //CBTManServer
   104 //CBTManServer
   104 //**********************************
   105 //**********************************
   105 /**
   106 /**
   106 The BTMan Server.
   107 The BTMan Server.
   107 **/
   108 **/
   108 NONSHARABLE_CLASS(CBTManServer) : public CPolicyServer
   109 NONSHARABLE_CLASS(CBTManServer) : public CPolicyServer, public MBTBURNotify
   109 	{
   110 	{
   110 public:
   111 public:
   111 	//construct / destruct
   112 	//construct / destruct
   112 	static CServer2* NewLC();
   113 	static CServer2* NewLC();
   113 	~CBTManServer();
   114 	~CBTManServer();
       
   115 
       
   116 	// From MBTBURNotify
       
   117 	virtual void BUROperationStarted();
       
   118 	virtual void BUROperationStopped();
   114 
   119 
   115 	void AddSession();
   120 	void AddSession();
   116 	void DropSession();
   121 	void DropSession();
   117 
   122 
   118 	inline TInt MaxSessionCount() const;
   123 	inline TInt MaxSessionCount() const;
   124 
   129 
   125 	inline CBTRegistry& Registry() const;
   130 	inline CBTRegistry& Registry() const;
   126 
   131 
   127 	void Publish(TUint aKey, TInt aValue); // only publish ints for now, ignore error
   132 	void Publish(TUint aKey, TInt aValue); // only publish ints for now, ignore error
   128 	void NotifyViewChange(CBTManSubSession& aSubSessionViewOwner, const TDesC& aViewDescriptor);
   133 	void NotifyViewChange(CBTManSubSession& aSubSessionViewOwner, const TDesC& aViewDescriptor);
       
   134 	void NotifyViewChange(const TDesC& aViewDescriptor);
   129 
   135 
   130 private:
   136 private:
   131 	CBTManServer();
   137 	CBTManServer();
   132 	void ConstructL();
   138 	void ConstructL();
   133 	//open/close a session
   139 	//open/close a session
   134 	CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
   140 	CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
       
   141 	void TryToStartShutdownTimer();
   135 
   142 
   136 private:
   143 private:
   137 	TInt					iMaxSessionCount;
   144 	TInt					iMaxSessionCount;
   138 	TInt					iSessionCount;	//<The number of sessions
   145 	TInt					iSessionCount;	//<The number of sessions
   139 	CBTManServerShutdown	iShutdown;//<A timer used to shut the server down after all clients have exited.
   146 	CBTManServerShutdown	iShutdown;//<A timer used to shut the server down after all clients have exited.
   140 	CObjectConIx*			iContainerIndex;//<The server has an onject container index which creates an object container for each session
   147 	CObjectConIx*			iContainerIndex;//<The server has an onject container index which creates an object container for each session
   141 	CBTRegistry*			iRegistry;
   148 	CBTRegistry*			iRegistry;
   142 	RProperty				iProperty;	// so that subsessions can publish change info
   149 	RProperty				iProperty;	// so that subsessions can publish change info
       
   150 	CBTManServerBURMgr*		iBURManager;	// Manage backup and restore events generated by the Secure Backup Engine
       
   151 
       
   152 	TBool			iBUROperationStarted;	// Whether or not a backup or restore operation is in progress (meaning that this server should not shutdown)
   143 	};
   153 	};
   144 
   154 
   145 inline TInt CBTManServer::MaxSessionCount() const {return iMaxSessionCount;}
   155 inline TInt CBTManServer::MaxSessionCount() const {return iMaxSessionCount;}
   146 inline TInt CBTManServer::SessionCount() const {return iSessionCount;}
   156 inline TInt CBTManServer::SessionCount() const {return iSessionCount;}
   147 inline CBTRegistry& CBTManServer::Registry() const {return *iRegistry;}
   157 inline CBTRegistry& CBTManServer::Registry() const {return *iRegistry;}
   184 	void DeleteMessage(CBTManMessage* aMessage);
   194 	void DeleteMessage(CBTManMessage* aMessage);
   185 
   195 
   186 	void CancelRequest(const RMessage2& aMessage);
   196 	void CancelRequest(const RMessage2& aMessage);
   187 
   197 
   188 	TBool SubSessionHasOverlappingView(CBTManSubSession& aSubSessionViewOwner, const TDesC& aViewDescriptor);
   198 	TBool SubSessionHasOverlappingView(CBTManSubSession& aSubSessionViewOwner, const TDesC& aViewDescriptor);
       
   199 	TBool SubSessionHasOverlappingView(const TDesC& aViewDescriptor);
   189 
   200 
   190 private:
   201 private:
   191 	void DoCompleteMessage(CBTManMessage& aMessage, TInt aReason);
   202 	void DoCompleteMessage(CBTManMessage& aMessage, TInt aReason);
   192 	void CompleteOutstandingMessages();
   203 	void CompleteOutstandingMessages();
   193 	void ClientRegChangeNotification(TAny* aPtr1);
   204 	void ClientRegChangeNotification(TAny* aPtr1);