connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCVirtualSerialConnection.java
author chpeckha
Mon, 06 Apr 2009 15:18:48 -0500
changeset 60 9d2210c8eed2
parent 2 d760517a8095
permissions -rw-r--r--
Commit changes for 2.1.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
cawthron
parents:
diff changeset
     1
/*
cawthron
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
cawthron
parents:
diff changeset
     3
* All rights reserved.
cawthron
parents:
diff changeset
     4
* This component and the accompanying materials are made available
cawthron
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
cawthron
parents:
diff changeset
     6
* which accompanies this distribution, and is available
cawthron
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
cawthron
parents:
diff changeset
     8
*
cawthron
parents:
diff changeset
     9
* Initial Contributors:
cawthron
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
cawthron
parents:
diff changeset
    11
*
cawthron
parents:
diff changeset
    12
* Contributors:
cawthron
parents:
diff changeset
    13
*
cawthron
parents:
diff changeset
    14
* Description: 
cawthron
parents:
diff changeset
    15
*
cawthron
parents:
diff changeset
    16
*/
cawthron
parents:
diff changeset
    17
/**
cawthron
parents:
diff changeset
    18
 * 
cawthron
parents:
diff changeset
    19
 */
cawthron
parents:
diff changeset
    20
package com.nokia.tcf.impl;
cawthron
parents:
diff changeset
    21
cawthron
parents:
diff changeset
    22
import org.eclipse.core.runtime.IStatus;
cawthron
parents:
diff changeset
    23
import org.eclipse.core.runtime.Status;
cawthron
parents:
diff changeset
    24
cawthron
parents:
diff changeset
    25
import com.nokia.tcf.Activator;
cawthron
parents:
diff changeset
    26
import com.nokia.tcf.api.ITCVirtualSerialConnection;
cawthron
parents:
diff changeset
    27
import com.nokia.tcf.api.TCErrorConstants;
cawthron
parents:
diff changeset
    28
cawthron
parents:
diff changeset
    29
public class TCVirtualSerialConnection extends TCBaseConnection implements
cawthron
parents:
diff changeset
    30
		ITCVirtualSerialConnection {
cawthron
parents:
diff changeset
    31
cawthron
parents:
diff changeset
    32
	private String comPort;
cawthron
parents:
diff changeset
    33
	/**
cawthron
parents:
diff changeset
    34
	 *  Create Virtual Serial connection with default COM port. Retry periods are defaulted.
cawthron
parents:
diff changeset
    35
	 */
cawthron
parents:
diff changeset
    36
	public TCVirtualSerialConnection() {
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    37
		super("virtualserial");
2
cawthron
parents:
diff changeset
    38
		this.comPort = ITCVirtualSerialConnection.DEFAULT_COM_PORT;
cawthron
parents:
diff changeset
    39
		decodeFormat = "ost";
cawthron
parents:
diff changeset
    40
	}
cawthron
parents:
diff changeset
    41
cawthron
parents:
diff changeset
    42
	/**
cawthron
parents:
diff changeset
    43
	 * Create virtual serial connection with default COM port. Retry periods are as specified.
cawthron
parents:
diff changeset
    44
	 * 
cawthron
parents:
diff changeset
    45
	 * @param connectionType
cawthron
parents:
diff changeset
    46
	 * @param retryInterval
cawthron
parents:
diff changeset
    47
	 * @param retryTimeout
cawthron
parents:
diff changeset
    48
	 */
cawthron
parents:
diff changeset
    49
	public TCVirtualSerialConnection(long retryInterval,
cawthron
parents:
diff changeset
    50
			long retryTimeout) {
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    51
		super("virtualserial", retryInterval, retryTimeout);
2
cawthron
parents:
diff changeset
    52
		this.comPort = ITCVirtualSerialConnection.DEFAULT_COM_PORT;
cawthron
parents:
diff changeset
    53
		decodeFormat = "ost";
cawthron
parents:
diff changeset
    54
	}
cawthron
parents:
diff changeset
    55
cawthron
parents:
diff changeset
    56
	/**
cawthron
parents:
diff changeset
    57
	 * Create virtual serial connection with specified COM port. Retry periods are defaulted.
cawthron
parents:
diff changeset
    58
	 * 
cawthron
parents:
diff changeset
    59
	 * @param inPort
cawthron
parents:
diff changeset
    60
	 */
cawthron
parents:
diff changeset
    61
	public TCVirtualSerialConnection(String inPort) {
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    62
		super("virtualserial");
2
cawthron
parents:
diff changeset
    63
		this.comPort = inPort;
cawthron
parents:
diff changeset
    64
		decodeFormat = "ost";
cawthron
parents:
diff changeset
    65
	}
cawthron
parents:
diff changeset
    66
	/* (non-Javadoc)
cawthron
parents:
diff changeset
    67
	 * @see com.nokia.tcf.internal.TCBaseConnection#getConnectionDescription()
cawthron
parents:
diff changeset
    68
	 */
cawthron
parents:
diff changeset
    69
	@Override
cawthron
parents:
diff changeset
    70
	public String getConnectionDescription() {
cawthron
parents:
diff changeset
    71
		return "VirtualSerial/" + comPort;
cawthron
parents:
diff changeset
    72
	}
cawthron
parents:
diff changeset
    73
cawthron
parents:
diff changeset
    74
	/* (non-Javadoc)
cawthron
parents:
diff changeset
    75
	 * @see com.nokia.tcf.api.ITCVirtualSerialConnection#getComPort()
cawthron
parents:
diff changeset
    76
	 */
cawthron
parents:
diff changeset
    77
	public String getComPort() {
cawthron
parents:
diff changeset
    78
		return comPort;
cawthron
parents:
diff changeset
    79
	}
cawthron
parents:
diff changeset
    80
cawthron
parents:
diff changeset
    81
	/* (non-Javadoc)
cawthron
parents:
diff changeset
    82
	 * @see com.nokia.tcf.api.ITCVirtualSerialConnection#setComPort(java.lang.String)
cawthron
parents:
diff changeset
    83
	 */
cawthron
parents:
diff changeset
    84
	public IStatus setComPort(String inPort) {
cawthron
parents:
diff changeset
    85
		IStatus status = new Status(Status.OK, Activator.PLUGIN_ID, (int)TCErrorConstants.TCAPI_ERR_NONE, "OK", null);
cawthron
parents:
diff changeset
    86
		if (inPort == null) {
cawthron
parents:
diff changeset
    87
			this.comPort = ITCVirtualSerialConnection.DEFAULT_COM_PORT;
cawthron
parents:
diff changeset
    88
		} else {
cawthron
parents:
diff changeset
    89
			this.comPort = inPort;
cawthron
parents:
diff changeset
    90
		}
cawthron
parents:
diff changeset
    91
		return status;
cawthron
parents:
diff changeset
    92
	}
cawthron
parents:
diff changeset
    93
cawthron
parents:
diff changeset
    94
	public IStatus setDecodeFormat(String inDecodeFormat) {
cawthron
parents:
diff changeset
    95
		return super.setDecodeFormat(inDecodeFormat);
cawthron
parents:
diff changeset
    96
	}
cawthron
parents:
diff changeset
    97
cawthron
parents:
diff changeset
    98
}