bluetooth/btstack/linkmgr/eirpublishertxpowerlevel.cpp
changeset 0 29b1cd4cb562
child 23 32ba20339036
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2008-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 "eirpublishertxpowerlevel.h"
       
    17 #include <bluetooth/eirpublisherbase.h>
       
    18 
       
    19 //**********************************
       
    20 // CEirPublisherTxPowerLevel
       
    21 //**********************************
       
    22 /**
       
    23 Provides functionality to publish transmission power level to EIR.
       
    24 **/
       
    25 CEirPublisherTxPowerLevel* CEirPublisherTxPowerLevel::NewL()
       
    26 	{
       
    27 	CEirPublisherTxPowerLevel* self = new (ELeave) CEirPublisherTxPowerLevel();
       
    28 	CleanupStack::PushL(self);
       
    29 	self->ConstructL();
       
    30 	CleanupStack::Pop();
       
    31 	return self;
       
    32 	}
       
    33 
       
    34 CEirPublisherTxPowerLevel::CEirPublisherTxPowerLevel()
       
    35 :	CEirPublisherBase(EEirTagTxPowerLevel)
       
    36 	{
       
    37 	}
       
    38 
       
    39 void CEirPublisherTxPowerLevel::ConstructL()
       
    40 	{
       
    41 	CEirPublisherBase::ConstructL();
       
    42 	}
       
    43 
       
    44 CEirPublisherTxPowerLevel::~CEirPublisherTxPowerLevel()
       
    45 	{
       
    46 	}
       
    47 
       
    48 void CEirPublisherTxPowerLevel::UpdateTxPowerLevel(TInt8 aTxPowerLevel)
       
    49 	{
       
    50 	iTxPowerLevel = aTxPowerLevel;
       
    51 	iPublisher->PublishData(KSizeOfTxPowerLevelData);
       
    52 	}
       
    53 	
       
    54 // From MEirPublisherNotifier
       
    55 void CEirPublisherTxPowerLevel::MepnSpaceAvailable(TUint aBytesAvailable)
       
    56 	{
       
    57 	if (aBytesAvailable >= KSizeOfTxPowerLevelData)
       
    58 		{
       
    59 		// only publish TxPowerLevel if enough space
       
    60 		iPublishBuf.Zero();
       
    61 		iPublishBuf.Append(iTxPowerLevel);
       
    62 		iPublisher->SetData(iPublishBuf, EEirDataComplete);
       
    63 		}
       
    64 	else
       
    65 		{
       
    66 		// Otherwise publish zero length string
       
    67 		iPublishBuf.Zero();
       
    68 		iPublisher->SetData(iPublishBuf, EEirDataPartial);
       
    69 		}
       
    70 	}
       
    71 
       
    72 void CEirPublisherTxPowerLevel::MepnSetDataError(TInt /*aResult*/)
       
    73 	{
       
    74 	}