javamanager/javacaptain/inc/pmcmessages.h
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:  pmcMessages
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PMCMESSAGES_H
       
    19 #define PMCMESSAGES_H
       
    20 
       
    21 #include "logger.h"
       
    22 #include "comms.h"
       
    23 #include "commsmessage.h"
       
    24 
       
    25 using namespace java::comms;
       
    26 
       
    27 namespace java
       
    28 {
       
    29 namespace captain
       
    30 {
       
    31 const int PMC_MSG_ID_PROCESS_TERMINATED_IND         = JAVACAPTAIN_MESSAGE_ID_RANGE_START_C + 20; // 120
       
    32 const int PMC_MSG_ID_PROCESS_INITIALISED_IND        = JAVACAPTAIN_MESSAGE_ID_RANGE_START_C + 21; // 121
       
    33 
       
    34 // Process terminated indication
       
    35 inline void setProcessTerminatedIndParams(CommsMessage& aMessage,
       
    36         const int& aPid)
       
    37 {
       
    38     aMessage.setMessageId(PMC_MSG_ID_PROCESS_TERMINATED_IND);
       
    39     aMessage.setModuleId(PLUGIN_ID_PMC_C);
       
    40     aMessage << aPid;
       
    41 }
       
    42 inline void getProcessTerminatedIndParams(CommsMessage& aMessage,
       
    43         int& aPid)
       
    44 {
       
    45     if (aMessage.getMessageId() == PMC_MSG_ID_PROCESS_TERMINATED_IND)
       
    46     {
       
    47         aMessage >> aPid;
       
    48     }
       
    49     else
       
    50     {
       
    51         ELOG2(EJavaCaptain, "wrong MessageId!: %d should be %d",
       
    52               aMessage.getMessageId(), PMC_MSG_ID_PROCESS_TERMINATED_IND);
       
    53     }
       
    54 }
       
    55 
       
    56 
       
    57 // Process initialised indication
       
    58 inline void setProcessInitialisedIndParams(CommsMessage& aMessage,
       
    59         const int& aPid)
       
    60 {
       
    61     aMessage.setMessageId(PMC_MSG_ID_PROCESS_INITIALISED_IND);
       
    62     aMessage.setModuleId(PLUGIN_ID_PMC_C);
       
    63     aMessage << aPid;
       
    64 }
       
    65 inline void getProcessInitialisedIndParams(CommsMessage& aMessage,
       
    66         int& aPid)
       
    67 {
       
    68     if (aMessage.getMessageId() == PMC_MSG_ID_PROCESS_INITIALISED_IND)
       
    69     {
       
    70         aMessage >> aPid;
       
    71     }
       
    72     else
       
    73     {
       
    74         ELOG2(EJavaCaptain, "wrong MessageId!: %d should be %d",
       
    75               aMessage.getMessageId(), PMC_MSG_ID_PROCESS_INITIALISED_IND);
       
    76     }
       
    77 }
       
    78 
       
    79 } // namespace captain
       
    80 } // namespace java
       
    81 
       
    82 #endif // PMCMESSAGES_H
       
    83