sysperfana/memspyext/com.nokia.s60tools.memspy/src/com/nokia/s60tools/memspy/model/TraceCoreEngine.java
changeset 7 8e12a575a9b5
equal deleted inserted replaced
6:f65f740e69f9 7:8e12a575a9b5
       
     1 /*
       
     2 * Copyright (c) 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 
       
    19 
       
    20 package com.nokia.s60tools.memspy.model;
       
    21 
       
    22 import java.awt.event.ActionEvent;
       
    23 import java.awt.event.ActionListener;
       
    24 import java.util.ArrayList;
       
    25 import java.util.Date;
       
    26 
       
    27 import javax.swing.Timer;
       
    28 
       
    29 import com.nokia.s60tools.memspy.common.ProductInfoRegistry;
       
    30 import com.nokia.s60tools.memspy.containers.SWMTLogInfo;
       
    31 import com.nokia.s60tools.memspy.containers.ThreadInfo;
       
    32 import com.nokia.s60tools.memspy.containers.SWMTLogInfo.SWMTLogType;
       
    33 import com.nokia.s60tools.memspy.export.ITraceClientNotificationsIf;
       
    34 import com.nokia.s60tools.memspy.interfaces.IMemSpyTraceListener;
       
    35 import com.nokia.s60tools.memspy.interfaces.IMemSpyTraceListener.LauncherAction;
       
    36 import com.nokia.s60tools.memspy.interfaces.IMemSpyTraceListener.LauncherErrorType;
       
    37 import com.nokia.s60tools.memspy.plugin.MemSpyPlugin;
       
    38 import com.nokia.s60tools.memspy.preferences.MemSpyPreferences;
       
    39 import com.nokia.s60tools.memspy.ui.wizards.DeviceOrFileSelectionPage;
       
    40 import com.nokia.s60tools.memspy.util.MemSpyConsole;
       
    41 import com.nokia.s60tools.util.console.IConsolePrintUtility;
       
    42 import com.nokia.s60tools.util.debug.DbgUtility;
       
    43 
       
    44 
       
    45 /**
       
    46  * <code>TraceCoreEngine</code> class offers public services for starting operations for 
       
    47  * getting heap dump and SWMT log data. It creates and manages list of sub tasks 
       
    48  * are requested sequentially until main operation chain is over (either successfully 
       
    49  * or with error).
       
    50  * 
       
    51  *  This class is tightly coupled with <code>TraceCoreDataHandler</code> class
       
    52  *  that parses trace data and passes flow control back to <code>TraceCoreEngine</code>
       
    53  *  between individual sub tasks.  
       
    54  *  
       
    55  *  @see com.nokia.s60tools.memspy.model.TraceCoreDataHandler.java
       
    56  */
       
    57 public class TraceCoreEngine implements ActionListener, ITraceClientNotificationsIf {
       
    58 
       
    59 	/**
       
    60 	 * Enumerator for upper level operation progress status. Ordinal order of the operations should not be changed.
       
    61 	 * Once operation status is advanced to <code>EProgressMemSpyOperationDone</code>
       
    62 	 * the progress status is not initialized until wizard re-start, connection setting are changed, or an error occurs. 
       
    63 	 * 
       
    64 	 * The enumerator is used in order being able to give user best possible guidance on time-out error when we know
       
    65 	 * the context in which the error has occurred. 
       
    66 	 */
       
    67 	public enum ProgressStatus{
       
    68 		EPROGRESS_INITIAL, 				// Initial status with no progress so far during current session
       
    69 		EPROGRESS_MEMSPY_LAUNCHED,		// MemSpy has been launched successfully
       
    70 		EPROGRESS_FIRST_TASK_LAUNCHED,	// First actual task for MemSpy is triggered (i.e. non-MemSpy launch task)
       
    71 		EPROGRESS_FIRST_TASK_DONE		// First actual task for MemSpy completed successfully (i.e. non-MemSpy launch task)
       
    72 	}
       
    73 
       
    74 	// GroupIDs that are used
       
    75 	public final static String MEMSPY_LAUNCH 				= "10";
       
    76 	public final static String MEMSPY_THREAD_LIST 			= "11";
       
    77 	public final static String MEMSPY_THREAD_INFO 			= "12";
       
    78 	public final static String MEMSPY_GET_HEAP_DUMP			= "13";
       
    79 	public final static String MEMSPY_SWMT_UPDATE			= "14";		
       
    80 	public final static String MEMSPY_SWMT_RESET			= "16";
       
    81 	public final static String MEMSPY_STOP					= "17";
       
    82 	public final static String MEMSPY_SET_CATEGORIES_LOW	= "19";
       
    83 	public final static String MEMSPY_SET_CATEGORIES_HIGH	= "20";	
       
    84 	public final static String MEMSPY_SET_SWMT_HEAP_DUMP	= "21";
       
    85 	public final static String MEMSPY_SET_HEAP_NAME_FILTER  = "SUBSCRIBE_COMM_EVENT_SET_HEAP_NAME_FILTER"; 
       
    86 	
       
    87 	// Time that device waits for line.
       
    88 	private final int SECOND = 1000;
       
    89 	private final int DEFAULT_WAIT_TIME =  20 * SECOND; // seconds
       
    90 	private final int MAX_WAIT_TIME =  60 * SECOND; // seconds
       
    91 	private int currentWaitTime;
       
    92 	
       
    93 	/**
       
    94 	 * Indicate that MemSpy Launcher data version is not received.
       
    95 	 */
       
    96 	private static final int MEMSPY_LAUNCHER_VERSION_NOT_DEFINED = -1;	
       
    97 	
       
    98 	/* timer that is used in error correction */
       
    99 	private Timer errorTimer;
       
   100 
       
   101 	/* boolean value that is true when MemSpy is running */
       
   102 	private boolean MemSpyRunning;
       
   103 	
       
   104 	/* Cycle number of swmt logs that is received next time */
       
   105 	private int cycleNumber;
       
   106 	
       
   107 	/* interval between swmt logs */
       
   108 	private int interval;
       
   109 	
       
   110 	/* timer that is used when receiving SWMT-logs via timer */
       
   111 	private Timer intervalTimer;
       
   112 	
       
   113 	/* info of swmt-log that is currently received */
       
   114 	private SWMTLogInfo swmtLogInfo;
       
   115 		
       
   116 	// Trace data handler
       
   117 	private TraceCoreDataHandler handler;
       
   118 	
       
   119 	// Id of threads that is currently received
       
   120 	int threadID;
       
   121 	
       
   122 	// Task list
       
   123 	private ArrayList<String> taskList;
       
   124 	
       
   125 	// WizardPage, that is notified when operations are done. 
       
   126 	private IMemSpyTraceListener wizardPage;
       
   127 	
       
   128 	// Name of the file where heap dumps and SWMT-logs are written.
       
   129 	private String currentFile;
       
   130 
       
   131 	/**
       
   132 	 * If S60 MemSpy is to be closed between cycles
       
   133 	 */
       
   134 	private boolean resetBetweenCycles = false;
       
   135 
       
   136 	/**
       
   137 	 * Stores MemSpy launcher communication version.
       
   138 	 */
       
   139 	private int receivedMemSpyLauncherDataVersion = MEMSPY_LAUNCHER_VERSION_NOT_DEFINED;
       
   140 
       
   141 	/**
       
   142 	 * Upper level operation progress status. Ordinal order of the operations should not be changed.
       
   143 	 * Once operation status is advanced to <code>EProgressMemSpyOperationDone</code>
       
   144 	 * the progress status is not initialized until wizard re-start, connection setting are changed, or an error occurs. 
       
   145 	 */
       
   146 	private ProgressStatus progressStatus = ProgressStatus.EPROGRESS_INITIAL;
       
   147 
       
   148 	/**
       
   149 	 * Provides possibly additional error information about the occurred error.
       
   150 	 */
       
   151 	private String additionalErrorInformation;
       
   152 	
       
   153 	/**
       
   154 	 * Constructor.
       
   155 	 */
       
   156 	public TraceCoreEngine(){
       
   157 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine() Construct START"); //$NON-NLS-1$
       
   158 		this.MemSpyRunning = false;
       
   159 		this.handler = new TraceCoreDataHandler(this);
       
   160 		this.taskList = new ArrayList<String>();
       
   161 		this.errorTimer = null;
       
   162 		this.cycleNumber = 1;
       
   163 		this.interval = 0;
       
   164 		this.swmtLogInfo = null;
       
   165 		this.currentWaitTime = DEFAULT_WAIT_TIME;
       
   166 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine() Construct END"); //$NON-NLS-1$
       
   167 	}
       
   168 
       
   169 	/**
       
   170 	 * Request thread list from MemSpyLauncher.
       
   171 	 * @param threadArray array where thread names and id's are written
       
   172 	 * @param wizard page which is notified when request is finished
       
   173 	 * @return true, if connection to TraceCore established successfully, else false
       
   174 	 */
       
   175 	
       
   176 	public boolean requestThreadList( ArrayList<ThreadInfo> threadArray, DeviceOrFileSelectionPage wizard ){
       
   177 		this.wizardPage 		= wizard;
       
   178 		
       
   179 		// Set handler values correct
       
   180 		handler.setLastWasName( false );
       
   181 		handler.setThreadArray( threadArray );
       
   182 	
       
   183 		// if connection established successfully, return true 
       
   184 		if( this.connect() ){
       
   185 			
       
   186 			// Set handler values correct
       
   187 			handler.setLastWasName( false );
       
   188 			handler.setThreadArray( threadArray );
       
   189 			
       
   190 			if( !this.MemSpyRunning ){
       
   191 				taskList.add( MEMSPY_LAUNCH );
       
   192 			}
       
   193 			taskList.add( MEMSPY_THREAD_LIST );
       
   194 			return this.runNextTask();
       
   195 		}
       
   196 		else{
       
   197 			return false;
       
   198 		}
       
   199 		
       
   200 		
       
   201 	}
       
   202 	
       
   203 	/**
       
   204 	 * Request Heap Dump from device and write it into text file
       
   205 	 * @param threadID ID of thread which is requested from device
       
   206  	 * @param wizardPage page which is notified when request is finished
       
   207 	 * @param currentFile path of the file where Heap Dump is written
       
   208 	 * @return true, if connection to TraceCore established successfully, else false 
       
   209 	 */
       
   210 	public boolean requestHeapDump( int threadID, IMemSpyTraceListener wizardPage, String currentFile ){
       
   211 
       
   212 		this.currentFile 		= currentFile;
       
   213 		this.wizardPage 		= wizardPage;
       
   214 		this.threadID 			= threadID;
       
   215 		
       
   216 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.requestHeapDump/threadID=" + threadID); //$NON-NLS-1$					
       
   217 
       
   218 		if( this.connect() ){
       
   219 			
       
   220 			// Reset heap type value
       
   221 			handler.setHeapTypeCorrect( false );
       
   222 			
       
   223 			// Send id to trace,
       
   224 			if( !this.sendIntegerDataToLauncher(threadID) ){
       
   225 				launcherError(LauncherErrorType.ACTIVATION);
       
   226 				return false;
       
   227 			}
       
   228 			else{
       
   229 				DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.requestHeapDump/activateId => OK"); //$NON-NLS-1$					
       
   230 			}
       
   231 			
       
   232 			if( !this.MemSpyRunning ){
       
   233 				taskList.add( MEMSPY_LAUNCH );
       
   234 			}
       
   235 			
       
   236 			// Add tasks into task list
       
   237 			taskList.add( MEMSPY_THREAD_INFO );
       
   238 			taskList.add( MEMSPY_GET_HEAP_DUMP );
       
   239 			
       
   240 			// start running tasks
       
   241 			return this.runNextTask();
       
   242 		}
       
   243 		else{
       
   244 			return false;
       
   245 		}
       
   246 	}
       
   247 	
       
   248 	/**
       
   249 	 * Request Heap Dump from device and write it into text file
       
   250 	 * @param threadID ID of thread which is requested from device
       
   251 	 * @param wizardPage page which is notified when request is finished
       
   252 	 * @param currentFile path of the file where Heap Dump is written
       
   253 	 * @return true, if connection to TraceCore established successfully, else false 
       
   254 	 */
       
   255 	public boolean requestHeapDump( String threadID, IMemSpyTraceListener wizardPage, String currentFile ){
       
   256 	
       
   257 		return requestHeapDump( Integer.parseInt(threadID), wizardPage, currentFile );
       
   258 
       
   259 	}
       
   260 		
       
   261 	/**
       
   262 	 * Request SWMT-log from device and write it into file
       
   263 	 * @param wizardPage page which is notified when request is finished
       
   264 	 * @param currentFile path of the file where Heap Dump is written
       
   265 	 * @param resetCycles should cycles be reseted
       
   266 	 * @return true, if connection to TraceCore established successfully, else false 
       
   267 	 */
       
   268 	public boolean requestSWMTLog( IMemSpyTraceListener wizardPage, String currentFile, boolean resetCycles){
       
   269 		this.currentFile 		= currentFile;
       
   270 		this.wizardPage 		= wizardPage;
       
   271 		
       
   272 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.requestSWMTLog(resetCycles=" + resetCycles + ")/currentFile: " + currentFile); //$NON-NLS-1$ //$NON-NLS-2$
       
   273 		
       
   274 		// if connection established successfully, return true 
       
   275 		if( this.connect() ){
       
   276 		
       
   277 			// stop and start MemSpy so that logging is reseted.
       
   278 			if( resetCycles == true ){
       
   279 				taskList.add( MEMSPY_STOP );
       
   280 				taskList.add( MEMSPY_LAUNCH );
       
   281 			}
       
   282 			
       
   283 			// If MemSpy is not running launch it
       
   284 			if( !this.MemSpyRunning ){
       
   285 				taskList.add( MEMSPY_LAUNCH );
       
   286 			}
       
   287 
       
   288 			//Adding category settings requests, if the feature is supported
       
   289 			if(MemSpyPlugin.getDefault().isSWMTCategorySettingFeatureEnabled()){
       
   290 				taskList.add( MEMSPY_SET_CATEGORIES_LOW ); //LOW bytes has to be written always before high bytes
       
   291 				taskList.add( MEMSPY_SET_CATEGORIES_HIGH ); //HIGH bytes has to be written always after low bytes				
       
   292 			}
       
   293 			
       
   294 			
       
   295 			// Set the name filter for User Heap SWMT category
       
   296 			if(MemSpyPreferences.isSWMTHeapDumpSelected() && !MemSpyPreferences.isProfileTrackedCategoriesSelected()) {
       
   297 				taskList.add( MEMSPY_SET_SWMT_HEAP_DUMP );
       
   298 				taskList.add( MEMSPY_SET_HEAP_NAME_FILTER );
       
   299 			}
       
   300 			
       
   301 			taskList.add( MEMSPY_SWMT_UPDATE );
       
   302 
       
   303 			// start running tasks
       
   304 			return this.runNextTask();
       
   305 		}
       
   306 		else{
       
   307 			return false;
       
   308 		}
       
   309 	}
       
   310 	
       
   311 	/**
       
   312 	 * Starts timer based SWMT logging.
       
   313 	 * @param wizardPage page which is notified when request is finished
       
   314 	 * @param currentFile path of the file where Heap Dump is written
       
   315 	 * @param resetInStart should cycles be reseted
       
   316 	 * @param resetBetweenCycles if MemSpy S60 application is to be reseted between every cycle
       
   317 	 * @param interval poll interval
       
   318 	 * @return true, if connection to TraceCore established successfully, else false 
       
   319 	 */
       
   320 	public boolean startSWMTTimer( IMemSpyTraceListener wizardPage, int cycleNumber, 
       
   321 								   boolean resetInStart, boolean resetBetweenCycles,  int interval ){
       
   322 		this.wizardPage 		= wizardPage;
       
   323 		this.resetBetweenCycles = resetBetweenCycles;
       
   324 	
       
   325 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.startSWMTTimer"); //$NON-NLS-1$
       
   326 		
       
   327 		// if connection established successfully, return true 
       
   328 		if( this.connect() ){
       
   329 			this.cycleNumber 		= cycleNumber - 1;
       
   330 			this.interval			= interval;
       
   331 			
       
   332 			
       
   333 			if( resetInStart == true ){
       
   334 				taskList.add( MEMSPY_STOP );
       
   335 				taskList.add( MEMSPY_LAUNCH );
       
   336 
       
   337 			}
       
   338 			
       
   339 			this.runNextTimedTask();
       
   340 			
       
   341 			return true;
       
   342 		}
       
   343 		else{
       
   344 			return false;
       
   345 		}
       
   346 		
       
   347 		
       
   348 	}
       
   349 	
       
   350 	
       
   351 	/**
       
   352 	 * Stops SWMT timer 
       
   353 	 * @return true if timer was stopped immediately, false if MemSpy operation was on-going and timer is stopped after after operations are done.
       
   354 	 */
       
   355 	public boolean stopSWMTTimer(){
       
   356 		
       
   357 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.stopSWMTTimer"); //$NON-NLS-1$
       
   358 				
       
   359 		// other variables to zero.
       
   360 		this.interval = 0;
       
   361 		this.cycleNumber = 1;
       
   362 
       
   363 		// if timer is, running stop it
       
   364 		if( intervalTimer != null && intervalTimer.isRunning() ){
       
   365 			intervalTimer.stop();
       
   366 			this.swmtLogInfo = null;
       
   367 			return true;
       
   368 		}
       
   369 		else{
       
   370 			return false;
       
   371 		}
       
   372 	}
       
   373 	
       
   374 	/**
       
   375 	 * addNextTimedTask.
       
   376 	 * Adds next timed tasks into taskList if needed
       
   377 	 */
       
   378 	private void runNextTimedTask(){
       
   379 		
       
   380 		cycleNumber++;
       
   381 		
       
   382 		// get new SWMT-object and set filename correct
       
   383 		swmtLogInfo = this.getNewSWMTInfo();
       
   384 		this.currentFile = swmtLogInfo.getPath();
       
   385 		
       
   386 		// If MemSpy is not running launch it
       
   387 		if( !this.MemSpyRunning ){
       
   388 			taskList.add( MEMSPY_LAUNCH );
       
   389 		}
       
   390 		//If memSpy is running and we want to reset it between cycles
       
   391 		else if(this.MemSpyRunning && resetBetweenCycles == true ){
       
   392 			taskList.add( MEMSPY_STOP );
       
   393 			taskList.add( MEMSPY_LAUNCH );
       
   394 
       
   395 		}
       
   396 				
       
   397 		//Adding category settings requests, if the feature is supported
       
   398 		if(MemSpyPlugin.getDefault().isSWMTCategorySettingFeatureEnabled()){
       
   399 			taskList.add( MEMSPY_SET_CATEGORIES_LOW ); //LOW bytes has to be written always before high bytes
       
   400 			taskList.add( MEMSPY_SET_CATEGORIES_HIGH ); //HIGH bytes has to be written always after low bytes			
       
   401 		}
       
   402 
       
   403 		// Set the name filter for User Heap SWMT category
       
   404 		if(MemSpyPreferences.isSWMTHeapDumpSelected() && !MemSpyPreferences.isProfileTrackedCategoriesSelected()) {
       
   405 			taskList.add( MEMSPY_SET_SWMT_HEAP_DUMP );			
       
   406 			taskList.add( MEMSPY_SET_HEAP_NAME_FILTER );
       
   407 		}
       
   408 
       
   409 		
       
   410 		// Requesting SWMT update
       
   411 		taskList.add( MEMSPY_SWMT_UPDATE );
       
   412 		
       
   413 		// start runnings tasks
       
   414 		this.runNextTask();
       
   415 	}
       
   416 	
       
   417 	/**
       
   418 	 * Function that handles calls when MemSpys operation is finished successfully
       
   419 	 * This method is called from DataHandler every time tag <MEMSPY_LAUNCHER_READY>-tag received.
       
   420 	 */
       
   421 	public void memSpyReady(){
       
   422 
       
   423 		
       
   424 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.memSpyReady"); //$NON-NLS-1$
       
   425 		
       
   426 		//Check Launcher data version
       
   427 		checkMemSpyLauncherDataVersion();
       
   428 		//MemSpy launcher data version is received always before <MEMSPY_LAUNCHER_READY> -tag is received
       
   429 		//When version number is checked, returning -1 to received value
       
   430 		receivedMemSpyLauncherDataVersion = MEMSPY_LAUNCHER_VERSION_NOT_DEFINED;
       
   431 		
       
   432 		// Stop logging trace data
       
   433 		handler.stopLogging();
       
   434 		// Stop listening trace data
       
   435 		MemSpyPlugin.getTraceProvider().stopListenTraceData();
       
   436 		// Stop timer
       
   437 		errorTimer.stop();
       
   438 		
       
   439 		// Checking an updating progress status based on the completed task type
       
   440 		checkTaskForCurrentProgressStatus(this.taskList.get(0));
       
   441 		
       
   442 		if( this.taskList.get(0) == MEMSPY_LAUNCH ){			
       
   443 			//Setting timer value to MAX here when known that MemSpy Launcher in S60 target is OK 
       
   444 			//(last successfully run command is MemSpy launch).
       
   445 			this.currentWaitTime = MAX_WAIT_TIME;
       
   446 
       
   447 			// MemSpy started successfully, update status
       
   448 			this.MemSpyRunning = true;
       
   449 			
       
   450 			DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.memSpyReady/MEMSPY_LAUNCH/MemSpyRunning=true"); //$NON-NLS-1$
       
   451 			if( this.taskList.size() >= 2 && this.taskList.get(1) == MEMSPY_THREAD_INFO ){
       
   452 				DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.memSpyReady/MEMSPY_LAUNCH/activateId( threadID: "+ threadID); //$NON-NLS-1$
       
   453 				if( !this.sendIntegerDataToLauncher(threadID) ){
       
   454 					launcherError(LauncherErrorType.ACTIVATION);
       
   455 				}
       
   456 				else{
       
   457 					DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "T raceCoreEngine.memSpyReady/MEMSPY_LAUNCH/activateId => OK"); //$NON-NLS-1$					
       
   458 				}
       
   459 			}
       
   460 		}
       
   461 		else if( this.taskList.get(0) == MEMSPY_THREAD_LIST ){
       
   462 			DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.memSpyReady/MEMSPY_THREAD_LIST"); //$NON-NLS-1$
       
   463 			this.wizardPage.operationFinished( LauncherAction.GET_THREAD_LIST );
       
   464 		}
       
   465 		else if( this.taskList.get(0) == MEMSPY_THREAD_INFO ){
       
   466 			// Heap info received
       
   467 			DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.memSpyReady/MEMSPY_THREAD_INFO"); //$NON-NLS-1$
       
   468 			
       
   469 			// If heap type is not correct, reset tasklist and return error
       
   470 			if( !handler.isHeapTypeCorrect() ){
       
   471 				this.taskList.clear();
       
   472 				this.wizardPage.deviceError( LauncherErrorType.HEAP_TYPE_WRONG );
       
   473 			}
       
   474 			
       
   475 			// ignore dumped traces-messages.
       
   476 			if( handler.isDumpedTraces() ){
       
   477 				handler.setDumpedTraces( false );
       
   478 			}			
       
   479 		}
       
   480 		else if( this.taskList.get(0) == MEMSPY_GET_HEAP_DUMP ){
       
   481 			// Heap Dump received
       
   482 			DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.memSpyReady/MEMSPY_GET_HEAP_DUMP"); //$NON-NLS-1$
       
   483 
       
   484 			if( handler.isDumpedTraces() == false ){
       
   485 				// Tell wizard that request is finished
       
   486 				this.wizardPage.operationFinished( LauncherAction.GET_HEAP_DUMP );
       
   487 			}
       
   488 			else{
       
   489 				handler.setDumpedTraces( false );
       
   490 				this.launcherError(LauncherErrorType.HEAP_NOT_FOUND);
       
   491 			}
       
   492 		}		
       
   493 		else if( this.taskList.get(0) == MEMSPY_SWMT_UPDATE || this.taskList.get(0) == MEMSPY_SWMT_RESET ){
       
   494 			// if SWMT log received
       
   495 			DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.memSpyReady/MEMSPY_SWMT_UPDATE || MEMSPY_SWMT_RESET"); //$NON-NLS-1$
       
   496 			
       
   497 			if( handler.isDumpedTraces() == false ){
       
   498 				// Tell wizard that request is finished
       
   499 				
       
   500 				// if timed swmt-logging is on request notification after interval
       
   501 				if( swmtLogInfo != null ){
       
   502 					
       
   503 					boolean timerRunning = false;
       
   504 					
       
   505 					// if interval is more that zero, start counter and set timerRunning variable correct.
       
   506 					if( interval > 0 ){
       
   507 						intervalTimer = new Timer( interval * SECOND, this );
       
   508 						intervalTimer.start();
       
   509 						timerRunning = true;
       
   510 					}
       
   511 					
       
   512 					// tell wizard that one log file has been received.
       
   513 					this.wizardPage.operationFinished( LauncherAction.TIMED_SWMT_UPDATE, swmtLogInfo, timerRunning);
       
   514 					swmtLogInfo = null;
       
   515 
       
   516 				}
       
   517 				else{
       
   518 					this.wizardPage.operationFinished( LauncherAction.SWMT_UPDATE );
       
   519 				}
       
   520 			}
       
   521 			else{
       
   522 				//Reset SWMT timer values.
       
   523 				this.stopSWMTTimer();
       
   524 				
       
   525 				handler.setDumpedTraces( false );
       
   526 				this.launcherError(LauncherErrorType.HEAP_NOT_FOUND);
       
   527 			}
       
   528 		}						
       
   529 		else if( this.taskList.get(0) == MEMSPY_STOP ){
       
   530 			MemSpyRunning = false;
       
   531 			DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.memSpyReady/MEMSPY_STOP"); //$NON-NLS-1$
       
   532 		}
       
   533 
       
   534 		// Remove first task from list.
       
   535 		if(taskList.size() > 0){
       
   536 			this.taskList.remove(0);
       
   537 			// Updating progress status to next task launched status 
       
   538 			// (only updated in case this is progress to previous situation).
       
   539 			setProgressStatus(ProgressStatus.EPROGRESS_FIRST_TASK_LAUNCHED);			
       
   540 		}
       
   541 		// run next task
       
   542 		this.runNextTask();
       
   543 	
       
   544 			
       
   545 	}
       
   546 
       
   547 	/**
       
   548 	 * Updates progress status based on given task id. 
       
   549 	 * Used setter method takes care that update is done only 
       
   550 	 * if there has been progress compared to previous situation.
       
   551 	 * @param taskId task event for the task that was just completed
       
   552 	 */
       
   553 	private void checkTaskForCurrentProgressStatus(String taskId) {
       
   554 		if( taskId == MEMSPY_LAUNCH ){			
       
   555 			setProgressStatus(ProgressStatus.EPROGRESS_MEMSPY_LAUNCHED);
       
   556 		}
       
   557 		else{
       
   558 			// In case of other than launch task first task has been executed properly
       
   559 			setProgressStatus(ProgressStatus.EPROGRESS_FIRST_TASK_DONE);			
       
   560 		}		
       
   561 	}
       
   562 
       
   563 	/**
       
   564 	 * Handles calls when launcher prints error message into trace.
       
   565 	 * @param error error code
       
   566 	 * @param clientContextErrorString provides optionally additional information about the error occurred
       
   567 	 */
       
   568 	public void launcherError( LauncherErrorType error, String clientContextErrorString ){
       
   569 		
       
   570 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.launcherError/error: " + error); //$NON-NLS-1$
       
   571 
       
   572 		additionalErrorInformation = clientContextErrorString;;
       
   573 		
       
   574 		handler.stopLogging();
       
   575 		// Stop listening trace data
       
   576 		MemSpyPlugin.getTraceProvider().stopListenTraceData();
       
   577 
       
   578 		// Stop timer
       
   579 		if( errorTimer != null ){
       
   580 			errorTimer.stop();
       
   581 			//Setting timer value to default when error occurred 
       
   582 			this.currentWaitTime = DEFAULT_WAIT_TIME;
       
   583 		}
       
   584 
       
   585 		// if wizard has been shut down, don't send error message.
       
   586 		if( taskList.size() == 1 && taskList.get(0) == MEMSPY_STOP ){
       
   587 			return;
       
   588 		}
       
   589 		this.taskList.clear();
       
   590 		// Stop logging trace data
       
   591 		
       
   592 		//
       
   593 		//When there are special handling about error, founding error codes and then call the wizard.
       
   594 		//But in default case, we just pass the error code to wizard to show the error.
       
   595 		//
       
   596 		
       
   597 		// MemSpy not running.
       
   598 		if( error == LauncherErrorType.MEMSPY_NOT_RUNNING ){
       
   599 			wizardPage.deviceError( LauncherErrorType.MEMSPY_NOT_RUNNING );
       
   600 			this.MemSpyRunning = false;
       
   601 		}
       
   602 		else if( error == LauncherErrorType.NO_ANSWER_FROM_DEVICE ){ 
       
   603 			// No answer from device can happen because
       
   604 			if( handler.isDumpedTraces() ){
       
   605 				// Input data is corrupted and traces are dumped...
       
   606 				handler.setDumpedTraces( false );
       
   607 				wizardPage.deviceError( LauncherErrorType.DUMPED_TRACES );
       
   608 			}
       
   609 			else{
       
   610 				//..or connection is broken and we really has'nt got any response from device
       
   611 				wizardPage.deviceError( LauncherErrorType.NO_ANSWER_FROM_DEVICE );
       
   612 			}
       
   613 		}		
       
   614 		else {
       
   615 			wizardPage.deviceError( error);
       
   616 		}		
       
   617 
       
   618 	}
       
   619 	
       
   620 	
       
   621 	/**
       
   622 	 * Function that is called when response from launcher is not received within reasonable time.
       
   623 	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
       
   624 	 */
       
   625 	public void actionPerformed(ActionEvent e) {
       
   626 	
       
   627 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.actionPerformed/e.getSource(): " + e.getSource().toString()); //$NON-NLS-1$
       
   628 		
       
   629 		if( e.getSource() == errorTimer ){
       
   630 			// This function is called if MemSpy operation does not respond in time stored in currentWaitTime member variable.
       
   631 			// I.e. no answer has been received from the device in expected maximum time.
       
   632 			this.launcherError(LauncherErrorType.NO_ANSWER_FROM_DEVICE);
       
   633 		}
       
   634 		else if( e.getSource() == intervalTimer ){			
       
   635 			this.runNextTimedTask();
       
   636 			// Notify wizard that SWMT receiving is started
       
   637 			wizardPage.startedReceivingSWMTLog();
       
   638 			intervalTimer.stop();
       
   639 		}		
       
   640 
       
   641 	}
       
   642 	
       
   643 	
       
   644 	/**
       
   645 	 * Shuts down MemSpy application. If some MemSpy operation is on-going schedule shutdown after that.
       
   646 	 */
       
   647 	public void shutDownMemSpy(){
       
   648 	
       
   649 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.shutDownMemSpy"); //$NON-NLS-1$
       
   650 		
       
   651 		// if MemSpy is running, send stop request
       
   652 		if( this.MemSpyRunning ) {
       
   653 			this.taskList.add( MEMSPY_STOP );
       
   654 		}
       
   655 		
       
   656 		// If timer is not running( MemSpy is not currently operating ), run next task
       
   657 		if( errorTimer != null && !errorTimer.isRunning() ){
       
   658 			this.runNextTask();
       
   659 		}
       
   660 		disconnectTrace();
       
   661 	}
       
   662 	
       
   663 	/**
       
   664 	 * Check if MemSpy is running
       
   665 	 * @return <code>true</code> if MemSpy is Running <code>false</code> otherwise.
       
   666 	 */
       
   667 	public boolean isMemSpyRunning() {
       
   668 		return MemSpyRunning;
       
   669 	}
       
   670 		
       
   671 	/**
       
   672 	 * Establishes connection between plugin and device.
       
   673 	 * @return true, is connection established successfully
       
   674 	 */
       
   675 	private boolean connect(){	
       
   676 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.connect"); //$NON-NLS-1$
       
   677 		return MemSpyPlugin.getTraceProvider().connectTraceSource(this);	
       
   678 	}
       
   679 	
       
   680 	/**
       
   681 	 * Disconnects connection between plugin and device if connection was started
       
   682 	 * for this MemSpy run. Leaving connection up, if TraceViewer was already connected.
       
   683 	 */
       
   684 	public void disconnectTrace() {		
       
   685 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.disconnectTrace"); //$NON-NLS-1$
       
   686 		MemSpyPlugin.getTraceProvider().disconnectTraceSource();	
       
   687 	}
       
   688 	
       
   689 	/**
       
   690 	 * Sends current usage context-specific integer data to launcher.
       
   691 	 * Integer data can contain values that can be expressed with 10 bytes
       
   692 	 * i.e. only 10 lower bytes are taken into account when setting data.
       
   693 	 * @param integerData integer data to be sent
       
   694 	 * @return <code>false</code> if failed to send integer data, otherwise <code>true</code>
       
   695 	 */
       
   696 	private boolean sendIntegerDataToLauncher(int integerData)
       
   697 	{
       
   698 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "sendIntegerDataToLauncher: id=" + integerData); //$NON-NLS-1$
       
   699 		return MemSpyPlugin.getTraceProvider().sendIntData(integerData);
       
   700 	}
       
   701 
       
   702 	/**
       
   703 	 * Sends current usage context-specific string message to launcher.
       
   704 	 * @param stringData string data to send
       
   705 	 * @param writesFile set to <code>true</code> if set trace handler needs to write some data into file
       
   706 	 * @return <code>true</code> on success, otherwise <code>false</code>
       
   707 	 */
       
   708 	private boolean sendStringDataToLauncher(String stringData, boolean writesFile){
       
   709 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.sendMessage/message=" + stringData); //$NON-NLS-1$ 
       
   710 		
       
   711 		if(! addDataProcessorAndSetupLogging(writesFile)){
       
   712 			return false;
       
   713 		}
       
   714 		
       
   715 		if(! MemSpyPlugin.getTraceProvider().sendStringData(stringData)){
       
   716 			return false;
       
   717 		}
       
   718 		
       
   719 		startErrorTimer();
       
   720 		return true;
       
   721 	}
       
   722 	
       
   723 	/**
       
   724 	 * activateTrace
       
   725 	 * Sends activation/deactivation message via TraceCore
       
   726 	 * @param group GroupID
       
   727 	 * @param writesFile true, if set trace handler needs to write some data into file.
       
   728 	 * return false if trace activation was not successful.
       
   729 	 */
       
   730 	private boolean activateTrace( String group, boolean writesFile ){
       
   731 			
       
   732 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.activateTrace/group=" + group + ", writesFile=" + writesFile); //$NON-NLS-1$ //$NON-NLS-2$
       
   733 		
       
   734 		if(! addDataProcessorAndSetupLogging(writesFile)){
       
   735 			return false;
       
   736 		}
       
   737 		
       
   738 		if(! MemSpyPlugin.getTraceProvider().activateTrace(group)){
       
   739 			return false;
       
   740 		}
       
   741 
       
   742 		startErrorTimer();			
       
   743 		return true;
       
   744 		
       
   745 	}
       
   746 
       
   747 	/**
       
   748 	 * Starts error time after request.
       
   749 	 */
       
   750 	private void startErrorTimer() {
       
   751 		// Start Timer
       
   752 		errorTimer = new Timer( currentWaitTime, this );
       
   753 		errorTimer.start();
       
   754 	}
       
   755 
       
   756 	/**
       
   757 	 * Adds dataprocessor and sets-up logging.
       
   758 	 * @param writesFile true, if set trace handler needs to write some data into file.
       
   759 	 * @return <code>true</code> in case of success, and <code>false</code> in case of some failure.
       
   760 	 */
       
   761 	private boolean addDataProcessorAndSetupLogging(boolean writesFile) {
       
   762 				
       
   763 		//Add DataProcessor to TraceViewer
       
   764 		if(! MemSpyPlugin.getTraceProvider().startListenTraceData(handler)){
       
   765 			return false;
       
   766 		}
       
   767 		
       
   768 		// Start logging
       
   769 		if( !handler.startLogging(currentFile, writesFile ) ){
       
   770 			return false;
       
   771 		}
       
   772 		
       
   773 		return true;
       
   774 	}
       
   775 	
       
   776 	/**
       
   777 	 * runNextTask
       
   778 	 * Gets next task from list and sends it to TraceCore.
       
   779 	 * @return false if operation fails.
       
   780 	 */
       
   781 	private boolean runNextTask(){
       
   782 		
       
   783 		try {
       
   784 			if( taskList.size() > 0 ){
       
   785 				String nextTask = taskList.get(0);
       
   786 				DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.runNextTask/taskList.get(0)=" + nextTask); //$NON-NLS-1$
       
   787 								
       
   788 				// Confirming that all necessary preparations for running the next task has been done.
       
   789 				prepareRunNextTask();
       
   790 				
       
   791 				// Set writeFile value as false when task needs to write some data into file
       
   792 				if( nextTask == MEMSPY_GET_HEAP_DUMP || nextTask == MEMSPY_SWMT_UPDATE || nextTask == MEMSPY_SWMT_RESET ){
       
   793 					if( !activateTrace( nextTask, true ) ){
       
   794 						this.launcherError(LauncherErrorType.ACTIVATION);
       
   795 						return false;
       
   796 					}
       
   797 				}
       
   798 				else if(nextTask == MEMSPY_SET_HEAP_NAME_FILTER){
       
   799 					// This task used subscribe communication, instead of group IDs
       
   800 					// Send SWMT heap filter before activating command group
       
   801 					DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.memSpyReady/MEMSPY_SET_HEAP_NAME_FILTER/sendMessage"); //$NON-NLS-1$
       
   802 					if( !this.sendStringDataToLauncher(getHeapNameFilterForSWMT(), false)){
       
   803 						launcherError(LauncherErrorType.ACTIVATION);
       
   804 					}
       
   805 					else{
       
   806 						DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.memSpyReady/MEMSPY_SET_HEAP_NAME_FILTER/sendMessage => OK"); //$NON-NLS-1$					
       
   807 					}
       
   808 				}
       
   809 				else{
       
   810 					if( !activateTrace( nextTask, false) ){
       
   811 						this.launcherError(LauncherErrorType.ACTIVATION);
       
   812 						return false;
       
   813 					};
       
   814 
       
   815 				}
       
   816 			}
       
   817 			else{
       
   818 				DbgUtility.println(DbgUtility.PRIORITY_LOOP, "TraceCoreEngine.runNextTask/empty taskList"); //$NON-NLS-1$								
       
   819 				//Setting timer value to default when there are no tasks to run
       
   820 				this.currentWaitTime = DEFAULT_WAIT_TIME;
       
   821 			}
       
   822 			return true;
       
   823 			
       
   824 		} catch (Exception e) {
       
   825 			String errMsg = "Unexpected exception in encountered in TraceCoreEngine.runNextTask: " + e;
       
   826 			MemSpyConsole.getInstance().println(errMsg , IConsolePrintUtility.MSG_ERROR);
       
   827 			return false;
       
   828 		}
       
   829 				
       
   830 	}
       
   831 	
       
   832 	
       
   833 	/**
       
   834 	 * Confirms that all necessary preparations for running the next task has been done.
       
   835 	 */
       
   836 	private void prepareRunNextTask() {		
       
   837 		if(this.taskList.get(0) == MEMSPY_SET_CATEGORIES_LOW ){
       
   838 			// Setting SWMT low bits data before activating command group
       
   839 			DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.prepareRunNextTask/activateId( getCategoriesForSWMTLowBits(): "+ getCategoriesForSWMTLowBits()); //$NON-NLS-1$
       
   840 			if( !this.sendIntegerDataToLauncher( getCategoriesForSWMTLowBits()) ){
       
   841 				launcherError(LauncherErrorType.ACTIVATION );
       
   842 			}
       
   843 			else{
       
   844 				DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.prepareRunNextTask/MEMSPY_SET_CATEGORIES_HIGH/activateId => OK"); //$NON-NLS-1$					
       
   845 			}
       
   846 		}
       
   847 		else if( this.taskList.get(0) == MEMSPY_SET_CATEGORIES_HIGH ){
       
   848 			// Setting SWMT high bits data before activating command group
       
   849 			DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.prepareRunNextTask/MEMSPY_SET_CATEGORIES_HIGH/activateId( getCategoriesForSWMTHighBits(): "+ getCategoriesForSWMTHighBits()); //$NON-NLS-1$
       
   850 			if( !this.sendIntegerDataToLauncher( getCategoriesForSWMTHighBits()) ){
       
   851 				launcherError(LauncherErrorType.ACTIVATION );
       
   852 			}
       
   853 			else{
       
   854 				DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.prepareRunNextTask/MEMSPY_SET_CATEGORIES_HIGH/activateId => OK"); //$NON-NLS-1$					
       
   855 			}
       
   856 		}
       
   857 	}
       
   858 
       
   859 	/**
       
   860 	 * getNewSWMTInfo.
       
   861 	 * Creates a new SWMTLogInfo object and sets correct filename and time into it.
       
   862 	 * @return SWMTLogInfo-object
       
   863 	 */
       
   864 	private SWMTLogInfo getNewSWMTInfo(){
       
   865 		
       
   866 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "TraceCoreEngine.getNewSWMTInfo"); //$NON-NLS-1$
       
   867 		
       
   868 		// Create new SWMTLogInfo item.
       
   869 		SWMTLogInfo newItem = new SWMTLogInfo();
       
   870 		
       
   871 		// set date correct
       
   872 		Date date = new Date();		
       
   873 		newItem.setDate(date);
       
   874 
       
   875 	
       
   876 		// set filename correct
       
   877 		newItem.setPath( MemSpyFileOperations.getTempFileNameForSWMTLog(cycleNumber, date) );
       
   878 		
       
   879 		// set type
       
   880 		newItem.setType( SWMTLogType.DEVICE );
       
   881 		
       
   882 		return newItem;
       
   883 	}
       
   884 	
       
   885 	/**
       
   886 	 * Get first task.
       
   887 	 * @return first task from taskList.
       
   888 	 */
       
   889 	public String getFirstTask(){
       
   890 		if( taskList.size() > 0 ){
       
   891 			return taskList.get(0);
       
   892 		}
       
   893 		else{
       
   894 			return null;
       
   895 		}
       
   896 	}	
       
   897 
       
   898 	/**
       
   899 	 * Gets lower 10 bits for SWMT categories that user wants to include into SWMT log.
       
   900 	 * @return  lower 10 bits for SWMT categories that user wants to include into SWMT log.
       
   901 	 */
       
   902 	public int getCategoriesForSWMTLowBits() {
       
   903 		int lowBits = getCategoriesForSWMTWithKernelHandles() & 0x3ff; // ANDs away all the other that lower 10 bits
       
   904 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "getCategoriesForSWMTLowBits(): " + String.format("0x%x", lowBits)); //$NON-NLS-1$
       
   905 		return lowBits; 
       
   906 	}
       
   907 
       
   908 	/**
       
   909 	 * Gets higher bits for SWMT categories that user wants to include into SWMT log.
       
   910 	 * @return  higher bits for SWMT categories that user wants to include into SWMT log.
       
   911 	 */
       
   912 	public int getCategoriesForSWMTHighBits() {
       
   913 		int highBits = getCategoriesForSWMTWithKernelHandles()>>10;
       
   914 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "getCategoriesForSWMTHighBits(): " + String.format("0x%x", highBits)); //$NON-NLS-1$
       
   915 		return highBits;
       
   916 	}
       
   917 
       
   918 	/**
       
   919 	 * Gets SWMT categories that user wants to include into SWMT log.
       
   920 	 * Includes always {@link SWMTCategoryConstants#CATEGORY_KERNELHANDLES} with it because SWMT Analyser
       
   921 	 * needs it to be functional
       
   922 	 * @return  SWMT categories that user wants to include into SWMT log.
       
   923 	 */
       
   924 	private int getCategoriesForSWMTWithKernelHandles() {
       
   925 		// CATEGORY_KERNELHANDLES is always included into fetched categories because data is required by SWMT analyser plug-in
       
   926 		//If SWMT Analyzer is modified so that Kernel Handles is not always needed then SWMTCategoryConstants.CATEGORY_KERNELHANDLES can be removed.
       
   927 		return getCategoriesForSWMT() | SWMTCategoryConstants.CATEGORY_KERNELHANDLES;
       
   928 	}	
       
   929 	
       
   930 
       
   931 	/**
       
   932 	 * Gets SWMT categories that user wants to include into SWMT log.
       
   933 	 * @return  SWMT categories that user wants to include into SWMT log.
       
   934 	 */
       
   935 	public int getCategoriesForSWMT() {
       
   936 		int sessionSpecificSWMTCategorySetting = MemSpyPreferences.getSWMTCategorySetting();
       
   937 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "getCategoriesForSWMT(): " + String.format("0x%x", sessionSpecificSWMTCategorySetting)); //$NON-NLS-1$
       
   938 		SWMTCategoryConstants.debugPrintSWMTCategorySetting(sessionSpecificSWMTCategorySetting);
       
   939 		return sessionSpecificSWMTCategorySetting;
       
   940 	}	
       
   941 	
       
   942 	/**
       
   943 	 * Sets SWMT categories that user wants to include into SWMT log.
       
   944 	 * @param categoriesForSWMT  SWMT categories that user wants to include into SWMT log.
       
   945 	 * @param isProfileSettings <code>true</code> if these settings are profile settings
       
   946 	 * <code>false</code> if these are custom settings
       
   947 	 */
       
   948 	public void setCategoriesForSWMT(int categoriesForSWMT, boolean isProfileSettings) {
       
   949 		MemSpyPreferences.setSWMTCategorySetting(categoriesForSWMT, isProfileSettings);
       
   950 	}
       
   951 	
       
   952 	/**
       
   953 	 * Sets if User has select a Profile or not
       
   954 	 * @param isProfileCategoriesSelected 
       
   955 	 */
       
   956 	public void setProfileTrackedCategoriesSelected(boolean isProfileCategoriesSelected) {
       
   957 		MemSpyPreferences.setProfileTrackedCategoriesSelected(isProfileCategoriesSelected);
       
   958 	}	
       
   959 	
       
   960 	/**
       
   961 	 * Gets if User has select a Profile or not
       
   962 	 * @return <code>true</code> if one of the profiles has been selected
       
   963 	 */
       
   964 	public boolean isProfileTrackedCategoriesSelected() {
       
   965 		return MemSpyPreferences.isProfileTrackedCategoriesSelected();
       
   966 	}		
       
   967 
       
   968 	/**
       
   969 	 * Gets SWMT HeapNameFilter to filter User Heaps in SWMT log.
       
   970 	 * @return SWMT HeapNameFilter that user wants to include into SWMT log.
       
   971 	 */
       
   972 	public String getHeapNameFilterForSWMT() {
       
   973 		String filter = MemSpyPreferences.getSWMTHeapNameFilter();
       
   974 		
       
   975 		DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "getHeapNameFilterForSWMT(): " + filter); //$NON-NLS-1$		
       
   976 		return filter;
       
   977 	}	
       
   978 	
       
   979 	/**
       
   980 	 * Sets SWMT HeapNameFilter to filter User Heaps in SWMT log.
       
   981 	 * @param HeapNameFilter SWMT HeapNameFilter that user wants to include into SWMT log.
       
   982 	 */
       
   983 	public void setHeapNameFilterForSWMT(String heapNameFilterForSWMT) {
       
   984 		MemSpyPreferences.setSWMTHeapNameFilter(heapNameFilterForSWMT);
       
   985 	}
       
   986 	
       
   987 	/**
       
   988 	 * Restarts error timer
       
   989 	 */
       
   990 	public void restartErrorTimer() {
       
   991 		if( errorTimer != null && errorTimer.isRunning() ){
       
   992 			errorTimer.restart();
       
   993 		}
       
   994 	}
       
   995 
       
   996 	/**
       
   997 	 * Notify about MemSpy Launcher S60 application version
       
   998 	 * @param version in format "x", e.g "1".
       
   999 	 */
       
  1000 	public void setMemSpyLauncherVersion(String version) {
       
  1001 		String msg = "MemSpy Launcher data version: '" +version +"' detected in S60 target.";
       
  1002 		DbgUtility.println(DbgUtility.PRIORITY_LOOP, msg);
       
  1003 		MemSpyConsole.getInstance().println(msg);
       
  1004 		
       
  1005 		receivedMemSpyLauncherDataVersion = Integer.parseInt(version);
       
  1006 	}
       
  1007 
       
  1008 	/**
       
  1009 	 * Check if received MemSpy Launcher data version is at least required version
       
  1010 	 */
       
  1011 	private void checkMemSpyLauncherDataVersion() {
       
  1012 		int requiredVersion = ProductInfoRegistry.getRequiredMemSpyLauncherDataVersion();
       
  1013 		DbgUtility.println(DbgUtility.PRIORITY_LOOP, "Required MemSpy Launcher data version: " +requiredVersion);
       
  1014 		if(requiredVersion > receivedMemSpyLauncherDataVersion){		
       
  1015 			this.launcherError(LauncherErrorType.TOO_OLD_MEMSPY_LAUNCHER_DATAVERSION);
       
  1016 		}
       
  1017 	}
       
  1018 
       
  1019 	/**
       
  1020 	 * Get Heap Dump files that has been imported during SWMT logging.
       
  1021 	 * @return list about imported Heap Dumps.
       
  1022 	 */
       
  1023 	public ArrayList<ThreadInfo> getImportedSWMTHeaps() { 
       
  1024 		return handler.getImportedSWMTHeaps();
       
  1025 	}
       
  1026 
       
  1027 	/**
       
  1028 	 * Gets progress status for current wizard session with current connection settings.
       
  1029 	 * @return Progress status for current wizard session with current connection settings.
       
  1030 	 */
       
  1031 	public ProgressStatus getProgressStatus() {
       
  1032 		return progressStatus;
       
  1033 	}
       
  1034 
       
  1035 	/**
       
  1036 	 * Sets progress status if there has been further progress after recent progress status update.
       
  1037 	 * @param progressStatus the progressStatus to set
       
  1038 	 */
       
  1039 	private void setProgressStatus(ProgressStatus progressStatus) {
       
  1040 		if(progressStatus.ordinal() > this.progressStatus.ordinal()){
       
  1041 			this.progressStatus = progressStatus;			
       
  1042 			DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "setProgressStatus: " + this.progressStatus.name()); //$NON-NLS-1$
       
  1043 		}
       
  1044 	}
       
  1045 
       
  1046 	/**
       
  1047 	 * Resets progress status back into initial value.
       
  1048 	 */
       
  1049 	public void resetProgressStatus() {
       
  1050 		this.progressStatus = ProgressStatus.EPROGRESS_INITIAL;
       
  1051 	}
       
  1052 
       
  1053 	/**
       
  1054 	 * Delegates launcher error info further without any additional information 
       
  1055 	 * @param generalLauncherError launcher error occurred
       
  1056 	 */
       
  1057 	public void launcherError(LauncherErrorType launcherError) {
       
  1058 		launcherError(launcherError, "");
       
  1059 	}
       
  1060 
       
  1061 	/**
       
  1062 	 * Gets possible additional information related to occurred error.
       
  1063 	 * @return string containing additional information related to occurred error
       
  1064 	 */
       
  1065 	public String getAdditionalErrorInformation() {
       
  1066 		return additionalErrorInformation;
       
  1067 	}
       
  1068 
       
  1069 	/* (non-Javadoc)
       
  1070 	 * @see com.nokia.s60tools.memspy.export.ITraceClientNotificationsIf#notifyError(java.lang.String)
       
  1071 	 */
       
  1072 	public void notifyError(String message) {
       
  1073 		// Currently only showing trace errors on console
       
  1074 		MemSpyConsole.getInstance().println(message, MemSpyConsole.MSG_ERROR);		
       
  1075 	}
       
  1076 
       
  1077 	/* (non-Javadoc)
       
  1078 	 * @see com.nokia.s60tools.memspy.export.ITraceClientNotificationsIf#notifyInformation(java.lang.String)
       
  1079 	 */
       
  1080 	public void notifyInformation(String message) {
       
  1081 		// Currently only showing trace informative messages on console
       
  1082 		MemSpyConsole.getInstance().println(message, MemSpyConsole.MSG_NORMAL);		
       
  1083 	}
       
  1084 
       
  1085 	/* (non-Javadoc)
       
  1086 	 * @see com.nokia.s60tools.memspy.export.ITraceClientNotificationsIf#notifyWarning(java.lang.String)
       
  1087 	 */
       
  1088 	public void notifyWarning(String message) {
       
  1089 		// Currently only showing trace warnings on console
       
  1090 		MemSpyConsole.getInstance().println(message, MemSpyConsole.MSG_WARNING);		
       
  1091 	}
       
  1092 
       
  1093 }