adaptationlayer/tsy/simatktsy_dll/internal/test/simatktsy_testtool/simatk/src/commandlanguagenotification.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:   Language Notification specific test class. Inherits 
       
    15 *                CCommandBase.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <stifparser.h>
       
    23 #include "commandlanguagenotification.h"
       
    24 
       
    25 
       
    26 // CONSTANTS
       
    27 _LIT( KType,                    "Type" );
       
    28 _LIT( KLanguage,                "Language" );
       
    29 
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CCommandLanguageNotification::CCommandLanguageNotification
       
    33 // C++ default constructor can NOT contain any code, that
       
    34 // might leave.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CCommandLanguageNotification::CCommandLanguageNotification
       
    38         (
       
    39         const TSatIpc       aIpc,
       
    40         const RSat&         aSat,
       
    41         CStifItemParser&    aParser,
       
    42         CStifLogger&        aLog
       
    43         ) : CSatCommandBase ( aIpc, aSat, aParser, aLog, RSat::ELanguageNotification ),
       
    44         iDataPckg( iData ),
       
    45         iRspPckg( iRsp )
       
    46     {
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CCommandLanguageNotification::~CCommandLanguageNotification
       
    51 // Destructor
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CCommandLanguageNotification::~CCommandLanguageNotification()
       
    55     {
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CCommandLanguageNotification::NotifySat
       
    60 // Send a notify request to Etel and clear internal data
       
    61 // (other items were commented in a header).
       
    62 // -----------------------------------------------------------------------------       
       
    63 //
       
    64 TInt CCommandLanguageNotification::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.NotifyLanguageNotificationPCmd( aSimAtkStatus, iDataPckg );
       
    76     
       
    77     return ret;
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CCommandLanguageNotification::CheckData
       
    82 // Verifies the validity of received command
       
    83 // (other items were commented in a header).
       
    84 // -----------------------------------------------------------------------------       
       
    85 //
       
    86 TInt CCommandLanguageNotification::CheckData()
       
    87     {
       
    88     iLog.Log( _L( "CCommandLanguageNotification::CheckData" ) );    
       
    89     
       
    90     TInt ret( KErrNone );
       
    91     
       
    92     // NotificationType    
       
    93     if ( KErrNone != CheckValue( KType, iData.iNotificationType,
       
    94         RSat::ENonSpecificLangNotification ) )
       
    95         {
       
    96         ret = KErrCorrupt;
       
    97         }
       
    98         
       
    99     // Language    
       
   100     if ( RSat::ESpecificLangNotification == iData.iNotificationType )
       
   101         {
       
   102         if ( KErrNone != CheckValue( KLanguage, iData.iLanguage ) )
       
   103             {
       
   104             ret = KErrCorrupt;
       
   105             }
       
   106         }
       
   107     else if ( iData.iLanguage )
       
   108         {
       
   109         iLog.Log( _L( "CCommandLanguageNotification::CheckData: ERROR \
       
   110             Language provided but Type-parameter is not set!" ) );
       
   111         ret = KErrCorrupt;
       
   112         }
       
   113 
       
   114     return ret;
       
   115     }
       
   116  
       
   117 // -----------------------------------------------------------------------------
       
   118 // CCommandLanguageNotification::SendResponse
       
   119 // Creates terminal response according to scripted parameters
       
   120 // (other items were commented in a header).
       
   121 // -----------------------------------------------------------------------------       
       
   122 //
       
   123 TInt CCommandLanguageNotification::SendResponse()
       
   124     {
       
   125     iLog.Log( _L( "CCommandLanguageNotification::SendResponse" ) );    
       
   126     
       
   127     TInt ret( KErrNone );
       
   128 
       
   129     // General result
       
   130     SetGeneralResult( iRsp.iGeneralResult );
       
   131     
       
   132     // Additional info & type
       
   133     SetAdditionalInfo( iRsp.iInfoType, iRsp.iAdditionalInfo );
       
   134     
       
   135     if ( KErrNone == ret )
       
   136         {
       
   137         ret = CSatCommandBase::SendResponse( iRspPckg );
       
   138         }
       
   139 
       
   140     return ret;
       
   141     }
       
   142     
       
   143 // End of File