C# Class PBCaGw.DataPacket

Handles messages between workers. Can contain either a TCP/UDP packet or an EPICS message
Inheritance: ICloneable
Show file Open project: ISISComputingGroup/EPICS-epicssharp Class Usage Examples

Public Properties

Property Type Description
Data byte[]
Destination System.Net.IPEndPoint
Kind DataPacketKind
ReverseAnswer bool
Sender System.Net.IPEndPoint

Public Methods

Method Description
Clone ( ) : object

Clone this packet, creating an exact copy. As the clone function is an implementation of IClonable it must return an object.

Create ( DataPacket remaining, DataPacket newPacket ) : DataPacket

Merges 2 packets together

Create ( DataPacket packet, UInt32 size, bool reuse = false ) : DataPacket

Creates a new message based on an existing packed and use the "size" to extract only the first part.

Create ( byte buff ) : DataPacket
Create ( byte buff, int size, WorkerChain chain, bool reuseBuffer = false ) : DataPacket

Creates a new message based on the byte buffer however use only the first "size" byte for it.

Create ( int size ) : DataPacket
Create ( int payloadSize, WorkerChain chain ) : DataPacket

Creates a new message with the given payload size and sets the payload size correctly.

GetDataAsString ( ) : string

Retreives the payload as string.

GetUInt16 ( int position ) : UInt16

Returns an UInt16 at a given position

GetUInt32 ( int position ) : UInt32

Returns an UInt32 at a given position

Padding ( int size ) : int
SetBytes ( int position, byte buff ) : void
SetDataAsString ( string str ) : void
SetUInt16 ( int position, UInt16 value ) : void

Writes an UInt16 at a given position

SetUInt32 ( int position, UInt32 value ) : void

Writes an UInt32 at a given position

ShowPools ( ) : void
SkipSize ( UInt32 size, bool reuse = false ) : DataPacket

Skips a given size from the data block

Private Methods

Method Description
DataPacket ( ) : System

Method Details

Clone() public method

Clone this packet, creating an exact copy. As the clone function is an implementation of IClonable it must return an object.
public Clone ( ) : object
return object

Create() public static method

Merges 2 packets together
public static Create ( DataPacket remaining, DataPacket newPacket ) : DataPacket
remaining DataPacket
newPacket DataPacket
return DataPacket

Create() public static method

Creates a new message based on an existing packed and use the "size" to extract only the first part.
public static Create ( DataPacket packet, UInt32 size, bool reuse = false ) : DataPacket
packet DataPacket
size System.UInt32
reuse bool
return DataPacket

Create() public static method

public static Create ( byte buff ) : DataPacket
buff byte
return DataPacket

Create() public static method

Creates a new message based on the byte buffer however use only the first "size" byte for it.
public static Create ( byte buff, int size, WorkerChain chain, bool reuseBuffer = false ) : DataPacket
buff byte
size int
chain PBCaGw.Workers.WorkerChain
reuseBuffer bool
return DataPacket

Create() public static method

public static Create ( int size ) : DataPacket
size int
return DataPacket

Create() public static method

Creates a new message with the given payload size and sets the payload size correctly.
public static Create ( int payloadSize, WorkerChain chain ) : DataPacket
payloadSize int
chain PBCaGw.Workers.WorkerChain
return DataPacket

GetDataAsString() public method

Retreives the payload as string.
public GetDataAsString ( ) : string
return string

GetUInt16() public method

Returns an UInt16 at a given position
public GetUInt16 ( int position ) : UInt16
position int
return System.UInt16

GetUInt32() public method

Returns an UInt32 at a given position
public GetUInt32 ( int position ) : UInt32
position int
return System.UInt32

Padding() public static method

public static Padding ( int size ) : int
size int
return int

SetBytes() public method

public SetBytes ( int position, byte buff ) : void
position int
buff byte
return void

SetDataAsString() public method

public SetDataAsString ( string str ) : void
str string
return void

SetUInt16() public method

Writes an UInt16 at a given position
public SetUInt16 ( int position, UInt16 value ) : void
position int
value System.UInt16
return void

SetUInt32() public method

Writes an UInt32 at a given position
public SetUInt32 ( int position, UInt32 value ) : void
position int
value System.UInt32
return void

ShowPools() public static method

public static ShowPools ( ) : void
return void

SkipSize() public method

Skips a given size from the data block
public SkipSize ( UInt32 size, bool reuse = false ) : DataPacket
size System.UInt32
reuse bool
return DataPacket

Property Details

Data public property

public byte[] Data
return byte[]

Destination public property

public IPEndPoint,System.Net Destination
return System.Net.IPEndPoint

Kind public property

public DataPacketKind Kind
return DataPacketKind

ReverseAnswer public property

Allows to change the sending rules
public bool ReverseAnswer
return bool

Sender public property

public IPEndPoint,System.Net Sender
return System.Net.IPEndPoint