javauis/amms_qt/mmacontrol/src/cammscustomcommandutility.cpp
changeset 23 98ccebc37403
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Custom command utility class for AMMS custom commands.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <logger.h>
       
    22 #include "cammscustomcommandutility.h"
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CAMMSCustomCommandUtility::NewL
       
    28 // Two-phased constructor.
       
    29 // -----------------------------------------------------------------------------
       
    30 CAMMSCustomCommandUtility* CAMMSCustomCommandUtility::NewL(
       
    31     RMMFController& aMMFController)
       
    32 {
       
    33     CAMMSCustomCommandUtility* self = NewLC(aMMFController);
       
    34     CleanupStack::Pop(self);
       
    35 
       
    36     return self;
       
    37 }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CAMMSCustomCommandUtility::NewLC
       
    41 // Two-phased constructor.
       
    42 // -----------------------------------------------------------------------------
       
    43 CAMMSCustomCommandUtility* CAMMSCustomCommandUtility::NewLC(
       
    44     RMMFController& aMMFController)
       
    45 {
       
    46     CAMMSCustomCommandUtility* self =
       
    47         new(ELeave) CAMMSCustomCommandUtility(aMMFController);
       
    48 
       
    49     CleanupStack::PushL(self);
       
    50 
       
    51     return self;
       
    52 }
       
    53 
       
    54 // Destructor
       
    55 CAMMSCustomCommandUtility::~CAMMSCustomCommandUtility()
       
    56 {
       
    57     LOG( EJavaAMMS, EInfo, "AMMS::CAMMSCustomCommandUtility::~CAMMSCustomCommandUtility");
       
    58 }
       
    59 
       
    60 TInt CAMMSCustomCommandUtility::CustomCommandSync(
       
    61     const TMMFMessageDestinationPckg& aDestination,
       
    62     TInt aFunction,
       
    63     const TDesC8& aDataTo1,
       
    64     const TDesC8& aDataTo2,
       
    65     TDes8& aDataFrom)
       
    66 {
       
    67     LOG1( EJavaAMMS, EInfo, 
       
    68         "AMMS::CAMMSCustomCommandUtility::CustomCommandSync(1) function: %d",
       
    69         aFunction);
       
    70 
       
    71     // In the first message (ECibGetBuilder) the aDataTo1 is null,
       
    72     // but in the second message (ECibBuild) it should contain the interface ID
       
    73 
       
    74     return iMMFController.CustomCommandSync(
       
    75                aDestination,
       
    76                aFunction,
       
    77                aDataTo1,
       
    78                aDataTo2,
       
    79                aDataFrom);
       
    80 }
       
    81 
       
    82 TInt CAMMSCustomCommandUtility::CustomCommandSync(
       
    83     const TMMFMessageDestinationPckg& aDestination,
       
    84     TInt aFunction,
       
    85     const TDesC8& aDataTo1,
       
    86     const TDesC8& aDataTo2)
       
    87 {
       
    88     LOG1( EJavaAMMS, EInfo, 
       
    89         "AMMS::CAMMSCustomCommandUtility::CustomCommandSync(2) function: %d",
       
    90         aFunction);
       
    91     return iMMFController.CustomCommandSync(
       
    92                aDestination,
       
    93                aFunction,
       
    94                aDataTo1,
       
    95                aDataTo2);
       
    96 }
       
    97 
       
    98 void CAMMSCustomCommandUtility::CustomCommandAsync(
       
    99     const TMMFMessageDestinationPckg& aDestination,
       
   100     TInt aFunction,
       
   101     const TDesC8& aDataTo1,
       
   102     const TDesC8& aDataTo2,
       
   103     TDes8& aDataFrom,
       
   104     TRequestStatus& aStatus)
       
   105 {
       
   106     LOG1( EJavaAMMS, EInfo, 
       
   107         "AMMS::CAMMSCustomCommandUtility::CustomCommandAsync(1) function: %d",
       
   108         aFunction);
       
   109     iMMFController.CustomCommandAsync(
       
   110         aDestination,
       
   111         aFunction,
       
   112         aDataTo1,
       
   113         aDataTo2,
       
   114         aDataFrom,
       
   115         aStatus);
       
   116 }
       
   117 
       
   118 void CAMMSCustomCommandUtility::CustomCommandAsync(
       
   119     const TMMFMessageDestinationPckg& aDestination,
       
   120     TInt aFunction,
       
   121     const TDesC8& aDataTo1,
       
   122     const TDesC8& aDataTo2,
       
   123     TRequestStatus& aStatus)
       
   124 {
       
   125     LOG1( EJavaAMMS, EInfo, 
       
   126         "AMMS::CAMMSCustomCommandUtility::CustomCommandAsync(2) function: %d",
       
   127         aFunction);
       
   128     iMMFController.CustomCommandAsync(
       
   129         aDestination,
       
   130         aFunction,
       
   131         aDataTo1,
       
   132         aDataTo2,
       
   133         aStatus);
       
   134 }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CCAMMSCustomCommandUtility::CAMMSCustomCommandUtility
       
   138 // C++ default constructor can NOT contain any code, that
       
   139 // might leave.
       
   140 // -----------------------------------------------------------------------------
       
   141 CAMMSCustomCommandUtility::CAMMSCustomCommandUtility(
       
   142     RMMFController& aMMFController):
       
   143         iMMFController(aMMFController)
       
   144 {
       
   145 }
       
   146 
       
   147 //  End of File