|
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 package com.nokia.s60tools.hticonnection.services.screencaptureservice; |
|
19 |
|
20 import com.nokia.HTI.BaseService; |
|
21 import com.nokia.HTI.IService; |
|
22 import com.nokia.s60tools.hticonnection.core.AbstractRequest; |
|
23 import com.nokia.s60tools.hticonnection.core.RequestResult; |
|
24 import com.nokia.s60tools.hticonnection.services.HTIScreenMode; |
|
25 |
|
26 /** |
|
27 * Callable object that can be used to wait for request to complete. |
|
28 */ |
|
29 public class GetScreenModeRequest extends AbstractRequest{ |
|
30 |
|
31 /** |
|
32 * Name used for request. |
|
33 */ |
|
34 private static final String REQUEST_NAME = "Get screen mode"; //$NON-NLS-1$ |
|
35 |
|
36 // Settings for capture. |
|
37 private final long timeout; |
|
38 |
|
39 /** |
|
40 * Get screen mode constructor. |
|
41 * @param timeout Time that is waited for operation to complete. Use 0 for infinite wait. |
|
42 */ |
|
43 public GetScreenModeRequest(long timeout) { |
|
44 super(REQUEST_NAME); |
|
45 this.timeout = timeout; |
|
46 } |
|
47 |
|
48 /* (non-Javadoc) |
|
49 * @see com.nokia.s60tools.hticonnection.core.AbstractRequest#createService() |
|
50 */ |
|
51 public BaseService createService(){ |
|
52 return new com.nokia.HTI.ScreenCapturingService.ScreenCapturingService(); |
|
53 } |
|
54 |
|
55 /* (non-Javadoc) |
|
56 * @see com.nokia.s60tools.hticonnection.core.AbstractRequest#invokeService(com.nokia.HTI.IService) |
|
57 */ |
|
58 public RequestResult invokeService(IService service) throws Exception{ |
|
59 com.nokia.HTI.ScreenCapturingService.HTIScreenMode screenMode = |
|
60 ((com.nokia.HTI.ScreenCapturingService.ScreenCapturingService)service) |
|
61 .getScreenMode(timeout); |
|
62 |
|
63 // Creating a new screen mode object, that can be sent to client. |
|
64 HTIScreenMode result = new HTIScreenMode(screenMode.getIndex(), screenMode.getWidth(), |
|
65 screenMode.getHeight(), screenMode.getRotation(), |
|
66 screenMode.getMode(), screenMode.getFocusIndex()); |
|
67 |
|
68 return new RequestResult(result); |
|
69 } |
|
70 } |