# HG changeset patch # User Matti Laitinen # Date 1271839598 -10800 # Node ID e67492608de049400175aef095b0f21a468cc8ad # Parent df27719e5a0d350bf52dfbc9be9cfcc92ff30334 HTI Connection 1.4.0 What's new: * Change: API improvements diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.carbide.extensions.hticonnection/feature.xml --- 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 @@ @@ -11,28 +11,25 @@ - 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:: "http://www.eclipse.org/legal/epl-v10.html". - -Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + + 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". - -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 - - - - diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection.help/META-INF/MANIFEST.MF --- 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, diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection.help/about.html --- 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 @@ - - - -About - - - - -

About This Content

-

November 27, 2009

-

Copyright

-

Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
-License: http://www.eclipse.org/legal/epl-v10.html.

- - \ No newline at end of file + + + + About + + + + +

About This Content

+ +

March 26, 2010

+ +

Copyright

+ +

Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights +reserved.
+License: http://www.eclipse.org/legal/epl-v10.html.

+ + diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection.help/html/images/Thumbs.db Binary file htiextension/com.nokia.s60tools.hticonnection.help/html/images/Thumbs.db has changed diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection.help/html/release_notes.htm --- 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 @@

Release Notes

-

HTI Connection – Version 1.3.1

+

HTI Connection – Version 1.4.0

-

Released 19th February 2010

+

Released 26th March 2010

  • Product description
  • Main features
  • @@ -49,14 +49,7 @@

    What's new

      -
    • Requires Carbide.c++ 2.5.0 or later to work!
    • -
    • 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.
    • -
    • Fix: Unhandled event loop exception -error during connection creation is - now fixed.
    • -
    • Documentation: Help links pointing to wrong location were fixed.
    • +
    • Change: API improvements.

    Installation notes

    @@ -98,6 +91,18 @@

    Version history

    +
    Version 1.3.1 – 19th February 2010
    +
      +
    • Requires Carbide.c++ 2.5.0 or later to work!
    • +
    • 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.
    • +
    • Fix: Unhandled event loop exception -error during connection creation is + now fixed.
    • +
    • Documentation: Help links pointing to wrong location were fixed.
    • +
    +
    Version 1.3.0 – 25th June 2009
    • Change: Connections are handled via Carbide.c++ Remote Connections.
    • diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection.help/html/tool.htm --- 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 @@ - - - - - - Carbide.c++ User Guide - - - - - -

       

      - - - - - - - - -

      -

       

      -

       

      -

       

      -

      Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
      - License: http://www.eclipse.org/legal/epl-v10.html

      -

      HTI Connection User Guide

      -

      Version 1.3.1; February, 2010

      - - \ No newline at end of file + + + + + Carbide.c++ User Guide + + + + + +

       

      + + + + + + + + + + + +

      + +

       

      + +

       

      + +

       

      + +

      Copyright © 2010 Nokia Corporation and/or its + subsidiary(-ies). All rights reserved.
      + License: http://www.eclipse.org/legal/epl-v10.html

      +

      HTI Connection User Guide

      + +

      Version 1.4.0; March, 2010

      +
      + + diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection/META-INF/MANIFEST.MF --- 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 diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/core/HtiConnection.java --- 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); } } diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/resources/messages.properties --- 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 diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/HTIScreenMode.java --- 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; + } } diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/HTIServiceFactory.java --- 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() { diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/IScreenCaptureService.java --- 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. diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/ScreenCaptureData.java --- /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; + } + +} diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ResetScreenDeltaRequest.java --- /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); + } +} diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ScreenCaptureDeltaRequest.java --- /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$ + } + } +} diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ScreenCaptureRequest.java --- 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); diff -r df27719e5a0d -r e67492608de0 htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/screencaptureservice/ScreenCaptureService.java --- 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(); } }