PECengine/StorageManager2/ClientSrc/RPEngStorageAdminSubClient.cpp
branchRCL_3
changeset 17 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
16:6ca72c0fe49a 17:a941bc465d9f
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  it is used to update session slot state and signal new
       
    15 *                session slot events
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "RPEngStorageAdminSubClient.h"
       
    22 
       
    23 #include "RPEngStorageAdminClient.h"
       
    24 #include "TPEngStorageServerMessages.h"
       
    25 
       
    26 #include "PresenceDebugPrint.h"
       
    27 
       
    28 // PEC Engine internal constants
       
    29 #include "PEngInternalGlobalConsts.h"
       
    30 
       
    31 
       
    32 // MACROS
       
    33 #define RETURN_IF_NOT_CONNECTED()\
       
    34     if(!iConnected)\
       
    35         {\
       
    36         return KErrDisconnected;\
       
    37         }
       
    38 
       
    39 
       
    40 // ============================ MEMBER FUNCTIONS ===============================
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // RPEngStorageAdminSubClient::RPEngStorageAdminSubClient
       
    44 // C++ default constructor can NOT contain any code, that might leave.
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 EXPORT_C RPEngStorageAdminSubClient::RPEngStorageAdminSubClient( )
       
    48     {
       
    49     }
       
    50 
       
    51 
       
    52 // Destructor
       
    53 EXPORT_C RPEngStorageAdminSubClient::~RPEngStorageAdminSubClient()
       
    54     {
       
    55     }
       
    56 
       
    57 
       
    58 // =============================================================================
       
    59 // ============================ Close/Connect FUNCTIONS ========================
       
    60 // =============================================================================
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // RPEngStorageAdminSubClient::Connect
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 EXPORT_C TInt RPEngStorageAdminSubClient::Connect(
       
    67     RPEngStorageAdminClient& aAdminClient,
       
    68     const TDesC8& aSessionName )
       
    69     {
       
    70     PENG_DP( D_PENG_LIT( "RPEngStorageAdminSubClient::Connect()" ) );
       
    71 
       
    72     TIpcArgs messArguments;
       
    73     messArguments.Set( KMessageSlot0, &aSessionName );
       
    74 
       
    75     TInt err( RSubSessionBase::CreateSubSession(
       
    76                   aAdminClient,
       
    77                   EMainSessCreateAdminSubSession,
       
    78                   messArguments ) );
       
    79 
       
    80     iConnected = ( err == KErrNone );
       
    81     return err;
       
    82     }
       
    83 
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // RPEngStorageAdminSubClient::Close
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 EXPORT_C void RPEngStorageAdminSubClient::Close()
       
    90     {
       
    91     PENG_DP( D_PENG_LIT( "RPEngStorageAdminSubClient::Close()" ) );
       
    92 
       
    93     // all requests from this sub-session are canceled by framework
       
    94     CloseSubSession( EMainSessCloseSubSession );
       
    95     iConnected = EFalse;
       
    96     }
       
    97 
       
    98 
       
    99 // =============================================================================
       
   100 // ------------------------ NEW MEMBER FUNCTIONS -------------------------------
       
   101 // =============================================================================
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // RPEngStorageAdminSubClient::NotifyGlobalEvent()
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 EXPORT_C TInt RPEngStorageAdminSubClient::NotifyEvent(
       
   108     const TDesC8& aEvent )
       
   109     {
       
   110     PENG_DP( D_PENG_LIT( "RPEngStorageAdminSubClient::NotifyEvent()" ) );
       
   111 
       
   112     RETURN_IF_NOT_CONNECTED();
       
   113 
       
   114     TIpcArgs messArgs;
       
   115     messArgs.Set( KMessageSlot0, &aEvent );
       
   116     return SendReceive( EAdminSubSessNotifyNewEvent, messArgs );
       
   117     }
       
   118 
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // RPEngStorageAdminSubClient::NotifyError()
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 EXPORT_C TInt RPEngStorageAdminSubClient::NotifyError(
       
   125     TInt aError )
       
   126     {
       
   127     PENG_DP( D_PENG_LIT( "RPEngStorageAdminSubClient::NotifyError()" ) );
       
   128 
       
   129     RETURN_IF_NOT_CONNECTED();
       
   130     TIpcArgs messArgs;
       
   131     messArgs.Set( KMessageSlot0, aError );
       
   132     return Send( EAdminSubSessNotifyError, messArgs );
       
   133     }
       
   134 
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // RPEngStorageAdminSubClient::CheckAppIdRegistration()
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 EXPORT_C TInt RPEngStorageAdminSubClient::CheckAppIdRegistration(
       
   141     const TDesC& aAppId )
       
   142     {
       
   143     RETURN_IF_NOT_CONNECTED();
       
   144 
       
   145     TIpcArgs messArgs;
       
   146     messArgs.Set( KMessageSlot0, &aAppId );
       
   147     return SendReceive( EAdminSubSessCheckAppIdRegistration, messArgs );
       
   148     }
       
   149 
       
   150 //  End of File
       
   151 
       
   152 
       
   153 
       
   154 
       
   155 
       
   156 
       
   157 
       
   158 
       
   159 
       
   160 
       
   161 
       
   162 
       
   163 
       
   164 
       
   165 
       
   166 
       
   167 
       
   168 
       
   169 
       
   170