usbengines/usbotgwatcher/src/cusbstatehostahost.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 12 Mar 2010 15:48:40 +0200
branchRCL_3
changeset 6 a15c582fbf97
parent 1 705ec7b86991
child 7 ff9df6630274
permissions -rw-r--r--
Revision: 201007 Kit: 201008

/*
 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
 * Description:  Implementation
 *
 */

#include <e32base.h>
#include <UsbWatcherInternalPSKeys.h>

#include "cusbstatehostahost.h"
#include "cusbnotifmanager.h"

#include "definitions.h"
#include "errors.h"
#include "debug.h"
#include "panic.h"

// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
CUsbStateHostAHost::CUsbStateHostAHost(CUsbOtgWatcher& aWatcher) :
    CUsbStateHostABase(aWatcher)
    {
    }

// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CUsbStateHostAHost::ConstructL()
    {
    LOG_FUNC

    CUsbStateHostABase::ConstructL();

    }

// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
CUsbStateHostAHost* CUsbStateHostAHost::NewL(CUsbOtgWatcher& aWatcher)
    {
    LOG_FUNC

    CUsbStateHostAHost* self = new (ELeave) CUsbStateHostAHost(aWatcher);
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::Pop(self);
    return self;
    }

// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
CUsbStateHostAHost::~CUsbStateHostAHost()
    {
    LOG_FUNC

    }

// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
TUsbStateIds CUsbStateHostAHost::Id()
    {
    return EUsbStateHostAHost;
    }

// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CUsbStateHostAHost::JustAdvancedToThisStateL()
    {
    LOG_FUNC

    // do general things 
    CUsbStateHostABase::JustAdvancedToThisStateL();

    User::LeaveIfError(RProperty::Set(KPSUidUsbWatcher,
            KUsbWatcherIsPeripheralConnected,
            KUsbWatcherPeripheralIsConnected));

    }

// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CUsbStateHostAHost::JustBeforeLeavingThisStateL()
    {
    LOG_FUNC

    User::LeaveIfError(RProperty::Set(KPSUidUsbWatcher,
            KUsbWatcherIsPeripheralConnected,
            KUsbWatcherPeripheralIsNotConnected));

    // do general things 
    CUsbStateHostABase::JustBeforeLeavingThisStateL();
    }

// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CUsbStateHostAHost::DeviceDetachedL(TDeviceEventInformation)
    {
    LOG_FUNC
    ChangeHostStateL( EUsbStateHostAInitiate);
    }

// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CUsbStateHostAHost::BadHubPositionL()
    {
    LOG_FUNC
    Panic( EBadHubPositionEventNotExpected);
    }