javaextensions/satsa/apdu/src.s60/cstsslotinfo.cpp
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     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:
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDE FILES
       
    20 #include "cstsslotinfo.h"
       
    21 #include "logger.h"
       
    22 
       
    23 namespace java
       
    24 {
       
    25 namespace satsa
       
    26 {
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // Reader status bits.
       
    31 const TUint8 KIdentityMask = 0x07;
       
    32 const TUint8 KCardReaderRemovable = 0x08;
       
    33 const TUint8 KCardPresent = 0x40;
       
    34 
       
    35 const TUint8 KHotSwappable = 'H';
       
    36 const TUint8 KColdSwappable = 'C';
       
    37 
       
    38 // ============================ MEMBER FUNCTIONS ===============================
       
    39 
       
    40 
       
    41 CSTSSlotInfo::CSTSSlotInfo()
       
    42 {
       
    43 }
       
    44 
       
    45 void CSTSSlotInfo::ConstructL(const TUint8& aRawData)
       
    46 {
       
    47     LOG(ESATSA, EInfo, "+ CSTSSlotInfo::ConstructL");
       
    48     iRawData = aRawData;
       
    49     // parse rawdata
       
    50     iRemovable = (iRawData & KCardReaderRemovable);
       
    51     iCardPresent = (iRawData & KCardPresent);
       
    52     iSlotNumber = (iRawData & KIdentityMask);
       
    53     LOG(ESATSA, EInfo, "-- CSTSSlotInfo::ConstructL");
       
    54 }
       
    55 
       
    56 CSTSSlotInfo* CSTSSlotInfo::NewL(const TUint8& aRawData)
       
    57 {
       
    58     LOG(ESATSA, EInfo, "+ CSTSSlotInfo::NewL called");
       
    59     CSTSSlotInfo* self = new(ELeave) CSTSSlotInfo;
       
    60     CleanupStack::PushL(self);
       
    61     self->ConstructL(aRawData);
       
    62     CleanupStack::Pop(self);
       
    63     LOG(ESATSA, EInfo, "- CSTSSlotInfo::NewL");
       
    64     return self;
       
    65 }
       
    66 
       
    67 CSTSSlotInfo::~CSTSSlotInfo()
       
    68 {
       
    69 
       
    70 }
       
    71 
       
    72 TInt CSTSSlotInfo::Slot()
       
    73 {
       
    74     LOG(ESATSA, EInfo, "+ CSTSSlotInfo::SLot");
       
    75     return iSlotNumber;
       
    76 }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CSTSSlotInfo::Type
       
    80 // Returns type of the slot.
       
    81 // (other items were commented in a header).
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 TChar CSTSSlotInfo::Type()
       
    85 {
       
    86     LOG(ESATSA, EInfo, "+ CSTSSlotInfo::Type");
       
    87     if (iRemovable)
       
    88     {
       
    89         LOG(ESATSA, EInfo, "+ CSTSSlotInfo::Type: Card is HotSwappable");
       
    90         return KHotSwappable;
       
    91     }
       
    92     else
       
    93     {
       
    94         LOG(ESATSA, EInfo, "+ CSTSSlotInfo::Type: Card is ColdSwappable");
       
    95         return KColdSwappable;
       
    96     }
       
    97 }
       
    98 
       
    99 } // namespace satsa
       
   100 } // namespace java
       
   101 //  End of File
       
   102