com.eurotech.framework.protocol.pcn
Class SnpMessage

java.lang.Object
  extended by com.eurotech.framework.protocol.pcn.SnpMessage

public class SnpMessage
extends Object

Defines SNP Message (Simple Network Protocol)

Author:
ilya.binshtok

Field Summary
static int SNP_HEADER_LENGTH
           
static int SNP_PREAMBLE_LENGTH
           
 
Constructor Summary
SnpMessage(ArrayList msg)
          SnpMessage - Reply constructor
SnpMessage(int src, int dst)
          SnpMessage constructor
SnpMessage(int src, int dst, String command)
          Short SNP message constructor
SnpMessage(int src, int dst, String command, ArrayList paramlist)
          SnpMessage constructor
SnpMessage(String error)
          SnpMessage - Error constructor
 
Method Summary
 void display()
          Displays SNP message.
 byte[] getBytes()
          Answers byte array of the SNP message.
 String getCommand()
          Reports SNP command.
 int getDataLength()
          Reports data length.
 int getDstAddress()
          Reports SNP destination address.
 String getError()
          Reports error message.
 ArrayList getMsg()
          Reports SNP message.
 int getPacketNo()
          Reports packet number.
 byte[] getPayload()
          Reports SNP message payload.
 String getPayloadString()
          Reports SNP message payload.
 int getSrcAddress()
          Reports SNP source address.
 int getTotPacketNo()
          Reports total packet number.
 boolean isPoll()
           
 boolean validCrc16()
          Reports if CRC16 of the reply message is valid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SNP_HEADER_LENGTH

public static final int SNP_HEADER_LENGTH
See Also:
Constant Field Values

SNP_PREAMBLE_LENGTH

public static final int SNP_PREAMBLE_LENGTH
See Also:
Constant Field Values
Constructor Detail

SnpMessage

public SnpMessage(int src,
                  int dst)
           throws EsfException
SnpMessage constructor

Parameters:
src - - source address as int
dst - - destination address as int
Throws:
EsfException

SnpMessage

public SnpMessage(int src,
                  int dst,
                  String command)
           throws EsfException
Short SNP message constructor

Parameters:
int - src - source address as int
int - dst - destination address as int
String - command - SNP command as String
Throws:
EsfException

SnpMessage

public SnpMessage(ArrayList msg)
           throws EsfException
SnpMessage - Reply constructor

Parameters:
msg - - reply message as ArrayList
Throws:
EsfException

SnpMessage

public SnpMessage(String error)
SnpMessage - Error constructor

Parameters:
String - error as String

SnpMessage

public SnpMessage(int src,
                  int dst,
                  String command,
                  ArrayList paramlist)
           throws EsfException
SnpMessage constructor

Parameters:
int - src - source address as int
int - dst - destination address as int
String - command - SNP command as String
ArrayList - paramlist - list of parameters as ArrayList
Throws:
EsfException
Method Detail

getBytes

public byte[] getBytes()
                throws EsfException
Answers byte array of the SNP message.

Returns:
byte [] - SNP message
Throws:
EsfException

validCrc16

public boolean validCrc16()
                   throws EsfException
Reports if CRC16 of the reply message is valid

Returns:
boolean
Throws:
EsfException

isPoll

public boolean isPoll()

display

public void display()
Displays SNP message.


getCommand

public String getCommand()
Reports SNP command.

Returns:
SNP command as String

getSrcAddress

public int getSrcAddress()
Reports SNP source address.

Returns:
source address as int

getDstAddress

public int getDstAddress()
Reports SNP destination address.

Returns:
destination address as int

getTotPacketNo

public int getTotPacketNo()
Reports total packet number.

Returns:
total packet number as int

getPacketNo

public int getPacketNo()
Reports packet number.

Returns:
packet number as int

getDataLength

public int getDataLength()
Reports data length.

Returns:
data length as int

getError

public String getError()
Reports error message.

Returns:
error message as String

getMsg

public ArrayList getMsg()
Reports SNP message.

Returns:
SNP message as String

getPayload

public byte[] getPayload()
Reports SNP message payload.

Returns:
message payload as byte[]

getPayloadString

public String getPayloadString()
Reports SNP message payload.

Returns:
message payload as String


Copyright © 2013. All Rights Reserved.