cnrg.itx.datax.devices
Class NetworkDestination

java.lang.Object
  |
  +--cnrg.itx.datax.devices.NetworkDestination

public class NetworkDestination
extends java.lang.Object
implements Destination

Class to act as a channel endpoint. Sends data to the network.


Field Summary
private  int bytesRead
          Attribute for storing the number of bytes written to the stream.
private  FECBuffer fecBuffer
          Class to package up the devices for FEC correction
private  java.net.InetAddress iaPeer
          Attribute to store the peer IPAddress
private  int iDevice
          Attribute for storing the device ID.
private static int instances
          Attribute for storing the device instance number.
private  int iNumPackets
          Attribute to hold number of packets sent
private  int iPort
          Attribute to store peer port
private  boolean mute
          Attribute to store the mute state of the device.
private  RTPPacketFactory rtpFactory
          Creates valid RTP packets out of data with appropriate headers
private  java.net.DatagramSocket socket
          Attribute for storing the datagram socket.
private  boolean useFECandRTP
          If FEC and bufferig is supported.
 
Constructor Summary
NetworkDestination()
          Default constructor to create a network destination.
NetworkDestination(boolean useFECandRTP)
          Constructor for the network device specifying if FEC and buffering should be used.
 
Method Summary
 void close()
          Method to close the network destination
 PropertiesCollection getProperties()
          Returns a collection of properties supported.
 Stats getStatistics()
           
 boolean mute(boolean mute)
          Method to mute the network destination.
 void setPeerProperties(PropertiesCollection pc)
          Interface to set the given properties collection into the device.
 void setProperties(PropertiesCollection pc)
          Sets the given properties collection into the device
 void write(byte[] b)
          Method to write data to the stream.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

bytesRead

private int bytesRead
Attribute for storing the number of bytes written to the stream.

iNumPackets

private int iNumPackets
Attribute to hold number of packets sent

instances

private static int instances
Attribute for storing the device instance number. This is a static attribute and will be incremented in the constructor. This represents the total number of instances of the stream destinations.

iDevice

private int iDevice
Attribute for storing the device ID. This is the value of the instance at the moment.

socket

private java.net.DatagramSocket socket
Attribute for storing the datagram socket.

mute

private boolean mute
Attribute to store the mute state of the device.

iaPeer

private java.net.InetAddress iaPeer
Attribute to store the peer IPAddress

iPort

private int iPort
Attribute to store peer port

fecBuffer

private FECBuffer fecBuffer
Class to package up the devices for FEC correction

rtpFactory

private RTPPacketFactory rtpFactory
Creates valid RTP packets out of data with appropriate headers

useFECandRTP

private boolean useFECandRTP
If FEC and bufferig is supported.
Constructor Detail

NetworkDestination

public NetworkDestination()
                   throws DataException
Default constructor to create a network destination.
Throws:
DataException - thrown if the socket cannot be created

NetworkDestination

public NetworkDestination(boolean useFECandRTP)
                   throws DataException
Constructor for the network device specifying if FEC and buffering should be used.
Parameters:
useFECandRTP - true if FEC and RTP are to be used
Throws:
DataException - thrown if resources cannot be allocated
Method Detail

write

public void write(byte[] b)
           throws DataException
Method to write data to the stream.
Specified by:
write in interface Destination
Parameters:
b - The array of bytes to write to the stream
Throws:
DataException - This is thrown when an IO error occurs

close

public void close()
Method to close the network destination
Specified by:
close in interface Destination

mute

public boolean mute(boolean mute)
Method to mute the network destination.
Specified by:
mute in interface Destination
Parameters:
mute - true if the device has to be muted and false if it has to be activated
Returns:
boolean true if the device was muted and false if it was activated

getStatistics

public Stats getStatistics()

getProperties

public PropertiesCollection getProperties()
                                   throws DataException
Returns a collection of properties supported.

setProperties

public void setProperties(PropertiesCollection pc)
                   throws DataException
Sets the given properties collection into the device

setPeerProperties

public void setPeerProperties(PropertiesCollection pc)
                       throws DataException
Interface to set the given properties collection into the device. WOrks under the assumption that this is the properties collection of the peer.