bluetooth/btcomm/src/writer.cpp
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 1997-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // writer.cpp - all the active reader code
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <cs_port.h>
       
    19 #include "btcomm.h"
       
    20 #include "btcommactive.h"
       
    21 
       
    22 
       
    23 CBTPortWriter *CBTPortWriter::NewL(CBTPortProxy *aParent)
       
    24 /**
       
    25 	Create new CBTPortWriter.
       
    26 	This function creates a new CBTPortWriter active object.
       
    27 **/
       
    28 	{
       
    29 	CBTPortWriter *cc;
       
    30 	cc=new (ELeave) CBTPortWriter();
       
    31 	CleanupStack::PushL(cc);
       
    32 	cc->InitL(aParent);
       
    33 	CleanupStack::Pop();
       
    34 	CActiveScheduler::Add(cc);
       
    35 	return cc;
       
    36 	}
       
    37 
       
    38 void CBTPortWriter::InitL(CBTPortProxy *aParent)
       
    39 	{
       
    40 	iPortProxy=aParent;
       
    41 	}
       
    42 
       
    43 CBTPortWriter::~CBTPortWriter()
       
    44 /**
       
    45 	CBTPortWriter destructor.	
       
    46 **/
       
    47 	{
       
    48 	Cancel();
       
    49 	}
       
    50 
       
    51 void CBTPortWriter::RunL()
       
    52 /**
       
    53 	CBTPortWriter RunL.
       
    54 	Active status cleared.  We can now call the DoWriteCompleted 
       
    55 	function on the corresponding port proxy object.
       
    56 **/
       
    57 	{
       
    58     iPortProxy->DoWriteCompleted(iStatus.Int());
       
    59 	}
       
    60 
       
    61 void CBTPortWriter::QueueWrite(const TDesC8& aData)
       
    62 /**
       
    63 	CBTPortWriter QueueWrite.
       
    64 **/
       
    65 	{
       
    66 	iPortProxy->iSocket.Write(aData,iStatus);
       
    67 	SetActive();
       
    68 	}
       
    69 
       
    70 void CBTPortWriter::DoCancel()
       
    71 /**
       
    72 	CBTPortWriter DoCancel.
       
    73 	Nothing to cancel.
       
    74 **/
       
    75 	{
       
    76 	iPortProxy->iSocket.CancelWrite();
       
    77 	}
       
    78 
       
    79 CBTPortWriter::CBTPortWriter() 
       
    80 	: CActive (EPriorityStandard)
       
    81 /**
       
    82 	CBTPortWriter private c'tor.
       
    83 **/
       
    84 	{
       
    85 	}