irda/irdastack/irtranp/SCONCONC.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 //
       
    15 
       
    16 #include "comreadwrite.h"
       
    17 #include "ABSTRACT.H"
       
    18 #include "SCONCONC.H"
       
    19 #include "GLOBAL.H"
       
    20 #include <e32base.h>
       
    21 
       
    22 SCONconCommand::SCONconCommand()
       
    23 	{
       
    24 	}
       
    25 
       
    26 SCONconCommand::SCONconCommand(CComReadWrite* aComReadWrite)
       
    27 	{
       
    28 	iComReadWrite = aComReadWrite;
       
    29 	}
       
    30 
       
    31 SCONconCommand::~SCONconCommand()
       
    32 	{
       
    33 	}
       
    34 
       
    35 	/*
       
    36 	* Method description:	Builds the packet
       
    37 	*
       
    38 */
       
    39 
       
    40 void SCONconCommand::Create()
       
    41 	{
       
    42 	//TPtr8 d = m_oData.Des();
       
    43 	
       
    44 	TBuf8<255> neginf; // neginf
       
    45 	//TPtr8 n = neginf.Des();
       
    46 	
       
    47 	neginf.Append(KTranpNegVer);
       
    48 	neginf.Append(KTranpFR);
       
    49 	neginf.Append(m_PDU);
       
    50 	neginf.Append(KTranpCR);
       
    51 	neginf.Append(KTranpLF);
       
    52 	neginf.Append(KTranpID);
       
    53 	neginf.Append(KTranpProductInformationString);
       
    54 	neginf.Append(KTranpCR);
       
    55 	neginf.Append(KTranpLF);
       
    56 	
       
    57 	m_oData.Append(0x00);
       
    58 	m_oData.Append(KTranpMsgTypeCEC);
       
    59 	m_oData.Append(KTranpInfTypeNeg);
       
    60 	
       
    61 	m_oData.Append(neginf.Length() + 18); // Hardcoded, but always the same .. size of the parts below.
       
    62 	
       
    63 	m_oData.Append(KTranpInfVer);
       
    64 	m_oData.Append(KTranpCFLGie);
       
    65 	
       
    66 	m_oData.Append(m_PMID);
       
    67 	m_oData.Append(m_SMID);
       
    68 	
       
    69 	m_oData.Append(neginf);
       
    70 	}
       
    71 
       
    72 	/*
       
    73 	* Method description:	Sends the packet
       
    74 	*
       
    75 */
       
    76 
       
    77 void SCONconCommand::DoIt()
       
    78 	{
       
    79 	iComReadWrite->Send(m_oData);
       
    80 	}
       
    81 
       
    82 void SCONconCommand::GetReply()
       
    83 	{
       
    84 	// We won't use this at all!
       
    85 	}
       
    86 
       
    87 	/*
       
    88 	* Method description:	Retrieves the packet - used for debugging purposes
       
    89 	*
       
    90 	* Returns:				Pointer to the packet
       
    91 */
       
    92 
       
    93 TDesC8& SCONconCommand::GetData()
       
    94 	{
       
    95 	return m_oData;
       
    96 	}
       
    97 
       
    98 	/*
       
    99 	* Method description:	Sets the Primary Machine ID
       
   100 	*
       
   101 	* Parameter:			a_PMID - the new Machine ID
       
   102 */
       
   103 
       
   104 void SCONconCommand::SetPMID(TPtr8 a_PMID)
       
   105 	{
       
   106 	m_PMID = a_PMID;
       
   107 	}
       
   108 
       
   109 	/*
       
   110 	* Method description:	Sets the Secondary Machine ID
       
   111 	*
       
   112 	* Parameter:			a_SMID - the new Machine ID
       
   113 */
       
   114 
       
   115 void SCONconCommand::SetSMID(TPtr8 a_SMID)
       
   116 	{
       
   117 	m_SMID = a_SMID;
       
   118 	}
       
   119 
       
   120 	/*
       
   121 	* Method description:	Sets the maximum receivable PDU size
       
   122 	*
       
   123 	* Parameter:			a_PDU - the new PDU size
       
   124 */
       
   125 
       
   126 void SCONconCommand::SetPDU(TUint8 a_PDU)
       
   127 	{
       
   128 	m_PDU = a_PDU;
       
   129 	}