javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtinput.cpp
branchRCL_3
changeset 66 2455ef1f5bbc
child 83 26b2b12093af
equal deleted inserted replaced
65:ae942d28ec0e 66:2455ef1f5bbc
       
     1 /*******************************************************************************
       
     2  * Copyright (c) 2005, 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved. This program and the accompanying materials
       
     4  * are made available under the terms of the Eclipse Public License v1.0
       
     5  * which accompanies this distribution, and is available at
       
     6  * http://www.eclipse.org/legal/epl-v10.html
       
     7  *
       
     8  * Contributors:
       
     9  *     Nokia Corporation - S60 implementation
       
    10  *******************************************************************************/
       
    11 
       
    12 
       
    13 #include <hal.h>
       
    14 #include "swtinput.h"
       
    15 #include "swtmobiledevice.h"
       
    16 
       
    17 
       
    18 // ======== MEMBER FUNCTIONS ========
       
    19 
       
    20 
       
    21 // ---------------------------------------------------------------------------
       
    22 // CSwtInput::NewL
       
    23 // ---------------------------------------------------------------------------
       
    24 //
       
    25 CSwtInput* CSwtInput::NewL(TSwtPeer aPeer, TInt aId)
       
    26 {
       
    27     CSwtInput* self = new(ELeave) CSwtInput(aPeer);
       
    28     CleanupStack::PushL(self);
       
    29     self->ConstructL(aId);
       
    30     CleanupStack::Pop(self);
       
    31     return self;
       
    32 }
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // CSwtInput::CSwtInput
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 CSwtInput::CSwtInput(TSwtPeer aPeer)
       
    39         : iPeer(aPeer)
       
    40         , iType(KErrNotFound)
       
    41         , iLocation(KErrNotFound)
       
    42 {
       
    43 }
       
    44 
       
    45 void CSwtInput::ConstructL(TInt aId)
       
    46 {
       
    47     RArray<CSwtMobileDevice::TSwtHwInput> inputs;
       
    48     CleanupClosePushL(inputs);
       
    49     CSwtMobileDevice::GetHwInputsL(inputs);
       
    50     if (aId < inputs.Count())
       
    51     {
       
    52         iType = inputs[aId].iType;
       
    53         iLocation = inputs[aId].iLocation;
       
    54     }
       
    55     CleanupStack::PopAndDestroy(&inputs);
       
    56 }
       
    57 
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // CSwtInput::~CSwtInput
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 CSwtInput::~CSwtInput()
       
    64 {
       
    65 }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // CSwtInput::Dispose
       
    69 // From MSwtInput
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 TSwtPeer CSwtInput::Dispose()
       
    73 {
       
    74     TSwtPeer peer(iPeer);
       
    75     delete this;
       
    76     return peer;
       
    77 }
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // CSwtInput::GetLocation
       
    81 // From MSwtInput
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 TInt CSwtInput::GetLocation()
       
    85 {
       
    86     return iLocation;
       
    87 }
       
    88 
       
    89 // ---------------------------------------------------------------------------
       
    90 // CSwtInput::GetType
       
    91 // From MSwtInput
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 TInt CSwtInput::GetType()
       
    95 {
       
    96     return iType;
       
    97 }