bluetooth/btstack/sdp/sdppdu.cpp
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2000-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 "sdppdu.h"
       
    17 
       
    18 CSdpPdu::CSdpPdu(CSdpNetDbProvider* aSdpNetDbProv)
       
    19 	: iBuf(KSdpPduHeaderSize), //Reserve Space for PDU header
       
    20 	iNetDbProvider(aSdpNetDbProv)
       
    21 	{
       
    22 	}
       
    23 
       
    24 CSdpPdu::~CSdpPdu()
       
    25 	{
       
    26 	iLink.Deque();
       
    27 	}
       
    28 
       
    29 void CSdpPdu::SetPduId(TUint8 aPduId)
       
    30 	{
       
    31 	iBuf[KSdpPduIdOffset] = aPduId;
       
    32 	}
       
    33 
       
    34 TUint8 CSdpPdu::PduId()
       
    35 	{
       
    36 	return iBuf[KSdpPduIdOffset];
       
    37 	}
       
    38 
       
    39 void CSdpPdu::SetTransid(TUint16 aTransId)
       
    40 	{
       
    41 	BigEndian::Put16(&iBuf[KSdpPduTransIdOffset], aTransId);
       
    42 	}
       
    43 
       
    44 TUint16 CSdpPdu::TransId()
       
    45 	{
       
    46 	return BigEndian::Get16(&iBuf[KSdpPduTransIdOffset]);
       
    47 	}
       
    48 
       
    49 void CSdpPdu::SetLength()
       
    50 	{
       
    51 	BigEndian::Put16(&iBuf[KSdpPduParamLengthOffset],
       
    52 					 static_cast<TUint16>(iBuf.Length()-KSdpPduHeaderSize));
       
    53 	}
       
    54 
       
    55 void CSdpPdu::PutByte(TUint8 aByte)
       
    56 	{
       
    57 	iBuf.Append(aByte);
       
    58 	}
       
    59 
       
    60 void CSdpPdu::PutBigEndian16(TUint16 aShort)
       
    61 	{
       
    62 	TInt len = iBuf.Length();
       
    63 	iBuf.SetLength(len+sizeof(aShort));
       
    64 	BigEndian::Put16(&iBuf[len], aShort);
       
    65 	}
       
    66 
       
    67 void CSdpPdu::PutBigEndian32(TUint32 aLong)
       
    68 	{
       
    69 	TInt len = iBuf.Length();
       
    70 	iBuf.SetLength(len+sizeof(aLong));
       
    71 	BigEndian::Put32(&iBuf[len], aLong);
       
    72 	}
       
    73 
       
    74 void CSdpPdu::PutData(const TDesC8& aDes)
       
    75 	{
       
    76 	iBuf.Append(aDes);
       
    77 	}
       
    78 
       
    79 TDesC8& CSdpPdu::Data()
       
    80 	{
       
    81 	return iBuf;
       
    82 	}
       
    83 
       
    84 CSdpNetDbProvider* CSdpPdu::NetDbProvider()
       
    85 	{
       
    86 	return iNetDbProvider;
       
    87 	}
       
    88