adaptationlayer/tsy/simatktsy_dll/internal/test/simatktsy_testtool/simatk/src/commanddisplaytext.cpp
changeset 4 510c70acdbf6
parent 3 1972d8c2e329
child 5 8ccc39f9d787
equal deleted inserted replaced
3:1972d8c2e329 4:510c70acdbf6
     1 /*
       
     2 * Copyright (c) 2002-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 the License "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:   DisplayText specific test class. Inherits CCommandBase.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <stifparser.h>
       
    22 #include "commanddisplaytext.h"
       
    23 
       
    24 // CONSTANTS
       
    25 _LIT( KPriority,            "Priority" );
       
    26 _LIT( KClearScreenTrigger,  "ClearScreenTrigger" );
       
    27 _LIT( KImmediateRsp,        "ImmediateRsp" );
       
    28 _LIT( KText,                "Text" );
       
    29 
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CCommandDisplayText::CCommandDisplayText
       
    33 // C++ default constructor can NOT contain any code, that
       
    34 // might leave.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CCommandDisplayText::CCommandDisplayText
       
    38         (
       
    39         const TSatIpc       aIpc,
       
    40         const RSat&         aSat,
       
    41         CStifItemParser&    aParser,
       
    42         CStifLogger&        aLog
       
    43         ) : CSatCommandBase ( aIpc, aSat, aParser, aLog, RSat::EDisplayText ),
       
    44         iDataPckg( iData ),
       
    45         iRspPckg( iRsp )
       
    46     {
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CCommandDisplayText::~CCommandDisplayText
       
    51 // Destructor
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CCommandDisplayText::~CCommandDisplayText()
       
    55     {
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CCommandDisplayText::NotifySat
       
    60 // Send a notify request to Etel and clear internal data
       
    61 // (other items were commented in a header).
       
    62 // -----------------------------------------------------------------------------       
       
    63 //
       
    64 TInt CCommandDisplayText::NotifySat
       
    65         (
       
    66         TRequestStatus& aSimAtkStatus
       
    67         )
       
    68     {
       
    69     TInt ret ( KErrNone );
       
    70     
       
    71     // Clear the package
       
    72     Init( iData );
       
    73     Init( iRsp );
       
    74     
       
    75     iSat.NotifyDisplayTextPCmd( aSimAtkStatus, iDataPckg );
       
    76     
       
    77     return ret;
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CCommandDisplayText::CheckData
       
    82 // Verifies the validity of received command
       
    83 // (other items were commented in a header).
       
    84 // -----------------------------------------------------------------------------       
       
    85 //
       
    86 TInt CCommandDisplayText::CheckData()
       
    87     {
       
    88     iLog.Log( _L( "CCommandDisplayText::CheckData" ) );
       
    89     
       
    90     TInt ret( KErrNone );
       
    91     
       
    92     // Priority
       
    93     if ( KErrNone != CheckValue( KPriority, iData.iPriority, 
       
    94         RSat::ENormalPriority ) )
       
    95         {
       
    96         ret = KErrCorrupt;
       
    97         }
       
    98 
       
    99     // ClearScreenTrigger
       
   100     if ( KErrNone != CheckValue( KClearScreenTrigger,
       
   101         iData.iClearScreenTrigger, RSat::EUserClear ) )
       
   102         {
       
   103         ret = KErrCorrupt;
       
   104         }
       
   105 
       
   106     // ImmediateRsp
       
   107     if ( KErrNone != CheckValue( KImmediateRsp, iData.iImmediateRsp, 
       
   108         RSat::ENoImmediateRsp ) )
       
   109         {
       
   110         ret = KErrCorrupt;
       
   111         }
       
   112 
       
   113     // Text
       
   114     if ( KErrNone != CheckText( KText, iData.iText ) )
       
   115         {
       
   116         ret = KErrCorrupt;
       
   117         }
       
   118 
       
   119     // Duration
       
   120     if ( KErrNone != CheckDuration( iData.iDuration ) )
       
   121         {
       
   122         ret = KErrCorrupt;
       
   123         }
       
   124     
       
   125     // Icon
       
   126     if ( KErrNone != CheckIcon( iData.iIconId ) )
       
   127         {
       
   128         ret = KErrCorrupt;
       
   129         }
       
   130     
       
   131     return ret;
       
   132     }
       
   133  
       
   134 // -----------------------------------------------------------------------------
       
   135 // CCommandDisplayText::SendResponse
       
   136 // Creates terminal response according to scripted parameters
       
   137 // (other items were commented in a header).
       
   138 // -----------------------------------------------------------------------------       
       
   139 //
       
   140 TInt CCommandDisplayText::SendResponse()
       
   141     {
       
   142     iLog.Log( _L( "CCommandDisplayText::SendResponse" ) );    
       
   143     
       
   144     TInt ret( KErrNone );
       
   145 
       
   146     // GeneralResult
       
   147     SetGeneralResult( iRsp.iGeneralResult );
       
   148 
       
   149     // InfoType & AdditionalInfo
       
   150     SetAdditionalInfo ( iRsp.iInfoType, iRsp.iAdditionalInfo );
       
   151     
       
   152     if ( KErrNone == ret )
       
   153         {
       
   154         ret = CSatCommandBase::SendResponse( iRspPckg );
       
   155         }
       
   156     
       
   157     return ret;
       
   158     }
       
   159 
       
   160 // End of File