All Downloads are FREE. Search and download functionalities are using the official Maven repository.

decodes.db.TransportMedium Maven / Gradle / Ivy

Go to download

A collection of software for aggregatting and processing environmental data such as from NOAA GOES satellites.

The newest version!
/*
*  $Id$
*  
*  Open Source Software
*  
*  $Log$
*  Revision 1.7  2016/10/07 14:49:25  mmaloney
*  Updates for Web Report for Gail Monds, LRD.
*
*  Revision 1.6  2015/02/06 18:27:09  mmaloney
*  The HashMap key should be upper case so that search is case insensitive.
*
*  Revision 1.5  2015/01/14 17:22:51  mmaloney
*  Polling implementation
*
*  Revision 1.4  2015/01/06 16:09:32  mmaloney
*  First cut of Polling Modules
*
*  Revision 1.3  2014/08/29 18:24:35  mmaloney
*  6.1 Schema Mods
*
*  Revision 1.2  2014/08/22 17:23:05  mmaloney
*  6.1 Schema Mods and Initial DCP Monitor Implementation
*
*  Revision 1.1.1.1  2014/05/19 15:28:59  mmaloney
*  OPENDCS 6.0 Initial Checkin
*
*  Revision 1.5  2013/03/21 18:27:39  mmaloney
*  DbKey Implementation
*
*/
package decodes.db;

import ilex.util.Logger;
import ilex.util.TextUtil;

/**
Holds all attributes for a Transport Medium
*/
public class TransportMedium extends DatabaseObject
{
	/**
	* The type of this TransportMedium.  This should match one of
	* the TransportMediumType enum values.
	*/
	private String mediumType;

	/**
	* This identifies this particular TransportMedium among all the
	* TransportMedia of this type.  An example of a GOES ID is
	* "CE458E08".  If the medium type is GOES-Random or GOES-Self-Timed,
	* then case is not significant, and this data member is stored in
	* all-uppercase.
	*/
	private String mediumId;

	/**
	* The channel number -- this is used by GOES-type TransportMediums.
	* If this is not used, it will have a value of -1.
	*/
	public int channelNum;

	/**
	* The time of the first transmission, as the second of the day.
	* If this is not used for a particular TransportMedium, it will
	* have a value of -1.
	*/
	public int assignedTime;

	/**
	* Window(?), in number of seconds
	* If this is not used for a particular TransportMedium, it will
	* have a value of -1.
	*/
	public int transmitWindow;

	/**
	* Interval between transmissions, in seconds.
	* If this is not used for a particular TransportMedium, it will
	* have a value of -1.
	*/
	public int transmitInterval;


	/**
	* This is a reference to the Platform to which this TransportMedium
	* applies.  This is never null.
	*/
	public Platform platform;

	/**
	  The name of the script to use to decode data from this TM.
	  This is a 'weak' link to a DECODES script. It is not evaluated until
	  necessary.
	*/
	public String scriptName;

	/**
	  This is the 'hard' reference to the DecodesScript used to decode the
	  data associated with this TransportMedium. It is not evaluated until
	  necessary to decode data.
	*/
	private DecodesScript decodesScript;

	/**
	* A reference to the EquipmentModel associated with this
	* TransportMedium.
	*/
	public EquipmentModel equipmentModel;

	/** Not implemented yet (?)  */
	public PlatformConfig performanceMeasurements;

	/** preamble is a GOES parameter, either S=Short or L=Long. */
	private char preamble;

	/**
	  Value added to GOES message time prior to computing sample times.
	  Defaults to 0. This value accomodates those platforms that take
	  sensor samples very close to the transmission times.
	  Example: Platform samples HG every 30 min., transmits at 00:30:00.
	  The most recent sample in the message is 00:00:00. Set the adjustment
	  to the maximum transmission time.
	*/
	private int timeAdjustment;

	/**
	  Time zone used for decoding data from this transport medium.
	*/
	private String timeZone;
	
	private String loggerType = null;
	private int baud = 0;
	private int stopBits = 0;
	private char parity = 'U'; // unknown
	private int dataBits = 0;
	private boolean doLogin = false;
	private String username = null;
	private String password = null;



	/// Key used for storing this TM in a hash table.
	private String tmKey;

	/**
	* Construct with just a reference to the Platform.
	*/
	public TransportMedium(Platform platform)
	{
		this.platform = platform;
		mediumType = "";
		mediumId = "";
		channelNum = Constants.undefinedIntKey;
		assignedTime = Constants.undefinedIntKey;
		transmitWindow = Constants.undefinedIntKey;
		transmitInterval = Constants.undefinedIntKey;
		scriptName = null;

		this.platform = platform;
		decodesScript = null;
		equipmentModel = null;
		performanceMeasurements = null;
		preamble = Constants.preambleShort;
		timeAdjustment = 0;
		timeZone = null;
	}

	/**
	  Construct with a reference to a Platform, a type and an ID.
	  This is the constructor used when parsing the PlatformList file in
	  the XML database, when the TransportXref element is encountered;
	  e.g.
	  
<TransportXref MediumType="GOES-Self-Timed" MediumId="CE3DB448"/>
@param platform the Platform that owns this TM. @param type the TransportMedium type @param id the TransportMedium unique ID */ public TransportMedium(Platform platform, String type, String id) { this(platform); mediumType = type; setMediumId(id); } /** * This overrides the DatabaseObject's method. This returns * "TransportMedium". @return "TransportMedium"; */ public String getObjectType() { return "TransportMedium"; } /** * @return a string appropriate for use as a unique file name. */ public String makeFileName() { StringBuffer sb; if (mediumType.equalsIgnoreCase(Constants.medium_GoesST) || mediumType.equalsIgnoreCase(Constants.medium_GoesRD)) sb = new StringBuffer("goes-"); else if (mediumType.equalsIgnoreCase("Data-Logger")) sb = new StringBuffer("edl-"); else if (mediumType.equalsIgnoreCase("Modem")) sb = new StringBuffer("modem-"); else sb = new StringBuffer(mediumType + "-"); sb.append(mediumId); for(int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy