usbengines/usbotgwatcher/src/cusbstatehostahost.cpp
changeset 35 9d8b04ca6939
child 63 ef2686f7597e
equal deleted inserted replaced
34:7858bc6ead78 35:9d8b04ca6939
       
     1 /*
       
     2  * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  Implementation
       
    15  *
       
    16  */
       
    17 
       
    18 #include <e32base.h>
       
    19 #include <UsbWatcherInternalPSKeys.h>
       
    20 #include <e32property.h>
       
    21 
       
    22 #include "cusbstatehostahost.h"
       
    23 #include "cusbnotifmanager.h"
       
    24 
       
    25 #include "definitions.h"
       
    26 #include "errors.h"
       
    27 #include "debug.h"
       
    28 #include "panic.h"
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // 
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CUsbStateHostAHost::CUsbStateHostAHost(CUsbOtgWatcher& aWatcher) :
       
    35     CUsbStateHostABase(aWatcher)
       
    36     {
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // 
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 void CUsbStateHostAHost::ConstructL()
       
    44     {
       
    45     LOG_FUNC
       
    46 
       
    47     CUsbStateHostABase::ConstructL();
       
    48 
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // 
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 CUsbStateHostAHost* CUsbStateHostAHost::NewL(CUsbOtgWatcher& aWatcher)
       
    56     {
       
    57     LOG_FUNC
       
    58 
       
    59     CUsbStateHostAHost* self = new (ELeave) CUsbStateHostAHost(aWatcher);
       
    60     CleanupStack::PushL(self);
       
    61     self->ConstructL();
       
    62     CleanupStack::Pop(self);
       
    63     return self;
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // 
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 CUsbStateHostAHost::~CUsbStateHostAHost()
       
    71     {
       
    72     LOG_FUNC
       
    73 
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // 
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 TUsbStateIds CUsbStateHostAHost::Id()
       
    81     {
       
    82     return EUsbStateHostAHost;
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // 
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 void CUsbStateHostAHost::JustAdvancedToThisStateL()
       
    90     {
       
    91     LOG_FUNC
       
    92 
       
    93     // do general things 
       
    94     CUsbStateHostABase::JustAdvancedToThisStateL();
       
    95 
       
    96     LEAVEIFERROR(RProperty::Set(KPSUidUsbWatcher,
       
    97             KUsbWatcherIsPeripheralConnected,
       
    98             KUsbWatcherPeripheralIsConnected));
       
    99 
       
   100     }
       
   101 
       
   102 // ---------------------------------------------------------------------------
       
   103 // 
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 void CUsbStateHostAHost::JustBeforeLeavingThisStateL()
       
   107     {
       
   108     LOG_FUNC
       
   109 
       
   110     LEAVEIFERROR(RProperty::Set(KPSUidUsbWatcher,
       
   111             KUsbWatcherIsPeripheralConnected,
       
   112             KUsbWatcherPeripheralIsNotConnected));
       
   113 
       
   114     // do general things 
       
   115     CUsbStateHostABase::JustBeforeLeavingThisStateL();
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // 
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 void CUsbStateHostAHost::DeviceDetachedL(TDeviceEventInformation)
       
   123     {
       
   124     LOG_FUNC
       
   125     ChangeHostStateL( EUsbStateHostAInitiate);
       
   126     }
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // 
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 void CUsbStateHostAHost::BadHubPositionL()
       
   133     {
       
   134     LOG_FUNC
       
   135     PANIC( EBadHubPositionEventNotExpected);
       
   136     }