mmappfw_plat/mpx_common_api/inc/mpxclientlist.inl
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Inline implementation of client list
       
    15 *
       
    16 */
       
    17 
       
    18 #include <mpxmessagegeneraldefs.h>
       
    19 #include <mpxlog.h>
       
    20 
       
    21 // -----------------------------------------------------------------------------
       
    22 // Convert TMPXMessage into CMPXMessage
       
    23 // -----------------------------------------------------------------------------
       
    24 //
       
    25 inline CMPXMessage* CMPXClientList::ConvertMsgLC(const TMPXMessage& aMsg)
       
    26     {
       
    27     CMPXMessage* msg = CMPXMessage::NewL();
       
    28     CleanupStack::PushL(msg);
       
    29     TMPXMessageId id=static_cast<TMPXMessageId>(KMPXMessageGeneral);
       
    30     msg->SetTObjectValueL<TMPXMessageId>(KMPXMessageGeneralId, id);
       
    31     msg->SetTObjectValueL<TInt>(KMPXMessageGeneralEvent, aMsg.Event());
       
    32     msg->SetTObjectValueL<TInt>(KMPXMessageGeneralType, aMsg.Type());
       
    33     msg->SetTObjectValueL<TInt>(KMPXMessageGeneralData, aMsg.Data());
       
    34     return msg;
       
    35     }
       
    36 // -----------------------------------------------------------------------------
       
    37 // Send message to all clients in the list
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 inline void CMPXClientList::SendMsgL(const TMPXMessage& aMsg)
       
    41     {
       
    42     MPX_FUNC_EX("CMPXClientList::SendMsgL(aTMsg)");
       
    43     CMPXMessage* msg = ConvertMsgLC(aMsg);
       
    44     // Magic number 1 which is always be old EError value in TMPXMessage
       
    45     TInt err = aMsg.Event()==1 ? aMsg.Data() : KErrNone;
       
    46     SendMsg(msg, err);
       
    47     CleanupStack::PopAndDestroy(msg);
       
    48     }    
       
    49     
       
    50 // -----------------------------------------------------------------------------
       
    51 // Send message to a client
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 inline void CMPXClientList::SendMsgL(TInt aIndex, const TMPXMessage& aMsg)
       
    55     {
       
    56     MPX_FUNC_EX("CMPXClientList::SendMsgL(aIndex, aTMsg)");
       
    57     CMPXMessage* msg = ConvertMsgLC(aMsg);
       
    58     SendMsg(aIndex, msg, KErrNone);
       
    59     CleanupStack::PopAndDestroy(msg);
       
    60     }
       
    61 
       
    62 //End of file