Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cnrg.itx.datax.devices
Class NetworkSource

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

public class NetworkSource
extends java.lang.Object
implements Source, java.lang.Runnable

Class to implement the network source. The network source acts as the network endpoint of a connection. It listens to the network pushes data into the channel.

Inner Class Summary
`(package private) class` | `NetworkSource.ChannelFeeder` Private class to implement a channel feeder.

Field Summary
`(package private) BufferQueue` | `bq` Buffer to reorder and provide flow control for RTP packets.
`(package private) byte[]` | `bSilence` Holds a the silence packet
`private int` | `bytesWritten` Attribute for storing the number of bytes written by this source.
`(package private) NetworkSource.ChannelFeeder` | `cf` Pulls data from the buffer queue and feeds into the channel.
`private Channel` | `channel` Attribute to store the channel for this source.
`private int` | `iDevice` Attribute for storing the device ID.
`private static int` | `instances` Attribute for storing the device instance number.
`private int` | `iNumPackets` Attribute storing number of packets received for this source
`private int` | `iSampleSize` Sample size.
`private boolean` | `mute`
`(package private) RTPPacketFactory` | `rtpFactory` Allows byte arrays to be converted to rtpPackets
`(package private) java.net.DatagramSocket` | `socket` Attribute for the netowrk socket which acts as the actual source of data.
`private boolean` | `start` Thread start/stop flags
`private java.lang.Thread` | `thread` Attribute to store the thread object.
`private boolean` | `useFECandRTP` Attribute for sprcifying if the FEC and RTP should be used.

Constructor Summary
`NetworkSource(Channel channel, int iSampleSize)` Constructs a Network object.
`NetworkSource(Channel channel, int iSampleSize, boolean useFECandRTP)` Constructs a Network object.

Method Summary
`void` | `close()` Method to close a network source.
`PropertiesCollection` | `getProperties()` Returns a collection of properties supported.
`Stats` | `getStatistics()` Method to get the statistics from the netowrk source
`boolean` | `mute(boolean mute)` Method to mute the network source.
`void` | `run()` Method which acts as a thread and pushes data to the channel.
`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` | `start()` Method to start the network source.
`void` | `stop()` Method to stop a netowrk source.

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### channel

    private Channel channel

  Attribute to store the channel for this source.

### socket

    java.net.DatagramSocket socket

  Attribute for the netowrk socket which acts as the actual source of data.

### start

    private boolean start

  Thread start/stop flags

### mute

    private boolean mute

### 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 source.

### iDevice

    private int iDevice

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

### iSampleSize

    private int iSampleSize

  Sample size.

### bytesWritten

    private int bytesWritten

  Attribute for storing the number of bytes written by this source.

### iNumPackets

    private int iNumPackets

  Attribute storing number of packets received for this source

### thread

    private java.lang.Thread thread

  Attribute to store the thread object.

### bq

    BufferQueue bq

  Buffer to reorder and provide flow control for RTP packets. The bufferQueue is created when we know the other person's inital sequence number.

### cf

    NetworkSource.ChannelFeeder cf

  Pulls data from the buffer queue and feeds into the channel.

### rtpFactory

    RTPPacketFactory rtpFactory

  Allows byte arrays to be converted to rtpPackets

### bSilence

    byte[] bSilence

  Holds a the silence packet

### useFECandRTP

    private boolean useFECandRTP

  Attribute for sprcifying if the FEC and RTP should be used.

Constructor Detail

### NetworkSource

    public NetworkSource(Channel channel,
                         int iSampleSize)
                  throws DataException

  Constructs a Network object. Lets java find the port.

  This is the preferred constructor for this object.

  NOTE: Sample size must be EQUAL across remote destination and local source!

  Parameters:
    `channel` - the Channel that this newtwork source is pushing into
    `iSampleSize` - the sample size of data sent over the network
  Throws:
    DataException - thrown if no port is free on this computer

### NetworkSource

    public NetworkSource(Channel channel,
                         int iSampleSize,
                         boolean useFECandRTP)
                  throws DataException

  Constructs a Network object. Lets java find the port.

  This is the preferred constructor for this object.

  NOTE: Sample size must be EQUAL across remote destination and local source!

  Parameters:
    `channel` - the Channel that this newtwork source is pushing into
    `iSampleSize` - the sample size of data sent over the network
    `useFECandRTP` - true if FEC and RTP have to be used

Method Detail

### start

    public void start()

  Method to start the network source.
  Specified by:
    start in interface Source

### run

    public void run()

  Method which acts as a thread and pushes data to the channel.
  Specified by:
    run in interface java.lang.Runnable

### stop

    public void stop()

  Method to stop a netowrk source.

### close

    public void close()

  Method to close a network source.
  Specified by:
    close in interface Source

### mute

    public boolean mute(boolean mute)

  Method to mute the network source.
  Specified by:
    mute in interface Source
  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()

  Method to get the statistics from the netowrk source
  Returns:
    Stats the statistics object

### getProperties

    public PropertiesCollection getProperties()
                                       throws DataException

  Returns a collection of properties supported.
  Returns:
    a collection of device properties
  Throws:
    DataException - thrown if the device properties cannot be defined

### setProperties

    public void setProperties(PropertiesCollection pc)
                       throws DataException

  Sets the given properties collection into the device
  Parameters:
    `pc` - the set of properties to be set on the device
  Throws:
    DataException - thrown if the provided proerties cannot be set on 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.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD