|
1 /* |
|
2 * Copyright (c) 2007-2010 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 * Connection interface |
|
17 * |
|
18 */ |
|
19 package com.nokia.traceviewer.engine; |
|
20 |
|
21 /** |
|
22 * Connection interface |
|
23 */ |
|
24 public interface Connection { |
|
25 |
|
26 /** |
|
27 * Connect to media |
|
28 * |
|
29 * @return true if connection succeeded, false otherwise |
|
30 */ |
|
31 public boolean connect(); |
|
32 |
|
33 /** |
|
34 * Creates a connection for given connection type. Types are taken from |
|
35 * com.nokia.traceviewer.engine.preferences.PreferenceConstants.java |
|
36 * |
|
37 * @param connectionType |
|
38 * connection type from |
|
39 * com.nokia.traceviewer.engine.preferences.PreferenceConstants |
|
40 * .java |
|
41 * @param parameters |
|
42 * connection parameters. When using TCP connection, parameters |
|
43 * are IP address, port number and channel number in this order. |
|
44 * When using USB serial connection, the only parameter is the |
|
45 * COM port number. |
|
46 * @param filePath |
|
47 * file path where the binary file is created |
|
48 * @return true if connection was succesfully created, false otherwise |
|
49 */ |
|
50 public boolean createConnection(String connectionType, String[] parameters, |
|
51 String filePath); |
|
52 |
|
53 /** |
|
54 * Disconnect from media |
|
55 * |
|
56 * @return true if disconnect succeeded, false otherwise |
|
57 */ |
|
58 public boolean disconnect(); |
|
59 |
|
60 /** |
|
61 * Indicates the status of the connection |
|
62 * |
|
63 * @return true if connection is up, false otherwise |
|
64 */ |
|
65 public boolean isConnected(); |
|
66 |
|
67 /** |
|
68 * Writes message to connection |
|
69 * |
|
70 * @param byteArray |
|
71 * byte array containing data |
|
72 * @return true if writing succeeded, false otherwise |
|
73 */ |
|
74 public boolean write(byte[] byteArray); |
|
75 } |