bthci/hci2implementations/CommandsEvents/symbian/src/rolechangeevent.cpp
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2006-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 // This file was generated automatically from the template eventsource.tmpl
       
    15 // on Wed, 25 Jul 2007 17:00:41 (time stamp)
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22 */
       
    23 
       
    24 #include <bluetooth/hci/rolechangeevent.h>
       
    25 #include <bluetooth/hci/hcierrors.h>
       
    26 #include <bluetooth/hci/hciopcodes.h>
       
    27 #include "symbiancommandseventsutils.h"
       
    28 
       
    29 #ifdef __FLOG_ACTIVE
       
    30 _LIT8(KLogComponent, LOG_COMPONENT_COMMANDSEVENTS_SYMBIAN);
       
    31 #endif
       
    32 
       
    33 // Construct an event object to wrap existing event data received from the Controller
       
    34 EXPORT_C TRoleChangeEvent::TRoleChangeEvent(const TDesC8& aEventData)
       
    35 	: THCIEventBase(aEventData)
       
    36 	{
       
    37 	iErrorCode = THCIErrorCode(iEventData[2]); // Status field is in octet 3
       
    38 	}
       
    39 
       
    40 // Construct a faked event, storing the supplied event parameters into the supplied empty event data buffer.
       
    41 EXPORT_C TRoleChangeEvent::TRoleChangeEvent(THCIErrorCode aStatus, const TBTDevAddr& aBDADDR, TUint8 aNewrole, TDes8& aEventData)
       
    42 	: THCIEventBase(ERoleChangeEvent, 8, aEventData)
       
    43 	{
       
    44 	iErrorCode = aStatus;
       
    45 	PutTUint8(aStatus, aEventData);
       
    46 	PutDevAddr(aBDADDR, aEventData);
       
    47 	PutTUint8(aNewrole, aEventData);
       
    48 	iEventData.Set(aEventData);
       
    49 	}
       
    50 
       
    51 // Destructor
       
    52 EXPORT_C TRoleChangeEvent::~TRoleChangeEvent()
       
    53 	{
       
    54 	}
       
    55 
       
    56 // The static Cast method is used to obtain a pointer to the derived class object
       
    57 EXPORT_C TRoleChangeEvent& TRoleChangeEvent::Cast(const THCIEventBase& aEvent)
       
    58 	{
       
    59 	__ASSERT_DEBUG(aEvent.EventCode() == ERoleChangeEvent, PANIC(KSymbianCommandsEventsPanicCat, EWrongEventCode));
       
    60 	return *(reinterpret_cast<TRoleChangeEvent*>(&const_cast<THCIEventBase&>(aEvent)));
       
    61 	}
       
    62 
       
    63 // Accessor methods for the parameters of the event
       
    64 
       
    65 EXPORT_C TBTDevAddr TRoleChangeEvent::BDADDR() const
       
    66 	{
       
    67 	return AsDevAddr(3);
       
    68 	}
       
    69 
       
    70 EXPORT_C TUint8 TRoleChangeEvent::Newrole() const
       
    71 	{
       
    72 	return AsTUint8(9);
       
    73 	}
       
    74 
       
    75