javacommons/security/javaunicertstoreplugin/tsrc/utils/commsmsgsender.cpp
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2009 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 "commsmsgsender.h"
       
    20 #include "comms.h"
       
    21 #include "certstoretestextensionplugin.h"
       
    22 #include "testfailedexception.h"
       
    23 
       
    24 using namespace java::comms;
       
    25 using namespace java::security;
       
    26 
       
    27 CommsMsgSender::CommsMsgSender()
       
    28 {
       
    29     mComms.connect(IPC_ADDRESS_JAVA_CAPTAIN_C);
       
    30 }
       
    31 
       
    32 CommsMsgSender::~CommsMsgSender()
       
    33 {
       
    34     mComms.disconnect();
       
    35 }
       
    36 
       
    37 void CommsMsgSender::SendStartJavaCertStorePlugin()
       
    38 {
       
    39     SendMsg(IPC_START_JAVA_CERT_STORE_EXT_PLUGIN);
       
    40 }
       
    41 
       
    42 void CommsMsgSender::SendStopJavaCertStorePlugin()
       
    43 {
       
    44     SendMsg(IPC_STOP_JAVA_CERT_STORE_EXT_PLUGIN);
       
    45 }
       
    46 
       
    47 void CommsMsgSender::SendMsg(int aMsgId)
       
    48 {
       
    49     CommsMessage msg;
       
    50     msg.setReceiver(IPC_ADDRESS_JAVA_CAPTAIN_C);
       
    51     msg.setSender(IPC_ADDRESS_JAVA_CAPTAIN_C);
       
    52     msg.setModuleId(PLUGIN_ID_CERT_STORE_PLUGIN_TESTER_C);
       
    53     msg.setMessageId(aMsgId);
       
    54     int err = mComms.send(msg);
       
    55     if (0 != err)
       
    56     {
       
    57         throw TestFailedException("sending comms msg failed",
       
    58                                   __FILE__,__FUNCTION__,__LINE__);
       
    59     }
       
    60 }
       
    61