usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp
author Fionntina Carville <fionntinac@symbian.org>
Mon, 15 Nov 2010 13:37:26 +0000
branchRCL_3
changeset 95 55a3258355ea
parent 80 e02eb84a14d2
permissions -rw-r--r--
Bug 3539. Update localisation mappings for usbservices.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
     3
 * All rights reserved.
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
     4
 * This component and the accompanying materials are made available
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
     6
 * which accompanies this distribution, and is available
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
 *
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
     9
 * Initial Contributors:
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    10
 * Nokia Corporation - initial contribution.
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    11
 *
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    12
 * Contributors:
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    13
 *
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    14
 * Description:  Blink/show Usb indicator notifier implementation
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    15
 *
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    16
 */
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
    18
#include <AknSmallIndicator.h>
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
    19
#include <avkon.hrh>
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <usbuinotif.h>
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include "cusbindicatornotifier.h"
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    23
#include "cusbstate.h"
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include "definitions.h"
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include "debug.h"
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include "panic.h"
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
// ======== MEMBER FUNCTIONS ========
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
// -----------------------------------------------------------------------------
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
// Two-phased constructor.
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
// -----------------------------------------------------------------------------
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
//
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    35
CUsbIndicatorNotifier* CUsbIndicatorNotifier::NewL(
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    36
        CUsbNotifManager& aNotifManager, CUsbOtgWatcher& aOtgWatcher)
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
    {
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    38
    LOG_FUNC
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    40
    CUsbIndicatorNotifier* self = new (ELeave) CUsbIndicatorNotifier(
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    41
            aNotifManager, aOtgWatcher);
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
    CleanupStack::PushL(self);
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
    self->ConstructL();
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
    CleanupStack::Pop(self);
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
    return self;
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
    }
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
// ---------------------------------------------------------------------------
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
// Destructor
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
// ---------------------------------------------------------------------------
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
//
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
CUsbIndicatorNotifier::~CUsbIndicatorNotifier()
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
    {
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    54
    LOG_FUNC
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    55
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
    Close();
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    57
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    58
    if (iOtgWatcher.VBusObserver())
3
47c263f7e521 Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    59
        {
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    60
        TRAP_IGNORE(iOtgWatcher.VBusObserver()->UnsubscribeL(*this));
3
47c263f7e521 Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    61
        }
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    62
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    63
    // Unsubscribe from otg watcher states change notifications
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    64
    TRAP_IGNORE(iOtgWatcher.UnsubscribeL(*this));
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    65
    }
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    66
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    67
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    68
// C++ constructor
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    69
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    70
//
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    71
CUsbIndicatorNotifier::CUsbIndicatorNotifier(CUsbNotifManager& aNotifManager,
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    72
        CUsbOtgWatcher& aOtgWatcher) :
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
    73
    CUsbNotifier(aNotifManager, KUsbUiNotifOtgIndicator, NULL), iOtgWatcher(
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
    74
            aOtgWatcher)
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    75
    {
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    76
    LOG_FUNC
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
    77
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
    78
    //To be changed to EAknIndicatorStateAnimate and remove iIconBlinkingTimer
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
    79
    //when AVKON implements animation form of usb indicator.
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
    80
    iIndicatorState = EAknIndicatorStateOn;
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    81
    }
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    82
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    83
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    84
// Second-phase constructor
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    85
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    86
//
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    87
void CUsbIndicatorNotifier::ConstructL()
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    88
    {
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    89
    LOG_FUNC
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    90
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    91
    // Subscribe for VBus change notifications
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    92
    iOtgWatcher.VBusObserver()->SubscribeL(*this);
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    93
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    94
    // Subscribe for otg watcher states change notifications
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
    95
    iOtgWatcher.SubscribeL(*this);
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    96
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
    97
    // check here for condition to set usb indicator
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
    98
    SetIndicatorL();
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
    99
    }
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   101
// ---------------------------------------------------------------------------
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   102
// Show/hide static icon of the indicator. 
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   103
// If the indicator is blinking, stop blinking it and show/hide the static 
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   104
// form of the indicator.
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   105
// ---------------------------------------------------------------------------
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   106
//
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   107
void CUsbIndicatorNotifier::ShowStaticL(TBool aVisible)
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   108
    {
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   109
    LOG_FUNC
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   110
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   111
    LOG1("aVisible = %d" , aVisible);
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   112
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   113
    SetIndicatorStateL(aVisible
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   114
                                ? EAknIndicatorStateOn
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   115
                                   : EAknIndicatorStateOff);
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    }
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   118
// ---------------------------------------------------------------------------
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   119
// 
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   120
// ---------------------------------------------------------------------------
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   121
//
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   122
void CUsbIndicatorNotifier::BlinkL()
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   123
    {
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   124
    LOG_FUNC
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   125
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   126
    SetIndicatorStateL( EAknIndicatorStateAnimate );
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   127
    }
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   128
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   129
// ---------------------------------------------------------------------------
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   130
// From base class CUsbNotifier
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   131
// ---------------------------------------------------------------------------
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   132
//
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   133
void CUsbIndicatorNotifier::ShowL()
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   134
    {
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   135
    LOG_FUNC
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   136
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   137
    ShowStaticL(ETrue);
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   138
    }
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
// ---------------------------------------------------------------------------
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
// From CUsbNotifier
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
// ---------------------------------------------------------------------------
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
//
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
void CUsbIndicatorNotifier::Close()
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
    {
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   146
    LOG_FUNC
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   147
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   148
    TRAP_IGNORE( ShowStaticL(EFalse) );
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
    }
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
// ---------------------------------------------------------------------------
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
// Set USB indicator On or Off
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
// ---------------------------------------------------------------------------
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
//
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   155
void CUsbIndicatorNotifier::SetIndicatorStateL(const TInt aState)
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    {
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   157
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   158
    LOG1( "USB indicator State = %d" , aState);
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   159
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   160
    CAknSmallIndicator* indicator = CAknSmallIndicator::NewLC(TUid::Uid(
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   161
            EAknIndicatorUSBConnection));
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   162
    indicator->SetIndicatorStateL(aState);
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   163
    CleanupStack::PopAndDestroy(indicator); //indicator    
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
    }
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   165
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   166
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   167
// 
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   168
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   169
//
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   170
void CUsbIndicatorNotifier::OtgWatcherStateChangedL(TUsbStateIds aState)
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   171
    {
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   172
    SetIndicatorL();
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   173
    }
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   174
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   175
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   176
// 
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   177
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   178
//
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   179
void CUsbIndicatorNotifier::VBusDownL()
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   180
    {
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   181
    SetIndicatorL();
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   182
    }
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   183
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   184
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   185
// 
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   186
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   187
//
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   188
void CUsbIndicatorNotifier::VBusUpL()
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   189
    {
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   190
    SetIndicatorL();
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   191
    }
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   192
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   193
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   194
// 
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   195
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   196
//  
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   197
void CUsbIndicatorNotifier::VBusObserverErrorL(TInt aError)
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   198
    {
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   199
    // do nothing
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   200
    }
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   201
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   202
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   203
// 
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   204
// ---------------------------------------------------------------------------
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   205
//  
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   206
void CUsbIndicatorNotifier::SetIndicatorL()
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   207
    {
21
ff9df6630274 Revision: 201009
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   208
    if (!(iOtgWatcher.IsDeviceA()) || iOtgWatcher.CurrentHostState()->Id() == EUsbStateHostAPeripheral)
3
47c263f7e521 Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   209
        {
21
ff9df6630274 Revision: 201009
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   210
        // if B or peripheral, than other party (usbwatcher) takes care of usb indicator
3
47c263f7e521 Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   211
        // in combined usbwatcher (if role swap allowed) one class has to manage usb indicator 
47c263f7e521 Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   212
        return;
47c263f7e521 Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   213
        }
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   214
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   215
    // if VBus Up and we are host -> show indicator
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   216
    if ((iOtgWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp)
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   217
            && (iOtgWatcher.CurrentHostState()->Id() == EUsbStateHostAHost))
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   218
        {
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   219
        ShowStaticL(ETrue);
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   220
        }
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   221
    // if VBus up and we are not host -> Blink indicator
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   222
    else if ((iOtgWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp)
20
a15c582fbf97 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   223
            && (iOtgWatcher.CurrentHostState()->Id() != EUsbStateHostAHost))
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   224
        {
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   225
        BlinkL();
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   226
        }
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   227
    else
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   228
    // Otherwise do not show indicator
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   229
        {
80
e02eb84a14d2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 79
diff changeset
   230
        ShowStaticL(EFalse);
1
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   231
        }
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   232
    }
705ec7b86991 Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   233
0
1e05558e2206 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
// End of file