connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCRealSerialConnection.java
author cawthron
Fri, 15 Jan 2010 11:19:08 -0600
branchRCL_2_4
changeset 768 774b5f74e4ed
parent 60 9d2210c8eed2
permissions -rw-r--r--
add release notes about WINSCW compiler 3.2.5 build 487
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.ITCRealSerialConnection;
cawthron
parents:
diff changeset
    27
import com.nokia.tcf.api.TCErrorConstants;
cawthron
parents:
diff changeset
    28
cawthron
parents:
diff changeset
    29
public class TCRealSerialConnection extends TCBaseConnection implements
cawthron
parents:
diff changeset
    30
		ITCRealSerialConnection {
cawthron
parents:
diff changeset
    31
cawthron
parents:
diff changeset
    32
	private String comPort;
cawthron
parents:
diff changeset
    33
	private String baudRate;
cawthron
parents:
diff changeset
    34
	private String parity;
cawthron
parents:
diff changeset
    35
	private String dataBits;
cawthron
parents:
diff changeset
    36
	private String stopBits;
cawthron
parents:
diff changeset
    37
	private String flowControl;
cawthron
parents:
diff changeset
    38
	
cawthron
parents:
diff changeset
    39
	/**
cawthron
parents:
diff changeset
    40
	 * Create Real Serial Connection.
cawthron
parents:
diff changeset
    41
	 * Retry times are defaulted.
cawthron
parents:
diff changeset
    42
	 * All serial parameters are defaulted.
cawthron
parents:
diff changeset
    43
	 */
cawthron
parents:
diff changeset
    44
	public TCRealSerialConnection() {
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    45
		super("serial");
2
cawthron
parents:
diff changeset
    46
		comPort = DEFAULT_COM_PORT;
cawthron
parents:
diff changeset
    47
		baudRate = DEFAULT_BAUD;
cawthron
parents:
diff changeset
    48
		parity = DEFAULT_PARITY;
cawthron
parents:
diff changeset
    49
		dataBits = DEFAULT_DATABITS;
cawthron
parents:
diff changeset
    50
		stopBits = DEFAULT_STOPBITS;
cawthron
parents:
diff changeset
    51
		flowControl = DEFAULT_FLOWCONTROL;
cawthron
parents:
diff changeset
    52
		decodeFormat = "ost";
cawthron
parents:
diff changeset
    53
	}
cawthron
parents:
diff changeset
    54
	/**
cawthron
parents:
diff changeset
    55
	 * Create Real Serial Connection with specified COM port.
cawthron
parents:
diff changeset
    56
	 * Retry times are defaulted.
cawthron
parents:
diff changeset
    57
	 * All other serial parameters are defaulted.
cawthron
parents:
diff changeset
    58
	 * 
cawthron
parents:
diff changeset
    59
	 * @param inComPort
cawthron
parents:
diff changeset
    60
	 */
cawthron
parents:
diff changeset
    61
	public TCRealSerialConnection(String inComPort) {
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    62
		super("serial");
2
cawthron
parents:
diff changeset
    63
		comPort = inComPort;
cawthron
parents:
diff changeset
    64
		baudRate = DEFAULT_BAUD;
cawthron
parents:
diff changeset
    65
		parity = DEFAULT_PARITY;
cawthron
parents:
diff changeset
    66
		dataBits = DEFAULT_DATABITS;
cawthron
parents:
diff changeset
    67
		stopBits = DEFAULT_STOPBITS;
cawthron
parents:
diff changeset
    68
		flowControl = DEFAULT_FLOWCONTROL;
cawthron
parents:
diff changeset
    69
		decodeFormat = "ost";
cawthron
parents:
diff changeset
    70
}
cawthron
parents:
diff changeset
    71
	/**
cawthron
parents:
diff changeset
    72
	 * Create Real Serial Connection with specified COM port.
cawthron
parents:
diff changeset
    73
	 * Retry times are also specified.
cawthron
parents:
diff changeset
    74
	 * Other serial parameters are defaulted.
cawthron
parents:
diff changeset
    75
	 * 
cawthron
parents:
diff changeset
    76
	 * @param inComPort
cawthron
parents:
diff changeset
    77
	 * @param retryInterval
cawthron
parents:
diff changeset
    78
	 * @param retryTimeout
cawthron
parents:
diff changeset
    79
	 */
cawthron
parents:
diff changeset
    80
	public TCRealSerialConnection(String inComPort, long retryInterval,
cawthron
parents:
diff changeset
    81
			long retryTimeout) {
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
    82
		super("serial", retryInterval, retryTimeout);
2
cawthron
parents:
diff changeset
    83
		comPort = inComPort;
cawthron
parents:
diff changeset
    84
		baudRate = DEFAULT_BAUD;
cawthron
parents:
diff changeset
    85
		parity = DEFAULT_PARITY;
cawthron
parents:
diff changeset
    86
		dataBits = DEFAULT_DATABITS;
cawthron
parents:
diff changeset
    87
		stopBits = DEFAULT_STOPBITS;
cawthron
parents:
diff changeset
    88
		flowControl = DEFAULT_FLOWCONTROL;
cawthron
parents:
diff changeset
    89
		decodeFormat = "ost";
cawthron
parents:
diff changeset
    90
	}
cawthron
parents:
diff changeset
    91
cawthron
parents:
diff changeset
    92
	/**
cawthron
parents:
diff changeset
    93
	 * Create Real Serial connection with specified COM port and baud rate.
cawthron
parents:
diff changeset
    94
	 * Retry times are defaulted.
cawthron
parents:
diff changeset
    95
	 * All other parameters are defaulted.
cawthron
parents:
diff changeset
    96
	 * 
cawthron
parents:
diff changeset
    97
	 * @param inComPort
cawthron
parents:
diff changeset
    98
	 * @param inBaudRate
cawthron
parents:
diff changeset
    99
	 */
cawthron
parents:
diff changeset
   100
	public TCRealSerialConnection(String inComPort, String inBaudRate) {
60
9d2210c8eed2 Commit changes for 2.1.0
chpeckha
parents: 2
diff changeset
   101
		super("serial");
2
cawthron
parents:
diff changeset
   102
		comPort = inComPort;
cawthron
parents:
diff changeset
   103
		baudRate = inBaudRate;
cawthron
parents:
diff changeset
   104
		parity = DEFAULT_PARITY;
cawthron
parents:
diff changeset
   105
		dataBits = DEFAULT_DATABITS;
cawthron
parents:
diff changeset
   106
		stopBits = DEFAULT_STOPBITS;
cawthron
parents:
diff changeset
   107
		flowControl = DEFAULT_FLOWCONTROL;
cawthron
parents:
diff changeset
   108
		decodeFormat = "ost";
cawthron
parents:
diff changeset
   109
	}
cawthron
parents:
diff changeset
   110
cawthron
parents:
diff changeset
   111
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   112
	 * @see com.nokia.tcf.internal.TCBaseConnection#getConnectionDescription()
cawthron
parents:
diff changeset
   113
	 */
cawthron
parents:
diff changeset
   114
	@Override
cawthron
parents:
diff changeset
   115
	public String getConnectionDescription() {
cawthron
parents:
diff changeset
   116
		return "RealSerial/" + comPort +"/" + baudRate + "/" + parity + "/" + dataBits + "/" + stopBits + "/" + flowControl;
cawthron
parents:
diff changeset
   117
	}
cawthron
parents:
diff changeset
   118
cawthron
parents:
diff changeset
   119
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   120
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#getBaudRate()
cawthron
parents:
diff changeset
   121
	 */
cawthron
parents:
diff changeset
   122
	public String getBaudRate() {
cawthron
parents:
diff changeset
   123
		return baudRate;
cawthron
parents:
diff changeset
   124
	}
cawthron
parents:
diff changeset
   125
cawthron
parents:
diff changeset
   126
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   127
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#getComPort()
cawthron
parents:
diff changeset
   128
	 */
cawthron
parents:
diff changeset
   129
	public String getComPort() {
cawthron
parents:
diff changeset
   130
		return comPort;
cawthron
parents:
diff changeset
   131
	}
cawthron
parents:
diff changeset
   132
cawthron
parents:
diff changeset
   133
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   134
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#getDataBits()
cawthron
parents:
diff changeset
   135
	 */
cawthron
parents:
diff changeset
   136
	public String getDataBits() {
cawthron
parents:
diff changeset
   137
		return dataBits;
cawthron
parents:
diff changeset
   138
	}
cawthron
parents:
diff changeset
   139
cawthron
parents:
diff changeset
   140
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   141
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#getFlowControl()
cawthron
parents:
diff changeset
   142
	 */
cawthron
parents:
diff changeset
   143
	public String getFlowControl() {
cawthron
parents:
diff changeset
   144
		return flowControl;
cawthron
parents:
diff changeset
   145
	}
cawthron
parents:
diff changeset
   146
cawthron
parents:
diff changeset
   147
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   148
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#getParity()
cawthron
parents:
diff changeset
   149
	 */
cawthron
parents:
diff changeset
   150
	public String getParity() {
cawthron
parents:
diff changeset
   151
		return parity;
cawthron
parents:
diff changeset
   152
	}
cawthron
parents:
diff changeset
   153
cawthron
parents:
diff changeset
   154
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   155
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#getStopBits()
cawthron
parents:
diff changeset
   156
	 */
cawthron
parents:
diff changeset
   157
	public String getStopBits() {
cawthron
parents:
diff changeset
   158
		return stopBits;
cawthron
parents:
diff changeset
   159
	}
cawthron
parents:
diff changeset
   160
cawthron
parents:
diff changeset
   161
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   162
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#setBaudRate(java.lang.String)
cawthron
parents:
diff changeset
   163
	 */
cawthron
parents:
diff changeset
   164
	public void setBaudRate(String inBaudRate) {
cawthron
parents:
diff changeset
   165
		baudRate = inBaudRate;
cawthron
parents:
diff changeset
   166
	}
cawthron
parents:
diff changeset
   167
cawthron
parents:
diff changeset
   168
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   169
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#setComPort(java.lang.String)
cawthron
parents:
diff changeset
   170
	 */
cawthron
parents:
diff changeset
   171
	public void setComPort(String inPort) {
cawthron
parents:
diff changeset
   172
		comPort = inPort;
cawthron
parents:
diff changeset
   173
	}
cawthron
parents:
diff changeset
   174
cawthron
parents:
diff changeset
   175
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   176
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#setDataBits(java.lang.String)
cawthron
parents:
diff changeset
   177
	 */
cawthron
parents:
diff changeset
   178
	public void setDataBits(String inDataBits) {
cawthron
parents:
diff changeset
   179
		dataBits = inDataBits;
cawthron
parents:
diff changeset
   180
	}
cawthron
parents:
diff changeset
   181
cawthron
parents:
diff changeset
   182
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   183
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#setFlowControl(java.lang.String)
cawthron
parents:
diff changeset
   184
	 */
cawthron
parents:
diff changeset
   185
	public void setFlowControl(String inFlowControl) {
cawthron
parents:
diff changeset
   186
		flowControl = inFlowControl;
cawthron
parents:
diff changeset
   187
	}
cawthron
parents:
diff changeset
   188
cawthron
parents:
diff changeset
   189
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   190
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#setParity(java.lang.String)
cawthron
parents:
diff changeset
   191
	 */
cawthron
parents:
diff changeset
   192
	public void setParity(String inParity) {
cawthron
parents:
diff changeset
   193
		parity = inParity;
cawthron
parents:
diff changeset
   194
	}
cawthron
parents:
diff changeset
   195
cawthron
parents:
diff changeset
   196
	/* (non-Javadoc)
cawthron
parents:
diff changeset
   197
	 * @see com.nokia.tcf.api.ITCRealSerialConnection#setStopBits(java.lang.String)
cawthron
parents:
diff changeset
   198
	 */
cawthron
parents:
diff changeset
   199
	public void setStopBits(String inStopBits) {
cawthron
parents:
diff changeset
   200
		stopBits = inStopBits;
cawthron
parents:
diff changeset
   201
	}
cawthron
parents:
diff changeset
   202
	public IStatus setDecodeFormat(String inDecodeFormat) {
cawthron
parents:
diff changeset
   203
		return super.setDecodeFormat(inDecodeFormat);
cawthron
parents:
diff changeset
   204
	}
cawthron
parents:
diff changeset
   205
}