sdkcreationmw/sdkruntimes/wsock/src/WinsockAgentCallback.cpp
author rajpuroh
Mon, 08 Mar 2010 12:09:11 +0530
changeset 0 b26acd06ea60
child 1 ac50fd48361b
permissions -rw-r--r--
First Contribution of SDK components
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     1
/*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     2
* Copyright (c) 2004-2005 Nokia Corporation and/or its subsidiary(-ies).
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     3
* All rights reserved.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     8
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     9
* Initial Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    11
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    12
* Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    13
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    14
* Description: 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    15
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    16
*/
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    17
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    18
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    19
#define TRACE_PREFIX "WSOCK: AgentCallback: "
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
#include "wsock.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
#include "WinsockAgentCallback.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    23
CWinsockAgentCallback::CWinsockAgentCallback(CWinsockAgent* aAgent,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    24
CWinsockAgent::CallbackMethod aMethod) : 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    25
CActive(EPriorityStandard), 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
iAgent(aAgent), 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
iMethod(aMethod)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
    CActiveScheduler::Add(this);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
void CWinsockAgentCallback::DoCancel()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
    TRACE("callback cancelled");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
    TRequestStatus *status = (&iStatus);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
    User::RequestComplete(status, KErrCancel);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
void CWinsockAgentCallback::RunL()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
    (iAgent->*iMethod)();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
void CWinsockAgentCallback::InvokeLater()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
    if (!IsActive())
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
        SetActive();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
        TRequestStatus *status = (&iStatus);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
        User::RequestComplete(status, KErrNone);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
CWinsockAgent* CWinsockAgentCallback::Agent()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
    return iAgent;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
}