testexecfw/useremul/src/UserEmulatorScriptsView.cpp
changeset 0 3e07fef1e154
equal deleted inserted replaced
-1:000000000000 0:3e07fef1e154
       
     1 /*------------------------------------------------------------------
       
     2  -
       
     3  * Software Name : UserEmulator
       
     4  * Version       : v4.2.1309
       
     5  * 
       
     6  * Copyright (c) 2009 France Telecom. All rights reserved.
       
     7  * This software is distributed under the License 
       
     8  * "Eclipse Public License - v 1.0" the text of which is available
       
     9  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10  *
       
    11  * Initial Contributors:
       
    12  * France Telecom 
       
    13  *
       
    14  * Contributors:
       
    15  *------------------------------------------------------------------
       
    16  -
       
    17  * File Name: UserEmulatorScriptsView.cpp
       
    18  * 
       
    19  * Created: 13/08/2009
       
    20  * Author(s): Marcell Kiss, Reshma Sandeep Das
       
    21  *   
       
    22  * Description:
       
    23  * Application View class
       
    24  *------------------------------------------------------------------
       
    25  -
       
    26  *
       
    27  */
       
    28 
       
    29 // System Includes
       
    30 #include <coemain.h>
       
    31 #include <eikedwin.h>
       
    32 #include <akniconarray.h> 
       
    33 #include <gulicon.h> 
       
    34 #include <eikclbd.h> 
       
    35 #include <bautils.h>
       
    36 #include <aknnotewrappers.h>
       
    37 #include <hal.h>
       
    38 #include <aknmessagequerydialog.h> 
       
    39 #include <icons.mbg>
       
    40 // User Includes
       
    41 #include <UserEmulator_0x2001C3AF.rsg>
       
    42 #include "UserEmulatorScriptsView.h"
       
    43 #include "UserEmulatorAppUi.h"
       
    44 #include "UserEmulatorApplication.h"
       
    45 #include "XmlHandler.h"
       
    46 #include "UserEmulator.hrh"
       
    47 #include "ScanFolders.h"
       
    48 #include "Utils.h"
       
    49 // Constant
       
    50 // Listbox icon file name
       
    51 _LIT(KIconFileName, "\\system\\apps\\useremulator\\Icons.mbm");
       
    52 
       
    53 // ============================ MEMBER FUNCTIONS ===============================
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CUserEmulatorScriptsView::NewL()
       
    57 // Two-phased constructor.
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 CUserEmulatorScriptsView* CUserEmulatorScriptsView::NewL(const TRect& aRect, CSettings* aSettings, CEikonEnv* aEikonEnv)
       
    61 	{
       
    62 	CUserEmulatorScriptsView* self = CUserEmulatorScriptsView::NewLC( aRect, aSettings, aEikonEnv);
       
    63 	CleanupStack::Pop(self);
       
    64 	return self;
       
    65 	}
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CUserEmulatorScriptsView::NewLC()
       
    69 // Two-phased constructor.
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 CUserEmulatorScriptsView* CUserEmulatorScriptsView::NewLC(const TRect& aRect, CSettings* aSettings, CEikonEnv* aEikonEnv)
       
    73 	{
       
    74 	CUserEmulatorScriptsView* self = new ( ELeave ) CUserEmulatorScriptsView(aSettings, aEikonEnv);
       
    75 	CleanupStack::PushL(self);
       
    76 	self->ConstructL(aRect);
       
    77 	return self;
       
    78 	}
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CUserEmulatorScriptsView::ConstructL()
       
    82 // Symbian 2nd phase constructor can leave.
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CUserEmulatorScriptsView::ConstructL(const TRect& aRect)
       
    86 {
       
    87      _LIT8(KXml,"*.xml");
       
    88 	 // Create a window for this application view
       
    89 	 CreateWindowL();
       
    90 
       
    91 	 iScanFolder = CScanFolders::NewL();
       
    92  	 iScanFolder->AddListenerL(this);
       
    93  	 iScanFolder->SetFilter( KXml );
       
    94 	 	
       
    95 	 // Create a single numbered style listbox
       
    96 	 iListBox = new (ELeave) CAknSingleGraphicStyleListBox(); // markable
       
    97 	 // Construct listbox   
       
    98 	 iListBox->ConstructL( this, EAknListBoxMarkableList | EAknListBoxLoopScrolling );    
       
    99 	 // Set scrollbars
       
   100 	 iListBox->CreateScrollBarFrameL( ETrue );
       
   101 	 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto );
       
   102 	 
       
   103 	 iListBox->UpdateScrollBarsL();
       
   104      iListBox->SetRect( Rect() );
       
   105         
       
   106 	 iFilesArray = new (ELeave) CDesCArrayFlat(1);
       
   107 	 iSelectedFilesArray = new (ELeave) CDesCArrayFlat(1);
       
   108 	 	 
       
   109 	 iListBox->Model()->SetItemTextArray( iFilesArray );
       
   110 	 // Listbox deletes the item array
       
   111 	 iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
       
   112 	 
       
   113 	 // Add icons to listbox
       
   114  	 SetupListIconsL();
       
   115  	 // Activate Listbox    
       
   116      iListBox->ActivateL();
       
   117  	 
       
   118   	 iNotifyFileChange = CNotifyFileChange::NewL(*this, iSettings->iScriptsPath);
       
   119   	 iIMEIReader = CImeiReader::NewL(*this);
       
   120   	 
       
   121  	 ShowScriptsL();
       
   122  	
       
   123  	 // Set the windows size
       
   124 	 SetRect(aRect);
       
   125 
       
   126 	 // Activate the window, which makes it ready to be drawn
       
   127 	 ActivateL();
       
   128 }
       
   129 // ---------------------------------------------------
       
   130 // Gets the reference to CNotifyFileChange object
       
   131 // ---------------------------------------------------
       
   132 //
       
   133 CNotifyFileChange* CUserEmulatorScriptsView::GetNotifyFileChange()
       
   134 	{
       
   135 	return iNotifyFileChange;
       
   136 	}
       
   137 // ---------------------------------------------------
       
   138 // Creates a list from files in script folder
       
   139 // ---------------------------------------------------
       
   140 //
       
   141 void CUserEmulatorScriptsView::ShowScriptsL()
       
   142 {
       
   143 	iFileName.Copy(iSettings->iScriptsPath);
       
   144 	TParsePtrC parser(iFileName);
       
   145 	BaflUtils::EnsurePathExistsL(iEEnv->FsSession(), parser.DriveAndPath());
       
   146 	iScanFolder->ScanFolderL(iFileName);
       
   147 }
       
   148 // -----------------------------------------------------------------------------
       
   149 // CUserEmulatorScriptsView::CUserEmulatorScriptsView()
       
   150 // C++ default constructor can NOT contain any code, that might leave.
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 CUserEmulatorScriptsView::CUserEmulatorScriptsView(CSettings* aSettings, CEikonEnv* aEikonEnv) 
       
   154                           : iSettings(aSettings), iEEnv(aEikonEnv)//,iStartLog(EFalse),iSystemInfo(ETrue)
       
   155 {
       
   156 	// No implementation required
       
   157 }
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CUserEmulatorScriptsView::~CUserEmulatorScriptsView()
       
   161 // Destructor.
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 CUserEmulatorScriptsView::~CUserEmulatorScriptsView()
       
   165 {
       
   166 	delete iListBox;
       
   167 	
       
   168 	if(iScanFolder)
       
   169 	{
       
   170 	iScanFolder->RemoveListener(this);
       
   171 	delete iScanFolder;
       
   172 	iScanFolder = NULL;
       
   173 	}
       
   174 	
       
   175 	delete iSelectedFilesArray;
       
   176 	
       
   177 	delete iNotifyFileChange;
       
   178 	delete iIMEIReader;
       
   179 	
       
   180 }
       
   181 
       
   182 // -----------------------------------------------------------------------------
       
   183 // CUserEmulatorAppView::Draw()
       
   184 // Draws the display.
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 void CUserEmulatorScriptsView::Draw(const TRect& /*aRect*/) const
       
   188 {
       
   189 	// Get the standard graphics context
       
   190 	CWindowGc& gc = SystemGc();
       
   191 
       
   192 	// Gets the control's extent
       
   193 	TRect drawRect(Rect());
       
   194 
       
   195 	// Clears the screen
       
   196 	gc.Clear(drawRect);
       
   197 }
       
   198 // -----------------------------------------------------------------------------
       
   199 // CUserEmulatorScriptsView::SizeChanged()
       
   200 // Called by framework when the view size is changed.
       
   201 // -----------------------------------------------------------------------------
       
   202 //
       
   203 void CUserEmulatorScriptsView::SizeChanged()
       
   204 {
       
   205 	if(iListBox)
       
   206 	{
       
   207 		iListBox->SetRect(Rect());	
       
   208 		TRAP_IGNORE(iListBox->UpdateScrollBarsL());
       
   209 	}
       
   210 	DrawNow();
       
   211 }
       
   212 // -----------------------------------------------------------------------------
       
   213 // CUserEmulatorScriptsView::PositionChanged()
       
   214 // Called by framework when the view position is changed.
       
   215 // -----------------------------------------------------------------------------
       
   216 //
       
   217 void CUserEmulatorScriptsView::PositionChanged()
       
   218 {
       
   219 	if(iListBox)
       
   220 	{
       
   221 		iListBox->SetRect(Rect());	
       
   222 		TRAP_IGNORE(iListBox->UpdateScrollBarsL());
       
   223 	}	
       
   224 	DrawNow();
       
   225 }
       
   226 // ---------------------------------------------------
       
   227 // Returns number of components in View
       
   228 // ---------------------------------------------------
       
   229 //
       
   230 TInt CUserEmulatorScriptsView::CountComponentControls() const
       
   231 {
       
   232 	return 1;
       
   233 }
       
   234 // ----------------------------------------------------------------------------------
       
   235 // Constructs a TVwsViewId object with User Emulator's UID and EScriptsView ID
       
   236 // ----------------------------------------------------------------------------------
       
   237 //
       
   238 TVwsViewId CUserEmulatorScriptsView::ViewId() const
       
   239 {
       
   240     const TUid viewId = { EScriptsView };
       
   241     return TVwsViewId(KUidUserEmulatorApp, viewId);
       
   242 }
       
   243 // ----------------------------------------------------------------
       
   244 // Stores device's IMEI details
       
   245 // ----------------------------------------------------------------
       
   246 //
       
   247 void CUserEmulatorScriptsView::GotIMEI(const TDesC& aIMEI,TInt /*aError*/)
       
   248 {
       
   249 	iImeiNo.Copy(aIMEI);
       
   250 }
       
   251 // --------------------------------------------------------------------------
       
   252 // Sends the CCoeControl interface of the control which has the given index
       
   253 // --------------------------------------------------------------------------
       
   254 //
       
   255 CCoeControl* CUserEmulatorScriptsView::ComponentControl(TInt aIndex) const
       
   256 {
       
   257     switch ( aIndex )
       
   258     {
       
   259         case 0:
       
   260 			return iListBox;
       
   261         default:
       
   262             return NULL;
       
   263     }
       
   264 }
       
   265 // --------------------------------------------------------------------------
       
   266 // Initialises icons of the script list
       
   267 // --------------------------------------------------------------------------
       
   268 //
       
   269 void CUserEmulatorScriptsView::SetupListIconsL()
       
   270 {
       
   271 	CFbsBitmap* markBitmap = NULL;
       
   272     CFbsBitmap* markBitmapMask = NULL;
       
   273     
       
   274     TFileName iconFileName;
       
   275 	TBuf<KDriveSize> appDrive; 
       
   276 	appDrive.Copy(iEEnv->EikAppUi()->Application()->AppFullName().Left(2)); 
       
   277 	// Insert drive letter into path
       
   278 	iconFileName.Insert(0, appDrive);
       
   279 	iconFileName.Append(KIconFileName());
       
   280 
       
   281     //CListItemDrawer is using this logical color as default for its marked icons
       
   282     TRgb defaultColor;
       
   283     defaultColor = iEEnv->Color(EColorControlText);
       
   284     	
       
   285     CAknIconArray* iconArray = new(ELeave) CAknIconArray(4);
       
   286     CleanupStack::PushL(iconArray);
       
   287     
       
   288     //Mark Icon
       
   289     AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(),
       
   290     			KAknsIIDQgnIndiMarkedAdd,
       
   291     			KAknsIIDQsnIconColors,
       
   292     			EAknsCIQsnIconColorsCG13,
       
   293     			markBitmap,
       
   294     			markBitmapMask,
       
   295     			KAvkonBitmapFile,
       
   296     			EMbmAvkonQgn_indi_marked_add,
       
   297     			EMbmAvkonQgn_indi_marked_add_mask,
       
   298     			defaultColor
       
   299     			);
       
   300     
       
   301     CGulIcon* markIcon = CGulIcon::NewL( markBitmap,markBitmapMask );
       
   302     CleanupStack::Pop( 2 ); // markBitmap, markBitmapMask
       
   303     CleanupStack::PushL( markIcon );      
       
   304     iconArray->AppendL( markIcon );
       
   305     
       
   306     iconArray->AppendL(iEikonEnv->CreateIconL(iconFileName, EMbmIconsPass, EMbmIconsPass));
       
   307     iconArray->AppendL(iEikonEnv->CreateIconL(iconFileName, EMbmIconsFail, EMbmIconsFail_mask));
       
   308     iconArray->AppendL(iEikonEnv->CreateIconL(iconFileName, EMbmIconsCancel, EMbmIconsCancel_mask));
       
   309     	
       
   310     iListBox->ItemDrawer()->ColumnData()->SetIconArray(iconArray);
       
   311     
       
   312     CleanupStack::Pop( 2 );// markIcon, iconArray
       
   313 }
       
   314 // --------------------------------------------------------------------------
       
   315 // Changes icon of a script in list
       
   316 // --------------------------------------------------------------------------
       
   317 //
       
   318 void CUserEmulatorScriptsView::ChangeIconL(TInt aScriptStatus, TInt aIndex)
       
   319 {
       
   320 	TBuf<KBuffer256> listItem;
       
   321 	_LIT(KListItemUnMark, "\t%S\t\t");
       
   322 	_LIT(KListItemWithPassIcon, "1\t%S\t\t");
       
   323 	_LIT(KListItemWithFailIcon, "2\t%S\t\t");
       
   324 	_LIT(KListItemWithCancelIcon, "3\t%S\t\t");
       
   325 				
       
   326 	CTextListBoxModel* model = iListBox->Model();  // not taking ownership
       
   327 	const CArrayFix<TInt> *SelectedIndexes = iListBox->SelectionIndexes();
       
   328 		
       
   329 	if(aIndex < 0 || aIndex > SelectedIndexes->Count())
       
   330 			return;
       
   331 
       
   332 	// Get the index of the selected item
       
   333     TInt selectedItemIndex = (*SelectedIndexes)[aIndex];
       
   334     if(iFilesArray->Count()>0 && selectedItemIndex <= iFilesArray->Count())
       
   335     {
       
   336     	TPtrC filePtr = model->ItemText(selectedItemIndex);
       
   337     	TPtrC buff = filePtr.Mid(filePtr.LocateF('\t')+1);
       
   338 		TPtrC fileNamePtr = buff.Mid(0,buff.LocateF('\t'));
       
   339 		
       
   340     	HBufC* fileName = HBufC::NewLC(fileNamePtr.Length());
       
   341     	fileName->Des().Copy(fileNamePtr);
       
   342     	
       
   343     	//delete old item
       
   344     	CDesCArray* itemArray = STATIC_CAST(CDesCArray*, model->ItemTextArray());
       
   345     	
       
   346     	itemArray->Delete(selectedItemIndex);
       
   347     	// Script statuses
       
   348     	switch(aScriptStatus)
       
   349 		{
       
   350     		case EScriptPassed:
       
   351       			listItem.AppendFormat(KListItemWithPassIcon(), fileName);	// Format new item
       
   352   			break;
       
   353     		case EScriptFailed:
       
   354     			listItem.AppendFormat(KListItemWithFailIcon(), fileName);	// Format new item
       
   355 			break;
       
   356     		case EScriptCancelled:
       
   357     			listItem.AppendFormat(KListItemWithCancelIcon(), fileName);	// Format new item
       
   358 			break;
       
   359     		case EScriptUnMark:
       
   360     			listItem.AppendFormat(KListItemUnMark(), fileName);	// Format new item
       
   361     		break;
       
   362 			
       
   363     		default:
       
   364     			break;
       
   365 		}
       
   366 		
       
   367     	itemArray->InsertL(selectedItemIndex, listItem);	// Insert new item - changes icon to green
       
   368 		SelectedIndexes->Count();
       
   369 		
       
   370     	CleanupStack::PopAndDestroy(fileName);
       
   371     }
       
   372 }
       
   373 // --------------------------------------------------------------------------
       
   374 // Script view's activation function
       
   375 // --------------------------------------------------------------------------
       
   376 //
       
   377 void CUserEmulatorScriptsView::DoViewActivatedL(const TVwsViewId& /*aPrevViewId*/, 
       
   378 		           TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/)
       
   379 {
       
   380     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
       
   381     		CEikScrollBarFrame::EOn, CEikScrollBarFrame::EOn);
       
   382     
       
   383     UpdateSystemCba(EFalse);
       
   384 }
       
   385 // --------------------------------------------------------------------------
       
   386 // Updates command button(s)
       
   387 // --------------------------------------------------------------------------
       
   388 //
       
   389 void CUserEmulatorScriptsView::UpdateSystemCba(TBool aConnStatus)
       
   390 {
       
   391     TInt res = 0;
       
   392     res = GetScriptsCount();
       
   393     
       
   394     if( res > 0 && !aConnStatus)
       
   395         res = R_SOFTKEYS_SCRIPTS;
       
   396     else
       
   397         res = R_SOFTKEYS_NOSCRIPTS;
       
   398 
       
   399     CEikButtonGroupContainer* cba = iEikonEnv->AppUiFactory()->Cba();
       
   400     TRAPD(err,cba->SetCommandSetL(res));
       
   401     cba->DrawDeferred();
       
   402 }
       
   403 // --------------------------------------------------------------------------
       
   404 // Script view's deactivation function
       
   405 // --------------------------------------------------------------------------
       
   406 //
       
   407 void CUserEmulatorScriptsView::DoViewDeactivated()
       
   408 {
       
   409 }
       
   410 // --------------------------------------------------------------------------
       
   411 // Gets script name by index
       
   412 // --------------------------------------------------------------------------
       
   413 //
       
   414 HBufC* CUserEmulatorScriptsView::GetScriptNameLC(TInt aIndex)
       
   415 {
       
   416 	HBufC* text = HBufC::NewLC(KBuffer512);
       
   417     TPtr textPtr(text->Des());
       
   418 	
       
   419     // Get the selected item indexes an array
       
   420 	iSelectedIndexes = iListBox->SelectionIndexes();			
       
   421 	CTextListBoxModel* model = iListBox->Model();  // not taking ownership
       
   422 	
       
   423 	if(aIndex < 0 || aIndex > iSelectedIndexes->Count())
       
   424 		return NULL;
       
   425 	
       
   426 	if ( iSelectedIndexes && iSelectedIndexes->Count() != 0 && aIndex<=iSelectedIndexes->Count() )
       
   427 	{
       
   428 		// Get the index of the selected item
       
   429 		TInt selectedItemIndex = (*iSelectedIndexes)[aIndex];
       
   430 		
       
   431 		TPtrC filePtr = model->ItemText(selectedItemIndex);
       
   432 		TInt pos=filePtr.LocateF('\t');
       
   433 		TPtrC buff;
       
   434 		if(pos!=KErrNotFound && pos+1<=filePtr.Length())
       
   435 			buff.Set(filePtr.Mid(pos+1));
       
   436 		
       
   437 		pos=buff.LocateF('\t');
       
   438 		TPtrC fileNamePtr;
       
   439 		if(pos!=KErrNotFound)
       
   440 			fileNamePtr.Set(buff.Mid(0,pos));
       
   441     	textPtr.Copy(fileNamePtr);
       
   442 	}
       
   443 	return text;
       
   444 }
       
   445 // --------------------------------------------------------------------------
       
   446 // Gets sum of scripts selected
       
   447 // --------------------------------------------------------------------------
       
   448 //
       
   449 TInt CUserEmulatorScriptsView::GetSelectedScriptsCount()
       
   450 {
       
   451 	return iSelectedIndexes->Count();
       
   452 }
       
   453 // --------------------------------------------------------------------------
       
   454 // Gets sum of all scripts in script's folder
       
   455 // --------------------------------------------------------------------------
       
   456 //
       
   457 TInt CUserEmulatorScriptsView::GetScriptsCount()
       
   458 {
       
   459 	CTextListBoxModel* model = iListBox->Model();  // not taking ownership
       
   460 	return model->NumberOfItems();
       
   461 }
       
   462 // ------------------------------------------------------------
       
   463 // Run selected scripts
       
   464 // ------------------------------------------------------------
       
   465 //
       
   466 TInt CUserEmulatorScriptsView::RunScriptsL(TInt& aErrcode)
       
   467 {
       
   468 	TInt err=KErrNone;
       
   469 	aErrcode=KErrNone;
       
   470 	
       
   471 	// Get the selected item indexes an array
       
   472 	iSelectedIndexes = iListBox->SelectionIndexes();			
       
   473 
       
   474 	iSelectedFilesArray->Reset();
       
   475 	
       
   476 	CTextListBoxModel* model = iListBox->Model();  // not taking ownership
       
   477 	
       
   478 	// Make sure the array is not null (no items)
       
   479 	if ( iSelectedIndexes && iSelectedIndexes->Count() > 0) 
       
   480 	{
       
   481 	    // Loop through the selected item indexes
       
   482 	    for ( TInt index=0; index < iSelectedIndexes->Count(); index++ )
       
   483         {
       
   484 	        // Get the index of the selected item
       
   485 	        TInt selectedItemIndex = (*iSelectedIndexes)[index];
       
   486 	        if(iFilesArray->Count()>0 && selectedItemIndex <= iFilesArray->Count())
       
   487 	        {
       
   488 	        	TPtrC filePtr = model->ItemText(selectedItemIndex);
       
   489 	        	// Disallow too long file names
       
   490 	        	TInt pos=filePtr.LocateF('\t');
       
   491 	        	TPtrC buff;
       
   492 	        	if(pos!=KErrNotFound && pos+1<=filePtr.Length())
       
   493 					buff.Set(filePtr.Mid(pos+1));
       
   494 	        	TPtrC fileNamePtr;
       
   495 	        	pos=buff.LocateF('\t');
       
   496 	        	if(pos!=KErrNotFound)
       
   497 					fileNamePtr.Set(buff.Mid(0,pos));
       
   498 	        	
       
   499 	        	iSelectedFilesArray->AppendL(fileNamePtr);
       
   500 	        	//Append the selected file names to an array
       
   501 	        	if(!iFileName.Length())
       
   502 	        		iFileName.Copy(iSettings->iScriptsPath);
       
   503 	        	iFileName.Append(fileNamePtr);
       
   504 	        	
       
   505 	        	//check if the iFilaName is valid
       
   506                 err = iSettings->CheckDrive(iFileName);
       
   507                 if(err == KErrNone)
       
   508 	        	  // Parse the XML file
       
   509 	        	  TRAPD(err,aErrcode=static_cast<CUserEmulatorAppUi*>(iCoeEnv->AppUi())->StartParsingL(iFileName));
       
   510 	        	  
       
   511 	        	iFileName.Zero();
       
   512 	        }			        
       
   513         }
       
   514 	}
       
   515 	else
       
   516 	{
       
   517 		//If no scripts selected
       
   518 		_LIT(KSELECTSCRIPT, "Select scripts to run..");
       
   519 		CUtils::MessageBoxL(KSELECTSCRIPT);
       
   520 	}
       
   521 	
       
   522 	return err;
       
   523 }
       
   524 
       
   525 // ------------------------------------------------------------------------------
       
   526 // Handles incoming pointer events (if pointer events are enabled on the device)
       
   527 // ------------------------------------------------------------------------------
       
   528 //
       
   529 void CUserEmulatorScriptsView::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   530 	{
       
   531 	if(AknLayoutUtils::PenEnabled())
       
   532 		{
       
   533 		if (iListBox)
       
   534 			{
       
   535 			iListBox->HandlePointerEventL(aPointerEvent);
       
   536 			}
       
   537 		// Call base class HandlePointerEventL()
       
   538 		CCoeControl::HandlePointerEventL(aPointerEvent);
       
   539 		}
       
   540 	}
       
   541 // --------------------------------------------------------------------------
       
   542 // Helper function
       
   543 // --------------------------------------------------------------------------
       
   544 //
       
   545 void CUserEmulatorScriptsView::HandleMarkCommandL(TInt aCommand)
       
   546 {
       
   547 	if (iListBox)
       
   548 	{
       
   549 		AknSelectionService::HandleMarkableListProcessCommandL (aCommand, iListBox);
       
   550 	}
       
   551 }
       
   552 // -------------------------------------------------------------------------------
       
   553 // Checks how many items are selected and the current one is selected or not
       
   554 // This function is needed to display correct Mark, Unmark, Mark all, etc. menus
       
   555 // -------------------------------------------------------------------------------
       
   556 //
       
   557 TInt CUserEmulatorScriptsView::CheckListBoxSelection()
       
   558 	{
       
   559 	TInt res=0;
       
   560 	// Gets all entries
       
   561 	TInt allEntries = GetScriptsCount();
       
   562 	if(allEntries>0)
       
   563 		{
       
   564 		const CArrayFix<TInt> *SelectedIndexes = iListBox->SelectionIndexes();
       
   565 		// Checks if current item is selected
       
   566 		TInt n=iListBox->CurrentItemIndex();
       
   567 		TBool IsSelected = iListBox->View()->ItemIsSelected(n);
       
   568 		if(SelectedIndexes)
       
   569 			{                
       
   570 			TInt selEntries = SelectedIndexes->Count();
       
   571 			// There is only one item in list box and it's selected
       
   572 			if(allEntries==1 && IsSelected)
       
   573 				res=EOneItemSel;
       
   574 		    // There is only one item and it is not selected
       
   575 			else if(allEntries==1 && !IsSelected)
       
   576 				res=EOneItem;
       
   577 			// There are more items and current one is selected and there's only one selected item
       
   578 			else if(allEntries>1 && IsSelected && selEntries==1)
       
   579 				res=EMoreItemsSel;
       
   580 			// There are more items and current one is not selected and there's no selected item
       
   581 			else if(allEntries>1 && !IsSelected && selEntries==0)
       
   582 				res=EMoreItems;
       
   583 			// There are more items and current one is selected and all items are selected in the list
       
   584 			else if(allEntries>1 && IsSelected && selEntries==allEntries)
       
   585 				res=EMoreItemsAll;
       
   586 			// There are more items and current one is not selected and all items are selected in 
       
   587 			// the list (except the current one)
       
   588 			else if(allEntries>1 && !IsSelected && selEntries==allEntries-1)
       
   589 				res=EMoreItemsAllExc;
       
   590 		    // There are more items and current one is selected and there are more than one selected items
       
   591 		    // but not all
       
   592 			else if(allEntries>1 && IsSelected && selEntries>1 && allEntries>selEntries)
       
   593 				res=EMoreItemsNotAll;
       
   594 			// There are more items and at least one item is selected which is not the current one
       
   595 			// but not all items are selected
       
   596 			else if(allEntries>1 && !IsSelected && selEntries>0 && allEntries>selEntries)
       
   597 				res=EMoreItemsNotAllNotCurrent;
       
   598 			}
       
   599 		}
       
   600 	return res;
       
   601 	}
       
   602 // -------------------------------------------------------------------------------
       
   603 // Unmark an item or unmark all items (according to aCommand param)
       
   604 // -------------------------------------------------------------------------------
       
   605 //
       
   606 void CUserEmulatorScriptsView::UnMarkL(TInt aCommand)
       
   607 {
       
   608 	const CArrayFix<TInt> *SelectedIndexes = iListBox->SelectionIndexes();
       
   609 	TInt currentItem = 0;
       
   610 	
       
   611 	// Make sure the array is not null (no items)
       
   612 	if ( SelectedIndexes && SelectedIndexes->Count() != 0) 
       
   613 	{
       
   614 		if(aCommand == EAknCmdUnmark)
       
   615 			currentItem = iListBox->CurrentItemIndex(); 
       
   616 		
       
   617 	    // Loop through the selected item indexes
       
   618 	    for ( TInt index=0; index < SelectedIndexes->Count(); index++ )
       
   619 	    {
       
   620 	    	if(currentItem == (*SelectedIndexes)[index] && aCommand == EAknCmdUnmark)
       
   621 	    	{
       
   622 	    		ChangeIconL(EScriptUnMark,index);
       
   623 	    		break;
       
   624 	    	}
       
   625 	    	else if(aCommand == EAknUnmarkAll)
       
   626 	    		ChangeIconL(EScriptUnMark,index);
       
   627 	    }
       
   628         HandleMarkCommandL(aCommand);
       
   629 	}	
       
   630 }
       
   631 // -----------------------------------------
       
   632 // Handles key events
       
   633 // -----------------------------------------
       
   634 //
       
   635 TKeyResponse CUserEmulatorScriptsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,
       
   636 		     										  TEventCode aType)
       
   637 {	
       
   638     // Only key events	
       
   639 	if (aType == EEventKey)
       
   640     {
       
   641         switch (aKeyEvent.iCode)
       
   642         {
       
   643             case EKeyUpArrow:
       
   644             case EKeyDownArrow:
       
   645                 return iListBox->OfferKeyEventL(aKeyEvent, aType);
       
   646 
       
   647             case EKeyBackspace:
       
   648                 // Don't handle key if shift is pressed
       
   649                 if ((aKeyEvent.iModifiers & EModifierShift) == 0)
       
   650                 {
       
   651                     return EKeyWasConsumed;
       
   652                 }
       
   653                 break;
       
   654             default:
       
   655             	break;
       
   656         }
       
   657     }
       
   658     return EKeyWasNotConsumed;
       
   659 }
       
   660 // -----------------------------------------
       
   661 // Handles resource change
       
   662 // -----------------------------------------
       
   663 //
       
   664 void CUserEmulatorScriptsView::HandleResourceChange(TInt aType)
       
   665 {
       
   666 	TRect rect;
       
   667  
       
   668     if ( aType==KEikDynamicLayoutVariantSwitch )
       
   669     {    
       
   670         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
       
   671         
       
   672         SetRect(rect);
       
   673         static_cast<CUserEmulatorAppUi*>(iCoeEnv->AppUi())->SetApplicationRectInSettings();
       
   674     }
       
   675  
       
   676 	CCoeControl::HandleResourceChange(aType);
       
   677 }
       
   678 // -----------------------------------------
       
   679 // Gets system info details
       
   680 // -----------------------------------------
       
   681 //
       
   682 void CUserEmulatorScriptsView::CmdGetSystemInfoL(TBool aValue)
       
   683 {
       
   684     // Operating system version
       
   685     TVersionName versionName = User::Version().Name();
       
   686 
       
   687     class THal {
       
   688     public:
       
   689         const TPtrC Machine(TInt aUid) {
       
   690             static const struct SMachine {
       
   691                 TInt Uid;
       
   692                 const TText* iName;
       
   693             } machine[] = {
       
   694                 { 0x101f4fc3, _S("Nokia 7650") },
       
   695                 { 0x101f466a, _S("Nokia 3650/3660") },
       
   696                 { 0x101f8c19, _S("Nokia N-Gage") },
       
   697                 { 0x101fb2b1, _S("Nokia N-Gage QD") },
       
   698                 { 0x101fb3f4, _S("Nokia 6260") },
       
   699                 { 0x101fb3dd, _S("Nokia 6600") },
       
   700                 { 0x101f3ee3, _S("Nokia 6620") },
       
   701                 { 0x101fb3f3, _S("Nokia 6670/7610") },
       
   702                 { 0x101fbb55, _S("Nokia 6630") },
       
   703                 { 0x10200f99, _S("Nokia 6680") },
       
   704                 { 0x10200f97, _S("Nokia 3230") },
       
   705                 { 0x10200f9b, _S("Nokia 6682") },
       
   706                 { 0x10200f9c, _S("Nokia 6681") },
       
   707                 { 0x10200f98, _S("N90") },
       
   708                 { 0x10200f9a, _S("N70") },
       
   709                 { 0x101fa031, _S("Sendo X") },
       
   710                 { 0x101f9071, _S("Siemens SX") },
       
   711           
       
   712                 { HAL::EMachineUid_Win32Emulator, _S("Win32 emulator") },
       
   713                 { 0x00000000, 0 }       // End of array
       
   714               };
       
   715 
       
   716             for (TInt i = 0; machine[i].Uid; ++i)
       
   717                 if (aUid == machine[i].Uid)
       
   718                     return TPtrC(machine[i].iName);
       
   719 
       
   720             return TPtrC(_S("N/A"));
       
   721         }
       
   722 
       
   723         const TPtrC Family(TUint aIndex) {
       
   724             const TText* family[] = {
       
   725                             _S("Crystal"),
       
   726                             _S("Pearl"),
       
   727                             _S("Quartz"),
       
   728             };
       
   729 
       
   730             if (aIndex < sizeof family / sizeof *family)
       
   731                 return TPtrC(family[aIndex]);
       
   732             else
       
   733                 return TPtrC(_S("N/A"));
       
   734         }
       
   735 
       
   736         const TPtrC Cpu(TUint aIndex) {
       
   737             const TText* cpu[] = {
       
   738                             _S("ARM"),
       
   739                             _S("MCore"),
       
   740                             _S("x86"),
       
   741             };
       
   742 
       
   743             if (aIndex < sizeof cpu / sizeof *cpu)
       
   744                 return TPtrC(cpu[aIndex]);
       
   745             else
       
   746                 return TPtrC(_S("N/A"));
       
   747         }
       
   748 
       
   749         const TPtrC StartupReason(TUint aIndex) {
       
   750             const TText* startup[] = {
       
   751                             _S("Cold"),
       
   752                             _S("Warm"),
       
   753                             _S("Fault"),
       
   754             };
       
   755 
       
   756             if (aIndex < sizeof startup / sizeof *startup)
       
   757                 return TPtrC(startup[aIndex]);
       
   758             else
       
   759                 return TPtrC(_S("N/A"));
       
   760         }
       
   761 
       
   762     } hal;
       
   763 
       
   764     //Get UI Version
       
   765 	TVersion UIversion = iEikonEnv->Version();
       
   766 	TVersionName UIVersion( UIversion.Name() );
       
   767 
       
   768 	// Get Machine Id
       
   769     TInt machineUid;
       
   770     TBuf<KBuffer20> machUid;
       
   771     HAL::Get(HAL::EMachineUid, machineUid);
       
   772     machUid.Format(K0x, machineUid);
       
   773 
       
   774     // Get Family
       
   775     TInt family;
       
   776     HAL::Get(HAL::EDeviceFamily, family);
       
   777     const TPtrC& familyName = hal.Family(family);
       
   778 
       
   779     // Get Family revision
       
   780     TInt familyRev;
       
   781     HAL::Get(HAL::EDeviceFamilyRev, familyRev);
       
   782 
       
   783     // Get CPU
       
   784     TInt cpu;
       
   785     HAL::Get(HAL::ECPU, cpu);
       
   786     const TPtrC& cpuName = hal.Cpu(cpu);
       
   787 
       
   788     // Get CPU speed
       
   789     TInt cpuSpeed;
       
   790     HAL::Get(HAL::ECPUSpeed, cpuSpeed);
       
   791 
       
   792     // Get Startup reason
       
   793     TInt startupReason;
       
   794     HAL::Get(HAL::ESystemStartupReason, startupReason);
       
   795     const TPtrC& startupReasonName = hal.StartupReason(startupReason);
       
   796 
       
   797     // Get total RAM
       
   798     TInt ram;
       
   799     HAL::Get(HAL::EMemoryRAM, ram);
       
   800 
       
   801     // Get Free RAM
       
   802     TInt ramFree;
       
   803     HAL::Get(HAL::EMemoryRAMFree, ramFree);
       
   804 
       
   805     // Get available ROM
       
   806     TInt rom;
       
   807     HAL::Get(HAL::EMemoryROM, rom);
       
   808     
       
   809    
       
   810     //Log system information
       
   811     if(aValue)
       
   812     {
       
   813 		_LIT(KSystemHeader, "#Date, Time,OS-Version,UI-Version,Machine ID,IMEI No,Family,CPU,CPUSpeed,Startup reason,RAM,FreeRAM,ROM\n");
       
   814 		static_cast<CUserEmulatorAppUi*>(iCoeEnv->AppUi())->Logger().WriteLogL(KSystemHeader, ETrue);
       
   815     }
       
   816     
       
   817     HBufC* title = iCoeEnv->AllocReadResourceLC(R_TEXT_SYSTEM_DETAILS);
       
   818     HBufC* textFormat = iCoeEnv->AllocReadResourceLC(R_FORMAT_SYSTEM_DETAILS);
       
   819     HBufC* text = HBufC::NewLC(KBuffer1024);
       
   820 
       
   821     text->Des().Format(*textFormat, &versionName, &UIVersion, &machUid,&iImeiNo, &familyName, familyRev, &cpuName, cpuSpeed / 1000, 
       
   822         &startupReasonName, ram, ram >> 20, ramFree, static_cast<TReal32>(ramFree) / 0x100000, rom, rom >> 20);
       
   823   
       
   824     //Log system information
       
   825     if(aValue)
       
   826     {
       
   827 		HBufC* textFormat1 = iCoeEnv->AllocReadResourceLC(R_FORMAT_SYSTEM_DETAILS_FILE);
       
   828 		HBufC* text1 = HBufC::NewLC(KBuffer1024);
       
   829 		   
       
   830 		text1->Des().Format(*textFormat1, &versionName, &UIVersion, &machUid, &iImeiNo, &familyName, familyRev, &cpuName, cpuSpeed / 1000, 
       
   831 				&startupReasonName, ram, ram >> 20, ramFree, static_cast<TReal32>(ramFree) / 0x100000, rom, rom >> 20);
       
   832 		   
       
   833 		static_cast<CUserEmulatorAppUi*>(iCoeEnv->AppUi())->Logger().WriteLogL(text1->Des(), EFalse, ETrue);
       
   834 		
       
   835 		//Log drive information
       
   836 		TVolumeInfo volumeInfo;
       
   837 		TInt driveNumber=EDriveA; 
       
   838 		TBuf<KBuffer200> buffer;
       
   839 		TChar driveLetter;    
       
   840 		_LIT(KDriveFormat,"Volume name: %c,Size: %Ld (%Ld MB),Free space: %Ld (%Ld MB)\n");
       
   841 		
       
   842 		for (driveNumber=EDriveA; driveNumber<EDriveZ; driveNumber++)
       
   843 		{
       
   844 			TInt err=iEEnv->FsSession().Volume(volumeInfo,driveNumber);
       
   845 			if (err!=KErrNotReady) 
       
   846 				// Volume() returns KErrNotReady if no volume present.
       
   847 				// In this case, check next drive number
       
   848 			{
       
   849 				User::LeaveIfError(iEEnv->FsSession().DriveToChar(driveNumber,driveLetter));
       
   850 				buffer.Zero();			
       
   851 				buffer.AppendFormat(KDriveFormat,TUint(driveLetter),volumeInfo.iSize,volumeInfo.iSize >> 20, volumeInfo.iFree, volumeInfo.iFree >> 20);
       
   852 				static_cast<CUserEmulatorAppUi*>(iCoeEnv->AppUi())->Logger().WriteLogL(buffer, EFalse, ETrue);
       
   853 			}
       
   854 		}
       
   855 		CleanupStack::PopAndDestroy(2);
       
   856     }
       
   857     // Don't log but display error info details
       
   858     if(!aValue)
       
   859     {
       
   860 		CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(*text);
       
   861 		dlg->SetHeaderText(*title);
       
   862 		dlg->PrepareLC(R_DIALOG_INFO);
       
   863 		dlg->RunLD();
       
   864     }   
       
   865 
       
   866     CleanupStack::PopAndDestroy(3);
       
   867 }
       
   868 
       
   869 
       
   870 // ----------------------------------------------------------------
       
   871 // This function gets called before a new folder is being scanned
       
   872 // ----------------------------------------------------------------
       
   873 //
       
   874 void CUserEmulatorScriptsView::FolderStarting( const TDesC & /*aFullPath*/,
       
   875 		                                       TBool /*aIsDriveListFlag*/ )
       
   876 {
       
   877 	 iFilesArray->Reset();
       
   878 }
       
   879 // ----------------------------------------------------------------
       
   880 // This function gets called with every entry of the currently 
       
   881 // scanned folder that is a folder. Not used
       
   882 // ----------------------------------------------------------------
       
   883 //
       
   884 void CUserEmulatorScriptsView::NewFolder( const TDesC & /*aEntry*/ )
       
   885 {
       
   886 }
       
   887 // ----------------------------------------------------------------
       
   888 // This function gets called with every entry of the currently 
       
   889 // scanned folder that is a plain file.
       
   890 // ----------------------------------------------------------------
       
   891 //
       
   892 void CUserEmulatorScriptsView::NewFile( const TDesC & aEntry )
       
   893 {
       
   894 	TBuf<KBuffer256> nameBuf;
       
   895 	_LIT(KFormatString, "\t%S\t\t");
       
   896 	nameBuf.AppendFormat(KFormatString, &aEntry);
       
   897 
       
   898 	TRAPD(err,iFilesArray->AppendL(nameBuf));	
       
   899 	if(err != KErrNone)
       
   900 	{
       
   901 		//Display error message
       
   902 	}
       
   903 }
       
   904 // ----------------------------------------------------------------
       
   905 // This is called after all entries of the currently scanned folder
       
   906 // have been delivered. This is NOT called when a scan operation is
       
   907 // aborted by starting a new scan before this got called!
       
   908 // ----------------------------------------------------------------
       
   909 //
       
   910 void CUserEmulatorScriptsView::FolderCompleteL()
       
   911 {
       
   912 	TRAPD(err,ShowFileListL());
       
   913 	if(err != KErrNone)
       
   914 	{
       
   915 		//Display error message
       
   916 	}
       
   917 	UpdateSystemCba(EFalse);
       
   918 	
       
   919 	// Notifies the AppUi that listbox is initialised with script name list
       
   920 	static_cast<CUserEmulatorAppUi*>(iCoeEnv->AppUi())->FolderScanCompletedL();
       
   921 }
       
   922 // ------------------------------------------------------------------
       
   923 // Called when an unexpected error occures during scanning. Not used
       
   924 // ------------------------------------------------------------------
       
   925 //
       
   926 void CUserEmulatorScriptsView::ErrorOccured( TInt /*aReasonCode*/ )
       
   927 {
       
   928 }
       
   929 // ------------------------------------------------------------------
       
   930 // Make list box to redraw its items
       
   931 // ------------------------------------------------------------------
       
   932 //
       
   933 void CUserEmulatorScriptsView::ShowFileListL()
       
   934 {		
       
   935     iListBox->HandleItemAdditionL( );
       
   936 	iListBox->SetFocus(ETrue, EDrawNow);	
       
   937 	iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);	
       
   938 }
       
   939 // ------------------------------------------------------------------------
       
   940 // Calls ShowScriptL function because a change occured in the given folder
       
   941 // ------------------------------------------------------------------------
       
   942 //
       
   943 void  CUserEmulatorScriptsView::FileChangeEventL()
       
   944 {
       
   945 	ShowScriptsL();
       
   946 }
       
   947 // ------------------------------------------------------------------------
       
   948 //  Gets the index of a given script and mark it
       
   949 // ------------------------------------------------------------------------
       
   950 //
       
   951 TInt CUserEmulatorScriptsView::GetScriptIndexAndMarkL(const TDesC8& aScriptName)
       
   952 {   
       
   953 	TInt ret = -1;
       
   954 	TFileName scriptName;
       
   955 	scriptName.Copy(aScriptName);
       
   956 	// Steps through the file array
       
   957 	for(TInt i=0; i < iFilesArray->Count();i++)
       
   958 	{   
       
   959 	    // Gets i. file name
       
   960 		TPtrC fileName = iFilesArray->operator [](i);
       
   961 		TFileName script;
       
   962 		
       
   963 		TInt pos=fileName.LocateF('\t');
       
   964 		TPtrC buff;
       
   965 		if(pos!=KErrNotFound && pos+1<=fileName.Length())
       
   966 			buff.Set(fileName.Mid(pos+1));
       
   967 		pos=buff.LocateF('\t');
       
   968 		TPtrC fileNamePtr;
       
   969 		if(pos!=KErrNotFound)
       
   970 			fileNamePtr.Set(buff.Mid(0,pos));
       
   971 		script.Copy(fileNamePtr);
       
   972 		
       
   973     	// If that's the script we are looking for then
       
   974 		if(scriptName.Compare(script) == 0)
       
   975 		{
       
   976 		    // the result will be it's index
       
   977 			ret = i;
       
   978 			break;
       
   979 		}			
       
   980 	}
       
   981 	if(ret < GetScriptsCount() && ret!=-1)
       
   982 	{
       
   983 		iListBox->SetCurrentItemIndex(ret);
       
   984 		HandleMarkCommandL(EAknCmdMark);
       
   985 	}
       
   986 	return ret;
       
   987 }
       
   988 
       
   989 //-------------------CImeiReader---------------------------------------------
       
   990 
       
   991 // ----------------------------------
       
   992 // CImeiReader::NewL
       
   993 // ----------------------------------
       
   994 //
       
   995 CImeiReader* CImeiReader::NewL(MImeiObserver& aObserver)
       
   996     {
       
   997     CImeiReader* self = NewLC(aObserver);
       
   998     CleanupStack::Pop(self);
       
   999     return self;
       
  1000     }
       
  1001 // ----------------------------------
       
  1002 // CImeiReader::NewL
       
  1003 // ----------------------------------
       
  1004 //  
       
  1005 CImeiReader* CImeiReader::NewLC(MImeiObserver& aObserver)
       
  1006     {
       
  1007     CImeiReader* self = new (ELeave) CImeiReader(aObserver);
       
  1008     CleanupStack::PushL(self);
       
  1009     self->ConstructL();
       
  1010     return self;
       
  1011     }
       
  1012     
       
  1013 // ----------------------------------
       
  1014 // CImeiReader::CImeiReader
       
  1015 // ----------------------------------
       
  1016 //  
       
  1017 CImeiReader::CImeiReader(MImeiObserver& aObserver)
       
  1018 :CActive(0),iObserver(aObserver),iIdV1Pkg(iIdV1)
       
  1019 {
       
  1020 }
       
  1021 // ----------------------------------
       
  1022 // CImeiReader::~CImeiReader
       
  1023 // ----------------------------------
       
  1024 // 
       
  1025 CImeiReader::~CImeiReader()
       
  1026 {
       
  1027 	Cancel();
       
  1028 	delete iTelephony;	
       
  1029 } 
       
  1030 // ----------------------------------
       
  1031 // CImeiReader::ConstructL
       
  1032 // ----------------------------------
       
  1033 //
       
  1034 void CImeiReader::ConstructL()
       
  1035 {	
       
  1036 	CActiveScheduler::Add(this);
       
  1037 	// Create telephony object
       
  1038 	iTelephony = CTelephony::NewL();
       
  1039 	iTelephony->GetPhoneId(iStatus,iIdV1Pkg);
       
  1040 	SetActive();	
       
  1041 }
       
  1042 // ----------------------------------
       
  1043 // CActive class's cancel function
       
  1044 // ----------------------------------
       
  1045 //
       
  1046 void CImeiReader::DoCancel()
       
  1047 {
       
  1048 	iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
       
  1049 }
       
  1050 // ----------------------------------
       
  1051 // CActive class's RunL function
       
  1052 // ----------------------------------
       
  1053 // 
       
  1054 void CImeiReader::RunL()
       
  1055 {
       
  1056     // Calls GotIMEI and stores serial number 
       
  1057 	iObserver.GotIMEI(iIdV1.iSerialNumber,iStatus.Int());
       
  1058 }
       
  1059 
       
  1060 // End of File