Package de.desy.tine.server.alarms

Source Code of de.desy.tine.server.alarms.TAlarmDefinition5

/*
* Created on Aug 23, 2005
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package de.desy.tine.server.alarms;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import de.desy.tine.definitions.TFormat;
import de.desy.tine.definitions.TStrings;
import de.desy.tine.stringUtils.StringToBytes;
import de.desy.tine.structUtils.TStructBase;
import de.desy.tine.structUtils.TStructDescription;
import de.desy.tine.structUtils.TStructRegistry;

public class TAlarmDefinition5 extends TStructBase
{
  private String almTag; // 16 char
  private int almCode;   // 4 bytes
  private int almMask;   // 4 bytes
  private short almSeverity; // 2 bytes;
  private short almDataFormat; // 1 byte
  private int almDataArraySize; // 1 byte
  private long almTimeResolution; // 4 bytes
  private short almHrtChannel; // 2 bytes
  private short almHrtModule;  // 2 bytes
  private String almText;      // 40 chars
  private String almDeviceText; // 38 chars
  private int almSystem;   // 2 bytes;
  private String almDataText; // 40 chars
  private String almUrl; // 40 chars
  private int numDefinitions; // 4 bytes
  private static TStructDescription almDefStruct = null;
  public static final int sizeInBytes = 200;
  public static void initStructDescription()
  {
    if (almDefStruct != null) return;
    almDefStruct = new TStructDescription("ADS");
    almDefStruct.beginDefinition();
    almDefStruct.addField(TFormat.CF_TEXT, TStrings.ALARM_TAG_SHORTSIZE);
    almDefStruct.addField(TFormat.CF_LONG, 1);
    almDefStruct.addField(TFormat.CF_LONG, 1);
    almDefStruct.addField(TFormat.CF_SHORT, 1);
    almDefStruct.addField(TFormat.CF_BYTE, 1);
    almDefStruct.addField(TFormat.CF_BYTE, 1);
    almDefStruct.addField(TFormat.CF_LONG, 1);
    almDefStruct.addField(TFormat.CF_SHORT, 1);
    almDefStruct.addField(TFormat.CF_SHORT, 1);
    almDefStruct.addField(TFormat.CF_TEXT, TStrings.ALARM_TEXT_SHORTSIZE);
    almDefStruct.addField(TFormat.CF_TEXT, TStrings.ALARM_TEXT_SHORTSIZE-2);
    almDefStruct.addField(TFormat.CF_SHORT, 1);
    almDefStruct.addField(TFormat.CF_TEXT, TStrings.ALARM_TEXT_SHORTSIZE);
    almDefStruct.addField(TFormat.CF_TEXT, TStrings.ALARM_TEXT_SHORTSIZE);
    almDefStruct.addField(TFormat.CF_LONG, 1);
    almDefStruct.setArraySize(100);
    almDefStruct.endDefinition();
    TStructRegistry.add(almDefStruct);
  }
  public void writeData(DataOutput dout) throws IOException
  {
    dout.write(StringToBytes.stringToFixedBytes(almTag, 16));
    dout.writeInt(almCode);
    dout.writeInt(almMask);
    dout.writeShort(almSeverity);
    dout.writeByte(almDataFormat);
    dout.writeByte(almDataArraySize);
    dout.writeInt((int)(almTimeResolution));
    dout.writeShort(almHrtChannel);
    dout.writeShort(almHrtModule);
    dout.write(StringToBytes.stringToFixedBytes(almText, 40));
    dout.write(StringToBytes.stringToFixedBytes(almDeviceText, 38));
    dout.writeShort(almSystem);
    dout.write(StringToBytes.stringToFixedBytes(almDataText, 40));
    dout.write(StringToBytes.stringToFixedBytes(almUrl, 40));
    dout.writeInt(numDefinitions);
  }
  public void readData(DataInput din) throws IOException
  {
    almTag = StringToBytes.readFixedString(din, 16);
    almCode = din.readInt();
    almMask = din.readInt();
    almSeverity = din.readShort();
    almDataFormat = din.readByte();
    almDataArraySize = din.readByte();
    almTimeResolution = din.readInt();
    almHrtChannel = din.readShort();
    almHrtModule = din.readShort();
    almText = StringToBytes.readFixedString(din, 40);
    almDeviceText = StringToBytes.readFixedString(din, 38);
    almSystem = din.readShort();
    almDataText = StringToBytes.readFixedString(din, 40);
    almUrl = StringToBytes.readFixedString(din, 40);
    numDefinitions = din.readInt();
  }
  public TAlarmDefinition5(String tag,String text,String deviceText,int code,int severity,int system)
  {
    initStructDescription();
    almTag = tag == null ? "" : new String(tag);
    almText = text == null ? "" : new String(text);
    almDeviceText = deviceText == null ? "" : new String(deviceText);
    almCode = code;
    almSeverity = (short)severity;
    almSystem = system;
    almDataText = "";
    almUrl = "";
  }
  public TAlarmDefinition5(String tag,String text,String deviceText,int code,int severity,int system,
      int mask,short dataFormat,int dataSize,String dataText,String url)
  {
    initStructDescription();
    almTag = tag == null ? "" : new String(tag);
    almText = text == null ? "" : new String(text);
    almDeviceText = deviceText == null ? "" : new String(deviceText);
    almCode = code;
    almSeverity = (short)severity;
    almSystem = system;
    almMask = mask;
    almDataText = dataText == null ? "" : new String(dataText);
    almDataFormat = dataFormat;
    almDataArraySize = dataSize;
    almUrl = url == null ? "" : new String(url);
  }
  public TAlarmDefinition5(String tag,String text,String deviceText,int code,int severity,int system,
      int mask,short dataFormat,int dataSize,String dataText,String url,
      long timeResolution,short hrtChannel,short hrtModule)
  {
    initStructDescription();
    almTag = tag == null ? "" : new String(tag);
    almText = text == null ? "" : new String(text);
    almDeviceText = deviceText == null ? "" : new String(deviceText);
    almCode = code;
    almSeverity = (short)severity;
    almSystem = system;
    almMask = mask;
    almDataText = dataText == null ? "" : new String(dataText);
    almDataFormat = dataFormat;
    almDataArraySize = dataSize;
    almUrl = url == null ? "" : new String(url);
    almTimeResolution = timeResolution;
    almHrtChannel = hrtChannel;
    almHrtModule = hrtModule;
  }
  // this will need a toByteArray() and a toStruct() method !
  public int getAlmCode()
  {
    return almCode;
  }
  public void setAlmCode(int almCode)
  {
    this.almCode = almCode;
  }
  public int getAlmDataArraySize()
  {
    return almDataArraySize;
  }
  public void setAlmDataArraySize(int almDataArraySize)
  {
    this.almDataArraySize = almDataArraySize;
  }
  public short getAlmDataFormat()
  {
    return almDataFormat;
  }
  public void setAlmDataFormat(short almDataFormat)
  {
    this.almDataFormat = almDataFormat;
  }
  public String getAlmDataText()
  {
    return almDataText;
  }
  public void setAlmDataText(String almDataText)
  {
    this.almDataText = almDataText;
  }
  public String getAlmDeviceText()
  {
    return almDeviceText;
  }
  public void setAlmDeviceText(String almDeviceText)
  {
    this.almDeviceText = almDeviceText;
  }
  public short getAlmHrtChannel()
  {
    return almHrtChannel;
  }
  public void setAlmHrtChannel(short almHrtChannel)
  {
    this.almHrtChannel = almHrtChannel;
  }
  public short getAlmHrtModule()
  {
    return almHrtModule;
  }
  public void setAlmHrtModule(short almHrtModule)
  {
    this.almHrtModule = almHrtModule;
  }
  public int getAlmMask()
  {
    return almMask;
  }
  public void setAlmMask(int almMask)
  {
    this.almMask = almMask;
  }
  public short getAlmSeverity()
  {
    return almSeverity;
  }
  public void setAlmSeverity(short almSeverity)
  {
    this.almSeverity = almSeverity;
  }
  public int getAlmSystem()
  {
    return almSystem;
  }
  public void setAlmSystem(int almSystem)
  {
    this.almSystem = almSystem;
  }
  public String getAlmTag()
  {
    return almTag;
  }
  public void setAlmTag(String almTag)
  {
    this.almTag = almTag;
  }
  public String getAlmText()
  {
    return almText;
  }
  public void setAlmText(String almText)
  {
    this.almText = almText;
  }
  public long getAlmTimeResolution()
  {
    return almTimeResolution;
  }
  public void setAlmTimeResolution(long almTimeResolution)
  {
    this.almTimeResolution = almTimeResolution;
  }
  public String getAlmUrl()
  {
    return almUrl;
  }
  public void setAlmUrl(String almUrl)
  {
    this.almUrl = almUrl;
  }
  public int getNumDefinitions()
  {
    return numDefinitions;
  }
  public void setNumDefinitions(int numDefinitions)
  {
    this.numDefinitions = numDefinitions;
  }
  public static TStructDescription getAlmDefStruct()
  {
    return almDefStruct;
  }
  public static void setAlmDefStruct(TStructDescription almDefStruct)
  {
    TAlarmDefinition5.almDefStruct = almDefStruct;
  }
}
TOP

Related Classes of de.desy.tine.server.alarms.TAlarmDefinition5

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.