lbs/internal/lbstestserver/inc/lbssystemcontroller.h
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2006-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 "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21  @released
       
    22 */
       
    23 #ifndef __LBS_SYSTEMSTARTER_H__
       
    24 #define __LBS_SYSTEMSTARTER_H__
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <e32def.h>
       
    28 #include <e32cmn.h>
       
    29 #include <e32std.h>
       
    30 #include <e32property.h>
       
    31 #include "lbstimer.h"
       
    32 
       
    33 class CLbsSystemStarter;
       
    34 
       
    35 
       
    36 const TInt KDefaultStartupTimeout = 30;
       
    37 
       
    38 // Responses to a request to start the LBS system
       
    39 enum
       
    40     {
       
    41     ELbsStartupSuccess,
       
    42     ELbsStartupFail,
       
    43     ELbsStartupRootNotFound
       
    44     };
       
    45 // Responses to a request to close down the LBS system
       
    46 enum
       
    47     {
       
    48     ELbsCloseDownRejected,
       
    49     ELbsCloseDownInProgress,
       
    50     ELbsCloseDownComplete,
       
    51     ELbsCloseDownRootNotFound
       
    52     };
       
    53 
       
    54 class RLbsSystemController
       
    55     {
       
    56 public:
       
    57 enum
       
    58     {
       
    59 	ELbsCloseDown = 1,
       
    60 	ELbsCloseDownAndConfirm,
       
    61 	ELbsResetOnly, // Just tell the process to clear the cache etc. rather than close down completely
       
    62 	ELbsTotalCloseDown // Close the LBS Root process as well.
       
    63     };
       
    64 public:
       
    65 	IMPORT_C static void InitializeL();
       
    66 	IMPORT_C static void ShutDownL();
       
    67 
       
    68 	IMPORT_C RLbsSystemController();
       
    69 	IMPORT_C void OpenL(TUid aModuleId);
       
    70 	IMPORT_C void Close();
       
    71 	
       
    72 	IMPORT_C void NotifySystemStartRequest(TRequestStatus& aStatus);
       
    73 	IMPORT_C TInt RequestSystemStartup();
       
    74 	IMPORT_C void SystemStartComplete(TInt aStartupResult);
       
    75 	IMPORT_C void NotifySystemCloseDownRequest(TRequestStatus& aStatus);
       
    76 	IMPORT_C TInt RequestSystemCloseDown();
       
    77 	IMPORT_C TInt RequestSystemCloseDown(TBool aNoWaitForResponse);
       
    78 	IMPORT_C void SystemCloseDownResponse(TInt aResponse);
       
    79 	IMPORT_C TInt GetCloseDownType();
       
    80 	IMPORT_C void RequestSystemReset();
       
    81 	IMPORT_C TInt RequestCompleteCloseDown();
       
    82 	
       
    83 	TInt GetStartupData(TDes8& aData);
       
    84 
       
    85 private:
       
    86 	TBool CheckLbsRootProcessIsUp();
       
    87 	
       
    88 private: 
       
    89 	RProperty    iLbsStartupRequest;
       
    90 	RProperty    iLbsStartupComplete;
       
    91 	RProperty    iLbsCloseDownRequest;
       
    92 	RProperty    iLbsCloseDownComplete;
       
    93 	};
       
    94 
       
    95 /*
       
    96  *
       
    97  * Observer used to pass system startup requests to the LBS Root process
       
    98  */
       
    99 class MLbsSystemStartupObserver
       
   100 	{
       
   101 public:
       
   102 	virtual void OnStartupRequest() = 0;
       
   103 	};
       
   104     
       
   105 /*
       
   106  * Active object which monitors the property which signals
       
   107  * when startup is required.
       
   108  */
       
   109 class  CLbsSystemStartupRequestHandler : public CActive 
       
   110 	{
       
   111 public:
       
   112 	IMPORT_C static CLbsSystemStartupRequestHandler* NewL(
       
   113                                  MLbsSystemStartupObserver* aObserver, 
       
   114                                                          TUid aProcessUid);
       
   115 	IMPORT_C ~CLbsSystemStartupRequestHandler();
       
   116 	IMPORT_C void ConfirmStartup(TInt aStartupStatus);
       
   117 
       
   118 protected:
       
   119 	CLbsSystemStartupRequestHandler(MLbsSystemStartupObserver* aObserver);
       
   120 	void ConstructL(TUid aProcessUid);
       
   121 
       
   122 protected: // From CActive
       
   123 	void RunL();
       
   124 	void DoCancel();
       
   125     
       
   126 private:
       
   127 	MLbsSystemStartupObserver* iObserver;
       
   128 	RLbsSystemController iLbsSystemController;    
       
   129 	};
       
   130     
       
   131 /*
       
   132  *
       
   133  * Observer used to pass system startup requests to the LBS Root process
       
   134  */
       
   135 class MLbsSystemCloseDownObserver
       
   136     {
       
   137 public:
       
   138     virtual void OnCloseDownRequest(TBool aConfirmCloseDownComplete) = 0;
       
   139     virtual void OnResetRequest() = 0;
       
   140     virtual void OnCompleteCloseDownRequest() = 0;
       
   141     };
       
   142     
       
   143 /*
       
   144  * Active object which monitors the property which signals
       
   145  * when closedown is required.
       
   146  */
       
   147 class  CLbsSystemCloseDownRequestHandler : public CActive 
       
   148 	{
       
   149 public:
       
   150 	IMPORT_C static CLbsSystemCloseDownRequestHandler* NewL(
       
   151 							MLbsSystemCloseDownObserver* aObserver, 
       
   152 													TUid aProcessUid);
       
   153     IMPORT_C ~CLbsSystemCloseDownRequestHandler();
       
   154     IMPORT_C void ConfirmCloseDown(TInt aResponse);
       
   155 
       
   156 protected:
       
   157     CLbsSystemCloseDownRequestHandler(MLbsSystemCloseDownObserver* aObserver);
       
   158     void ConstructL(TUid aProcessUid);
       
   159 
       
   160 protected: // From CActive
       
   161     void RunL();
       
   162     void DoCancel();
       
   163     
       
   164 private:
       
   165     MLbsSystemCloseDownObserver* iObserver;
       
   166     RLbsSystemController iLbsSystemController;    
       
   167     };
       
   168     
       
   169 #endif //__LBS_SYSTEMSTARTER_H__