sdkcreationmw/sdkruntimes/wsock/src/WinsockAgentCallback.cpp
changeset 0 b26acd06ea60
child 1 ac50fd48361b
equal deleted inserted replaced
-1:000000000000 0:b26acd06ea60
       
     1 /*
       
     2 * Copyright (c) 2004-2005 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #define TRACE_PREFIX "WSOCK: AgentCallback: "
       
    20 #include "wsock.h"
       
    21 #include "WinsockAgentCallback.h"
       
    22 
       
    23 CWinsockAgentCallback::CWinsockAgentCallback(CWinsockAgent* aAgent,
       
    24 CWinsockAgent::CallbackMethod aMethod) : 
       
    25 CActive(EPriorityStandard), 
       
    26 iAgent(aAgent), 
       
    27 iMethod(aMethod)
       
    28 {
       
    29     CActiveScheduler::Add(this);
       
    30 }
       
    31 
       
    32 void CWinsockAgentCallback::DoCancel()
       
    33 {
       
    34     TRACE("callback cancelled");
       
    35     TRequestStatus *status = (&iStatus);
       
    36     User::RequestComplete(status, KErrCancel);
       
    37 }
       
    38 
       
    39 void CWinsockAgentCallback::RunL()
       
    40 {
       
    41     (iAgent->*iMethod)();
       
    42 }
       
    43 
       
    44 void CWinsockAgentCallback::InvokeLater()
       
    45 {
       
    46     if (!IsActive())
       
    47     {
       
    48         SetActive();
       
    49         TRequestStatus *status = (&iStatus);
       
    50         User::RequestComplete(status, KErrNone);
       
    51     }
       
    52 }
       
    53 
       
    54 CWinsockAgent* CWinsockAgentCallback::Agent()
       
    55 {
       
    56     return iAgent;
       
    57 }