presetserver/clientsrc/Psservnotifier.cpp
changeset 0 09774dfdd46b
child 12 608f67c22514
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2006-2006 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:  Client-server preset notifier
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <pscommon.h>
       
    20 #include <psserv.h>
       
    21 
       
    22 #include "psservnotifier.h"
       
    23 
       
    24 // ======== LOCAL FUNCTIONS ========
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // Constructor.
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 RPSServNotifier::RPSServNotifier( RPSServ& aServer, TInt aId )
       
    33     : iServer( aServer ), iData(), iId( aId )
       
    34     {
       
    35     // Initialize the last handled notification identifier to zero as the default constructor doesn't do it for us.
       
    36     iData().iNotificationId = 0; 
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // Closes the notifier.
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 void RPSServNotifier::Close()
       
    44     {
       
    45     CancelNotify();
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // Requests a notify when a preset changes.
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 void RPSServNotifier::Notify( TRequestStatus& aStatus )
       
    53     {
       
    54     iServer.SendReceive( EPSOpNotify, TIpcArgs( reinterpret_cast<TInt>( this ), iId, &iData ), aStatus );
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // Cancels a pending notify.
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 void RPSServNotifier::CancelNotify()
       
    62     {
       
    63     iServer.SendReceive( EPSOpCancelNotify, TIpcArgs( reinterpret_cast<TInt>( this ) ) );
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // Returns the id of the preset that was changed.
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 TInt RPSServNotifier::Id() const
       
    71     {
       
    72     return iData().iId;
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // Returns the data handler of the preset that was changed.
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 TUid RPSServNotifier::DataHandler() const
       
    80     {
       
    81     return iData().iDataHandler;
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------------------------
       
    85 // Returns the reason for the change.
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 MPSPresetObserver::TPSReason RPSServNotifier::Reason() const
       
    89     {
       
    90     return iData().iReason;
       
    91     }
       
    92 
       
    93 // ======== GLOBAL FUNCTIONS ========