HTI Connection 1.4.0
authorMatti Laitinen <matti.t.laitinen@nokia.com>
Wed, 21 Apr 2010 11:46:38 +0300
changeset 9 e67492608de0
parent 8 df27719e5a0d
child 10 2715b6594cd9
HTI Connection 1.4.0 What's new: * Change: API improvements
htiextension/com.nokia.carbide.extensions.hticonnection/feature.xml
htiextension/com.nokia.s60tools.hticonnection.help/META-INF/MANIFEST.MF
htiextension/com.nokia.s60tools.hticonnection.help/about.html
htiextension/com.nokia.s60tools.hticonnection.help/html/images/Thumbs.db
htiextension/com.nokia.s60tools.hticonnection.help/html/release_notes.htm
htiextension/com.nokia.s60tools.hticonnection.help/html/tool.htm
htiextension/com.nokia.s60tools.hticonnection/META-INF/MANIFEST.MF
htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/core/HtiConnection.java
htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/resources/messages.properties
htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/HTIScreenMode.java
htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/HTIServiceFactory.java
htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/IScreenCaptureService.java
htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/ScreenCaptureData.java
htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ResetScreenDeltaRequest.java
htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ScreenCaptureDeltaRequest.java
htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ScreenCaptureRequest.java
htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ScreenCaptureService.java
--- a/htiextension/com.nokia.carbide.extensions.hticonnection/feature.xml	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.carbide.extensions.hticonnection/feature.xml	Wed Apr 21 11:46:38 2010 +0300
@@ -2,7 +2,7 @@
 <feature
       id="com.nokia.carbide.extensions.hticonnection"
       label="Carbide.c++ Extensions - HTI Connection"
-      version="1.3.0"
+      version="1.4.0"
       provider-name="Nokia"
       plugin="com.nokia.s60tools.hticonnection">
 
@@ -11,28 +11,25 @@
    </description>
 
    <copyright>
-      Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License:: "http://www.eclipse.org/legal/epl-v10.html".
+      Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved. License:: &quot;http://www.eclipse.org/legal/epl-v10.html&quot;.
    </copyright>
 
-   <license url="license.txt">   
-Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+   <license url="license.txt">
+      Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 All rights reserved.
 This component and the accompanying materials are made available
 under the terms of &quot;Eclipse Public License v1.0&quot;
 which accompanies this distribution, and is available
 at the URL &quot;http://www.eclipse.org/legal/epl-v10.html&quot;.
-
-Part of the graphics of the program are from Eclipse 3.4 platform
-and CDT project in Eclipse community, which are made available under
-the terms of the Eclipse Public License v1.0.
-A copy of the EPL is provided at
+
+Part of the graphics of the program are from Eclipse 3.4 platform
+and CDT project in Eclipse community, which are made available under
+the terms of the Eclipse Public License v1.0.
+A copy of the EPL is provided at
 http://www.eclipse.org/legal/epl-v10.html
    </license>
 
-   <url>
-      <update label="Carbide.c++ Update Site" url="http://tools.ext.nokia.com/updates/carbide22"/>
-      <discovery label="Carbide.c++ Update Site" url="http://tools.ext.nokia.com/updates/carbide22"/>
-   </url>
 
    <requires>
       <import plugin="org.eclipse.core.runtime" version="3.4.0" match="greaterOrEqual"/>
--- a/htiextension/com.nokia.s60tools.hticonnection.help/META-INF/MANIFEST.MF	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection.help/META-INF/MANIFEST.MF	Wed Apr 21 11:46:38 2010 +0300
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name:  Carbide.c++ Extensions - HTI Connection Help Plug-in
 Bundle-SymbolicName: com.nokia.s60tools.hticonnection.help;singleton:=true
-Bundle-Version: 1.3.1
+Bundle-Version: 1.4.0
 Bundle-Vendor: Nokia
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
--- a/htiextension/com.nokia.s60tools.hticonnection.help/about.html	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection.help/about.html	Wed Apr 21 11:46:38 2010 +0300
@@ -1,15 +1,20 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
-</head>
-<body>
-
-<h2>About This Content</h2>
-<p>November 27, 2009</p>
-<h3>Copyright</h3>
-<p>Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.<br>
-License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</p>
-
-</body></html>
\ No newline at end of file
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+  <title>About</title>
+  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body>
+<h2>About This Content</h2>
+
+<p>March 26, 2010</p>
+
+<h3>Copyright</h3>
+
+<p>Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights
+reserved.<br>
+License: <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</p>
+</body>
+</html>
Binary file htiextension/com.nokia.s60tools.hticonnection.help/html/images/Thumbs.db has changed
--- a/htiextension/com.nokia.s60tools.hticonnection.help/html/release_notes.htm	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection.help/html/release_notes.htm	Wed Apr 21 11:46:38 2010 +0300
@@ -9,9 +9,9 @@
 <body>
 <h2>Release Notes</h2>
 
-<h4>HTI Connection &ndash; Version 1.3.1</h4>
+<h4>HTI Connection &ndash; Version 1.4.0</h4>
 
-<p>Released 19th February 2010</p>
+<p>Released 26th March 2010</p>
 <ul>
   <li><a href="#description">Product description</a></li>
   <li><a href="#features">Main features</a></li>
@@ -49,14 +49,7 @@
 
 <h3><a name="newfeatures"></a>What's new</h3>
 <ul>
-  <li>Requires Carbide.c++ 2.5.0 or later to work!</li>
-  <li>New: New connection preference option called "Current connection". If
-    this option is selected, user can change the currently active connection
-    easily either from Remote Connection view, or from a new Trim widget
-    showing the current connection.</li>
-  <li>Fix: Unhandled event loop exception -error during connection creation is
-    now fixed.</li>
-  <li>Documentation: Help links pointing to wrong location were fixed.</li>
+  <li>Change: API improvements.</li>
 </ul>
 
 <h3><a name="installation"></a>Installation notes</h3>
@@ -98,6 +91,18 @@
 
 <h3>Version history</h3>
 
+<h5>Version 1.3.1 &ndash; 19th February 2010</h5>
+<ul>
+  <li>Requires Carbide.c++ 2.5.0 or later to work!</li>
+  <li>New: New connection preference option called "Current connection". If
+    this option is selected, user can change the currently active connection
+    easily either from Remote Connection view, or from a new Trim widget
+    showing the current connection.</li>
+  <li>Fix: Unhandled event loop exception -error during connection creation is
+    now fixed.</li>
+  <li>Documentation: Help links pointing to wrong location were fixed.</li>
+</ul>
+
 <h5>Version 1.3.0 &ndash; 25th June 2009</h5>
 <ul>
   <li>Change: Connections are handled via Carbide.c++ Remote Connections.</li>
--- a/htiextension/com.nokia.s60tools.hticonnection.help/html/tool.htm	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection.help/html/tool.htm	Wed Apr 21 11:46:38 2010 +0300
@@ -1,32 +1,45 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-	<title>Carbide.c++ User Guide</title>
-    <link href="../book.css" rel="stylesheet" type="text/css">
-	<style>
-		table, td, th { border: 0px none #FFF; }
-    </style>
-</head>
-
-<body background="images/background_carbide.jpg" >
-<p>&nbsp;</p>
-<table width="530" border="0" align="center" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF" >
-  <tr>
-    <td width="215"><img src="images/about_cpp.png" width="225" height="200"></td>
-    <td width="294" valign="bottom"><p align="right"><b><img src="images/brandmark_cpp.gif" width="106" height="52"></b></p>
-        <p>&nbsp;</p>
-        <p>&nbsp;</p>
-        <p>&nbsp;</p>
-        <p class="titleSmall">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. <br>
-        License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></p>
-    </td>
-  </tr>
-  <tr>
-    <td colspan="2"><h1 align="center">HTI Connection User Guide</h1>
-      <p align="center" class="titleSmall">Version 1.3.1; February, 2010</p></td>
-  </tr>
-</table>
-</body>
-</html>
\ No newline at end of file
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+  <title>Carbide.c++ User Guide</title>
+  <link href="../book.css" rel="stylesheet" type="text/css">
+  <style>
+                table, td, th { border: 0px none #FFF; }
+  </style>
+</head>
+
+<body background="images/background_carbide.jpg">
+<p> </p>
+
+<table width="530" border="0" align="center" cellpadding="0" cellspacing="5"
+bgcolor="#FFFFFF">
+  <tbody>
+    <tr>
+      <td width="215"><img src="images/about_cpp.png" width="225"
+      height="200"></td>
+      <td width="294" valign="bottom"><p align="right"><b><img
+        src="images/brandmark_cpp.gif" width="106" height="52"></b></p>
+
+        <p> </p>
+
+        <p> </p>
+
+        <p> </p>
+
+        <p class="titleSmall">Copyright © 2010 Nokia Corporation and/or its
+        subsidiary(-ies). All rights reserved. <br>
+        License: <a
+        href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></p>
+      </td>
+    </tr>
+    <tr>
+      <td colspan="2"><h1 align="center">HTI Connection User Guide</h1>
+
+        <p align="center" class="titleSmall">Version 1.4.0; March, 2010</p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</body>
+</html>
--- a/htiextension/com.nokia.s60tools.hticonnection/META-INF/MANIFEST.MF	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection/META-INF/MANIFEST.MF	Wed Apr 21 11:46:38 2010 +0300
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Carbide.c++ Extensions - HTI Connection
 Bundle-SymbolicName: com.nokia.s60tools.hticonnection;singleton:=true
-Bundle-Version: 1.3.1
+Bundle-Version: 1.4.0
 Bundle-ClassPath: .,
  htiapi.jar
 Bundle-Vendor: Nokia
--- a/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/core/HtiConnection.java	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/core/HtiConnection.java	Wed Apr 21 11:46:38 2010 +0300
@@ -510,10 +510,9 @@
 			// ID of normal connection need to be saved to preferences so that it will be used later as default.
 			String connectionID = (currentConnection == null) ? HtiApiPreferenceConstants.DEFAULT_CONNECTION_ID 
 					: currentConnection.getIdentifier();
-						
-			// Set only if NOT already set as same or NOT set as "current connection".
-			if ((!connectionID.equals(HtiApiActivator.getPreferences().getConnectionID())) &&
-				(!HtiApiPreferences.SELECTION_ID_CURRENT.equals(HtiApiActivator.getPreferences().getConnectionID()))) {
+			// Do not change default if it is "current connection".
+			if (!HtiApiActivator.getPreferences().getConnectionID().equals(HtiApiPreferences.SELECTION_ID_CURRENT) &&
+				!connectionID.equals(HtiApiActivator.getPreferences().getConnectionID())) {
 				HtiApiActivator.getPreferences().setConnectionID(connectionID);
 			}
 		}
--- a/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/resources/messages.properties	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/resources/messages.properties	Wed Apr 21 11:46:38 2010 +0300
@@ -74,7 +74,9 @@
 RequestQueueManager.RequestFailed_Exception_Msg=\ failed - 
 RequestQueueManager.RequestInterrupted_Exception_Msg=\ was interrupted - 
 RequestQueueManager.ServiceShutdown_Exception_Msg=Service has been shutdown, new requests are not accepted.
-ScreenCaptureRequest.InvalidImage_Exception_Msg=Captured image is not valid. Connection resetted.
+ScreenCaptureRequest.InvalidImage_Exception_Msg=Captured image is not valid. Connection reset.
+ScreenCaptureDeltaRequest.InvalidImageData_Exception_Msg=Captured image delta data is not valid. Connection reset.
+ScreenCaptureDeltaRequest.InvalidImage_Exception_Msg=Captured image delta is not valid. Connection reset.
 ScrollLockAction.ScrollLock_Action_Text=Scroll Lock
 ScrollLockAction.ScrollLock_Action_Tooltip=Scroll Lock
 SelectAllAction.SelectAll_Action_Text=Select All
--- a/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/HTIScreenMode.java	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/HTIScreenMode.java	Wed Apr 21 11:46:38 2010 +0300
@@ -226,4 +226,41 @@
 	public String toString() {
 		return "[screen " + index + ": " + width + "x" + height + " @ " + MODE[mode] + ROTATION[rotation] + ", focus: " + focusIndex + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
 	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + focusIndex;
+		result = prime * result + height;
+		result = prime * result + index;
+		result = prime * result + mode;
+		result = prime * result + rotation;
+		result = prime * result + width;
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		HTIScreenMode other = (HTIScreenMode) obj;
+		if (focusIndex != other.focusIndex)
+			return false;
+		if (height != other.height)
+			return false;
+		if (index != other.index)
+			return false;
+		if (mode != other.mode)
+			return false;
+		if (rotation != other.rotation)
+			return false;
+		if (width != other.width)
+			return false;
+		return true;
+	}
 }
--- a/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/HTIServiceFactory.java	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/HTIServiceFactory.java	Wed Apr 21 11:46:38 2010 +0300
@@ -18,8 +18,6 @@
 package com.nokia.s60tools.hticonnection.services;
 
 import com.nokia.s60tools.hticonnection.core.HtiConnection;
-import com.nokia.s60tools.hticonnection.listener.HtiConnectionManager;
-import com.nokia.s60tools.hticonnection.listener.IHtiConnectionListener;
 import com.nokia.s60tools.hticonnection.services.applicationcontrolservice.ApplicationControlService;
 import com.nokia.s60tools.hticonnection.services.connectiontestservice.ConnectionTestService;
 import com.nokia.s60tools.hticonnection.services.ftpservice.FTPService;
@@ -35,8 +33,8 @@
 	/**
 	 * Gets HTI version to which HTI Connection is currently connected. Or null if connection
 	 * is down. Value for this query is got when connection is established and it is
-	 * up to date when connection started message comes by {@link IHtiConnectionListener}. 
-	 * See {@link HtiConnectionManager} for more information.
+	 * up to date when connection started message comes by {@link com.nokia.s60tools.hticonnection.listener.IHtiConnectionListener}. 
+	 * See {@link com.nokia.s60tools.hticonnection.listener.HtiConnectionManager} for more information.
 	 * @return HTI Version queried from HTI agent or null if connection is down.
 	 */
 	public static HTIVersion getCurrentHTIVersion() {
--- a/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/IScreenCaptureService.java	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/IScreenCaptureService.java	Wed Apr 21 11:46:38 2010 +0300
@@ -41,6 +41,31 @@
 						throws ServiceShutdownException, HTIException, ConnectionException;
 	
 	/**
+	 * Captures a screen delta with specified type and color amount.
+	 * Screen delta means changes in screen after last screen capture delta.
+	 * @param imgMimeType Image MIME type, e.g. "image/png", "image/gif", "image/jpeg"
+	 * @param colorDepth Color depth e.g. ConnectionTestService.COLOR_DEPTH_ECOLOR64K.
+	 * @param timeout Time in milliseconds that is waited for the operation to complete. Use 0 for infinite.
+	 * @return Screen capture data including changed part of the screen as byte[] and the location of it.
+	 * @throws ConnectionException Connection failed
+	 * @throws HTIException Thrown when there are problems with HTI
+	 * @throws ServiceShutdownException Thrown after services have been shut down
+	 * and new requests are not accepted.
+	 */
+	public ScreenCaptureData captureFullScreenDelta(String imgMimeType, int colorDepth, long timeout)
+						throws ServiceShutdownException, HTIException, ConnectionException;
+	
+	/**
+	 * 
+	 * @param timeout Time in milliseconds that is waited for the operation to complete. Use 0 for infinite.
+	 * @throws ServiceShutdownException Thrown after services have been shut down
+	 * @throws HTIException Thrown when there are problems with HTI
+	 * @throws ConnectionException Connection failed
+	 */
+	public void resetScreenDelta(long timeout)
+						throws ServiceShutdownException, HTIException, ConnectionException;
+	
+	/**
 	 * Gets information about the screen. This information includes width, height, rotation, and display mode
 	 * of the screen. Also screen index and currently focused screen index is returned.
 	 * @param timeout Time in milliseconds that is waited for the operation to complete. Use 0 for infinite.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/ScreenCaptureData.java	Wed Apr 21 11:46:38 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.s60tools.hticonnection.services;
+
+import java.util.List;
+
+/**
+ * A simple class to handle and deliver screen capture data.
+ */
+public class ScreenCaptureData {
+
+	private Integer topLeftX;
+	private Integer topLeftY;
+	private Integer bottomRightX;
+	private Integer bottomRightY;
+	private byte[] imageData;
+	
+	/**
+	 * Constructor.
+	 */
+	public ScreenCaptureData() {	
+	}
+	
+	/**
+	 * Alternative constructor.
+	 * @param data Result data from com.nokia.HTI.ScreenCapturingService.ScreenCapturingService
+	 * 			   List that contains Coordinates all 0 if no image was captured Top
+	 *         	   left x coordinate Integer Top left y coordinate Integer Bottom
+	 *         	   right x coordinate Integer Bottom right y coordinate Integer
+	 *         	   Image data byte[].
+	 */
+	public ScreenCaptureData(List data) {
+		if ((data != null) && (data.size() == 5)) {
+			this.topLeftX = (Integer)data.get(0);
+			this.topLeftY = (Integer)data.get(1);
+			this.bottomRightX = (Integer)data.get(2);
+			this.bottomRightY = (Integer)data.get(3);
+			this.imageData = (byte[])data.get(4);
+		}
+	}
+
+	public Integer getTopLeftX() {
+		return topLeftX;
+	}
+
+	public void setTopLeftX(Integer topLeftX) {
+		this.topLeftX = topLeftX;
+	}
+
+	public Integer getTopLeftY() {
+		return topLeftY;
+	}
+
+	public void setTopLeftY(Integer topLeftY) {
+		this.topLeftY = topLeftY;
+	}
+
+	public Integer getBottomRightX() {
+		return bottomRightX;
+	}
+
+	public void setBottomRightX(Integer bottomRightX) {
+		this.bottomRightX = bottomRightX;
+	}
+
+	public Integer getBottomRightY() {
+		return bottomRightY;
+	}
+
+	public void setBottomRightY(Integer bottomRightY) {
+		this.bottomRightY = bottomRightY;
+	}
+
+	public byte[] getImageData() {
+		return imageData;
+	}
+
+	public void setImageData(byte[] imageData) {
+		this.imageData = imageData;
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ResetScreenDeltaRequest.java	Wed Apr 21 11:46:38 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.s60tools.hticonnection.services.screencaptureservice;
+
+import com.nokia.HTI.BaseService;
+import com.nokia.HTI.HTIMessage;
+import com.nokia.HTI.IService;
+import com.nokia.s60tools.hticonnection.core.AbstractRequest;
+import com.nokia.s60tools.hticonnection.core.RequestResult;
+
+/**
+ * Callable object that can be used to wait for request to complete.
+ * The target of this request is to perform reset screen delta on device side.
+ */
+public class ResetScreenDeltaRequest extends AbstractRequest{
+	
+	/**
+	 * Name used for request.
+	 */
+	private static final String REQUEST_NAME = "Reset screen delta"; //$NON-NLS-1$
+	
+	// Settings for capture.
+	private final long timeout;
+
+	/**
+	 * Reset screen delta.
+	 * @param timeout Time that is waited for operation to complete. Use 0 for infinite wait.
+	 */
+	public ResetScreenDeltaRequest(long timeout){
+		super(REQUEST_NAME);
+		this.timeout = timeout;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.nokia.s60tools.hticonnection.core.AbstractRequest#createService()
+	 */
+	public BaseService createService(){
+		return new com.nokia.HTI.ScreenCapturingService.ScreenCapturingService();
+		}
+	
+	/* (non-Javadoc)
+	 * @see com.nokia.s60tools.hticonnection.core.AbstractRequest#invokeService(com.nokia.HTI.IService)
+	 */
+	public RequestResult invokeService(IService service) throws Exception{
+		
+		com.nokia.HTI.ScreenCapturingService.ScreenCapturingService scService = 
+			(com.nokia.HTI.ScreenCapturingService.ScreenCapturingService)service;
+
+		HTIMessage result = scService.resetScreenDelta(timeout);
+			
+		return new RequestResult(result);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ScreenCaptureDeltaRequest.java	Wed Apr 21 11:46:38 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.s60tools.hticonnection.services.screencaptureservice;
+
+import java.io.ByteArrayInputStream;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+import com.nokia.HTI.BaseService;
+import com.nokia.HTI.IService;
+import com.nokia.s60tools.hticonnection.core.AbstractRequest;
+import com.nokia.s60tools.hticonnection.core.RequestResult;
+import com.nokia.s60tools.hticonnection.resources.Messages;
+
+/**
+ * Callable object that can be used to wait for request to complete.
+ * The target of this request is to perform screen capture delta on device side.
+ */
+public class ScreenCaptureDeltaRequest extends AbstractRequest{
+	
+	/**
+	 * Name used for request.
+	 */
+	private static final String REQUEST_NAME = "Screen capture delta"; //$NON-NLS-1$
+	
+	// Settings for capture.
+	private final String imgMimeType;
+	private final int colorDepth;
+	private final long timeout;
+
+	/**
+	 * Capture a screen delta.
+	 * @param imgMimeType Image MIME type, e.g. "image/png", "image/gif", "image/jpeg"
+	 * @param colorDepth Color depth e.g. ConnectionTestService.COLOR_DEPTH_ECOLOR64K.
+	 * @param timeout Time that is waited for operation to complete. Use 0 for infinite wait.
+	 */
+	public ScreenCaptureDeltaRequest(String imgMimeType, int colorDepth, long timeout){
+		super(REQUEST_NAME);
+		this.imgMimeType = imgMimeType;
+		this.colorDepth = colorDepth;
+		this.timeout = timeout;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.nokia.s60tools.hticonnection.core.AbstractRequest#createService()
+	 */
+	public BaseService createService(){
+		return new com.nokia.HTI.ScreenCapturingService.ScreenCapturingService();
+		}
+	
+	/* (non-Javadoc)
+	 * @see com.nokia.s60tools.hticonnection.core.AbstractRequest#invokeService(com.nokia.HTI.IService)
+	 */
+	public RequestResult invokeService(IService service) throws Exception{
+		
+		com.nokia.HTI.ScreenCapturingService.ScreenCapturingService scService = 
+			(com.nokia.HTI.ScreenCapturingService.ScreenCapturingService)service;
+
+		List changes = scService.captureFullScreenDelta(imgMimeType, (byte)colorDepth, timeout);
+		
+		// Testing image to prevent sending invalid data.
+		testImageData(changes);
+		
+		return new RequestResult(changes);
+    }
+	
+	/**
+	 * Test data by creating image from data.
+	 * @param imageChanges Image in binary format and its coordinates in a list.
+	 * @throws Exception Thrown if creating the image fails.
+	 */
+	private void testImageData(List imageChanges) throws Exception {
+		// Check imageData validity.
+		if (imageChanges.size() != 5) {
+			// Incorrect amount of items in a list.
+			throw new Exception(Messages.getString("ScreenCaptureDeltaRequest.InvalidImageData_Exception_Msg")); //$NON-NLS-1$
+		}
+		// If image is empty, no need to test it.
+		if (((byte[])imageChanges.get(4)).length == 0) return;
+		try {		
+			// Converting bytes to image to test that image is valid.
+			ByteArrayInputStream is = new ByteArrayInputStream((byte[])imageChanges.get(4));
+			Image image = new Image(Display.getDefault(), is);
+			image.dispose();
+		} 
+		catch(Exception e) {
+			// Couldn't create an image from data. Throwing an error.
+			// Connection will be reseted in abstractRequest after error.
+			throw new Exception(Messages.getString("ScreenCaptureDeltaRequest.InvalidImage_Exception_Msg")); //$NON-NLS-1$
+		}
+	}
+}
--- a/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ScreenCaptureRequest.java	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ScreenCaptureRequest.java	Wed Apr 21 11:46:38 2010 +0300
@@ -67,8 +67,10 @@
 	 * @see com.nokia.s60tools.hticonnection.core.AbstractRequest#invokeService(com.nokia.HTI.IService)
 	 */
 	public RequestResult invokeService(IService service) throws Exception{
-		byte[] result = ((com.nokia.HTI.ScreenCapturingService.ScreenCapturingService)service)
-						.captureFullScreen(imgMimeType, (byte)colorDepth, timeout);
+		com.nokia.HTI.ScreenCapturingService.ScreenCapturingService scService = 
+			(com.nokia.HTI.ScreenCapturingService.ScreenCapturingService)service;
+		
+		byte[] result = scService.captureFullScreen(imgMimeType, (byte)colorDepth, timeout);
 		
 		// Testing image to prevent sending invalid data.
 		testImageData(result);
--- a/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ScreenCaptureService.java	Wed Apr 21 11:43:59 2010 +0300
+++ b/htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ScreenCaptureService.java	Wed Apr 21 11:46:38 2010 +0300
@@ -24,6 +24,7 @@
 import com.nokia.s60tools.hticonnection.exceptions.ServiceShutdownException;
 import com.nokia.s60tools.hticonnection.services.HTIScreenMode;
 import com.nokia.s60tools.hticonnection.services.IScreenCaptureService;
+import com.nokia.s60tools.hticonnection.services.ScreenCaptureData;
 import com.nokia.s60tools.util.console.IConsolePrintUtility;
 
 /**
@@ -55,12 +56,31 @@
 	}
 	
 	/* (non-Javadoc)
+	 * @see com.nokia.s60tools.hticonnection.services.IScreenCaptureService#captureFullScreenDelta(java.lang.String, int, long)
+	 */
+	public ScreenCaptureData captureFullScreenDelta(String imgMimeType, int colorDepth, long timeout) 
+								throws ServiceShutdownException, HTIException, ConnectionException{
+		ScreenCaptureDeltaRequest request = new ScreenCaptureDeltaRequest(imgMimeType, colorDepth, timeout);
+		RequestResult result = RequestQueueManager.getInstance().submit(request, printUtility);
+		return new ScreenCaptureData(result.getListData());
+	}
+	
+	/* (non-Javadoc)
+	 * @see com.nokia.s60tools.hticonnection.services.IScreenCaptureService#resetScreenDelta(java.lang.String, int, long)
+	 */
+	public void resetScreenDelta(long timeout) 
+								throws ServiceShutdownException, HTIException, ConnectionException{
+		ResetScreenDeltaRequest request = new ResetScreenDeltaRequest(timeout);
+		RequestQueueManager.getInstance().submit(request, printUtility);
+	}
+	
+	/* (non-Javadoc)
 	 * @see com.nokia.s60tools.hticonnection.services.IScreenCaptureService#getScreenMode(long)
 	 */
 	public HTIScreenMode getScreenMode(long timeout) 
 								throws ServiceShutdownException, HTIException, ConnectionException{
-		GetScreenModeRequest request = new GetScreenModeRequest(timeout);
-		RequestResult result = RequestQueueManager.getInstance().submit(request, printUtility);
+		GetScreenModeRequest request = new GetScreenModeRequest(timeout);	
+		RequestResult result = RequestQueueManager.getInstance().submit(request, printUtility);	
 		return result.getScreenMode();
 	}
 }