javaextensions/satsa/apdu/src.s60/cstsresphandler.cpp
changeset 21 2a9601315dfc
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     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 "cstsresphandler.h"
       
    21 #include "cstsapduevent.h"
       
    22 #include "logger.h"
       
    23 
       
    24 namespace java
       
    25 {
       
    26 namespace satsa
       
    27 {
       
    28 
       
    29 CSTSRespHandler::CSTSRespHandler()
       
    30 {
       
    31 
       
    32 }
       
    33 
       
    34 void CSTSRespHandler::ConstructL(JNIEnv& aJni, jobject aNotifyObject,
       
    35                                  jmethodID aHandleEventMethod)
       
    36 {
       
    37     iApduEvent
       
    38     = new(ELeave) CSTSApduEvent(aJni, aNotifyObject, aHandleEventMethod);
       
    39 }
       
    40 
       
    41 CSTSRespHandler* CSTSRespHandler::NewLC(JNIEnv& aJni, jobject aNotifyObject,
       
    42                                         jmethodID aHandleEventMethod)
       
    43 {
       
    44     LOG(ESATSA, EInfo, "+ CSTSRespHandler::NewLC");
       
    45     CSTSRespHandler* self = new(ELeave) CSTSRespHandler();
       
    46     CleanupStack::PushL(self);
       
    47     self->ConstructL(aJni, aNotifyObject, aHandleEventMethod);
       
    48     LOG(ESATSA, EInfo, "+ CSTSRespHandler::NewLC");
       
    49     return self;
       
    50 }
       
    51 
       
    52 CSTSRespHandler* CSTSRespHandler::NewL(JNIEnv& aJni, jobject aNotifyObject,
       
    53                                        jmethodID aHandleEventMethod)
       
    54 {
       
    55     CSTSRespHandler* self = CSTSRespHandler::NewLC(aJni, aNotifyObject,
       
    56                             aHandleEventMethod);
       
    57     CleanupStack::Pop(self);
       
    58     return self;
       
    59 }
       
    60 
       
    61 // Destructor
       
    62 CSTSRespHandler::~CSTSRespHandler()
       
    63 {
       
    64     delete iApduEvent;
       
    65 }
       
    66 
       
    67 // --------------------------------------------
       
    68 // CSTSRespHandler::SetOperationId
       
    69 // Setter for operation id
       
    70 // --------------------------------------------
       
    71 void CSTSRespHandler::SetOperationId(TInt aId)
       
    72 {
       
    73     LOG(ESATSA, EInfo, "+ CSTSRespHandler::SetOperationId");
       
    74     iApduEvent->SetId(aId);
       
    75 }
       
    76 
       
    77 void CSTSRespHandler::OperationComplete(JNIEnv* aJni, jobject aPeer,
       
    78                                         HBufC8* aResponse, TInt aError)
       
    79 {
       
    80     LOG(ESATSA, EInfo, "+ CSTSRespHandler::OperationComplete");
       
    81     TInt error = aError;
       
    82     iApduEvent->SetData(aResponse);
       
    83     iApduEvent->SetErrorCode(error);
       
    84     iApduEvent->Dispatch(aJni, aPeer);
       
    85     LOG(ESATSA, EInfo, "-- CSTSRespHandler::OperationComplete");
       
    86 }
       
    87 
       
    88 } // namespace satsa
       
    89 } // namespace java
       
    90 //  End of File