bluetoothengine/btsap/src/BTSapSimCardStatusNotifier.cpp
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2004 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 *     This class handles SIM card status change notification
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "BTSapSimCardStatusNotifier.h"
       
    23 #include "BTSapServerState.h"
       
    24 #include "debug.h"
       
    25 
       
    26 // ================= MEMBER FUNCTIONS =======================
       
    27 
       
    28 // C++ default constructor can NOT contain any code, that
       
    29 // might leave.
       
    30 //
       
    31 CBTSapSimCardStatusNotifier::CBTSapSimCardStatusNotifier(CBTSapServerState& aBTSapServerState)
       
    32     : CActive(EPriorityNormal), 
       
    33       iBTSapServerState(aBTSapServerState),
       
    34       iSubscriptionModule(aBTSapServerState.SubscriptionModule())
       
    35     {
       
    36     CActiveScheduler::Add(this);
       
    37     }
       
    38 
       
    39 // Destructor.
       
    40 CBTSapSimCardStatusNotifier::~CBTSapSimCardStatusNotifier()
       
    41     {
       
    42     BTSAP_TRACE_OPT(KBTSAP_TRACE_FUNCTIONS, BTSapPrintTrace(_L("[BTSap]  ~CBTSapSimCardStatusNotifier")));
       
    43 	Cancel();
       
    44     }
       
    45 
       
    46 // ---------------------------------------------------------
       
    47 // NewL()
       
    48 // ---------------------------------------------------------
       
    49 //
       
    50 CBTSapSimCardStatusNotifier* CBTSapSimCardStatusNotifier::NewL(CBTSapServerState& aBTSapServerState)
       
    51     {
       
    52     CBTSapSimCardStatusNotifier* self = new (ELeave) CBTSapSimCardStatusNotifier(aBTSapServerState);
       
    53     CleanupStack::PushL(self);
       
    54     self->ConstructL();
       
    55     CleanupStack::Pop();
       
    56     return self;
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------
       
    60 // ConstructL
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 void CBTSapSimCardStatusNotifier::ConstructL()
       
    64     {
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------
       
    68 // DoCancel
       
    69 // ---------------------------------------------------------
       
    70 //
       
    71 void CBTSapSimCardStatusNotifier::DoCancel()
       
    72     {
       
    73     BTSAP_TRACE_OPT(KBTSAP_TRACE_FUNCTIONS, BTSapPrintTrace(_L("[BTSap]  CBTSapSimCardStatusNotifier: DoCancel")));
       
    74     iSubscriptionModule.CancelAsyncRequest(ECustomNotifySimCardStatusIPC);
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------
       
    78 // RunL
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 void CBTSapSimCardStatusNotifier::RunL()
       
    82     {
       
    83     BTSAP_TRACE_OPT(KBTSAP_TRACE_FUNCTIONS, BTSapPrintTrace(_L("[BTSap]  CBTSapSimCardStatusNotifier: RunL: %d, CardStatus: %d"), iStatus.Int(), iCardStatus));
       
    84     iBTSapServerState.SimCardStatusChanged(TCardStatus(iCardStatus));
       
    85 
       
    86     iSubscriptionModule.NotifySimCardStatus(iStatus, iCardStatus);
       
    87     SetActive();
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------
       
    91 // Start
       
    92 // ---------------------------------------------------------
       
    93 void CBTSapSimCardStatusNotifier::Start()
       
    94     {
       
    95     BTSAP_TRACE_OPT(KBTSAP_TRACE_FUNCTIONS, BTSapPrintTrace(_L("[BTSap]  CBTSapSimCardStatusNotifier: Start")));
       
    96 
       
    97     iSubscriptionModule.NotifySimCardStatus(iStatus, iCardStatus);
       
    98     SetActive();
       
    99     }
       
   100 
       
   101 //  End of File