usbmgmt/usbmgrtest/t_ncm/inc/setncmiapcommand.h
branchRCL_3
changeset 16 012cc2ee6408
parent 15 f92a4f87e424
equal deleted inserted replaced
15:f92a4f87e424 16:012cc2ee6408
     1 /*
       
     2 * Copyright (c) 2002-2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 /** @file
       
    19  @internalComponent
       
    20  @test
       
    21  */
       
    22 
       
    23 #ifndef SETNCMIAPCOMMAND_H
       
    24 #define SETNCMIAPCOMMAND_H
       
    25 
       
    26 #include "commandengine.h"
       
    27 #include <centralrepository.h>
       
    28 
       
    29 NONSHARABLE_CLASS(CSetNcmIapCommand) : public CNcmCommandBase
       
    30 /**
       
    31 Set the Ncm Iap Id into central repository
       
    32 */
       
    33 	{
       
    34 public:
       
    35 	enum TSetNcmIapCommandState
       
    36 	{
       
    37 		EIapId,			//The command is in state of wait user input iap
       
    38 		EIapPriority	//The command is in state of wait user input iap index
       
    39 	};
       
    40 public:
       
    41 	static CSetNcmIapCommand* NewL(CUsbNcmConsole& aUsb, TUint aKey);
       
    42 	~CSetNcmIapCommand();
       
    43 
       
    44 	//Get the first IAP ID stored in central repository.
       
    45 	void GetDefaultIapL(TInt& aDefaultIap);
       
    46 
       
    47 public:
       
    48 	//From CNcmCommandBase
       
    49 	void DoCommandL();
       
    50 	
       
    51 private:
       
    52 	CSetNcmIapCommand(CUsbNcmConsole& aUsb, TUint aKey);
       
    53 	void ConstructL();
       
    54 
       
    55 private:
       
    56 	//From CActive
       
    57 	void DoCancel();
       
    58 	void RunL();
       
    59 	TInt RunError(TInt aError);
       
    60 
       
    61 private:
       
    62 	//Display all IAPs stored in central repository which are used for Ncm
       
    63 	void ListAllNcmIapL();
       
    64 	//Set the Iap Id inputed by user into central repository
       
    65 	void SetNcmIapL();
       
    66 	
       
    67 	//Init work for run this command
       
    68 	void InitWorkL();
       
    69 	//Stop work when finish or terminate this command
       
    70 	void EndWork();
       
    71 	
       
    72 private:
       
    73 
       
    74 	TSetNcmIapCommandState iCommandState;
       
    75 
       
    76 	//The console used to display iap info and get user input for ncm iap
       
    77 	CConsoleBase* iConsole;
       
    78 	//user current input
       
    79 	RBuf		 iChars;
       
    80 	//the Iap id user want to store in central repository
       
    81 	TInt iIapId;
       
    82 	//the position of the Iap id which will be stored in central repository
       
    83 	TInt iIndex;
       
    84 	//central repository handle
       
    85 	CRepository* iRepository;
       
    86 	//all Iaps get from central repository
       
    87 	RArray<TUint32> iRows;
       
    88 
       
    89 	//followed are used for finding Iap Id stored in central repository
       
    90 	static const TUint KPartialKey = 0x01010000;
       
    91 	static const TUint KMask = 0xFFFF0000;
       
    92 	static const TInt KMaxNumOfChars = 255;
       
    93 	
       
    94 
       
    95 	};
       
    96 
       
    97 
       
    98 _LIT(KSetIapMemo ,"Input the NcmIap you want to set:");
       
    99 _LIT(KSetIapIndexMemo, "Input the index of iap you want to set:");
       
   100 _LIT(KErrInput, "Error input. Input again.\n");
       
   101 
       
   102 const TUid KNcmIapIdRepositoryUID = {0x10286a43};
       
   103 
       
   104 #endif // SETNCMIAPCOMMAND_H
       
   105