javamanager/javacaptain/inc.linux/signalhandlermessages.h
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:  signalhandlermessages
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef SIGNALHANDLERMESSAGES_H
       
    19 #define SIGNALHANDLERMESSAGES_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 // Message IDs of all installer extension services
       
    32 const int SIG_MSG_ID_SIGCHLD    = JAVACAPTAIN_MESSAGE_ID_RANGE_START_C + 30;    // 130
       
    33 const int SIG_MSG_ID_SIGALRM    = SIG_MSG_ID_SIGCHLD + 1;                       // 131
       
    34 const int SIG_MSG_ID_SIGINT     = SIG_MSG_ID_SIGALRM + 1;                       // 132
       
    35 
       
    36 inline void setSignalChildMessage(CommsMessage& aMessage, const int& aPid, const int& aStatus)
       
    37 {
       
    38     aMessage.setModuleId(PLUGIN_ID_SIGNAL_C);
       
    39     aMessage.setMessageId(SIG_MSG_ID_SIGCHLD);
       
    40     aMessage << aPid << aStatus;
       
    41 }
       
    42 inline void getSignalChildMessage(CommsMessage& aMessage, int& aPid, int& aStatus)
       
    43 {
       
    44     if (aMessage.getMessageId() == SIG_MSG_ID_SIGCHLD)
       
    45     {
       
    46         aMessage >> aPid >> aStatus;
       
    47     }
       
    48     else
       
    49     {
       
    50         ELOG2(EJavaCaptain, "wrong MessageId!: %d should be %d",
       
    51               aMessage.getMessageId(), SIG_MSG_ID_SIGCHLD);
       
    52     }
       
    53 }
       
    54 
       
    55 inline void setSignalAlarmMessage(CommsMessage& aMessage)
       
    56 {
       
    57     aMessage.setModuleId(PLUGIN_ID_SIGNAL_C);
       
    58     aMessage.setMessageId(SIG_MSG_ID_SIGALRM);
       
    59 }
       
    60 inline void getSignalAlarmMessage(CommsMessage& aMessage)
       
    61 {
       
    62     if (aMessage.getMessageId() != SIG_MSG_ID_SIGALRM)
       
    63     {
       
    64         ELOG2(EJavaCaptain, "wrong MessageId!: %d should be %d",
       
    65               aMessage.getMessageId(), SIG_MSG_ID_SIGCHLD);
       
    66     }
       
    67 }
       
    68 
       
    69 inline void setSignalInterruptMessage(CommsMessage& aMessage)
       
    70 {
       
    71     aMessage.setModuleId(PLUGIN_ID_SIGNAL_C);
       
    72     aMessage.setMessageId(SIG_MSG_ID_SIGINT);
       
    73 }
       
    74 inline void getSignalInterruptMessage(CommsMessage& aMessage)
       
    75 {
       
    76     if (aMessage.getMessageId() != SIG_MSG_ID_SIGINT)
       
    77     {
       
    78         ELOG2(EJavaCaptain, "wrong MessageId!: %d should be %d",
       
    79               aMessage.getMessageId(), SIG_MSG_ID_SIGINT);
       
    80     }
       
    81 }
       
    82 
       
    83 } // namespace captain
       
    84 } // namespace java
       
    85 
       
    86 #endif // SIGNALHANDLERMESSAGES_H
       
    87