common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientobserver.cpp
changeset 748 e13acd883fbe
child 872 17498133d9ad
equal deleted inserted replaced
747:76f9aaeefbab 748:e13acd883fbe
       
     1 // Copyright (c) 2002-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 // INCLUDE FILES
       
    19 #include    "ctlbsclientobserver.h"
       
    20 
       
    21 
       
    22 // CONSTANTS
       
    23 // Apparently the EposServer name is same on WINS and ARMI
       
    24 _LIT(KEPosServerName, "!PosServer");
       
    25 
       
    26 _LIT(KPrivacyServerName, "eposprivsrv"); // TBD: Is this name OK?
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =======================
       
    29 
       
    30 
       
    31 // ---------------------------------------------------------
       
    32 // CT_LbsClientObserver::WaitForEPosShutdown
       
    33 // 
       
    34 // (other items were commented in a header).
       
    35 // ---------------------------------------------------------
       
    36 //
       
    37 void CT_LbsClientObserver::WaitForEPosShutdown()
       
    38     {
       
    39     WaitForProcessDeath(KEPosServerName);
       
    40     }
       
    41 
       
    42 void EPosShutdownWaitCleanupItem(TAny*)
       
    43     {
       
    44     CT_LbsClientObserver::WaitForEPosShutdown();
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------
       
    48 // CT_LbsClientObserver::EPosShutdownWaitPushL
       
    49 // 
       
    50 // (other items were commented in a header).
       
    51 // ---------------------------------------------------------
       
    52 //
       
    53 void CT_LbsClientObserver::EPosShutdownWaitPushL()
       
    54     {
       
    55     CleanupStack::PushL(TCleanupItem(EPosShutdownWaitCleanupItem));
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // CT_LbsClientObserver::EPosAliveL
       
    60 // 
       
    61 // (other items were commented in a header).
       
    62 // ---------------------------------------------------------
       
    63 //
       
    64 TBool CT_LbsClientObserver::EPosAliveL()
       
    65     {
       
    66     return ProcessAliveL(KEPosServerName);
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------
       
    70 // CT_LbsClientObserver::WaitForPrivacyServerShutdown
       
    71 // 
       
    72 // (other items were commented in a header).
       
    73 // ---------------------------------------------------------
       
    74 //
       
    75 void CT_LbsClientObserver::WaitForPrivacyServerShutdown()
       
    76     {
       
    77     WaitForProcessDeath(KPrivacyServerName);
       
    78     }
       
    79 
       
    80 void PrivacyServerShutdownWaitCleanupItem(TAny*)
       
    81     {
       
    82     CT_LbsClientObserver::WaitForPrivacyServerShutdown();
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------
       
    86 // CT_LbsClientObserver::PrivacyServerShutdownWaitPushL
       
    87 // 
       
    88 // (other items were commented in a header).
       
    89 // ---------------------------------------------------------
       
    90 //
       
    91 void CT_LbsClientObserver::PrivacyServerShutdownWaitPushL()
       
    92     {
       
    93     CleanupStack::PushL(TCleanupItem(PrivacyServerShutdownWaitCleanupItem));
       
    94     }
       
    95 
       
    96 // ---------------------------------------------------------
       
    97 // CT_LbsClientObserver::PrivacyServerAliveL
       
    98 // 
       
    99 // (other items were commented in a header).
       
   100 // ---------------------------------------------------------
       
   101 //
       
   102 TBool CT_LbsClientObserver::PrivacyServerAliveL()
       
   103     {
       
   104     return ProcessAliveL(KPrivacyServerName);
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------
       
   108 // CT_LbsClientObserver::WaitForProcessDeath
       
   109 // 
       
   110 // (other items were commented in a header).
       
   111 // ---------------------------------------------------------
       
   112 //
       
   113 void CT_LbsClientObserver::WaitForProcessDeath(const TDesC& aProcessName)
       
   114     {
       
   115 #ifdef __WINS__
       
   116     RThread process;
       
   117 #else
       
   118     RProcess process;
       
   119 #endif
       
   120 
       
   121     if (process.Open(aProcessName))
       
   122         {
       
   123         return;
       
   124         }
       
   125 
       
   126     TRequestStatus status;
       
   127     process.Logon(status);
       
   128     User::WaitForRequest(status);
       
   129 
       
   130     process.Close();
       
   131     }
       
   132 
       
   133 // ---------------------------------------------------------
       
   134 // CT_LbsClientObserver::ProcessAliveL
       
   135 // 
       
   136 // (other items were commented in a header).
       
   137 // ---------------------------------------------------------
       
   138 //
       
   139 TBool CT_LbsClientObserver::ProcessAliveL(const TDesC& aProcessName)
       
   140     {
       
   141 	TFindServer find(aProcessName);
       
   142     TFullName   name;
       
   143     if (find.Next(name) == KErrNone) // server found
       
   144 		{
       
   145 		return ETrue;
       
   146 		}
       
   147 	else 
       
   148 		{
       
   149 		return EFalse;
       
   150 		}
       
   151     }
       
   152 
       
   153 //  End of File