videofeeds/server/tsrc/VCXVodContentApiTest/VCXTestEcgFileObserver/src/IptvTestEcgFileObserverBlocks.cpp
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2002 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:   ?Description*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 // [INCLUDE FILES] - do not remove
       
    21 #include <e32svr.h>
       
    22 #include <StifParser.h>
       
    23 #include <Stiftestinterface.h>
       
    24 #include "IptvTestEcgFileObserver.h"
       
    25 
       
    26 // INCLUDE FILES
       
    27 #include <e32svr.h>
       
    28 #include <StifParser.h>
       
    29 #include <Stiftestinterface.h>
       
    30 
       
    31 #include "VCXTestLog.h"
       
    32 #include "TestUtilConnection.h"
       
    33 #include "TestUtilConnectionWaiter.h"
       
    34 #include "IptvTestDownloadManager.h"
       
    35 #include "VCXTestCommon.h"
       
    36 #include "CIptvTestMobilecrashWatcher.h"
       
    37 #include <BADESCA.H>
       
    38 #include <COMMDB.H>
       
    39 #include "VCXTestCommon.h"
       
    40 #include "CIptvTestUtilities.h"
       
    41 
       
    42 class CIptvTestUtilities;
       
    43 
       
    44 // CONSTANTS
       
    45 
       
    46 _LIT( KDateTimeString, "%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%H%:1%T%:2%S%.%*C2%:3%-B" );
       
    47 _LIT( KServicePathFormat, "C:\\data\\videocenter\\ecg\\%d\\tbn\\" );
       
    48 
       
    49 /* 5 videos; thumbnails: all; touch TN file: all */ 
       
    50 _LIT( KIptvTestUrlUpdateAll, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op30=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op31=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op22=on&op12=on&op32=on&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op23=on&op13=on&op33=on&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op24=on&op14=on&op34=on&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&hiddenfield=Secret+Text" );
       
    51 
       
    52 /* 5 videos; thumbnails: all; touch TN file: none */ 
       
    53 _LIT( KIptvTestUrl1, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op22=on&op12=on&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op23=on&op13=on&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op24=on&op14=on&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&hiddenfield=Secret+Text" );
       
    54 
       
    55 /* 5 videos; thumbnails: all; touch TN file: 0, 2, 4 */
       
    56 _LIT( KIptvTestUrl2, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op30=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op22=on&op12=on&op32=on&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op23=on&op13=on&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op24=on&op14=on&op34=on&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&hiddenfield=Secret+Text" );
       
    57 
       
    58 /* 5 videos; touch feed TN; thumbnails: all; touch TN file: none */
       
    59 _LIT( KIptvTestUrl3, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&opx=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op22=on&op12=on&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op23=on&op13=on&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op24=on&op14=on&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&hiddenfield=Secret+Text" );
       
    60 
       
    61 /* 4 videos; touch feed TN; thumbnails: all */
       
    62 _LIT( KIptvTestUrl4, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op22=on&op12=on&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op23=on&op13=on&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&hiddenfield=Secret+Text" );
       
    63 
       
    64 /* Videos 0-3, same thumbnails in 0,1 and 2,3 */
       
    65 _LIT( KIptvTestUrl5, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op30=on&op71=n95_1.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op31=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op22=on&op12=on&op32=on&op73=n95_3.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op23=on&op13=on&op33=on&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&hiddenfield=Secret+Text" );
       
    66 
       
    67 /* 3 videos; thumbnails: 1, 2; touch TN file: 1, 2 */ 
       
    68 _LIT( KIptvTestUrl6, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op30=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op31=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op22=on&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&hiddenfield=Secret+Text&XIIT=1" );
       
    69 
       
    70 /* 3 videos; thumbnails: 1, 3; touch TN file: 1, 2 */
       
    71 _LIT( KIptvTestUrl7, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op30=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op31=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op22=on&op12=on&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&hiddenfield=Secret+Text&XIIT=1" );
       
    72 
       
    73 /* Videos 1,2,4,5, thumbnails in all, not touched */
       
    74 _LIT( KIptvTestUrl8, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op12=on&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op23=on&op13=on&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op24=on&op14=on&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&hiddenfield=Secret+Text&XIIT=1");
       
    75 
       
    76 /* Videos 1, 2, thumbnails, 2nd touched */
       
    77 _LIT( KIptvTestUrl9, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op31=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&hiddenfield=Secret+Text&XIIT=1");
       
    78 
       
    79 /* All videos, thumbnails, last one touched */
       
    80 _LIT( KIptvTestUrl10, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op22=on&op12=on&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op23=on&op13=on&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op24=on&op14=on&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op25=on&op15=on&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op26=on&op16=on&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op27=on&op17=on&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&op28=on&op18=on&op38=on&hiddenfield=Secret+Text");
       
    81 
       
    82 /* All videos, thumbnails, first one touched */
       
    83 _LIT( KIptvTestUrl11, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op30=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op22=on&op12=on&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op23=on&op13=on&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op24=on&op14=on&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op25=on&op15=on&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op26=on&op16=on&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op27=on&op17=on&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&op28=on&op18=on&hiddenfield=Secret+Text");
       
    84 
       
    85 /* Videos 0-3, thumbnails */
       
    86 _LIT( KIptvTestUrl12, "http://193.65.182.78/cgi-bin/nokia_tntest_engine.cgi?op0=on&op70=n95_1.png&op80=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op90=N95&op20=on&op10=on&op71=n95_2.png&op81=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op91=N95&op21=on&op11=on&op72=n95_3.png&op82=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op92=N95&op22=on&op12=on&op73=n93.png&op83=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op93=N9x+and+N80&op23=on&op13=on&op74=n80.png&op84=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op94=N9x+and+N80&op75=n91.png&op85=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op95=N9x+and+N80&op76=n76.png&op86=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op96=N7x&op77=n70.png&op87=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op97=N7x&op78=n72.png&op88=Fri%2C+26+May+2015+14%3A35%3A26+GMT&op98=N7x&hiddenfield=Secret+Text");
       
    87 
       
    88 // MODULE DATA STRUCTURES
       
    89 
       
    90 // ============================ MEMBER FUNCTIONS ===============================
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CIptvTestEcgFileObserver::Delete
       
    94 // Delete here all resources allocated and opened from test methods.
       
    95 // Called from destructor.
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 void CIptvTestEcgFileObserver::Delete()
       
    99     {
       
   100 	if(iDownloadManager)
       
   101 		{
       
   102 		delete iDownloadManager;
       
   103 		iDownloadManager = NULL;
       
   104 		}
       
   105     iFs.Close();
       
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CIptvTestEcgFileObserver::RunMethodL
       
   110 // Run specified method. Contains also table of test mothods and their names.
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 TInt CIptvTestEcgFileObserver::RunMethodL(
       
   114     CStifItemParser& aItem )
       
   115     {
       
   116 
       
   117     static TStifFunctionInfo const KFunctions[] =
       
   118         {
       
   119         // Copy this line for every implemented function.
       
   120         // First string is the function name used in TestScripter script file.
       
   121         // Second is the actual implementation member function.
       
   122         ENTRY( "SetObservedServicePath", CIptvTestEcgFileObserver::SetObservedServicePathL ),
       
   123 		ENTRY( "Download", CIptvTestEcgFileObserver::DownloadL ),
       
   124 		ENTRY( "AddObservedFilename", CIptvTestEcgFileObserver::AddObservedFilenameL ),
       
   125 		ENTRY( "GetFileDate", CIptvTestEcgFileObserver::GetFileDateL ),
       
   126 		ENTRY( "CheckFileDate", CIptvTestEcgFileObserver::CheckFileDateL ),
       
   127 		ENTRY( "CheckFileState", CIptvTestEcgFileObserver::CheckFileState ),
       
   128 		ENTRY( "SyncTimeWithServer", CIptvTestEcgFileObserver::SyncTimeWithServerL ),
       
   129         //ADD NEW ENTRY HERE
       
   130         // [test cases entries] - Do not remove
       
   131 
       
   132         };
       
   133 
       
   134     const TInt count = sizeof( KFunctions ) /
       
   135                         sizeof( TStifFunctionInfo );
       
   136 
       
   137     return RunInternalL( KFunctions, count, aItem );
       
   138 
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CIptvTestEcgFileObserver::DownloadL
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 TInt CIptvTestEcgFileObserver::DownloadL( CStifItemParser& aItem  )
       
   146 	{
       
   147     VCXLOGLO1(">>>CIptvTestEcgFileObserver::DownloadL");
       
   148     // Print to UI
       
   149     _LIT( KIptvTestUtilModule, "CIptvTestEcgFileObserver" );
       
   150     _LIT( KWhere, "In DownloadL" );
       
   151     TestModuleIf().Printf( 0, KIptvTestUtilModule, KWhere );
       
   152     // Print to log file
       
   153     iLog->Log( KWhere );
       
   154 
       
   155     TInt err = KErrNone;
       
   156 
       
   157  	aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   158 
       
   159  	TPtrC pAddress, pOutFile, pUserName, pPassword, pIapName;
       
   160 
       
   161     if( aItem.GetNextString ( pAddress ) != KErrNone )
       
   162         {
       
   163 		VCXLOGLO1("CIptvTestEcgFileObserver::DownloadL: Could not read parameter address!");
       
   164 		return KErrGeneral;
       
   165         }
       
   166 
       
   167     HBufC* heapBuffer = HBufC::NewL(4000);
       
   168     TPtr ptr( heapBuffer->Des() );
       
   169 
       
   170     if( ParseAddress( pAddress ) )
       
   171         {
       
   172         VCXLOGLO1("CIptvTestEcgFileObserver::DownloadL: Using hard coded address.");
       
   173         }
       
   174     ptr.Copy( pAddress );
       
   175 
       
   176     if( aItem.GetNextString ( pOutFile ) != KErrNone )
       
   177         {
       
   178 		VCXLOGLO1("CIptvTestEcgFileObserver::DownloadL: Could not read parameter outputfile!");
       
   179 		return KErrGeneral;
       
   180         }
       
   181 
       
   182     if( aItem.GetNextString ( pUserName ) != KErrNone )
       
   183         {
       
   184 		VCXLOGLO1("CIptvTestEcgFileObserver::DownloadL: no user name specified!");
       
   185         }
       
   186 
       
   187     if( aItem.GetNextString ( pPassword ) != KErrNone )
       
   188         {
       
   189 		VCXLOGLO1("CIptvTestEcgFileObserver::DownloadL: no password specified!");
       
   190         }
       
   191 
       
   192     if( aItem.GetNextString ( pIapName ) != KErrNone )
       
   193         {
       
   194 		VCXLOGLO1("CIptvTestEcgFileObserver::DownloadL: no iap specified!");
       
   195         }
       
   196 
       
   197 	VCXLOGLO2("Address: %S", &pAddress);
       
   198 	VCXLOGLO2("OutFile: %S", &pOutFile);
       
   199 	VCXLOGLO2("name: %S", &pUserName);
       
   200 	VCXLOGLO2("Password: %S", &pPassword);
       
   201 	VCXLOGLO2("Iap: %S", &pIapName);
       
   202 
       
   203    if(iDownloadManager)
       
   204         {
       
   205         delete iDownloadManager;
       
   206         iDownloadManager = NULL;
       
   207         }
       
   208 	
       
   209 	if(!iDownloadManager)
       
   210 		{
       
   211 		iDownloadManager = CIptvTestDownloadManager::NewL(this);
       
   212 		}
       
   213 
       
   214     TUint32 iapId(0);
       
   215 
       
   216     CVCXTestCommon* vcxCommon;
       
   217     vcxCommon = CVCXTestCommon::NewL();
       
   218     vcxCommon->GetIapIdL( pIapName, iapId );
       
   219     delete vcxCommon;
       
   220 
       
   221 	err = iDownloadManager->DownloadL(ptr, pOutFile, pUserName, pPassword, iapId);
       
   222 	if(err != KErrNone)
       
   223 		{
       
   224 		VCXLOGLO2("iDownloadManager returned: %d", err);
       
   225 		}
       
   226 
       
   227 	VCXLOGLO1("<<<CIptvTestEcgFileObserver::DownloadL");
       
   228     return err;
       
   229 	}
       
   230 
       
   231 // -----------------------------------------------------------------------------
       
   232 // CIptvTestEcgFileObserver::ParseAddress
       
   233 // -----------------------------------------------------------------------------
       
   234 //
       
   235 TBool CIptvTestEcgFileObserver::ParseAddress( TPtrC& aAddress )
       
   236     {
       
   237     TBool found( 0 );
       
   238 
       
   239     if( aAddress == _L("KIptvTestUrlUpdateAll") )
       
   240         {
       
   241         aAddress.Set( KIptvTestUrlUpdateAll );
       
   242         found = ETrue;
       
   243         }
       
   244     else if( aAddress == _L("KIptvTestUrl1") )
       
   245         {
       
   246         aAddress.Set( KIptvTestUrl1 );
       
   247         found = ETrue;
       
   248         }
       
   249     else if( aAddress == _L("KIptvTestUrl2") )
       
   250         {
       
   251         aAddress.Set( KIptvTestUrl2 );
       
   252         found = ETrue;
       
   253         }
       
   254     else if( aAddress == _L("KIptvTestUrl3") )
       
   255         {
       
   256         aAddress.Set( KIptvTestUrl3 );
       
   257         found = ETrue;
       
   258         }
       
   259     else if( aAddress == _L("KIptvTestUrl4") )
       
   260         {
       
   261         aAddress.Set( KIptvTestUrl4 );
       
   262         found = ETrue;
       
   263         }
       
   264     else if( aAddress == _L("KIptvTestUrl5") )
       
   265         {
       
   266         aAddress.Set( KIptvTestUrl5 );
       
   267         found = ETrue;
       
   268         }
       
   269     else if( aAddress == _L("KIptvTestUrl6") )
       
   270         {
       
   271         aAddress.Set( KIptvTestUrl6 );
       
   272         found = ETrue;
       
   273         }
       
   274     else if( aAddress == _L("KIptvTestUrl7") )
       
   275         {
       
   276         aAddress.Set( KIptvTestUrl7 );
       
   277         found = ETrue;
       
   278         }
       
   279     else if( aAddress == _L("KIptvTestUrl8") )
       
   280         {
       
   281         aAddress.Set( KIptvTestUrl8 );
       
   282         found = ETrue;
       
   283         }
       
   284     else if( aAddress == _L("KIptvTestUrl9") )
       
   285         {
       
   286         aAddress.Set( KIptvTestUrl9 );
       
   287         found = ETrue;
       
   288         }
       
   289     else if( aAddress == _L("KIptvTestUrl10") )
       
   290         {
       
   291         aAddress.Set( KIptvTestUrl10 );
       
   292         found = ETrue;
       
   293         }
       
   294     else if( aAddress == _L("KIptvTestUrl11") )
       
   295         {
       
   296         aAddress.Set( KIptvTestUrl11 );
       
   297         found = ETrue;
       
   298         }
       
   299     else if( aAddress == _L("KIptvTestUrl12") )
       
   300         {
       
   301         aAddress.Set( KIptvTestUrl12 );
       
   302         found = ETrue;
       
   303         }
       
   304     return found;
       
   305     }
       
   306 
       
   307 
       
   308 // -----------------------------------------------------------------------------
       
   309 // CIptvTestEcgFileObserver::SetObservedServicePathL
       
   310 // -----------------------------------------------------------------------------
       
   311 //
       
   312 TInt CIptvTestEcgFileObserver::SetObservedServicePathL( CStifItemParser& aItem )
       
   313     {
       
   314     VCXLOGLO1(">>>CIptvTestEcgFileObserver::SetObservedFilenameL");
       
   315     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   316 
       
   317     TInt error( 0 );
       
   318     TPtrC serviceName;
       
   319     error = aItem.GetNextString( serviceName );
       
   320     if( error != KErrNone )
       
   321         {
       
   322         VCXLOGLO1("CIptvTestEcgFileObserver::SetObservedFilenameL -- No service given!");
       
   323         VCXLOGLO1("<<<CIptvTestEcgFileObserver::SetObservedFilenameL");
       
   324         return error;
       
   325         }
       
   326 
       
   327     TInt serviceId( 0 );
       
   328 
       
   329     CIptvTestUtilities* util;
       
   330     util = CIptvTestUtilities::NewL();
       
   331     util->GetServiceIdByNameL( serviceName, serviceId );
       
   332     delete util;
       
   333 
       
   334     iObservedServicePath = HBufC::NewL(1024);
       
   335     iObservedServicePath->Des().Format( KServicePathFormat(), serviceId );
       
   336     VCXLOGLO2("CIptvTestEcgFileObserver::SetObservedServicePathL -- path:   %S", iObservedServicePath );
       
   337     
       
   338     iObservedFiles.ResetAndDestroy();
       
   339 
       
   340     VCXLOGLO1("<<<CIptvTestEcgFileObserver::SetObservedFilenameL");
       
   341     return KErrNone;
       
   342     }
       
   343 
       
   344 // -----------------------------------------------------------------------------
       
   345 // CIptvTestEcgFileObserver::AddObservedFilenameL
       
   346 // -----------------------------------------------------------------------------
       
   347 //
       
   348 TInt CIptvTestEcgFileObserver::AddObservedFilenameL( CStifItemParser& aItem )
       
   349     {
       
   350     VCXLOGLO1(">>>CIptvTestUtilModule::AddObservedFilenameL");
       
   351 		/*
       
   352     // Print to UI
       
   353     _LIT( KIptvTestEcgFileObserver, "IptvTestEcgFileObserver" );
       
   354     _LIT( KWhere, "In AddObservedFilenameL" );
       
   355     TestModuleIf().Printf( 0, KIptvTestEcgFileObserver, KWhere );
       
   356     // Print to log file
       
   357     iLog->Log( KWhere );
       
   358     */
       
   359     
       
   360     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   361     
       
   362     TPtrC tempFileName;
       
   363     while( aItem.GetNextString( tempFileName ) == KErrNone )
       
   364         {
       
   365         HBufC* temp = HBufC::NewL( tempFileName.Length() + 1 + iObservedServicePath->Length() + 1);
       
   366         CleanupStack::PushL(temp);
       
   367         temp->Des().Append( *iObservedServicePath );
       
   368         temp->Des().Append( tempFileName );
       
   369         VCXLOGLO2("CIptvTestEcgFileObserver::SetObservedFilenameL -- adding: %S", temp );
       
   370         iObservedFiles.AppendL( temp );
       
   371         CleanupStack::Pop(temp);
       
   372         }
       
   373     VCXLOGLO1("<<<CIptvTestEcgFileObserver::SetObservedFilenameL");
       
   374     return 0;
       
   375     }
       
   376 
       
   377 // -----------------------------------------------------------------------------
       
   378 // CIptvTestEcgFileObserver::GetFileDate
       
   379 // -----------------------------------------------------------------------------
       
   380 //
       
   381 TInt CIptvTestEcgFileObserver::GetFileDateL( CStifItemParser& /* aItem */ )
       
   382 	{
       
   383 	VCXLOGLO1(">>>CIptvTestEcgFileObserver::GetFileDateL");
       
   384 
       
   385     iFileModifiedDates.Reset();
       
   386 
       
   387     TInt err( 0 );
       
   388     TInt index( 0 );
       
   389 	for( index = 0; index < iObservedFiles.Count() ; index++ )
       
   390 	    {
       
   391 	    HBufC16* fileName = iObservedFiles[index];
       
   392 	    VCXLOGLO2("CIptvTestEcgFileObserver::GetFileDate -- fetching: %S", fileName);
       
   393 
       
   394 	    TBuf<256> timeString;
       
   395 	    RFile file;
       
   396 	    CleanupClosePushL(file);
       
   397 	    TInt err = file.Open(iFs, *fileName, EFileRead);
       
   398 	    TTime temp( 0 );
       
   399 	    if( err == KErrNone )
       
   400 	        {
       
   401             file.Modified( temp );
       
   402             temp.FormatL(timeString, KDateTimeString);
       
   403             file.Close();
       
   404 	        }
       
   405 	    VCXLOGLO2("CIptvTestEcgFileObserver::GetFileDate -- date: %S", &timeString );
       
   406 	    CleanupStack::PopAndDestroy();
       
   407         iFileModifiedDates.Append( temp );
       
   408 	    }
       
   409 	VCXLOGLO2("<<<CIptvTestEcgFileObserver:: returning: %d", err);
       
   410 	VCXLOGLO1("<<<CIptvTestEcgFileObserver::GetFileDateL");
       
   411 	return err;
       
   412 	}
       
   413 
       
   414 // -----------------------------------------------------------------------------
       
   415 // CIptvTestEcgFileObserver::CheckFileDateL
       
   416 // -----------------------------------------------------------------------------
       
   417 //
       
   418 TInt CIptvTestEcgFileObserver::CheckFileDateL( CStifItemParser& aItem )
       
   419 	{
       
   420 	VCXLOGLO1(">>>CIptvTestEcgFileObserver::CheckFileDateL");
       
   421 
       
   422 	TInt err( 0 );
       
   423 
       
   424 	/* Check every observed file for modified date */
       
   425     TInt index( 0 );
       
   426     TBuf<256> timeSaved;
       
   427     TBuf<256> timeCheck;
       
   428 
       
   429 	for( index = 0; index < iObservedFiles.Count() ; index++ )
       
   430 	    {
       
   431         TBool expectedValue( EFalse ); // Default is that dates are not modified 
       
   432         TInt temp;
       
   433         if( aItem.GetNextInt( temp ) == KErrNone ) 
       
   434             {
       
   435             expectedValue = static_cast<TBool>( temp );   
       
   436             }
       
   437 	    
       
   438 	    HBufC16* fileName = iObservedFiles[index];
       
   439         RFile file;
       
   440         CleanupClosePushL(file);
       
   441         err = file.Open( iFs, *fileName, EFileRead );
       
   442         
       
   443         if( err == KErrNone )
       
   444             {
       
   445             VCXLOGLO2("CIptvTestEcgFileObserver::CheckFileDate -- Getting modified date from %S", fileName );
       
   446             
       
   447             TTime checkModified( 0 );
       
   448             User::LeaveIfError( file.Modified( checkModified ) );
       
   449             checkModified.FormatL(timeCheck, KDateTimeString);
       
   450             
       
   451             TTime savedModified( 0 );
       
   452             if( iFileModifiedDates.Count() > index )
       
   453                 {
       
   454                 savedModified = iFileModifiedDates[index];
       
   455                 savedModified.FormatL(timeSaved, KDateTimeString);
       
   456                 }
       
   457             VCXLOGLO3("CIptvTestEcgFileObserver::CheckFileDate -- Saved date: %S,  New date:   %S", &timeSaved, &timeCheck );
       
   458                  
       
   459             // Set the modified value to true if the modified dates don't match
       
   460             TBool modifiedValue = (checkModified != savedModified);
       
   461             
       
   462             VCXLOGLO3("CIptvTestEcgFileObserver::CheckFileDate -- expect: %d, modified: %d", expectedValue, modifiedValue );
       
   463             
       
   464             // If the expected value doesn't match with the modified value, return error
       
   465             if( expectedValue != modifiedValue )
       
   466                 {
       
   467                 VCXLOGLO1("CIptvTestEcgFileObserver::CheckFileDate -- value not expected!");
       
   468                 err = KErrCorrupt; 
       
   469                 }            
       
   470             }
       
   471         else
       
   472             {
       
   473             if( err == KErrNotFound )
       
   474                 {
       
   475                 err = KErrNone; // We don't care if the file doesn't exist, check is done by CheckFileState
       
   476                 }
       
   477             else
       
   478                 {
       
   479                 VCXLOGLO2("IptvTestEcgFileObserver::CheckFileDate -- error opening file: %d", err );
       
   480                 }
       
   481             }
       
   482 
       
   483         CleanupStack::PopAndDestroy(&file);
       
   484 	    }
       
   485 	
       
   486 	VCXLOGLO2("<<<CIptvTestEcgFileObserver:: returning: %d", err);
       
   487 	VCXLOGLO1("<<<CIptvTestEcgFileObserver::CheckFileDateL");
       
   488 	return err;
       
   489 	}
       
   490 
       
   491 // -----------------------------------------------------------------------------
       
   492 // CIptvTestEcgFileObserver::CheckFileState
       
   493 // -----------------------------------------------------------------------------
       
   494 //
       
   495 TInt CIptvTestEcgFileObserver::CheckFileState( CStifItemParser& aItem )
       
   496 	{
       
   497     VCXLOGLO1(">>>CIptvTestEcgFileObserver::CheckFileState");
       
   498 
       
   499     TInt err( 0 );
       
   500 
       
   501     TInt index( 0 );
       
   502     for( index = 0; index < iObservedFiles.Count() ; index++ )
       
   503         {
       
   504         TInt temp = ETrue;
       
   505         TBool checkStatus( temp ); // Default: checkStatus is ETrue 
       
   506         aItem.GetNextInt( temp );
       
   507         checkStatus = static_cast<TBool>( temp );
       
   508 
       
   509         HBufC16* fileName = iObservedFiles[index];
       
   510 
       
   511     	/* Get the state of the file (exists / not ) */
       
   512         TBool exists = BaflUtils::FileExists( iFs, *fileName );
       
   513         VCXLOGLO4("CIptvTestEcgFileObserver::CheckFileState -- Checking state of %S, real: %d, expected: %d", fileName, exists, checkStatus );
       
   514 
       
   515         if( checkStatus != exists )
       
   516         	{
       
   517     		VCXLOGLO1("CIptvTestEcgFileObserver::CheckFileState -- File state doesn't match the expected status!");
       
   518     		err = KErrCorrupt;
       
   519     		break;
       
   520         	}
       
   521         }
       
   522     VCXLOGLO2("<<<CIptvTestEcgFileObserver:: returning: %d", err);
       
   523     VCXLOGLO1("<<<CIptvTestEcgFileObserver::CheckFileState");
       
   524     return err;
       
   525 	}
       
   526 
       
   527 // -----------------------------------------------------------------------------
       
   528 // CIptvTestEcgFileObserver::SyncTimeWithServerL
       
   529 // -----------------------------------------------------------------------------
       
   530 //
       
   531 TInt CIptvTestEcgFileObserver::SyncTimeWithServerL( CStifItemParser& aItem )
       
   532 	{
       
   533     VCXLOGLO1(">>>CIptvTestUtilModule::SyncTimeWithServerL");
       
   534 		/*
       
   535     // Print to UI
       
   536     _LIT( KIptvTestEcgFileObserver, "IptvTestEcgFileObserver" );
       
   537     _LIT( KWhere, "In SyncTimeWithServerL" );
       
   538     TestModuleIf().Printf( 0, KIptvTestEcgFileObserver, KWhere );
       
   539     // Print to log file
       
   540     iLog->Log( KWhere );
       
   541     */
       
   542 
       
   543     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
       
   544     TInt error;
       
   545     RFile file;
       
   546 
       
   547     TPtrC tempFileName;
       
   548     if( aItem.GetNextString( tempFileName ) )
       
   549         {
       
   550         VCXLOGLO1( "CIptvTestEcgFileObserver::SyncTimeWithServerL -- No filename given!" );
       
   551         VCXLOGLO1( "<<<CIptvTestEcgFileObserver::SyncTimeWithServerL" );
       
   552         return KErrArgument;
       
   553         }
       
   554 	VCXLOGLO2("CIptvTestEcgFileObserver::SyncTimeWithServerL -- Reading from: %S", &tempFileName );	
       
   555 
       
   556 	TBuf8<22> textFromFile;
       
   557 	error = file.Open( iFs, tempFileName, EFileRead );
       
   558 	VCXLOGLO2( "CIptvTestEcgFileObserver:: file open %d", error );
       
   559 	
       
   560 	if( error == KErrNone )
       
   561 	    {
       
   562 	    error = file.Read( textFromFile );
       
   563 	    VCXLOGLO2( "CIptvTestEcgFileObserver:: file read %d", error );
       
   564 	    file.Close();
       
   565 	    
       
   566 	
       
   567 	    HBufC* monni = HBufC::NewL( textFromFile.Length() );
       
   568 	    monni->Des().Copy(textFromFile);
       
   569 	
       
   570 	    VCXLOGLO2("CIptvTestEcgFileObserver::SyncTimeWithServerL -- String read: %S", monni );	
       
   571 	
       
   572 	    TTime newTime( *monni );
       
   573 	    delete monni;
       
   574 	
       
   575 	    TInt err = CVCXTestCommon::SetSystemTime( newTime );
       
   576 	
       
   577 	    VCXLOGLO2( "CIptvTestEcgFileObserver:: returning: %d", error );
       
   578 	    }
       
   579 	
       
   580 	VCXLOGLO1( "<<<CIptvTestEcgFileObserver::SyncTimeWithServerL" );
       
   581 	return error;
       
   582 	}
       
   583 
       
   584 
       
   585 // -----------------------------------------------------------------------------
       
   586 // CIptvTestEcgFileObserver::DownloadFinished
       
   587 // -----------------------------------------------------------------------------
       
   588 //
       
   589 void CIptvTestEcgFileObserver::DownloadFinished(TInt aError)
       
   590 	{
       
   591 	VCXLOGLO2("CIptvTestEcgFileObserver:: Download finished: %d", aError);
       
   592 	Signal(aError);
       
   593 	}
       
   594 
       
   595 //  [End of File] - Do not remove